1 /* AbiWord 2 * Copyright (C) 2004 Martin Sevior <msevior@physics.unimelb.edu.au> 3 * Copyright (C) 1998 AbiSource, Inc. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 * 02110-1301 USA. 19 * 20 */ 21 22 #ifndef TOCCONTAINER_H 23 #define TOCCONTAINER_H 24 25 #ifdef FMT_TEST 26 #include <stdio.h> 27 #endif 28 29 #include "ut_misc.h" 30 #include "ut_types.h" 31 #include "ut_vector.h" 32 #include "pt_Types.h" 33 #include "fp_Page.h" 34 #include "fp_ContainerObject.h" 35 #include "fp_Column.h" 36 #include "gr_Graphics.h" 37 38 class fl_DocSectionLayout; 39 40 class ABI_EXPORT fp_TOCContainer : public fp_VerticalContainer 41 { 42 public: 43 fp_TOCContainer(fl_SectionLayout* pSectionLayout); 44 fp_TOCContainer(fl_SectionLayout* pSectionLayout,fp_TOCContainer * pMaster); 45 virtual ~fp_TOCContainer(); 46 virtual void mapXYToPosition(UT_sint32 x, UT_sint32 y, 47 PT_DocPosition& pos, 48 bool& bBOL, bool& bEOL, bool &isTOC); 49 UT_sint32 getValue(void); 50 void layout(void); 51 void forceClearScreen(void); 52 UT_sint32 getTotalTOCHeight(void) const; 53 virtual UT_sint32 getHeight(void) const; 54 virtual void clearScreen(void); 55 virtual void draw(dg_DrawArgs*); 56 virtual void draw(GR_Graphics*); 57 virtual void setContainer(fp_Container * pContainer); 58 virtual void setY(UT_sint32 iY); 59 virtual fp_Container * getNextContainerInSection(void) const; 60 virtual fp_Container * getPrevContainerInSection(void) const; 61 fp_Column * getBrokenColumn(void); 62 virtual bool isVBreakable(void); isHBreakable(void)63 virtual bool isHBreakable(void) {return false;} 64 virtual UT_sint32 wantVBreakAt(UT_sint32); wantHBreakAt(UT_sint32)65 virtual UT_sint32 wantHBreakAt(UT_sint32) {return 0;} 66 virtual fp_ContainerObject * VBreakAt(UT_sint32); HBreakAt(UT_sint32)67 virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;} 68 69 fl_DocSectionLayout * getDocSectionLayout(void); 70 void setSelected(bool bIsSelected); getMasterTOC(void)71 fp_TOCContainer * getMasterTOC(void) const 72 { return m_pMasterTOC; } isThisBroken(void)73 bool isThisBroken(void) const 74 { return m_bIsBroken;} 75 void setYBreakHere(UT_sint32 iBreakHere); 76 void setYBottom(UT_sint32 iBotContainer); 77 bool isInBrokenTOC(fp_Container * pCon); 78 // 79 // This is the smallest Y value of the TOC allowed in this 80 // broken TOC 81 // getYBreak(void)82 UT_sint32 getYBreak(void) const 83 {return m_iYBreakHere;} 84 // 85 // This is the largest Y value of the TOC allowed in this broken TOC 86 // getYBottom(void)87 UT_sint32 getYBottom(void) const 88 {return m_iYBottom;} 89 fp_TOCContainer * getFirstBrokenTOC(void) const; 90 fp_TOCContainer * getLastBrokenTOC(void) const; 91 void setFirstBrokenTOC(fp_TOCContainer * pBroke); 92 void setLastBrokenTOC(fp_TOCContainer * pBroke); 93 void deleteBrokenTOCs(bool bClearFirst); 94 void adjustBrokenTOCs(void); 95 UT_sint32 getBrokenTop(void); 96 UT_sint32 getBrokenBot(void); setBrokenTop(UT_sint32 iTop)97 void setBrokenTop(UT_sint32 iTop) 98 { m_iBrokenTop = iTop;} setBrokenBot(UT_sint32 iBot)99 void setBrokenBot(UT_sint32 iBot) 100 { m_iBrokenBottom = iBot;} 101 UT_sint32 getBrokenNumber(void); setLastWantedVBreak(UT_sint32 iBreakAt)102 virtual void setLastWantedVBreak(UT_sint32 iBreakAt) 103 {m_iLastWantedVBreak = iBreakAt;} getLastWantedVBreak(void)104 virtual UT_sint32 getLastWantedVBreak(void) const 105 {return m_iLastWantedVBreak;} 106 virtual fp_Container * getFirstBrokenContainer() const; 107 virtual void deleteBrokenAfter(bool bClearFirst); 108 109 private: 110 // 111 // Variables for TOC's broken across Vertical Containers. 112 // 113 fp_TOCContainer * m_pFirstBrokenTOC; 114 fp_TOCContainer * m_pLastBrokenTOC; 115 bool m_bIsBroken; 116 fp_TOCContainer * m_pMasterTOC; 117 UT_sint32 m_iYBreakHere; 118 UT_sint32 m_iYBottom; 119 UT_sint32 m_iBrokenTop; 120 UT_sint32 m_iBrokenBottom; 121 UT_sint32 m_iLastWantedVBreak; 122 }; 123 124 #endif /* TOCCONTAINER_H */ 125