2006-02-07 01:13:47 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2006-02-07 01:13:47 +00:00
|
|
|
#include "nsPrintSettingsWin.h"
|
|
|
|
#include "nsCRT.h"
|
|
|
|
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(nsPrintSettingsWin,
|
|
|
|
nsPrintSettings,
|
|
|
|
nsIPrintSettingsWin)
|
2006-02-07 01:13:47 +00:00
|
|
|
|
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsWin.h
|
|
|
|
* @update
|
|
|
|
*/
|
|
|
|
nsPrintSettingsWin::nsPrintSettingsWin() :
|
|
|
|
nsPrintSettings(),
|
2012-07-30 14:20:58 +00:00
|
|
|
mDeviceName(nullptr),
|
|
|
|
mDriverName(nullptr),
|
|
|
|
mDevMode(nullptr)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:13:52 +00:00
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsWin.h
|
|
|
|
* @update
|
|
|
|
*/
|
2006-02-07 01:14:05 +00:00
|
|
|
nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin& aPS) :
|
2012-07-30 14:20:58 +00:00
|
|
|
mDeviceName(nullptr),
|
|
|
|
mDriverName(nullptr),
|
|
|
|
mDevMode(nullptr)
|
2006-02-07 01:13:52 +00:00
|
|
|
{
|
2006-02-07 01:14:05 +00:00
|
|
|
*this = aPS;
|
2006-02-07 01:13:52 +00:00
|
|
|
}
|
|
|
|
|
2006-02-07 01:13:47 +00:00
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsWin.h
|
|
|
|
* @update
|
|
|
|
*/
|
|
|
|
nsPrintSettingsWin::~nsPrintSettingsWin()
|
|
|
|
{
|
2015-03-27 00:01:12 +00:00
|
|
|
if (mDeviceName) free(mDeviceName);
|
|
|
|
if (mDriverName) free(mDriverName);
|
2006-02-07 01:14:13 +00:00
|
|
|
if (mDevMode) ::HeapFree(::GetProcessHeap(), 0, mDevMode);
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:02:17 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const char16_t * aDeviceName)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
if (mDeviceName) {
|
2015-03-27 00:01:12 +00:00
|
|
|
free(mDeviceName);
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
2013-12-03 15:12:57 +00:00
|
|
|
mDeviceName = aDeviceName?wcsdup(char16ptr_t(aDeviceName)):nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-01-04 15:02:17 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(char16_t **aDeviceName)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aDeviceName);
|
2014-01-04 15:02:17 +00:00
|
|
|
*aDeviceName = mDeviceName?reinterpret_cast<char16_t*>(wcsdup(mDeviceName)):nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:02:17 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const char16_t * aDriverName)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
if (mDriverName) {
|
2015-03-27 00:01:12 +00:00
|
|
|
free(mDriverName);
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
2013-12-03 15:12:57 +00:00
|
|
|
mDriverName = aDriverName?wcsdup(char16ptr_t(aDriverName)):nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-01-04 15:02:17 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::GetDriverName(char16_t **aDriverName)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aDriverName);
|
2014-01-04 15:02:17 +00:00
|
|
|
*aDriverName = mDriverName?reinterpret_cast<char16_t*>(wcsdup(mDriverName)):nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-10-22 00:54:26 +00:00
|
|
|
void nsPrintSettingsWin::CopyDevMode(DEVMODEW* aInDevMode, DEVMODEW *& aOutDevMode)
|
2006-02-07 01:14:13 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
aOutDevMode = nullptr;
|
2006-02-07 01:14:13 +00:00
|
|
|
size_t size = aInDevMode->dmSize + aInDevMode->dmDriverExtra;
|
2008-10-22 00:54:26 +00:00
|
|
|
aOutDevMode = (LPDEVMODEW)::HeapAlloc (::GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
2006-02-07 01:14:13 +00:00
|
|
|
if (aOutDevMode) {
|
|
|
|
memcpy(aOutDevMode, aInDevMode, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-10-22 00:54:26 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::GetDevMode(DEVMODEW * *aDevMode)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aDevMode);
|
|
|
|
|
|
|
|
if (mDevMode) {
|
2006-02-07 01:14:13 +00:00
|
|
|
CopyDevMode(mDevMode, *aDevMode);
|
2006-02-07 01:13:47 +00:00
|
|
|
} else {
|
2012-07-30 14:20:58 +00:00
|
|
|
*aDevMode = nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2006-02-07 01:14:05 +00:00
|
|
|
|
2008-10-22 00:54:26 +00:00
|
|
|
NS_IMETHODIMP nsPrintSettingsWin::SetDevMode(DEVMODEW * aDevMode)
|
2006-02-07 01:13:47 +00:00
|
|
|
{
|
|
|
|
if (mDevMode) {
|
2006-02-07 01:14:13 +00:00
|
|
|
::HeapFree(::GetProcessHeap(), 0, mDevMode);
|
2013-10-08 18:48:20 +00:00
|
|
|
mDevMode = nullptr;
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (aDevMode) {
|
2006-02-07 01:14:13 +00:00
|
|
|
CopyDevMode(aDevMode, mDevMode);
|
2006-02-07 01:13:47 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2006-02-07 01:13:52 +00:00
|
|
|
|
2016-01-22 16:05:19 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettingsWin::GetPrintableWidthInInches(double* aPrintableWidthInInches)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aPrintableWidthInInches);
|
|
|
|
*aPrintableWidthInInches = mPrintableWidthInInches;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettingsWin::SetPrintableWidthInInches(double aPrintableWidthInInches)
|
|
|
|
{
|
|
|
|
mPrintableWidthInInches = aPrintableWidthInInches;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettingsWin::GetPrintableHeightInInches(double* aPrintableHeightInInches)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aPrintableHeightInInches);
|
|
|
|
*aPrintableHeightInInches = mPrintableHeightInInches;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettingsWin::SetPrintableHeightInInches(double aPrintableHeightInInches)
|
|
|
|
{
|
|
|
|
mPrintableHeightInInches = aPrintableHeightInInches;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettingsWin::GetEffectivePageSize(double *aWidth, double *aHeight)
|
|
|
|
{
|
|
|
|
// If printable page size not set, fall back to nsPrintSettings.
|
|
|
|
if (mPrintableWidthInInches == 0l || mPrintableHeightInInches == 0l) {
|
|
|
|
return nsPrintSettings::GetEffectivePageSize(aWidth, aHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mOrientation == kPortraitOrientation) {
|
|
|
|
*aWidth = NS_INCHES_TO_TWIPS(mPrintableWidthInInches);
|
|
|
|
*aHeight = NS_INCHES_TO_TWIPS(mPrintableHeightInInches);
|
|
|
|
} else {
|
|
|
|
*aHeight = NS_INCHES_TO_TWIPS(mPrintableWidthInInches);
|
|
|
|
*aWidth = NS_INCHES_TO_TWIPS(mPrintableHeightInInches);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-01-12 17:40:07 +00:00
|
|
|
nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode)
|
2016-01-22 16:05:19 +00:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aHdc);
|
2016-01-12 17:40:07 +00:00
|
|
|
MOZ_ASSERT(aDevMode);
|
|
|
|
|
|
|
|
mIsInitedFromPrinter = true;
|
|
|
|
if (aDevMode->dmFields & DM_ORIENTATION) {
|
|
|
|
mOrientation = int32_t(aDevMode->dmOrientation == DMORIENT_PORTRAIT
|
|
|
|
? kPortraitOrientation : kLandscapeOrientation);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aDevMode->dmFields & DM_COPIES) {
|
|
|
|
mNumCopies = aDevMode->dmCopies;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Since we do the scaling, grab their value and reset back to 100.
|
|
|
|
if (aDevMode->dmFields & DM_SCALE) {
|
|
|
|
double scale = double(aDevMode->dmScale) / 100.0f;
|
|
|
|
if (mScaling == 1.0 || scale != 1.0) {
|
|
|
|
mScaling = scale;
|
|
|
|
}
|
|
|
|
aDevMode->dmScale = 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aDevMode->dmFields & DM_PAPERSIZE) {
|
|
|
|
mPaperData = aDevMode->dmPaperSize;
|
|
|
|
} else {
|
|
|
|
mPaperData = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The length and width in DEVMODE are always in tenths of a millimeter, so
|
|
|
|
// storing them in millimeters is easiest.
|
|
|
|
mPaperSizeUnit = kPaperSizeMillimeters;
|
|
|
|
if (aDevMode->dmFields & DM_PAPERLENGTH) {
|
|
|
|
mPaperHeight = aDevMode->dmPaperLength / 10l;
|
|
|
|
} else {
|
|
|
|
mPaperHeight = -1l;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aDevMode->dmFields & DM_PAPERWIDTH) {
|
|
|
|
mPaperWidth = aDevMode->dmPaperWidth / 10l;
|
|
|
|
} else {
|
|
|
|
mPaperWidth = -1l;
|
|
|
|
}
|
2016-01-22 16:05:19 +00:00
|
|
|
|
|
|
|
// On Windows we currently create a surface using the printable area of the
|
|
|
|
// page and don't set the unwriteable [sic] margins. Using the unwriteable
|
|
|
|
// margins doesn't appear to work on Windows, but I am not sure if this is a
|
|
|
|
// bug elsewhere in our code or a Windows quirk.
|
|
|
|
int32_t printableWidthInDots = GetDeviceCaps(aHdc, HORZRES);
|
|
|
|
int32_t printableHeightInDots = GetDeviceCaps(aHdc, VERTRES);
|
|
|
|
int32_t widthDPI = GetDeviceCaps(aHdc, LOGPIXELSX);
|
|
|
|
int32_t heightDPI = GetDeviceCaps(aHdc, LOGPIXELSY);
|
|
|
|
|
|
|
|
// Keep these values in portrait format, so we can reflect our own changes
|
|
|
|
// to mOrientation.
|
|
|
|
if (mOrientation == kPortraitOrientation) {
|
|
|
|
mPrintableWidthInInches = double(printableWidthInDots) / widthDPI;
|
|
|
|
mPrintableHeightInInches = double(printableHeightInDots) / heightDPI;
|
|
|
|
} else {
|
|
|
|
mPrintableHeightInInches = double(printableWidthInDots) / widthDPI;
|
|
|
|
mPrintableWidthInInches = double(printableHeightInDots) / heightDPI;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Using Y to match existing code, X DPI should be the same for printing.
|
|
|
|
mResolution = heightDPI;
|
|
|
|
}
|
|
|
|
|
2016-01-12 17:40:07 +00:00
|
|
|
void
|
|
|
|
nsPrintSettingsWin::CopyToNative(DEVMODEW* aDevMode)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aDevMode);
|
|
|
|
|
|
|
|
if (mPaperData >= 0) {
|
|
|
|
aDevMode->dmPaperSize = mPaperData;
|
|
|
|
aDevMode->dmFields |= DM_PAPERSIZE;
|
|
|
|
} else {
|
|
|
|
aDevMode->dmPaperSize = 0;
|
|
|
|
aDevMode->dmFields &= ~DM_PAPERSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
double paperHeight;
|
|
|
|
double paperWidth;
|
|
|
|
if (mPaperSizeUnit == kPaperSizeMillimeters) {
|
|
|
|
paperHeight = mPaperHeight;
|
|
|
|
paperWidth = mPaperWidth;
|
|
|
|
} else {
|
|
|
|
paperHeight = mPaperHeight * MM_PER_INCH_FLOAT;
|
|
|
|
paperWidth = mPaperWidth * MM_PER_INCH_FLOAT;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set a sensible limit on the minimum height and width.
|
|
|
|
if (paperHeight >= MM_PER_INCH_FLOAT) {
|
|
|
|
// In DEVMODEs, physical lengths are stored in tenths of millimeters.
|
|
|
|
aDevMode->dmPaperLength = paperHeight * 10l;
|
|
|
|
aDevMode->dmFields |= DM_PAPERLENGTH;
|
|
|
|
} else {
|
|
|
|
aDevMode->dmPaperLength = 0;
|
|
|
|
aDevMode->dmFields &= ~DM_PAPERLENGTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (paperWidth >= MM_PER_INCH_FLOAT) {
|
|
|
|
aDevMode->dmPaperWidth = paperWidth * 10l;
|
|
|
|
aDevMode->dmFields |= DM_PAPERWIDTH;
|
|
|
|
} else {
|
|
|
|
aDevMode->dmPaperWidth = 0;
|
|
|
|
aDevMode->dmFields &= ~DM_PAPERWIDTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup Orientation
|
|
|
|
aDevMode->dmOrientation = mOrientation == kPortraitOrientation
|
|
|
|
? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
|
|
|
|
aDevMode->dmFields |= DM_ORIENTATION;
|
|
|
|
|
|
|
|
// Setup Number of Copies
|
|
|
|
aDevMode->dmCopies = mNumCopies;
|
|
|
|
aDevMode->dmFields |= DM_COPIES;
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:14:05 +00:00
|
|
|
//-------------------------------------------
|
2006-02-07 01:13:52 +00:00
|
|
|
nsresult
|
2006-02-07 01:14:05 +00:00
|
|
|
nsPrintSettingsWin::_Clone(nsIPrintSettings **_retval)
|
2006-02-07 01:13:52 +00:00
|
|
|
{
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsPrintSettingsWin> printSettings = new nsPrintSettingsWin(*this);
|
2015-03-12 13:43:50 +00:00
|
|
|
printSettings.forget(_retval);
|
|
|
|
return NS_OK;
|
2006-02-07 01:13:52 +00:00
|
|
|
}
|
2006-02-07 01:14:05 +00:00
|
|
|
|
|
|
|
//-------------------------------------------
|
|
|
|
nsPrintSettingsWin& nsPrintSettingsWin::operator=(const nsPrintSettingsWin& rhs)
|
|
|
|
{
|
|
|
|
if (this == &rhs) {
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
((nsPrintSettings&) *this) = rhs;
|
|
|
|
|
|
|
|
if (mDeviceName) {
|
2013-08-22 10:31:48 +00:00
|
|
|
free(mDeviceName);
|
2006-02-07 01:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mDriverName) {
|
2013-08-22 10:31:48 +00:00
|
|
|
free(mDriverName);
|
2006-02-07 01:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Use free because we used the native malloc to create the memory
|
|
|
|
if (mDevMode) {
|
2006-02-07 01:14:13 +00:00
|
|
|
::HeapFree(::GetProcessHeap(), 0, mDevMode);
|
2006-02-07 01:14:05 +00:00
|
|
|
}
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
mDeviceName = rhs.mDeviceName?wcsdup(rhs.mDeviceName):nullptr;
|
|
|
|
mDriverName = rhs.mDriverName?wcsdup(rhs.mDriverName):nullptr;
|
2006-02-07 01:14:05 +00:00
|
|
|
|
|
|
|
if (rhs.mDevMode) {
|
2006-02-07 01:14:13 +00:00
|
|
|
CopyDevMode(rhs.mDevMode, mDevMode);
|
2006-02-07 01:14:05 +00:00
|
|
|
} else {
|
2012-07-30 14:20:58 +00:00
|
|
|
mDevMode = nullptr;
|
2006-02-07 01:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------
|
|
|
|
nsresult
|
|
|
|
nsPrintSettingsWin::_Assign(nsIPrintSettings *aPS)
|
|
|
|
{
|
2007-07-08 07:08:04 +00:00
|
|
|
nsPrintSettingsWin *psWin = static_cast<nsPrintSettingsWin*>(aPS);
|
2006-02-07 01:14:05 +00:00
|
|
|
*this = *psWin;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Testing of assign and clone
|
|
|
|
// This define turns on the testing module below
|
|
|
|
// so at start up it writes and reads the prefs.
|
|
|
|
#ifdef DEBUG_rodsX
|
|
|
|
#include "nsIPrintOptions.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
class Tester {
|
|
|
|
public:
|
|
|
|
Tester();
|
|
|
|
};
|
|
|
|
Tester::Tester()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIPrintSettings> ps;
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIPrintOptions> printService = do_GetService("@mozilla.org/gfx/printsettings-service;1", &rv);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
rv = printService->CreatePrintSettings(getter_AddRefs(ps));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps) {
|
2011-10-02 02:16:19 +00:00
|
|
|
ps->SetPrintOptions(nsIPrintSettings::kPrintOddPages, true);
|
|
|
|
ps->SetPrintOptions(nsIPrintSettings::kPrintEvenPages, false);
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetMarginTop(1.0);
|
|
|
|
ps->SetMarginLeft(1.0);
|
|
|
|
ps->SetMarginBottom(1.0);
|
|
|
|
ps->SetMarginRight(1.0);
|
|
|
|
ps->SetScaling(0.5);
|
2011-10-02 02:16:19 +00:00
|
|
|
ps->SetPrintBGColors(true);
|
|
|
|
ps->SetPrintBGImages(true);
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetPrintRange(15);
|
2006-02-07 01:15:21 +00:00
|
|
|
ps->SetHeaderStrLeft(NS_ConvertUTF8toUTF16("Left").get());
|
|
|
|
ps->SetHeaderStrCenter(NS_ConvertUTF8toUTF16("Center").get());
|
|
|
|
ps->SetHeaderStrRight(NS_ConvertUTF8toUTF16("Right").get());
|
|
|
|
ps->SetFooterStrLeft(NS_ConvertUTF8toUTF16("Left").get());
|
|
|
|
ps->SetFooterStrCenter(NS_ConvertUTF8toUTF16("Center").get());
|
|
|
|
ps->SetFooterStrRight(NS_ConvertUTF8toUTF16("Right").get());
|
|
|
|
ps->SetPaperName(NS_ConvertUTF8toUTF16("Paper Name").get());
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetPaperData(1);
|
|
|
|
ps->SetPaperWidth(100.0);
|
|
|
|
ps->SetPaperHeight(50.0);
|
|
|
|
ps->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
|
2011-10-02 02:16:19 +00:00
|
|
|
ps->SetPrintReversed(true);
|
|
|
|
ps->SetPrintInColor(true);
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetOrientation(nsIPrintSettings::kLandscapeOrientation);
|
2006-02-07 01:15:21 +00:00
|
|
|
ps->SetPrintCommand(NS_ConvertUTF8toUTF16("Command").get());
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetNumCopies(2);
|
2006-02-07 01:15:21 +00:00
|
|
|
ps->SetPrinterName(NS_ConvertUTF8toUTF16("Printer Name").get());
|
2011-10-02 02:16:19 +00:00
|
|
|
ps->SetPrintToFile(true);
|
2006-02-07 01:15:21 +00:00
|
|
|
ps->SetToFileName(NS_ConvertUTF8toUTF16("File Name").get());
|
2006-02-07 01:14:05 +00:00
|
|
|
ps->SetPrintPageDelay(1000);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> ps2;
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
rv = printService->CreatePrintSettings(getter_AddRefs(ps2));
|
|
|
|
}
|
|
|
|
|
|
|
|
ps2->Assign(ps);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> psClone;
|
|
|
|
ps2->Clone(getter_AddRefs(psClone));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
Tester gTester;
|
2016-01-12 17:40:07 +00:00
|
|
|
#endif
|