[email protected] | d7546c40 | 2009-04-09 16:36:44 | [diff] [blame] | 1 | // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 8ff1d42 | 2009-07-07 21:31:39 | [diff] [blame] | 5 | #ifndef PRINTING_PAGE_OVERLAYS_H_ |
| 6 | #define PRINTING_PAGE_OVERLAYS_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace printing { |
| 11 | |
| 12 | class PrintedDocument; |
| 13 | class PrintedPage; |
| 14 | |
| 15 | // Page's overlays, i.e. headers and footers. Contains the strings that will be |
| 16 | // printed in the overlays, with actual values as variables. The variables are |
| 17 | // replaced by their actual values with ReplaceVariables(). |
| 18 | class PageOverlays { |
| 19 | public: |
| 20 | // Position of the header/footer. |
| 21 | enum HorizontalPosition { |
| 22 | LEFT, |
| 23 | CENTER, |
| 24 | RIGHT, |
| 25 | }; |
| 26 | |
| 27 | // Position of the header/footer. |
| 28 | enum VerticalPosition { |
| 29 | TOP, |
| 30 | BOTTOM, |
| 31 | }; |
| 32 | |
| 33 | PageOverlays(); |
| 34 | |
| 35 | // Equality operator. |
| 36 | bool Equals(const PageOverlays& rhs) const; |
| 37 | |
| 38 | // Returns the string of an overlay according to its x,y position. |
| 39 | const std::wstring& GetOverlay(HorizontalPosition x, |
| 40 | VerticalPosition y) const; |
| 41 | |
[email protected] | d7546c40 | 2009-04-09 16:36:44 | [diff] [blame] | 42 | // Sets the string of an overlay according to its x,y position. |
| 43 | void SetOverlay(HorizontalPosition x, VerticalPosition y, |
| 44 | std::wstring& input); |
| 45 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 46 | // Replaces the variables in |input| with their actual values according to the |
| 47 | // properties of the current printed document and the current printed page. |
| 48 | static std::wstring ReplaceVariables(const std::wstring& input, |
| 49 | const PrintedDocument& document, |
| 50 | const PrintedPage& page); |
| 51 | |
| 52 | // Keys that are dynamically replaced in the header and footer by their actual |
| 53 | // values. |
| 54 | // Web page's title. |
| 55 | static const wchar_t* const kTitle; |
| 56 | // Print job's start time. |
| 57 | static const wchar_t* const kTime; |
| 58 | // Print job's start date. |
| 59 | static const wchar_t* const kDate; |
| 60 | // Printed page's number. |
| 61 | static const wchar_t* const kPage; |
| 62 | // Print job's total page count. |
| 63 | static const wchar_t* const kPageCount; |
| 64 | // Printed page's number on total page count. |
| 65 | static const wchar_t* const kPageOnTotal; |
| 66 | // Web page's displayed url. |
| 67 | static const wchar_t* const kUrl; |
| 68 | |
| 69 | // Actual headers and footers. |
| 70 | std::wstring top_left; |
| 71 | std::wstring top_center; |
| 72 | std::wstring top_right; |
| 73 | std::wstring bottom_left; |
| 74 | std::wstring bottom_center; |
| 75 | std::wstring bottom_right; |
| 76 | }; |
| 77 | |
| 78 | } // namespace printing |
| 79 | |
[email protected] | 8ff1d42 | 2009-07-07 21:31:39 | [diff] [blame] | 80 | #endif // PRINTING_PAGE_OVERLAYS_H_ |