widget/xpwidgets/nsPrintOptionsImpl.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsPrintOptionsImpl_h__
michael@0 8 #define nsPrintOptionsImpl_h__
michael@0 9
michael@0 10 #include "nsCOMPtr.h"
michael@0 11 #include "nsIPrintOptions.h"
michael@0 12 #include "nsIPrintSettingsService.h"
michael@0 13 #include "nsString.h"
michael@0 14 #include "nsFont.h"
michael@0 15
michael@0 16 /**
michael@0 17 * Class nsPrintOptions
michael@0 18 */
michael@0 19 class nsPrintOptions : public nsIPrintOptions,
michael@0 20 public nsIPrintSettingsService
michael@0 21 {
michael@0 22 public:
michael@0 23 NS_DECL_ISUPPORTS
michael@0 24 NS_DECL_NSIPRINTOPTIONS
michael@0 25 NS_DECL_NSIPRINTSETTINGSSERVICE
michael@0 26
michael@0 27 /**
michael@0 28 * method Init
michael@0 29 * Initializes member variables. Every consumer that does manual
michael@0 30 * creation (instead of do_CreateInstance) needs to call this method
michael@0 31 * immediately after instantiation.
michael@0 32 */
michael@0 33 virtual nsresult Init();
michael@0 34
michael@0 35 nsPrintOptions();
michael@0 36 virtual ~nsPrintOptions();
michael@0 37
michael@0 38 protected:
michael@0 39 void ReadBitFieldPref(const char * aPrefId, int32_t anOption);
michael@0 40 void WriteBitFieldPref(const char * aPrefId, int32_t anOption);
michael@0 41 void ReadJustification(const char * aPrefId, int16_t& aJust,
michael@0 42 int16_t aInitValue);
michael@0 43 void WriteJustification(const char * aPrefId, int16_t aJust);
michael@0 44 void ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips,
michael@0 45 const char * aMarginPref);
michael@0 46 void WriteInchesFromTwipsPref(const char * aPrefId, int32_t aTwips);
michael@0 47 void ReadInchesIntToTwipsPref(const char * aPrefId, int32_t& aTwips,
michael@0 48 const char * aMarginPref);
michael@0 49 void WriteInchesIntFromTwipsPref(const char * aPrefId, int32_t aTwips);
michael@0 50
michael@0 51 nsresult ReadPrefDouble(const char * aPrefId, double& aVal);
michael@0 52 nsresult WritePrefDouble(const char * aPrefId, double aVal);
michael@0 53
michael@0 54 /**
michael@0 55 * method ReadPrefs
michael@0 56 * @param aPS a pointer to the printer settings
michael@0 57 * @param aPrinterName the name of the printer for which to read prefs
michael@0 58 * @param aFlags flag specifying which prefs to read
michael@0 59 */
michael@0 60 virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString&
michael@0 61 aPrinterName, uint32_t aFlags);
michael@0 62 /**
michael@0 63 * method WritePrefs
michael@0 64 * @param aPS a pointer to the printer settings
michael@0 65 * @param aPrinterName the name of the printer for which to write prefs
michael@0 66 * @param aFlags flag specifying which prefs to read
michael@0 67 */
michael@0 68 virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrefName,
michael@0 69 uint32_t aFlags);
michael@0 70 const char* GetPrefName(const char * aPrefName,
michael@0 71 const nsAString& aPrinterName);
michael@0 72
michael@0 73 /**
michael@0 74 * method _CreatePrintSettings
michael@0 75 * May be implemented by the platform-specific derived class
michael@0 76 *
michael@0 77 * @return printer settings instance
michael@0 78 */
michael@0 79 virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
michael@0 80
michael@0 81 // Members
michael@0 82 nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
michael@0 83
michael@0 84 nsCString mPrefName;
michael@0 85
michael@0 86 private:
michael@0 87 // These are not supported and are not implemented!
michael@0 88 nsPrintOptions(const nsPrintOptions& x);
michael@0 89 nsPrintOptions& operator=(const nsPrintOptions& x);
michael@0 90 };
michael@0 91
michael@0 92 #endif /* nsPrintOptionsImpl_h__ */

mercurial