LCOV - code coverage report
Current view: directory - widget/gtk2 - nsPrintSettingsGTK.h (source / functions) Found Hit Coverage
Test: app.info Lines: 4 0 0.0 %
Date: 2012-06-02 Functions: 4 0 0.0 %

       1                 : /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  *
       3                 :  * ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       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/
      10                 :  *
      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.
      15                 :  *
      16                 :  * The Original Code is the Mozilla browser.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is Mozilla Foundation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2008
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Michael Ventnor <m.ventnor@gmail.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef nsPrintSettingsGTK_h_
      40                 : #define nsPrintSettingsGTK_h_
      41                 : 
      42                 : #include "nsPrintSettingsImpl.h"
      43                 : 
      44                 : extern "C" {
      45                 : #include <gtk/gtk.h>
      46                 : #include <gtk/gtkprinter.h>
      47                 : #include <gtk/gtkprintjob.h>
      48                 : }
      49                 : 
      50                 : #define NS_PRINTSETTINGSGTK_IID \
      51                 : { 0x758df520, 0xc7c3, 0x11dc, { 0x95, 0xff, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
      52                 :  
      53                 : 
      54                 : //*****************************************************************************
      55                 : //***    nsPrintSettingsGTK
      56                 : //*****************************************************************************
      57                 : 
      58                 : class nsPrintSettingsGTK : public nsPrintSettings
      59                 : {
      60                 : public:
      61                 :   NS_DECL_ISUPPORTS_INHERITED
      62                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSGTK_IID)
      63                 : 
      64                 :   nsPrintSettingsGTK();
      65                 :   virtual ~nsPrintSettingsGTK();
      66                 : 
      67                 :   // We're overriding these methods because we want to read/write with GTK objects,
      68                 :   // not local variables. This allows a simpler settings implementation between
      69                 :   // Gecko and GTK.
      70                 : 
      71               0 :   GtkPageSetup* GetGtkPageSetup() { return mPageSetup; };
      72                 :   void SetGtkPageSetup(GtkPageSetup *aPageSetup);
      73                 : 
      74               0 :   GtkPrintSettings* GetGtkPrintSettings() { return mPrintSettings; };
      75                 :   void SetGtkPrintSettings(GtkPrintSettings *aPrintSettings);
      76                 : 
      77               0 :   GtkPrinter* GetGtkPrinter() { return mGTKPrinter; };
      78                 :   void SetGtkPrinter(GtkPrinter *aPrinter);
      79                 : 
      80                 :   bool GetForcePrintSelectionOnly() { return mPrintSelectionOnly; };
      81               0 :   void SetForcePrintSelectionOnly(bool aPrintSelectionOnly) { mPrintSelectionOnly = aPrintSelectionOnly; };
      82                 : 
      83                 :   // If not printing the selection, this is stored in the GtkPrintSettings. Printing the
      84                 :   // selection is stored as a protected boolean (mPrintSelectionOnly).
      85                 :   NS_IMETHOD GetPrintRange(PRInt16 *aPrintRange);
      86                 :   NS_IMETHOD SetPrintRange(PRInt16 aPrintRange);
      87                 : 
      88                 :   // The page range is stored as as single range in the GtkPrintSettings object.
      89                 :   NS_IMETHOD GetStartPageRange(PRInt32 *aStartPageRange);
      90                 :   NS_IMETHOD SetStartPageRange(PRInt32 aStartPageRange);
      91                 :   NS_IMETHOD GetEndPageRange(PRInt32 *aEndPageRange);
      92                 :   NS_IMETHOD SetEndPageRange(PRInt32 aEndPageRange);
      93                 : 
      94                 :   // Reversed, color, orientation and file name are all stored in the GtkPrintSettings.
      95                 :   // Orientation is also stored in the GtkPageSetup and its setting takes priority when getting the orientation.
      96                 :   NS_IMETHOD GetPrintReversed(bool *aPrintReversed);
      97                 :   NS_IMETHOD SetPrintReversed(bool aPrintReversed);
      98                 : 
      99                 :   NS_IMETHOD GetPrintInColor(bool *aPrintInColor);
     100                 :   NS_IMETHOD SetPrintInColor(bool aPrintInColor);
     101                 : 
     102                 :   NS_IMETHOD GetOrientation(PRInt32 *aOrientation);
     103                 :   NS_IMETHOD SetOrientation(PRInt32 aOrientation);
     104                 : 
     105                 :   NS_IMETHOD GetToFileName(PRUnichar * *aToFileName);
     106                 :   NS_IMETHOD SetToFileName(const PRUnichar * aToFileName);
     107                 : 
     108                 :   // Gets/Sets the printer name in the GtkPrintSettings. If no printer name is specified there,
     109                 :   // you will get back the name of the current internal GtkPrinter.
     110                 :   NS_IMETHOD GetPrinterName(PRUnichar * *aPrinter);
     111                 :   NS_IMETHOD SetPrinterName(const PRUnichar * aPrinter);
     112                 : 
     113                 :   // Number of copies is stored/gotten from the GtkPrintSettings.
     114                 :   NS_IMETHOD GetNumCopies(PRInt32 *aNumCopies);
     115                 :   NS_IMETHOD SetNumCopies(PRInt32 aNumCopies);
     116                 : 
     117                 :   NS_IMETHOD GetScaling(double *aScaling);
     118                 :   NS_IMETHOD SetScaling(double aScaling);
     119                 : 
     120                 :   // A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize.
     121                 :   NS_IMETHOD GetPaperName(PRUnichar * *aPaperName);
     122                 :   NS_IMETHOD SetPaperName(const PRUnichar * aPaperName);
     123                 : 
     124                 :   NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin);
     125                 :   NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop);
     126                 :   NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft);
     127                 :   NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom);
     128                 :   NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight);
     129                 : 
     130                 :   NS_IMETHOD GetPaperWidth(double *aPaperWidth);
     131                 :   NS_IMETHOD SetPaperWidth(double aPaperWidth);
     132                 : 
     133                 :   NS_IMETHOD GetPaperHeight(double *aPaperHeight);
     134                 :   NS_IMETHOD SetPaperHeight(double aPaperHeight);
     135                 : 
     136                 :   NS_IMETHOD SetPaperSizeUnit(PRInt16 aPaperSizeUnit);
     137                 : 
     138                 :   NS_IMETHOD GetEffectivePageSize(double *aWidth, double *aHeight);
     139                 : 
     140                 :   NS_IMETHOD SetupSilentPrinting();
     141                 : 
     142                 :   NS_IMETHOD GetPageRanges(nsTArray<PRInt32> &aPages);
     143                 : 
     144                 : protected:
     145                 :   nsPrintSettingsGTK(const nsPrintSettingsGTK& src);
     146                 :   nsPrintSettingsGTK& operator=(const nsPrintSettingsGTK& rhs);
     147                 : 
     148                 :   virtual nsresult _Clone(nsIPrintSettings **_retval);
     149                 :   virtual nsresult _Assign(nsIPrintSettings *aPS);
     150                 : 
     151                 :   GtkUnit GetGTKUnit(PRInt16 aGeckoUnit);
     152                 :   void SaveNewPageSize();
     153                 : 
     154                 :   /**
     155                 :    * Re-initialize mUnwriteableMargin with values from mPageSetup.
     156                 :    * Should be called whenever mPageSetup is initialized or overwritten.
     157                 :    */
     158                 :   void InitUnwriteableMargin();
     159                 : 
     160                 :   /**
     161                 :    * On construction:
     162                 :    * - mPrintSettings, mPageSetup and mPaperSize are just new objects with defaults determined by GTK.
     163                 :    * - mGTKPrinter is NULL!!! Remember to be careful when accessing this property.
     164                 :    */
     165                 :   GtkPageSetup* mPageSetup;
     166                 :   GtkPrintSettings* mPrintSettings;
     167                 :   GtkPrinter* mGTKPrinter;
     168                 :   GtkPaperSize* mPaperSize;
     169                 : 
     170                 :   bool mPrintSelectionOnly;
     171                 : };
     172                 : 
     173                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsPrintSettingsGTK, NS_PRINTSETTINGSGTK_IID)
     174                 : 
     175                 : 
     176                 : #endif // nsPrintSettingsGTK_h_

Generated by: LCOV version 1.7