Add supported_locales attribute to external_extensions.json
[chromium-blink-merge.git] / printing / page_setup.h
blob7f338931a62f95f007bfb0b992e9318bd01306f6
1 // Copyright (c) 2011 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.
5 #ifndef PRINTING_PAGE_SETUP_H_
6 #define PRINTING_PAGE_SETUP_H_
8 #include "printing/printing_export.h"
9 #include "ui/gfx/rect.h"
11 namespace printing {
13 // Margins for a page setup.
14 class PRINTING_EXPORT PageMargins {
15 public:
16 PageMargins();
18 void Clear();
20 // Equality operator.
21 bool Equals(const PageMargins& rhs) const;
23 // Vertical space for the overlay from the top of the sheet.
24 int header;
25 // Vertical space for the overlay from the bottom of the sheet.
26 int footer;
27 // Margin on each side of the sheet.
28 int left;
29 int right;
30 int top;
31 int bottom;
34 // Settings that define the size and printable areas of a page. Unit is
35 // unspecified.
36 class PRINTING_EXPORT PageSetup {
37 public:
38 PageSetup();
39 ~PageSetup();
41 void Clear();
43 // Equality operator.
44 bool Equals(const PageSetup& rhs) const;
46 void Init(const gfx::Size& physical_size, const gfx::Rect& printable_area,
47 int text_height);
49 void SetRequestedMargins(const PageMargins& requested_margins);
51 // Flips the orientation of the page and recalculates all page areas.
52 void FlipOrientation();
54 const gfx::Size& physical_size() const { return physical_size_; }
55 const gfx::Rect& overlay_area() const { return overlay_area_; }
56 const gfx::Rect& content_area() const { return content_area_; }
57 const gfx::Rect& printable_area() const { return printable_area_; }
58 const PageMargins& effective_margins() const {
59 return effective_margins_;
62 private:
63 // Physical size of the page, including non-printable margins.
64 gfx::Size physical_size_;
66 // The printable area as specified by the printer driver. We can't get
67 // larger than this.
68 gfx::Rect printable_area_;
70 // The printable area for headers and footers.
71 gfx::Rect overlay_area_;
73 // The printable area as selected by the user's margins.
74 gfx::Rect content_area_;
76 // Effective margins.
77 PageMargins effective_margins_;
79 // Requested margins.
80 PageMargins requested_margins_;
82 // Space that must be kept free for the overlays.
83 int text_height_;
86 } // namespace printing
88 #endif // PRINTING_PAGE_SETUP_H_