michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsPrintSettingsGTK_h_ michael@0: #define nsPrintSettingsGTK_h_ michael@0: michael@0: #include "nsPrintSettingsImpl.h" michael@0: michael@0: extern "C" { michael@0: #include michael@0: #if (MOZ_WIDGET_GTK == 2) michael@0: #include michael@0: #include michael@0: #else michael@0: #include michael@0: #endif michael@0: } michael@0: michael@0: #define NS_PRINTSETTINGSGTK_IID \ michael@0: { 0x758df520, 0xc7c3, 0x11dc, { 0x95, 0xff, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } } michael@0: michael@0: michael@0: //***************************************************************************** michael@0: //*** nsPrintSettingsGTK michael@0: //***************************************************************************** michael@0: michael@0: class nsPrintSettingsGTK : public nsPrintSettings michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSGTK_IID) michael@0: michael@0: nsPrintSettingsGTK(); michael@0: virtual ~nsPrintSettingsGTK(); michael@0: michael@0: // We're overriding these methods because we want to read/write with GTK objects, michael@0: // not local variables. This allows a simpler settings implementation between michael@0: // Gecko and GTK. michael@0: michael@0: GtkPageSetup* GetGtkPageSetup() { return mPageSetup; }; michael@0: void SetGtkPageSetup(GtkPageSetup *aPageSetup); michael@0: michael@0: GtkPrintSettings* GetGtkPrintSettings() { return mPrintSettings; }; michael@0: void SetGtkPrintSettings(GtkPrintSettings *aPrintSettings); michael@0: michael@0: GtkPrinter* GetGtkPrinter() { return mGTKPrinter; }; michael@0: void SetGtkPrinter(GtkPrinter *aPrinter); michael@0: michael@0: bool GetForcePrintSelectionOnly() { return mPrintSelectionOnly; }; michael@0: void SetForcePrintSelectionOnly(bool aPrintSelectionOnly) { mPrintSelectionOnly = aPrintSelectionOnly; }; michael@0: michael@0: // If not printing the selection, this is stored in the GtkPrintSettings. Printing the michael@0: // selection is stored as a protected boolean (mPrintSelectionOnly). michael@0: NS_IMETHOD GetPrintRange(int16_t *aPrintRange); michael@0: NS_IMETHOD SetPrintRange(int16_t aPrintRange); michael@0: michael@0: // The page range is stored as as single range in the GtkPrintSettings object. michael@0: NS_IMETHOD GetStartPageRange(int32_t *aStartPageRange); michael@0: NS_IMETHOD SetStartPageRange(int32_t aStartPageRange); michael@0: NS_IMETHOD GetEndPageRange(int32_t *aEndPageRange); michael@0: NS_IMETHOD SetEndPageRange(int32_t aEndPageRange); michael@0: michael@0: // Reversed, color, orientation and file name are all stored in the GtkPrintSettings. michael@0: // Orientation is also stored in the GtkPageSetup and its setting takes priority when getting the orientation. michael@0: NS_IMETHOD GetPrintReversed(bool *aPrintReversed); michael@0: NS_IMETHOD SetPrintReversed(bool aPrintReversed); michael@0: michael@0: NS_IMETHOD GetPrintInColor(bool *aPrintInColor); michael@0: NS_IMETHOD SetPrintInColor(bool aPrintInColor); michael@0: michael@0: NS_IMETHOD GetOrientation(int32_t *aOrientation); michael@0: NS_IMETHOD SetOrientation(int32_t aOrientation); michael@0: michael@0: NS_IMETHOD GetToFileName(char16_t * *aToFileName); michael@0: NS_IMETHOD SetToFileName(const char16_t * aToFileName); michael@0: michael@0: // Gets/Sets the printer name in the GtkPrintSettings. If no printer name is specified there, michael@0: // you will get back the name of the current internal GtkPrinter. michael@0: NS_IMETHOD GetPrinterName(char16_t * *aPrinter); michael@0: NS_IMETHOD SetPrinterName(const char16_t * aPrinter); michael@0: michael@0: // Number of copies is stored/gotten from the GtkPrintSettings. michael@0: NS_IMETHOD GetNumCopies(int32_t *aNumCopies); michael@0: NS_IMETHOD SetNumCopies(int32_t aNumCopies); michael@0: michael@0: NS_IMETHOD GetScaling(double *aScaling); michael@0: NS_IMETHOD SetScaling(double aScaling); michael@0: michael@0: // A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize. michael@0: NS_IMETHOD GetPaperName(char16_t * *aPaperName); michael@0: NS_IMETHOD SetPaperName(const char16_t * aPaperName); michael@0: michael@0: NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin); michael@0: NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop); michael@0: NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft); michael@0: NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom); michael@0: NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight); michael@0: michael@0: NS_IMETHOD GetPaperWidth(double *aPaperWidth); michael@0: NS_IMETHOD SetPaperWidth(double aPaperWidth); michael@0: michael@0: NS_IMETHOD GetPaperHeight(double *aPaperHeight); michael@0: NS_IMETHOD SetPaperHeight(double aPaperHeight); michael@0: michael@0: NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit); michael@0: michael@0: NS_IMETHOD GetEffectivePageSize(double *aWidth, double *aHeight); michael@0: michael@0: NS_IMETHOD SetupSilentPrinting(); michael@0: michael@0: NS_IMETHOD GetPageRanges(nsTArray &aPages); michael@0: michael@0: NS_IMETHOD GetResolution(int32_t *aResolution); michael@0: NS_IMETHOD SetResolution(int32_t aResolution); michael@0: michael@0: NS_IMETHOD GetDuplex(int32_t *aDuplex); michael@0: NS_IMETHOD SetDuplex(int32_t aDuplex); michael@0: michael@0: protected: michael@0: nsPrintSettingsGTK(const nsPrintSettingsGTK& src); michael@0: nsPrintSettingsGTK& operator=(const nsPrintSettingsGTK& rhs); michael@0: michael@0: virtual nsresult _Clone(nsIPrintSettings **_retval); michael@0: virtual nsresult _Assign(nsIPrintSettings *aPS); michael@0: michael@0: GtkUnit GetGTKUnit(int16_t aGeckoUnit); michael@0: void SaveNewPageSize(); michael@0: michael@0: /** michael@0: * Re-initialize mUnwriteableMargin with values from mPageSetup. michael@0: * Should be called whenever mPageSetup is initialized or overwritten. michael@0: */ michael@0: void InitUnwriteableMargin(); michael@0: michael@0: /** michael@0: * On construction: michael@0: * - mPrintSettings, mPageSetup and mPaperSize are just new objects with defaults determined by GTK. michael@0: * - mGTKPrinter is nullptr!!! Remember to be careful when accessing this property. michael@0: */ michael@0: GtkPageSetup* mPageSetup; michael@0: GtkPrintSettings* mPrintSettings; michael@0: GtkPrinter* mGTKPrinter; michael@0: GtkPaperSize* mPaperSize; michael@0: michael@0: bool mPrintSelectionOnly; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsPrintSettingsGTK, NS_PRINTSETTINGSGTK_IID) michael@0: michael@0: michael@0: #endif // nsPrintSettingsGTK_h_