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 nsPrintOptionsImpl_h__ michael@0: #define nsPrintOptionsImpl_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIPrintOptions.h" michael@0: #include "nsIPrintSettingsService.h" michael@0: #include "nsString.h" michael@0: #include "nsFont.h" michael@0: michael@0: /** michael@0: * Class nsPrintOptions michael@0: */ michael@0: class nsPrintOptions : public nsIPrintOptions, michael@0: public nsIPrintSettingsService michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIPRINTOPTIONS michael@0: NS_DECL_NSIPRINTSETTINGSSERVICE michael@0: michael@0: /** michael@0: * method Init michael@0: * Initializes member variables. Every consumer that does manual michael@0: * creation (instead of do_CreateInstance) needs to call this method michael@0: * immediately after instantiation. michael@0: */ michael@0: virtual nsresult Init(); michael@0: michael@0: nsPrintOptions(); michael@0: virtual ~nsPrintOptions(); michael@0: michael@0: protected: michael@0: void ReadBitFieldPref(const char * aPrefId, int32_t anOption); michael@0: void WriteBitFieldPref(const char * aPrefId, int32_t anOption); michael@0: void ReadJustification(const char * aPrefId, int16_t& aJust, michael@0: int16_t aInitValue); michael@0: void WriteJustification(const char * aPrefId, int16_t aJust); michael@0: void ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips, michael@0: const char * aMarginPref); michael@0: void WriteInchesFromTwipsPref(const char * aPrefId, int32_t aTwips); michael@0: void ReadInchesIntToTwipsPref(const char * aPrefId, int32_t& aTwips, michael@0: const char * aMarginPref); michael@0: void WriteInchesIntFromTwipsPref(const char * aPrefId, int32_t aTwips); michael@0: michael@0: nsresult ReadPrefDouble(const char * aPrefId, double& aVal); michael@0: nsresult WritePrefDouble(const char * aPrefId, double aVal); michael@0: michael@0: /** michael@0: * method ReadPrefs michael@0: * @param aPS a pointer to the printer settings michael@0: * @param aPrinterName the name of the printer for which to read prefs michael@0: * @param aFlags flag specifying which prefs to read michael@0: */ michael@0: virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString& michael@0: aPrinterName, uint32_t aFlags); michael@0: /** michael@0: * method WritePrefs michael@0: * @param aPS a pointer to the printer settings michael@0: * @param aPrinterName the name of the printer for which to write prefs michael@0: * @param aFlags flag specifying which prefs to read michael@0: */ michael@0: virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrefName, michael@0: uint32_t aFlags); michael@0: const char* GetPrefName(const char * aPrefName, michael@0: const nsAString& aPrinterName); michael@0: michael@0: /** michael@0: * method _CreatePrintSettings michael@0: * May be implemented by the platform-specific derived class michael@0: * michael@0: * @return printer settings instance michael@0: */ michael@0: virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval); michael@0: michael@0: // Members michael@0: nsCOMPtr mGlobalPrintSettings; michael@0: michael@0: nsCString mPrefName; michael@0: michael@0: private: michael@0: // These are not supported and are not implemented! michael@0: nsPrintOptions(const nsPrintOptions& x); michael@0: nsPrintOptions& operator=(const nsPrintOptions& x); michael@0: }; michael@0: michael@0: #endif /* nsPrintOptionsImpl_h__ */