OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_PRINTED_PAGE_H_ | 5 #ifndef PRINTING_PRINTED_PAGE_H_ |
6 #define PRINTING_PRINTED_PAGE_H_ | 6 #define PRINTING_PRINTED_PAGE_H_ |
7 | 7 |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 const gfx::Rect& page_content_rect, | 27 const gfx::Rect& page_content_rect, |
28 bool has_visible_overlays); | 28 bool has_visible_overlays); |
29 | 29 |
30 // Getters | 30 // Getters |
31 int page_number() const { return page_number_; } | 31 int page_number() const { return page_number_; } |
32 const NativeMetafile* native_metafile() const; | 32 const NativeMetafile* native_metafile() const; |
33 const gfx::Size& page_size() const { return page_size_; } | 33 const gfx::Size& page_size() const { return page_size_; } |
34 const gfx::Rect& page_content_rect() const { return page_content_rect_; } | 34 const gfx::Rect& page_content_rect() const { return page_content_rect_; } |
35 bool has_visible_overlays() const { return has_visible_overlays_; } | 35 bool has_visible_overlays() const { return has_visible_overlays_; } |
36 | 36 |
| 37 // Get page content rect adjusted based on |
| 38 // http://dev.w3.org/csswg/css3-page/#positioning-page-box |
| 39 void GetCenteredPageContentRect(const gfx::Size& paper_size, |
| 40 gfx::Rect* content_rect) const; |
| 41 |
37 private: | 42 private: |
38 friend class base::RefCountedThreadSafe<PrintedPage>; | 43 friend class base::RefCountedThreadSafe<PrintedPage>; |
39 | 44 |
40 ~PrintedPage(); | 45 ~PrintedPage(); |
41 | 46 |
42 // Page number inside the printed document. | 47 // Page number inside the printed document. |
43 const int page_number_; | 48 const int page_number_; |
44 | 49 |
45 // Actual paint data. | 50 // Actual paint data. |
46 const scoped_ptr<NativeMetafile> native_metafile_; | 51 const scoped_ptr<NativeMetafile> native_metafile_; |
47 | 52 |
48 // The physical page size. To support multiple page formats inside on print | 53 // The physical page size. To support multiple page formats inside on print |
49 // job. | 54 // job. |
50 const gfx::Size page_size_; | 55 const gfx::Size page_size_; |
51 | 56 |
52 // The printable area of the page. | 57 // The printable area of the page. |
53 const gfx::Rect page_content_rect_; | 58 const gfx::Rect page_content_rect_; |
54 | 59 |
55 // True if the overlays should be visible in this page. | 60 // True if the overlays should be visible in this page. |
56 bool has_visible_overlays_; | 61 bool has_visible_overlays_; |
57 | 62 |
58 DISALLOW_COPY_AND_ASSIGN(PrintedPage); | 63 DISALLOW_COPY_AND_ASSIGN(PrintedPage); |
59 }; | 64 }; |
60 | 65 |
61 } // namespace printing | 66 } // namespace printing |
62 | 67 |
63 #endif // PRINTING_PRINTED_PAGE_H_ | 68 #endif // PRINTING_PRINTED_PAGE_H_ |
OLD | NEW |