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) const;
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) const;
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 void clearCountWrapNumber(void);
00101
00102 void columnHeightChanged(fp_Column* pLeader);
00103 bool breakPage(void);
00104 UT_sint32 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 bool containsPageBreak(void) const;
00110 fp_Container * updatePageForWrapping(fp_Column *& pNextCol);
00111
00112 void removeHdrFtr(HdrFtrType hfType);
00113 fp_ShadowContainer* getHdrFtrP(HdrFtrType hfType) const;
00114 fp_ShadowContainer* getHdrFtrContainer(fl_HdrFtrSectionLayout*);
00115 fp_ShadowContainer* buildHdrFtrContainer(fl_HdrFtrSectionLayout*,
00116 HdrFtrType hfType);
00117
00118
00119 void footnoteHeightChanged(void);
00120 UT_sint32 countFootnoteContainers(void) const;
00121 fp_FootnoteContainer* getNthFootnoteContainer(UT_sint32 n) const;
00122 bool insertFootnoteContainer(fp_FootnoteContainer * pFC);
00123 void removeFootnoteContainer(fp_FootnoteContainer * pFC);
00124 UT_sint32 findFootnoteContainer(fp_FootnoteContainer * pFC) const;
00125 void clearScreenFootnotes(void);
00126 UT_sint32 getFootnoteHeight(void) const;
00127
00128
00129
00130 void annotationHeightChanged(void);
00131 UT_sint32 countAnnotationContainers(void) const;
00132 fp_AnnotationContainer* getNthAnnotationContainer(UT_sint32 n) const;
00133 bool insertAnnotationContainer(fp_AnnotationContainer * pFC);
00134 void removeAnnotationContainer(fp_AnnotationContainer * pFC);
00135 UT_sint32 findAnnotationContainer(fp_AnnotationContainer * pFC) const;
00136 void clearScreenAnnotations(void);
00137 UT_sint32 getAnnotationHeight(void) const;
00138 UT_sint32 getAnnotationPos( UT_uint32 pid) const;
00139
00140
00141 void frameHeightChanged(void);
00142 UT_sint32 countAboveFrameContainers(void) const;
00143 UT_sint32 countBelowFrameContainers(void) const;
00144 fp_FrameContainer* getNthAboveFrameContainer(UT_sint32 n) const;
00145 fp_FrameContainer* getNthBelowFrameContainer(UT_sint32 n) const;
00146 bool insertFrameContainer(fp_FrameContainer * pFC);
00147 void removeFrameContainer(fp_FrameContainer * pFC);
00148 UT_sint32 findFrameContainer(fp_FrameContainer * pFC) const;
00149 void clearScreenFrames(void);
00150 void markDirtyOverlappingRuns(fp_FrameContainer * pFC);
00151 void expandDamageRect(UT_sint32 x, UT_sint32 y,
00152 UT_sint32 width, UT_sint32 height);
00153 bool intersectsDamagedRect(fp_ContainerObject * pObj);
00154 void redrawDamagedFrames(dg_DrawArgs* pDA);
00155 bool overlapsWrappedFrame(fp_Line * pLine);
00156 bool overlapsWrappedFrame(UT_Rect & rec);
00157 void setPageNumberInFrames(void);
00158 UT_sint32 getPageNumber(void);
00159 bool TopBotMarginChanged(void);
00160 void setLastMappedTOC(fl_TOCLayout * pTOCL)
00161 { m_pLastMappedTOC = pTOCL;}
00162 fl_TOCLayout * getLastMappedTOC(void)
00163 { return m_pLastMappedTOC;}
00164 fg_FillType * getFillType(void);
00165 void getAllLayouts(UT_GenericVector<fl_ContainerLayout *> & AllLayouts);
00166
00167 #ifdef FMT_TEST
00168 void __dump(FILE * fp) const;
00169 #endif
00170
00171 void updateColumnX();
00172 protected:
00173 void _drawCropMarks(dg_DrawArgs*);
00174 void _reformat(void);
00175 void _reformatColumns(void);
00176 void _reformatFootnotes(void);
00177 void _reformatAnnotations(void);
00178
00179 private:
00180
00181 fp_Page(const fp_Page&);
00182 void operator=(const fp_Page&);
00183
00184 FL_DocLayout* m_pLayout;
00185 FV_View* m_pView;
00186 fp_Page* m_pNext;
00187 fp_Page* m_pPrev;
00188
00189 fp_PageSize m_pageSize;
00190 UT_uint32 m_iResolution;
00191
00192 bool m_bNeedsRedraw;
00193
00194 UT_GenericVector<fp_Column *> m_vecColumnLeaders;
00195
00196 fl_DocSectionLayout* m_pOwner;
00197
00198 fp_ShadowContainer* m_pFooter;
00199 fp_ShadowContainer* m_pHeader;
00200
00201 UT_GenericVector<fp_FootnoteContainer *> m_vecFootnotes;
00202 UT_GenericVector<fp_AnnotationContainer *> m_vecAnnotations;
00203 fg_FillType m_FillType;
00204 UT_GenericVector<fp_FrameContainer *> m_vecAboveFrames;
00205 UT_GenericVector<fp_FrameContainer *> m_vecBelowFrames;
00206 fl_TOCLayout * m_pLastMappedTOC;
00207
00208 UT_Rect m_rDamageRect;
00209 UT_sint32 m_iCountWrapPasses;
00210 };
00211
00212 #endif