diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-16 23:31:46 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-16 23:50:19 -0400 |
commit | c998665f8a5d7b46772fbd10b6cbd03384295c7f (patch) | |
tree | 6e8f960df0a6b700ccd24feb8d7efb930cfc0bf1 /editeng | |
parent | 1ab81c180bdda46434fe470f31450c676265aefd (diff) |
Same with EditUndoDelContent.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/editeng.hxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 25 | ||||
-rw-r--r-- | editeng/source/editeng/editundo.cxx | 49 | ||||
-rw-r--r-- | editeng/source/editeng/editundo.hxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 1 |
5 files changed, 64 insertions, 31 deletions
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index 215f63f1122c..c7357dfcdeb1 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -110,6 +110,7 @@ class EditDoc; struct PasteOrDropInfos; class Range; struct EPaM; +class DeletedNodeInfo; ////////////////////////////////////////////////////////////////////////////// @@ -549,6 +550,15 @@ public: String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const; sal_uInt16 GetScriptType(const EditSelection& rSel) const; + + void RemoveParaPortion(size_t nNode); + + bool IsCallParaInsertedOrDeleted() const; + + void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo); + void UpdateSelections(); + + void InsertContent(ContentNode* pNode, sal_uInt16 nPos); }; #endif // _MyEDITENG_HXX diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 1fae33188fa1..93f5decb5545 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -742,6 +742,31 @@ sal_uInt16 EditEngine::GetScriptType(const EditSelection& rSel) const return pImpEditEngine->GetScriptType(rSel); } +void EditEngine::RemoveParaPortion(size_t nNode) +{ + pImpEditEngine->GetParaPortions().Remove(nNode); +} + +bool EditEngine::IsCallParaInsertedOrDeleted() const +{ + return pImpEditEngine->IsCallParaInsertedOrDeleted(); +} + +void EditEngine::AppendDeletedNodeInfo(DeletedNodeInfo* pInfo) +{ + pImpEditEngine->aDeletedNodes.push_back(pInfo); +} + +void EditEngine::UpdateSelections() +{ + pImpEditEngine->UpdateSelections(); +} + +void EditEngine::InsertContent(ContentNode* pNode, sal_uInt16 nPos) +{ + pImpEditEngine->InsertContent(pNode, nPos); +} + uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const EditSelection& rSelection) { return pImpEditEngine->CreateTransferable(rSelection); diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index e2b9d81cc659..fb7cd5771311 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -183,13 +183,12 @@ XubString EditUndo::GetComment() const return aComment; } -EditUndoDelContent::EditUndoDelContent( ImpEditEngine* _pImpEE, ContentNode* pNode, sal_uInt16 n ) - : EditUndo( EDITUNDO_DELCONTENT, _pImpEE ) -{ - pContentNode = pNode; - nNode = n; - bDelObject = sal_True; -} +EditUndoDelContent::EditUndoDelContent( + ImpEditEngine* _pImpEE, ContentNode* pNode, size_t nPortion) : + EditUndo(EDITUNDO_DELCONTENT, _pImpEE), + bDelObject(true), + nNode(nPortion), + pContentNode(pNode) {} EditUndoDelContent::~EditUndoDelContent() { @@ -199,44 +198,44 @@ EditUndoDelContent::~EditUndoDelContent() void EditUndoDelContent::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); - GetImpEditEngine()->InsertContent( pContentNode, nNode ); - bDelObject = sal_False; // belongs to the Engine again + DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); + GetEditEngine()->InsertContent( pContentNode, nNode ); + bDelObject = false; // belongs to the Engine again EditSelection aSel( EditPaM( pContentNode, 0 ), EditPaM( pContentNode, pContentNode->Len() ) ); - GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); + GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); } void EditUndoDelContent::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); + DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); - ImpEditEngine* _pImpEE = GetImpEditEngine(); + EditEngine* pEE = GetEditEngine(); // pNode is no longer correct, if the paragraphs where merged // in between Undos - pContentNode = _pImpEE->GetEditDoc().GetObject( nNode ); + pContentNode = pEE->GetEditDoc().GetObject( nNode ); DBG_ASSERT( pContentNode, "EditUndoDelContent::Redo(): Node?!" ); - _pImpEE->GetParaPortions().Remove( nNode ); + pEE->RemoveParaPortion(nNode); // Do not delete node, depends on the undo! - _pImpEE->GetEditDoc().Remove( nNode ); - if( _pImpEE->IsCallParaInsertedOrDeleted() ) - _pImpEE->GetEditEnginePtr()->ParagraphDeleted( nNode ); + pEE->GetEditDoc().Remove( nNode ); + if (pEE->IsCallParaInsertedOrDeleted()) + pEE->ParagraphDeleted( nNode ); DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pContentNode, nNode ); - _pImpEE->aDeletedNodes.push_back(pInf); - _pImpEE->UpdateSelections(); + pEE->AppendDeletedNodeInfo(pInf); + pEE->UpdateSelections(); - ContentNode* pN = ( nNode < _pImpEE->GetEditDoc().Count() ) - ? _pImpEE->GetEditDoc().GetObject( nNode ) - : _pImpEE->GetEditDoc().GetObject( nNode-1 ); + ContentNode* pN = ( nNode < pEE->GetEditDoc().Count() ) + ? pEE->GetEditDoc().GetObject( nNode ) + : pEE->GetEditDoc().GetObject( nNode-1 ); DBG_ASSERT( pN && ( pN != pContentNode ), "?! RemoveContent !? " ); EditPaM aPaM( pN, pN->Len() ); - bDelObject = sal_True; // belongs to the Engine again + bDelObject = true; // belongs to the Engine again - _pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + pEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } EditUndoConnectParas::EditUndoConnectParas( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP, diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx index bfb141ce55b0..67a1b2558bce 100644 --- a/editeng/source/editeng/editundo.hxx +++ b/editeng/source/editeng/editundo.hxx @@ -48,15 +48,15 @@ class EditView; class EditUndoDelContent : public EditUndo { private: - sal_Bool bDelObject; - sal_uInt16 nNode; + bool bDelObject; + size_t nNode; ContentNode* pContentNode; // Points to the valid, // undestroyed object! public: - TYPEINFO(); - EditUndoDelContent( ImpEditEngine* pImpEE, ContentNode* pNode, sal_uInt16 nPortio ); - ~EditUndoDelContent(); + TYPEINFO(); + EditUndoDelContent(ImpEditEngine* pImpEE, ContentNode* pNode, size_t nPortion); + virtual ~EditUndoDelContent(); virtual void Undo(); virtual void Redo(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 9f8fb4649f27..6e31d6c07e63 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -382,7 +382,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable { // The Undos have to manipulate directly ( private-Methods ), // do that no new Undo is inserted! - friend class EditUndoDelContent; friend class EditUndoConnectParas; friend class EditUndoSplitPara; friend class EditUndoInsertFeature; |