Update all files to use Windows CRLF (\r\n) line endings (issue #45).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@33 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-07-24 19:11:01 +00:00
parent 6a7b6d5038
commit ea3a49abe1
72 changed files with 7757 additions and 7757 deletions

View File

@@ -1,138 +1,138 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "precompiled_libcef.h"
#include "print_settings.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "printing/units.h"
namespace printing {
// Global SequenceNumber used for generating unique cookie values.
static base::AtomicSequenceNumber cookie_seq(base::LINKER_INITIALIZED);
PrintSettings::PrintSettings()
: min_shrink(1.25),
max_shrink(2.0),
desired_dpi(72),
selection_only(false),
to_file(false),
dpi_(0),
landscape_(false) {
}
void PrintSettings::Clear() {
ranges.clear();
min_shrink = 1.25;
max_shrink = 2.;
desired_dpi = 72;
selection_only = false;
to_file = false;
printer_name_.clear();
device_name_.clear();
page_setup_pixels_.Clear();
dpi_ = 0;
landscape_ = false;
}
#ifdef WIN32
void PrintSettings::Init(HDC hdc,
const DEVMODE& dev_mode,
const PageRanges& new_ranges,
const std::wstring& new_device_name,
bool print_selection_only,
bool print_to_file) {
DCHECK(hdc);
printer_name_ = dev_mode.dmDeviceName;
device_name_ = new_device_name;
ranges = new_ranges;
landscape_ = dev_mode.dmOrientation == DMORIENT_LANDSCAPE;
selection_only = print_selection_only;
to_file = print_to_file;
dpi_ = GetDeviceCaps(hdc, LOGPIXELSX);
// No printer device is known to advertise different dpi in X and Y axis; even
// the fax device using the 200x100 dpi setting. It's ought to break so many
// applications that it's not even needed to care about. WebKit doesn't
// support different dpi settings in X and Y axis.
DCHECK_EQ(dpi_, GetDeviceCaps(hdc, LOGPIXELSY));
DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORX), 0);
DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORY), 0);
// Initialize page_setup_pixels_.
gfx::Size physical_size_pixels(GetDeviceCaps(hdc, PHYSICALWIDTH),
GetDeviceCaps(hdc, PHYSICALHEIGHT));
gfx::Rect printable_area_pixels(GetDeviceCaps(hdc, PHYSICALOFFSETX),
GetDeviceCaps(hdc, PHYSICALOFFSETY),
GetDeviceCaps(hdc, HORZRES),
GetDeviceCaps(hdc, VERTRES));
SetPrinterPrintableArea(physical_size_pixels, printable_area_pixels);
}
#endif
void PrintSettings::SetPrinterPrintableArea(
gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels) {
int margin_printer_units = ConvertUnit(500, kHundrethsMMPerInch, dpi_);
// Start by setting the user configuration
// Hard-code text_height = 0.5cm = ~1/5 of inch
page_setup_pixels_.Init(physical_size_pixels,
printable_area_pixels,
margin_printer_units);
// Now apply user configured settings.
PageMargins margins;
margins.header = margin_printer_units;
margins.footer = margin_printer_units;
margins.left = margin_printer_units;
margins.top = margin_printer_units;
margins.right = margin_printer_units;
margins.bottom = margin_printer_units;
page_setup_pixels_.SetRequestedMargins(margins);
}
void PrintSettings::RenderParams(PrintParams* params) const {
DCHECK(params);
params->printable_size.SetSize(page_setup_pixels_.content_area().width(),
page_setup_pixels_.content_area().height());
params->dpi = dpi_;
// Currently hardcoded at 1.25. See PrintSettings' constructor.
params->min_shrink = min_shrink;
// Currently hardcoded at 2.0. See PrintSettings' constructor.
params->max_shrink = max_shrink;
// Currently hardcoded at 72dpi. See PrintSettings' constructor.
params->desired_dpi = desired_dpi;
// Always use an invalid cookie.
params->document_cookie = 0;
params->selection_only = selection_only;
params->to_file = to_file;
}
bool PrintSettings::Equals(const PrintSettings& rhs) const {
// Do not test the display device name (printer_name_) for equality since it
// may sometimes be chopped off at 30 chars. As long as device_name is the
// same, that's fine.
return ranges == rhs.ranges &&
min_shrink == rhs.min_shrink &&
max_shrink == rhs.max_shrink &&
desired_dpi == rhs.desired_dpi &&
device_name_ == rhs.device_name_ &&
page_setup_pixels_.Equals(rhs.page_setup_pixels_) &&
dpi_ == rhs.dpi_ &&
landscape_ == rhs.landscape_;
}
int PrintSettings::NewCookie() {
// A cookie of 0 is used to mark a document as unassigned, count from 1.
return cookie_seq.GetNext() + 1;
}
} // namespace printing
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "precompiled_libcef.h"
#include "print_settings.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "printing/units.h"
namespace printing {
// Global SequenceNumber used for generating unique cookie values.
static base::AtomicSequenceNumber cookie_seq(base::LINKER_INITIALIZED);
PrintSettings::PrintSettings()
: min_shrink(1.25),
max_shrink(2.0),
desired_dpi(72),
selection_only(false),
to_file(false),
dpi_(0),
landscape_(false) {
}
void PrintSettings::Clear() {
ranges.clear();
min_shrink = 1.25;
max_shrink = 2.;
desired_dpi = 72;
selection_only = false;
to_file = false;
printer_name_.clear();
device_name_.clear();
page_setup_pixels_.Clear();
dpi_ = 0;
landscape_ = false;
}
#ifdef WIN32
void PrintSettings::Init(HDC hdc,
const DEVMODE& dev_mode,
const PageRanges& new_ranges,
const std::wstring& new_device_name,
bool print_selection_only,
bool print_to_file) {
DCHECK(hdc);
printer_name_ = dev_mode.dmDeviceName;
device_name_ = new_device_name;
ranges = new_ranges;
landscape_ = dev_mode.dmOrientation == DMORIENT_LANDSCAPE;
selection_only = print_selection_only;
to_file = print_to_file;
dpi_ = GetDeviceCaps(hdc, LOGPIXELSX);
// No printer device is known to advertise different dpi in X and Y axis; even
// the fax device using the 200x100 dpi setting. It's ought to break so many
// applications that it's not even needed to care about. WebKit doesn't
// support different dpi settings in X and Y axis.
DCHECK_EQ(dpi_, GetDeviceCaps(hdc, LOGPIXELSY));
DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORX), 0);
DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORY), 0);
// Initialize page_setup_pixels_.
gfx::Size physical_size_pixels(GetDeviceCaps(hdc, PHYSICALWIDTH),
GetDeviceCaps(hdc, PHYSICALHEIGHT));
gfx::Rect printable_area_pixels(GetDeviceCaps(hdc, PHYSICALOFFSETX),
GetDeviceCaps(hdc, PHYSICALOFFSETY),
GetDeviceCaps(hdc, HORZRES),
GetDeviceCaps(hdc, VERTRES));
SetPrinterPrintableArea(physical_size_pixels, printable_area_pixels);
}
#endif
void PrintSettings::SetPrinterPrintableArea(
gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels) {
int margin_printer_units = ConvertUnit(500, kHundrethsMMPerInch, dpi_);
// Start by setting the user configuration
// Hard-code text_height = 0.5cm = ~1/5 of inch
page_setup_pixels_.Init(physical_size_pixels,
printable_area_pixels,
margin_printer_units);
// Now apply user configured settings.
PageMargins margins;
margins.header = margin_printer_units;
margins.footer = margin_printer_units;
margins.left = margin_printer_units;
margins.top = margin_printer_units;
margins.right = margin_printer_units;
margins.bottom = margin_printer_units;
page_setup_pixels_.SetRequestedMargins(margins);
}
void PrintSettings::RenderParams(PrintParams* params) const {
DCHECK(params);
params->printable_size.SetSize(page_setup_pixels_.content_area().width(),
page_setup_pixels_.content_area().height());
params->dpi = dpi_;
// Currently hardcoded at 1.25. See PrintSettings' constructor.
params->min_shrink = min_shrink;
// Currently hardcoded at 2.0. See PrintSettings' constructor.
params->max_shrink = max_shrink;
// Currently hardcoded at 72dpi. See PrintSettings' constructor.
params->desired_dpi = desired_dpi;
// Always use an invalid cookie.
params->document_cookie = 0;
params->selection_only = selection_only;
params->to_file = to_file;
}
bool PrintSettings::Equals(const PrintSettings& rhs) const {
// Do not test the display device name (printer_name_) for equality since it
// may sometimes be chopped off at 30 chars. As long as device_name is the
// same, that's fine.
return ranges == rhs.ranges &&
min_shrink == rhs.min_shrink &&
max_shrink == rhs.max_shrink &&
desired_dpi == rhs.desired_dpi &&
device_name_ == rhs.device_name_ &&
page_setup_pixels_.Equals(rhs.page_setup_pixels_) &&
dpi_ == rhs.dpi_ &&
landscape_ == rhs.landscape_;
}
int PrintSettings::NewCookie() {
// A cookie of 0 is used to mark a document as unassigned, count from 1.
return cookie_seq.GetNext() + 1;
}
} // namespace printing

