1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/xpwidgets/nsPrintOptionsImpl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsPrintOptionsImpl_h__ 1.11 +#define nsPrintOptionsImpl_h__ 1.12 + 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsIPrintOptions.h" 1.15 +#include "nsIPrintSettingsService.h" 1.16 +#include "nsString.h" 1.17 +#include "nsFont.h" 1.18 + 1.19 +/** 1.20 + * Class nsPrintOptions 1.21 + */ 1.22 +class nsPrintOptions : public nsIPrintOptions, 1.23 + public nsIPrintSettingsService 1.24 +{ 1.25 +public: 1.26 + NS_DECL_ISUPPORTS 1.27 + NS_DECL_NSIPRINTOPTIONS 1.28 + NS_DECL_NSIPRINTSETTINGSSERVICE 1.29 + 1.30 + /** 1.31 + * method Init 1.32 + * Initializes member variables. Every consumer that does manual 1.33 + * creation (instead of do_CreateInstance) needs to call this method 1.34 + * immediately after instantiation. 1.35 + */ 1.36 + virtual nsresult Init(); 1.37 + 1.38 + nsPrintOptions(); 1.39 + virtual ~nsPrintOptions(); 1.40 + 1.41 +protected: 1.42 + void ReadBitFieldPref(const char * aPrefId, int32_t anOption); 1.43 + void WriteBitFieldPref(const char * aPrefId, int32_t anOption); 1.44 + void ReadJustification(const char * aPrefId, int16_t& aJust, 1.45 + int16_t aInitValue); 1.46 + void WriteJustification(const char * aPrefId, int16_t aJust); 1.47 + void ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips, 1.48 + const char * aMarginPref); 1.49 + void WriteInchesFromTwipsPref(const char * aPrefId, int32_t aTwips); 1.50 + void ReadInchesIntToTwipsPref(const char * aPrefId, int32_t& aTwips, 1.51 + const char * aMarginPref); 1.52 + void WriteInchesIntFromTwipsPref(const char * aPrefId, int32_t aTwips); 1.53 + 1.54 + nsresult ReadPrefDouble(const char * aPrefId, double& aVal); 1.55 + nsresult WritePrefDouble(const char * aPrefId, double aVal); 1.56 + 1.57 + /** 1.58 + * method ReadPrefs 1.59 + * @param aPS a pointer to the printer settings 1.60 + * @param aPrinterName the name of the printer for which to read prefs 1.61 + * @param aFlags flag specifying which prefs to read 1.62 + */ 1.63 + virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString& 1.64 + aPrinterName, uint32_t aFlags); 1.65 + /** 1.66 + * method WritePrefs 1.67 + * @param aPS a pointer to the printer settings 1.68 + * @param aPrinterName the name of the printer for which to write prefs 1.69 + * @param aFlags flag specifying which prefs to read 1.70 + */ 1.71 + virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrefName, 1.72 + uint32_t aFlags); 1.73 + const char* GetPrefName(const char * aPrefName, 1.74 + const nsAString& aPrinterName); 1.75 + 1.76 + /** 1.77 + * method _CreatePrintSettings 1.78 + * May be implemented by the platform-specific derived class 1.79 + * 1.80 + * @return printer settings instance 1.81 + */ 1.82 + virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval); 1.83 + 1.84 + // Members 1.85 + nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings; 1.86 + 1.87 + nsCString mPrefName; 1.88 + 1.89 +private: 1.90 + // These are not supported and are not implemented! 1.91 + nsPrintOptions(const nsPrintOptions& x); 1.92 + nsPrintOptions& operator=(const nsPrintOptions& x); 1.93 +}; 1.94 + 1.95 +#endif /* nsPrintOptionsImpl_h__ */