blob: f30aa263a1ddc4313e1f12129f02c9214807b5b4 [file] [log] [blame]
[email protected]d7546c402009-04-09 16:36:441// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]8ff1d422009-07-07 21:31:395#ifndef PRINTING_PAGE_OVERLAYS_H_
6#define PRINTING_PAGE_OVERLAYS_H_
initial.commit09911bf2008-07-26 23:55:297
8#include <string>
9
10namespace printing {
11
12class PrintedDocument;
13class 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().
18class 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]d7546c402009-04-09 16:36:4442 // 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.commit09911bf2008-07-26 23:55:2946 // 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]8ff1d422009-07-07 21:31:3980#endif // PRINTING_PAGE_OVERLAYS_H_