1 // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // The contents of this file must follow a specific format in order to 33 // support the CEF translator tool. See the translator.README.txt file in the 34 // tools directory for more information. 35 // 36 37 #ifndef CEF_INCLUDE_CEF_PRINT_SETTINGS_H_ 38 #define CEF_INCLUDE_CEF_PRINT_SETTINGS_H_ 39 #pragma once 40 41 #include <vector> 42 43 #include "include/cef_base.h" 44 45 /// 46 // Class representing print settings. 47 /// 48 /*--cef(source=library)--*/ 49 class CefPrintSettings : public virtual CefBaseRefCounted { 50 public: 51 typedef cef_color_model_t ColorModel; 52 typedef cef_duplex_mode_t DuplexMode; 53 typedef std::vector<CefRange> PageRangeList; 54 55 /// 56 // Create a new CefPrintSettings object. 57 /// 58 /*--cef()--*/ 59 static CefRefPtr<CefPrintSettings> Create(); 60 61 /// 62 // Returns true if this object is valid. Do not call any other methods if this 63 // function returns false. 64 /// 65 /*--cef()--*/ 66 virtual bool IsValid() = 0; 67 68 /// 69 // Returns true if the values of this object are read-only. Some APIs may 70 // expose read-only objects. 71 /// 72 /*--cef()--*/ 73 virtual bool IsReadOnly() = 0; 74 75 /// 76 // Set the page orientation. 77 /// 78 /*--cef()--*/ 79 virtual void SetOrientation(bool landscape) = 0; 80 81 /// 82 // Returns true if the orientation is landscape. 83 /// 84 /*--cef()--*/ 85 virtual bool IsLandscape() = 0; 86 87 /// 88 // Set the printer printable area in device units. 89 // Some platforms already provide flipped area. Set |landscape_needs_flip| 90 // to false on those platforms to avoid double flipping. 91 /// 92 /*--cef()--*/ 93 virtual void SetPrinterPrintableArea( 94 const CefSize& physical_size_device_units, 95 const CefRect& printable_area_device_units, 96 bool landscape_needs_flip) = 0; 97 98 /// 99 // Set the device name. 100 /// 101 /*--cef(optional_param=name)--*/ 102 virtual void SetDeviceName(const CefString& name) = 0; 103 104 /// 105 // Get the device name. 106 /// 107 /*--cef()--*/ 108 virtual CefString GetDeviceName() = 0; 109 110 /// 111 // Set the DPI (dots per inch). 112 /// 113 /*--cef()--*/ 114 virtual void SetDPI(int dpi) = 0; 115 116 /// 117 // Get the DPI (dots per inch). 118 /// 119 /*--cef()--*/ 120 virtual int GetDPI() = 0; 121 122 /// 123 // Set the page ranges. 124 /// 125 /*--cef()--*/ 126 virtual void SetPageRanges(const PageRangeList& ranges) = 0; 127 128 /// 129 // Returns the number of page ranges that currently exist. 130 /// 131 /*--cef()--*/ 132 virtual size_t GetPageRangesCount() = 0; 133 134 /// 135 // Retrieve the page ranges. 136 /// 137 /*--cef(count_func=ranges:GetPageRangesCount)--*/ 138 virtual void GetPageRanges(PageRangeList& ranges) = 0; 139 140 /// 141 // Set whether only the selection will be printed. 142 /// 143 /*--cef()--*/ 144 virtual void SetSelectionOnly(bool selection_only) = 0; 145 146 /// 147 // Returns true if only the selection will be printed. 148 /// 149 /*--cef()--*/ 150 virtual bool IsSelectionOnly() = 0; 151 152 /// 153 // Set whether pages will be collated. 154 /// 155 /*--cef()--*/ 156 virtual void SetCollate(bool collate) = 0; 157 158 /// 159 // Returns true if pages will be collated. 160 /// 161 /*--cef()--*/ 162 virtual bool WillCollate() = 0; 163 164 /// 165 // Set the color model. 166 /// 167 /*--cef()--*/ 168 virtual void SetColorModel(ColorModel model) = 0; 169 170 /// 171 // Get the color model. 172 /// 173 /*--cef(default_retval=COLOR_MODEL_UNKNOWN)--*/ 174 virtual ColorModel GetColorModel() = 0; 175 176 /// 177 // Set the number of copies. 178 /// 179 /*--cef()--*/ 180 virtual void SetCopies(int copies) = 0; 181 182 /// 183 // Get the number of copies. 184 /// 185 /*--cef()--*/ 186 virtual int GetCopies() = 0; 187 188 /// 189 // Set the duplex mode. 190 /// 191 /*--cef()--*/ 192 virtual void SetDuplexMode(DuplexMode mode) = 0; 193 194 /// 195 // Get the duplex mode. 196 /// 197 /*--cef(default_retval=DUPLEX_MODE_UNKNOWN)--*/ 198 virtual DuplexMode GetDuplexMode() = 0; 199 }; 200 201 #endif // CEF_INCLUDE_CEF_PRINT_SETTINGS_H_ 202