#include <AbiCollab_Import.h>
Public Member Functions | |
ABI_Collab_Import (AbiCollab *pAbiCollab, PD_Document *doc) | |
~ABI_Collab_Import () | |
bool | import (const SessionPacket &sPacket, BuddyPtr collaborator) |
std::map< BuddyPtr, UT_sint32 > & | getRemoteRevisions () |
PT_DocPosition | getEndOfDoc () |
void | masterInit () |
void | slaveInit (BuddyPtr pBuddy, UT_sint32 iRev) |
Private Member Functions | |
bool | _isOverlapping (UT_sint32 pos1, UT_sint32 length1, UT_sint32 pos2, UT_sint32 length2) |
void | _calculateCollisionSeqence (UT_sint32 iIncomingRemoteRev, const std::string &sIncomingDocUUID, UT_sint32 &iStart, UT_sint32 &iEnd) |
UT_sint32 | _getIncomingAdjustmentForState (const UT_GenericVector< ChangeAdjust * > *pExpAdjusts, UT_sint32 iStart, UT_sint32 iEnd, UT_sint32 iIncomingPos, UT_sint32 iIncomingLength, const std::string &sIncomingUUID, std::deque< int > &impAdjs) |
bool | _checkForCollision (const AbstractChangeRecordSessionPacket &acrsp, UT_sint32 &iRev, UT_sint32 &iImportAdjustment) |
bool | _handleCollision (UT_sint32 iIncommingRev, UT_sint32 iLocalRev, BuddyPtr pCollaborator) |
bool | _shouldIgnore (BuddyPtr pCollaborator) |
void | _disableUpdates (UT_GenericVector< AV_View * > &vecViews, bool bIsGlob) |
void | _enableUpdates (UT_GenericVector< AV_View * > vecViews, bool bIsGlob) |
bool | _import (const SessionPacket &packet, UT_sint32 iImportAdjustment, BuddyPtr pCollaborator, bool inGlob=false) |
Private Attributes | |
PD_Document * | m_pDoc |
AbiCollab * | m_pAbiCollab |
std::map< BuddyPtr, UT_sint32 > | m_remoteRevs |
std::vector< std::pair < BuddyPtr, UT_sint32 > > | m_revertSet |
std::deque< UT_sint32 > | m_iAlreadyRevertedRevs |
Friends | |
class | FakeAccountHandler |
ABI_Collab_Import::ABI_Collab_Import | ( | AbiCollab * | pAbiCollab, | |
PD_Document * | doc | |||
) |
ABI_Collab_Import::~ABI_Collab_Import | ( | ) |
void ABI_Collab_Import::_calculateCollisionSeqence | ( | UT_sint32 | iIncomingRemoteRev, | |
const std::string & | sIncomingDocUUID, | |||
UT_sint32 & | iStart, | |||
UT_sint32 & | iEnd | |||
) | [private] |
References ABI_Collab_Export::getAdjusts(), AbiCollab::getExport(), UT_GenericVector< T >::getItemCount(), ChangeAdjust::getLocalAdjust(), ChangeAdjust::getLocalLength(), ChangeAdjust::getLocalPos(), ChangeAdjust::getLocalRev(), UT_GenericVector< T >::getNthItem(), ChangeAdjust::getRemoteDocUUID(), m_pAbiCollab, UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_return_if_fail, and UT_SHOULD_NOT_HAPPEN.
Referenced by _checkForCollision().
bool ABI_Collab_Import::_checkForCollision | ( | const AbstractChangeRecordSessionPacket & | acrsp, | |
UT_sint32 & | iRev, | |||
UT_sint32 & | iImportAdjustment | |||
) | [private] |
Scan back through the CR's we've emitted since this remote CR was sent and see if any overlap this one. return true if there is a collision.
References _calculateCollisionSeqence(), _getIncomingAdjustmentForState(), _isOverlapping(), ABI_Collab_Export::getAdjusts(), SessionPacket::getDocUUID(), AbiCollab::getExport(), AbstractChangeRecordSessionPacket::getLength(), ChangeAdjust::getLocalAdjust(), ChangeAdjust::getLocalLength(), ChangeAdjust::getLocalPos(), ChangeAdjust::getLocalRev(), UT_GenericVector< T >::getNthItem(), AbstractChangeRecordSessionPacket::getPos(), ChangeAdjust::getRemoteDocUUID(), AbstractChangeRecordSessionPacket::getRemoteRev(), AbiCollab_ImportRuleSet::isOverlapAllowed(), m_pAbiCollab, UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_return_val_if_fail, and UT_SHOULD_NOT_HAPPEN.
Referenced by import().
void ABI_Collab_Import::_disableUpdates | ( | UT_GenericVector< AV_View * > & | vecViews, | |
bool | bIsGlob | |||
) | [private] |
References PD_Document::beginUserAtomicGlob(), PD_Document::disableListUpdates(), PD_Document::getAllViews(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_pDoc, PD_Document::notifyPieceTableChangeStart(), AV_View::setActivityMask(), and PD_Document::setDontImmediatelyLayout().
Referenced by import().
void ABI_Collab_Import::_enableUpdates | ( | UT_GenericVector< AV_View * > | vecViews, | |
bool | bIsGlob | |||
) | [private] |
References PD_Document::enableListUpdates(), PD_Document::endUserAtomicGlob(), FV_View::fixInsertionPointCoords(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_pDoc, PD_Document::notifyPieceTableChangeEnd(), PD_SIGNAL_UPDATE_LAYOUT, AV_View::setActivityMask(), PD_Document::setDontImmediatelyLayout(), FV_View::shouldScreenUpdateOnGeneralUpdate(), PD_Document::signalListeners(), and PD_Document::updateDirtyLists().
Referenced by import().
UT_sint32 ABI_Collab_Import::_getIncomingAdjustmentForState | ( | const UT_GenericVector< ChangeAdjust * > * | pExpAdjusts, | |
UT_sint32 | iStart, | |||
UT_sint32 | iEnd, | |||
UT_sint32 | iIncomingPos, | |||
UT_sint32 | iIncomingLength, | |||
const std::string & | sIncomingUUID, | |||
std::deque< int > & | impAdjs | |||
) | [private] |
bool ABI_Collab_Import::_handleCollision | ( | UT_sint32 | iIncommingRev, | |
UT_sint32 | iLocalRev, | |||
BuddyPtr | pCollaborator | |||
) | [private] |
References UT_GenericVector< T >::deleteNthItem(), ABI_Collab_Export::getAdjusts(), AbiCollab::getExport(), UT_GenericVector< T >::getItemCount(), ChangeAdjust::getLocalAdjust(), ChangeAdjust::getLocalPos(), ChangeAdjust::getLocalRev(), UT_GenericVector< T >::getNthItem(), AD_Document::getOrigDocUUIDString(), ChangeAdjust::getRemoteDocUUID(), AbiCollab::getSessionId(), AbiCollab::isLocallyControlled(), m_iAlreadyRevertedRevs, m_pAbiCollab, m_pDoc, m_revertSet, AbiCollab::push(), AbiCollab::setIsReverting(), ChangeAdjust::setLocalPos(), PD_Document::undoCmd(), UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_return_val_if_fail, and UT_SHOULD_NOT_HAPPEN.
Referenced by import().
bool ABI_Collab_Import::_import | ( | const SessionPacket & | packet, | |
UT_sint32 | iImportAdjustment, | |||
BuddyPtr | pCollaborator, | |||
bool | inGlob = false | |||
) | [private] |
Take a packet, interpret it's contents and apply the implied operations on the document.
References _PCT_FirstChangeRecord, AV_CHG_FMTBLOCK, AV_CHG_FMTCHAR, AV_CHG_FMTSTYLE, AV_CHG_PAGECOUNT, AV_CHG_TYPING, PD_Document::changeDocPropeties(), PD_Document::changeSpanFmt(), PD_Document::changeStruxFmt(), PD_Document::createAndSendCR(), PD_Document::createDataItem(), PD_Document::deleteFmtMark(), PD_Document::deleteSpan(), PD_Document::deleteStrux(), gchar, XAP_App::getApp(), Props_ChangeRecordSessionPacket::getAttribute(), Props_ChangeRecordSessionPacket::getAtts(), XAP_Frame::getCurrentView(), PD_Document::getDocumentRDF(), getEndOfDoc(), XAP_App::getLastFocussedFrame(), ChangeRecordSessionPacket::getLength(), PD_Style::getName(), Object_ChangeRecordSessionPacket::getObjectType(), GlobSessionPacket::getPackets(), ChangeRecordSessionPacket::getPos(), Props_ChangeRecordSessionPacket::getProps(), ChangeRecordSessionPacket::getPXType(), ChangeRecordSessionPacket::getRev(), RevertSessionPacket::getRev(), GlobSessionPacket::getRev(), SignalSessionPacket::getSignalType(), PD_Document::getStruxOfTypeFromPosition(), PD_Document::getStyleFromSDH(), PD_Document::insertObject(), PD_Document::insertSpan(), PD_Document::insertStrux(), UT_UCS4String::length(), Data_ChangeRecordSessionPacket::m_bTokenSet, DeleteStrux_ChangeRecordSessionPacket::m_eStruxType, ChangeStrux_ChangeRecordSessionPacket::m_eStruxType, m_iAlreadyRevertedRevs, m_pDoc, m_remoteRevs, m_revertSet, InsertSpan_ChangeRecordSessionPacket::m_sText, Data_ChangeRecordSessionPacket::m_sToken, Data_ChangeRecordSessionPacket::m_vecData, FV_View::notifyListeners(), PCT_GlobSessionPacket, PCT_RevertAckSessionPacket, PCT_RevertSessionPacket, PCT_SignalSessionPacket, PP_std_copyProps(), PT_DATAITEM_ATTRIBUTE_NAME, PTC_SetExactly, PTX_Block, PX_ChangeRecord::PXT_ChangeDocProp, PX_ChangeRecord::PXT_ChangeDocRDF, PX_ChangeRecord::PXT_ChangeFmtMark, PX_ChangeRecord::PXT_ChangeObject, PX_ChangeRecord::PXT_ChangePoint, PX_ChangeRecord::PXT_ChangeSpan, PX_ChangeRecord::PXT_ChangeStrux, PX_ChangeRecord::PXT_CreateDataItem, PX_ChangeRecord::PXT_DeleteFmtMark, PX_ChangeRecord::PXT_DeleteObject, PX_ChangeRecord::PXT_DeleteSpan, PX_ChangeRecord::PXT_DeleteStrux, PX_ChangeRecord::PXT_GlobMarker, PX_ChangeRecord::PXT_InsertFmtMark, PX_ChangeRecord::PXT_InsertObject, PX_ChangeRecord::PXT_InsertSpan, PX_ChangeRecord::PXT_InsertStrux, PX_ChangeRecord::PXT_ListUpdate, PX_ChangeRecord::PXT_RemoveList, PX_ChangeRecord::PXT_StopList, PX_ChangeRecord::PXT_UpdateField, PX_ChangeRecord::PXT_UpdateLayout, PP_AttrProp::setAttributes(), PP_AttrProp::setProperties(), PD_Document::signalListeners(), szName, UT_UCS4String::ucs4_str(), UT_ASSERT, UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_NOT_IMPLEMENTED, UT_return_val_if_fail, and UT_SHOULD_NOT_HAPPEN.
Referenced by FakeAccountHandler::_import(), and import().
bool ABI_Collab_Import::_isOverlapping | ( | UT_sint32 | pos1, | |
UT_sint32 | length1, | |||
UT_sint32 | pos2, | |||
UT_sint32 | length2 | |||
) | [private] |
Referenced by _checkForCollision(), and _getIncomingAdjustmentForState().
bool ABI_Collab_Import::_shouldIgnore | ( | BuddyPtr | pCollaborator | ) | [private] |
References AbiCollab::isLocallyControlled(), m_pAbiCollab, m_revertSet, UT_DEBUGMSG, and UT_return_val_if_fail.
Referenced by import().
PT_DocPosition ABI_Collab_Import::getEndOfDoc | ( | void | ) |
References PD_Document::getBounds(), and m_pDoc.
Referenced by _import().
References m_remoteRevs.
Referenced by AbiCollab::_fillRemoteRev(), and AbiCollab::_removeCollaborator().
bool ABI_Collab_Import::import | ( | const SessionPacket & | sPacket, | |
BuddyPtr | collaborator | |||
) |
References _checkForCollision(), _disableUpdates(), _enableUpdates(), _handleCollision(), _import(), _shouldIgnore(), SessionPacket::getDocUUID(), AD_Document::getOrigDocUUIDString(), AbstractChangeRecordSessionPacket::getRev(), AbstractChangeRecordSessionPacket::isInstanceOf(), m_pDoc, PCT_RevertAckSessionPacket, PCT_RevertSessionPacket, PCT_SignalSessionPacket, AD_Document::setMyUUID(), SessionPacket::toStr(), UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_NOT_IMPLEMENTED, and UT_return_val_if_fail.
Referenced by AbiCollab::import().
void ABI_Collab_Import::masterInit | ( | ) |
References m_iAlreadyRevertedRevs, m_remoteRevs, and m_revertSet.
Referenced by AbiCollab::_restartAsMaster(), and AbiCollab::AbiCollab().
References m_iAlreadyRevertedRevs, m_remoteRevs, m_revertSet, and UT_return_if_fail.
Referenced by AbiCollab::_restartAsSlave(), and AbiCollab::AbiCollab().
friend class FakeAccountHandler [friend] |
std::deque<UT_sint32> ABI_Collab_Import::m_iAlreadyRevertedRevs [private] |
Referenced by _handleCollision(), _import(), masterInit(), and slaveInit().
AbiCollab* ABI_Collab_Import::m_pAbiCollab [private] |
Referenced by _calculateCollisionSeqence(), _checkForCollision(), _handleCollision(), and _shouldIgnore().
PD_Document* ABI_Collab_Import::m_pDoc [private] |
Referenced by _disableUpdates(), _enableUpdates(), _handleCollision(), _import(), getEndOfDoc(), and import().
std::map<BuddyPtr, UT_sint32> ABI_Collab_Import::m_remoteRevs [private] |
Referenced by _import(), getRemoteRevisions(), masterInit(), and slaveInit().
std::vector<std::pair<BuddyPtr, UT_sint32> > ABI_Collab_Import::m_revertSet [private] |
Referenced by _handleCollision(), _import(), _shouldIgnore(), masterInit(), and slaveInit().