00001 /* AbiWord 00002 * Copyright (C) 2004 Martin Sevior <msevior@physics.unimelb.edu.au> 00003 * Copyright (C) 1998 AbiSource, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 * 00020 */ 00021 00022 #ifndef TOCCONTAINER_H 00023 #define TOCCONTAINER_H 00024 00025 #ifdef FMT_TEST 00026 #include <stdio.h> 00027 #endif 00028 00029 #include "ut_misc.h" 00030 #include "ut_types.h" 00031 #include "ut_vector.h" 00032 #include "pt_Types.h" 00033 #include "fp_Page.h" 00034 #include "fp_ContainerObject.h" 00035 #include "fp_Column.h" 00036 #include "gr_Graphics.h" 00037 00038 class fl_DocSectionLayout; 00039 00040 class ABI_EXPORT fp_TOCContainer : public fp_VerticalContainer 00041 { 00042 public: 00043 fp_TOCContainer(fl_SectionLayout* pSectionLayout); 00044 fp_TOCContainer(fl_SectionLayout* pSectionLayout,fp_TOCContainer * pMaster); 00045 virtual ~fp_TOCContainer(); 00046 virtual void mapXYToPosition(UT_sint32 x, UT_sint32 y, 00047 PT_DocPosition& pos, 00048 bool& bBOL, bool& bEOL, bool &isTOC); 00049 UT_sint32 getValue(void); 00050 void layout(void); 00051 void forceClearScreen(void); 00052 UT_sint32 getTotalTOCHeight(void) const; 00053 virtual UT_sint32 getHeight(void) const; 00054 virtual void clearScreen(void); 00055 virtual void draw(dg_DrawArgs*); 00056 virtual void draw(GR_Graphics*); 00057 virtual void setContainer(fp_Container * pContainer); 00058 virtual void setY(UT_sint32 iY); 00059 virtual fp_Container * getNextContainerInSection(void) const; 00060 virtual fp_Container * getPrevContainerInSection(void) const; 00061 fp_Column * getBrokenColumn(void); 00062 virtual bool isVBreakable(void); 00063 virtual bool isHBreakable(void) {return false;} 00064 virtual UT_sint32 wantVBreakAt(UT_sint32); 00065 virtual UT_sint32 wantHBreakAt(UT_sint32) {return 0;} 00066 virtual fp_ContainerObject * VBreakAt(UT_sint32); 00067 virtual fp_ContainerObject * HBreakAt(UT_sint32) {return NULL;} 00068 00069 fl_DocSectionLayout * getDocSectionLayout(void); 00070 void setSelected(bool bIsSelected); 00071 fp_TOCContainer * getMasterTOC(void) const 00072 { return m_pMasterTOC; } 00073 bool isThisBroken(void) const 00074 { return m_bIsBroken;} 00075 void setYBreakHere(UT_sint32 iBreakHere); 00076 void setYBottom(UT_sint32 iBotContainer); 00077 bool isInBrokenTOC(const fp_Container * pCon); 00078 // 00079 // This is the smallest Y value of the TOC allowed in this 00080 // broken TOC 00081 // 00082 UT_sint32 getYBreak(void) const 00083 {return m_iYBreakHere;} 00084 // 00085 // This is the largest Y value of the TOC allowed in this broken TOC 00086 // 00087 UT_sint32 getYBottom(void) const 00088 {return m_iYBottom;} 00089 fp_TOCContainer * getFirstBrokenTOC(void) const; 00090 fp_TOCContainer * getLastBrokenTOC(void) const; 00091 void setFirstBrokenTOC(fp_TOCContainer * pBroke); 00092 void setLastBrokenTOC(fp_TOCContainer * pBroke); 00093 void deleteBrokenTOCs(bool bClearFirst); 00094 void adjustBrokenTOCs(void); 00095 UT_sint32 getBrokenTop(void); 00096 UT_sint32 getBrokenBot(void); 00097 void setBrokenTop(UT_sint32 iTop) 00098 { m_iBrokenTop = iTop;} 00099 void setBrokenBot(UT_sint32 iBot) 00100 { m_iBrokenBottom = iBot;} 00101 UT_sint32 getBrokenNumber(void); 00102 virtual void setLastWantedVBreak(UT_sint32 iBreakAt) 00103 {m_iLastWantedVBreak = iBreakAt;} 00104 virtual UT_sint32 getLastWantedVBreak(void) const 00105 {return m_iLastWantedVBreak;} 00106 virtual fp_Container * getFirstBrokenContainer() const; 00107 virtual void deleteBrokenAfter(bool bClearFirst); 00108 00109 private: 00110 // 00111 // Variables for TOC's broken across Vertical Containers. 00112 // 00113 fp_TOCContainer * m_pFirstBrokenTOC; 00114 fp_TOCContainer * m_pLastBrokenTOC; 00115 bool m_bIsBroken; 00116 fp_TOCContainer * m_pMasterTOC; 00117 UT_sint32 m_iYBreakHere; 00118 UT_sint32 m_iYBottom; 00119 UT_sint32 m_iBrokenTop; 00120 UT_sint32 m_iBrokenBottom; 00121 UT_sint32 m_iLastWantedVBreak; 00122 }; 00123 00124 #endif /* TOCCONTAINER_H */