| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PRINTING_PRINT_SETTINGS_H_ | 5 #ifndef PRINTING_PRINT_SETTINGS_H_ |
| 6 #define PRINTING_PRINT_SETTINGS_H_ | 6 #define PRINTING_PRINT_SETTINGS_H_ |
| 7 | 7 |
| 8 #include "gfx/rect.h" | 8 #include "gfx/rect.h" |
| 9 #include "printing/page_overlays.h" | 9 #include "printing/page_overlays.h" |
| 10 #include "printing/page_range.h" | 10 #include "printing/page_range.h" |
| 11 #include "printing/page_setup.h" | 11 #include "printing/page_setup.h" |
| 12 | 12 |
| 13 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
| 14 #import <ApplicationServices/ApplicationServices.h> | 14 #import <ApplicationServices/ApplicationServices.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #if defined(OS_WIN) |
| 17 typedef struct HDC__* HDC; | 18 typedef struct HDC__* HDC; |
| 18 typedef struct _devicemodeW DEVMODE; | 19 typedef struct _devicemodeW DEVMODE; |
| 20 #elif defined(USE_X11) |
| 19 typedef struct _GtkPrintSettings GtkPrintSettings; | 21 typedef struct _GtkPrintSettings GtkPrintSettings; |
| 20 typedef struct _GtkPageSetup GtkPageSetup; | 22 typedef struct _GtkPageSetup GtkPageSetup; |
| 23 #endif |
| 21 | 24 |
| 22 namespace printing { | 25 namespace printing { |
| 23 | 26 |
| 24 // OS-independent print settings. | 27 // OS-independent print settings. |
| 25 class PrintSettings { | 28 class PrintSettings { |
| 26 public: | 29 public: |
| 27 PrintSettings(); | 30 PrintSettings(); |
| 28 ~PrintSettings(); | 31 ~PrintSettings(); |
| 29 | 32 |
| 30 // Reinitialize the settings to the default values. | 33 // Reinitialize the settings to the default values. |
| 31 void Clear(); | 34 void Clear(); |
| 32 | 35 |
| 33 #ifdef WIN32 | 36 #if defined(OS_WIN) |
| 34 // Reads the settings from the selected device context. Calculates derived | 37 // Reads the settings from the selected device context. Calculates derived |
| 35 // values like printable_area_. | 38 // values like printable_area_. |
| 36 void Init(HDC hdc, | 39 void Init(HDC hdc, |
| 37 const DEVMODE& dev_mode, | 40 const DEVMODE& dev_mode, |
| 38 const PageRanges& new_ranges, | 41 const PageRanges& new_ranges, |
| 39 const std::wstring& new_device_name, | 42 const std::wstring& new_device_name, |
| 40 bool selection_only); | 43 bool selection_only); |
| 41 #elif defined(OS_MACOSX) | 44 #elif defined(OS_MACOSX) |
| 42 // Reads the settings from the given PMPrinter and PMPageFormat. | 45 // Reads the settings from the given PMPrinter and PMPageFormat. |
| 43 void Init(PMPrinter printer, PMPageFormat page_format, | 46 void Init(PMPrinter printer, PMPageFormat page_format, |
| 44 const PageRanges& new_ranges, bool print_selection_only); | 47 const PageRanges& new_ranges, bool print_selection_only); |
| 45 #elif defined(OS_LINUX) | 48 #elif defined(USE_X11) |
| 46 // Initializes the settings from the given GtkPrintSettings and GtkPageSetup. | 49 // Initializes the settings from the given GtkPrintSettings and GtkPageSetup. |
| 47 // TODO(jhawkins): This method is a mess across the platforms. Refactor. | 50 // TODO(jhawkins): This method is a mess across the platforms. Refactor. |
| 48 void Init(GtkPrintSettings* settings, | 51 void Init(GtkPrintSettings* settings, |
| 49 GtkPageSetup* page_setup, | 52 GtkPageSetup* page_setup, |
| 50 const PageRanges& new_ranges, | 53 const PageRanges& new_ranges, |
| 51 bool print_selection_onl); | 54 bool print_selection_onl); |
| 52 #endif | 55 #endif |
| 53 | 56 |
| 54 // Set printer printable area in in device units. | 57 // Set printer printable area in in device units. |
| 55 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, | 58 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Printer's device effective dots per inch in both axis. | 134 // Printer's device effective dots per inch in both axis. |
| 132 int dpi_; | 135 int dpi_; |
| 133 | 136 |
| 134 // Is the orientation landscape or portrait. | 137 // Is the orientation landscape or portrait. |
| 135 bool landscape_; | 138 bool landscape_; |
| 136 }; | 139 }; |
| 137 | 140 |
| 138 } // namespace printing | 141 } // namespace printing |
| 139 | 142 |
| 140 #endif // PRINTING_PRINT_SETTINGS_H_ | 143 #endif // PRINTING_PRINT_SETTINGS_H_ |
| OLD | NEW |