| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "printing/page_range.h" | 12 #include "printing/page_range.h" |
| 13 #include "printing/page_setup.h" | 13 #include "printing/page_setup.h" |
| 14 #include "printing/print_job_constants.h" |
| 14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 15 | 16 |
| 16 namespace printing { | 17 namespace printing { |
| 17 | 18 |
| 18 // OS-independent print settings. | 19 // OS-independent print settings. |
| 19 class PRINTING_EXPORT PrintSettings { | 20 class PRINTING_EXPORT PrintSettings { |
| 20 public: | 21 public: |
| 21 PrintSettings(); | 22 PrintSettings(); |
| 22 ~PrintSettings(); | 23 ~PrintSettings(); |
| 23 | 24 |
| 24 // Reinitialize the settings to the default values. | 25 // Reinitialize the settings to the default values. |
| 25 void Clear(); | 26 void Clear(); |
| 26 | 27 |
| 27 // Set printer printable area in in device units. | 28 // Set printer printable area in in device units. |
| 28 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, | 29 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, |
| 29 gfx::Rect const& printable_area_device_units, | 30 gfx::Rect const& printable_area_device_units, |
| 30 int units_per_inch); | 31 int units_per_inch); |
| 31 | 32 |
| 33 void SetCustomMargins(const PageMargins& margins_in_points); |
| 34 |
| 32 // Equality operator. | 35 // Equality operator. |
| 33 // NOTE: printer_name is NOT tested for equality since it doesn't affect the | 36 // NOTE: printer_name is NOT tested for equality since it doesn't affect the |
| 34 // output. | 37 // output. |
| 35 bool Equals(const PrintSettings& rhs) const; | 38 bool Equals(const PrintSettings& rhs) const; |
| 36 | 39 |
| 37 void set_landscape(bool landscape) { landscape_ = landscape; } | 40 void set_landscape(bool landscape) { landscape_ = landscape; } |
| 38 void set_printer_name(const string16& printer_name) { | 41 void set_printer_name(const string16& printer_name) { |
| 39 printer_name_ = printer_name; | 42 printer_name_ = printer_name; |
| 40 } | 43 } |
| 41 const string16& printer_name() const { return printer_name_; } | 44 const string16& printer_name() const { return printer_name_; } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // behavior matches MacIE and Mozilla, at least) | 80 // behavior matches MacIE and Mozilla, at least) |
| 78 double max_shrink; | 81 double max_shrink; |
| 79 | 82 |
| 80 // Desired visible dots per inch rendering for output. Printing should be | 83 // Desired visible dots per inch rendering for output. Printing should be |
| 81 // scaled to ScreenDpi/dpix*desired_dpi. | 84 // scaled to ScreenDpi/dpix*desired_dpi. |
| 82 int desired_dpi; | 85 int desired_dpi; |
| 83 | 86 |
| 84 // Indicates if the user only wants to print the current selection. | 87 // Indicates if the user only wants to print the current selection. |
| 85 bool selection_only; | 88 bool selection_only; |
| 86 | 89 |
| 87 // Indicates whether we should use browser-controlled page overlays | 90 // Indicates what kind of margins should be applied to the printable area. |
| 88 // (header, footer, margins etc). If it is false, the overlays are | 91 MarginType margin_type; |
| 89 // controlled by the renderer. | |
| 90 bool use_overlays; | |
| 91 | 92 |
| 92 // Cookie generator. It is used to initialize PrintedDocument with its | 93 // Cookie generator. It is used to initialize PrintedDocument with its |
| 93 // associated PrintSettings, to be sure that each generated PrintedPage is | 94 // associated PrintSettings, to be sure that each generated PrintedPage is |
| 94 // correctly associated with its corresponding PrintedDocument. | 95 // correctly associated with its corresponding PrintedDocument. |
| 95 static int NewCookie(); | 96 static int NewCookie(); |
| 96 | 97 |
| 97 // Updates the orientation and flip the page if needed. | 98 // Updates the orientation and flip the page if needed. |
| 98 void SetOrientation(bool landscape); | 99 void SetOrientation(bool landscape); |
| 99 | 100 |
| 100 // Strings to be printed as headers and footers if requested by the user. | 101 // Strings to be printed as headers and footers if requested by the user. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 119 PageSetup page_setup_device_units_; | 120 PageSetup page_setup_device_units_; |
| 120 | 121 |
| 121 // Printer's device effective dots per inch in both axis. | 122 // Printer's device effective dots per inch in both axis. |
| 122 int dpi_; | 123 int dpi_; |
| 123 | 124 |
| 124 // Is the orientation landscape or portrait. | 125 // Is the orientation landscape or portrait. |
| 125 bool landscape_; | 126 bool landscape_; |
| 126 | 127 |
| 127 // True if this printer supports AlphaBlend. | 128 // True if this printer supports AlphaBlend. |
| 128 bool supports_alpha_blend_; | 129 bool supports_alpha_blend_; |
| 130 |
| 131 // If margin type is custom, these are the margins. |
| 132 PageMargins custom_margins_in_points_; |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 } // namespace printing | 135 } // namespace printing |
| 132 | 136 |
| 133 #endif // PRINTING_PRINT_SETTINGS_H_ | 137 #endif // PRINTING_PRINT_SETTINGS_H_ |
| OLD | NEW |