View File

@@ -1,150 +1,150 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _PRINTING_PRINT_SETTINGS_H
#define _PRINTING_PRINT_SETTINGS_H
#include "base/gfx/rect.h"
#include "printing/page_range.h"
#include "printing/page_setup.h"
typedef struct HDC__* HDC;
typedef struct _devicemodeW DEVMODE;
namespace printing {
// Parameters for a render request.
struct PrintParams {
// In pixels according to dpi_x and dpi_y.
gfx::Size printable_size;
// Specifies dots per inch.
double dpi;
// Minimum shrink factor. See PrintSettings::min_shrink for more information.
double min_shrink;
// Maximum shrink factor. See PrintSettings::max_shrink for more information.
double max_shrink;
// Desired apparent dpi on paper.
int desired_dpi;
// Cookie for the document to ensure correctness.
int document_cookie;
// Indicates if the user only wants to print the current selection.
bool selection_only;
// Indicates if the user wants to print to file.
bool to_file;
// Warning: do not compare document_cookie.
bool Equals(const PrintParams& rhs) const {
return printable_size == rhs.printable_size &&
dpi == rhs.dpi &&
min_shrink == rhs.min_shrink &&
max_shrink == rhs.max_shrink &&
desired_dpi == rhs.desired_dpi &&
selection_only == rhs.selection_only &&
to_file == rhs.to_file;
}
};
// OS-independent print settings.
class PrintSettings {
public:
PrintSettings();
// Reinitialize the settings to the default values.
void Clear();
#ifdef WIN32
// Reads the settings from the selected device context. Calculates derived
// values like printable_area_.
void Init(HDC hdc,
const DEVMODE& dev_mode,
const PageRanges& new_ranges,
const std::wstring& new_device_name,
bool selection_only,
bool to_file);
#endif
// Set printer printable area in pixels.
void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels);
// Initializes the print parameters that needs to be sent to the renderer
// process.
void RenderParams(PrintParams* params) const;
// Equality operator.
// NOTE: printer_name is NOT tested for equality since it doesn't affect the
// output.
bool Equals(const PrintSettings& rhs) const;
const std::wstring& printer_name() const { return printer_name_; }
void set_device_name(const std::wstring& device_name) {
device_name_ = device_name;
}
const std::wstring& device_name() const { return device_name_; }
int dpi() const { return dpi_; }
const PageSetup& page_setup_pixels() const { return page_setup_pixels_; }
// Multi-page printing. Each PageRange describes a from-to page combination.
// This permits printing selected pages only.
PageRanges ranges;
// By imaging to a width a little wider than the available pixels, thin pages
// will be scaled down a little, matching the way they print in IE and Camino.
// This lets them use fewer sheets than they would otherwise, which is
// presumably why other browsers do this. Wide pages will be scaled down more
// than this.
double min_shrink;
// This number determines how small we are willing to reduce the page content
// in order to accommodate the widest line. If the page would have to be
// reduced smaller to make the widest line fit, we just clip instead (this
// behavior matches MacIE and Mozilla, at least)
double max_shrink;
// Desired visible dots per inch rendering for output. Printing should be
// scaled to ScreenDpi/dpix*desired_dpi.
int desired_dpi;
// Indicates if the user only wants to print the current selection.
bool selection_only;
// Indicates if the user wants to print to file.
bool to_file;
// Cookie generator. It is used to initialize PrintedDocument with its
// associated PrintSettings, to be sure that each generated PrintedPage is
// correctly associated with its corresponding PrintedDocument.
static int NewCookie();
private:
//////////////////////////////////////////////////////////////////////////////
// Settings that can't be changed without side-effects.
// Printer name as shown to the user.
std::wstring printer_name_;
// Printer device name as opened by the OS.
std::wstring device_name_;
// Page setup in pixel units, dpi adjusted.
PageSetup page_setup_pixels_;
// Printer's device effective dots per inch in both axis.
int dpi_;
// Is the orientation landscape or portrait.
bool landscape_;
};
} // namespace printing
#endif // _PRINTING_PRINT_SETTINGS_H
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _PRINTING_PRINT_SETTINGS_H
#define _PRINTING_PRINT_SETTINGS_H
#include "base/gfx/rect.h"
#include "printing/page_range.h"
#include "printing/page_setup.h"
typedef struct HDC__* HDC;
typedef struct _devicemodeW DEVMODE;
namespace printing {
// Parameters for a render request.
struct PrintParams {
// In pixels according to dpi_x and dpi_y.
gfx::Size printable_size;
// Specifies dots per inch.
double dpi;
// Minimum shrink factor. See PrintSettings::min_shrink for more information.
double min_shrink;
// Maximum shrink factor. See PrintSettings::max_shrink for more information.
double max_shrink;
// Desired apparent dpi on paper.
int desired_dpi;
// Cookie for the document to ensure correctness.
int document_cookie;
// Indicates if the user only wants to print the current selection.
bool selection_only;
// Indicates if the user wants to print to file.
bool to_file;
// Warning: do not compare document_cookie.
bool Equals(const PrintParams& rhs) const {
return printable_size == rhs.printable_size &&
dpi == rhs.dpi &&
min_shrink == rhs.min_shrink &&
max_shrink == rhs.max_shrink &&
desired_dpi == rhs.desired_dpi &&
selection_only == rhs.selection_only &&
to_file == rhs.to_file;
}
};
// OS-independent print settings.
class PrintSettings {
public:
PrintSettings();
// Reinitialize the settings to the default values.
void Clear();
#ifdef WIN32
// Reads the settings from the selected device context. Calculates derived
// values like printable_area_.
void Init(HDC hdc,
const DEVMODE& dev_mode,
const PageRanges& new_ranges,
const std::wstring& new_device_name,
bool selection_only,
bool to_file);
#endif
// Set printer printable area in pixels.
void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels);
// Initializes the print parameters that needs to be sent to the renderer
// process.
void RenderParams(PrintParams* params) const;
// Equality operator.
// NOTE: printer_name is NOT tested for equality since it doesn't affect the
// output.
bool Equals(const PrintSettings& rhs) const;
const std::wstring& printer_name() const { return printer_name_; }
void set_device_name(const std::wstring& device_name) {
device_name_ = device_name;
}
const std::wstring& device_name() const { return device_name_; }
int dpi() const { return dpi_; }
const PageSetup& page_setup_pixels() const { return page_setup_pixels_; }
// Multi-page printing. Each PageRange describes a from-to page combination.
// This permits printing selected pages only.
PageRanges ranges;
// By imaging to a width a little wider than the available pixels, thin pages
// will be scaled down a little, matching the way they print in IE and Camino.
// This lets them use fewer sheets than they would otherwise, which is
// presumably why other browsers do this. Wide pages will be scaled down more
// than this.
double min_shrink;
// This number determines how small we are willing to reduce the page content
// in order to accommodate the widest line. If the page would have to be
// reduced smaller to make the widest line fit, we just clip instead (this
// behavior matches MacIE and Mozilla, at least)
double max_shrink;
// Desired visible dots per inch rendering for output. Printing should be
// scaled to ScreenDpi/dpix*desired_dpi.
int desired_dpi;
// Indicates if the user only wants to print the current selection.
bool selection_only;
// Indicates if the user wants to print to file.
bool to_file;
// Cookie generator. It is used to initialize PrintedDocument with its
// associated PrintSettings, to be sure that each generated PrintedPage is
// correctly associated with its corresponding PrintedDocument.
static int NewCookie();
private:
//////////////////////////////////////////////////////////////////////////////
// Settings that can't be changed without side-effects.
// Printer name as shown to the user.
std::wstring printer_name_;
// Printer device name as opened by the OS.
std::wstring device_name_;
// Page setup in pixel units, dpi adjusted.
PageSetup page_setup_pixels_;
// Printer's device effective dots per inch in both axis.
int dpi_;
// Is the orientation landscape or portrait.
bool landscape_;
};
} // namespace printing
#endif // _PRINTING_PRINT_SETTINGS_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +1,141 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _PRINTING_WIN_PRINTING_CONTEXT_H
#define _PRINTING_WIN_PRINTING_CONTEXT_H
#include "print_settings.h"
#include <ocidl.h>
#include <commdlg.h>
#include <string>
#include "base/basictypes.h"
namespace printing {
// Describe the user selected printing context for Windows. This includes the
// OS-dependent UI to ask the user about the print settings. This class directly
// talk to the printer and manages the document and pages breaks.
class PrintingContext {
public:
// Tri-state result for user behavior-dependent functions.
enum Result {
OK,
CANCEL,
FAILED,
};
PrintingContext();
~PrintingContext();
// Asks the user what printer and format should be used to print. Updates the
// context with the select device settings.
Result AskUserForSettings(HWND window, int max_pages, bool has_selection);
// Selects the user's default printer and format. Updates the context with the
// default device settings.
Result UseDefaultSettings();
// Initializes with predefined settings.
Result InitWithSettings(const PrintSettings& settings);
// Reinitializes the settings to uninitialized for object reuse.
void ResetSettings();
// Does platform specific setup of the printer before the printing. Signal the
// printer that a document is about to be spooled.
// Warning: This function enters a message loop. That may cause side effects
// like IPC message processing! Some printers have side-effects on this call
// like virtual printers that ask the user for the path of the saved document;
// for example a PDF printer.
Result NewDocument(const std::wstring& document_name);
// Starts a new page.
Result NewPage();
// Closes the printed page.
Result PageDone();
// Closes the printing job. After this call the object is ready to start a new
// document.
Result DocumentDone();
// Cancels printing. Can be used in a multithreaded context. Takes effect
// immediately.
void Cancel();
// Dismiss the Print... dialog box if shown.
void DismissDialog();
HDC context() {
return hdc_;
}
const PrintSettings& settings() const {
return settings_;
}
private:
// Class that manages the PrintDlgEx() callbacks. This is meant to be a
// temporary object used during the Print... dialog display.
class CallbackHandler;
// Does bookkeeping when an error occurs.
PrintingContext::Result OnError();
// Used in response to the user canceling the printing.
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
// Reads the settings from the selected device context. Updates settings_ and
// its margins.
bool InitializeSettings(const DEVMODE& dev_mode,
const std::wstring& new_device_name,
const PRINTPAGERANGE* ranges,
int number_ranges,
bool selection_only,
bool to_file);
// Retrieves the printer's default low-level settings. hdc_ is allocated with
// this call.
bool GetPrinterSettings(HANDLE printer,
const std::wstring& device_name);
// Allocates the HDC for a specific DEVMODE.
bool AllocateContext(const std::wstring& printer_name,
const DEVMODE* dev_mode);
// Parses the result of a PRINTDLGEX result.
Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);
Result ParseDialogResult(const PRINTDLG& dialog_options);
// The selected printer context.
HDC hdc_;
// Complete print context settings.
PrintSettings settings_;
#ifndef NDEBUG
// Current page number in the print job.
int page_number_;
#endif
// The dialog box for the time it is shown.
volatile HWND dialog_box_;
// The dialog box has been dismissed.
volatile bool dialog_box_dismissed_;
// Is a print job being done.
volatile bool in_print_job_;
// Did the user cancel the print job.
volatile bool abort_printing_;
DISALLOW_EVIL_CONSTRUCTORS(PrintingContext);
};
} // namespace printing
#endif // _PRINTING_WIN_PRINTING_CONTEXT_H
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _PRINTING_WIN_PRINTING_CONTEXT_H
#define _PRINTING_WIN_PRINTING_CONTEXT_H
#include "print_settings.h"
#include <ocidl.h>
#include <commdlg.h>
#include <string>
#include "base/basictypes.h"
namespace printing {
// Describe the user selected printing context for Windows. This includes the
// OS-dependent UI to ask the user about the print settings. This class directly
// talk to the printer and manages the document and pages breaks.
class PrintingContext {
public:
// Tri-state result for user behavior-dependent functions.
enum Result {
OK,
CANCEL,
FAILED,
};
PrintingContext();
~PrintingContext();
// Asks the user what printer and format should be used to print. Updates the
// context with the select device settings.
Result AskUserForSettings(HWND window, int max_pages, bool has_selection);
// Selects the user's default printer and format. Updates the context with the
// default device settings.
Result UseDefaultSettings();
// Initializes with predefined settings.
Result InitWithSettings(const PrintSettings& settings);
// Reinitializes the settings to uninitialized for object reuse.
void ResetSettings();
// Does platform specific setup of the printer before the printing. Signal the
// printer that a document is about to be spooled.
// Warning: This function enters a message loop. That may cause side effects
// like IPC message processing! Some printers have side-effects on this call
// like virtual printers that ask the user for the path of the saved document;
// for example a PDF printer.
Result NewDocument(const std::wstring& document_name);
// Starts a new page.
Result NewPage();
// Closes the printed page.
Result PageDone();
// Closes the printing job. After this call the object is ready to start a new
// document.
Result DocumentDone();
// Cancels printing. Can be used in a multithreaded context. Takes effect
// immediately.
void Cancel();
// Dismiss the Print... dialog box if shown.
void DismissDialog();
HDC context() {
return hdc_;
}
const PrintSettings& settings() const {
return settings_;
}
private:
// Class that manages the PrintDlgEx() callbacks. This is meant to be a
// temporary object used during the Print... dialog display.
class CallbackHandler;
// Does bookkeeping when an error occurs.
PrintingContext::Result OnError();
// Used in response to the user canceling the printing.
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
// Reads the settings from the selected device context. Updates settings_ and
// its margins.
bool InitializeSettings(const DEVMODE& dev_mode,
const std::wstring& new_device_name,
const PRINTPAGERANGE* ranges,
int number_ranges,
bool selection_only,
bool to_file);
// Retrieves the printer's default low-level settings. hdc_ is allocated with
// this call.
bool GetPrinterSettings(HANDLE printer,
const std::wstring& device_name);
// Allocates the HDC for a specific DEVMODE.
bool AllocateContext(const std::wstring& printer_name,
const DEVMODE* dev_mode);
// Parses the result of a PRINTDLGEX result.
Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);
Result ParseDialogResult(const PRINTDLG& dialog_options);
// The selected printer context.
HDC hdc_;
// Complete print context settings.
PrintSettings settings_;
#ifndef NDEBUG
// Current page number in the print job.
int page_number_;
#endif
// The dialog box for the time it is shown.
volatile HWND dialog_box_;
// The dialog box has been dismissed.
volatile bool dialog_box_dismissed_;
// Is a print job being done.
volatile bool in_print_job_;
// Did the user cancel the print job.
volatile bool abort_printing_;
DISALLOW_EVIL_CONSTRUCTORS(PrintingContext);
};
} // namespace printing
#endif // _PRINTING_WIN_PRINTING_CONTEXT_H