Public Member Functions | Protected Member Functions | Private Attributes

AD_Document Class Reference

#include <xad_Document.h>

Inheritance diagram for AD_Document:
PD_Document

List of all members.

Public Member Functions

 AD_Document ()
void ref (void)
void unref (void)
virtual AD_DOCUMENT_TYPE getType () const =0
XAP_ResourceManagerresourceManager () const
const char * getFilename (void) const
const std::string & getPrintFilename (void) const
void setPrintFilename (const std::string &sFile)
void clearFilename (void)
virtual UT_Error readFromFile (const char *szFilename, int ieft, const char *props=NULL)=0
virtual UT_Error importFile (const char *szFilename, int ieft, bool markClean=false, bool bImportStylesFirst=true, const char *props=NULL)=0
virtual UT_Error newDocument ()=0
virtual bool isDirty (void) const =0
virtual void forceDirty ()
bool isForcedDirty () const
virtual bool canDo (bool bUndo) const =0
virtual bool undoCmd (UT_uint32 repeatCount)=0
virtual bool redoCmd (UT_uint32 repeatCount)=0
UT_Error saveAs (const char *szFilename, int ieft, const char *props=NULL)
UT_Error saveAs (const char *szFilename, int ieft, bool cpy, const char *props=NULL)
UT_Error save (void)
virtual bool createDataItem (const char *szName, bool bBase64, const UT_ByteBuf *pByteBuf, const std::string &mime_type, PD_DataItemHandle *ppHandle)=0
virtual bool replaceDataItem (const char *szName, const UT_ByteBuf *pByteBuf)=0
virtual bool getDataItemDataByName (const char *szName, const UT_ByteBuf **ppByteBuf, std::string *mime_type, PD_DataItemHandle *ppHandle) const =0
time_t getTimeSinceSave () const
 Returns the # of seconds since the last save of this file.
time_t getLastSavedTime () const
void setLastSavedTime (time_t t)
virtual UT_uint32 getLastSavedAsType () const =0
time_t getTimeSinceOpen () const
time_t getLastOpenedTime () const
void setLastOpenedTime (time_t t)
time_t getEditTime () const
void setEditTime (UT_uint32 t)
void setDocVersion (UT_uint32 i)
UT_uint32 getDocVersion () const
void setEncodingName (const char *szEncodingName)
const char * getEncodingName () const
bool isPieceTableChanging (void) const
virtual void setMetaDataProp (const std::string &key, const std::string &value)=0
virtual bool getMetaDataProp (const std::string &key, std::string &outProp) const =0
virtual void setAnnotationProp (const std::string &key, const std::string &value)=0
virtual bool getAnnotationProp (const std::string &key, std::string &outProp) const =0
void addRecordToHistory (const AD_VersionData &v)
void purgeHistory ()
UT_sint32 getHistoryCount () const
UT_uint32 getHistoryNthId (UT_sint32 i) const
time_t getHistoryNthTime (UT_sint32 i) const
time_t getHistoryNthTimeStarted (UT_sint32 i) const
time_t getHistoryNthEditTime (UT_sint32 i) const
const UT_UUIDgetHistoryNthUID (UT_sint32 i) const
bool getHistoryNthAutoRevisioned (UT_sint32 i) const
UT_uint32 getHistoryNthTopXID (UT_sint32 i) const
AD_HISTORY_STATE verifyHistoryState (UT_uint32 &iVersion) const
const AD_VersionDatafindHistoryRecord (UT_uint32 iVersion) const
bool showHistory (AV_View *pView)
bool areDocumentsRelated (const AD_Document &d) const
bool areDocumentHistoriesEqual (const AD_Document &d, UT_uint32 &iVer) const
virtual bool areDocumentContentsEqual (const AD_Document &d, UT_uint32 &pos) const =0
virtual bool areDocumentFormatsEqual (const AD_Document &d, UT_uint32 &pos) const =0
virtual bool areDocumentStylesheetsEqual (const AD_Document &d) const =0
void setDocUUID (const char *u)
const char * getDocUUIDString () const
const UT_UUIDgetDocUUID () const
void setOrigUUID (const char *u)
const char * getOrigDocUUIDString () const
const UT_UUIDgetOrigDocUUID () const
void setMyUUID (const char *u)
UT_UTF8String getMyUUIDString () const
const UT_UUIDgetMyUUID () const
UT_UUIDgetNewUUID () const
UT_uint32 getNewUUID32 () const
UT_uint64 getNewUUID64 () const
bool addRevision (UT_uint32 iId, UT_UCS4Char *pDesc, time_t tStart, UT_uint32 iVersion, bool bGenCR=true)
bool addRevision (UT_uint32 iId, const UT_UCS4Char *pDesc, UT_uint32 iLen, time_t tStart, UT_uint32 iVersion, bool bGenCR=true)
bool addRevision (AD_Revision *pRev, bool bGenCR=true)
virtual bool createAndSendDocPropCR (const gchar **pAtts, const gchar **pProps)=0
const UT_GenericVector
< AD_Revision * > & 
getRevisions ()
UT_uint32 getHighestRevisionId () const
const AD_RevisiongetHighestRevision () const
UT_sint32 getRevisionIndxFromId (UT_uint32 iId) const
bool usingChangeTracking () const
 Should we pay attention to change tracking?
