2006-02-07 04:12:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
1998-11-14 05:05:13 +03:00
|
|
|
|
|
|
|
#ifndef nsDeviceContextSpecWin_h___
|
|
|
|
#define nsDeviceContextSpecWin_h___
|
|
|
|
|
2006-02-07 04:14:15 +03:00
|
|
|
#include "nsCOMPtr.h"
|
1998-11-14 05:05:13 +03:00
|
|
|
#include "nsIDeviceContextSpec.h"
|
2016-10-28 02:31:14 +03:00
|
|
|
#include "nsIPrinterEnumerator.h"
|
2006-02-07 04:13:12 +03:00
|
|
|
#include "nsIPrintSettings.h"
|
2006-02-11 03:03:51 +03:00
|
|
|
#include "nsISupportsPrimitives.h"
|
1998-11-14 05:05:13 +03:00
|
|
|
#include <windows.h>
|
2012-06-14 22:28:06 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-01-05 13:08:57 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
1998-11-14 05:05:13 +03:00
|
|
|
|
2009-04-02 01:59:02 +04:00
|
|
|
class nsIWidget;
|
|
|
|
|
1998-11-14 05:05:13 +03:00
|
|
|
class nsDeviceContextSpecWin : public nsIDeviceContextSpec
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDeviceContextSpecWin();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2017-11-06 06:37:28 +03:00
|
|
|
virtual already_AddRefed<PrintTarget> MakePrintTarget() final override;
|
2013-07-24 15:48:37 +04:00
|
|
|
NS_IMETHOD BeginDocument(const nsAString& aTitle,
|
2016-01-05 13:08:57 +03:00
|
|
|
const nsAString& aPrintToFileName,
|
2013-07-24 15:48:37 +04:00
|
|
|
int32_t aStartPage,
|
2017-11-04 19:53:05 +03:00
|
|
|
int32_t aEndPage) override { return NS_OK; }
|
|
|
|
NS_IMETHOD EndDocument() override { return NS_OK; }
|
2015-12-16 19:58:46 +03:00
|
|
|
NS_IMETHOD BeginPage() override { return NS_OK; }
|
|
|
|
NS_IMETHOD EndPage() override { return NS_OK; }
|
2006-02-10 23:40:54 +03:00
|
|
|
|
2015-12-16 19:58:46 +03:00
|
|
|
NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview) override;
|
2006-02-07 04:13:12 +03:00
|
|
|
|
2017-11-06 06:37:28 +03:00
|
|
|
float GetDPI() final override;
|
2016-01-05 13:08:57 +03:00
|
|
|
|
2017-11-06 06:37:28 +03:00
|
|
|
float GetPrintingScale() final override;
|
2016-01-05 13:08:57 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
void GetDriverName(nsAString& aDriverName) const { aDriverName = mDriverName; }
|
|
|
|
void GetDeviceName(nsAString& aDeviceName) const { aDeviceName = mDeviceName; }
|
2006-02-07 04:13:32 +03: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-22 04:54:26 +04:00
|
|
|
void GetDevMode(LPDEVMODEW &aDevMode);
|
2006-02-07 04:13:32 +03:00
|
|
|
|
|
|
|
// helper functions
|
2017-10-09 02:08:09 +03:00
|
|
|
nsresult GetDataFromPrinter(const nsAString& aName,
|
|
|
|
nsIPrintSettings* aPS = nullptr);
|
2006-02-07 04:13:32 +03:00
|
|
|
|
1998-11-14 05:05:13 +03:00
|
|
|
protected:
|
2006-02-07 04:13:21 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
void SetDeviceName(const nsAString& aDeviceName);
|
|
|
|
void SetDriverName(const nsAString& aDriverName);
|
2008-10-22 04:54:26 +04:00
|
|
|
void SetDevMode(LPDEVMODEW aDevMode);
|
2006-02-07 04:13:12 +03:00
|
|
|
|
1998-11-14 05:05:13 +03:00
|
|
|
virtual ~nsDeviceContextSpecWin();
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
nsString mDriverName;
|
|
|
|
nsString mDeviceName;
|
2008-10-22 04:54:26 +04:00
|
|
|
LPDEVMODEW mDevMode;
|
2006-02-07 04:13:12 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
2016-03-19 14:01:30 +03:00
|
|
|
int16_t mOutputFormat = nsIPrintSettings::kOutputFormatNative;
|
2017-06-20 06:34:43 +03:00
|
|
|
|
|
|
|
#ifdef MOZ_ENABLE_SKIA_PDF
|
2017-06-08 13:55:42 +03:00
|
|
|
|
|
|
|
// This variable is independant of nsIPrintSettings::kOutputFormatPDF.
|
|
|
|
// It controls both whether normal printing is done via PDF using Skia and
|
|
|
|
// whether print-to-PDF uses Skia.
|
2017-06-20 06:34:43 +03:00
|
|
|
bool mPrintViaSkPDF;
|
|
|
|
#endif
|
2006-02-07 04:13:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsPrinterEnumeratorWin final : public nsIPrinterEnumerator
|
2006-02-07 04:13:12 +03:00
|
|
|
{
|
2014-07-16 00:37:58 +04:00
|
|
|
~nsPrinterEnumeratorWin();
|
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
public:
|
|
|
|
nsPrinterEnumeratorWin();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPRINTERENUMERATOR
|
1998-11-14 05:05:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|