[Libreoffice-commits] .: 8 commits - editeng/inc editeng/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Apr 16 21:35:46 PDT 2012
editeng/inc/editeng/editeng.hxx | 19 +++
editeng/inc/editeng/editund2.hxx | 12 +-
editeng/source/editeng/editeng.cxx | 75 +++++++++++++--
editeng/source/editeng/editundo.cxx | 174 ++++++++++++++++++------------------
editeng/source/editeng/editundo.hxx | 10 +-
editeng/source/editeng/impedit.hxx | 14 --
6 files changed, 189 insertions(+), 115 deletions(-)
New commits:
commit 620ca8c527fb77334bdb29eb4d00e8102b731bde
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:48:35 2012 -0400
Remove the last undo friend from ImpEditEngine.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index a239b9f..043776b 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -564,6 +564,8 @@ public:
EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward);
EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
+
+ EditSelection MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 4a1fa61..81ad880 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -787,6 +787,11 @@ EditPaM EditEngine::InsertFeature(const EditSelection& rEditSelection, const Sfx
return pImpEditEngine->ImpInsertFeature(rEditSelection, rItem);
}
+EditSelection EditEngine::MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView)
+{
+ return pImpEditEngine->MoveParagraphs(rParagraphs, nNewPos, pCurView);
+}
+
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 9c370d1..067d84f 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -448,7 +448,7 @@ EditUndoMoveParagraphs::~EditUndoMoveParagraphs()
void EditUndoMoveParagraphs::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
Range aTmpRange( nParagraphs );
long nTmpDest = aTmpRange.Min();
@@ -465,15 +465,15 @@ void EditUndoMoveParagraphs::Undo()
else
nTmpDest += aTmpRange.Len();
- EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( aTmpRange, (sal_uInt16)nTmpDest, 0 ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ EditSelection aNewSel = GetEditEngine()->MoveParagraphs(aTmpRange, (sal_uInt16)nTmpDest, 0);
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
void EditUndoMoveParagraphs::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( nParagraphs, nDest, 0 ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditSelection aNewSel = GetEditEngine()->MoveParagraphs(nParagraphs, nDest, 0);
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
EditUndoSetStyleSheet::EditUndoSetStyleSheet( ImpEditEngine* _pImpEE, sal_uInt16 nP,
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 6e0ebb7..6b013bc 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -380,12 +380,8 @@ public:
class ImpEditEngine : public SfxListener, boost::noncopyable
{
- // The Undos have to manipulate directly ( private-Methods ),
- // do that no new Undo is inserted!
- friend class EditUndoMoveParagraphs;
-
- friend class EditEngine; // For access to Imp-Methods
- friend class EditDbg; // Debug Routines
+ friend class EditEngine;
+ friend class EditDbg;
public:
typedef std::vector<EditView*> ViewsType;
commit ba644a0947a91bba7ccb62fe6e1ae85f0ee30041
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:44:29 2012 -0400
EditUndoSplitPara
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 5dfddf7..a239b9f 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -562,6 +562,8 @@ public:
void InsertContent(ContentNode* pNode, sal_uInt16 nPos);
EditPaM SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos);
EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward);
+
+ EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 3d28480..4a1fa61 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -782,6 +782,11 @@ EditPaM EditEngine::ConnectContents(sal_uInt16 nLeftNode, bool bBackward)
return pImpEditEngine->ConnectContents(nLeftNode, bBackward);
}
+EditPaM EditEngine::InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem)
+{
+ return pImpEditEngine->ImpInsertFeature(rEditSelection, rItem);
+}
+
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 fa5c72f..9c370d1 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -412,26 +412,26 @@ EditUndoInsertFeature::~EditUndoInsertFeature()
void EditUndoInsertFeature::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
EditSelection aSel( aPaM, aPaM );
// Attributes are then corrected implicitly by the document ...
aSel.Max().GetIndex()++;
- GetImpEditEngine()->ImpDeleteSelection( aSel );
+ GetEditEngine()->DeleteSelection(aSel);
aSel.Max().GetIndex()--; // For Selection
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
void EditUndoInsertFeature::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
EditSelection aSel( aPaM, aPaM );
- GetImpEditEngine()->ImpInsertFeature( aSel, *pFeature );
+ GetEditEngine()->InsertFeature(aSel, *pFeature);
if ( pFeature->Which() == EE_FEATURE_FIELD )
- GetImpEditEngine()->UpdateFields();
+ GetEditEngine()->UpdateFieldsOnly();
aSel.Max().GetIndex()++;
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
EditUndoMoveParagraphs::EditUndoMoveParagraphs
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 842ba66..6e0ebb7 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 EditUndoInsertFeature;
friend class EditUndoMoveParagraphs;
friend class EditEngine; // For access to Imp-Methods
commit 6199bd3f73019cc109d385db14596e1ca40300bc
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:40:39 2012 -0400
EditUndoSplitPara
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 0aa0a4d..fa5c72f 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -316,16 +316,16 @@ EditUndoSplitPara::~EditUndoSplitPara()
void EditUndoSplitPara::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, sal_False );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->ConnectContents(nNode, false);
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
void EditUndoSplitPara::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->SplitContent(nNode, nSepPos);
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
EditUndoInsertChars::EditUndoInsertChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index b1d8868..842ba66 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 EditUndoSplitPara;
friend class EditUndoInsertFeature;
friend class EditUndoMoveParagraphs;
commit a5927d2166a5095b3edbd1886a6e00bb3f863915
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:38:43 2012 -0400
Same with EditUndoConnectParas.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index c7357df..5dfddf7 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -553,12 +553,15 @@ public:
void RemoveParaPortion(size_t nNode);
+ void SetCallParaInsertedOrDeleted(bool b);
bool IsCallParaInsertedOrDeleted() const;
void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo);
void UpdateSelections();
void InsertContent(ContentNode* pNode, sal_uInt16 nPos);
+ EditPaM SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos);
+ EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 93f5dec..3d28480 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -747,6 +747,11 @@ void EditEngine::RemoveParaPortion(size_t nNode)
pImpEditEngine->GetParaPortions().Remove(nNode);
}
+void EditEngine::SetCallParaInsertedOrDeleted(bool b)
+{
+ pImpEditEngine->SetCallParaInsertedOrDeleted(b);
+}
+
bool EditEngine::IsCallParaInsertedOrDeleted() const
{
return pImpEditEngine->IsCallParaInsertedOrDeleted();
@@ -767,6 +772,16 @@ void EditEngine::InsertContent(ContentNode* pNode, sal_uInt16 nPos)
pImpEditEngine->InsertContent(pNode, nPos);
}
+EditPaM EditEngine::SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos)
+{
+ return pImpEditEngine->SplitContent(nNode, nSepPos);
+}
+
+EditPaM EditEngine::ConnectContents(sal_uInt16 nLeftNode, bool bBackward)
+{
+ return pImpEditEngine->ConnectContents(nLeftNode, bBackward);
+}
+
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 fb7cd57..0aa0a4d 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -268,39 +268,39 @@ EditUndoConnectParas::~EditUndoConnectParas()
void EditUndoConnectParas::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
// For SplitContent ParagraphInserted can not be called yet because the
// Outliner relies on the attributes to initialize the depth
- sal_Bool bCall = GetImpEditEngine()->IsCallParaInsertedOrDeleted();
- GetImpEditEngine()->SetCallParaInsertedOrDeleted( sal_False );
+ sal_Bool bCall = GetEditEngine()->IsCallParaInsertedOrDeleted();
+ GetEditEngine()->SetCallParaInsertedOrDeleted(false);
- EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos );
- GetImpEditEngine()->SetParaAttribs( nNode, aLeftParaAttribs );
- GetImpEditEngine()->SetParaAttribs( nNode+1, aRightParaAttribs );
+ EditPaM aPaM = GetEditEngine()->SplitContent(nNode, nSepPos);
+ GetEditEngine()->SetParaAttribs( nNode, aLeftParaAttribs );
+ GetEditEngine()->SetParaAttribs( nNode+1, aRightParaAttribs );
- GetImpEditEngine()->SetCallParaInsertedOrDeleted( bCall );
- if ( GetImpEditEngine()->IsCallParaInsertedOrDeleted() )
- GetImpEditEngine()->GetEditEnginePtr()->ParagraphInserted( nNode+1 );
+ GetEditEngine()->SetCallParaInsertedOrDeleted( bCall );
+ if (GetEditEngine()->IsCallParaInsertedOrDeleted())
+ GetEditEngine()->ParagraphInserted( nNode+1 );
- if ( GetImpEditEngine()->GetStyleSheetPool() )
+ if (GetEditEngine()->GetStyleSheetPool())
{
if ( aLeftStyleName.Len() )
- GetImpEditEngine()->SetStyleSheet( (sal_uInt16)nNode, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aLeftStyleName, eLeftStyleFamily ) );
+ GetEditEngine()->SetStyleSheet( (sal_uInt16)nNode, (SfxStyleSheet*)GetEditEngine()->GetStyleSheetPool()->Find( aLeftStyleName, eLeftStyleFamily ) );
if ( aRightStyleName.Len() )
- GetImpEditEngine()->SetStyleSheet( nNode+1, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aRightStyleName, eRightStyleFamily ) );
+ GetEditEngine()->SetStyleSheet( nNode+1, (SfxStyleSheet*)GetEditEngine()->GetStyleSheetPool()->Find( aRightStyleName, eRightStyleFamily ) );
}
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
void EditUndoConnectParas::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Np Active View!" );
- EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, bBackward );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: Np Active View!" );
+ EditPaM aPaM = GetEditEngine()->ConnectContents( nNode, bBackward );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
EditUndoSplitPara::EditUndoSplitPara( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 6e31d6c..b1d8868 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 EditUndoConnectParas;
friend class EditUndoSplitPara;
friend class EditUndoInsertFeature;
friend class EditUndoMoveParagraphs;
commit c998665f8a5d7b46772fbd10b6cbd03384295c7f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:31:46 2012 -0400
Same with EditUndoDelContent.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 215f63f..c7357df 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 1fae331..93f5dec 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 e2b9d81..fb7cd57 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 bfb141c..67a1b25 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 9f8fb46..6e31d6c 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;
commit 1ab81c180bdda46434fe470f31450c676265aefd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:12:59 2012 -0400
same with EditUndoRemoveChars.
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index c98ea01..e2b9d81 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -381,22 +381,22 @@ EditUndoRemoveChars::EditUndoRemoveChars( ImpEditEngine* _pImpEE, const EPaM& rE
void EditUndoRemoveChars::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
EditSelection aSel( aPaM, aPaM );
- GetImpEditEngine()->ImpInsertText( aSel, aText );
+ GetEditEngine()->InsertText(aSel, aText);
aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len();
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
void EditUndoRemoveChars::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
EditSelection aSel( aPaM, aPaM );
aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len();
- EditPaM aNewPaM = GetImpEditEngine()->ImpDeleteSelection( aSel );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewPaM );
+ EditPaM aNewPaM = GetEditEngine()->DeleteSelection(aSel);
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aNewPaM);
}
EditUndoInsertFeature::EditUndoInsertFeature( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const SfxPoolItem& rFeature)
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index a74fbef..9f8fb46 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 EditUndoRemoveChars;
friend class EditUndoDelContent;
friend class EditUndoConnectParas;
friend class EditUndoSplitPara;
commit c6eceac87b5f904a2ec51b161dd4136bfb8c4e54
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 23:10:13 2012 -0400
EditUndoInsertCharts is no longer a friend of ImpEditEngine.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 8bfe3f4..215f63f 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -109,6 +109,7 @@ class EditSelectionEngine;
class EditDoc;
struct PasteOrDropInfos;
class Range;
+struct EPaM;
//////////////////////////////////////////////////////////////////////////////
@@ -519,6 +520,7 @@ public:
void ParaAttribsToCharAttribs(ContentNode* pNode);
+ EditPaM CreateEditPaM(const EPaM& rEPaM);
EditPaM ConnectParagraphs(
ContentNode* pLeft, ContentNode* pRight, bool bBackward = false);
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index c5e1e5a..1fae331 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -752,6 +752,11 @@ void EditEngine::ParaAttribsToCharAttribs(ContentNode* pNode)
pImpEditEngine->ParaAttribsToCharAttribs(pNode);
}
+EditPaM EditEngine::CreateEditPaM(const EPaM& rEPaM)
+{
+ return pImpEditEngine->CreateEditPaM(rEPaM);
+}
+
EditPaM EditEngine::ConnectParagraphs(
ContentNode* pLeft, ContentNode* pRight, bool bBackward)
{
@@ -2543,7 +2548,7 @@ void EditEngine::ParagraphHeightChanged( sal_uInt16 nPara )
XubString EditEngine::GetUndoComment( sal_uInt16 nId ) const
{
DBG_CHKTHIS( EditEngine, 0 );
- rtl::OUString aComment;
+ XubString aComment;
switch ( nId )
{
case EDITUNDO_REMOVECHARS:
@@ -2552,12 +2557,12 @@ XubString EditEngine::GetUndoComment( sal_uInt16 nId ) const
case EDITUNDO_DELCONTENT:
case EDITUNDO_DELETE:
case EDITUNDO_CUT:
- aComment = EE_RESSTR(RID_EDITUNDO_DEL);
+ aComment = XubString( EditResId( RID_EDITUNDO_DEL ) );
break;
case EDITUNDO_MOVEPARAGRAPHS:
case EDITUNDO_MOVEPARAS:
case EDITUNDO_DRAGANDDROP:
- aComment = EE_RESSTR(RID_EDITUNDO_MOVE);
+ aComment = XubString( EditResId( RID_EDITUNDO_MOVE ) );
break;
case EDITUNDO_INSERTFEATURE:
case EDITUNDO_SPLITPARA:
@@ -2565,29 +2570,29 @@ XubString EditEngine::GetUndoComment( sal_uInt16 nId ) const
case EDITUNDO_PASTE:
case EDITUNDO_INSERT:
case EDITUNDO_READ:
- aComment = EE_RESSTR(RID_EDITUNDO_INSERT);
+ aComment = XubString( EditResId( RID_EDITUNDO_INSERT ) );
break;
case EDITUNDO_SRCHANDREPL:
case EDITUNDO_REPLACEALL:
- aComment = EE_RESSTR(RID_EDITUNDO_REPLACE);
+ aComment = XubString( EditResId( RID_EDITUNDO_REPLACE ) );
break;
case EDITUNDO_ATTRIBS:
case EDITUNDO_PARAATTRIBS:
case EDITUNDO_STRETCH:
- aComment = EE_RESSTR(RID_EDITUNDO_SETATTRIBS);
+ aComment = XubString( EditResId( RID_EDITUNDO_SETATTRIBS ) );
break;
case EDITUNDO_RESETATTRIBS:
- aComment = EE_RESSTR(RID_EDITUNDO_RESETATTRIBS);
+ aComment = XubString( EditResId( RID_EDITUNDO_RESETATTRIBS ) );
break;
case EDITUNDO_STYLESHEET:
- aComment = EE_RESSTR(RID_EDITUNDO_SETSTYLE);
+ aComment = XubString( EditResId( RID_EDITUNDO_SETSTYLE ) );
break;
case EDITUNDO_TRANSLITERATE:
- aComment = EE_RESSTR(RID_EDITUNDO_TRANSLITERATE);
+ aComment = XubString( EditResId( RID_EDITUNDO_TRANSLITERATE ) );
break;
case EDITUNDO_INDENTBLOCK:
case EDITUNDO_UNINDENTBLOCK:
- aComment = EE_RESSTR(RID_EDITUNDO_INDENT);
+ aComment = XubString( EditResId( RID_EDITUNDO_INDENT ) );
break;
}
return aComment;
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index f395729..c98ea01 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -337,22 +337,22 @@ EditUndoInsertChars::EditUndoInsertChars( ImpEditEngine* _pImpEE, const EPaM& rE
void EditUndoInsertChars::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
EditSelection aSel( aPaM, aPaM );
aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len();
- EditPaM aNewPaM( GetImpEditEngine()->ImpDeleteSelection( aSel ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aNewPaM, aNewPaM ) );
+ EditPaM aNewPaM( GetEditEngine()->DeleteSelection(aSel) );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aNewPaM, aNewPaM ) );
}
void EditUndoInsertChars::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- GetImpEditEngine()->ImpInsertText( EditSelection( aPaM, aPaM ), aText );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
+ EditPaM aPaM = GetEditEngine()->CreateEditPaM(aEPaM);
+ GetEditEngine()->InsertText(EditSelection(aPaM, aPaM), aText);
EditPaM aNewPaM( aPaM );
aNewPaM.GetIndex() = aNewPaM.GetIndex() + aText.Len();
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) );
}
sal_Bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 1f77f88..a74fbef 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 EditUndoInsertChars;
friend class EditUndoRemoveChars;
friend class EditUndoDelContent;
friend class EditUndoConnectParas;
commit c5cf5f700f53f5742bb8f3080083454c9623dadc
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 22:51:49 2012 -0400
Have EditUndo also return EditEngine*.
This is the first step toward having the undo classes use EditEngine
instead of ImpEditEngine.
diff --git a/editeng/inc/editeng/editund2.hxx b/editeng/inc/editeng/editund2.hxx
index 554fb32..85ad570 100644
--- a/editeng/inc/editeng/editund2.hxx
+++ b/editeng/inc/editeng/editund2.hxx
@@ -32,6 +32,7 @@
#include "editeng/editengdllapi.h"
#include <svl/undo.hxx>
+class EditEngine;
class ImpEditEngine;
class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager
@@ -55,14 +56,15 @@ class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
{
private:
sal_uInt16 nId;
- ImpEditEngine* pImpEE;
+ ImpEditEngine* mpEditEngine;
public:
- TYPEINFO();
- EditUndo( sal_uInt16 nI, ImpEditEngine* pImpEE );
- virtual ~EditUndo();
+ TYPEINFO();
+ EditUndo(sal_uInt16 nI, ImpEditEngine* pEE);
+ virtual ~EditUndo();
- ImpEditEngine* GetImpEditEngine() const { return pImpEE; }
+ EditEngine* GetEditEngine();
+ ImpEditEngine* GetImpEditEngine();
virtual void Undo() = 0;
virtual void Redo() = 0;
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 81bce92..f395729 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -140,11 +140,10 @@ sal_Bool EditUndoManager::Redo()
return bDone;
}
-EditUndo::EditUndo( sal_uInt16 nI, ImpEditEngine* p )
+EditUndo::EditUndo(sal_uInt16 nI, ImpEditEngine* pEE) :
+ nId(nI), mpEditEngine(pEE)
{
DBG_CTOR( EditUndo, 0 );
- nId = nI;
- pImpEE = p;
}
EditUndo::~EditUndo()
@@ -152,6 +151,16 @@ EditUndo::~EditUndo()
DBG_DTOR( EditUndo, 0 );
}
+EditEngine* EditUndo::GetEditEngine()
+{
+ return mpEditEngine->GetEditEnginePtr();
+}
+
+ImpEditEngine* EditUndo::GetImpEditEngine()
+{
+ return mpEditEngine;
+}
+
sal_uInt16 EditUndo::GetId() const
{
DBG_CHKTHIS( EditUndo, 0 );
@@ -166,9 +175,9 @@ sal_Bool EditUndo::CanRepeat(SfxRepeatTarget&) const
XubString EditUndo::GetComment() const
{
XubString aComment;
- if ( pImpEE )
+ if ( mpEditEngine )
{
- EditEngine* pEditEng = pImpEE->GetEditEnginePtr();
+ EditEngine* pEditEng = mpEditEngine->GetEditEnginePtr();
aComment = pEditEng->GetUndoComment( GetId() );
}
return aComment;
More information about the Libreoffice-commits
mailing list