bool isMarkRevisions () const
bool isShowRevisions () const
UT_uint32 getShowRevisionId () const
UT_uint32 getRevisionId () const
UT_uint32 findAutoRevisionId (UT_uint32 iVersion) const
UT_uint32 findNearestAutoRevisionId (UT_uint32 iVersion, bool bLesser=true) const
void toggleMarkRevisions ()
void toggleShowRevisions ()
virtual void setMarkRevisions (bool bMark)
void setShowRevisions (bool bShow)
void setShowRevisionId (UT_uint32 iId)
void setRevisionId (UT_uint32 iId)
bool isAutoRevisioning () const
virtual void setAutoRevisioning (bool autorev)
virtual void purgeRevisionTable (bool bUnconditional=false)=0
virtual bool acceptRejectRevision (bool bReject, UT_uint32 iStart, UT_uint32 iEnd, UT_uint32 iLevel)=0
virtual bool rejectAllHigherRevisions (UT_uint32 iLevel)=0
virtual bool acceptAllRevisions ()=0
bool purgeAllRevisions (AV_View *pView)
bool isOrigUUID (void) const
void setFilename (char *name)
virtual UT_uint32 getXID () const =0
virtual UT_uint32 getTopXID () const =0

Protected Member Functions

virtual UT_Error _saveAs (const char *szFilename, int ieft, const char *props=NULL)=0
virtual UT_Error _saveAs (const char *szFilename, int ieft, bool cpy, const char *props=NULL)=0
virtual UT_Error _save (void)=0
void _purgeRevisionTable ()
void _adjustHistoryOnSave ()
void _setFilename (char *name)
void _setForceDirty (bool b)
void _setPieceTableChanging (bool b)
void _setMarkRevisions (bool bMark)
bool _restoreVersion (XAP_Frame *pFrame, UT_uint32 iVersion)
virtual void _clearUndo ()=0
virtual ~AD_Document ()

Private Attributes

XAP_ResourceManagerm_pResourceManager
int m_iRefCount
const char * m_szFilename
UT_String m_szEncodingName
bool m_bPieceTableChanging
time_t m_lastSavedTime
time_t m_lastOpenedTime
time_t m_iEditTime
UT_uint32 m_iVersion
bool m_bHistoryWasSaved
UT_Vector m_vHistory
UT_GenericVector< AD_Revision * > m_vRevisions
bool m_bMarkRevisions
bool m_bShowRevisions
UT_uint32 m_iRevisionID
UT_uint32 m_iShowRevisionID
bool m_bAutoRevisioning
bool m_bForcedDirty
UT_UUIDm_pUUID
UT_UUIDm_pOrigUUID
UT_UUIDm_pMyUUID
bool m_bDoNotAdjustHistory
bool m_bAfterFirstSave
UT_UTF8String m_sMyUUIDString
UT_UTF8String m_sOrigUUIDString
std::string m_sPrintFilename

