layout/generic/nsPageFrame.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5 #ifndef nsPageFrame_h___
michael@0 6 #define nsPageFrame_h___
michael@0 7
michael@0 8 #include "mozilla/Attributes.h"
michael@0 9 #include "nsContainerFrame.h"
michael@0 10 #include "nsLeafFrame.h"
michael@0 11
michael@0 12 class nsSharedPageData;
michael@0 13
michael@0 14 // Page frame class used by the simple page sequence frame
michael@0 15 class nsPageFrame : public nsContainerFrame {
michael@0 16
michael@0 17 public:
michael@0 18 NS_DECL_FRAMEARENA_HELPERS
michael@0 19
michael@0 20 friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 21
michael@0 22 virtual nsresult Reflow(nsPresContext* aPresContext,
michael@0 23 nsHTMLReflowMetrics& aDesiredSize,
michael@0 24 const nsHTMLReflowState& aMaxSize,
michael@0 25 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 26
michael@0 27 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 28 const nsRect& aDirtyRect,
michael@0 29 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 30
michael@0 31 /**
michael@0 32 * Get the "type" of the frame
michael@0 33 *
michael@0 34 * @see nsGkAtoms::pageFrame
michael@0 35 */
michael@0 36 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 37
michael@0 38 #ifdef DEBUG_FRAME_DUMP
michael@0 39 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 40 #endif
michael@0 41
michael@0 42 //////////////////
michael@0 43 // For Printing
michael@0 44 //////////////////
michael@0 45
michael@0 46 // Tell the page which page number it is out of how many
michael@0 47 virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages);
michael@0 48
michael@0 49 virtual void SetSharedPageData(nsSharedPageData* aPD);
michael@0 50
michael@0 51 // We must allow Print Preview UI to have a background, no matter what the
michael@0 52 // user's settings
michael@0 53 virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
michael@0 54
michael@0 55 void PaintHeaderFooter(nsRenderingContext& aRenderingContext,
michael@0 56 nsPoint aPt);
michael@0 57
michael@0 58 protected:
michael@0 59 nsPageFrame(nsStyleContext* aContext);
michael@0 60 virtual ~nsPageFrame();
michael@0 61
michael@0 62 typedef enum {
michael@0 63 eHeader,
michael@0 64 eFooter
michael@0 65 } nsHeaderFooterEnum;
michael@0 66
michael@0 67 nscoord GetXPosition(nsRenderingContext& aRenderingContext,
michael@0 68 const nsRect& aRect,
michael@0 69 int32_t aJust,
michael@0 70 const nsString& aStr);
michael@0 71
michael@0 72 void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
michael@0 73 nsHeaderFooterEnum aHeaderFooter,
michael@0 74 int32_t aJust,
michael@0 75 const nsString& sStr,
michael@0 76 const nsRect& aRect,
michael@0 77 nscoord aHeight,
michael@0 78 nscoord aAscent,
michael@0 79 nscoord aWidth);
michael@0 80
michael@0 81 void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
michael@0 82 nsHeaderFooterEnum aHeaderFooter,
michael@0 83 const nsString& aStrLeft,
michael@0 84 const nsString& aStrRight,
michael@0 85 const nsString& aStrCenter,
michael@0 86 const nsRect& aRect,
michael@0 87 nscoord aAscent,
michael@0 88 nscoord aHeight);
michael@0 89
michael@0 90 void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);
michael@0 91
michael@0 92 int32_t mPageNum;
michael@0 93 int32_t mTotNumPages;
michael@0 94
michael@0 95 nsSharedPageData* mPD;
michael@0 96 };
michael@0 97
michael@0 98
michael@0 99 class nsPageBreakFrame : public nsLeafFrame
michael@0 100 {
michael@0 101 NS_DECL_FRAMEARENA_HELPERS
michael@0 102
michael@0 103 nsPageBreakFrame(nsStyleContext* aContext);
michael@0 104 ~nsPageBreakFrame();
michael@0 105
michael@0 106 virtual nsresult Reflow(nsPresContext* aPresContext,
michael@0 107 nsHTMLReflowMetrics& aDesiredSize,
michael@0 108 const nsHTMLReflowState& aReflowState,
michael@0 109 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 110
michael@0 111 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 112
michael@0 113 #ifdef DEBUG_FRAME_DUMP
michael@0 114 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 115 #endif
michael@0 116
michael@0 117 protected:
michael@0 118
michael@0 119 virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE;
michael@0 120 virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE;
michael@0 121
michael@0 122 bool mHaveReflowed;
michael@0 123
michael@0 124 friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 125 };
michael@0 126
michael@0 127 #endif /* nsPageFrame_h___ */
michael@0 128

mercurial