OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
11 #include "printing/page_range.h" | 12 #include "printing/page_range.h" |
12 #include "printing/page_setup.h" | 13 #include "printing/page_setup.h" |
13 #include "printing/print_job_constants.h" | 14 #include "printing/print_job_constants.h" |
14 #include "printing/printing_export.h" | 15 #include "printing/printing_export.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 | 17 |
17 namespace printing { | 18 namespace printing { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool landscape_needs_flip); | 92 bool landscape_needs_flip); |
92 const PageSetup& page_setup_device_units() const { | 93 const PageSetup& page_setup_device_units() const { |
93 return page_setup_device_units_; | 94 return page_setup_device_units_; |
94 } | 95 } |
95 | 96 |
96 void set_device_name(const base::string16& device_name) { | 97 void set_device_name(const base::string16& device_name) { |
97 device_name_ = device_name; | 98 device_name_ = device_name; |
98 } | 99 } |
99 const base::string16& device_name() const { return device_name_; } | 100 const base::string16& device_name() const { return device_name_; } |
100 | 101 |
101 void set_dpi(int dpi) { dpi_ = dpi; } | 102 void set_dpi(int dpi) { |
102 int dpi() const { return dpi_; } | 103 dpi_[0] = dpi; |
| 104 dpi_[1] = dpi; |
| 105 } |
| 106 void set_dpi_xy(int dpi_horizontal, int dpi_vertical) { |
| 107 dpi_[0] = dpi_horizontal; |
| 108 dpi_[1] = dpi_vertical; |
| 109 } |
| 110 int dpi() const { return std::min(dpi_[0], dpi_[1]); } |
| 111 int dpi_horizontal() const { return dpi_[0]; } |
| 112 int dpi_vertical() const { return dpi_[1]; } |
103 | 113 |
104 void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; } | 114 void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; } |
105 double scale_factor() const { return scale_factor_; } | 115 double scale_factor() const { return scale_factor_; } |
106 | 116 |
107 void set_rasterize_pdf(bool rasterize_pdf) { rasterize_pdf_ = rasterize_pdf; } | 117 void set_rasterize_pdf(bool rasterize_pdf) { rasterize_pdf_ = rasterize_pdf; } |
108 bool rasterize_pdf() const { return rasterize_pdf_; } | 118 bool rasterize_pdf() const { return rasterize_pdf_; } |
109 | 119 |
110 void set_supports_alpha_blend(bool supports_alpha_blend) { | 120 void set_supports_alpha_blend(bool supports_alpha_blend) { |
111 supports_alpha_blend_ = supports_alpha_blend; | 121 supports_alpha_blend_ = supports_alpha_blend; |
112 } | 122 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Cookie generator. It is used to initialize PrintedDocument with its | 183 // Cookie generator. It is used to initialize PrintedDocument with its |
174 // associated PrintSettings, to be sure that each generated PrintedPage is | 184 // associated PrintSettings, to be sure that each generated PrintedPage is |
175 // correctly associated with its corresponding PrintedDocument. | 185 // correctly associated with its corresponding PrintedDocument. |
176 static int NewCookie(); | 186 static int NewCookie(); |
177 | 187 |
178 private: | 188 private: |
179 // Multi-page printing. Each PageRange describes a from-to page combination. | 189 // Multi-page printing. Each PageRange describes a from-to page combination. |
180 // This permits printing selected pages only. | 190 // This permits printing selected pages only. |
181 PageRanges ranges_; | 191 PageRanges ranges_; |
182 | 192 |
183 // Desired visible dots per inch rendering for output. Printing should be | |
184 // scaled to ScreenDpi/dpix*desired_dpi. | |
185 int desired_dpi_; | |
186 | |
187 // Indicates if the user only wants to print the current selection. | 193 // Indicates if the user only wants to print the current selection. |
188 bool selection_only_; | 194 bool selection_only_; |
189 | 195 |
190 // Indicates what kind of margins should be applied to the printable area. | 196 // Indicates what kind of margins should be applied to the printable area. |
191 MarginType margin_type_; | 197 MarginType margin_type_; |
192 | 198 |
193 // Strings to be printed as headers and footers if requested by the user. | 199 // Strings to be printed as headers and footers if requested by the user. |
194 base::string16 title_; | 200 base::string16 title_; |
195 base::string16 url_; | 201 base::string16 url_; |
196 | 202 |
(...skipping 17 matching lines...) Expand all Loading... |
214 | 220 |
215 // Printer device name as opened by the OS. | 221 // Printer device name as opened by the OS. |
216 base::string16 device_name_; | 222 base::string16 device_name_; |
217 | 223 |
218 // Media requested by the user. | 224 // Media requested by the user. |
219 RequestedMedia requested_media_; | 225 RequestedMedia requested_media_; |
220 | 226 |
221 // Page setup in device units. | 227 // Page setup in device units. |
222 PageSetup page_setup_device_units_; | 228 PageSetup page_setup_device_units_; |
223 | 229 |
224 // Printer's device effective dots per inch in both axis. | 230 // Printer's device effective dots per inch in both axes. The two values will |
225 int dpi_; | 231 // generally be identical. However, on Windows, there are a few rare printers |
| 232 // that support resolutions with different DPI in different dimensions. |
| 233 int dpi_[2]; |
226 | 234 |
227 // Scale factor | 235 // Scale factor |
228 double scale_factor_; | 236 double scale_factor_; |
229 | 237 |
230 // True if PDF should be printed as a raster PDF | 238 // True if PDF should be printed as a raster PDF |
231 bool rasterize_pdf_; | 239 bool rasterize_pdf_; |
232 | 240 |
233 // Is the orientation landscape or portrait. | 241 // Is the orientation landscape or portrait. |
234 bool landscape_; | 242 bool landscape_; |
235 | 243 |
236 // True if this printer supports AlphaBlend. | 244 // True if this printer supports AlphaBlend. |
237 bool supports_alpha_blend_; | 245 bool supports_alpha_blend_; |
238 | 246 |
239 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
240 // True to print text with GDI. | 248 // True to print text with GDI. |
241 bool print_text_with_gdi_; | 249 bool print_text_with_gdi_; |
242 | 250 |
243 PrinterType printer_type_; | 251 PrinterType printer_type_; |
244 #endif | 252 #endif |
245 | 253 |
246 // If margin type is custom, this is what was requested. | 254 // If margin type is custom, this is what was requested. |
247 PageMargins requested_custom_margins_in_points_; | 255 PageMargins requested_custom_margins_in_points_; |
248 }; | 256 }; |
249 | 257 |
250 } // namespace printing | 258 } // namespace printing |
251 | 259 |
252 #endif // PRINTING_PRINT_SETTINGS_H_ | 260 #endif // PRINTING_PRINT_SETTINGS_H_ |
OLD | NEW |