Constructor & Destructor Documentation

AD_Document::~AD_Document (  )  [protected, virtual]

Member Function Documentation

virtual void AD_Document::_clearUndo (  )  [protected, pure virtual]

Implemented in PD_Document.

Referenced by _restoreVersion(), and purgeAllRevisions().

void AD_Document::_purgeRevisionTable (  )  [protected]
virtual UT_Error AD_Document::_save ( void   )  [protected, pure virtual]

Implemented in PD_Document.

Referenced by save().

virtual UT_Error AD_Document::_saveAs ( const char *  szFilename,
int  ieft,
const char *  props = NULL 
) [protected, pure virtual]

Implemented in PD_Document.

Referenced by saveAs().

virtual UT_Error AD_Document::_saveAs ( const char *  szFilename,
int  ieft,
bool  cpy,
const char *  props = NULL 
) [protected, pure virtual]

Implemented in PD_Document.

void AD_Document::_setFilename ( char *  name  )  [inline, protected]

References FREEP.

Referenced by PD_Document::_importFile(), and PD_Document::_saveAs().

void AD_Document::_setForceDirty ( bool  b  )  [inline, protected]
void AD_Document::_setMarkRevisions ( bool  bMark  )  [inline, protected]
void AD_Document::_setPieceTableChanging ( bool  b  )  [inline, protected]
virtual bool AD_Document::acceptAllRevisions (  )  [pure virtual]

Implemented in PD_Document.

Referenced by purgeAllRevisions(), and setAutoRevisioning().

virtual bool AD_Document::acceptRejectRevision ( bool  bReject,
UT_uint32  iStart,
UT_uint32  iEnd,
UT_uint32  iLevel 
) [pure virtual]

Implemented in PD_Document.

void AD_Document::addRecordToHistory ( const AD_VersionData vd  ) 

Add given version data to the document history.

References UT_GenericVector< T >::addItem(), m_vHistory, UT_return_if_fail, and v.

Referenced by _adjustHistoryOnSave(), setAutoRevisioning(), and IE_Imp_AbiWord_1::startElement().

bool AD_Document::addRevision ( UT_uint32  iId,
const UT_UCS4Char pDesc,
UT_uint32  iLen,
time_t  tStart,
UT_uint32  iVersion,
bool  bGenCR = true 
)
virtual bool AD_Document::areDocumentContentsEqual ( const AD_Document d,
UT_uint32 pos 
) const [pure virtual]

Implemented in PD_Document.

Referenced by XAP_Dialog_DocComparison::calculate().

virtual bool AD_Document::areDocumentFormatsEqual ( const AD_Document d,
UT_uint32 pos 
) const [pure virtual]

Implemented in PD_Document.

Referenced by XAP_Dialog_DocComparison::calculate().

bool AD_Document::areDocumentHistoriesEqual ( const AD_Document d,
UT_uint32 iVersion 
) const

Returns true if both documents are based on the same root document and all version records have identical UID's on return, the last identical version id is found in iVersion

References getDocUUID(), getHistoryCount(), AD_VersionData::getId(), UT_GenericVector< T >::getNthItem(), m_pUUID, m_vHistory, UT_MAX, and UT_MIN.

Referenced by XAP_Dialog_DocComparison::calculate().

bool AD_Document::areDocumentsRelated ( const AD_Document d  )  const

Returns true if both documents are based on the same root document

References getDocUUID(), and m_pUUID.

Referenced by XAP_Dialog_DocComparison::calculate().

virtual bool AD_Document::areDocumentStylesheetsEqual ( const AD_Document d  )  const [pure virtual]

