00001 /* AbiWord 00002 * Copyright (C) 2002 Patrick Lam <plam@mit.edu> 00003 * Copyright (C) 2003 Martin Sevior <msevior@physics.unimelb.edu.au> 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 * 00021 */ 00022 00023 #ifndef FRAMECONTAINER_H 00024 #define FRAMECONTAINER_H 00025 00026 #ifdef FMT_TEST 00027 #include <stdio.h> 00028 #endif 00029 00030 #include "ut_misc.h" 00031 #include "ut_types.h" 00032 #include "ut_vector.h" 00033 #include "pt_Types.h" 00034 #include "fp_Page.h" 00035 #include "fp_ContainerObject.h" 00036 #include "fp_Column.h" 00037 #include "gr_Graphics.h" 00038 #include "pp_PropertyMap.h" 00039 00040 class fl_TableLayout; 00041 class fl_DocSectionLayout; 00042 class fl_BlockLayout; 00043 00044 #define FRAME_HANDLE_SIZE 6 00045 00046 class ABI_EXPORT fp_FrameContainer : public fp_VerticalContainer 00047 { 00048 public: 00049 fp_FrameContainer(fl_SectionLayout* pSectionLayout); 00050 virtual ~fp_FrameContainer(); 00051 void layout(void); 00052 virtual void clearScreen(void); 00053 virtual void draw(dg_DrawArgs*); 00054 virtual void draw(GR_Graphics*) {} 00055 void drawHandles(dg_DrawArgs * pDA); 00056 void drawBoundaries(dg_DrawArgs * pDA); 00057 virtual void setContainer(fp_Container * pContainer); 00058 virtual fp_Container * getNextContainerInSection(void) const; 00059 virtual fp_Container * getPrevContainerInSection(void) const; 00060 virtual fp_Page * getPage(void) const { return m_pPage;} 00061 virtual UT_sint32 getX() const; 00062 virtual UT_sint32 getY() const; 00063 virtual UT_sint32 getWidth() const; 00064 virtual UT_sint32 getHeight() const; 00065 virtual void setHeight(UT_sint32 iHeight); 00066 UT_sint32 getLeftPad(UT_sint32 y, UT_sint32 height); 00067 UT_sint32 getRightPad(UT_sint32 y, UT_sint32 height); 00068 virtual bool isVBreakable(void) 00069 { return false;} 00070 UT_sint32 getFullX() const; 00071 UT_sint32 getFullY() const; 00072 UT_sint32 getFullWidth() const; 00073 UT_sint32 getFullHeight() const; 00074 void setXpad(UT_sint32 xPad) 00075 {m_iXpad = xPad;} 00076 void setYpad(UT_sint32 yPad) 00077 {m_iYpad = yPad;} 00078 UT_sint32 getXPad(void) const { return m_iXpad;} 00079 UT_sint32 getYPad(void) const { return m_iYpad;} 00080 void setPage(fp_Page * pPage); 00081 fl_DocSectionLayout * getDocSectionLayout(void); 00082 void getBlocksAroundFrame(UT_GenericVector<fl_BlockLayout *> & vecBlocks); 00083 PP_PropertyMap::Background getBackground () const; 00084 void setPreferedPageNo(UT_sint32 i); 00085 UT_sint32 getPreferedPageNo(void) 00086 { return m_iPreferedPageNo;} 00087 void setPreferedColumnNo(UT_sint32 i); 00088 UT_sint32 getPreferedColumnNo(void) 00089 { return m_iPreferedColumnNo;} 00090 00091 void setBackground (const PP_PropertyMap::Background & style); 00092 00093 void setBottomStyle (const PP_PropertyMap::Line & style) { m_lineBottom = style; } 00094 void setLeftStyle (const PP_PropertyMap::Line & style) { m_lineLeft = style; } 00095 void setRightStyle (const PP_PropertyMap::Line & style) { m_lineRight = style; } 00096 void setTopStyle (const PP_PropertyMap::Line & style) { m_lineTop = style; } 00097 void setOverWrote(void) 00098 {m_bOverWrote = true;} 00099 void setWrapping(bool bWrapping) 00100 {m_bIsWrapped = bWrapping;} 00101 bool isWrappingSet(void) const 00102 { return m_bIsWrapped;} 00103 void setTightWrapping( bool bTight) 00104 { m_bIsTightWrapped = bTight;} 00105 bool isTightWrapped(void) const 00106 { return m_bIsTightWrapped;} 00107 bool isTopBot(void) const 00108 { return m_bIsTopBot; } 00109 void setTopBot(bool b) 00110 { m_bIsTopBot = b;} 00111 bool isLeftWrapped(void) const 00112 { return m_bIsLeftWrapped;} 00113 void setLeftWrapped(bool b) 00114 { m_bIsLeftWrapped = b;} 00115 bool isRightWrapped(void) const 00116 { return m_bIsRightWrapped;} 00117 void setRightWrapped(bool b) 00118 { m_bIsRightWrapped = b;} 00119 00120 bool overlapsRect(const UT_Rect & rec); 00121 bool isAbove(void); 00122 void setAbove(bool bAbove) 00123 { m_bIsAbove = bAbove;} 00124 private: 00125 void _drawLine (const PP_PropertyMap::Line & style, 00126 UT_sint32 left, UT_sint32 top, 00127 UT_sint32 right, UT_sint32 bot, 00128 GR_Graphics * pGr); 00129 fp_Page * m_pPage; 00130 UT_sint32 m_iXpad; 00131 UT_sint32 m_iYpad; 00132 bool m_bNeverDrawn; 00133 00134 // cell-background properties 00135 PP_PropertyMap::Background m_background; 00136 00137 // cell-border properties 00138 PP_PropertyMap::Line m_lineBottom; 00139 PP_PropertyMap::Line m_lineLeft; 00140 PP_PropertyMap::Line m_lineRight; 00141 PP_PropertyMap::Line m_lineTop; 00142 bool m_bOverWrote; 00143 bool m_bIsWrapped; 00144 bool m_bIsTightWrapped; 00145 bool m_bIsAbove; 00146 bool m_bIsTopBot; 00147 bool m_bIsLeftWrapped; 00148 bool m_bIsRightWrapped; 00149 UT_sint32 m_iPreferedPageNo; 00150 UT_sint32 m_iPreferedColumnNo; 00151 }; 00152 00153 00154 #endif /* FRAMECONTAINER_H */