OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PRINTING_PAGE_SETUP_H__ | |
6 #define CHROME_BROWSER_PRINTING_PAGE_SETUP_H__ | |
7 | |
8 #include "base/gfx/rect.h" | |
9 | |
10 namespace printing { | |
11 | |
12 // Margins for a page setup. | |
13 class PageMargins { | |
14 public: | |
15 PageMargins(); | |
16 | |
17 void Clear(); | |
18 | |
19 // Equality operator. | |
20 bool Equals(const PageMargins& rhs) const; | |
21 | |
22 // Vertical space for the overlay from the top of the sheet. | |
23 int header; | |
24 // Vertical space for the overlay from the bottom of the sheet. | |
25 int footer; | |
26 // Margin on each side of the sheet. | |
27 int left; | |
28 int right; | |
29 int top; | |
30 int bottom; | |
31 }; | |
32 | |
33 // Settings that define the size and printable areas of a page. Unit is | |
34 // unspecified. | |
35 class PageSetup { | |
36 public: | |
37 PageSetup(); | |
38 | |
39 void Clear(); | |
40 | |
41 // Equality operator. | |
42 bool Equals(const PageSetup& rhs) const; | |
43 | |
44 void Init(const gfx::Size& physical_size, const gfx::Rect& printable_area, | |
45 int text_height); | |
46 | |
47 void SetRequestedMargins(const PageMargins& requested_margins); | |
48 | |
49 const gfx::Size& physical_size() const { return physical_size_; } | |
50 const gfx::Rect& overlay_area() const { return overlay_area_; } | |
51 const gfx::Rect& content_area() const { return content_area_; } | |
52 const PageMargins& effective_margins() const { | |
53 return effective_margins_; | |
54 } | |
55 | |
56 private: | |
57 // Physical size of the page, including non-printable margins. | |
58 gfx::Size physical_size_; | |
59 | |
60 // The printable area as specified by the printer driver. We can't get | |
61 // larger than this. | |
62 gfx::Rect printable_area_; | |
63 | |
64 // The printable area for headers and footers. | |
65 gfx::Rect overlay_area_; | |
66 | |
67 // The printable area as selected by the user's margins. | |
68 gfx::Rect content_area_; | |
69 | |
70 // Effective margins. | |
71 PageMargins effective_margins_; | |
72 | |
73 // Requested margins. | |
74 PageMargins requested_margins_; | |
75 | |
76 // Space that must be kept free for the overlays. | |
77 int text_height_; | |
78 }; | |
79 | |
80 } // namespace printing | |
81 | |
82 #endif // CHROME_BROWSER_PRINTING_PAGE_SETUP_H__ | |
OLD | NEW |