Implemented in PD_Document.

Referenced by XAP_Dialog_DocComparison::calculate().

virtual bool AD_Document::canDo ( bool  bUndo  )  const [pure virtual]

Implemented in PD_Document.

void AD_Document::clearFilename ( void   )  [inline]
virtual bool AD_Document::createAndSendDocPropCR ( const gchar **  pAtts,
const gchar **  pProps 
) [pure virtual]

Implemented in PD_Document.

Referenced by addRevision().

virtual bool AD_Document::createDataItem ( const char *  szName,
bool  bBase64,
const UT_ByteBuf pByteBuf,
const std::string &  mime_type,
PD_DataItemHandle ppHandle 
) [pure virtual]

Implemented in PD_Document.

UT_uint32 AD_Document::findAutoRevisionId ( UT_uint32  iVersion  )  const

Find revision id that corresponds to given document version

Returns:
: id > 0 on success or 0 on failure

References AD_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), AD_Revision::getVersion(), m_vRevisions, UT_DEBUGMSG, and UT_return_val_if_fail.

Referenced by _restoreVersion().

UT_uint32 AD_Document::findNearestAutoRevisionId ( UT_uint32  iVersion,
bool  bLesser = true 
) const

Finds the nearest autorevision for the given document version

Parameters:
UT_uint32 iVersion: the document version
bool bLesser: indicates whether nearest lesser or nearest greater autorevision is required
Returns:
: id > 0 on success or 0 on failure

References AD_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), AD_Revision::getVersion(), m_vRevisions, UT_DEBUGMSG, and UT_return_val_if_fail.

virtual void AD_Document::forceDirty (  )  [inline, virtual]
virtual bool AD_Document::getAnnotationProp ( const std::string &  key,
std::string &  outProp 
) const [pure virtual]

Implemented in PD_Document.

virtual bool AD_Document::getDataItemDataByName ( const char *  szName,
const UT_ByteBuf **  ppByteBuf,
std::string *  mime_type,
PD_DataItemHandle ppHandle 
) const [pure virtual]

Implemented in PD_Document.

Referenced by GR_EmbedView::getSnapShots().

const UT_UUID* AD_Document::getDocUUID (  )  const [inline]
time_t AD_Document::getEditTime (  )  const [inline]
const char * AD_Document::getEncodingName ( void   )  const
time_t AD_Document::getHistoryNthEditTime ( UT_sint32  i  )  const
UT_uint32 AD_Document::getHistoryNthId ( UT_sint32  i  )  const
time_t AD_Document::getHistoryNthTime ( UT_sint32  i  )  const

Get time stamp for n-th record in version history NB: the time stamp represents the last save time

References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), AD_VersionData::getTime(), m_vHistory, and v.

const UT_UUID & AD_Document::getHistoryNthUID ( UT_sint32  i  )  const
time_t AD_Document::getLastOpenedTime (  )  const [inline]
virtual UT_uint32 AD_Document::getLastSavedAsType (  )  const [pure virtual]

Implemented in PD_Document.

Referenced by _restoreVersion().

time_t AD_Document::getLastSavedTime (  )  const [inline]
virtual bool AD_Document::getMetaDataProp ( const std::string &  key,
std::string &  outProp 
) const [pure virtual]

Implemented in PD_Document.

Referenced by XAP_FrameImpl::_updateTitle().

const UT_UUID* AD_Document::getMyUUID (  )  const [inline]
UT_UTF8String AD_Document::getMyUUIDString (  )  const

Get the UID of the users of this document represented as a string (this function is primarily for exporters)

NOTE: don't make this a static variable, as this value might change over the life of the document

References m_pMyUUID, m_sMyUUIDString, and UT_return_val_if_fail.

Referenced by ABI_Collab_Export::_handleNewPacket(), FV_View::addCaret(), ABI_Collab_Export::change(), FV_View::FV_View(), FV_View::isActive(), and FV_View::updateCarets().

UT_UUID * AD_Document::getNewUUID (  )  const

Creates a new UUID; this uuid has the 'MAC' portion set to the same value as the main doc uuid -- this guarantees that all id's generated this way will be document unique even though withou using MAC in the uuid we cannot absolutely guarantee universal uniqueness.

References UT_UUIDGenerator::createUUID(), XAP_App::getApp(), XAP_App::getUUIDGenerator(), UT_UUID::isValid(), m_pUUID, UT_UUID::resetTime(), UT_ASSERT, and UT_return_val_if_fail.

Referenced by s_RTF_ListenerWriteDoc::_openTag(), FV_View::cmdInsertEmbed(), FV_View::cmdInsertGraphic(), FV_View::cmdInsertGraphicAtStrux(), FV_View::cmdInsertLatexMath(), FV_View::cmdInsertPositionedGraphic(), FV_View::cmdUpdateEmbed(), getNewUUID32(), and getNewUUID64().

const UT_UUID* AD_Document::getOrigDocUUID (  )  const [inline]
const char * AD_Document::getOrigDocUUIDString (  )  const

Get the Original UID of this document represented as a string (this function is primarily for exporters)

References m_pOrigUUID, m_sOrigUUIDString, UT_return_val_if_fail, and UT_UTF8String::utf8_str().

Referenced by ABI_Collab_Import::_handleCollision(), PacketFactory< _PacketType >::create(), ABI_Collab_Import::import(), and ABI_Collab_Export::signal().

const std::string & AD_Document::getPrintFilename ( void   )  const
UT_sint32 AD_Document::getRevisionIndxFromId ( UT_uint32  iId  )  const

find revision with id iId and return its index in revision table

Parameters:
iId -- id of revision we are interested in
Returns:
-- if found index into revision vector if not found < 0

References AD_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), and m_vRevisions.

Referenced by IE_Exp_RTF::_output_revision().

UT_uint32 AD_Document::getShowRevisionId (  )  const [inline]
time_t AD_Document::getTimeSinceOpen (  )  const [inline]

References time.

time_t AD_Document::getTimeSinceSave (  )  const [inline]

Returns the # of seconds since the last save of this file.

References time.

Referenced by XAP_Frame::getTimeSinceSave().

virtual UT_uint32 AD_Document::getTopXID (  )  const [pure virtual]

Implemented in PD_Document.

Referenced by _adjustHistoryOnSave(), and setAutoRevisioning().

virtual AD_DOCUMENT_TYPE AD_Document::getType (  )  const [pure virtual]
virtual UT_uint32 AD_Document::getXID (  )  const [pure virtual]

Implemented in PD_Document.

virtual UT_Error AD_Document::importFile ( const char *  szFilename,
int  ieft,
bool  markClean = false,
bool  bImportStylesFirst = true,
const char *  props = NULL 
) [pure virtual]

Implemented in PD_Document.

Referenced by AP_Frame::_importDocument().

bool AD_Document::isAutoRevisioning (  )  const [inline]
virtual bool AD_Document::isDirty ( void   )  const [pure virtual]
bool AD_Document::isForcedDirty (  )  const [inline]

Referenced by PD_Document::isDirty().

bool AD_Document::isShowRevisions (  )  const [inline]
virtual UT_Error AD_Document::newDocument (  )  [pure virtual]
void AD_Document::purgeHistory (  ) 
virtual void AD_Document::purgeRevisionTable ( bool  bUnconditional = false  )  [pure virtual]

Implemented in PD_Document.

Referenced by purgeAllRevisions().

virtual UT_Error AD_Document::readFromFile ( const char *  szFilename,
int  ieft,
const char *  props = NULL 
) [pure virtual]

Implemented in PD_Document.

Referenced by AP_Frame::_loadDocument().

virtual bool AD_Document::redoCmd ( UT_uint32  repeatCount  )  [pure virtual]

Implemented in PD_Document.

