gfx/thebes/gfxPSSurface.h
author ffxbld
Thu, 13 Feb 2014 19:59:34 -0500
branchGECKO280b3_2014021319_RELBRANCH
changeset 176295 1f89dd5f5d38ea7361e472ec5ae547f8c338f04c
parent 145708 8fed67bc814d173ddba7083a1a6e6669456b7a2e
child 231662 45ed883185742a2ac8f804a3e283ff32e1075bc5
permissions -rw-r--r--
Automated checkin: version bump for firefox 28.0b3 release. DONTBUILD CLOSED TREE a=release

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef GFX_PSSURFACE_H
#define GFX_PSSURFACE_H

#include "gfxASurface.h"

/* for the output stream */
#include "nsCOMPtr.h"
#include "nsIOutputStream.h"
#include "gfxContext.h"

class gfxPSSurface : public gfxASurface {
public:
    enum PageOrientation {
        PORTRAIT,
        LANDSCAPE
    };

    gfxPSSurface(nsIOutputStream *aStream, const gfxSize& aSizeInPoints, PageOrientation aOrientation);
    virtual ~gfxPSSurface();

    virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
    virtual nsresult EndPrinting();
    virtual nsresult AbortPrinting();
    virtual nsresult BeginPage();
    virtual nsresult EndPage();
    virtual void Finish();

    void SetDPI(double x, double y);
    void GetDPI(double *xDPI, double *yDPI);

    virtual bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); }

    // this is in points!
    virtual const gfxIntSize GetSize() const
    {
        return mSize;
    }

    virtual int32_t GetDefaultContextFlags() const
    {
        return gfxContext::FLAG_SIMPLIFY_OPERATORS |
               gfxContext::FLAG_DISABLE_SNAPPING;
    }

private:
    nsCOMPtr<nsIOutputStream> mStream;
    double mXDPI;
    double mYDPI;
    gfxIntSize mSize;
    PageOrientation mOrientation;
};

#endif /* GFX_PSSURFACE_H */