/src/mozilla-central/layout/generic/nsPageFrame.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | #ifndef nsPageFrame_h___ |
7 | | #define nsPageFrame_h___ |
8 | | |
9 | | #include "mozilla/Attributes.h" |
10 | | #include "nsContainerFrame.h" |
11 | | #include "nsLeafFrame.h" |
12 | | |
13 | | class nsFontMetrics; |
14 | | class nsSharedPageData; |
15 | | |
16 | | // Page frame class used by the simple page sequence frame |
17 | | class nsPageFrame final : public nsContainerFrame { |
18 | | |
19 | | public: |
20 | | NS_DECL_QUERYFRAME |
21 | | NS_DECL_FRAMEARENA_HELPERS(nsPageFrame) |
22 | | |
23 | | friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell, |
24 | | ComputedStyle* aStyle); |
25 | | |
26 | | virtual void Reflow(nsPresContext* aPresContext, |
27 | | ReflowOutput& aDesiredSize, |
28 | | const ReflowInput& aReflowInput, |
29 | | nsReflowStatus& aStatus) override; |
30 | | |
31 | | virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
32 | | const nsDisplayListSet& aLists) override; |
33 | | |
34 | | #ifdef DEBUG_FRAME_DUMP |
35 | | virtual nsresult GetFrameName(nsAString& aResult) const override; |
36 | | #endif |
37 | | |
38 | | ////////////////// |
39 | | // For Printing |
40 | | ////////////////// |
41 | | |
42 | | // Tell the page which page number it is out of how many |
43 | | virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages); |
44 | | |
45 | | virtual void SetSharedPageData(nsSharedPageData* aPD); |
46 | | |
47 | | // We must allow Print Preview UI to have a background, no matter what the |
48 | | // user's settings |
49 | 0 | virtual bool HonorPrintBackgroundSettings() override { return false; } |
50 | | |
51 | | void PaintHeaderFooter(gfxContext& aRenderingContext, |
52 | | nsPoint aPt, bool aSubpixelAA); |
53 | | |
54 | | /** |
55 | | * Return our page content frame. |
56 | | */ |
57 | | void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; |
58 | | |
59 | | protected: |
60 | | explicit nsPageFrame(ComputedStyle* aStyle); |
61 | | virtual ~nsPageFrame(); |
62 | | |
63 | | typedef enum { |
64 | | eHeader, |
65 | | eFooter |
66 | | } nsHeaderFooterEnum; |
67 | | |
68 | | nscoord GetXPosition(gfxContext& aRenderingContext, |
69 | | nsFontMetrics& aFontMetrics, |
70 | | const nsRect& aRect, |
71 | | int32_t aJust, |
72 | | const nsString& aStr); |
73 | | |
74 | | void DrawHeaderFooter(gfxContext& aRenderingContext, |
75 | | nsFontMetrics& aFontMetrics, |
76 | | nsHeaderFooterEnum aHeaderFooter, |
77 | | int32_t aJust, |
78 | | const nsString& sStr, |
79 | | const nsRect& aRect, |
80 | | nscoord aHeight, |
81 | | nscoord aAscent, |
82 | | nscoord aWidth); |
83 | | |
84 | | void DrawHeaderFooter(gfxContext& aRenderingContext, |
85 | | nsFontMetrics& aFontMetrics, |
86 | | nsHeaderFooterEnum aHeaderFooter, |
87 | | const nsString& aStrLeft, |
88 | | const nsString& aStrRight, |
89 | | const nsString& aStrCenter, |
90 | | const nsRect& aRect, |
91 | | nscoord aAscent, |
92 | | nscoord aHeight); |
93 | | |
94 | | void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr); |
95 | | |
96 | | int32_t mPageNum; |
97 | | int32_t mTotNumPages; |
98 | | |
99 | | nsSharedPageData* mPD; |
100 | | nsMargin mPageContentMargin; |
101 | | }; |
102 | | |
103 | | |
104 | | class nsPageBreakFrame final : public nsLeafFrame |
105 | | { |
106 | | NS_DECL_FRAMEARENA_HELPERS(nsPageBreakFrame) |
107 | | |
108 | | explicit nsPageBreakFrame(ComputedStyle* aStyle); |
109 | | ~nsPageBreakFrame(); |
110 | | |
111 | | virtual void Reflow(nsPresContext* aPresContext, |
112 | | ReflowOutput& aDesiredSize, |
113 | | const ReflowInput& aReflowInput, |
114 | | nsReflowStatus& aStatus) override; |
115 | | |
116 | | #ifdef DEBUG_FRAME_DUMP |
117 | | virtual nsresult GetFrameName(nsAString& aResult) const override; |
118 | | #endif |
119 | | |
120 | | protected: |
121 | | |
122 | | virtual nscoord GetIntrinsicISize() override; |
123 | | virtual nscoord GetIntrinsicBSize() override; |
124 | | |
125 | | bool mHaveReflowed; |
126 | | |
127 | | friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, |
128 | | ComputedStyle* aStyle); |
129 | | }; |
130 | | |
131 | | #endif /* nsPageFrame_h___ */ |
132 | | |