| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__ | |
| 6 #define CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__ | |
| 7 | |
| 8 #include "base/gfx/rect.h" | |
| 9 #include "chrome/browser/printing/page_overlays.h" | |
| 10 #include "chrome/browser/printing/page_range.h" | |
| 11 #include "chrome/browser/printing/page_setup.h" | |
| 12 | |
| 13 struct ViewMsg_Print_Params; | |
| 14 typedef struct HDC__* HDC; | |
| 15 typedef struct _devicemodeW DEVMODE; | |
| 16 | |
| 17 namespace printing { | |
| 18 | |
| 19 // OS-independent print settings. | |
| 20 class PrintSettings { | |
| 21 public: | |
| 22 PrintSettings(); | |
| 23 | |
| 24 // Reinitialize the settings to the default values. | |
| 25 void Clear(); | |
| 26 | |
| 27 #ifdef WIN32 | |
| 28 // Reads the settings from the selected device context. Calculates derived | |
| 29 // values like printable_area_. | |
| 30 void Init(HDC hdc, | |
| 31 const DEVMODE& dev_mode, | |
| 32 const PageRanges& new_ranges, | |
| 33 const std::wstring& new_device_name, | |
| 34 bool selection_only); | |
| 35 #endif | |
| 36 | |
| 37 // Set printer printable area in in pixels. | |
| 38 void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels, | |
| 39 gfx::Rect const& printable_area_pixels); | |
| 40 | |
| 41 // Initializes the print parameters that needs to be sent to the renderer | |
| 42 // process. | |
| 43 void RenderParams(ViewMsg_Print_Params* params) const; | |
| 44 | |
| 45 // Equality operator. | |
| 46 // NOTE: printer_name is NOT tested for equality since it doesn't affect the | |
| 47 // output. | |
| 48 bool Equals(const PrintSettings& rhs) const; | |
| 49 | |
| 50 const std::wstring& printer_name() const { return printer_name_; } | |
| 51 void set_device_name(const std::wstring& device_name) { | |
| 52 device_name_ = device_name; | |
| 53 } | |
| 54 const std::wstring& device_name() const { return device_name_; } | |
| 55 int dpi() const { return dpi_; } | |
| 56 const PageSetup& page_setup_pixels() const { return page_setup_pixels_; } | |
| 57 | |
| 58 // Multi-page printing. Each PageRange describes a from-to page combination. | |
| 59 // This permits printing selected pages only. | |
| 60 PageRanges ranges; | |
| 61 | |
| 62 // By imaging to a width a little wider than the available pixels, thin pages | |
| 63 // will be scaled down a little, matching the way they print in IE and Camino. | |
| 64 // This lets them use fewer sheets than they would otherwise, which is | |
| 65 // presumably why other browsers do this. Wide pages will be scaled down more | |
| 66 // than this. | |
| 67 double min_shrink; | |
| 68 | |
| 69 // This number determines how small we are willing to reduce the page content | |
| 70 // in order to accommodate the widest line. If the page would have to be | |
| 71 // reduced smaller to make the widest line fit, we just clip instead (this | |
| 72 // behavior matches MacIE and Mozilla, at least) | |
| 73 double max_shrink; | |
| 74 | |
| 75 // Desired visible dots per inch rendering for output. Printing should be | |
| 76 // scaled to ScreenDpi/dpix*desired_dpi. | |
| 77 int desired_dpi; | |
| 78 | |
| 79 // The various overlays (headers and footers). | |
| 80 PageOverlays overlays; | |
| 81 | |
| 82 // Indicates if the user only wants to print the current selection. | |
| 83 bool selection_only; | |
| 84 | |
| 85 // Cookie generator. It is used to initialize PrintedDocument with its | |
| 86 // associated PrintSettings, to be sure that each generated PrintedPage is | |
| 87 // correctly associated with its corresponding PrintedDocument. | |
| 88 static int NewCookie(); | |
| 89 | |
| 90 private: | |
| 91 ////////////////////////////////////////////////////////////////////////////// | |
| 92 // Settings that can't be changed without side-effects. | |
| 93 | |
| 94 // Printer name as shown to the user. | |
| 95 std::wstring printer_name_; | |
| 96 | |
| 97 // Printer device name as opened by the OS. | |
| 98 std::wstring device_name_; | |
| 99 | |
| 100 // Page setup in pixel units, dpi adjusted. | |
| 101 PageSetup page_setup_pixels_; | |
| 102 | |
| 103 // Printer's device effective dots per inch in both axis. | |
| 104 int dpi_; | |
| 105 | |
| 106 // Is the orientation landscape or portrait. | |
| 107 bool landscape_; | |
| 108 }; | |
| 109 | |
| 110 } // namespace printing | |
| 111 | |
| 112 #endif // CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__ | |
| OLD | NEW |