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
10 #include "mozilla/embedding/PPrinting.h"
12 #include "nsIPrintSettings.h"
13 #include "nsIPrintSettingsService.h"
18 * Class nsPrintSettingsService. Base class for the platform specific widget
19 * subclasses to inherit from.
21 class nsPrintSettingsService
: public nsIPrintSettingsService
{
24 NS_DECL_NSIPRINTSETTINGSSERVICE
26 nsPrintSettingsService() = default;
30 * Initializes member variables. Every consumer that does manual
31 * creation (instead of do_CreateInstance) needs to call this method
32 * immediately after instantiation.
34 virtual nsresult
Init();
37 // Copying is not supported.
38 nsPrintSettingsService(const nsPrintSettingsService
& x
) = delete;
39 nsPrintSettingsService
& operator=(const nsPrintSettingsService
& x
) = delete;
42 virtual ~nsPrintSettingsService() = default;
44 void ReadBitFieldPref(const char* aPrefId
, int32_t anOption
);
45 void WriteBitFieldPref(const char* aPrefId
, int32_t anOption
);
46 void ReadJustification(const char* aPrefId
, int16_t& aJust
,
48 void WriteJustification(const char* aPrefId
, int16_t aJust
);
49 void ReadInchesToTwipsPref(const char* aPrefId
, int32_t& aTwips
,
50 const char* aMarginPref
);
51 void WriteInchesFromTwipsPref(const char* aPrefId
, int32_t aTwips
);
52 void ReadInchesIntToTwipsPref(const char* aPrefId
, int32_t& aTwips
,
53 const char* aMarginPref
);
54 void WriteInchesIntFromTwipsPref(const char* aPrefId
, int32_t aTwips
);
56 nsresult
ReadPrefDouble(const char* aPrefId
, double& aVal
);
57 nsresult
WritePrefDouble(const char* aPrefId
, double aVal
);
61 * @param aPS a pointer to the printer settings
62 * @param aPrinterName the name of the printer for which to read prefs
63 * @param aFlags flag specifying which prefs to read
65 virtual nsresult
ReadPrefs(nsIPrintSettings
* aPS
,
66 const nsAString
& aPrinterName
, uint32_t aFlags
);
69 * @param aPS a pointer to the printer settings
70 * @param aPrinterName the name of the printer for which to write prefs
71 * @param aFlags flag specifying which prefs to read
73 virtual nsresult
WritePrefs(nsIPrintSettings
* aPS
,
74 const nsAString
& aPrinterName
, uint32_t aFlags
);
76 const char* GetPrefName(const char* aPrefName
, const nsAString
& aPrinterName
);
79 * method _CreatePrintSettings
80 * May be implemented by the platform-specific derived class
82 * @return printer settings instance
84 virtual nsresult
_CreatePrintSettings(nsIPrintSettings
** _retval
) = 0;
90 #endif // nsPrintSettingsService_h