2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-11-05 02:21:50 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-11-05 02:21:50 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-11-05 02:21:50 +03:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-11-05 02:21:50 +03:00
|
|
|
#ifndef nsSimplePageSequence_h___
|
|
|
|
#define nsSimplePageSequence_h___
|
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
#include "nsIPageSequenceFrame.h"
|
2001-01-27 17:09:34 +03:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsIPrintOptions.h"
|
1998-11-05 02:21:50 +03:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
//-----------------------------------------------
|
|
|
|
// This class maintains all the data that
|
|
|
|
// is used by all the page frame
|
|
|
|
// It lives while the nsSimplePageSequenceFrame lives
|
|
|
|
class nsSharedPageData {
|
|
|
|
public:
|
|
|
|
nsSharedPageData();
|
|
|
|
~nsSharedPageData();
|
|
|
|
|
|
|
|
PRUnichar * mDateTimeStr;
|
|
|
|
nsFont * mHeadFootFont;
|
|
|
|
PRUnichar * mPageNumFormat;
|
|
|
|
PRUnichar * mPageNumAndTotalsFormat;
|
|
|
|
|
|
|
|
nsRect mReflowRect;
|
|
|
|
nsMargin mReflowMargin;
|
|
|
|
nsSize mShadowSize;
|
|
|
|
nsMargin mExtraMargin;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintOptions> mPrintOptions;
|
|
|
|
};
|
|
|
|
|
1998-11-05 02:21:50 +03:00
|
|
|
// Simple page sequence frame class. Used when we're in paginated mode
|
1998-12-07 06:43:02 +03:00
|
|
|
class nsSimplePageSequenceFrame : public nsContainerFrame,
|
|
|
|
public nsIPageSequenceFrame {
|
1998-11-05 02:21:50 +03:00
|
|
|
public:
|
1999-12-05 02:49:50 +03:00
|
|
|
friend nsresult NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
1999-05-12 02:03:29 +04:00
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
|
|
|
|
|
|
// nsIFrameReflow
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-11-05 02:21:50 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aMaxSize,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2001-09-26 18:01:26 +04:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
// nsIPageSequenceFrame
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Print(nsIPresContext* aPresContext,
|
2001-01-27 17:09:34 +03:00
|
|
|
nsIPrintOptions* aPrintOptions,
|
1998-12-07 06:43:02 +03:00
|
|
|
nsIPrintStatusCallback* aStatusCallback);
|
2001-01-27 17:09:34 +03:00
|
|
|
NS_IMETHOD SetOffsets(nscoord aStartOffset, nscoord aEndOffset);
|
|
|
|
NS_IMETHOD SetPageNo(PRInt32 aPageNo) { return NS_OK;}
|
2001-11-03 17:59:39 +03:00
|
|
|
NS_IMETHOD SetSelectionHeight(nscoord aYOffset, nscoord aHeight) { mYSelOffset = aYOffset; mSelectionHeight = aHeight; return NS_OK; }
|
1998-12-07 06:43:02 +03:00
|
|
|
|
2001-03-27 15:56:03 +04:00
|
|
|
// Async Printing
|
|
|
|
NS_IMETHOD StartPrint(nsIPresContext* aPresContext,
|
|
|
|
nsIPrintOptions* aPrintOptions);
|
|
|
|
NS_IMETHOD PrintNextPage(nsIPresContext* aPresContext,
|
|
|
|
nsIPrintOptions* aPrintOptions);
|
|
|
|
NS_IMETHOD GetCurrentPageNum(PRInt32* aPageNum);
|
|
|
|
NS_IMETHOD GetNumPages(PRInt32* aNumPages);
|
|
|
|
NS_IMETHOD IsDoingPrintRange(PRBool* aDoing);
|
|
|
|
NS_IMETHOD GetPrintRange(PRInt32* aFromPage, PRInt32* aToPage);
|
2001-04-12 17:04:29 +04:00
|
|
|
NS_IMETHOD SkipPageBegin() { mSkipPageBegin = PR_TRUE; return NS_OK; }
|
|
|
|
NS_IMETHOD SkipPageEnd() { mSkipPageEnd = PR_TRUE; return NS_OK; }
|
|
|
|
NS_IMETHOD DoPageEnd(nsIPresContext* aPresContext);
|
|
|
|
NS_IMETHOD GetPrintThisPage(PRBool* aPrintThisPage) { *aPrintThisPage = mPrintThisPage; return NS_OK; }
|
|
|
|
NS_IMETHOD SetOffset(nscoord aX, nscoord aY) { mOffsetX = aX; mOffsetY = aY; return NS_OK; }
|
|
|
|
NS_IMETHOD SuppressHeadersAndFooters(PRBool aDoSup);
|
|
|
|
NS_IMETHOD SetClipRect(nsIPresContext* aPresContext, nsRect* aSize);
|
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
NS_IMETHOD SizeTo(nsIPresContext* aPresContext,
|
|
|
|
nscoord aWidth,
|
|
|
|
nscoord aHeight);
|
2001-04-12 17:04:29 +04:00
|
|
|
#ifdef NS_DEBUG
|
1998-11-05 02:21:50 +03:00
|
|
|
// Debugging
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
2001-04-12 17:04:29 +04:00
|
|
|
NS_IMETHOD SetDebugFD(FILE* aFD);
|
|
|
|
FILE * mDebugFD;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-07 06:43:02 +03:00
|
|
|
|
|
|
|
protected:
|
1999-05-12 02:03:29 +04:00
|
|
|
nsSimplePageSequenceFrame();
|
2001-01-27 17:09:34 +03:00
|
|
|
virtual ~nsSimplePageSequenceFrame();
|
1998-12-07 06:43:02 +03:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
nsresult IncrementalReflow(nsIPresContext* aPresContext,
|
1999-07-03 06:22:10 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsSize& aPageSize,
|
|
|
|
nscoord aX,
|
|
|
|
nscoord& aY);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
nsresult CreateContinuingPageFrame(nsIPresContext* aPresContext,
|
1999-07-03 06:22:10 +04:00
|
|
|
nsIFrame* aPageFrame,
|
|
|
|
nsIFrame** aContinuingFrame);
|
2001-09-26 18:01:26 +04:00
|
|
|
|
|
|
|
void SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, PRBool aPageNumOnly);
|
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
// SharedPageData Helper methods
|
|
|
|
void SetDateTimeStr(PRUnichar * aDateTimeStr);
|
|
|
|
void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly);
|
|
|
|
void SetPageSizes(const nsRect& aRect, const nsMargin& aMarginRect);
|
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();}
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();}
|
2001-01-27 17:09:34 +03:00
|
|
|
|
|
|
|
nscoord mStartOffset;
|
|
|
|
nscoord mEndOffset;
|
|
|
|
|
|
|
|
nsMargin mMargin;
|
|
|
|
PRBool mIsPrintingSelection;
|
2001-03-27 15:56:03 +04:00
|
|
|
|
|
|
|
// Asynch Printing
|
|
|
|
PRInt32 mPageNum;
|
|
|
|
PRInt32 mTotalPages;
|
|
|
|
PRInt32 mPrintedPageNum;
|
|
|
|
nsIFrame * mCurrentPageFrame;
|
|
|
|
PRPackedBool mDoingPageRange;
|
|
|
|
PRInt32 mPrintRangeType;
|
|
|
|
PRInt32 mFromPageNum;
|
|
|
|
PRInt32 mToPageNum;
|
2001-04-12 17:04:29 +04:00
|
|
|
PRPackedBool mSkipPageBegin;
|
|
|
|
PRPackedBool mSkipPageEnd;
|
|
|
|
PRPackedBool mPrintThisPage;
|
|
|
|
|
|
|
|
PRPackedBool mSupressHF;
|
|
|
|
nscoord mOffsetX;
|
|
|
|
nscoord mOffsetY;
|
2001-03-27 15:56:03 +04:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
nsSize mSize;
|
|
|
|
nsSharedPageData* mPageData; // data shared by all the nsPageFrames
|
|
|
|
|
|
|
|
// Selection Printing Info
|
|
|
|
nscoord mSelectionHeight;
|
|
|
|
nscoord mYSelOffset;
|
|
|
|
|
|
|
|
|
1998-11-05 02:21:50 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsSimplePageSequence_h___ */
|
|
|
|
|