[M120 Migration][VD] Remove accessing oom_score_adj in zygote process
[platform/framework/web/chromium-efl.git] / printing / page_setup.h
1 // Copyright 2011 The Chromium Authors
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 PRINTING_PAGE_SETUP_H_
6 #define PRINTING_PAGE_SETUP_H_
7
8 #include "base/component_export.h"
9 #include "ui/gfx/geometry/rect.h"
10
11 namespace printing {
12
13 // Margins for a page setup.
14 class COMPONENT_EXPORT(PRINTING) PageMargins {
15  public:
16   PageMargins();
17   PageMargins(int header, int footer, int left, int right, int top, int bottom);
18
19   bool operator==(const PageMargins& other) const;
20
21   void Clear();
22
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;
32 };
33
34 // Settings that define the size and printable areas of a page. Unit is
35 // unspecified.
36 class COMPONENT_EXPORT(PRINTING) PageSetup {
37  public:
38   PageSetup();
39   PageSetup(const gfx::Size& physical_size,
40             const gfx::Rect& printable_area,
41             const PageMargins& requested_margins,
42             bool forced_margins,
43             int text_height);
44   PageSetup(const PageSetup& other);
45   ~PageSetup();
46
47   bool operator==(const PageSetup& other) const;
48
49   // Gets a symmetrical printable area.
50   static gfx::Rect GetSymmetricalPrintableArea(const gfx::Size& page_size,
51                                                const gfx::Rect& printable_area);
52
53   void Clear();
54
55   void Init(const gfx::Size& physical_size,
56             const gfx::Rect& printable_area,
57             int text_height);
58
59   // Use `requested_margins` as long as they fall inside the printable area.
60   void SetRequestedMargins(const PageMargins& requested_margins);
61
62   // Ignore the printable area, and set the margins to `requested_margins`.
63   void ForceRequestedMargins(const PageMargins& requested_margins);
64
65   // Flips the orientation of the page and recalculates all page areas.
66   void FlipOrientation();
67
68   const gfx::Size& physical_size() const { return physical_size_; }
69   const gfx::Rect& overlay_area() const { return overlay_area_; }
70   const gfx::Rect& content_area() const { return content_area_; }
71   const gfx::Rect& printable_area() const { return printable_area_; }
72   const PageMargins& effective_margins() const { return effective_margins_; }
73   const PageMargins& requested_margins() const { return requested_margins_; }
74   bool forced_margins() const { return forced_margins_; }
75   int text_height() const { return text_height_; }
76
77  private:
78   // Store `requested_margins_` and update page setup values.
79   void SetRequestedMarginsAndCalculateSizes(
80       const PageMargins& requested_margins);
81
82   // Calculate overlay_area_, effective_margins_, and content_area_, based on
83   // a constraint of `bounds` and `text_height`.
84   void CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height);
85
86   // Physical size of the page, including non-printable margins.
87   gfx::Size physical_size_;
88
89   // The printable area as specified by the printer driver. We can't get
90   // larger than this.
91   gfx::Rect printable_area_;
92
93   // The printable area for headers and footers.
94   gfx::Rect overlay_area_;
95
96   // The printable area as selected by the user's margins.
97   gfx::Rect content_area_;
98
99   // Effective margins.
100   PageMargins effective_margins_;
101
102   // Requested margins.
103   PageMargins requested_margins_;
104
105   // True when `effective_margins_` respects `printable_area_` else false.
106   bool forced_margins_;
107
108   // Space that must be kept free for the overlays.
109   int text_height_;
110 };
111
112 }  // namespace printing
113
114 #endif  // PRINTING_PAGE_SETUP_H_