summaryrefslogtreecommitdiffstats
path: root/printing/page_overlays.h
diff options
context:
space:
mode:
authorsverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 21:31:39 +0000
committersverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 21:31:39 +0000
commit8ff1d42631e79e842669dc3051d91ed7db80f1dc (patch)
tree55c1987549e982bfbf60a33fad3b60b5113d7864 /printing/page_overlays.h
parent395f9295b3e370746846dbe6073a0d43ab7e4af5 (diff)
downloadchromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.zip
chromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.tar.gz
chromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.tar.bz2
Move printing related stuff to the root printing project from the browser project. This simplifies further refactoring and eases understanding of the printing part of Chrome.
Also renamed win_printing_context to printing_context_win (correct naming convention) and added stub implementations for _linux and mac. Now all but one file is compiling on all platforms. TEST=none (no functional change). BUG=none Review URL: http://codereview.chromium.org/149212 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/page_overlays.h')
-rw-r--r--printing/page_overlays.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/printing/page_overlays.h b/printing/page_overlays.h
new file mode 100644
index 0000000..f30aa26
--- /dev/null
+++ b/printing/page_overlays.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PRINTING_PAGE_OVERLAYS_H_
+#define PRINTING_PAGE_OVERLAYS_H_
+
+#include <string>
+
+namespace printing {
+
+class PrintedDocument;
+class PrintedPage;
+
+// Page's overlays, i.e. headers and footers. Contains the strings that will be
+// printed in the overlays, with actual values as variables. The variables are
+// replaced by their actual values with ReplaceVariables().
+class PageOverlays {
+ public:
+ // Position of the header/footer.
+ enum HorizontalPosition {
+ LEFT,
+ CENTER,
+ RIGHT,
+ };
+
+ // Position of the header/footer.
+ enum VerticalPosition {
+ TOP,
+ BOTTOM,
+ };
+
+ PageOverlays();
+
+ // Equality operator.
+ bool Equals(const PageOverlays& rhs) const;
+
+ // Returns the string of an overlay according to its x,y position.
+ const std::wstring& GetOverlay(HorizontalPosition x,
+ VerticalPosition y) const;
+
+ // Sets the string of an overlay according to its x,y position.
+ void SetOverlay(HorizontalPosition x, VerticalPosition y,
+ std::wstring& input);
+
+ // Replaces the variables in |input| with their actual values according to the
+ // properties of the current printed document and the current printed page.
+ static std::wstring ReplaceVariables(const std::wstring& input,
+ const PrintedDocument& document,
+ const PrintedPage& page);
+
+ // Keys that are dynamically replaced in the header and footer by their actual
+ // values.
+ // Web page's title.
+ static const wchar_t* const kTitle;
+ // Print job's start time.
+ static const wchar_t* const kTime;
+ // Print job's start date.
+ static const wchar_t* const kDate;
+ // Printed page's number.
+ static const wchar_t* const kPage;
+ // Print job's total page count.
+ static const wchar_t* const kPageCount;
+ // Printed page's number on total page count.
+ static const wchar_t* const kPageOnTotal;
+ // Web page's displayed url.
+ static const wchar_t* const kUrl;
+
+ // Actual headers and footers.
+ std::wstring top_left;
+ std::wstring top_center;
+ std::wstring top_right;
+ std::wstring bottom_left;
+ std::wstring bottom_center;
+ std::wstring bottom_right;
+};
+
+} // namespace printing
+
+#endif // PRINTING_PAGE_OVERLAYS_H_