michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsDeviceContextSpecWin_h___ michael@0: #define nsDeviceContextSpecWin_h___ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDeviceContextSpec.h" michael@0: #include "nsIPrintOptions.h" // For nsIPrinterEnumerator michael@0: #include "nsIPrintSettings.h" michael@0: #include "nsISupportsPrimitives.h" michael@0: #include michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsIWidget; michael@0: michael@0: class nsDeviceContextSpecWin : public nsIDeviceContextSpec michael@0: { michael@0: public: michael@0: nsDeviceContextSpecWin(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); michael@0: NS_IMETHOD BeginDocument(const nsAString& aTitle, michael@0: char16_t* aPrintToFileName, michael@0: int32_t aStartPage, michael@0: int32_t aEndPage) { return NS_OK; } michael@0: NS_IMETHOD EndDocument() { return NS_OK; } michael@0: NS_IMETHOD BeginPage() { return NS_OK; } michael@0: NS_IMETHOD EndPage() { return NS_OK; } michael@0: michael@0: NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview); michael@0: michael@0: void GetDriverName(wchar_t *&aDriverName) const { aDriverName = mDriverName; } michael@0: void GetDeviceName(wchar_t *&aDeviceName) const { aDeviceName = mDeviceName; } michael@0: michael@0: // The GetDevMode will return a pointer to a DevMode michael@0: // whether it is from the Global memory handle or just the DevMode michael@0: // To get the DevMode from the Global memory Handle it must lock it michael@0: // So this call must be paired with a call to UnlockGlobalHandle michael@0: void GetDevMode(LPDEVMODEW &aDevMode); michael@0: michael@0: // helper functions michael@0: nsresult GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS = nullptr); michael@0: michael@0: static nsresult SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, michael@0: LPDEVMODEW aDevMode); michael@0: michael@0: protected: michael@0: michael@0: void SetDeviceName(char16ptr_t aDeviceName); michael@0: void SetDriverName(char16ptr_t aDriverName); michael@0: void SetDevMode(LPDEVMODEW aDevMode); michael@0: michael@0: void SetupPaperInfoFromSettings(); michael@0: michael@0: virtual ~nsDeviceContextSpecWin(); michael@0: michael@0: wchar_t* mDriverName; michael@0: wchar_t* mDeviceName; michael@0: LPDEVMODEW mDevMode; michael@0: michael@0: nsCOMPtr mPrintSettings; michael@0: }; michael@0: michael@0: michael@0: //------------------------------------------------------------------------- michael@0: // Printer Enumerator michael@0: //------------------------------------------------------------------------- michael@0: class nsPrinterEnumeratorWin MOZ_FINAL : public nsIPrinterEnumerator michael@0: { michael@0: public: michael@0: nsPrinterEnumeratorWin(); michael@0: ~nsPrinterEnumeratorWin(); michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIPRINTERENUMERATOR michael@0: }; michael@0: michael@0: #endif