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

pt_PieceTable.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
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., 59 Temple Place - Suite 330, Boston, MA
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef PT_PIECETABLE_H
00023 #define PT_PIECETABLE_H
00024 
00025 #include <stdio.h>
00026 #include "ut_types.h"
00027 #include "ut_growbuf.h"
00028 #include "ut_hash.h"
00029 #include "ut_stack.h"
00030 #include "pt_Types.h"
00031 #include "pp_TableAttrProp.h"
00032 #include "pf_Fragments.h"
00033 #include "pt_VarSet.h"
00034 #include "pp_Revision.h"
00035 #include "px_ChangeHistory.h"
00036 
00037 class pf_Frag_Object;
00038 class pf_Frag_FmtMark;
00039 class pf_Frag_Text;
00040 class pf_Frag_Strux;
00041 class pf_Frag_Strux_Block;
00042 class pf_Frag_Strux_Section;
00043 class PX_ChangeRecord_Span;
00044 class PD_Style;
00045 class PL_ListenerCoupleCloser;
00046 class fl_ContainerLayout;
00047 
00048 #ifdef PT_TEST
00049 #include "ut_test.h"
00050 #endif
00051 
00054 // pt_PieceTable implements a "Piece Table" as described/suggested
00055 // by .../dev/design/PieceTable.html
00056 
00057 class ABI_EXPORT pt_PieceTable
00058 {
00059     friend class PX_ChangeRecord;
00060 public:
00061     pt_PieceTable(PD_Document * pDocument);
00062     ~pt_PieceTable();
00063 
00064     void                    setPieceTableState(PTState pts);
00065     PTState                 getPieceTableState() const {return m_pts;}
00066     void                    beginMultiStepGlob(void);
00067     void                    endMultiStepGlob(void);
00068     void                    beginUserAtomicGlob(void);
00069     void                    endUserAtomicGlob(void);
00070 
00071     void                    setClean(void);
00072     bool                    isDirty(void) const;
00073 
00074     bool                    canDo(bool bUndo) const;
00075     UT_uint32                               undoCount(bool bUndo) const;
00076     bool                    undoCmd(void);
00077     bool                    redoCmd(void);
00078     bool                    getNthUndo(PX_ChangeRecord ** ppcr, UT_uint32 undoNdx) const
00079                                 { return m_history.getNthUndo(ppcr, undoNdx); }
00080     bool                    getUndo(PX_ChangeRecord ** ppcr, bool bStatic=false) const
00081                                 { return m_history.getUndo(ppcr, bStatic); }
00082     bool                    getRedo(PX_ChangeRecord ** ppcr) const
00083                                 { return m_history.getRedo(ppcr); }
00084     void                    clearUndo() {m_history.clearHistory();}
00085 
00086     static void     s_getLocalisedStyleName(const char *szStyle, UT_UTF8String &utf8);
00087 
00088 protected:
00089     bool                    _realInsertObject(PT_DocPosition dpos,
00090                                               PTObjectType pto,
00091                                               const gchar ** attributes,
00092                                               const gchar ** properties);
00093 
00094     bool                    _realInsertObject(PT_DocPosition dpos,
00095                                               PTObjectType pto,
00096                                               const gchar ** attributes,
00097                                               const gchar ** properties, pf_Frag_Object ** ppfo );
00098 
00099     bool                    _realInsertSpan(PT_DocPosition dpos,
00100                                             const UT_UCSChar * p,
00101                                             UT_uint32 length,
00102                                             const gchar ** attributes,
00103                                             const gchar ** properties,
00104                                             fd_Field * pField = NULL,
00105                                             bool bAddChangeRec = true);
00106 
00107     bool                    _realDeleteSpan(PT_DocPosition dpos1,
00108                                             PT_DocPosition dpos2,
00109                                             PP_AttrProp *p_AttrProp_Before,
00110                                             bool bDeleteTableStruxes,
00111                                             bool bDontGlob=false);
00112 
00113 #if 0
00114     // this is for fields and so should not be needed with revisions
00115     bool                    _realInsertSpan_norec(PT_DocPosition dpos,
00116                                              const UT_UCSChar * p,
00117                                              UT_uint32 length, fd_Field * pField = NULL);
00118     bool                    _realDeleteFieldFrag(pf_Frag * pf);
00119 #endif
00120 
00121     // this one I am not sure about
00122     void                    _realDeleteHdrFtrStrux(pf_Frag_Strux * pfs);
00123 
00124     bool                    _realChangeSpanFmt(PTChangeFmt ptc,
00125                                                PT_DocPosition dpos1,
00126                                                PT_DocPosition dpos2,
00127                                                const gchar ** attributes,
00128                                                const gchar ** properties,
00129                                                bool bRevisionDelete);
00130 
00131     bool                    _realInsertStrux(PT_DocPosition dpos,
00132                                              PTStruxType pts,
00133                                              const gchar ** attributes,
00134                                              const gchar ** properties,
00135                                              pf_Frag_Strux ** ppfs_ret);
00136 
00137     bool                    _realChangeStruxFmt(PTChangeFmt ptc,
00138                                                 PT_DocPosition dpos1,
00139                                                 PT_DocPosition dpos2,
00140                                                 const gchar ** attributes,
00141                                                 const gchar ** properties,
00142                                                 PTStruxType pts,
00143                                                 bool bRevisionDelete);
00144 
00145     bool                    _realChangeStruxForLists(pf_Frag_Strux* sdh,
00146                                                      const char * pszParentID,
00147                                                      bool bRevisionDelete);
00148 
00149     bool                    _realChangeSectionAttsNoUpdate(pf_Frag_Strux * pfStrux, const char * attr, const char * attvalue);
00150 
00151 
00152 
00153     /******************************************************************
00154         these are the new revisions aware methods
00155     */
00156 public:
00157     bool                    insertObject(PT_DocPosition dpos,
00158                                          PTObjectType pto,
00159                                          const gchar ** attributes,
00160                                          const gchar ** properties);
00161 
00162     bool                    insertObject(PT_DocPosition dpos,
00163                                          PTObjectType pto,
00164                                          const gchar ** attributes,
00165                                          const gchar ** properties, pf_Frag_Object ** ppfo );
00166 
00167     bool                    insertSpan(PT_DocPosition dpos,
00168                                        const UT_UCSChar * p,
00169                                        UT_uint32 length, fd_Field * pField = NULL,
00170                                        bool bAddChangeRec = true);
00171 
00172     pf_Frag* getEndOfBlock( PT_DocPosition currentpos, PT_DocPosition endpos );
00173     // bool deleteSpanChangeTrackingAreWeMarkingDeltaMerge( PT_DocPosition startpos,
00174     //                                                      PT_DocPosition endpos );
00175     pf_Frag_Strux* inSameBlock( PT_DocPosition startpos, PT_DocPosition endpos );
00176     // bool changeTrackingAddParaAttribute( pf_Frag_Strux* pfs,
00177     //                                      const char* attr,
00178     //                                      std::string v );
00179     // bool deleteSpanChangeTrackingMaybeMarkParagraphEndDeletion( PT_DocPosition currentpos,
00180     //                                                             PT_DocPosition endpos );
00181 
00182     bool                    deleteSpan(PT_DocPosition dpos1,
00183                                        PT_DocPosition dpos2,
00184                                        PP_AttrProp *p_AttrProp_Before,
00185                                        UT_uint32 &iRealDeleteCount,
00186                                        bool bDontGlob=false);
00187 
00188 
00189     bool                    deleteSpan(PT_DocPosition dpos1,
00190                                        PT_DocPosition dpos2,
00191                                        PP_AttrProp *p_AttrProp_Before,
00192                                        UT_uint32 &iRealDeleteCount,
00193                                        bool bDeleteTableStruxes,
00194                                        bool bDontGlob);
00195     bool                    createAndSendCR(PT_DocPosition  dpos,
00196                                             UT_sint32 iType,bool bSave, UT_Byte iGlob);
00197 
00198     bool                    createAndSendDocPropCR( const gchar ** pAtts, const gchar ** pProps);
00199 
00200     bool                    deleteSpanWithTable(PT_DocPosition dpos1,
00201                                                 PT_DocPosition dpos2,
00202                                                 PP_AttrProp *p_AttrProp_Before,
00203                                                 UT_uint32 &iRealDeleteCount,
00204                                                 bool bDeleteTableStrux);
00205 
00206     bool                    deleteFieldFrag(pf_Frag * pf);
00207 
00208     void                    deleteHdrFtrStrux(pf_Frag_Strux * pfs);
00209 
00210     bool                    changeSpanFmt(PTChangeFmt ptc,
00211                                           PT_DocPosition dpos1,
00212                                           PT_DocPosition dpos2,
00213                                           const gchar ** attributes,
00214                                           const gchar ** properties);
00215 
00216     bool                    insertStrux(PT_DocPosition dpos,
00217                                         PTStruxType pts,
00218                                         pf_Frag_Strux ** ppfs_ret = 0);
00219 
00220     bool                    insertStrux(PT_DocPosition dpos,
00221                                         PTStruxType pts,
00222                                         const gchar ** attributes,
00223                                         const gchar ** properties,
00224                                         pf_Frag_Strux ** ppfs_ret = 0
00225                                         );
00226 
00227     bool                    changeStruxFmt(PTChangeFmt ptc,
00228                                            PT_DocPosition dpos1,
00229                                            PT_DocPosition dpos2,
00230                                            const gchar ** attributes,
00231                                            const gchar ** properties,
00232                                            PTStruxType pts=PTX_StruxDummy);
00233 
00234 
00235     bool                    changeStruxFmtNoUndo(PTChangeFmt ptc,
00236                                            pf_Frag_Strux * pfs,
00237                                            const gchar ** attributes,
00238                                            const gchar ** properties);
00239 
00240     bool                    changeStruxFormatNoUpdate(PTChangeFmt ptc, pf_Frag_Strux * pfs,const gchar ** attributes);
00241 
00242     bool                    changeObjectFormatNoUpdate(PTChangeFmt ptc, pf_Frag_Object * pfo,const gchar ** attributes,const gchar ** properties);
00243 
00244     bool                    changeStruxForLists(pf_Frag_Strux* sdh,
00245                                                 const char * pszParentID);
00246     bool                    changeSectionAttsNoUpdate(pf_Frag_Strux * pfStrux, const char * attr, const char * attvalue);
00247     bool                    deleteStruxNoUpdate(pf_Frag_Strux* sdh);
00248     bool                    deleteFragNoUpdate(pf_Frag * pf);
00249     bool                    deleteStruxWithNotify(pf_Frag_Strux* sdh);
00250     bool                    insertStruxNoUpdateBefore(pf_Frag_Strux* sdh, PTStruxType pts,const gchar ** attributes );
00251     bool                    changeLastStruxFmtNoUndo(PT_DocPosition dpos, PTStruxType pts,
00252                                                      const gchar ** attrs, const gchar ** props,
00253                                                      bool bSkipEmbededSections);
00254 
00255     bool                    changeLastStruxFmtNoUndo(PT_DocPosition dpos, PTStruxType pts,
00256                                                      const gchar ** attrs, const gchar * props,
00257                                                      bool bSkipEmbededSections);
00258 
00259 
00260     /********************** END OF REVISIONS AWARE METHODS ******/
00261     bool                    insertFmtMark(PTChangeFmt ptc,
00262                                           PT_DocPosition dpos,
00263                                           PP_AttrProp *p_AttrProp)
00264         {
00265             return _insertFmtMarkFragWithNotify(ptc,dpos,p_AttrProp);
00266         }
00267     bool                    deleteFmtMark(PT_DocPosition dpos);
00268 
00269     // the append- methods are only available while importing
00270     // the document.
00271 
00272     PD_Document *           getDocument(void);
00273     bool                    appendStrux(PTStruxType pts, const gchar ** attributes, pf_Frag_Strux ** ppfs_ret = 0);
00274     bool                    appendStruxFmt(pf_Frag_Strux * pfs, const gchar ** attributes);
00275     bool                    appendLastStruxFmt(PTStruxType pts, const gchar ** attrs, const gchar ** props,
00276                                                bool bSkipEmbededSections);
00277     bool                    appendLastStruxFmt(PTStruxType pts, const gchar ** attrs, const gchar * props,
00278                                                bool bSkipEmbededSections);
00279 
00280     bool                    appendFmt(const gchar ** attributes);
00281     bool                    appendFmt(const UT_GenericVector<const gchar*> * pVecAttributes);
00282     bool                    appendSpan(const UT_UCSChar * p, UT_uint32 length);
00283     bool                    appendObject(PTObjectType pto, const gchar ** attributes);
00284     bool                    appendFmtMark(void);
00285     bool                    appendStyle(const gchar ** attributes);
00286 
00287     bool                    insertStruxBeforeFrag(pf_Frag * pF, PTStruxType pts,
00288                                                   const gchar ** attributes, pf_Frag_Strux ** ppfs_ret = 0);
00289     bool                    insertSpanBeforeFrag(pf_Frag * pF, const UT_UCSChar * p, UT_uint32 length);
00290     bool                    insertObjectBeforeFrag(pf_Frag * pF, PTObjectType pto,
00291                                                    const gchar ** attributes);
00292     bool                    insertFmtMarkBeforeFrag(pf_Frag * pF);
00293     bool                    insertFmtMarkBeforeFrag(pf_Frag * pF, const gchar ** attributes);
00294 
00295     bool                    removeStyle(const gchar * name);
00296     size_t                  getStyleCount(void) const;
00297 
00298     bool                    tellListener(PL_Listener * pListener);
00299     bool                    tellListenerSubset( PL_Listener * pListener,
00300                                                 PD_DocumentRange * pDocRange,
00301                                                 PL_ListenerCoupleCloser* closer = 0 );
00302 
00303     bool                    addListener(PL_Listener * pListener,
00304                                         PL_ListenerId listenerId);
00305 
00306     bool                    getAttrProp(PT_AttrPropIndex indexAP,
00307                                         const PP_AttrProp ** ppAP) const;
00308     bool                    getSpanAttrProp(pf_Frag_Strux* sdh, UT_uint32 offset, bool bLeftSide,
00309                                             const PP_AttrProp ** ppAP) const;
00310 
00311     inline const UT_UCSChar *getPointer(PT_BufIndex bi) const
00312         {
00313             // the pointer that we return is NOT a zero-terminated
00314             // string.  the caller is responsible for knowing how
00315             // long the data is within the span/fragment.
00316 
00317             return m_varset.getPointer(bi);
00318         }
00319 
00320     bool                    getBlockBuf(pf_Frag_Strux* sdh, UT_GrowBuf * pgb) const;
00321 
00322     PT_DocPosition          getPosEnd();
00323     bool                    getBounds(bool bEnd, PT_DocPosition & docPos) const;
00324     PT_DocPosition          getStruxPosition(pf_Frag_Strux* sdh) const;
00325     PT_DocPosition          getFragPosition(const pf_Frag * pfToFind) const;
00326 
00327     bool dumpDoc( const char* msg, PT_DocPosition currentpos, PT_DocPosition endpos );
00328 
00329     bool                    getFragFromPosition(PT_DocPosition docPos,
00330                                                 pf_Frag ** ppf,
00331                                                 PT_BlockOffset * pOffset) const;
00332 
00333     bool                    getStruxOfTypeFromPosition(PL_ListenerId listenerId,
00334                                                        PT_DocPosition docPos,
00335                                                        PTStruxType pts,
00336                                                        fl_ContainerLayout* * psfh) const;
00337 
00338     pf_Frag_Strux*       getBlockFromPosition(PT_DocPosition pos) const;
00339 
00340     bool                    getStruxOfTypeFromPosition(PT_DocPosition docPos,
00341                                                        PTStruxType pts,
00342                                                        pf_Frag_Strux* * sdh) const;
00343 
00344     bool                    getStruxFromPosition(PL_ListenerId listenerId,
00345                                                  PT_DocPosition docPos,
00346                                                  fl_ContainerLayout* * psfh) const;
00347 
00348     bool                    getFragsFromPositions(PT_DocPosition dPos1, PT_DocPosition dPos2,
00349                                                   pf_Frag ** ppf1, PT_BlockOffset * pOffset1,
00350                                                   pf_Frag ** ppf2, PT_BlockOffset * pOffset2) const;
00351 
00352     bool                    getStyle(const char * szName, PD_Style ** ppStyle) const;
00353 
00354     bool                    enumStyles(UT_uint32 k,
00355                                        const char ** pszName, const PD_Style ** ppStyle) const;
00356 
00357     bool                    enumStyles(UT_GenericVector<PD_Style*> * & pStyles) const;
00358 
00359     const UT_GenericStringMap<PD_Style *> & getAllStyles()const {return m_hashStyles;}
00360     bool                    isEndFootnote(pf_Frag * pf) const;
00361     bool                    isFootnote(pf_Frag * pf) const;
00362 
00363     void                    clearIfAtFmtMark(PT_DocPosition dpos);
00364     pt_VarSet &             getVarSet(void) {return m_varset;};
00365     pf_Fragments &          getFragments(void) {return m_fragments;};
00366 
00367     bool                    purgeFmtMarks();
00368     bool                    isDoingTheDo(void) const
00369     {   return m_bDoingTheDo;}
00370 
00371     void                    setDoNotTweakPosition(bool b) {m_bDoNotTweakPosition = b;}
00372 
00373     UT_uint32               getXID();
00374     UT_uint32               getTopXID() const {return m_iXID;}
00375     void                    setXIDThreshold(UT_uint32 i){m_iXID = i;}
00376     void                    fixMissingXIDs();
00377     UT_sint32               calcDocsize(void);
00378     void                    setCRNumber(UT_sint32 iCRNumber)
00379     { m_iCurCRNumber = iCRNumber;}
00380 #ifdef PT_TEST
00381     UT_TestStatus           __test_VerifyCoalescedFrags(FILE * fp) const;
00382     void                    __dump(FILE * fp) const;
00383     px_ChangeHistory*       getChangeHistory(void) const
00384         { return &m_history; }
00385 #endif /* PT_TEST */
00386 
00387 protected:
00388 
00389     pf_Frag_Strux*          _findLastStruxOfType(pf_Frag * pfStart,
00390                                                  PTStruxType pst,
00391                                                  PTStruxType* stopConditions,
00392                                                  bool bSkipEmbededSections );
00393     pf_Frag_Strux*          _findLastStruxOfType(pf_Frag * pfStart, PTStruxType pst, bool bSkipEmbeded);
00394     pf_Frag *               _findPrevHyperlink(pf_Frag * pfStart);
00395     pf_Frag *               _findNextHyperlink(pf_Frag * pfStart);
00396 
00397     bool                    _tellAndMaybeAddListener(PL_Listener * pListener,
00398                                                      PL_ListenerId listenerId,
00399                                                      bool bAdd);
00400 
00401     void                    _captureActiveSpan(pf_Frag_Strux_Block * pfsBlock);
00402     PT_AttrPropIndex        _chooseIndexAP(pf_Frag * pf, PT_BlockOffset fragOffset);
00403     bool                    _canCoalesceInsertSpan(PX_ChangeRecord_Span * pcrSpan) const;
00404 
00405     bool                    _createStrux(PTStruxType pts,
00406                                          PT_AttrPropIndex indexAP,
00407                                          pf_Frag_Strux ** ppfs);
00408 
00409     void                    _insertStrux(pf_Frag * pf,
00410                                          PT_BlockOffset fragOffset,
00411                                          pf_Frag_Strux * pfsNew);
00412 
00413     bool                    _insertObject(pf_Frag * pf,
00414                                           PT_BlockOffset fragOffset,
00415                                           PTObjectType pto,
00416                                           PT_AttrPropIndex indexAP,
00417                                           pf_Frag_Object * &pfo);
00418 
00419     bool                    _createObject(PTObjectType pto,
00420                                           PT_AttrPropIndex indexAP,
00421                                           pf_Frag_Object ** ppfo);
00422 
00423     bool                    _insertSpan(pf_Frag * pf,
00424                                         PT_BufIndex bi,
00425                                         PT_BlockOffset fragOffset,
00426                                         UT_uint32 length,
00427                                         PT_AttrPropIndex indexAP,
00428                                         fd_Field * pField = NULL);
00429     bool                    _StruxIsNotTable(pf_Frag_Strux * pfs);
00430     bool                    _deleteSpan(pf_Frag_Text * pft, UT_uint32 fragOffset,
00431                                         PT_BufIndex bi, UT_uint32 length,
00432                                         pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00433     void                    _unlinkFrag(pf_Frag * pf,
00434                                         pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00435     bool                    _getStruxFromPosition(PT_DocPosition docPos,
00436                                                   pf_Frag_Strux ** ppfs, bool bSkipFootnotes = false) const;
00437     bool                    _getStruxOfTypeFromPosition(PT_DocPosition dpos,
00438                                                         PTStruxType pts,
00439                                                         pf_Frag_Strux ** ppfs) const;
00440     pf_Frag_Strux*          _getBlockFromPosition(PT_DocPosition pos) const;
00441     bool                    _doTheDo(const PX_ChangeRecord * pcr, bool bUndo);
00442     bool                    _struxHasContent(pf_Frag_Strux * pfs) const;
00443     bool                    _struxIsEmpty(pf_Frag_Strux * pfs) const;
00444     bool                    _unlinkStrux(pf_Frag_Strux * pfs,
00445                                          pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00446     bool                    _unlinkStrux_Block(pf_Frag_Strux * pfs,
00447                                                pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00448     bool                    _unlinkStrux_Section(pf_Frag_Strux * pfs,
00449                                                  pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00450 
00451     bool                    _canCoalesceDeleteSpan(PX_ChangeRecord_Span * pcrSpan) const;
00452 
00453     bool                    _deleteSpanWithNotify(PT_DocPosition dpos,
00454                                                   pf_Frag_Text * pft, UT_uint32 fragOffset,
00455                                                   UT_uint32 length,
00456                                                   pf_Frag_Strux * pfs,
00457                                                   pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd,
00458                                                   bool bAddChangeRec = true);
00459 
00460     bool                    _isSimpleDeleteSpan(PT_DocPosition dpos1,
00461                                                 PT_DocPosition dpos2) const;
00462     void                    _tweakFieldSpan(PT_DocPosition& dpos1,
00463                                             PT_DocPosition& dpos2) const;
00464     bool                    _tweakDeleteSpanOnce(PT_DocPosition& dpos1,
00465                                                  PT_DocPosition& dpos2,
00466                                                  UT_Stack * pstDelayStruxDelete) const;
00467     bool                    _tweakDeleteSpan(PT_DocPosition& dpos1,
00468                                              PT_DocPosition& dpos2,
00469                                              UT_Stack * pstDelayStruxDelete) const;
00470     bool                    _deleteFormatting(PT_DocPosition dpos1,
00471                                               PT_DocPosition dpos2);
00472 
00473     bool                     _deleteComplexSpanHAR( pf_Frag_Object *pO,
00474                                                     PT_DocPosition dpos1,
00475                                                     PT_DocPosition dpos2,
00476                                                     UT_uint32& length,
00477                                                     PT_BlockOffset& fragOffset_First,
00478                                                     UT_uint32& lengthThisStep,
00479                                                     pf_Frag_Strux*& pfsContainer,
00480                                                     pf_Frag*& pfNewEnd,
00481                                                     UT_uint32& fragOffsetNewEnd,
00482                                                     const char* startAttrCSTR );
00483 
00484     bool                    _deleteComplexSpan(PT_DocPosition & dpos1,
00485                                                PT_DocPosition & dpos2,
00486                                                UT_Stack *stDelayStruxDelete);
00487 
00488 
00489     bool                    _deleteComplexSpan_norec(PT_DocPosition dpos1,
00490                                                      PT_DocPosition dpos2);
00491 
00492     bool                    _deleteObject(pf_Frag_Object * pfo,
00493                                           pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00494 
00495     bool                    _deleteObjectWithNotify(PT_DocPosition dpos,
00496                                                     pf_Frag_Object * pfo, UT_uint32 fragOffset,
00497                                                     UT_uint32 length,
00498                                                     pf_Frag_Strux * pfs,
00499                                                     pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd,
00500                                                     bool bAddChangeRec = true);
00501 
00502 
00503 
00504     bool                    _deleteObject_norec(PT_DocPosition dpos,
00505                                                 pf_Frag_Object * pfo, UT_uint32 fragOffset,
00506                                                 UT_uint32 length,
00507                                                 pf_Frag_Strux * pfs,
00508                                                 pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00509 
00510     bool                    _deleteStruxWithNotify(PT_DocPosition dpos,
00511                                                    pf_Frag_Strux * pfs,
00512                                                    pf_Frag ** ppfEnd,
00513                                                    UT_uint32 * pfragOffsetEnd,
00514                                                    bool bWithRec = true);
00515 
00516     bool                    _deleteHdrFtrsFromSectionStruxIfPresent(pf_Frag_Strux_Section * pfStruxSec);
00517 
00518     void                    _deleteHdrFtrStruxWithNotify( pf_Frag_Strux * pfFragStruxHdrFtr);
00519 
00520     bool                    _fixHdrFtrReferences(const gchar * pType, const gchar * pId, bool bNotional = false);
00521 
00522     bool                    _fmtChangeStrux(pf_Frag_Strux * pfs,
00523                                             PT_AttrPropIndex indexNewAP);
00524 
00525     bool                    _fmtChangeStruxWithNotify(PTChangeFmt ptc,
00526                                                       pf_Frag_Strux * pfs,
00527                                                       const gchar ** attributes,
00528                                                       const gchar ** properties,
00529                                                       bool bRevisionDelete);
00530 
00531     bool                    _fmtChangeStruxWithNotify(PTChangeFmt ptc,
00532                                                       pf_Frag_Strux * pfs,
00533                                                       const gchar ** attributes,
00534                                                       const gchar ** properties,
00535                                                       bool bDoAll,
00536                                                       bool bRevisionDelete);
00537 
00538     bool                    _fmtChangeSpan(pf_Frag_Text * pft, UT_uint32 fragOffset, UT_uint32 length,
00539                                            PT_AttrPropIndex indexNewAP,
00540                                            pf_Frag ** ppfNewEnd, UT_uint32 * pfragOffsetNewEnd);
00541 
00542     bool                    _fmtChangeSpanWithNotify(PTChangeFmt ptc,
00543                                                      pf_Frag_Text * pft, UT_uint32 fragOffset,
00544                                                      PT_DocPosition dpos,
00545                                                      UT_uint32 length,
00546                                                      const gchar ** attributes,
00547                                                      const gchar ** properties,
00548                                                      pf_Frag_Strux * pfs,
00549                                                      pf_Frag ** ppfNewEnd,
00550                                                      UT_uint32 * pfragOffsetNewEnd,
00551                                                      bool bRevisionDelete);
00552 
00553     bool                    _fmtChangeObject(pf_Frag_Object * pfo,
00554                                              PT_AttrPropIndex indexNewAP,
00555                                              pf_Frag ** ppfNewEnd,
00556                                              UT_uint32 * pfragOffsetNewEnd);
00557 
00558     bool                    _fmtChangeObjectWithNotify(PTChangeFmt ptc,
00559                                                        pf_Frag_Object * pfo, UT_uint32 fragOffset,
00560                                                        PT_DocPosition dpos,
00561                                                        UT_uint32 length,
00562                                                        const gchar ** attributes,
00563                                                        const gchar ** properties,
00564                                                        pf_Frag_Strux * pfs,
00565                                                        pf_Frag ** ppfNewEnd,
00566                                                        UT_uint32 * pfragOffsetNewEnd,
00567                                                        bool bRevisionDelete);
00568 
00569     bool                    _getStruxFromFrag(pf_Frag * pfStart, pf_Frag_Strux ** ppfs) const;
00570     bool                    _getStruxFromFragSkip(pf_Frag * pfStart, pf_Frag_Strux ** ppfs) const;
00571 
00572     bool                    _getNextStruxAfterFragSkip(pf_Frag *pfStart, pf_Frag_Strux ** ppfs);
00573 
00574     bool                    _getStruxFromPositionSkip(PT_DocPosition docPos,
00575                                                       pf_Frag_Strux ** ppfs) const;
00576 
00577     UT_uint32               _computeBlockOffset(pf_Frag_Strux * pfs,pf_Frag * pfTarget) const;
00578 
00579     bool                    _loadBuiltinStyles(void);
00580     bool                    _createBuiltinStyle(const char * szName, bool bDisplayed, const gchar ** attributes);
00581 
00582     bool                    _insertFmtMarkFragWithNotify(PTChangeFmt ptc,
00583                                                          PT_DocPosition dpos,
00584                                                          const gchar ** attributes,
00585                                                          const gchar ** properties);
00586     bool                    _insertFmtMarkFragWithNotify(PTChangeFmt ptc,
00587                                                          PT_DocPosition dpos,
00588                                                          PP_AttrProp *p_AttrProp);
00589     bool                    _insertFmtMark(pf_Frag * pf, UT_uint32 fragOffset, PT_AttrPropIndex api);
00590     bool                    _insertFmtMarkAfterBlockWithNotify(pf_Frag_Strux * pfsBlock,
00591                                                                PT_DocPosition dpos,
00592                                                                PT_AttrPropIndex api);
00593     bool                    _deleteFmtMarkWithNotify(PT_DocPosition dpos, pf_Frag_FmtMark * pffm,
00594                                                      pf_Frag_Strux * pfs,
00595                                                      pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00596     bool                    _deleteFmtMark(pf_Frag_FmtMark * pffm,
00597                                            pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00598     bool                    _fmtChangeFmtMarkWithNotify(PTChangeFmt ptc, pf_Frag_FmtMark * pffm,
00599                                                         PT_DocPosition dpos,
00600                                                         const gchar ** attributes, const gchar ** properties,
00601                                                         pf_Frag_Strux * pfs,
00602                                                         pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd);
00603     bool                    _fmtChangeFmtMark(pf_Frag_FmtMark * pffm,
00604                                               PT_AttrPropIndex indexNewAP,
00605                                               pf_Frag ** ppfNewEnd,
00606                                               UT_uint32 * pfragOffsetNewEnd);
00607     bool                    _computeFmtMarkForNewBlock(pf_Frag_Strux * pfsBlock,
00608                                                        pf_Frag * pfCurrent, PT_BlockOffset fragOffset,
00609                                                        PT_AttrPropIndex * pFmtMarkAP);
00610     bool                    _getSpanAttrPropHelper(pf_Frag * pf, const PP_AttrProp ** ppAP) const;
00611     bool                    _lastUndoIsThisFmtMark(PT_DocPosition dpos);
00612 
00613     bool                    _changePointWithNotify(PT_DocPosition dpos);
00614 
00615     // helper methods for the appned and insert*BeforeFrag methods
00616     bool                    _makeStrux(PTStruxType pts, const gchar ** attributes,
00617                                        pf_Frag_Strux * &pfs);
00618     bool                    _makeObject(PTObjectType pto, const gchar ** attributes,
00619                                         pf_Frag_Object * &pfo);
00620     bool                    _makeFmtMark(pf_Frag_FmtMark * &pff);
00621     bool                    _makeFmtMark(pf_Frag_FmtMark * &pff, const gchar ** attributes);
00622     UT_sint32               _getNextChangeRecordNumber(void)
00623     { return m_iCurCRNumber++;}
00624     // implemented in pt_PT_InsertStrux.cpp
00625     bool                    _translateRevisionAttribute(PP_RevisionAttr & Revisions, PT_AttrPropIndex indexAP,
00626                                                         PP_RevisionType eType,
00627                                                         const gchar ** & ppRevAttrib,
00628                                                         const gchar ** & ppRevProps,
00629                                                         const gchar **   ppAttrib,
00630                                                         const gchar **   ppProps);
00631 
00632 
00633     PTState                 m_pts;      /* are we loading or editing */
00634     pt_VarSet               m_varset;
00635     px_ChangeHistory        m_history;
00636     pf_Fragments            m_fragments;
00637     UT_GenericStringMap<PD_Style *> m_hashStyles;
00638 
00639     struct {
00640         PT_AttrPropIndex    m_indexCurrentInlineAP;
00641     } loading;                          /* stuff only valid while m_pts==PTS_Loading */
00642 
00643     PD_Document *           m_pDocument; /* back pointer to our document */
00644 
00645     UT_uint32               m_atomicGlobCount;
00646     bool                    m_bDoingTheDo;
00647     bool                    m_bDoNotTweakPosition;
00648 
00649     UT_uint32               m_iXID;
00650     UT_sint32               m_iCurCRNumber;
00651 };
00652 
00653 #endif /* PT_PIECETABLE_H */

Generated on Mon May 28 2012 for AbiWord by  doxygen 1.7.1