2006-02-07 04:11:55 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; 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/. */
|
2006-02-07 04:11:55 +03:00
|
|
|
|
|
|
|
#include "nsPrintSettingsImpl.h"
|
|
|
|
#include "nsReadableUtils.h"
|
2006-02-07 04:14:12 +03:00
|
|
|
#include "nsIPrintSession.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2006-02-07 04:11:55 +03:00
|
|
|
|
2008-03-19 23:51:42 +03:00
|
|
|
#define DEFAULT_MARGIN_WIDTH 0.5
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsPrintSettings, nsIPrintSettings)
|
2006-02-07 04:11:55 +03:00
|
|
|
|
2018-04-13 16:01:28 +03:00
|
|
|
nsPrintSettings::nsPrintSettings()
|
|
|
|
: mPrintOptions(0L),
|
|
|
|
mPrintRange(kRangeAllPages),
|
|
|
|
mStartPageNum(1),
|
|
|
|
mEndPageNum(1),
|
|
|
|
mScaling(1.0),
|
|
|
|
mPrintBGColors(false),
|
|
|
|
mPrintBGImages(false),
|
|
|
|
mPrintFrameTypeUsage(kUseInternalDefault),
|
|
|
|
mPrintFrameType(kFramesAsIs),
|
|
|
|
mHowToEnableFrameUI(kFrameEnableNone),
|
|
|
|
mIsCancelled(false),
|
|
|
|
mPrintSilent(false),
|
|
|
|
mPrintPreview(false),
|
|
|
|
mShrinkToFit(true),
|
|
|
|
mShowPrintProgress(true),
|
|
|
|
mPrintPageDelay(50),
|
|
|
|
mPaperData(0),
|
|
|
|
mPaperWidth(8.5),
|
|
|
|
mPaperHeight(11.0),
|
|
|
|
mPaperSizeUnit(kPaperSizeInches),
|
|
|
|
mPrintReversed(false),
|
|
|
|
mPrintInColor(true),
|
|
|
|
mOrientation(kPortraitOrientation),
|
2018-06-15 17:48:51 +03:00
|
|
|
mResolution(0),
|
|
|
|
mDuplex(0),
|
2018-04-13 16:01:28 +03:00
|
|
|
mNumCopies(1),
|
|
|
|
mPrintToFile(false),
|
|
|
|
mOutputFormat(kOutputFormatNative),
|
|
|
|
mIsInitedFromPrinter(false),
|
|
|
|
mIsInitedFromPrefs(false) {
|
2006-02-07 04:11:55 +03:00
|
|
|
/* member initializers and constructor code */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t marginWidth = NS_INCHES_TO_INT_TWIPS(DEFAULT_MARGIN_WIDTH);
|
2008-03-19 23:51:42 +03:00
|
|
|
mMargin.SizeTo(marginWidth, marginWidth, marginWidth, marginWidth);
|
2007-11-13 22:14:07 +03:00
|
|
|
mEdge.SizeTo(0, 0, 0, 0);
|
2008-03-19 23:51:42 +03:00
|
|
|
mUnwriteableMargin.SizeTo(0, 0, 0, 0);
|
2006-02-07 04:11:55 +03:00
|
|
|
|
|
|
|
mPrintOptions = kPrintOddPages | kPrintEvenPages;
|
|
|
|
|
2006-02-07 04:15:02 +03:00
|
|
|
mHeaderStrs[0].AssignLiteral("&T");
|
|
|
|
mHeaderStrs[2].AssignLiteral("&U");
|
2006-02-07 04:11:55 +03:00
|
|
|
|
2006-02-07 04:15:02 +03:00
|
|
|
mFooterStrs[0].AssignLiteral(
|
|
|
|
"&PT"); // Use &P (Page Num Only) or &PT (Page Num of Page Total)
|
|
|
|
mFooterStrs[2].AssignLiteral("&D");
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2006-02-07 04:14:05 +03:00
|
|
|
nsPrintSettings::nsPrintSettings(const nsPrintSettings &aPS) { *this = aPS; }
|
2006-02-07 04:13:52 +03:00
|
|
|
|
2006-02-07 04:11:55 +03:00
|
|
|
nsPrintSettings::~nsPrintSettings() {}
|
|
|
|
|
2006-02-07 04:14:12 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintSession(
|
|
|
|
nsIPrintSession **aPrintSession) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aPrintSession);
|
2012-07-30 18:20:58 +04:00
|
|
|
*aPrintSession = nullptr;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2006-02-07 04:14:12 +03:00
|
|
|
nsCOMPtr<nsIPrintSession> session = do_QueryReferent(mSession);
|
|
|
|
if (!session) return NS_ERROR_NOT_INITIALIZED;
|
|
|
|
*aPrintSession = session;
|
|
|
|
NS_ADDREF(*aPrintSession);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintSession(nsIPrintSession *aPrintSession) {
|
2013-10-28 18:05:51 +04:00
|
|
|
// Clearing it by passing nullptr is not allowed. That's why we
|
2006-02-07 04:14:12 +03:00
|
|
|
// use a weak ref so that it doesn't have to be cleared.
|
|
|
|
NS_ENSURE_ARG(aPrintSession);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2006-02-07 04:14:38 +03:00
|
|
|
mSession = do_GetWeakReference(aPrintSession);
|
2006-02-07 04:14:12 +03:00
|
|
|
if (!mSession) {
|
|
|
|
// This may happen if the implementation of this object does
|
|
|
|
// not support weak references - programmer error.
|
|
|
|
NS_ERROR("Could not get a weak reference from aPrintSession");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2006-02-07 04:11:55 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetStartPageRange(int32_t *aStartPageRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
// NS_ENSURE_ARG_POINTER(aStartPageRange);
|
|
|
|
*aStartPageRange = mStartPageNum;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetStartPageRange(int32_t aStartPageRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mStartPageNum = aStartPageRange;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetEndPageRange(int32_t *aEndPageRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
// NS_ENSURE_ARG_POINTER(aEndPageRange);
|
|
|
|
*aEndPageRange = mEndPageNum;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetEndPageRange(int32_t aEndPageRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mEndPageNum = aEndPageRange;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintReversed(bool *aPrintReversed) {
|
2006-02-07 04:11:55 +03:00
|
|
|
// NS_ENSURE_ARG_POINTER(aPrintReversed);
|
|
|
|
*aPrintReversed = mPrintReversed;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintReversed(bool aPrintReversed) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintReversed = aPrintReversed;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintInColor(bool *aPrintInColor) {
|
2006-02-07 04:11:55 +03:00
|
|
|
// NS_ENSURE_ARG_POINTER(aPrintInColor);
|
|
|
|
*aPrintInColor = mPrintInColor;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintInColor(bool aPrintInColor) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintInColor = aPrintInColor;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetOrientation(int32_t *aOrientation) {
|
2006-02-07 04:14:23 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aOrientation);
|
2006-02-07 04:11:55 +03:00
|
|
|
*aOrientation = mOrientation;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetOrientation(int32_t aOrientation) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mOrientation = aOrientation;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-11 17:10:42 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetResolution(int32_t *aResolution) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aResolution);
|
|
|
|
*aResolution = mResolution;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetResolution(const int32_t aResolution) {
|
|
|
|
mResolution = aResolution;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetDuplex(int32_t *aDuplex) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aDuplex);
|
|
|
|
*aDuplex = mDuplex;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetDuplex(const int32_t aDuplex) {
|
|
|
|
mDuplex = aDuplex;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrinterName(nsAString &aPrinter) {
|
|
|
|
aPrinter = mPrinter;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2006-02-07 04:15:23 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrinterName(const nsAString &aPrinter) {
|
|
|
|
if (!mPrinter.Equals(aPrinter)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsInitedFromPrinter = false;
|
|
|
|
mIsInitedFromPrefs = false;
|
2006-02-07 04:14:05 +03:00
|
|
|
}
|
2006-02-07 04:14:23 +03:00
|
|
|
|
|
|
|
mPrinter.Assign(aPrinter);
|
2006-02-07 04:14:05 +03:00
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetNumCopies(int32_t *aNumCopies) {
|
2006-02-07 04:14:23 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aNumCopies);
|
2006-02-07 04:11:55 +03:00
|
|
|
*aNumCopies = mNumCopies;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetNumCopies(int32_t aNumCopies) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mNumCopies = aNumCopies;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintToFile(bool *aPrintToFile) {
|
2006-02-07 04:11:55 +03:00
|
|
|
// NS_ENSURE_ARG_POINTER(aPrintToFile);
|
|
|
|
*aPrintToFile = mPrintToFile;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintToFile(bool aPrintToFile) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintToFile = aPrintToFile;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetToFileName(nsAString &aToFileName) {
|
|
|
|
aToFileName = mToFileName;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetToFileName(const nsAString &aToFileName) {
|
|
|
|
mToFileName = aToFileName;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetOutputFormat(int16_t *aOutputFormat) {
|
2007-03-01 03:02:27 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aOutputFormat);
|
|
|
|
*aOutputFormat = mOutputFormat;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetOutputFormat(int16_t aOutputFormat) {
|
2007-03-01 03:02:27 +03:00
|
|
|
mOutputFormat = aOutputFormat;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintPageDelay(int32_t *aPrintPageDelay) {
|
2006-02-07 04:11:55 +03:00
|
|
|
*aPrintPageDelay = mPrintPageDelay;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintPageDelay(int32_t aPrintPageDelay) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintPageDelay = aPrintPageDelay;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetIsInitializedFromPrinter(
|
|
|
|
bool *aIsInitializedFromPrinter) {
|
2006-02-07 04:14:23 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aIsInitializedFromPrinter);
|
2011-09-29 10:19:26 +04:00
|
|
|
*aIsInitializedFromPrinter = (bool)mIsInitedFromPrinter;
|
2006-02-07 04:14:23 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetIsInitializedFromPrinter(
|
|
|
|
bool aIsInitializedFromPrinter) {
|
|
|
|
mIsInitedFromPrinter = (bool)aIsInitializedFromPrinter;
|
2006-02-07 04:14:23 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetIsInitializedFromPrefs(
|
|
|
|
bool *aInitializedFromPrefs) {
|
2006-02-07 04:14:23 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aInitializedFromPrefs);
|
2011-09-29 10:19:26 +04:00
|
|
|
*aInitializedFromPrefs = (bool)mIsInitedFromPrefs;
|
2006-02-07 04:14:23 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetIsInitializedFromPrefs(
|
|
|
|
bool aInitializedFromPrefs) {
|
|
|
|
mIsInitedFromPrefs = (bool)aInitializedFromPrefs;
|
2006-02-07 04:14:23 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetMarginTop(double *aMarginTop) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aMarginTop);
|
|
|
|
*aMarginTop = NS_TWIPS_TO_INCHES(mMargin.top);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetMarginTop(double aMarginTop) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mMargin.top = NS_INCHES_TO_INT_TWIPS(float(aMarginTop));
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetMarginLeft(double *aMarginLeft) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aMarginLeft);
|
|
|
|
*aMarginLeft = NS_TWIPS_TO_INCHES(mMargin.left);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetMarginLeft(double aMarginLeft) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mMargin.left = NS_INCHES_TO_INT_TWIPS(float(aMarginLeft));
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetMarginBottom(double *aMarginBottom) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aMarginBottom);
|
|
|
|
*aMarginBottom = NS_TWIPS_TO_INCHES(mMargin.bottom);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetMarginBottom(double aMarginBottom) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mMargin.bottom = NS_INCHES_TO_INT_TWIPS(float(aMarginBottom));
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetMarginRight(double *aMarginRight) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aMarginRight);
|
|
|
|
*aMarginRight = NS_TWIPS_TO_INCHES(mMargin.right);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetMarginRight(double aMarginRight) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mMargin.right = NS_INCHES_TO_INT_TWIPS(float(aMarginRight));
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-11-13 22:14:07 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetEdgeTop(double *aEdgeTop) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aEdgeTop);
|
|
|
|
*aEdgeTop = NS_TWIPS_TO_INCHES(mEdge.top);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetEdgeTop(double aEdgeTop) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mEdge.top = NS_INCHES_TO_INT_TWIPS(float(aEdgeTop));
|
2007-11-13 22:14:07 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetEdgeLeft(double *aEdgeLeft) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aEdgeLeft);
|
|
|
|
*aEdgeLeft = NS_TWIPS_TO_INCHES(mEdge.left);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetEdgeLeft(double aEdgeLeft) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mEdge.left = NS_INCHES_TO_INT_TWIPS(float(aEdgeLeft));
|
2007-11-13 22:14:07 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetEdgeBottom(double *aEdgeBottom) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aEdgeBottom);
|
|
|
|
*aEdgeBottom = NS_TWIPS_TO_INCHES(mEdge.bottom);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetEdgeBottom(double aEdgeBottom) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mEdge.bottom = NS_INCHES_TO_INT_TWIPS(float(aEdgeBottom));
|
2007-11-13 22:14:07 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetEdgeRight(double *aEdgeRight) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aEdgeRight);
|
|
|
|
*aEdgeRight = NS_TWIPS_TO_INCHES(mEdge.right);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetEdgeRight(double aEdgeRight) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mEdge.right = NS_INCHES_TO_INT_TWIPS(float(aEdgeRight));
|
2007-11-13 22:14:07 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-03-19 23:51:42 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginTop(
|
|
|
|
double *aUnwriteableMarginTop) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aUnwriteableMarginTop);
|
|
|
|
*aUnwriteableMarginTop = NS_TWIPS_TO_INCHES(mUnwriteableMargin.top);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginTop(
|
|
|
|
double aUnwriteableMarginTop) {
|
2008-03-20 08:58:48 +03:00
|
|
|
if (aUnwriteableMarginTop >= 0.0) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mUnwriteableMargin.top = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginTop);
|
2008-03-19 23:51:42 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginLeft(
|
|
|
|
double *aUnwriteableMarginLeft) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aUnwriteableMarginLeft);
|
|
|
|
*aUnwriteableMarginLeft = NS_TWIPS_TO_INCHES(mUnwriteableMargin.left);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginLeft(
|
|
|
|
double aUnwriteableMarginLeft) {
|
2008-03-20 08:58:48 +03:00
|
|
|
if (aUnwriteableMarginLeft >= 0.0) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mUnwriteableMargin.left = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginLeft);
|
2008-03-19 23:51:42 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginBottom(
|
|
|
|
double *aUnwriteableMarginBottom) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aUnwriteableMarginBottom);
|
|
|
|
*aUnwriteableMarginBottom = NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginBottom(
|
|
|
|
double aUnwriteableMarginBottom) {
|
2008-03-20 08:58:48 +03:00
|
|
|
if (aUnwriteableMarginBottom >= 0.0) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mUnwriteableMargin.bottom =
|
|
|
|
NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginBottom);
|
2008-03-19 23:51:42 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginRight(
|
|
|
|
double *aUnwriteableMarginRight) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aUnwriteableMarginRight);
|
|
|
|
*aUnwriteableMarginRight = NS_TWIPS_TO_INCHES(mUnwriteableMargin.right);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginRight(
|
|
|
|
double aUnwriteableMarginRight) {
|
2008-03-20 08:58:48 +03:00
|
|
|
if (aUnwriteableMarginRight >= 0.0) {
|
2010-08-13 13:59:16 +04:00
|
|
|
mUnwriteableMargin.right = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginRight);
|
2008-03-19 23:51:42 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetScaling(double *aScaling) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aScaling);
|
|
|
|
*aScaling = mScaling;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetScaling(double aScaling) {
|
|
|
|
mScaling = aScaling;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintBGColors(bool *aPrintBGColors) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintBGColors);
|
|
|
|
*aPrintBGColors = mPrintBGColors;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintBGColors(bool aPrintBGColors) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintBGColors = aPrintBGColors;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintBGImages(bool *aPrintBGImages) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintBGImages);
|
|
|
|
*aPrintBGImages = mPrintBGImages;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintBGImages(bool aPrintBGImages) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintBGImages = aPrintBGImages;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintRange(int16_t *aPrintRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintRange);
|
|
|
|
*aPrintRange = mPrintRange;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintRange(int16_t aPrintRange) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintRange = aPrintRange;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetTitle(nsAString &aTitle) {
|
|
|
|
aTitle = mTitle;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetTitle(const nsAString &aTitle) {
|
|
|
|
mTitle = aTitle;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetDocURL(nsAString &aDocURL) {
|
|
|
|
aDocURL = mURL;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetDocURL(const nsAString &aDocURL) {
|
|
|
|
mURL = aDocURL;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsImpl.h
|
|
|
|
* @update 1/12/01 rods
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsPrintSettings::GetPrintOptions(int32_t aType, bool *aTurnOnOff) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aTurnOnOff);
|
2011-10-17 18:59:28 +04:00
|
|
|
*aTurnOnOff = mPrintOptions & aType ? true : false;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsImpl.h
|
|
|
|
* @update 1/12/01 rods
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsPrintSettings::SetPrintOptions(int32_t aType, bool aTurnOnOff) {
|
2006-02-07 04:11:55 +03:00
|
|
|
if (aTurnOnOff) {
|
|
|
|
mPrintOptions |= aType;
|
|
|
|
} else {
|
|
|
|
mPrintOptions &= ~aType;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** ---------------------------------------------------
|
|
|
|
* See documentation in nsPrintSettingsImpl.h
|
|
|
|
* @update 1/12/01 rods
|
|
|
|
*/
|
2015-05-06 22:35:35 +03:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsPrintSettings::GetPrintOptionsBits(int32_t *aBits) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aBits);
|
|
|
|
*aBits = mPrintOptions;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 22:35:35 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettings::SetPrintOptionsBits(int32_t aBits) {
|
|
|
|
mPrintOptions = aBits;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(nsAString &aTitle) {
|
|
|
|
aTitle = mHeaderStrs[0];
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const nsAString &aTitle) {
|
|
|
|
mHeaderStrs[0] = aTitle;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(nsAString &aTitle) {
|
|
|
|
aTitle = mHeaderStrs[1];
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const nsAString &aTitle) {
|
|
|
|
mHeaderStrs[1] = aTitle;
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(nsAString &aTitle) {
|
|
|
|
aTitle = mHeaderStrs[2];
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const nsAString &aTitle) {
|
|
|
|
mHeaderStrs[2] = aTitle;
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(nsAString &aTitle) {
|
|
|
|
aTitle = mFooterStrs[0];
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const nsAString &aTitle) {
|
|
|
|
mFooterStrs[0] = aTitle;
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(nsAString &aTitle) {
|
|
|
|
aTitle = mFooterStrs[1];
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const nsAString &aTitle) {
|
|
|
|
mFooterStrs[1] = aTitle;
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(nsAString &aTitle) {
|
|
|
|
aTitle = mFooterStrs[2];
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const nsAString &aTitle) {
|
|
|
|
mFooterStrs[2] = aTitle;
|
|
|
|
return NS_OK;
|
2006-02-07 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintFrameTypeUsage(
|
|
|
|
int16_t *aPrintFrameTypeUsage) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintFrameTypeUsage);
|
|
|
|
*aPrintFrameTypeUsage = mPrintFrameTypeUsage;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintFrameTypeUsage(
|
|
|
|
int16_t aPrintFrameTypeUsage) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintFrameTypeUsage = aPrintFrameTypeUsage;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintFrameType(int16_t *aPrintFrameType) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintFrameType);
|
2012-08-22 19:56:38 +04:00
|
|
|
*aPrintFrameType = (int32_t)mPrintFrameType;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintFrameType(int16_t aPrintFrameType) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintFrameType = aPrintFrameType;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPrintSilent(bool *aPrintSilent) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPrintSilent);
|
|
|
|
*aPrintSilent = mPrintSilent;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPrintSilent(bool aPrintSilent) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPrintSilent = aPrintSilent;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetShrinkToFit(bool *aShrinkToFit) {
|
2006-02-07 04:13:20 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aShrinkToFit);
|
|
|
|
*aShrinkToFit = mShrinkToFit;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetShrinkToFit(bool aShrinkToFit) {
|
2006-02-07 04:13:20 +03:00
|
|
|
mShrinkToFit = aShrinkToFit;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetShowPrintProgress(bool *aShowPrintProgress) {
|
2006-02-07 04:13:49 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aShowPrintProgress);
|
|
|
|
*aShowPrintProgress = mShowPrintProgress;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetShowPrintProgress(bool aShowPrintProgress) {
|
2006-02-07 04:13:49 +03:00
|
|
|
mShowPrintProgress = aShowPrintProgress;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPaperName(nsAString &aPaperName) {
|
|
|
|
aPaperName = mPaperName;
|
2006-02-07 04:13:37 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-10-09 02:08:09 +03:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPaperName(const nsAString &aPaperName) {
|
|
|
|
mPaperName = aPaperName;
|
2006-02-07 04:13:37 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetHowToEnableFrameUI(
|
|
|
|
int16_t *aHowToEnableFrameUI) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aHowToEnableFrameUI);
|
2011-07-27 10:43:37 +04:00
|
|
|
*aHowToEnableFrameUI = mHowToEnableFrameUI;
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetHowToEnableFrameUI(
|
|
|
|
int16_t aHowToEnableFrameUI) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mHowToEnableFrameUI = aHowToEnableFrameUI;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetIsCancelled(bool *aIsCancelled) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aIsCancelled);
|
|
|
|
*aIsCancelled = mIsCancelled;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetIsCancelled(bool aIsCancelled) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mIsCancelled = aIsCancelled;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPaperWidth(double *aPaperWidth) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aPaperWidth);
|
|
|
|
*aPaperWidth = mPaperWidth;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPaperWidth(double aPaperWidth) {
|
|
|
|
mPaperWidth = aPaperWidth;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPaperHeight(double *aPaperHeight) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aPaperHeight);
|
|
|
|
*aPaperHeight = mPaperHeight;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPaperHeight(double aPaperHeight) {
|
|
|
|
mPaperHeight = aPaperHeight;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPaperSizeUnit(int16_t *aPaperSizeUnit) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPaperSizeUnit);
|
|
|
|
*aPaperSizeUnit = mPaperSizeUnit;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPaperSizeUnit(int16_t aPaperSizeUnit) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPaperSizeUnit = aPaperSizeUnit;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::GetPaperData(int16_t *aPaperData) {
|
2006-02-07 04:11:55 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aPaperData);
|
|
|
|
*aPaperData = mPaperData;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsPrintSettings::SetPaperData(int16_t aPaperData) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mPaperData = aPaperData;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** ---------------------------------------------------
|
2017-12-19 13:42:15 +03:00
|
|
|
* See documentation in nsPrintSettingsService.h
|
2006-02-07 04:11:55 +03:00
|
|
|
* @update 6/21/00 dwc
|
|
|
|
* @update 1/12/01 rods
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::SetMarginInTwips(nsIntMargin &aMargin) {
|
2006-02-07 04:11:55 +03:00
|
|
|
mMargin = aMargin;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-11-13 22:14:07 +03:00
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::SetEdgeInTwips(nsIntMargin &aEdge) {
|
2007-11-13 22:14:07 +03:00
|
|
|
mEdge = aEdge;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-03-19 23:51:42 +03:00
|
|
|
// NOTE: Any subclass implementation of this function should make sure
|
|
|
|
// to check for negative margin values in aUnwriteableMargin (which
|
|
|
|
// would indicate that we should use the system default unwriteable margin.)
|
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::SetUnwriteableMarginInTwips(nsIntMargin &aUnwriteableMargin) {
|
2008-03-19 23:51:42 +03:00
|
|
|
if (aUnwriteableMargin.top >= 0) {
|
|
|
|
mUnwriteableMargin.top = aUnwriteableMargin.top;
|
|
|
|
}
|
|
|
|
if (aUnwriteableMargin.left >= 0) {
|
|
|
|
mUnwriteableMargin.left = aUnwriteableMargin.left;
|
|
|
|
}
|
|
|
|
if (aUnwriteableMargin.bottom >= 0) {
|
|
|
|
mUnwriteableMargin.bottom = aUnwriteableMargin.bottom;
|
|
|
|
}
|
|
|
|
if (aUnwriteableMargin.right >= 0) {
|
|
|
|
mUnwriteableMargin.right = aUnwriteableMargin.right;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 04:11:55 +03:00
|
|
|
/** ---------------------------------------------------
|
2017-12-19 13:42:15 +03:00
|
|
|
* See documentation in nsPrintSettingsService.h
|
2006-02-07 04:11:55 +03:00
|
|
|
* @update 6/21/00 dwc
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::GetMarginInTwips(nsIntMargin &aMargin) {
|
2006-02-07 04:11:55 +03:00
|
|
|
aMargin = mMargin;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-11-13 22:14:07 +03:00
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::GetEdgeInTwips(nsIntMargin &aEdge) {
|
2007-11-13 22:14:07 +03:00
|
|
|
aEdge = mEdge;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-03-19 23:51:42 +03:00
|
|
|
NS_IMETHODIMP
|
2009-01-15 06:27:09 +03:00
|
|
|
nsPrintSettings::GetUnwriteableMarginInTwips(nsIntMargin &aUnwriteableMargin) {
|
2008-03-19 23:51:42 +03:00
|
|
|
aUnwriteableMargin = mUnwriteableMargin;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-01-21 06:47:25 +03:00
|
|
|
/** ---------------------------------------------------
|
|
|
|
* Stub - platform-specific implementations can use this function.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettings::SetupSilentPrinting() { return NS_OK; }
|
|
|
|
|
2006-02-07 04:11:55 +03:00
|
|
|
/** ---------------------------------------------------
|
2017-12-19 13:42:15 +03:00
|
|
|
* See documentation in nsPrintSettingsService.h
|
2006-02-07 04:11:55 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2007-07-17 03:16:48 +04:00
|
|
|
nsPrintSettings::GetEffectivePageSize(double *aWidth, double *aHeight) {
|
2006-02-07 04:11:55 +03:00
|
|
|
if (mPaperSizeUnit == kPaperSizeInches) {
|
|
|
|
*aWidth = NS_INCHES_TO_TWIPS(float(mPaperWidth));
|
|
|
|
*aHeight = NS_INCHES_TO_TWIPS(float(mPaperHeight));
|
|
|
|
} else {
|
|
|
|
*aWidth = NS_MILLIMETERS_TO_TWIPS(float(mPaperWidth));
|
|
|
|
*aHeight = NS_MILLIMETERS_TO_TWIPS(float(mPaperHeight));
|
|
|
|
}
|
2007-07-17 03:16:48 +04:00
|
|
|
if (kLandscapeOrientation == mOrientation) {
|
|
|
|
double temp = *aWidth;
|
|
|
|
*aWidth = *aHeight;
|
|
|
|
*aHeight = temp;
|
|
|
|
}
|
2006-02-07 04:11:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-07 08:45:06 +04:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsPrintSettings::GetPageRanges(nsTArray<int32_t> &aPages) {
|
2011-12-07 08:45:06 +04:00
|
|
|
aPages.Clear();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 04:14:05 +03:00
|
|
|
nsresult nsPrintSettings::_Clone(nsIPrintSettings **_retval) {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPrintSettings> printSettings = new nsPrintSettings(*this);
|
2015-03-12 16:43:50 +03:00
|
|
|
printSettings.forget(_retval);
|
|
|
|
return NS_OK;
|
2006-02-07 04:13:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettings::Clone(nsIPrintSettings **_retval) {
|
2006-02-07 04:14:05 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(_retval);
|
|
|
|
return _Clone(_retval);
|
2006-02-07 04:13:52 +03:00
|
|
|
}
|
2006-02-07 04:14:05 +03:00
|
|
|
|
|
|
|
nsresult nsPrintSettings::_Assign(nsIPrintSettings *aPS) {
|
2007-07-08 11:08:04 +04:00
|
|
|
nsPrintSettings *ps = static_cast<nsPrintSettings *>(aPS);
|
2006-02-07 04:14:05 +03:00
|
|
|
*this = *ps;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPrintSettings::Assign(nsIPrintSettings *aPS) {
|
|
|
|
NS_ENSURE_ARG(aPS);
|
|
|
|
return _Assign(aPS);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------
|
|
|
|
nsPrintSettings &nsPrintSettings::operator=(const nsPrintSettings &rhs) {
|
|
|
|
if (this == &rhs) {
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
mStartPageNum = rhs.mStartPageNum;
|
|
|
|
mEndPageNum = rhs.mEndPageNum;
|
|
|
|
mMargin = rhs.mMargin;
|
2007-11-13 22:14:07 +03:00
|
|
|
mEdge = rhs.mEdge;
|
2008-03-19 23:51:42 +03:00
|
|
|
mUnwriteableMargin = rhs.mUnwriteableMargin;
|
2006-02-07 04:14:05 +03:00
|
|
|
mScaling = rhs.mScaling;
|
|
|
|
mPrintBGColors = rhs.mPrintBGColors;
|
|
|
|
mPrintBGImages = rhs.mPrintBGImages;
|
|
|
|
mPrintRange = rhs.mPrintRange;
|
|
|
|
mTitle = rhs.mTitle;
|
|
|
|
mURL = rhs.mURL;
|
|
|
|
mHowToEnableFrameUI = rhs.mHowToEnableFrameUI;
|
|
|
|
mIsCancelled = rhs.mIsCancelled;
|
|
|
|
mPrintFrameTypeUsage = rhs.mPrintFrameTypeUsage;
|
|
|
|
mPrintFrameType = rhs.mPrintFrameType;
|
|
|
|
mPrintSilent = rhs.mPrintSilent;
|
|
|
|
mShrinkToFit = rhs.mShrinkToFit;
|
|
|
|
mShowPrintProgress = rhs.mShowPrintProgress;
|
|
|
|
mPaperName = rhs.mPaperName;
|
|
|
|
mPaperData = rhs.mPaperData;
|
|
|
|
mPaperWidth = rhs.mPaperWidth;
|
|
|
|
mPaperHeight = rhs.mPaperHeight;
|
|
|
|
mPaperSizeUnit = rhs.mPaperSizeUnit;
|
|
|
|
mPrintReversed = rhs.mPrintReversed;
|
|
|
|
mPrintInColor = rhs.mPrintInColor;
|
|
|
|
mOrientation = rhs.mOrientation;
|
|
|
|
mNumCopies = rhs.mNumCopies;
|
|
|
|
mPrinter = rhs.mPrinter;
|
|
|
|
mPrintToFile = rhs.mPrintToFile;
|
|
|
|
mToFileName = rhs.mToFileName;
|
2007-03-01 03:02:27 +03:00
|
|
|
mOutputFormat = rhs.mOutputFormat;
|
2006-02-07 04:14:05 +03:00
|
|
|
mPrintPageDelay = rhs.mPrintPageDelay;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t i = 0; i < NUM_HEAD_FOOT; i++) {
|
2006-02-07 04:14:05 +03:00
|
|
|
mHeaderStrs[i] = rhs.mHeaderStrs[i];
|
|
|
|
mFooterStrs[i] = rhs.mFooterStrs[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|