1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/nsPageFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 +#ifndef nsPageFrame_h___ 1.9 +#define nsPageFrame_h___ 1.10 + 1.11 +#include "mozilla/Attributes.h" 1.12 +#include "nsContainerFrame.h" 1.13 +#include "nsLeafFrame.h" 1.14 + 1.15 +class nsSharedPageData; 1.16 + 1.17 +// Page frame class used by the simple page sequence frame 1.18 +class nsPageFrame : public nsContainerFrame { 1.19 + 1.20 +public: 1.21 + NS_DECL_FRAMEARENA_HELPERS 1.22 + 1.23 + friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 1.24 + 1.25 + virtual nsresult Reflow(nsPresContext* aPresContext, 1.26 + nsHTMLReflowMetrics& aDesiredSize, 1.27 + const nsHTMLReflowState& aMaxSize, 1.28 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.29 + 1.30 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.31 + const nsRect& aDirtyRect, 1.32 + const nsDisplayListSet& aLists) MOZ_OVERRIDE; 1.33 + 1.34 + /** 1.35 + * Get the "type" of the frame 1.36 + * 1.37 + * @see nsGkAtoms::pageFrame 1.38 + */ 1.39 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.40 + 1.41 +#ifdef DEBUG_FRAME_DUMP 1.42 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; 1.43 +#endif 1.44 + 1.45 + ////////////////// 1.46 + // For Printing 1.47 + ////////////////// 1.48 + 1.49 + // Tell the page which page number it is out of how many 1.50 + virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages); 1.51 + 1.52 + virtual void SetSharedPageData(nsSharedPageData* aPD); 1.53 + 1.54 + // We must allow Print Preview UI to have a background, no matter what the 1.55 + // user's settings 1.56 + virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; } 1.57 + 1.58 + void PaintHeaderFooter(nsRenderingContext& aRenderingContext, 1.59 + nsPoint aPt); 1.60 + 1.61 +protected: 1.62 + nsPageFrame(nsStyleContext* aContext); 1.63 + virtual ~nsPageFrame(); 1.64 + 1.65 + typedef enum { 1.66 + eHeader, 1.67 + eFooter 1.68 + } nsHeaderFooterEnum; 1.69 + 1.70 + nscoord GetXPosition(nsRenderingContext& aRenderingContext, 1.71 + const nsRect& aRect, 1.72 + int32_t aJust, 1.73 + const nsString& aStr); 1.74 + 1.75 + void DrawHeaderFooter(nsRenderingContext& aRenderingContext, 1.76 + nsHeaderFooterEnum aHeaderFooter, 1.77 + int32_t aJust, 1.78 + const nsString& sStr, 1.79 + const nsRect& aRect, 1.80 + nscoord aHeight, 1.81 + nscoord aAscent, 1.82 + nscoord aWidth); 1.83 + 1.84 + void DrawHeaderFooter(nsRenderingContext& aRenderingContext, 1.85 + nsHeaderFooterEnum aHeaderFooter, 1.86 + const nsString& aStrLeft, 1.87 + const nsString& aStrRight, 1.88 + const nsString& aStrCenter, 1.89 + const nsRect& aRect, 1.90 + nscoord aAscent, 1.91 + nscoord aHeight); 1.92 + 1.93 + void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr); 1.94 + 1.95 + int32_t mPageNum; 1.96 + int32_t mTotNumPages; 1.97 + 1.98 + nsSharedPageData* mPD; 1.99 +}; 1.100 + 1.101 + 1.102 +class nsPageBreakFrame : public nsLeafFrame 1.103 +{ 1.104 + NS_DECL_FRAMEARENA_HELPERS 1.105 + 1.106 + nsPageBreakFrame(nsStyleContext* aContext); 1.107 + ~nsPageBreakFrame(); 1.108 + 1.109 + virtual nsresult Reflow(nsPresContext* aPresContext, 1.110 + nsHTMLReflowMetrics& aDesiredSize, 1.111 + const nsHTMLReflowState& aReflowState, 1.112 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.113 + 1.114 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.115 + 1.116 +#ifdef DEBUG_FRAME_DUMP 1.117 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; 1.118 +#endif 1.119 + 1.120 +protected: 1.121 + 1.122 + virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; 1.123 + virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE; 1.124 + 1.125 + bool mHaveReflowed; 1.126 + 1.127 + friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 1.128 +}; 1.129 + 1.130 +#endif /* nsPageFrame_h___ */ 1.131 +