/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * 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/. */
/** * A struct that can be used off the main thread to collect printer-specific * info that can be used to initialized a default nsIPrintSettings object.
*/ struct PrintSettingsInitializer {
nsString mPrinter;
PaperInfo mPaperInfo;
int16_t mPaperSizeUnit = nsIPrintSettings::kPaperSizeInches; // If we fail to obtain printer capabilities, being given the option to print // in color to your monochrome printer is a lot less annoying than not being // given the option to print in color to your color printer. bool mPrintInColor = true; int mResolution = 0; int mSheetOrientation = nsIPrintSettings::kPortraitOrientation; int mNumCopies = 1; int mDuplex = nsIPrintSettings::kDuplexNone;
// This is to hold a reference to a newly cloned settings object that will // then be initialized by the other values in the initializer that may have // been changed on a background thread.
nsMainThreadPtrHandle<nsPrintSettings> mPrintSettings;
class nsPrintSettings : public nsIPrintSettings { public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPRINTSETTINGS using PrintSettingsInitializer = mozilla::PrintSettingsInitializer;
/** * Initialize relevant members from the PrintSettingsInitializer. * This is specifically not a constructor so that we can ensure that the * relevant setters are dynamically dispatched to derived classes.
*/ virtualvoid InitWithInitializer(const PrintSettingsInitializer& aSettings);
// Sets a default file name for the print settings. void SetDefaultFileName();
protected: virtual ~nsPrintSettings();
// May be implemented by the platform-specific derived class virtual nsresult _Clone(nsIPrintSettings** _retval); virtual nsresult _Assign(nsIPrintSettings* aPS);
// Members
nsWeakPtr mSession; // Should never be touched by Clone or Assign
// mMargin, mEdge, and mUnwriteableMargin are stored in twips
nsIntMargin mMargin;
nsIntMargin mEdge;
nsIntMargin mUnwriteableMargin;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.