Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / widget / src / xpwidgets / nsPrintOptionsImpl.h
blob15c07367a581580e21ecca752a73558dc391830a
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Travis Bogard <travis@netscape.com>
25 * Jessica Blanco <jblanco@us.ibm.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef nsPrintOptionsImpl_h__
42 #define nsPrintOptionsImpl_h__
44 #include "nsCOMPtr.h"
45 #include "nsIPrintOptions.h"
46 #include "nsIPrintSettingsService.h"
47 #include "nsIPrefBranch.h"
48 #include "nsString.h"
49 #include "nsFont.h"
51 /**
52 * Class nsPrintOptions
54 class nsPrintOptions : public nsIPrintOptions,
55 public nsIPrintSettingsService
57 public:
58 NS_DECL_ISUPPORTS
59 NS_DECL_NSIPRINTOPTIONS
60 NS_DECL_NSIPRINTSETTINGSSERVICE
62 /**
63 * method Init
64 * Initializes member variables. Every consumer that does manual
65 * creation (instead of do_CreateInstance) needs to call this method
66 * immediately after instantiation.
68 virtual nsresult Init();
70 nsPrintOptions();
71 virtual ~nsPrintOptions();
73 protected:
74 void ReadBitFieldPref(const char * aPrefId, PRInt32 anOption);
75 void WriteBitFieldPref(const char * aPrefId, PRInt32 anOption);
76 void ReadJustification(const char * aPrefId, PRInt16& aJust,
77 PRInt16 aInitValue);
78 void WriteJustification(const char * aPrefId, PRInt16 aJust);
79 void ReadInchesToTwipsPref(const char * aPrefId, nscoord& aTwips,
80 const char * aMarginPref);
81 void WriteInchesFromTwipsPref(const char * aPrefId, nscoord aTwips);
82 void ReadInchesIntToTwipsPref(const char * aPrefId, nscoord& aTwips,
83 const char * aMarginPref);
84 void WriteInchesIntFromTwipsPref(const char * aPrefId, nscoord aTwips);
86 nsresult ReadPrefString(const char * aPrefId, nsAString& aString);
87 /**
88 * method WritePrefString
89 * Writes PRUnichar* to Prefs and deletes the contents of aString
91 nsresult WritePrefString(const char * aPrefId, const nsAString& aString);
92 nsresult WritePrefString(PRUnichar*& aStr, const char* aPrefId);
93 nsresult ReadPrefDouble(const char * aPrefId, double& aVal);
94 nsresult WritePrefDouble(const char * aPrefId, double aVal);
96 /**
97 * method ReadPrefs
98 * @param aPS a pointer to the printer settings
99 * @param aPrinterName the name of the printer for which to read prefs
100 * @param aFlags flag specifying which prefs to read
102 virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString&
103 aPrinterName, PRUint32 aFlags);
105 * method WritePrefs
106 * @param aPS a pointer to the printer settings
107 * @param aPrinterName the name of the printer for which to write prefs
108 * @param aFlags flag specifying which prefs to read
110 virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrefName,
111 PRUint32 aFlags);
112 const char* GetPrefName(const char * aPrefName,
113 const nsAString& aPrinterName);
116 * method _CreatePrintSettings
117 * May be implemented by the platform-specific derived class
119 * @return printer settings instance
121 virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
123 // Members
124 nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
126 nsCString mPrefName;
128 nsCOMPtr<nsIPrefBranch> mPrefBranch;
130 private:
131 // These are not supported and are not implemented!
132 nsPrintOptions(const nsPrintOptions& x);
133 nsPrintOptions& operator=(const nsPrintOptions& x);
136 #endif /* nsPrintOptionsImpl_h__ */