Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 the margin values in anti-clockwise direction. | |
| 19 void Rotate(); | |
| 20 | |
| 18 void Clear(); | 21 void Clear(); |
| 19 | 22 |
| 20 // Equality operator. | 23 // Equality operator. |
| 21 bool Equals(const PageMargins& rhs) const; | 24 bool Equals(const PageMargins& rhs) const; |
| 22 | 25 |
| 23 // Vertical space for the overlay from the top of the sheet. | 26 // Vertical space for the overlay from the top of the sheet. |
| 24 int header; | 27 int header; |
| 25 // Vertical space for the overlay from the bottom of the sheet. | 28 // Vertical space for the overlay from the bottom of the sheet. |
| 26 int footer; | 29 int footer; |
| 27 // Margin on each side of the sheet. | 30 // Margin on each side of the sheet. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 57 | 60 |
| 58 const gfx::Size& physical_size() const { return physical_size_; } | 61 const gfx::Size& physical_size() const { return physical_size_; } |
| 59 const gfx::Rect& overlay_area() const { return overlay_area_; } | 62 const gfx::Rect& overlay_area() const { return overlay_area_; } |
| 60 const gfx::Rect& content_area() const { return content_area_; } | 63 const gfx::Rect& content_area() const { return content_area_; } |
| 61 const gfx::Rect& printable_area() const { return printable_area_; } | 64 const gfx::Rect& printable_area() const { return printable_area_; } |
| 62 const PageMargins& effective_margins() const { | 65 const PageMargins& effective_margins() const { |
| 63 return effective_margins_; | 66 return effective_margins_; |
| 64 } | 67 } |
| 65 | 68 |
| 66 private: | 69 private: |
| 70 // Store |requested_margins_| and update page setup values. | |
| 71 void SetRequestedMarginsAndUpdateValues(const PageMargins& requested_margins); | |
|
vandebo (ex-Chrome)
2011/11/03 21:12:57
nit: SetRequestedMarginsAndCalculateSizes
kmadhusu
2011/11/03 22:37:39
Done.
| |
| 72 | |
| 67 // Calculate overlay_area_, effective_margins_, and content_area_, based on | 73 // Calculate overlay_area_, effective_margins_, and content_area_, based on |
| 68 // a constraint of |bounds| and |text_height|. | 74 // a constraint of |bounds| and |text_height|. |
| 69 void CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height); | 75 void CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height); |
| 70 | 76 |
| 71 // Physical size of the page, including non-printable margins. | 77 // Physical size of the page, including non-printable margins. |
| 72 gfx::Size physical_size_; | 78 gfx::Size physical_size_; |
| 73 | 79 |
| 74 // The printable area as specified by the printer driver. We can't get | 80 // The printable area as specified by the printer driver. We can't get |
| 75 // larger than this. | 81 // larger than this. |
| 76 gfx::Rect printable_area_; | 82 gfx::Rect printable_area_; |
| 77 | 83 |
| 78 // The printable area for headers and footers. | 84 // The printable area for headers and footers. |
| 79 gfx::Rect overlay_area_; | 85 gfx::Rect overlay_area_; |
| 80 | 86 |
| 81 // The printable area as selected by the user's margins. | 87 // The printable area as selected by the user's margins. |
| 82 gfx::Rect content_area_; | 88 gfx::Rect content_area_; |
| 83 | 89 |
| 84 // Effective margins. | 90 // Effective margins. |
| 85 PageMargins effective_margins_; | 91 PageMargins effective_margins_; |
| 86 | 92 |
| 87 // Requested margins. | 93 // Requested margins. |
| 88 PageMargins requested_margins_; | 94 PageMargins requested_margins_; |
| 89 | 95 |
| 96 // True when |effective_margins_| respects |printable_area_| else false. | |
| 97 bool forced_margins_; | |
| 98 | |
| 90 // Space that must be kept free for the overlays. | 99 // Space that must be kept free for the overlays. |
| 91 int text_height_; | 100 int text_height_; |
| 92 }; | 101 }; |
| 93 | 102 |
| 94 } // namespace printing | 103 } // namespace printing |
| 95 | 104 |
| 96 #endif // PRINTING_PAGE_SETUP_H_ | 105 #endif // PRINTING_PAGE_SETUP_H_ |
| OLD | NEW |