michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsPageFrame_h___ michael@0: #define nsPageFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsContainerFrame.h" michael@0: #include "nsLeafFrame.h" michael@0: michael@0: class nsSharedPageData; michael@0: michael@0: // Page frame class used by the simple page sequence frame michael@0: class nsPageFrame : public nsContainerFrame { michael@0: michael@0: public: michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aMaxSize, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, michael@0: const nsRect& aDirtyRect, michael@0: const nsDisplayListSet& aLists) MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * Get the "type" of the frame michael@0: * michael@0: * @see nsGkAtoms::pageFrame michael@0: */ michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: ////////////////// michael@0: // For Printing michael@0: ////////////////// michael@0: michael@0: // Tell the page which page number it is out of how many michael@0: virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages); michael@0: michael@0: virtual void SetSharedPageData(nsSharedPageData* aPD); michael@0: michael@0: // We must allow Print Preview UI to have a background, no matter what the michael@0: // user's settings michael@0: virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; } michael@0: michael@0: void PaintHeaderFooter(nsRenderingContext& aRenderingContext, michael@0: nsPoint aPt); michael@0: michael@0: protected: michael@0: nsPageFrame(nsStyleContext* aContext); michael@0: virtual ~nsPageFrame(); michael@0: michael@0: typedef enum { michael@0: eHeader, michael@0: eFooter michael@0: } nsHeaderFooterEnum; michael@0: michael@0: nscoord GetXPosition(nsRenderingContext& aRenderingContext, michael@0: const nsRect& aRect, michael@0: int32_t aJust, michael@0: const nsString& aStr); michael@0: michael@0: void DrawHeaderFooter(nsRenderingContext& aRenderingContext, michael@0: nsHeaderFooterEnum aHeaderFooter, michael@0: int32_t aJust, michael@0: const nsString& sStr, michael@0: const nsRect& aRect, michael@0: nscoord aHeight, michael@0: nscoord aAscent, michael@0: nscoord aWidth); michael@0: michael@0: void DrawHeaderFooter(nsRenderingContext& aRenderingContext, michael@0: nsHeaderFooterEnum aHeaderFooter, michael@0: const nsString& aStrLeft, michael@0: const nsString& aStrRight, michael@0: const nsString& aStrCenter, michael@0: const nsRect& aRect, michael@0: nscoord aAscent, michael@0: nscoord aHeight); michael@0: michael@0: void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr); michael@0: michael@0: int32_t mPageNum; michael@0: int32_t mTotNumPages; michael@0: michael@0: nsSharedPageData* mPD; michael@0: }; michael@0: michael@0: michael@0: class nsPageBreakFrame : public nsLeafFrame michael@0: { michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: nsPageBreakFrame(nsStyleContext* aContext); michael@0: ~nsPageBreakFrame(); michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: protected: michael@0: michael@0: virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; michael@0: virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE; michael@0: michael@0: bool mHaveReflowed; michael@0: michael@0: friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: }; michael@0: michael@0: #endif /* nsPageFrame_h___ */ michael@0: