00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PD_DOCUMENT_H
00025 #define PD_DOCUMENT_H
00026
00027 #include <stdio.h>
00028 #include <string>
00029
00030 #include "ut_types.h"
00031 #include "ut_vector.h"
00032 #include "ut_hash.h"
00033 #include "xad_Document.h"
00034 #include "ut_xml.h"
00035 #include "pt_Types.h"
00036 #include "pl_Listener.h"
00037 #include "pf_Frag.h"
00038 #include "ie_FileInfo.h"
00039 #include "fp_PageSize.h"
00040 #include "ut_string_class.h"
00041 #include "ut_misc.h"
00042 #include "px_ChangeRecord.h"
00043
00044 #include <gsf/gsf-input.h>
00045 #include <gsf/gsf-output.h>
00046
00047 class UT_ByteBuf;
00048 class UT_GrowBuf;
00049 class pt_PieceTable;
00050 class PP_AttrProp;
00051 class PP_Revision;
00052 class PP_RevisionAttr;
00053 class pf_Frag_Strux;
00054 class PX_ChangeRecord;
00055 class PD_Style;
00056 class PD_DocIterator;
00057 class fd_Field;
00058 class po_Bookmark;
00059 class fl_AutoNum;
00060 class fl_BlockLayout;
00061 class fp_Run;
00062 class UT_UTF8String;
00063 class pp_Author;
00064
00065
00066 #ifdef PT_TEST
00067 #include "ut_test.h"
00068 #endif
00069
00070 enum
00071 {
00072 PD_SIGNAL_UPDATE_LAYOUT = 0,
00073 PD_SIGNAL_REFORMAT_LAYOUT,
00074 PD_SIGNAL_DOCPROPS_CHANGED_REBUILD,
00075 PD_SIGNAL_DOCPROPS_CHANGED_NO_REBUILD,
00076 PD_SIGNAL_REVISION_MODE_CHANGED,
00077 PD_SIGNAL_DOCNAME_CHANGED,
00078 PD_SIGNAL_DOCDIRTY_CHANGED,
00079 PD_SIGNAL_SAVEDOC,
00080 PD_SIGNAL_DOCCLOSED
00081 };
00082
00084
00086
00087
00088 #define DC_META_PREFIX "dc."
00089
00090
00091 #define ABIWORD_META_PREFIX "abiword."
00092
00093
00094 #define CUSTOM_META_PREFIX "custom."
00095
00097
00099
00100
00101 #define PD_META_KEY_TITLE "dc.title"
00102
00103
00104
00105 #define PD_META_KEY_CREATOR "dc.creator"
00106
00107
00108 #define PD_META_KEY_SUBJECT "dc.subject"
00109
00110
00111 #define PD_META_KEY_DESCRIPTION "dc.description"
00112
00113
00114 #define PD_META_KEY_PUBLISHER "dc.publisher"
00115
00116
00117 #define PD_META_KEY_CONTRIBUTOR "dc.contributor"
00118
00119
00120 #define PD_META_KEY_DATE "dc.date"
00121
00122
00123
00124 #define PD_META_KEY_TYPE "dc.type"
00125
00126
00127
00128 #define PD_META_KEY_FORMAT "dc.format"
00129
00130
00131 #define PD_META_KEY_SOURCE "dc.source"
00132
00133
00134 #define PD_META_KEY_LANGUAGE "dc.language"
00135
00136
00137 #define PD_META_KEY_RELATION "dc.relation"
00138
00139
00140
00141 #define PD_META_KEY_COVERAGE "dc.coverage"
00142
00143
00144 #define PD_META_KEY_RIGHTS "dc.rights"
00145
00147
00149
00150
00151 #define PD_META_KEY_KEYWORDS "abiword.keywords"
00152
00153
00154 #define PD_META_KEY_DATE_LAST_CHANGED "abiword.date_last_changed"
00155
00156
00157 #define PD_META_KEY_GENERATOR "abiword.generator"
00158
00159 class ABI_EXPORT ImagePage
00160 {
00161 public:
00162 ImagePage(UT_UTF8String & sImageId, UT_sint32 iPage, double xInch, double yInch, const char * pzProps);
00163 virtual ~ImagePage(void);
00164 const UT_UTF8String * getImageId(void) const;
00165 UT_sint32 getPageNo(void) const;
00166 double getXInch(void) const;
00167 double getYInch(void) const;
00168 const UT_UTF8String * getProps(void) const;
00169
00170 private:
00171 UT_UTF8String m_sImageId;
00172 UT_sint32 m_iPage;
00173 double m_xInch;
00174 double m_yInch;
00175 UT_UTF8String m_sProps;
00176 };
00177
00181 class ABI_EXPORT TextboxPage
00182 {
00183 public:
00184 TextboxPage(UT_sint32 iPage, double xInch, double yInch,const char * pzProps, UT_ByteBuf & sContent);
00185 virtual ~TextboxPage(void);
00186 const UT_ByteBuf * getContent(void) const;
00187 UT_sint32 getPageNo(void) const;
00188 double getXInch(void) const;
00189 double getYInch(void) const;
00190 const UT_UTF8String * getProps(void) const;
00191 private:
00192 UT_sint32 m_iPage;
00193 double m_xInch;
00194 double m_yInch;
00195 UT_UTF8String m_sProps;
00196 UT_ByteBuf m_sContent;
00197 };
00198
00199
00204 class ABI_EXPORT PD_Document : public AD_Document
00205 {
00206 public:
00207 PD_Document();
00208
00209 virtual AD_DOCUMENT_TYPE getType() const {return ADDOCUMENT_ABIWORD;}
00210
00211 virtual UT_Error readFromFile(const char * szFilename, int ieft, const char * impProps = NULL);
00212 virtual UT_Error importFile(const char * szFilename, int ieft, bool markClean = false, bool bImportStylesFirst = true,
00213 const char * impProps = NULL);
00214 UT_Error readFromFile(GsfInput *input, int ieft, const char * impProps = NULL);
00215 UT_Error importFile(GsfInput *input, int ieft, bool markClean = false, bool bImportStylesFirst = true,
00216 const char * impProps = NULL);
00217 virtual UT_Error importStyles(const char * szFilename, int ieft, bool bDocProps = false);
00218
00219 virtual UT_Error newDocument(void);
00220
00221 UT_Error saveAs(GsfOutput * output, int ieft, bool cpy = false, const char * expProps = NULL);
00222
00223
00224 UT_Error createRawDocument(void);
00225 void finishRawCreation(void);
00226
00227 virtual bool isDirty(void) const;
00228 virtual void forceDirty();
00229 bool isConnected(void);
00230 virtual bool canDo(bool bUndo) const;
00231 virtual UT_uint32 undoCount(bool bUndo) const;
00232 virtual bool undoCmd(UT_uint32 repeatCount);
00233 virtual bool redoCmd(UT_uint32 repeatCount);
00234 bool isDoingTheDo(void) const;
00235
00236
00237
00238 void removeCaret(const std::string& sCaretID);
00239
00240
00241
00242 void addPageReferencedImage(UT_UTF8String & sImageId, UT_sint32 iPage, double xInch, double yInch, const char * pzProps);
00243 void addPageReferencedTextbox(UT_ByteBuf & sContent,UT_sint32 iPage, double xInch, double yInch,const char * pzProps);
00244 ImagePage * getNthImagePage(UT_sint32 iImagePage);
00245 TextboxPage * getNthTextboxPage(UT_sint32 iTextboxPage);
00246 void clearAllPendingObjects(void);
00247
00248
00249
00250 void setShowAuthors(bool bAuthors);
00251 bool isShowAuthors(void) const
00252 { return m_bShowAuthors;}
00253 bool isExportAuthorAtts(void) const;
00254 void setExportAuthorAtts(bool bExport);
00255 UT_GenericVector<pp_Author*>& getAuthors()
00256 { return m_vecAuthors; }
00257 UT_sint32 getMyAuthorInt(void) const;
00258 void setMyAuthorInt(UT_sint32 iAuthor);
00259 UT_sint32 getLastAuthorInt(void) const;
00260 UT_sint32 getNumAuthors(void) const;
00261 pp_Author * getNthAuthor(UT_sint32 i) const;
00262 pp_Author * getAuthorByInt(UT_sint32 i) const;
00263 pp_Author * addAuthor(UT_sint32 iAuthor);
00264 bool sendAddAuthorCR(pp_Author * pAuthor);
00265 bool sendChangeAuthorCR(pp_Author * pAuthor);
00266 UT_sint32 findFirstFreeAuthorInt(void) const;
00267 private:
00268 bool addAuthorAttributeIfBlank(const gchar ** szAttsIn, const gchar **& szAttsOut, UT_String & storage);
00269 bool addAuthorAttributeIfBlank( PP_AttrProp *&p_AttrProp);
00270 bool _buildAuthorProps(pp_Author * pAuthor, const gchar **& szProps);
00271 public:
00272
00273 void beginUserAtomicGlob(void);
00274 void endUserAtomicGlob(void);
00275 void setMarginChangeOnly(bool b);
00276 bool isMarginChangeOnly(void) const;
00277 bool changeObjectFormatNoUpdate(PTChangeFmt ptc ,PL_ObjectHandle odh,const gchar ** attributes,const gchar ** properties );
00278 PT_AttrPropIndex getAPIFromSOH(PL_ObjectHandle odh);
00279 bool insertObject(PT_DocPosition dpos,
00280 PTObjectType pto,
00281 const gchar ** attributes,
00282 const gchar ** properties);
00283 bool insertObject(PT_DocPosition dpos,
00284 PTObjectType pto,
00285 const gchar ** attributes,
00286 const gchar ** properties, fd_Field ** pField );
00287
00288 bool insertSpan(PT_DocPosition dpos,
00289 const UT_UCSChar * p,
00290 UT_uint32 length,
00291 PP_AttrProp *p_AttrProp = NULL);
00292
00293 bool deleteSpan(PT_DocPosition dpos1,
00294 PT_DocPosition dpos2,
00295 PP_AttrProp *p_AttrProp_Before,
00296 UT_uint32 &iRealDeleteCount,
00297 bool bDeleteTableStruxes = false);
00298
00299 bool deleteFmtMark( PT_DocPosition dpos);
00300
00301 bool changeSpanFmt(PTChangeFmt ptc,
00302 PT_DocPosition dpos1,
00303 PT_DocPosition dpos2,
00304 const gchar ** attributes,
00305 const gchar ** properties);
00306
00307 bool insertStrux(PT_DocPosition dpos,
00308 PTStruxType pts, pf_Frag_Strux ** ppfs_ret = 0);
00309 bool deleteStrux(PT_DocPosition dpos,
00310 PTStruxType pts,
00311 bool bRecordChange);
00312
00313 bool createAndSendCR(PT_DocPosition dpos,UT_sint32 iType,bool bsave,UT_Byte iGlob);
00314 virtual bool createAndSendDocPropCR( const gchar ** pAtts,const gchar ** pProps );
00315 bool changeDocPropeties(const gchar ** szAtts, const gchar ** pProps);
00316
00317 bool insertStrux(PT_DocPosition dpos,
00318 PTStruxType pts,
00319 const gchar ** attributes,
00320 const gchar ** properties, pf_Frag_Strux ** ppfs_ret = 0);
00321
00322 void deleteHdrFtrStrux(PL_StruxDocHandle sdh);
00323
00324 bool changeStruxFmt(PTChangeFmt ptc,
00325 PT_DocPosition dpos1,
00326 PT_DocPosition dpos2,
00327 const gchar ** attributes,
00328 const gchar ** properties,
00329 PTStruxType pts);
00330
00331 bool changeStruxFmt(PTChangeFmt ptc,
00332 PT_DocPosition dpos1,
00333 PT_DocPosition dpos2,
00334 const gchar ** attributes,
00335 const gchar ** properties);
00336
00337
00338 bool changeStruxFmtNoUndo(PTChangeFmt ptc,
00339 PL_StruxDocHandle sdh,
00340 const gchar ** attributes,
00341 const gchar ** properties);
00342
00343 bool changeStruxForLists(PL_StruxDocHandle sdh,
00344 const char * pszParentID);
00345
00346 bool insertFmtMark(PTChangeFmt ptc,
00347 PT_DocPosition dpos,
00348 PP_AttrProp *p_AttrProp);
00349
00350 bool changeLastStruxFmtNoUndo(PT_DocPosition dpos, PTStruxType pts,
00351 const gchar ** attrs, const gchar ** props,
00352 bool bSkipEmbededSections);
00353
00354 bool changeLastStruxFmtNoUndo(PT_DocPosition dpos, PTStruxType pts,
00355 const gchar ** attrs, const gchar * props,
00356 bool bSkipEmbededSections);
00357
00358
00359
00360
00361 bool appendStrux(PTStruxType pts, const gchar ** attributes, pf_Frag_Strux ** ppfs_ret = 0);
00362 bool appendStruxFmt(pf_Frag_Strux * pfs, const gchar ** attributes);
00363 bool appendLastStruxFmt(PTStruxType pts, const gchar ** attrs, const gchar ** props,
00364 bool bSkipEmbededSections);
00365 bool appendLastStruxFmt(PTStruxType pts, const gchar ** attrs, const gchar * props,
00366 bool bSkipEmbededSections);
00367 bool appendFmt(const gchar ** attributes);
00368 bool appendFmt(const UT_GenericVector<const gchar*> * pVecAttributes);
00369 bool appendSpan(const UT_UCSChar * p, UT_uint32 length);
00370 bool appendObject(PTObjectType pto, const gchar ** attributes);
00371 bool appendFmtMark(void);
00372 bool appendStyle(const gchar ** attributes);
00373 bool changeStruxFormatNoUpdate(PTChangeFmt ptc ,PL_StruxDocHandle sdh,const gchar ** attributes);
00374 bool insertStruxBeforeFrag(pf_Frag * pF, PTStruxType pts,
00375 const gchar ** attributes, pf_Frag_Strux ** ppfs_ret = 0);
00376 bool insertSpanBeforeFrag(pf_Frag * pF, const UT_UCSChar * p, UT_uint32 length);
00377 bool insertObjectBeforeFrag(pf_Frag * pF, PTObjectType pto,
00378 const gchar ** attributes);
00379 bool insertFmtMarkBeforeFrag(pf_Frag * pF);
00380 bool insertFmtMarkBeforeFrag(pf_Frag * pF, const gchar ** attributes);
00381
00382 pf_Frag * findFragOfType(pf_Frag::PFType iType, UT_sint32 iSubtype = -1,
00383 const pf_Frag * pfStart = NULL);
00384 pf_Frag * getLastFrag() const;
00385 bool checkForSuspect(void);
00386 bool repairDoc(void);
00387 bool removeStyle(const gchar * name);
00388 bool tellListener(PL_Listener * pListener);
00389 bool tellListenerSubset(PL_Listener * pListener,
00390 PD_DocumentRange * pDocRange);
00391 bool addListener(PL_Listener * pListener, PL_ListenerId * pListenerId);
00392 bool removeListener(PL_ListenerId listenerId);
00393 bool signalListeners(UT_uint32 iSignal) const;
00394 bool notifyListeners(const pf_Frag_Strux * pfs, const PX_ChangeRecord * pcr) const;
00395 bool notifyListeners(const pf_Frag_Strux * pfs,
00396 pf_Frag_Strux * pfsNew,
00397 const PX_ChangeRecord * pcr) const;
00398 void deferNotifications(void);
00399 void processDeferredNotifications(void);
00400 UT_sint32 getAdjustmentForCR(const PX_ChangeRecord * pcr) const;
00401
00402
00403
00404 bool getAttrProp(PT_AttrPropIndex indexAP, const PP_AttrProp ** ppAP) const;
00405 bool getSpanAttrProp(PL_StruxDocHandle sdh, UT_uint32 offset, bool bLeftSide,
00406 const PP_AttrProp ** ppAP) const;
00407
00408 bool getAttrProp(PT_AttrPropIndex apIndx, const PP_AttrProp ** ppAP, PP_RevisionAttr ** pRevisions,
00409 bool bShowRevisions, UT_uint32 iRevisionId, bool &bHiddenRevision) const;
00410
00411 bool getSpanAttrProp(PL_StruxDocHandle sdh, UT_uint32 offset, bool bLeftSide,
00412 const PP_AttrProp ** ppAP,
00413 PP_RevisionAttr ** pRevisions,
00414 bool bShowRevisions, UT_uint32 iRevisionId,
00415 bool &bHiddenRevision) const;
00416
00417 const UT_UCSChar * getPointer(PT_BufIndex bi) const;
00418 bool getBlockBuf(PL_StruxDocHandle sdh, UT_GrowBuf * pgb) const;
00419
00420 bool getBounds(bool bEnd, PT_DocPosition & docPos) const;
00421 PTStruxType getStruxType(PL_StruxDocHandle sdh) const;
00422 PT_DocPosition getStruxPosition(PL_StruxDocHandle sdh) const;
00423 bool getStruxFromPosition(PL_ListenerId listenerId,
00424 PT_DocPosition docPos,
00425 PL_StruxFmtHandle * psfh) const;
00426 bool getStruxOfTypeFromPosition(PL_ListenerId listenerId,
00427 PT_DocPosition docPos,
00428 PTStruxType pts,
00429 PL_StruxFmtHandle * psfh) const;
00430 bool getStruxOfTypeFromPosition(PT_DocPosition, PTStruxType pts, PL_StruxDocHandle * sdh) const;
00431
00432 pf_Frag * getFragFromPosition(PT_DocPosition docPos) const;
00433
00434 bool getNextStruxOfType(PL_StruxDocHandle sdh,PTStruxType pts,
00435 PL_StruxDocHandle * nextsdh);
00436 bool getPrevStruxOfType(PL_StruxDocHandle sdh,PTStruxType pts,
00437 PL_StruxDocHandle * prevsdh);
00438 bool getNextStrux(PL_StruxDocHandle sdh, PL_StruxDocHandle *nextSDH);
00439
00440
00441
00442 virtual bool createDataItem(const char * szName, bool bBase64,
00443 const UT_ByteBuf * pByteBuf,
00444 const std::string & mime_type,
00445 void ** ppHandle);
00446 virtual bool replaceDataItem(const char * szName, const UT_ByteBuf * pByteBuf);
00447 virtual bool getDataItemDataByName(const char * szName,
00448 const UT_ByteBuf ** ppByteBuf,
00449 std::string* pMimeType,
00450 void ** ppHandle) const;
00451 bool setDataItemToken(void* pHandle, void* pToken);
00452 bool getDataItemData(void * pHandle,
00453 const char ** pszName, const UT_ByteBuf ** ppByteBuf, const void** ppToken) const;
00454 bool getDataItemFileExtension(const char *szDataID, std::string &sExt, bool bDot = true) const;
00455 bool enumDataItems(UT_uint32 k,
00456 void ** ppHandle, const char ** pszName, const UT_ByteBuf ** ppByteBuf, std::string * pMimeType) const;
00457
00458 PL_StruxDocHandle findHdrFtrStrux(const gchar * pszHdtFtr,
00459 const gchar * pszHdrFtrID);
00460 bool verifySectionID(const gchar * pszId);
00461 PL_StruxDocHandle getLastSectionSDH(void);
00462 PL_StruxDocHandle getLastStruxOfType(PTStruxType pts);
00463
00464 bool changeStruxAttsNoUpdate(PL_StruxDocHandle sdh, const char * attr, const char * attvalue);
00465 bool deleteStruxNoUpdate(PL_StruxDocHandle sdh);
00466 bool deleteFragNoUpdate(pf_Frag * pf);
00467 bool insertStruxNoUpdateBefore(PL_StruxDocHandle sdh, PTStruxType pts,const gchar ** attributes );
00468 bool isStruxBeforeThis(PL_StruxDocHandle sdh, PTStruxType pts);
00469
00470
00471
00472
00473 PT_AttrPropIndex getAPIFromSDH(PL_StruxDocHandle sdh);
00474 bool getAttributeFromSDH(PL_StruxDocHandle sdh, bool bShowRevisions, UT_uint32 iRevisionLevel,
00475 const char * szAttribute, const char ** pszValue);
00476
00477 bool getPropertyFromSDH(PL_StruxDocHandle sdh, bool bShowRevisions, UT_uint32 iRevisionLevel,
00478 const char * szProperty, const char ** pszValue);
00479
00480 void getAllUsedStyles(UT_GenericVector<PD_Style*> * pVecStyles);
00481 PL_StruxFmtHandle getNthFmtHandle(PL_StruxDocHandle sdh, UT_uint32 n);
00482 bool getStyle(const char * szName, PD_Style ** ppStyle) const;
00483 PD_Style * getStyleFromSDH(PL_StruxDocHandle sdh);
00484 PL_StruxDocHandle getPrevNumberedHeadingStyle(PL_StruxDocHandle sdh);
00485 size_t getStyleCount(void);
00486 bool enumStyles(UT_uint32 k,
00487 const char ** pszName, const PD_Style ** ppStyle) const;
00488 bool enumStyles(UT_GenericVector<PD_Style*> * & pStyles) const;
00489
00490 bool addStyleProperty(const gchar * szStyleName, const gchar * szPropertyName, const gchar * szPropertyValue);
00491 bool addStyleProperties(const gchar * szStyleName, const gchar ** pProperties);
00492 bool setAllStyleAttributes(const gchar * szStyleName, const gchar ** pAttribs);
00493 bool addStyleAttributes(const gchar * szStyleName, const gchar ** pAttribs);
00494
00495 PL_StruxDocHandle findPreviousStyleStrux(const gchar * szStyle, PT_DocPosition pos);
00496 PL_StruxDocHandle findForwardStyleStrux(const gchar * szStyle, PT_DocPosition pos);
00497 bool updateDocForStyleChange(const gchar * szStyleName,
00498 bool isParaStyle);
00499 void updateAllLayoutsInDoc( PL_StruxDocHandle sdh);
00500 void clearIfAtFmtMark(PT_DocPosition dpos);
00501
00502 virtual UT_uint32 getLastSavedAsType() const { return m_lastSavedAsType; }
00503 UT_uint32 getLastOpenedType() const { return m_lastOpenedType; }
00504 bool updateFields(void);
00505 bool getField(PL_StruxDocHandle sdh,
00506 UT_uint32 offset,
00507 fd_Field * &pField);
00508 po_Bookmark * getBookmark(PL_StruxDocHandle sdh, UT_uint32 offset);
00509 pf_Frag * findBookmark(const char * pName, bool bEnd = false, pf_Frag * pfStart = NULL);
00510 bool hasMath(void);
00511
00512 void setDontChangeInsPoint(void);
00513 void allowChangeInsPoint(void);
00514 bool getAllowChangeInsPoint(void) const;
00515
00516 bool isFootnoteAtPos(PT_DocPosition pos);
00517 bool isEndFootnoteAtPos(PT_DocPosition pos);
00518 UT_sint32 getEmbeddedOffset(PL_StruxDocHandle sdh,PT_DocPosition posOff, PL_StruxDocHandle & sdhEmbedded);
00519
00520
00521 bool isTOCAtPos(PT_DocPosition pos);
00522
00523
00524 bool isFrameAtPos(PT_DocPosition pos);
00525 bool isEndFrameAtPos(PT_DocPosition pos);
00526 bool isHdrFtrAtPos(PT_DocPosition pos);
00527 bool isSectionAtPos(PT_DocPosition pos);
00528 bool isBlockAtPos(PT_DocPosition pos);
00529
00530
00531
00532 bool isTableAtPos(PT_DocPosition pos);
00533 bool isEndTableAtPos(PT_DocPosition pos);
00534 bool isCellAtPos(PT_DocPosition pos);
00535 PL_StruxDocHandle getEndTableStruxFromTableSDH(PL_StruxDocHandle tableSDH);
00536 PL_StruxDocHandle getEndCellStruxFromCellSDH(PL_StruxDocHandle cellSDH);
00537 PL_StruxDocHandle getEndTableStruxFromTablePos(PT_DocPosition posTable);
00538 bool getRowsColsFromTableSDH(PL_StruxDocHandle tableSDH,
00539 bool bShowRevisions, UT_uint32 iRevisionLevel,
00540 UT_sint32 * numRows, UT_sint32 * numCols);
00541 PL_StruxDocHandle getCellSDHFromRowCol(PL_StruxDocHandle tableSDH,
00542 bool bShowRevisions, UT_uint32 iRevisionLevel,
00543 UT_sint32 row,
00544 UT_sint32 col);
00545 void miniDump(PL_StruxDocHandle sdh, UT_sint32 nstruxes);
00546
00547 bool isInsertHyperLinkValid(PT_DocPosition pos) const;
00548
00549
00550
00551 fl_AutoNum * getListByID(UT_uint32 id) const;
00552 fl_AutoNum * getNthList(UT_uint32 i) const;
00553 bool enumLists(UT_uint32 k, fl_AutoNum ** pAutoNum);
00554 UT_uint32 getListsCount(void) const;
00555 void addList(fl_AutoNum * pAutoNum);
00556 bool appendList(const gchar ** attributes);
00557 bool fixListHierarchy(void);
00558 void removeList(fl_AutoNum * pAutoNum,PL_StruxDocHandle sdh );
00559 void listUpdate(PL_StruxDocHandle sdh);
00560 void StopList(PL_StruxDocHandle sdh);
00561 void disableListUpdates(void);
00562 void enableListUpdates(void);
00563 void updateDirtyLists(void);
00564 bool areListUpdatesAllowed(void);
00565 void setHasListStopped(bool bStop) {m_bHasListStopped = bStop;}
00566 bool hasListStopped(void) const {return m_bHasListStopped;}
00567
00568 void setDoingPaste(void);
00569 void clearDoingPaste(void);
00570 bool isDoingPaste(void);
00571
00572 void setRedrawHappenning(bool bIsHappening) {m_bRedrawHappenning = bIsHappening;}
00573 bool isRedrawHappenning(void) const {return m_bRedrawHappenning;}
00574
00575
00576 bool convertPercentToInches(const char * szPercent, UT_UTF8String & sInches);
00577 bool setPageSizeFromFile(const gchar ** attributes);
00578 const fp_PageSize * getPageSize(void) const
00579 { return & m_docPageSize;}
00580 fp_PageSize m_docPageSize;
00581 bool isBookmarkUnique(const gchar * pName) const;
00582 bool isBookmarkRelativeLink(const gchar * pName) const;
00583 UT_sint32 getBookmarkCount()const {return m_vBookmarkNames.getItemCount();}
00584 const gchar * getNthBookmark(UT_sint32 n)const{return reinterpret_cast<const gchar *>(m_vBookmarkNames.getNthItem(n));}
00585 void addBookmark(const gchar * pName);
00586 void removeBookmark(const gchar * pName);
00587
00589
00590
00591 virtual void setMarkRevisions(bool bMark);
00592
00593 void setMarkRevisionsNoNotify(bool bMark) {AD_Document::setMarkRevisions(bMark);}
00594
00595 virtual bool acceptRejectRevision(bool bReject,
00596 UT_uint32 iStart,
00597 UT_uint32 iEnd,
00598 UT_uint32 iLevel);
00599
00600 virtual bool rejectAllHigherRevisions(UT_uint32 iLevel);
00601 virtual bool acceptAllRevisions();
00602
00603 const PP_AttrProp * explodeRevisions(PP_RevisionAttr *& pRevisions, const PP_AttrProp * pAP,
00604 bool bShow, UT_uint32 iId, bool &bHiddenRevision) const;
00605
00606 virtual void purgeRevisionTable(bool bUnconditional = false);
00607
00608 void notifyPieceTableChangeStart(void);
00609 void notifyPieceTableChangeEnd(void);
00610
00611
00612
00613 pt_PieceTable * getPieceTable(void) const
00614 { return m_pPieceTable; }
00615 #ifdef PT_TEST
00616 void __dump(FILE * fp) const;
00618 static PD_Document* m_pDoc;
00619 #endif
00620
00621
00622
00623 inline bool areStylesLocked () const { return m_bLockedStyles; }
00624 void lockStyles(bool b);
00625
00626 virtual void setMetaDataProp (const UT_String & key, const UT_UTF8String & value);
00627 virtual bool getMetaDataProp (const UT_String & key, UT_UTF8String & outProp) const;
00628
00629
00630 virtual void setAnnotationProp (const UT_String & key, const UT_UTF8String & value);
00631 virtual bool getAnnotationProp (const UT_String & key, UT_UTF8String & outProp) const;
00632
00633 UT_GenericStringMap<UT_UTF8String*> & getMetaData () { return m_metaDataMap ; }
00634
00635
00636 const PP_AttrProp * getAttrProp() const;
00637 PT_AttrPropIndex getAttrPropIndex() const {return m_indexAP;}
00638 bool setAttrProp(const gchar ** ppAttr);
00639 bool setAttributes(const gchar ** ppAttr);
00640 bool setProperties(const gchar ** ppProps);
00641 void setDontImmediatelyLayout(bool b)
00642 { m_bDontImmediatelyLayout = b;}
00643 bool isDontImmediateLayout(void) const
00644 { return m_bDontImmediatelyLayout;}
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656 UT_UTF8String getMailMergeField(const UT_String & key) const;
00657 bool mailMergeFieldExists(const UT_String & key) const;
00658 void setMailMergeField(const UT_String & key, const UT_UTF8String & value);
00659
00660 void clearMailMergeMap();
00661
00662 void setMailMergeLink (const char * file) {
00663 m_mailMergeLink = file;
00664 }
00665
00666 const UT_UTF8String & getMailMergeLink() const { return m_mailMergeLink; }
00667 const UT_GenericStringMap<UT_UTF8String *> & getMailMergeMap() const { return m_mailMergeMap; }
00668
00669 void invalidateCache(void);
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697 UT_uint32 getUID(UT_UniqueId::idType t) {return m_UID.getUID(t);}
00698 bool setMinUID(UT_UniqueId::idType t, UT_uint32 i) {return m_UID.setMinId(t,i);}
00699 bool isIdUnique(UT_UniqueId::idType t, UT_uint32 i) const {return m_UID.isIdUnique(t,i);}
00700
00701 virtual bool areDocumentContentsEqual(const AD_Document &d, UT_uint32 &pos) const;
00702 virtual bool areDocumentFormatsEqual(const AD_Document &d, UT_uint32 &pos) const;
00703 virtual bool areDocumentStylesheetsEqual(const AD_Document &d) const;
00704
00705 bool findFirstDifferenceInContent(PT_DocPosition &pos, UT_sint32 &iOffset2,
00706 const PD_Document &d) const;
00707
00708 bool findWhereSimilarityResumes(PT_DocPosition &pos, UT_sint32 &iOffset2,
00709 UT_uint32 & iKnownLength,
00710 const PD_Document &d) const;
00711
00712 virtual void setAutoRevisioning(bool autorev);
00713
00714 virtual UT_uint32 getXID();
00715 virtual UT_uint32 getTopXID() const;
00716 void fixMissingXIDs();
00717 UT_uint32 getFragXIDforVersion(const pf_Frag * pf, UT_uint32 iVersion) const;
00718 void removeConnections(void);
00719 void changeConnectedDocument(PD_Document * pDoc);
00720 UT_sint32 getNewHdrHeight(void) const
00721 { return m_iNewHdrHeight;}
00722 UT_sint32 getNewFtrHeight(void) const
00723 { return m_iNewFtrHeight;}
00724
00725 void setNewHdrHeight(UT_sint32 newHeight)
00726 { m_iNewHdrHeight = newHeight;}
00727 void setNewFtrHeight(UT_sint32 newHeight)
00728 { m_iNewFtrHeight = newHeight;}
00729
00730 bool purgeFmtMarks();
00731
00732 void tellPTDoNotTweakPosition(bool b);
00733
00734 void setVDNDinProgress(bool b) {m_bVDND = b;}
00735 bool isVDNDinProgress() const {return m_bVDND;}
00736 UT_sint32 getCRNumber() const { return m_iCRCounter; }
00737 void setCRNumber(UT_sint32 iCRCounter) { m_iCRCounter = iCRCounter; }
00738 UT_sint32 getNextCRNumber(void);
00739 void getAllViews(UT_GenericVector<AV_View *> * vecViews) const;
00740 void ignoreSignals(void)
00741 { m_bIgnoreSignals = true;}
00742 void dontIgnoreSignals(void)
00743 { m_bIgnoreSignals = false;}
00744 void setClean(void)
00745 { _setClean();}
00746
00747 void setCoalescingMask(bool mask)
00748 { m_bCoalescingMask = mask; }
00749 bool isCoalescingMasked() const
00750 { return m_bCoalescingMask; }
00751 protected:
00752 virtual ~PD_Document();
00753
00754 virtual UT_Error _saveAs(const char * szFilename, int ieft, const char * expProps = NULL);
00755 virtual UT_Error _saveAs(const char * szFilename, int ieft, bool cpy, const char * expProps = NULL);
00756 virtual UT_Error _saveAs(GsfOutput *output, int ieft, bool cpy, const char * expProps);
00757 virtual UT_Error _save(void);
00758
00759
00760 void _setClean(void);
00761 void _destroyDataItemData(void);
00762 bool _syncFileTypes(bool bReadSaveWriteOpen);
00763
00764 bool _acceptRejectRevision(bool bReject, UT_uint32 iStart, UT_uint32 iEnd,
00765 const PP_Revision * pRev,
00766 PP_RevisionAttr &RevAttr, pf_Frag * pf,
00767 bool & bDeleted);
00768
00769 virtual void _clearUndo();
00770
00771 UT_Error _importFile(const char * szFilename, int ieft,
00772 bool markClean, bool bImportStylesFirst,
00773 bool isImportFile, const char* impProps);
00774 UT_Error _importFile(GsfInput * input, int ieft,
00775 bool markClean, bool bImportStylesFirst,
00776 bool bIsImportFile, const char* impProps);
00777
00778 bool _removeRepeatedHdrFtr(pf_Frag_Strux * pfs ,UT_GenericVector<pf_Frag_Strux *> * vecHdrFtrs, UT_sint32 i);
00779 bool _pruneSectionAPI(pf_Frag_Strux * pfs,const char * szHType, UT_GenericVector<pf_Frag_Strux *> *vecHdrFtrs);
00780 bool _matchSection(pf_Frag_Strux * pfs, UT_GenericVector<pf_Frag_Strux *> *vecSections);
00781 bool _removeHdrFtr(pf_Frag_Strux * pfs);
00782 bool _checkAndFixTable(pf_Frag_Strux * pfs);
00783 public:
00784
00785
00786
00787
00788 bool exportGetVisDirectionAtPos(PT_DocPosition pos, UT_BidiCharType &type);
00789 private:
00790 bool _exportInitVisDirection(PT_DocPosition pos);
00791 bool _exportFindVisDirectionRunAtPos(PT_DocPosition pos);
00792
00793 private:
00794 bool m_ballowListUpdates;
00795 pt_PieceTable * m_pPieceTable;
00796 UT_GenericVector<PL_Listener *> m_vecListeners;
00797 UT_GenericVector<fl_AutoNum *> m_vecLists;
00798 bool m_bHasListStopped;
00799
00800 UT_GenericStringMap<struct _dataItemPair*> m_hashDataItems;
00801 public:
00802 IE_FileInfo m_fileImpExpInfo;
00803 private:
00804 IEFileType m_lastOpenedType;
00805 IEFileType m_lastSavedAsType;
00806 bool m_bDoingPaste;
00807 bool m_bAllowInsertPointChange;
00808 bool m_bRedrawHappenning;
00809 bool m_bLoading;
00810 UT_Vector m_vBookmarkNames;
00811 bool m_bLockedStyles;
00812 UT_GenericStringMap<UT_UTF8String*> m_metaDataMap;
00813 PT_AttrPropIndex m_indexAP;
00814 bool m_bDontImmediatelyLayout;
00815
00816
00817 UT_GenericStringMap<UT_UTF8String*> m_mailMergeMap;
00818
00819 UT_UCS4Char m_iLastDirMarker;
00820
00821 UT_UTF8String m_mailMergeLink;
00822
00823
00824 const fl_BlockLayout * m_pVDBl;
00825 fp_Run * m_pVDRun;
00826 PT_DocPosition m_iVDLastPos;
00827 UT_UniqueId m_UID;
00828 UT_sint32 m_iNewHdrHeight;
00829 UT_sint32 m_iNewFtrHeight;
00830 bool m_bMarginChangeOnly;
00831 UT_GenericVector<pf_Frag *> m_vecSuspectFrags;
00832
00833 bool m_bVDND;
00834 UT_sint32 m_iCRCounter;
00835 mutable UT_sint32 m_iUpdateCount;
00836 bool m_bIgnoreSignals;
00837
00838 bool m_bCoalescingMask;
00839 bool m_bShowAuthors;
00840 UT_GenericVector<pp_Author *> m_vecAuthors;
00841 bool m_bExportAuthorAtts;
00842 UT_sint32 m_iMyAuthorInt;
00843 UT_sint32 m_iLastAuthorInt;
00844 UT_GenericVector<ImagePage *> m_pPendingImagePage;
00845 UT_GenericVector<TextboxPage *> m_pPendingTextboxPage;
00846 };
00847
00848 #endif