widget/windows/nsDeviceContextSpecWin.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsDeviceContextSpecWin_h___
     7 #define nsDeviceContextSpecWin_h___
     9 #include "nsCOMPtr.h"
    10 #include "nsIDeviceContextSpec.h"
    11 #include "nsIPrintOptions.h" // For nsIPrinterEnumerator
    12 #include "nsIPrintSettings.h"
    13 #include "nsISupportsPrimitives.h"
    14 #include <windows.h>
    15 #include "mozilla/Attributes.h"
    17 class nsIWidget;
    19 class nsDeviceContextSpecWin : public nsIDeviceContextSpec
    20 {
    21 public:
    22   nsDeviceContextSpecWin();
    24   NS_DECL_ISUPPORTS
    26   NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
    27   NS_IMETHOD BeginDocument(const nsAString& aTitle,
    28                            char16_t*       aPrintToFileName,
    29                            int32_t          aStartPage,
    30                            int32_t          aEndPage) { return NS_OK; }
    31   NS_IMETHOD EndDocument() { return NS_OK; }
    32   NS_IMETHOD BeginPage() { return NS_OK; }
    33   NS_IMETHOD EndPage() { return NS_OK; }
    35   NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
    37   void GetDriverName(wchar_t *&aDriverName) const   { aDriverName = mDriverName;     }
    38   void GetDeviceName(wchar_t *&aDeviceName) const   { aDeviceName = mDeviceName;     }
    40   // The GetDevMode will return a pointer to a DevMode
    41   // whether it is from the Global memory handle or just the DevMode
    42   // To get the DevMode from the Global memory Handle it must lock it 
    43   // So this call must be paired with a call to UnlockGlobalHandle
    44   void GetDevMode(LPDEVMODEW &aDevMode);
    46   // helper functions
    47   nsresult GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS = nullptr);
    49   static nsresult SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, 
    50                                               LPDEVMODEW         aDevMode);
    52 protected:
    54   void SetDeviceName(char16ptr_t aDeviceName);
    55   void SetDriverName(char16ptr_t aDriverName);
    56   void SetDevMode(LPDEVMODEW aDevMode);
    58   void SetupPaperInfoFromSettings();
    60   virtual ~nsDeviceContextSpecWin();
    62   wchar_t*      mDriverName;
    63   wchar_t*      mDeviceName;
    64   LPDEVMODEW mDevMode;
    66   nsCOMPtr<nsIPrintSettings> mPrintSettings;
    67 };
    70 //-------------------------------------------------------------------------
    71 // Printer Enumerator
    72 //-------------------------------------------------------------------------
    73 class nsPrinterEnumeratorWin MOZ_FINAL : public nsIPrinterEnumerator
    74 {
    75 public:
    76   nsPrinterEnumeratorWin();
    77   ~nsPrinterEnumeratorWin();
    78   NS_DECL_ISUPPORTS
    79   NS_DECL_NSIPRINTERENUMERATOR
    80 };
    82 #endif

mercurial