00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PAGE_H
00021 #define PAGE_H
00022
00023 #include <stdio.h>
00024 #include "ut_types.h"
00025 #include "ut_vector.h"
00026 #include "pt_Types.h"
00027 #include "fl_SectionLayout.h"
00028 #include "fp_PageSize.h"
00029 #include "fp_ContainerObject.h"
00030
00031 class FL_DocLayout;
00032 class fp_Column;
00033 class fp_Container;
00034 class fp_ShadowContainer;
00035 class fp_FootnoteContainer;
00036 class fp_AnnotationContainer;
00037 class fp_FrameContainer;
00038 class fl_DocSectionLayout;
00039 class fl_HdrFtrSectionLayout;
00040 class fl_HdrFtrShadow;
00041 class fl_FootnoteLayout;
00042 class fl_AnnotationLayout;
00043 class fl_FrameLayout;
00044 class FV_View;
00045 class GR_Graphics;
00046 class fp_TableContainer;
00047 class fl_TOCLayout;
00048 struct dg_DrawArgs;
00049
00050 class ABI_EXPORT _BL
00051 {
00052 public:
00053 _BL(fl_BlockLayout * pBL,fp_Line * pL) :
00054 m_pBL(pBL),
00055 m_pL(pL)
00056 {
00057 }
00058 fl_BlockLayout * m_pBL;
00059 fp_Line * m_pL;
00060 };
00061
00062
00063 class ABI_EXPORT fp_Page
00064 {
00065 public:
00066 fp_Page(FL_DocLayout*,
00067 FV_View*,
00068 const fp_PageSize& pageSize,
00069 fl_DocSectionLayout* pOwner
00070 );
00071 ~fp_Page();
00072
00073 UT_sint32 getWidth(void) const;
00074 const fp_PageSize& getPageSize() const;
00075 UT_sint32 getHeight(void) const;
00076 UT_sint32 getBottom(void) const;
00077 fp_Page* getNext(void) const;
00078 fp_Page* getPrev(void) const;
00079 void setNext(fp_Page*);
00080 void setPrev(fp_Page*);
00081 void markAllDirty(void) {m_bNeedsRedraw = true;}
00082 UT_sint32 getColumnGap(void) const;
00083 FL_DocLayout* getDocLayout() const;
00084 void setView(FV_View*);
00085 bool isOnScreen(void);
00086
00087 inline fl_DocSectionLayout* getOwningSection(void) const { return m_pOwner; }
00088
00089 PT_DocPosition getFirstLastPos(bool bFirst) const;
00090 void mapXYToPosition(bool bNotFrames,UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL,bool & isTOC, bool bUseHdrFtr = false, fl_HdrFtrShadow ** pShadow = NULL);
00091 void mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC,bool bUseHdrFtr = false, fl_HdrFtrShadow ** pShadow = NULL);
00092 void getScreenOffsets(fp_Container*, UT_sint32& xoff, UT_sint32& yoff) const;
00093
00094 void draw(dg_DrawArgs*, bool bAlaysUseWhiteBackground=false);
00095 bool needsRedraw(void) const;
00096 UT_sint32 getFilledHeight(fp_Container * prevContainer) const;
00097 UT_sint32 getAvailableHeight(void) const;
00098 UT_sint32 getAvailableHeightForColumn(const fp_Column * pColumn) const;
00099 fp_TableContainer * getContainingTable(PT_DocPosition pos);
00100
00101
00102 void columnHeightChanged(fp_Column* pLeader);
00103 bool breakPage(void);
00104 UT_uint32 countColumnLeaders(void) const;
00105 fp_Column* getNthColumnLeader(UT_sint32 n) const;
00106 bool insertColumnLeader(fp_Column* pLeader, fp_Column* pAfter);
00107 void removeColumnLeader(fp_Column* pLeader);
00108 bool isEmpty(void) const;
00109 fp_Container * updatePageForWrapping(fp_Column *& pNextCol);
00110
00111 void removeHdrFtr(HdrFtrType hfType);
00112 fp_ShadowContainer* getHdrFtrP(HdrFtrType hfType) const;
00113 fp_ShadowContainer* getHdrFtrContainer(fl_HdrFtrSectionLayout*);
00114 fp_ShadowContainer* buildHdrFtrContainer(fl_HdrFtrSectionLayout*,
00115 HdrFtrType hfType);
00116
00117
00118 void footnoteHeightChanged(void);
00119 UT_uint32 countFootnoteContainers(void) const;
00120 fp_FootnoteContainer* getNthFootnoteContainer(UT_sint32 n) const;
00121 bool insertFootnoteContainer(fp_FootnoteContainer * pFC);
00122 void removeFootnoteContainer(fp_FootnoteContainer * pFC);
00123 UT_sint32 findFootnoteContainer(fp_FootnoteContainer * pFC);
00124 void clearScreenFootnotes(void);
00125 UT_sint32 getFootnoteHeight(void);
00126
00127
00128
00129 void annotationHeightChanged(void);
00130 UT_uint32 countAnnotationContainers(void) const;
00131 fp_AnnotationContainer* getNthAnnotationContainer(UT_sint32 n) const;
00132 bool insertAnnotationContainer(fp_AnnotationContainer * pFC);
00133 void removeAnnotationContainer(fp_AnnotationContainer * pFC);
00134 UT_sint32 findAnnotationContainer(fp_AnnotationContainer * pFC);
00135 void clearScreenAnnotations(void);
00136 UT_sint32 getAnnotationHeight(void);
00137 UT_uint32 getAnnotationPos( UT_uint32 pid);
00138
00139
00140 void frameHeightChanged(void);
00141 UT_uint32 countAboveFrameContainers(void) const;
00142 UT_uint32 countBelowFrameContainers(void) const;
00143 fp_FrameContainer* getNthAboveFrameContainer(UT_sint32 n) const;
00144 fp_FrameContainer* getNthBelowFrameContainer(UT_sint32 n) const;
00145 bool insertFrameContainer(fp_FrameContainer * pFC);
00146 void removeFrameContainer(fp_FrameContainer * pFC);
00147 UT_sint32 findFrameContainer(fp_FrameContainer * pFC);
00148 void clearScreenFrames(void);
00149 void markDirtyOverlappingRuns(fp_FrameContainer * pFC);
00150 void expandDamageRect(UT_sint32 x, UT_sint32 y,
00151 UT_sint32 width, UT_sint32 height);
00152 void redrawDamagedFrames(dg_DrawArgs* pDA);
00153 bool overlapsWrappedFrame(fp_Line * pLine);
00154 bool overlapsWrappedFrame(UT_Rect & rec);
00155 void setPageNumberInFrames(void);
00156
00157 bool TopBotMarginChanged(void);
00158 void setLastMappedTOC(fl_TOCLayout * pTOCL)
00159 { m_pLastMappedTOC = pTOCL;}
00160 fl_TOCLayout * getLastMappedTOC(void)
00161 { return m_pLastMappedTOC;}
00162 fg_FillType * getFillType(void);
00163 void getAllLayouts(UT_GenericVector<fl_ContainerLayout *> & AllLayouts);
00164
00165 #ifdef FMT_TEST
00166 void __dump(FILE * fp) const;
00167 #endif
00168
00169 void updateColumnX();
00170 protected:
00171 void _drawCropMarks(dg_DrawArgs*);
00172 void _reformat(void);
00173 void _reformatColumns(void);
00174 void _reformatFootnotes(void);
00175 void _reformatAnnotations(void);
00176
00177 private:
00178
00179 fp_Page(const fp_Page&);
00180 void operator=(const fp_Page&);
00181
00182 FL_DocLayout* m_pLayout;
00183 FV_View* m_pView;
00184 fp_Page* m_pNext;
00185 fp_Page* m_pPrev;
00186
00187 fp_PageSize m_pageSize;
00188 UT_uint32 m_iResolution;
00189
00190 bool m_bNeedsRedraw;
00191
00192 UT_GenericVector<fp_Column *> m_vecColumnLeaders;
00193
00194 fl_DocSectionLayout* m_pOwner;
00195
00196 fp_ShadowContainer* m_pFooter;
00197 fp_ShadowContainer* m_pHeader;
00198
00199 UT_GenericVector<fp_FootnoteContainer *> m_vecFootnotes;
00200 UT_GenericVector<fp_AnnotationContainer *> m_vecAnnotations;
00201 fg_FillType m_FillType;
00202 UT_GenericVector<fp_FrameContainer *> m_vecAboveFrames;
00203 UT_GenericVector<fp_FrameContainer *> m_vecBelowFrames;
00204 fl_TOCLayout * m_pLastMappedTOC;
00205
00206 UT_Rect m_rDamageRect;
00207 UT_sint32 m_iCountWrapPasses;
00208 };
00209
00210 #endif