| 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 "printing/printing_export.h" | 15 #include "printing/printing_export.h" |
| 15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 16 | 17 |
| 17 namespace printing { | 18 namespace printing { |
| 18 | 19 |
| 19 // Returns true if color model is selected. | 20 // Returns true if color model is selected. |
| 20 PRINTING_EXPORT bool isColorModelSelected(int model); | 21 PRINTING_EXPORT bool isColorModelSelected(int model); |
| 21 | 22 |
| 22 #if defined (USE_CUPS) | 23 #if defined (USE_CUPS) |
| 23 // Get the color model setting name and value for the |color_mode|. | 24 // Get the color model setting name and value for the |color_mode|. |
| 24 PRINTING_EXPORT void GetColorModelForMode(int color_mode, | 25 PRINTING_EXPORT void GetColorModelForMode(int color_mode, |
| 25 std::string* color_setting_name, | 26 std::string* color_setting_name, |
| 26 std::string* color_value); | 27 std::string* color_value); |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 // OS-independent print settings. | 30 // OS-independent print settings. |
| 30 class PRINTING_EXPORT PrintSettings { | 31 class PRINTING_EXPORT PrintSettings { |
| 31 public: | 32 public: |
| 32 PrintSettings(); | 33 PrintSettings(); |
| 33 ~PrintSettings(); | 34 ~PrintSettings(); |
| 34 | 35 |
| 35 // Reinitialize the settings to the default values. | 36 // Reinitialize the settings to the default values. |
| 36 void Clear(); | 37 void Clear(); |
| 37 | 38 |
| 38 // Set printer printable area in in device units. | 39 // Set printer printable area in in device units. |
| 39 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, | 40 void SetPrinterPrintableArea(gfx::Size const& physical_size_device_units, |
| 40 gfx::Rect const& printable_area_device_units, | 41 gfx::Rect const& printable_area_device_units, |
| 41 int units_per_inch); | 42 int units_per_inch); |
| 42 | 43 |
| 44 void SetCustomMargins(const PageMargins& margins_in_points); |
| 45 |
| 43 // Equality operator. | 46 // Equality operator. |
| 44 // NOTE: printer_name is NOT tested for equality since it doesn't affect the | 47 // NOTE: printer_name is NOT tested for equality since it doesn't affect the |
| 45 // output. | 48 // output. |
| 46 bool Equals(const PrintSettings& rhs) const; | 49 bool Equals(const PrintSettings& rhs) const; |
| 47 | 50 |
| 48 void set_landscape(bool landscape) { landscape_ = landscape; } | 51 void set_landscape(bool landscape) { landscape_ = landscape; } |
| 49 void set_printer_name(const string16& printer_name) { | 52 void set_printer_name(const string16& printer_name) { |
| 50 printer_name_ = printer_name; | 53 printer_name_ = printer_name; |
| 51 } | 54 } |
| 52 const string16& printer_name() const { return printer_name_; } | 55 const string16& printer_name() const { return printer_name_; } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // behavior matches MacIE and Mozilla, at least) | 91 // behavior matches MacIE and Mozilla, at least) |
| 89 double max_shrink; | 92 double max_shrink; |
| 90 | 93 |
| 91 // Desired visible dots per inch rendering for output. Printing should be | 94 // Desired visible dots per inch rendering for output. Printing should be |
| 92 // scaled to ScreenDpi/dpix*desired_dpi. | 95 // scaled to ScreenDpi/dpix*desired_dpi. |
| 93 int desired_dpi; | 96 int desired_dpi; |
| 94 | 97 |
| 95 // Indicates if the user only wants to print the current selection. | 98 // Indicates if the user only wants to print the current selection. |
| 96 bool selection_only; | 99 bool selection_only; |
| 97 | 100 |
| 98 // Indicates whether we should use browser-controlled page overlays | 101 // Indicates what kind of margins should be applied to the printable area. |
| 99 // (header, footer, margins etc). If it is false, the overlays are | 102 MarginType margin_type; |
| 100 // controlled by the renderer. | |
| 101 bool use_overlays; | |
| 102 | 103 |
| 103 // Cookie generator. It is used to initialize PrintedDocument with its | 104 // Cookie generator. It is used to initialize PrintedDocument with its |
| 104 // associated PrintSettings, to be sure that each generated PrintedPage is | 105 // associated PrintSettings, to be sure that each generated PrintedPage is |
| 105 // correctly associated with its corresponding PrintedDocument. | 106 // correctly associated with its corresponding PrintedDocument. |
| 106 static int NewCookie(); | 107 static int NewCookie(); |
| 107 | 108 |
| 108 // Updates the orientation and flip the page if needed. | 109 // Updates the orientation and flip the page if needed. |
| 109 void SetOrientation(bool landscape); | 110 void SetOrientation(bool landscape); |
| 110 | 111 |
| 111 // Strings to be printed as headers and footers if requested by the user. | 112 // Strings to be printed as headers and footers if requested by the user. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 130 PageSetup page_setup_device_units_; | 131 PageSetup page_setup_device_units_; |
| 131 | 132 |
| 132 // Printer's device effective dots per inch in both axis. | 133 // Printer's device effective dots per inch in both axis. |
| 133 int dpi_; | 134 int dpi_; |
| 134 | 135 |
| 135 // Is the orientation landscape or portrait. | 136 // Is the orientation landscape or portrait. |
| 136 bool landscape_; | 137 bool landscape_; |
| 137 | 138 |
| 138 // True if this printer supports AlphaBlend. | 139 // True if this printer supports AlphaBlend. |
| 139 bool supports_alpha_blend_; | 140 bool supports_alpha_blend_; |
| 141 |
| 142 // If margin type is custom, these are the margins. |
| 143 PageMargins custom_margins_in_points_; |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace printing | 146 } // namespace printing |
| 143 | 147 |
| 144 #endif // PRINTING_PRINT_SETTINGS_H_ | 148 #endif // PRINTING_PRINT_SETTINGS_H_ |
| OLD | NEW |