1 // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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.
37 #ifndef CEF_INCLUDE_CEF_PRINT_SETTINGS_H_
38 #define CEF_INCLUDE_CEF_PRINT_SETTINGS_H_
43 #include "include/cef_base.h"
46 // Class representing print settings.
48 /*--cef(source=library)--*/
49 class CefPrintSettings : public virtual CefBase {
51 typedef cef_color_model_t ColorModel;
52 typedef cef_duplex_mode_t DuplexMode;
53 typedef std::vector<CefPageRange> PageRangeList;
56 // Create a new CefPrintSettings object.
59 static CefRefPtr<CefPrintSettings> Create();
62 // Returns true if this object is valid. Do not call any other methods if this
63 // function returns false.
66 virtual bool IsValid() =0;
69 // Returns true if the values of this object are read-only. Some APIs may
70 // expose read-only objects.
73 virtual bool IsReadOnly() =0;
76 // Returns a writable copy of this object.
79 virtual CefRefPtr<CefPrintSettings> Copy() =0;
82 // Set the page orientation.
85 virtual void SetOrientation(bool landscape) =0;
88 // Returns true if the orientation is landscape.
91 virtual bool IsLandscape() =0;
94 // Set the printer printable area in device units.
95 // Some platforms already provide flipped area. Set |landscape_needs_flip|
96 // to false on those platforms to avoid double flipping.
99 virtual void SetPrinterPrintableArea(
100 const CefSize& physical_size_device_units,
101 const CefRect& printable_area_device_units,
102 bool landscape_needs_flip) =0;
105 // Set the device name.
107 /*--cef(optional_param=name)--*/
108 virtual void SetDeviceName(const CefString& name) =0;
111 // Get the device name.
114 virtual CefString GetDeviceName() =0;
117 // Set the DPI (dots per inch).
120 virtual void SetDPI(int dpi) =0;
123 // Get the DPI (dots per inch).
126 virtual int GetDPI() =0;
129 // Set the page ranges.
132 virtual void SetPageRanges(const PageRangeList& ranges) =0;
135 // Returns the number of page ranges that currently exist.
138 virtual size_t GetPageRangesCount() =0;
141 // Retrieve the page ranges.
143 /*--cef(count_func=ranges:GetPageRangesCount)--*/
144 virtual void GetPageRanges(PageRangeList& ranges) =0;
147 // Set whether only the selection will be printed.
150 virtual void SetSelectionOnly(bool selection_only) =0;
153 // Returns true if only the selection will be printed.
156 virtual bool IsSelectionOnly() =0;
159 // Set whether pages will be collated.
162 virtual void SetCollate(bool collate) =0;
165 // Returns true if pages will be collated.
168 virtual bool WillCollate() =0;
171 // Set the color model.
174 virtual void SetColorModel(ColorModel model) =0;
177 // Get the color model.
179 /*--cef(default_retval=COLOR_MODEL_UNKNOWN)--*/
180 virtual ColorModel GetColorModel() =0;
183 // Set the number of copies.
186 virtual void SetCopies(int copies) =0;
189 // Get the number of copies.
192 virtual int GetCopies() =0;
195 // Set the duplex mode.
198 virtual void SetDuplexMode(DuplexMode mode) =0;
201 // Get the duplex mode.
203 /*--cef(default_retval=DUPLEX_MODE_UNKNOWN)--*/
204 virtual DuplexMode GetDuplexMode() =0;
207 #endif // CEF_INCLUDE_CEF_PRINT_SETTINGS_H_