Bug 417561, disable tagging of Talkback now we have prebuilt packages, r=rhelmer
[mozilla-1.9.git] / layout / generic / nsSimplePageSequence.h
bloba3937b482e733809abd900e32d3c2a5b888e18e0
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 nsSimplePageSequence_h___
38 #define nsSimplePageSequence_h___
40 #include "nsIPageSequenceFrame.h"
41 #include "nsContainerFrame.h"
42 #include "nsIPrintSettings.h"
43 #include "nsIPrintOptions.h"
44 #include "nsIDateTimeFormat.h"
46 //-----------------------------------------------
47 // This class maintains all the data that
48 // is used by all the page frame
49 // It lives while the nsSimplePageSequenceFrame lives
50 class nsSharedPageData {
51 public:
52 nsSharedPageData();
53 ~nsSharedPageData();
55 PRUnichar * mDateTimeStr;
56 nsFont * mHeadFootFont;
57 PRUnichar * mPageNumFormat;
58 PRUnichar * mPageNumAndTotalsFormat;
59 PRUnichar * mDocTitle;
60 PRUnichar * mDocURL;
62 nsSize mReflowSize;
63 nsMargin mReflowMargin;
64 // shadow of page in PrintPreview; drawn around bottom and right edges
65 nsSize mShadowSize;
66 // Extra Margin between the device area and the edge of the page;
67 // approximates unprintable area
68 nsMargin mExtraMargin;
69 // Margin for headers and footers; it defaults to 4/100 of an inch on UNIX
70 // and 0 elsewhere; I think it has to do with some inconsistency in page size
71 // computations
72 nsMargin mEdgePaperMargin;
74 nsCOMPtr<nsIPrintSettings> mPrintSettings;
75 nsCOMPtr<nsIPrintOptions> mPrintOptions;
77 nscoord mPageContentXMost; // xmost size from Reflow(width)
78 nscoord mPageContentSize; // constrained size (width)
81 // Simple page sequence frame class. Used when we're in paginated mode
82 class nsSimplePageSequenceFrame : public nsContainerFrame,
83 public nsIPageSequenceFrame {
84 public:
85 friend nsIFrame* NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
87 // nsISupports
88 NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
90 // nsIFrame
91 NS_IMETHOD Reflow(nsPresContext* aPresContext,
92 nsHTMLReflowMetrics& aDesiredSize,
93 const nsHTMLReflowState& aMaxSize,
94 nsReflowStatus& aStatus);
96 NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
97 const nsRect& aDirtyRect,
98 const nsDisplayListSet& aLists);
100 // nsIPageSequenceFrame
101 NS_IMETHOD SetPageNo(PRInt32 aPageNo) { return NS_OK;}
102 NS_IMETHOD SetSelectionHeight(nscoord aYOffset, nscoord aHeight) { mYSelOffset = aYOffset; mSelectionHeight = aHeight; return NS_OK; }
103 NS_IMETHOD SetTotalNumPages(PRInt32 aTotal) { mTotalPages = aTotal; return NS_OK; }
105 // Gets the dead space (the gray area) around the Print Preview Page
106 NS_IMETHOD GetDeadSpaceValue(nscoord* aValue) { *aValue = NS_INCHES_TO_TWIPS(0.25); return NS_OK; }
108 // For Shrink To Fit
109 NS_IMETHOD GetSTFPercent(float& aSTFPercent);
111 // Async Printing
112 NS_IMETHOD StartPrint(nsPresContext* aPresContext,
113 nsIPrintSettings* aPrintSettings,
114 PRUnichar* aDocTitle,
115 PRUnichar* aDocURL);
116 NS_IMETHOD PrintNextPage();
117 NS_IMETHOD GetCurrentPageNum(PRInt32* aPageNum);
118 NS_IMETHOD GetNumPages(PRInt32* aNumPages);
119 NS_IMETHOD IsDoingPrintRange(PRBool* aDoing);
120 NS_IMETHOD GetPrintRange(PRInt32* aFromPage, PRInt32* aToPage);
121 NS_IMETHOD DoPageEnd();
124 * Get the "type" of the frame
126 * @see nsGkAtoms::sequenceFrame
128 virtual nsIAtom* GetType() const;
130 #ifdef NS_DEBUG
131 NS_IMETHOD GetFrameName(nsAString& aResult) const;
132 #endif
134 void PaintPageSequence(nsIRenderingContext& aRenderingContext,
135 const nsRect& aDirtyRect,
136 nsPoint aPt);
138 protected:
139 nsSimplePageSequenceFrame(nsStyleContext* aContext);
140 virtual ~nsSimplePageSequenceFrame();
142 nsresult CreateContinuingPageFrame(nsPresContext* aPresContext,
143 nsIFrame* aPageFrame,
144 nsIFrame** aContinuingFrame);
146 void SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, PRBool aPageNumOnly);
148 // SharedPageData Helper methods
149 void SetDateTimeStr(PRUnichar * aDateTimeStr);
150 void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly);
152 NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();}
153 NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();}
155 nsMargin mMargin;
156 PRBool mIsPrintingSelection;
158 // Asynch Printing
159 PRInt32 mPageNum;
160 PRInt32 mTotalPages;
161 nsIFrame * mCurrentPageFrame;
162 PRPackedBool mDoingPageRange;
163 PRInt32 mPrintRangeType;
164 PRInt32 mFromPageNum;
165 PRInt32 mToPageNum;
166 PRPackedBool mPrintThisPage;
168 nsSize mSize;
169 nsSharedPageData* mPageData; // data shared by all the nsPageFrames
171 // Selection Printing Info
172 nscoord mSelectionHeight;
173 nscoord mYSelOffset;
175 // I18N date formatter service which we'll want to cache locally.
176 nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
180 #endif /* nsSimplePageSequence_h___ */