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

Side by Side Diff: printing/page_setup.h

Issue 8201027: Move margin processing code to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix issue that turned up on Windows Created 9 years, 2 months 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
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
(...skipping 28 matching lines...) Expand all
39 ~PageSetup(); 39 ~PageSetup();
40 40
41 void Clear(); 41 void Clear();
42 42
43 // Equality operator. 43 // Equality operator.
44 bool Equals(const PageSetup& rhs) const; 44 bool Equals(const PageSetup& rhs) const;
45 45
46 void Init(const gfx::Size& physical_size, const gfx::Rect& printable_area, 46 void Init(const gfx::Size& physical_size, const gfx::Rect& printable_area,
47 int text_height); 47 int text_height);
48 48
49 // Use |requested_margins| as long as they fall inside the printable area.
49 void SetRequestedMargins(const PageMargins& requested_margins); 50 void SetRequestedMargins(const PageMargins& requested_margins);
50 51
52 // Ignore the printable area, and set the margins to |requested_margins|.
53 void ForceRequestedMargins(const PageMargins& requested_margins);
54
51 // Flips the orientation of the page and recalculates all page areas. 55 // Flips the orientation of the page and recalculates all page areas.
52 void FlipOrientation(); 56 void FlipOrientation();
53 57
54 const gfx::Size& physical_size() const { return physical_size_; } 58 const gfx::Size& physical_size() const { return physical_size_; }
55 const gfx::Rect& overlay_area() const { return overlay_area_; } 59 const gfx::Rect& overlay_area() const { return overlay_area_; }
56 const gfx::Rect& content_area() const { return content_area_; } 60 const gfx::Rect& content_area() const { return content_area_; }
57 const gfx::Rect& printable_area() const { return printable_area_; } 61 const gfx::Rect& printable_area() const { return printable_area_; }
58 const PageMargins& effective_margins() const { 62 const PageMargins& effective_margins() const {
59 return effective_margins_; 63 return effective_margins_;
60 } 64 }
61 65
62 private: 66 private:
67 // Calculate overlay_area_, effective_margins_, and content_area_, based on
68 // a contstraint of |printable_area|
Lei Zhang 2011/10/15 03:42:19 nit: contstraint -> constraint, printable_area ->
vandebo (ex-Chrome) 2011/10/15 20:52:08 Done.
69 void CalculateSizesWithinRect(const gfx::Rect& bounds);
70
63 // Physical size of the page, including non-printable margins. 71 // Physical size of the page, including non-printable margins.
64 gfx::Size physical_size_; 72 gfx::Size physical_size_;
65 73
66 // The printable area as specified by the printer driver. We can't get 74 // The printable area as specified by the printer driver. We can't get
67 // larger than this. 75 // larger than this.
68 gfx::Rect printable_area_; 76 gfx::Rect printable_area_;
69 77
70 // The printable area for headers and footers. 78 // The printable area for headers and footers.
71 gfx::Rect overlay_area_; 79 gfx::Rect overlay_area_;
72 80
73 // The printable area as selected by the user's margins. 81 // The printable area as selected by the user's margins.
74 gfx::Rect content_area_; 82 gfx::Rect content_area_;
75 83
76 // Effective margins. 84 // Effective margins.
77 PageMargins effective_margins_; 85 PageMargins effective_margins_;
78 86
79 // Requested margins. 87 // Requested margins.
80 PageMargins requested_margins_; 88 PageMargins requested_margins_;
81 89
82 // Space that must be kept free for the overlays. 90 // Space that must be kept free for the overlays.
83 int text_height_; 91 int text_height_;
84 }; 92 };
85 93
86 } // namespace printing 94 } // namespace printing
87 95
88 #endif // PRINTING_PAGE_SETUP_H_ 96 #endif // PRINTING_PAGE_SETUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698