Bug 575870 - Enable the firefox button on xp themed, classic, and aero basic. r=dao...
[mozilla-central.git] / layout / generic / nsPageFrame.h
blobd912083743f84fcb373ed18827ab73531a56c856
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #ifndef nsPageFrame_h___
38 #define nsPageFrame_h___
40 #include "nsContainerFrame.h"
41 #include "nsLeafFrame.h"
43 class nsSharedPageData;
45 // Page frame class used by the simple page sequence frame
46 class nsPageFrame : public nsContainerFrame {
48 public:
49 NS_DECL_FRAMEARENA_HELPERS
51 friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
53 NS_IMETHOD Reflow(nsPresContext* aPresContext,
54 nsHTMLReflowMetrics& aDesiredSize,
55 const nsHTMLReflowState& aMaxSize,
56 nsReflowStatus& aStatus);
58 NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
59 const nsRect& aDirtyRect,
60 const nsDisplayListSet& aLists);
62 virtual PRBool IsContainingBlock() const;
64 /**
65 * Get the "type" of the frame
67 * @see nsGkAtoms::pageFrame
69 virtual nsIAtom* GetType() const;
71 #ifdef NS_DEBUG
72 NS_IMETHOD GetFrameName(nsAString& aResult) const;
73 #endif
75 //////////////////
76 // For Printing
77 //////////////////
79 // Tell the page which page number it is out of how many
80 virtual void SetPageNumInfo(PRInt32 aPageNumber, PRInt32 aTotalPages);
82 virtual void SetSharedPageData(nsSharedPageData* aPD);
84 void PaintPrintPreviewBackground(nsIRenderingContext& aRenderingContext,
85 nsPoint aPt);
86 void PaintHeaderFooter(nsIRenderingContext& aRenderingContext,
87 nsPoint aPt);
88 void PaintPageContent(nsIRenderingContext& aRenderingContext,
89 const nsRect& aDirtyRect,
90 nsPoint aPt);
92 protected:
93 nsPageFrame(nsStyleContext* aContext);
94 virtual ~nsPageFrame();
96 typedef enum {
97 eHeader,
98 eFooter
99 } nsHeaderFooterEnum;
101 nscoord GetXPosition(nsIRenderingContext& aRenderingContext,
102 const nsRect& aRect,
103 PRInt32 aJust,
104 const nsString& aStr);
106 void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
107 nsHeaderFooterEnum aHeaderFooter,
108 PRInt32 aJust,
109 const nsString& sStr,
110 const nsRect& aRect,
111 nscoord aHeight,
112 nscoord aAscent,
113 nscoord aWidth);
115 void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
116 nsHeaderFooterEnum aHeaderFooter,
117 const nsString& aStrLeft,
118 const nsString& aStrRight,
119 const nsString& aStrCenter,
120 const nsRect& aRect,
121 nscoord aAscent,
122 nscoord aHeight);
124 void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);
126 PRInt32 mPageNum;
127 PRInt32 mTotNumPages;
129 nsSharedPageData* mPD;
133 class nsPageBreakFrame : public nsLeafFrame
135 NS_DECL_FRAMEARENA_HELPERS
137 nsPageBreakFrame(nsStyleContext* aContext);
138 ~nsPageBreakFrame();
140 NS_IMETHOD Reflow(nsPresContext* aPresContext,
141 nsHTMLReflowMetrics& aDesiredSize,
142 const nsHTMLReflowState& aReflowState,
143 nsReflowStatus& aStatus);
145 virtual nsIAtom* GetType() const;
147 #ifdef NS_DEBUG
148 NS_IMETHOD GetFrameName(nsAString& aResult) const;
149 #endif
151 protected:
153 virtual nscoord GetIntrinsicWidth();
154 virtual nscoord GetIntrinsicHeight();
156 PRBool mHaveReflowed;
158 friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
161 #endif /* nsPageFrame_h___ */