1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/thebes/gfxPDFSurface.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_PDFSURFACE_H 1.10 +#define GFX_PDFSURFACE_H 1.11 + 1.12 +#include "gfxASurface.h" 1.13 +#include "gfxContext.h" 1.14 + 1.15 +/* for the output stream */ 1.16 +#include "nsCOMPtr.h" 1.17 +#include "nsIOutputStream.h" 1.18 + 1.19 +class gfxPDFSurface : public gfxASurface { 1.20 +public: 1.21 + gfxPDFSurface(nsIOutputStream *aStream, const gfxSize& aSizeInPoints); 1.22 + virtual ~gfxPDFSurface(); 1.23 + 1.24 + virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName); 1.25 + virtual nsresult EndPrinting(); 1.26 + virtual nsresult AbortPrinting(); 1.27 + virtual nsresult BeginPage(); 1.28 + virtual nsresult EndPage(); 1.29 + virtual void Finish(); 1.30 + 1.31 + void SetDPI(double x, double y); 1.32 + void GetDPI(double *xDPI, double *yDPI); 1.33 + 1.34 + // this is in points! 1.35 + virtual const gfxIntSize GetSize() const 1.36 + { 1.37 + return gfxIntSize(mSize.width, mSize.height); 1.38 + } 1.39 + 1.40 + virtual int32_t GetDefaultContextFlags() const 1.41 + { 1.42 + return gfxContext::FLAG_SIMPLIFY_OPERATORS | 1.43 + gfxContext::FLAG_DISABLE_SNAPPING | 1.44 + gfxContext::FLAG_DISABLE_COPY_BACKGROUND; 1.45 + } 1.46 + 1.47 +private: 1.48 + nsCOMPtr<nsIOutputStream> mStream; 1.49 + double mXDPI; 1.50 + double mYDPI; 1.51 + gfxSize mSize; 1.52 +}; 1.53 + 1.54 +#endif /* GFX_PDFSURFACE_H */