/* -*- Mode: C++; 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/. */
usingnamespace mozilla; using mozilla::dom::Promise; using mozilla::gfx::MarginDouble;
// The maximum error when considering a paper size equal, in points. // There is some variance in the actual sizes returned by printer drivers and // print servers for paper sizes. This is a best-guess based on initial // telemetry which should catch most near-miss dimensions. This should let us // get consistent paper size names even when the size isn't quite exactly the // correct size. static constexpr double kPaperSizePointsEpsilon = 4.0;
// Basic implementation of nsIPrinterInfo class nsPrinterInfo : public nsIPrinterInfo { public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsPrinterInfo)
NS_DECL_NSIPRINTERINFO
nsPrinterInfo() = delete;
nsPrinterInfo(nsPrinterBase& aPrinter, const nsPrinterBase::PrinterInfo& aPrinterInfo)
: mDefaultSettings(
CreatePlatformPrintSettings(aPrinterInfo.mDefaultSettings)) {
mPaperList.SetCapacity(aPrinterInfo.mPaperList.Length()); for (const PaperInfo& info : aPrinterInfo.mPaperList) {
mPaperList.AppendElement(MakeRefPtr<nsPaper>(aPrinter, info));
}
// Update the printer's default settings with the global settings.
nsCOMPtr<nsIPrintSettingsService> printSettingsSvc =
do_GetService("@mozilla.org/gfx/printsettings-service;1"); if (printSettingsSvc) { // Passing false as the second parameter means we don't get the printer // specific settings.
printSettingsSvc->InitPrintSettingsFromPrefs(
mDefaultSettings, false, nsIPrintSettings::kInitSaveAll);
}
}
¤ 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.0.28Bemerkung:
(vorverarbeitet)
¤
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.