2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsDeviceContextSpecWin_h___
|
|
|
|
#define nsDeviceContextSpecWin_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDeviceContextSpec.h"
|
|
|
|
#include "nsIPrintOptions.h" // For nsIPrinterEnumerator
|
|
|
|
#include "nsIPrintSettings.h"
|
|
|
|
#include "nsISupportsPrimitives.h"
|
|
|
|
#include <windows.h>
|
2012-06-14 11:28:06 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-04-01 14:59:02 -07:00
|
|
|
class nsIWidget;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsDeviceContextSpecWin : public nsIDeviceContextSpec
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDeviceContextSpecWin();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
|
|
|
|
NS_IMETHOD BeginDocument(PRUnichar* aTitle,
|
|
|
|
PRUnichar* aPrintToFileName,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartPage,
|
|
|
|
int32_t aEndPage) { return NS_OK; }
|
2008-03-26 18:21:46 -07:00
|
|
|
NS_IMETHOD EndDocument() { return NS_OK; }
|
|
|
|
NS_IMETHOD BeginPage() { return NS_OK; }
|
|
|
|
NS_IMETHOD EndPage() { return NS_OK; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-21 17:54:26 -07:00
|
|
|
void GetDriverName(PRUnichar *&aDriverName) const { aDriverName = mDriverName; }
|
|
|
|
void GetDeviceName(PRUnichar *&aDeviceName) const { aDeviceName = mDeviceName; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The GetDevMode will return a pointer to a DevMode
|
|
|
|
// whether it is from the Global memory handle or just the DevMode
|
|
|
|
// To get the DevMode from the Global memory Handle it must lock it
|
|
|
|
// So this call must be paired with a call to UnlockGlobalHandle
|
2008-10-21 17:54:26 -07:00
|
|
|
void GetDevMode(LPDEVMODEW &aDevMode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// helper functions
|
2012-07-30 07:20:58 -07:00
|
|
|
nsresult GetDataFromPrinter(const PRUnichar * aName, nsIPrintSettings* aPS = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static nsresult SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings,
|
2008-10-21 17:54:26 -07:00
|
|
|
LPDEVMODEW aDevMode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2008-10-21 17:54:26 -07:00
|
|
|
void SetDeviceName(const PRUnichar* aDeviceName);
|
|
|
|
void SetDriverName(const PRUnichar* aDriverName);
|
|
|
|
void SetDevMode(LPDEVMODEW aDevMode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetupPaperInfoFromSettings();
|
|
|
|
|
|
|
|
virtual ~nsDeviceContextSpecWin();
|
|
|
|
|
2008-10-21 17:54:26 -07:00
|
|
|
PRUnichar* mDriverName;
|
|
|
|
PRUnichar* mDeviceName;
|
|
|
|
LPDEVMODEW mDevMode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
2012-06-14 11:28:06 -07:00
|
|
|
class nsPrinterEnumeratorWin MOZ_FINAL : public nsIPrinterEnumerator
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsPrinterEnumeratorWin();
|
|
|
|
~nsPrinterEnumeratorWin();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPRINTERENUMERATOR
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|