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