Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: printing/page_setup.h

Issue 8351063: PrintPreview: [LINUX] Update the margin values after flipping the paper orientation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | printing/page_setup.cc » ('j') | printing/page_setup.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PRINTING_PAGE_SETUP_H_ 5 #ifndef PRINTING_PAGE_SETUP_H_
6 #define PRINTING_PAGE_SETUP_H_ 6 #define PRINTING_PAGE_SETUP_H_
7 7
8 #include "printing/printing_export.h" 8 #include "printing/printing_export.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 10
11 namespace printing { 11 namespace printing {
12 12
13 // Margins for a page setup. 13 // Margins for a page setup.
14 class PRINTING_EXPORT PageMargins { 14 class PRINTING_EXPORT PageMargins {
15 public: 15 public:
16 PageMargins(); 16 PageMargins();
17 17
18 // Rotates |page_margins| values in anti-clockwise direction and update the
19 // current values.
20 void RotatePageMarginsAndUpdateCurrentValue(const PageMargins& page_margins);
vandebo (ex-Chrome) 2011/11/03 17:26:35 I think a simple "Rotate(void)" method, that modif
kmadhusu 2011/11/03 20:46:54 Yes. It will work perfectly. Fixed.
21
18 void Clear(); 22 void Clear();
19 23
20 // Equality operator. 24 // Equality operator.
21 bool Equals(const PageMargins& rhs) const; 25 bool Equals(const PageMargins& rhs) const;
22 26
23 // Vertical space for the overlay from the top of the sheet. 27 // Vertical space for the overlay from the top of the sheet.
24 int header; 28 int header;
25 // Vertical space for the overlay from the bottom of the sheet. 29 // Vertical space for the overlay from the bottom of the sheet.
26 int footer; 30 int footer;
27 // Margin on each side of the sheet. 31 // Margin on each side of the sheet.
(...skipping 29 matching lines...) Expand all
57 61
58 const gfx::Size& physical_size() const { return physical_size_; } 62 const gfx::Size& physical_size() const { return physical_size_; }
59 const gfx::Rect& overlay_area() const { return overlay_area_; } 63 const gfx::Rect& overlay_area() const { return overlay_area_; }
60 const gfx::Rect& content_area() const { return content_area_; } 64 const gfx::Rect& content_area() const { return content_area_; }
61 const gfx::Rect& printable_area() const { return printable_area_; } 65 const gfx::Rect& printable_area() const { return printable_area_; }
62 const PageMargins& effective_margins() const { 66 const PageMargins& effective_margins() const {
63 return effective_margins_; 67 return effective_margins_;
64 } 68 }
65 69
66 private: 70 private:
71 // Store |requested_margins_| and update page setup values.
72 void SetRequestedMarginsAndUpdateValues(const PageMargins& requested_margins);
73
67 // Calculate overlay_area_, effective_margins_, and content_area_, based on 74 // Calculate overlay_area_, effective_margins_, and content_area_, based on
68 // a constraint of |bounds| and |text_height|. 75 // a constraint of |bounds| and |text_height|.
69 void CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height); 76 void CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height);
70 77
71 // Physical size of the page, including non-printable margins. 78 // Physical size of the page, including non-printable margins.
72 gfx::Size physical_size_; 79 gfx::Size physical_size_;
73 80
74 // The printable area as specified by the printer driver. We can't get 81 // The printable area as specified by the printer driver. We can't get
75 // larger than this. 82 // larger than this.
76 gfx::Rect printable_area_; 83 gfx::Rect printable_area_;
77 84
78 // The printable area for headers and footers. 85 // The printable area for headers and footers.
79 gfx::Rect overlay_area_; 86 gfx::Rect overlay_area_;
80 87
81 // The printable area as selected by the user's margins. 88 // The printable area as selected by the user's margins.
82 gfx::Rect content_area_; 89 gfx::Rect content_area_;
83 90
84 // Effective margins. 91 // Effective margins.
85 PageMargins effective_margins_; 92 PageMargins effective_margins_;
86 93
87 // Requested margins. 94 // Requested margins.
88 PageMargins requested_margins_; 95 PageMargins requested_margins_;
89 96
97 // True when the |requested_margins_| respects |printable_area_| else false.
vandebo (ex-Chrome) 2011/11/03 17:26:35 True when |effective_margins_|...
kmadhusu 2011/11/03 20:46:54 Done.
98 bool forced_margins_;
99
90 // Space that must be kept free for the overlays. 100 // Space that must be kept free for the overlays.
91 int text_height_; 101 int text_height_;
92 }; 102 };
93 103
94 } // namespace printing 104 } // namespace printing
95 105
96 #endif // PRINTING_PAGE_SETUP_H_ 106 #endif // PRINTING_PAGE_SETUP_H_
OLDNEW
« no previous file with comments | « no previous file | printing/page_setup.cc » ('j') | printing/page_setup.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698