1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsPrintSettingsService_h
8 #define nsPrintSettingsService_h
11 #include "nsIPrintSettings.h"
12 #include "nsIPrintSettingsService.h"
17 * Class nsPrintSettingsService. Base class for the platform specific widget
18 * subclasses to inherit from.
20 class nsPrintSettingsService
: public nsIPrintSettingsService
{
23 NS_DECL_NSIPRINTSETTINGSSERVICE
25 nsPrintSettingsService() = default;
29 * Initializes member variables. Every consumer that does manual
30 * creation (instead of do_CreateInstance) needs to call this method
31 * immediately after instantiation.
33 virtual nsresult
Init();
36 // Copying is not supported.
37 nsPrintSettingsService(const nsPrintSettingsService
& x
) = delete;
38 nsPrintSettingsService
& operator=(const nsPrintSettingsService
& x
) = delete;
41 virtual ~nsPrintSettingsService() = default;
43 void ReadBitFieldPref(const char* aPrefId
, int32_t anOption
);
44 void WriteBitFieldPref(const char* aPrefId
, int32_t anOption
);
45 void ReadJustification(const char* aPrefId
, int16_t& aJust
,
47 void WriteJustification(const char* aPrefId
, int16_t aJust
);
48 bool ReadInchesToTwipsPref(const char* aPrefId
, int32_t& aTwips
);
49 void WriteInchesFromTwipsPref(const char* aPrefId
, int32_t aTwips
);
50 bool ReadInchesIntToTwipsPref(const char* aPrefId
, int32_t& aTwips
);
51 void WriteInchesIntFromTwipsPref(const char* aPrefId
, int32_t aTwips
);
53 nsresult
ReadPrefDouble(const char* aPrefId
, double& aVal
);
54 nsresult
WritePrefDouble(const char* aPrefId
, double aVal
);
58 * @param aPS a pointer to the printer settings
59 * @param aPrinterName the name of the printer for which to read prefs
60 * @param aFlags flag specifying which prefs to read
62 virtual nsresult
ReadPrefs(nsIPrintSettings
* aPS
,
63 const nsAString
& aPrinterName
, uint32_t aFlags
);
66 * @param aPS a pointer to the printer settings
67 * @param aPrinterName the name of the printer for which to write prefs
68 * @param aFlags flag specifying which prefs to read
70 virtual nsresult
WritePrefs(nsIPrintSettings
* aPS
,
71 const nsAString
& aPrinterName
, uint32_t aFlags
);
73 const char* GetPrefName(const char* aPrefName
, const nsAString
& aPrinterName
);
76 * method _CreatePrintSettings
77 * May be implemented by the platform-specific derived class
79 * @return printer settings instance
81 virtual nsresult
_CreatePrintSettings(nsIPrintSettings
** _retval
) = 0;
87 #endif // nsPrintSettingsService_h