1 /* AbiWord 2 * Copyright (C) 2003 Martin Sevior. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 #ifndef FRAMELAYOUT_H 21 #define FRAMELAYOUT_H 22 23 #include "ut_types.h" 24 #include "ut_vector.h" 25 #include "pt_Types.h" 26 #include "fl_Layout.h" 27 #include "fl_ContainerLayout.h" 28 #include "fl_SectionLayout.h" 29 #include "pl_Listener.h" 30 #include "ut_debugmsg.h" 31 #include "pp_PropertyMap.h" 32 33 class pf_Frag_Strux; 34 35 enum FL_FrameFormatMode 36 { 37 FL_FRAME_POSITIONED_TO_BLOCK, 38 FL_FRAME_POSITIONED_TO_COLUMN, 39 FL_FRAME_POSITIONED_TO_PAGE, 40 FL_FRAME_POSITIONED_INLINE 41 }; 42 43 enum FL_FrameWrapMode 44 { 45 FL_FRAME_ABOVE_TEXT, 46 FL_FRAME_BELOW_TEXT, 47 FL_FRAME_WRAPPED_TO_RIGHT, 48 FL_FRAME_WRAPPED_TO_LEFT, 49 FL_FRAME_WRAPPED_BOTH_SIDES, 50 FL_FRAME_WRAPPED_TOPBOT 51 }; 52 53 enum FL_FrameType 54 { 55 FL_FRAME_TEXTBOX_TYPE, 56 FL_FRAME_WRAPPER_IMAGE, 57 FL_FRAME_WRAPPER_TABLE, 58 FL_FRAME_WRAPPER_EMBED 59 }; 60 61 // We have one fl_FrameLayout for each Frame. They all 62 // get physically placed on a page. 63 64 65 // The fl_FrameLayout is placed before the Block it is closest to on the page. 66 // It holds Blocks of it's own like cells and footnotes. 67 68 class ABI_EXPORT fl_FrameLayout : public fl_SectionLayout 69 { 70 friend class fl_DocListener; 71 friend class fp_FrameContainer; 72 73 public: 74 fl_FrameLayout(FL_DocLayout* pLayout, 75 pf_Frag_Strux* sdh, 76 PT_AttrPropIndex ap, 77 fl_ContainerLayout * pMyContainerLayout); 78 virtual ~fl_FrameLayout(); 79 80 virtual bool doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc); 81 virtual bool doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx); 82 virtual bool doclistener_deleteEndFrame(const PX_ChangeRecord_Strux * pcrx); 83 virtual bool bl_doclistener_insertEndFrame(fl_ContainerLayout*, 84 const PX_ChangeRecord_Strux * pcrx, 85 pf_Frag_Strux* sdh, 86 PL_ListenerId lid, 87 void (* pfnBindHandles)(pf_Frag_Strux* sdhNew, 88 PL_ListenerId lid, 89 fl_ContainerLayout* sfhNew)); 90 bool insertBlockAfter(fl_ContainerLayout* pCL, 91 const PX_ChangeRecord_Strux * pcrx, 92 pf_Frag_Strux* sdh, 93 PL_ListenerId lid, 94 void (* pfnBindHandles)(pf_Frag_Strux* sdhNew, 95 PL_ListenerId lid, 96 fl_ContainerLayout* sfhNew)); 97 98 void miniFormat(void); 99 virtual void format(void); 100 virtual void updateLayout(bool bDoFull); 101 virtual void collapse(void); 102 void localCollapse(); 103 virtual void markAllRunsDirty(void); 104 virtual fl_SectionLayout * getSectionLayout(void) const; 105 bool recalculateFields(UT_uint32 iUpdateCount); 106 virtual void redrawUpdate(void); 107 virtual fp_Container* getNewContainer(fp_Container* = NULL); 108 PT_DocPosition getDocPosition(void); 109 UT_uint32 getLength(void); 110 virtual void setNeedsReformat(fl_ContainerLayout * pCL, UT_uint32 offset = 0); 111 void setContainerProperties(void); 112 UT_sint32 getBoundingSpace(void) const; getFrameType(void)113 FL_FrameType getFrameType(void) const 114 {return m_iFrameType;} getFramePositionTo(void)115 FL_FrameFormatMode getFramePositionTo(void) const 116 { return m_iFramePositionTo;} getFrameWrapMode(void)117 FL_FrameWrapMode getFrameWrapMode(void) const 118 { return m_iFrameWrapMode;} getFrameWidth(void)119 UT_sint32 getFrameWidth(void) const 120 { return m_iWidth;} getFrameHeight(void)121 UT_sint32 getFrameHeight(void) const 122 { return m_iHeight;} getFrameXpos(void)123 UT_sint32 getFrameXpos(void) const 124 { return m_iXpos;} getFrameYpos(void)125 UT_sint32 getFrameYpos(void) const 126 { return m_iYpos;} getFrameXColpos(void)127 UT_sint32 getFrameXColpos(void) const 128 { return m_iXColumn;} getFrameYColpos(void)129 UT_sint32 getFrameYColpos(void) const 130 { return m_iYColumn;} getFrameXPagepos(void)131 UT_sint32 getFrameXPagepos(void) const 132 { return m_iXPage;} getFrameYPagepos(void)133 UT_sint32 getFrameYPagepos(void) const 134 { return m_iYPage;} 135 setFrameWidth(UT_sint32 iW)136 void setFrameWidth(UT_sint32 iW) { m_iWidth = iW;} setFrameHeight(UT_sint32 iH)137 void setFrameHeight(UT_sint32 iH) { m_iHeight = iH;} setFrameXpos(UT_sint32 iX)138 void setFrameXpos(UT_sint32 iX) { m_iXpos = iX;} setFrameYpos(UT_sint32 iY)139 void setFrameYpos(UT_sint32 iY) { m_iYpos = iY;} isEndFrameIn(void)140 bool isEndFrameIn(void) const 141 { return m_bHasEndFrame;} isTightWrap(void)142 bool isTightWrap(void) 143 { return m_bIsTightWrap;} expandHeight(void)144 bool expandHeight(void) const 145 { return m_bExpandHeight;} minHeight(void)146 UT_sint32 minHeight(void) const 147 { return m_iMinHeight;} getParentContainer(void)148 fl_ContainerLayout * getParentContainer(void) const 149 {return m_pParentContainer;} setParentContainer(fl_ContainerLayout * pCon)150 void setParentContainer(fl_ContainerLayout * pCon) 151 {m_pParentContainer = pCon;} 152 private: 153 virtual void _lookupProperties(const PP_AttrProp* pAP); 154 virtual void _lookupMarginProperties(const PP_AttrProp* pAP); 155 void _purgeLayout(void); 156 void _createFrameContainer(void); 157 void _insertFrameContainer(fp_Container * pNewFC); 158 FL_FrameType m_iFrameType; 159 FL_FrameFormatMode m_iFramePositionTo; 160 bool m_bNeedsRebuild; 161 bool m_bNeedsFormat; 162 bool m_bIsOnPage; 163 bool m_bHasEndFrame; 164 165 // Frame-background properties 166 PP_PropertyMap::Background m_background; 167 168 // Frame-border properties 169 PP_PropertyMap::Line m_lineBottom; 170 PP_PropertyMap::Line m_lineLeft; 171 PP_PropertyMap::Line m_lineRight; 172 PP_PropertyMap::Line m_lineTop; 173 174 UT_sint32 m_iWidth; 175 UT_sint32 m_iHeight; 176 UT_sint32 m_iXpos; 177 UT_sint32 m_iYpos; 178 179 UT_sint32 m_iXpad; 180 UT_sint32 m_iYpad; 181 182 UT_sint32 m_iXColumn; 183 UT_sint32 m_iYColumn; 184 185 UT_sint32 m_iXPage; 186 UT_sint32 m_iYPage; 187 188 UT_sint32 m_iBoundingSpace; 189 FL_FrameWrapMode m_iFrameWrapMode; 190 bool m_bIsTightWrap; 191 UT_sint32 m_iPrefPage; 192 UT_sint32 m_iPrefColumn; 193 bool m_bExpandHeight; 194 UT_sint32 m_iMinHeight; 195 fl_ContainerLayout * m_pParentContainer; 196 }; 197 198 #endif /* FRAMELAYOUT_H */ 199