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