• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

fl_ContainerLayout.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  * Copyright (C) 2002 Martin Sevior
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 #ifndef CONTAINERLAYOUT_H
00022 #define CONTAINERLAYOUT_H
00023 
00024 #ifdef FMT_TEST
00025 #include <stdio.h>
00026 #endif
00027 
00028 typedef enum _fl_ContainerType
00029 {
00030     FL_CONTAINER_BLOCK,
00031     FL_CONTAINER_DOCSECTION,
00032     FL_CONTAINER_HDRFTR,
00033     FL_CONTAINER_SHADOW,
00034     FL_CONTAINER_FOOTNOTE,
00035     FL_CONTAINER_ENDNOTE,
00036     FL_CONTAINER_MARGINNOTE,
00037     FL_CONTAINER_TABLE,
00038     FL_CONTAINER_CELL,
00039     FL_CONTAINER_FRAME,
00040         FL_CONTAINER_TOC,
00041     FL_CONTAINER_ANNOTATION,
00042     FL_CONTAINER_RDFANCHOR
00043 } fl_ContainerType;
00044 
00045 // this enum is used here and by the run classes
00046 // I had to move it here from fp_Run to avoid circular dependency
00047 typedef enum {FP_VISIBLE = 0,
00048               FP_HIDDEN_TEXT,
00049               FP_HIDDEN_REVISION,
00050               FP_HIDDEN_REVISION_AND_TEXT,
00051               FP_HIDDEN_FOLDED
00052 } FPVisibility;
00053 
00054 
00055 #include "ut_types.h"
00056 #include "ut_vector.h"
00057 #include "pt_Types.h"
00058 #include "fl_Layout.h"
00059 #include "ut_debugmsg.h"
00060 #include "ut_misc.h" // for UT_RGBColor
00061 #include "gr_Image.h"
00062 #include "gr_Graphics.h"
00063 
00064 class FL_DocLayout;
00065 class PD_Document;
00066 class PP_AttrProp;
00067 class fl_Layout;
00068 class fl_HdrFtrSectionLayout;
00069 class fl_SectionLayout;
00070 class fp_ContainerObject;
00071 class fp_Container;
00072 class fp_Run;
00073 class fl_DocSectionLayout;
00074 class UT_GrowBuf;
00075 class fl_FrameLayout;
00076 class fp_FrameContainer;
00077 class fl_BlockLayout;
00078 class pf_Frag_Strux;
00079 
00080 class ABI_EXPORT fl_ContainerLayout : public fl_Layout
00081 {
00082     friend class fl_BlockLayout;
00083 public:
00084     fl_ContainerLayout(fl_ContainerLayout* pLayout, pf_Frag_Strux* sdh, PT_AttrPropIndex ap, PTStruxType iStrux,fl_ContainerType iType);
00085     virtual ~fl_ContainerLayout();
00086 
00087     fl_ContainerType    getContainerType(void) const { return m_iConType; }
00088     const char *        getContainerString(void);
00089     const char *                getAttribute(const char * pKey) const;
00090     virtual fp_Container*       getFirstContainer() const;
00091     virtual fp_Container*       getLastContainer() const;
00092     virtual void                setFirstContainer(fp_Container * pCon);
00093     virtual void                setLastContainer(fp_Container * pCon);
00094 
00095     virtual bool        recalculateFields(UT_uint32 iUpdateCount) =0;
00096 
00097     virtual fp_Container*       getNewContainer(fp_Container * pFirstContainer = NULL) = 0;
00098     virtual FL_DocLayout *      getDocLayout(void) const;
00099     UT_sint32           getLevelInList(void);
00100     virtual void        format(void) = 0;
00101     virtual void        appendTextToBuf(UT_GrowBuf & buf) const;
00102     virtual void        updateLayout(bool bDoAll) = 0;
00103     virtual void        markAllRunsDirty(void) =0;
00104     virtual void        collapse(void) = 0;
00105     virtual void        redrawUpdate(void) = 0;
00106     virtual void        setNeedsReformat(fl_ContainerLayout * pCL, UT_uint32 offset = 0) = 0;
00107     virtual void        setNeedsRedraw(void) = 0;
00108     virtual bool        isCollapsed(void) const = 0;
00109     virtual bool        needsReformat(void) const = 0;
00110     virtual bool        needsRedraw(void) const = 0;
00111     virtual fl_DocSectionLayout * getDocSectionLayout(void) const;
00112     virtual fl_SectionLayout * getSectionLayout() const = 0;
00113     virtual fl_HdrFtrSectionLayout * getHdrFtrSectionLayout(void) const;
00114     void                setContainingLayout(fl_ContainerLayout*);
00115     fl_ContainerLayout * myContainingLayout(void) const;
00116     fl_HdrFtrSectionLayout *   getHdrFtrLayout(void);
00117     void                setPrev(fl_ContainerLayout*);
00118     void                setNext(fl_ContainerLayout*);
00119     fl_ContainerLayout * getPrev(void) const;
00120     fl_ContainerLayout * getNext(void) const;
00121     fl_ContainerLayout * getFirstLayout(void) const;
00122     fl_ContainerLayout * getLastLayout(void) const;
00123     void                 setLastLayout(fl_ContainerLayout *pL);
00124     void                 setFirstLayout(fl_ContainerLayout *pL);
00125     fl_ContainerLayout * append(pf_Frag_Strux* sdh, PT_AttrPropIndex indexAP,fl_ContainerType iType);
00126     void                 add(fl_ContainerLayout* pL);
00127     fl_ContainerLayout * insert(pf_Frag_Strux* sdh, fl_ContainerLayout * pPrev, PT_AttrPropIndex indexAP,fl_ContainerType iType);
00128     void                 remove(fl_ContainerLayout * pL);
00129     virtual fp_Run *        getFirstRun(void) const;
00130     virtual PT_DocPosition  getPosition(bool bActualBlockPosition = false) const;
00131     bool                    canContainPoint() const;
00132     FPVisibility            isHidden() const {return m_eHidden;}
00133     void                    setVisibility(FPVisibility eVis) {m_eHidden = eVis;}
00134     bool                    isOnScreen() const;
00135 
00136 // Frames stuff
00137     UT_sint32               getNumFrames(void) const;
00138     fl_FrameLayout *        getNthFrameLayout(UT_sint32 i) const;
00139     fp_FrameContainer *     getNthFrameContainer(UT_sint32 i) const;
00140     void                    addFrame(fl_FrameLayout * pFrame);
00141     bool                    removeFrame(fl_FrameLayout * pFrame);
00142 
00143 // For Folded Text
00144 
00145     UT_sint32               getFoldedLevel(void);
00146     UT_uint32               getFoldedID(void);
00147     void                    lookupFoldedLevel(void);
00148 
00149     void                    lookupProperties(void);
00150     void                    lookupMarginProperties(void);
00151 
00152     fl_BlockLayout*         getNextBlockInDocument(void) const;
00153     fl_BlockLayout*         getPrevBlockInDocument(void) const;
00154 
00155     FPVisibility            getAP(const PP_AttrProp *& pAP)const;
00156     void                    getSpanAP(UT_uint32 blockPos, bool bLeft, const PP_AttrProp * &pSpanAP) const;
00157 
00158  // Embedded structures
00159     bool                    containsFootnoteLayouts(void) const;
00160     bool                    containsAnnotationLayouts(void) const;
00161 
00162 #ifdef FMT_TEST
00163     virtual void        __dump(FILE * fp) const;
00164 #endif
00165 protected:
00166     // need this to be protected, so fl_BlockLayout can call it
00167     void                    _insertIntoList(fl_ContainerLayout * pL);
00168 
00169 private:
00170     bool                    _getPropertiesAP(const PP_AttrProp *& pAP);
00171     virtual void            _lookupProperties(const PP_AttrProp* pAP) = 0;
00172 
00173     // This function must be overriden by any derrived class that can endup positioned
00174     // outside of the normal printable area on page
00175     virtual void            _lookupMarginProperties(const PP_AttrProp* /*pAP*/){}
00176 
00177     virtual bool            _canContainPoint() const {return true;}
00178     void                    _insertFirst(fl_ContainerLayout * pL);
00179 
00180     fl_ContainerType            m_iConType;
00181     fl_ContainerLayout*         m_pMyLayout;
00182 
00183     fl_ContainerLayout*         m_pPrev;
00184     fl_ContainerLayout*         m_pNext;
00185 
00186     fl_ContainerLayout*         m_pFirstL;
00187     fl_ContainerLayout*         m_pLastL;
00188     fp_Container *              m_pFirstContainer;
00189     fp_Container *              m_pLastContainer;
00190     FPVisibility                m_eHidden;
00191     UT_GenericVector<fl_FrameLayout *> m_vecFrames;
00192     UT_sint32                   m_iFoldedLevel;
00193     UT_uint32                   m_iFoldedID;
00194 };
00195 
00196 #endif /* CONTAINERLAYOUT_H */
00197 
00198 
00199 
00200 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1