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

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

mercurial