OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/gfx/rect.h" | 8 #include "base/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) |
| 14 #import <ApplicationServices/ApplicationServices.h> |
| 15 #endif |
| 16 |
13 typedef struct HDC__* HDC; | 17 typedef struct HDC__* HDC; |
14 typedef struct _devicemodeW DEVMODE; | 18 typedef struct _devicemodeW DEVMODE; |
15 | 19 |
16 namespace printing { | 20 namespace printing { |
17 | 21 |
18 // OS-independent print settings. | 22 // OS-independent print settings. |
19 class PrintSettings { | 23 class PrintSettings { |
20 public: | 24 public: |
21 PrintSettings(); | 25 PrintSettings(); |
22 | 26 |
23 // Reinitialize the settings to the default values. | 27 // Reinitialize the settings to the default values. |
24 void Clear(); | 28 void Clear(); |
25 | 29 |
26 #ifdef WIN32 | 30 #ifdef WIN32 |
27 // Reads the settings from the selected device context. Calculates derived | 31 // Reads the settings from the selected device context. Calculates derived |
28 // values like printable_area_. | 32 // values like printable_area_. |
29 void Init(HDC hdc, | 33 void Init(HDC hdc, |
30 const DEVMODE& dev_mode, | 34 const DEVMODE& dev_mode, |
31 const PageRanges& new_ranges, | 35 const PageRanges& new_ranges, |
32 const std::wstring& new_device_name, | 36 const std::wstring& new_device_name, |
33 bool selection_only); | 37 bool selection_only); |
| 38 #elif defined(OS_MACOSX) |
| 39 // Reads the settings from the given PMPrinter and PMPageFormat. |
| 40 void Init(PMPrinter printer, PMPageFormat page_format, |
| 41 const PageRanges& new_ranges, bool print_selection_only); |
34 #endif | 42 #endif |
35 | 43 |
36 // Set printer printable area in in pixels. | 44 // Set printer printable area in in pixels. |
37 void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels, | 45 void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels, |
38 gfx::Rect const& printable_area_pixels); | 46 gfx::Rect const& printable_area_pixels); |
39 | 47 |
40 // Equality operator. | 48 // Equality operator. |
41 // NOTE: printer_name is NOT tested for equality since it doesn't affect the | 49 // NOTE: printer_name is NOT tested for equality since it doesn't affect the |
42 // output. | 50 // output. |
43 bool Equals(const PrintSettings& rhs) const; | 51 bool Equals(const PrintSettings& rhs) const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Printer's device effective dots per inch in both axis. | 106 // Printer's device effective dots per inch in both axis. |
99 int dpi_; | 107 int dpi_; |
100 | 108 |
101 // Is the orientation landscape or portrait. | 109 // Is the orientation landscape or portrait. |
102 bool landscape_; | 110 bool landscape_; |
103 }; | 111 }; |
104 | 112 |
105 } // namespace printing | 113 } // namespace printing |
106 | 114 |
107 #endif // PRINTING_PRINT_SETTINGS_H_ | 115 #endif // PRINTING_PRINT_SETTINGS_H_ |
OLD | NEW |