1 /* AbiWord 2 * Copyright (C) 2002 Patrick Lam <plam@mit.edu> 3 * Copyright (C) 2003 Martin Sevior <msevior@physics.unimelb.edu.au> 4 * Copyright (C) 1998 AbiSource, Inc. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 * 02110-1301 USA. 20 * 21 */ 22 23 #ifndef FRAMECONTAINER_H 24 #define FRAMECONTAINER_H 25 26 #ifdef FMT_TEST 27 #include <stdio.h> 28 #endif 29 30 #include "ut_misc.h" 31 #include "ut_types.h" 32 #include "ut_vector.h" 33 #include "pt_Types.h" 34 #include "fp_Page.h" 35 #include "fp_ContainerObject.h" 36 #include "fp_Column.h" 37 #include "gr_Graphics.h" 38 #include "pp_PropertyMap.h" 39 40 class fl_TableLayout; 41 class fl_DocSectionLayout; 42 class fl_BlockLayout; 43 44 #define FRAME_HANDLE_SIZE 6 45 46 class ABI_EXPORT fp_FrameContainer : public fp_VerticalContainer 47 { 48 public: 49 fp_FrameContainer(fl_SectionLayout* pSectionLayout); 50 virtual ~fp_FrameContainer(); 51 void layout(void); 52 virtual void clearScreen(void); 53 virtual void draw(dg_DrawArgs*); draw(GR_Graphics *)54 virtual void draw(GR_Graphics*) {} 55 void drawHandles(dg_DrawArgs * pDA); 56 void drawBoundaries(dg_DrawArgs * pDA); 57 virtual void setContainer(fp_Container * pContainer); 58 virtual fp_Container * getNextContainerInSection(void) const; 59 virtual fp_Container * getPrevContainerInSection(void) const; getPage(void)60 virtual fp_Page * getPage(void) { return m_pPage;} 61 virtual UT_sint32 getX() const; 62 virtual UT_sint32 getY() const; 63 virtual UT_sint32 getWidth() const; 64 virtual UT_sint32 getHeight() const; 65 virtual void setHeight(UT_sint32 iHeight); 66 UT_sint32 getLeftPad(UT_sint32 y, UT_sint32 height); 67 UT_sint32 getRightPad(UT_sint32 y, UT_sint32 height); isVBreakable(void)68 virtual bool isVBreakable(void) 69 { return false;} 70 UT_sint32 getFullX() const; 71 UT_sint32 getFullY() const; 72 UT_sint32 getFullWidth() const; 73 UT_sint32 getFullHeight() const; setXpad(UT_sint32 xPad)74 void setXpad(UT_sint32 xPad) 75 {m_iXpad = xPad;} setYpad(UT_sint32 yPad)76 void setYpad(UT_sint32 yPad) 77 {m_iYpad = yPad;} getXPad(void)78 UT_sint32 getXPad(void) const { return m_iXpad;} getYPad(void)79 UT_sint32 getYPad(void) const { return m_iYpad;} 80 void setPage(fp_Page * pPage); 81 fl_DocSectionLayout * getDocSectionLayout(void); 82 void getBlocksAroundFrame(UT_GenericVector<fl_BlockLayout *> & vecBlocks); 83 PP_PropertyMap::Background getBackground () const; 84 void setPreferedPageNo(UT_sint32 i); getPreferedPageNo(void)85 UT_sint32 getPreferedPageNo(void) 86 { return m_iPreferedPageNo;} 87 void setPreferedColumnNo(UT_sint32 i); getPreferedColumnNo(void)88 UT_sint32 getPreferedColumnNo(void) 89 { return m_iPreferedColumnNo;} 90 91 void setBackground (const PP_PropertyMap::Background & style); 92 setBottomStyle(const PP_PropertyMap::Line & style)93 void setBottomStyle (const PP_PropertyMap::Line & style) { m_lineBottom = style; } setLeftStyle(const PP_PropertyMap::Line & style)94 void setLeftStyle (const PP_PropertyMap::Line & style) { m_lineLeft = style; } setRightStyle(const PP_PropertyMap::Line & style)95 void setRightStyle (const PP_PropertyMap::Line & style) { m_lineRight = style; } setTopStyle(const PP_PropertyMap::Line & style)96 void setTopStyle (const PP_PropertyMap::Line & style) { m_lineTop = style; } setOverWrote(void)97 void setOverWrote(void) 98 {m_bOverWrote = true;} setWrapping(bool bWrapping)99 void setWrapping(bool bWrapping) 100 {m_bIsWrapped = bWrapping;} isWrappingSet(void)101 bool isWrappingSet(void) const 102 { return m_bIsWrapped;} setTightWrapping(bool bTight)103 void setTightWrapping( bool bTight) 104 { m_bIsTightWrapped = bTight;} isTightWrapped(void)105 bool isTightWrapped(void) const 106 { return m_bIsTightWrapped;} isTopBot(void)107 bool isTopBot(void) const 108 { return m_bIsTopBot; } setTopBot(bool b)109 void setTopBot(bool b) 110 { m_bIsTopBot = b;} isLeftWrapped(void)111 bool isLeftWrapped(void) const 112 { return m_bIsLeftWrapped;} setLeftWrapped(bool b)113 void setLeftWrapped(bool b) 114 { m_bIsLeftWrapped = b;} isRightWrapped(void)115 bool isRightWrapped(void) const 116 { return m_bIsRightWrapped;} setRightWrapped(bool b)117 void setRightWrapped(bool b) 118 { m_bIsRightWrapped = b;} 119 120 bool overlapsRect(UT_Rect & rec); 121 bool isAbove(void); setAbove(bool bAbove)122 void setAbove(bool bAbove) 123 { m_bIsAbove = bAbove;} 124 private: 125 void _drawLine (const PP_PropertyMap::Line & style, 126 UT_sint32 left, UT_sint32 top, 127 UT_sint32 right, UT_sint32 bot, 128 GR_Graphics * pGr); 129 fp_Page * m_pPage; 130 UT_sint32 m_iXpad; 131 UT_sint32 m_iYpad; 132 bool m_bNeverDrawn; 133 134 // cell-background properties 135 PP_PropertyMap::Background m_background; 136 137 // cell-border properties 138 PP_PropertyMap::Line m_lineBottom; 139 PP_PropertyMap::Line m_lineLeft; 140 PP_PropertyMap::Line m_lineRight; 141 PP_PropertyMap::Line m_lineTop; 142 bool m_bOverWrote; 143 bool m_bIsWrapped; 144 bool m_bIsTightWrapped; 145 bool m_bIsAbove; 146 bool m_bIsTopBot; 147 bool m_bIsLeftWrapped; 148 bool m_bIsRightWrapped; 149 UT_sint32 m_iPreferedPageNo; 150 UT_sint32 m_iPreferedColumnNo; 151 }; 152 153 154 #endif /* FRAMECONTAINER_H */ 155