2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef nsPageFrame_h___
|
|
|
|
#define nsPageFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsLeafFrame.h"
|
|
|
|
|
|
|
|
class nsSharedPageData;
|
|
|
|
|
|
|
|
// Page frame class used by the simple page sequence frame
|
|
|
|
class nsPageFrame : public nsContainerFrame {
|
|
|
|
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aMaxSize,
|
2013-05-14 09:33:23 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::pageFrame
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////
|
|
|
|
// For Printing
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
// Tell the page which page number it is out of how many
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void SetPageNumInfo(int32_t aPageNumber, int32_t aTotalPages);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual void SetSharedPageData(nsSharedPageData* aPD);
|
|
|
|
|
2011-06-10 03:07:26 -07:00
|
|
|
// We must allow Print Preview UI to have a background, no matter what the
|
|
|
|
// user's settings
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
|
2011-06-10 03:07:26 -07:00
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
void PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPoint aPt);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsPageFrame(nsStyleContext* aContext);
|
|
|
|
virtual ~nsPageFrame();
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eHeader,
|
|
|
|
eFooter
|
|
|
|
} nsHeaderFooterEnum;
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
nscoord GetXPosition(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsRect& aRect,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aJust,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsString& aStr);
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsHeaderFooterEnum aHeaderFooter,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aJust,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsString& sStr,
|
|
|
|
const nsRect& aRect,
|
|
|
|
nscoord aHeight,
|
|
|
|
nscoord aAscent,
|
|
|
|
nscoord aWidth);
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
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);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPageNum;
|
|
|
|
int32_t mTotNumPages;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsSharedPageData* mPD;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
class nsPageBreakFrame : public nsLeafFrame
|
|
|
|
{
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsPageBreakFrame(nsStyleContext* aContext);
|
|
|
|
~nsPageBreakFrame();
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2008-12-29 07:07:36 -08:00
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHaveReflowed;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPageFrame_h___ */
|
|
|
|
|