void AD_Document::ref ( void   ) 

References m_iRefCount, and UT_ASSERT.

virtual bool AD_Document::rejectAllHigherRevisions ( UT_uint32  iLevel  )  [pure virtual]

Implemented in PD_Document.

Referenced by _restoreVersion().

virtual bool AD_Document::replaceDataItem ( const char *  szName,
const UT_ByteBuf pByteBuf 
) [pure virtual]

Implemented in PD_Document.

UT_Error AD_Document::save ( void   ) 
UT_Error AD_Document::saveAs ( const char *  szFilename,
int  ieft,
bool  cpy,
const char *  props = NULL 
)

References _saveAs(), m_bAfterFirstSave, and UT_OK.

UT_Error AD_Document::saveAs ( const char *  szFilename,
int  ieft,
const char *  props = NULL 
)
virtual void AD_Document::setAnnotationProp ( const std::string &  key,
const std::string &  value 
) [pure virtual]

Implemented in PD_Document.

void AD_Document::setDocUUID ( const char *  s  ) 

Set UID for the present document

References UT_UUID::isValid(), m_pUUID, UT_UUID::makeUUID(), UT_UUID::setUUID(), and UT_return_if_fail.

Referenced by IE_Imp_AbiWord_1::startElement().

void AD_Document::setDocVersion ( UT_uint32  i  )  [inline]
void AD_Document::setEditTime ( UT_uint32  t  )  [inline]
void AD_Document::setFilename ( char *  name  )  [inline]
void AD_Document::setLastOpenedTime ( time_t  t  )  [inline]
void AD_Document::setLastSavedTime ( time_t  t  )  [inline]
void AD_Document::setMarkRevisions ( bool  bMark  )  [virtual]
virtual void AD_Document::setMetaDataProp ( const std::string &  key,
const std::string &  value 
) [pure virtual]

Implemented in PD_Document.

void AD_Document::setMyUUID ( const char *  s  ) 
void AD_Document::setOrigUUID ( const char *  s  ) 
void AD_Document::setPrintFilename ( const std::string &  sFile  ) 
void AD_Document::setRevisionId ( UT_uint32  iId  ) 
void AD_Document::setShowRevisions ( bool  bShow  ) 
void AD_Document::toggleMarkRevisions (  ) 
void AD_Document::toggleShowRevisions (  ) 
virtual bool AD_Document::undoCmd ( UT_uint32  repeatCount  )  [pure virtual]

Implemented in PD_Document.

void AD_Document::unref ( void   ) 
bool AD_Document::usingChangeTracking (  )  const

Should we pay attention to change tracking?

References getHighestRevisionId(), and isMarkRevisions().

AD_HISTORY_STATE AD_Document::verifyHistoryState ( UT_uint32 iVersion  )  const

Verifies to what extent we are able to restore given version of the document

Returns:
: return value indicates whether full/partial/no restore is possible
Parameters:
UT_uint32 & iVersion: on entry contains the version number user wants to revert to; if return value indicates partial restore iVersion indicates which nearest (greater) version can be restored fully, or 0 if no such version exists

References ADHIST_NO_RESTORE, getHistoryCount(), AD_VersionData::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), AD_VersionData::isAutoRevisioned(), m_vHistory, UT_ASSERT_HARMLESS, UT_SHOULD_NOT_HAPPEN, and v.

Referenced by showHistory().


Member Data Documentation

time_t AD_Document::m_iEditTime [private]

Referenced by _restoreVersion().

int AD_Document::m_iRefCount [private]

Referenced by ref(), unref(), and ~AD_Document().

Referenced by _adjustHistoryOnSave().

time_t AD_Document::m_lastSavedTime [private]

Referenced by _adjustHistoryOnSave().

std::string AD_Document::m_sPrintFilename [private]
const char* AD_Document::m_szFilename [private]

Referenced by getFilename(), and ~AD_Document().


The documentation for this class was generated from the following files: