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