[Libreoffice-commits] .: 2 commits - editeng/inc editeng/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Apr 17 09:49:42 PDT 2012
editeng/inc/editeng/editeng.hxx | 20 ++
editeng/inc/editeng/editund2.hxx | 11 -
editeng/source/editeng/editeng.cxx | 55 ++++++
editeng/source/editeng/editundo.cxx | 295 ++++++++++++++++--------------------
editeng/source/editeng/editundo.hxx | 84 +++++-----
editeng/source/editeng/impedit.hxx | 5
editeng/source/editeng/impedit2.cxx | 22 +-
editeng/source/editeng/impedit4.cxx | 2
editeng/source/editeng/impedit5.cxx | 12 -
9 files changed, 271 insertions(+), 235 deletions(-)
New commits:
commit 56ef4ea05520115dc5db6bf861dca80a20a76775
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 17 12:12:43 2012 -0400
Removed all references to ImpEditEngine from all of edit undo classes.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 523addf..5cbad78 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -132,6 +132,9 @@ class EDITENG_DLLPUBLIC EditEngine
friend class EditDbg;
friend class Outliner;
+public:
+ typedef std::vector<EditView*> ViewsType;
+
private:
ImpEditEngine* pImpEditEngine;
@@ -214,6 +217,7 @@ public:
size_t GetViewCount() const;
sal_Bool HasView( EditView* pView ) const;
EditView* GetActiveView() const;
+ void SetActiveView(EditView* pView);
void SetPaperSize( const Size& rSize );
const Size& GetPaperSize() const;
@@ -572,6 +576,12 @@ public:
void RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0);
+
+ ViewsType& GetEditViews();
+ const ViewsType& GetEditViews() const;
+
+ void SetUndoMode(bool b);
+ void FormatAndUpdate(EditView* pCurView = NULL);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/inc/editeng/editund2.hxx b/editeng/inc/editeng/editund2.hxx
index 85ad570..dc465a9 100644
--- a/editeng/inc/editeng/editund2.hxx
+++ b/editeng/inc/editeng/editund2.hxx
@@ -33,17 +33,15 @@
#include <svl/undo.hxx>
class EditEngine;
-class ImpEditEngine;
class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager
{
using SfxUndoManager::Undo;
using SfxUndoManager::Redo;
-private:
- ImpEditEngine* pImpEE;
+ EditEngine* mpEditEngine;
public:
- EditUndoManager( ImpEditEngine* pImpEE );
+ EditUndoManager(EditEngine* pEE);
virtual sal_Bool Undo();
virtual sal_Bool Redo();
@@ -56,15 +54,14 @@ class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
{
private:
sal_uInt16 nId;
- ImpEditEngine* mpEditEngine;
+ EditEngine* mpEditEngine;
public:
TYPEINFO();
- EditUndo(sal_uInt16 nI, ImpEditEngine* pEE);
+ EditUndo(sal_uInt16 nI, EditEngine* pEE);
virtual ~EditUndo();
EditEngine* GetEditEngine();
- ImpEditEngine* GetImpEditEngine();
virtual void Undo() = 0;
virtual void Redo() = 0;
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 2f9e901..8314387 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -421,6 +421,11 @@ EditView* EditEngine::GetActiveView() const
return pImpEditEngine->GetActiveView();
}
+void EditEngine::SetActiveView(EditView* pView)
+{
+ pImpEditEngine->SetActiveView(pView);
+}
+
void EditEngine::SetDefTab( sal_uInt16 nDefTab )
{
DBG_CHKTHIS( EditEngine, 0 );
@@ -807,6 +812,26 @@ void EditEngine::RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAt
pImpEditEngine->RemoveCharAttribs(rSel, bRemoveParaAttribs, nWhich);
}
+EditEngine::ViewsType& EditEngine::GetEditViews()
+{
+ return pImpEditEngine->GetEditViews();
+}
+
+const EditEngine::ViewsType& EditEngine::GetEditViews() const
+{
+ return pImpEditEngine->GetEditViews();
+}
+
+void EditEngine::SetUndoMode(bool b)
+{
+ pImpEditEngine->SetUndoMode(b);
+}
+
+void EditEngine::FormatAndUpdate(EditView* pCurView)
+{
+ pImpEditEngine->FormatAndUpdate(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 ebbc6e9..be05f7d 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -65,22 +65,19 @@ void lcl_DoSetSelection( EditView* pView, sal_uInt16 nPara )
pView->GetImpEditView()->SetEditSelection( aSel );
}
-EditUndoManager::EditUndoManager( ImpEditEngine* p )
-{
- pImpEE = p;
-}
+EditUndoManager::EditUndoManager(EditEngine* pEE) : mpEditEngine(pEE) {}
sal_Bool EditUndoManager::Undo()
{
if ( GetUndoActionCount() == 0 )
return sal_False;
- DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" );
+ DBG_ASSERT( mpEditEngine->GetActiveView(), "Active View?" );
- if ( !pImpEE->GetActiveView() )
+ if ( !mpEditEngine->GetActiveView() )
{
- if (!pImpEE->GetEditViews().empty())
- pImpEE->SetActiveView(pImpEE->GetEditViews()[0]);
+ if (!mpEditEngine->GetEditViews().empty())
+ mpEditEngine->SetActiveView(mpEditEngine->GetEditViews()[0]);
else
{
OSL_FAIL("Undo in engine is not possible without a View! ");
@@ -88,19 +85,19 @@ sal_Bool EditUndoManager::Undo()
}
}
- pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection
+ mpEditEngine->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection
- pImpEE->SetUndoMode( sal_True );
+ mpEditEngine->SetUndoMode( sal_True );
sal_Bool bDone = SfxUndoManager::Undo();
- pImpEE->SetUndoMode( sal_False );
+ mpEditEngine->SetUndoMode( sal_False );
- EditSelection aNewSel( pImpEE->GetActiveView()->GetImpEditView()->GetEditSelection() );
+ EditSelection aNewSel( mpEditEngine->GetActiveView()->GetImpEditView()->GetEditSelection() );
DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () ");
- DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () ");
+ DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () ");
aNewSel.Min() = aNewSel.Max();
- pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
- pImpEE->FormatAndUpdate( pImpEE->GetActiveView() );
+ mpEditEngine->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ mpEditEngine->FormatAndUpdate( mpEditEngine->GetActiveView() );
return bDone;
}
@@ -110,12 +107,12 @@ sal_Bool EditUndoManager::Redo()
if ( GetRedoActionCount() == 0 )
return sal_False;
- DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" );
+ DBG_ASSERT( mpEditEngine->GetActiveView(), "Active View?" );
- if ( !pImpEE->GetActiveView() )
+ if ( !mpEditEngine->GetActiveView() )
{
- if (!pImpEE->GetEditViews().empty())
- pImpEE->SetActiveView(pImpEE->GetEditViews()[0]);
+ if (!mpEditEngine->GetEditViews().empty())
+ mpEditEngine->SetActiveView(mpEditEngine->GetEditViews()[0]);
else
{
OSL_FAIL( "Redo in Engine ohne View nicht moeglich!" );
@@ -123,24 +120,24 @@ sal_Bool EditUndoManager::Redo()
}
}
- pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection
+ mpEditEngine->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection
- pImpEE->SetUndoMode( sal_True );
+ mpEditEngine->SetUndoMode( sal_True );
sal_Bool bDone = SfxUndoManager::Redo();
- pImpEE->SetUndoMode( sal_False );
+ mpEditEngine->SetUndoMode( sal_False );
- EditSelection aNewSel( pImpEE->GetActiveView()->GetImpEditView()->GetEditSelection() );
+ EditSelection aNewSel( mpEditEngine->GetActiveView()->GetImpEditView()->GetEditSelection() );
DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () ");
- DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () ");
+ DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () ");
aNewSel.Min() = aNewSel.Max();
- pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
- pImpEE->FormatAndUpdate( pImpEE->GetActiveView() );
+ mpEditEngine->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ mpEditEngine->FormatAndUpdate( mpEditEngine->GetActiveView() );
return bDone;
}
-EditUndo::EditUndo(sal_uInt16 nI, ImpEditEngine* pEE) :
+EditUndo::EditUndo(sal_uInt16 nI, EditEngine* pEE) :
nId(nI), mpEditEngine(pEE)
{
DBG_CTOR( EditUndo, 0 );
@@ -153,11 +150,6 @@ EditUndo::~EditUndo()
EditEngine* EditUndo::GetEditEngine()
{
- return mpEditEngine->GetEditEnginePtr();
-}
-
-ImpEditEngine* EditUndo::GetImpEditEngine()
-{
return mpEditEngine;
}
@@ -174,18 +166,16 @@ sal_Bool EditUndo::CanRepeat(SfxRepeatTarget&) const
XubString EditUndo::GetComment() const
{
- XubString aComment;
+ String aComment;
if ( mpEditEngine )
- {
- EditEngine* pEditEng = mpEditEngine->GetEditEnginePtr();
- aComment = pEditEng->GetUndoComment( GetId() );
- }
+ aComment = mpEditEngine->GetUndoComment( GetId() );
+
return aComment;
}
EditUndoDelContent::EditUndoDelContent(
- ImpEditEngine* _pImpEE, ContentNode* pNode, size_t nPortion) :
- EditUndo(EDITUNDO_DELCONTENT, _pImpEE),
+ EditEngine* pEE, ContentNode* pNode, size_t nPortion) :
+ EditUndo(EDITUNDO_DELCONTENT, pEE),
bDelObject(true),
nNode(nPortion),
pContentNode(pNode) {}
@@ -238,12 +228,14 @@ void EditUndoDelContent::Redo()
pEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
-EditUndoConnectParas::EditUndoConnectParas( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP,
- const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
- const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBkwrd )
- : EditUndo( EDITUNDO_CONNECTPARAS, _pImpEE ),
- aLeftParaAttribs( rLeftParaAttribs ),
- aRightParaAttribs( rRightParaAttribs )
+EditUndoConnectParas::EditUndoConnectParas(
+ EditEngine* pEE, sal_uInt16 nN, sal_uInt16 nSP,
+ const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
+ const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBkwrd) :
+ EditUndo(EDITUNDO_CONNECTPARAS, pEE),
+ aLeftParaAttribs(rLeftParaAttribs),
+ aRightParaAttribs(rRightParaAttribs),
+ bBackward(bBkwrd)
{
nNode = nN;
nSepPos = nSP;
@@ -258,8 +250,6 @@ EditUndoConnectParas::EditUndoConnectParas( ImpEditEngine* _pImpEE, sal_uInt16 n
aRightStyleName = pRightStyle->GetName();
eRightStyleFamily = pRightStyle->GetFamily();
}
-
- bBackward = bBkwrd;
}
EditUndoConnectParas::~EditUndoConnectParas()
@@ -303,16 +293,12 @@ void EditUndoConnectParas::Redo()
GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
-EditUndoSplitPara::EditUndoSplitPara( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP )
- : EditUndo( EDITUNDO_SPLITPARA, _pImpEE )
-{
- nNode = nN;
- nSepPos = nSP;
-}
+EditUndoSplitPara::EditUndoSplitPara(
+ EditEngine* pEE, sal_uInt16 nN, sal_uInt16 nSP) :
+ EditUndo(EDITUNDO_SPLITPARA, pEE),
+ nNode(nN), nSepPos(nSP) {}
-EditUndoSplitPara::~EditUndoSplitPara()
-{
-}
+EditUndoSplitPara::~EditUndoSplitPara() {}
void EditUndoSplitPara::Undo()
{
@@ -328,11 +314,11 @@ void EditUndoSplitPara::Redo()
GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
}
-EditUndoInsertChars::EditUndoInsertChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr )
- : EditUndo( EDITUNDO_INSERTCHARS, _pImpEE ),
- aEPaM( rEPaM ), aText( rStr )
-{
-}
+EditUndoInsertChars::EditUndoInsertChars(
+ EditEngine* pEE, const EPaM& rEPaM, const String& rStr) :
+ EditUndo(EDITUNDO_INSERTCHARS, pEE),
+ aEPaM(rEPaM),
+ aText(rStr) {}
void EditUndoInsertChars::Undo()
{
@@ -372,11 +358,10 @@ sal_Bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction )
return sal_False;
}
-EditUndoRemoveChars::EditUndoRemoveChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr )
- : EditUndo( EDITUNDO_REMOVECHARS, _pImpEE ),
- aEPaM( rEPaM ), aText( rStr )
-{
-}
+EditUndoRemoveChars::EditUndoRemoveChars(
+ EditEngine* pEE, const EPaM& rEPaM, const String& rStr) :
+ EditUndo(EDITUNDO_REMOVECHARS, pEE),
+ aEPaM(rEPaM), aText(rStr) {}
void EditUndoRemoveChars::Undo()
{
@@ -398,8 +383,9 @@ void EditUndoRemoveChars::Redo()
GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aNewPaM);
}
-EditUndoInsertFeature::EditUndoInsertFeature( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const SfxPoolItem& rFeature)
- : EditUndo( EDITUNDO_INSERTFEATURE, _pImpEE ), aEPaM( rEPaM )
+EditUndoInsertFeature::EditUndoInsertFeature(
+ EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature) :
+ EditUndo(EDITUNDO_INSERTFEATURE, pEE), aEPaM(rEPaM)
{
pFeature = rFeature.Clone();
DBG_ASSERT( pFeature, "Feature could not be duplicated: EditUndoInsertFeature" );
@@ -434,17 +420,11 @@ void EditUndoInsertFeature::Redo()
GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
-EditUndoMoveParagraphs::EditUndoMoveParagraphs
- ( ImpEditEngine* _pImpEE, const Range& rParas, sal_uInt16 n )
- : EditUndo( EDITUNDO_MOVEPARAGRAPHS, _pImpEE ),
- nParagraphs( rParas )
-{
- nDest = n;
-}
+EditUndoMoveParagraphs::EditUndoMoveParagraphs(
+ EditEngine* pEE, const Range& rParas, sal_uInt16 n) :
+ EditUndo(EDITUNDO_MOVEPARAGRAPHS, pEE), nParagraphs(rParas), nDest(n) {}
-EditUndoMoveParagraphs::~EditUndoMoveParagraphs()
-{
-}
+EditUndoMoveParagraphs::~EditUndoMoveParagraphs() {}
void EditUndoMoveParagraphs::Undo()
{
@@ -476,12 +456,13 @@ void EditUndoMoveParagraphs::Redo()
GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
-EditUndoSetStyleSheet::EditUndoSetStyleSheet( ImpEditEngine* _pImpEE, sal_uInt16 nP,
- const XubString& rPrevName, SfxStyleFamily ePrevFam,
- const XubString& rNewName, SfxStyleFamily eNewFam,
- const SfxItemSet& rPrevParaAttribs )
- : EditUndo( EDITUNDO_STYLESHEET, _pImpEE ), aPrevName( rPrevName ), aNewName( rNewName ),
- aPrevParaAttribs( rPrevParaAttribs )
+EditUndoSetStyleSheet::EditUndoSetStyleSheet(
+ EditEngine* pEE, sal_uInt16 nP, const String& rPrevName, SfxStyleFamily ePrevFam,
+ const String& rNewName, SfxStyleFamily eNewFam, const SfxItemSet& rPrevParaAttribs) :
+ EditUndo(EDITUNDO_STYLESHEET, pEE),
+ aPrevName(rPrevName),
+ aNewName(rNewName),
+ aPrevParaAttribs(rPrevParaAttribs)
{
ePrevFamily = ePrevFam;
eNewFamily = eNewFam;
@@ -507,17 +488,14 @@ void EditUndoSetStyleSheet::Redo()
lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
-EditUndoSetParaAttribs::EditUndoSetParaAttribs( ImpEditEngine* _pImpEE, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems )
- : EditUndo( EDITUNDO_PARAATTRIBS, _pImpEE ),
- aPrevItems( rPrevItems ),
- aNewItems(rNewItems )
-{
- nPara = nP;
-}
+EditUndoSetParaAttribs::EditUndoSetParaAttribs(
+ EditEngine* pEE, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems) :
+ EditUndo(EDITUNDO_PARAATTRIBS, pEE),
+ nPara(nP),
+ aPrevItems(rPrevItems),
+ aNewItems(rNewItems) {}
-EditUndoSetParaAttribs::~EditUndoSetParaAttribs()
-{
-}
+EditUndoSetParaAttribs::~EditUndoSetParaAttribs() {}
void EditUndoSetParaAttribs::Undo()
{
@@ -533,10 +511,9 @@ void EditUndoSetParaAttribs::Redo()
lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
-EditUndoSetAttribs::EditUndoSetAttribs( ImpEditEngine* _pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems )
- : EditUndo( EDITUNDO_ATTRIBS, _pImpEE ),
- aESel( rESel ),
- aNewAttribs( rNewItems )
+EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems) :
+ EditUndo(EDITUNDO_ATTRIBS, pEE),
+ aESel(rESel), aNewAttribs(rNewItems)
{
// When EditUndoSetAttribs actually is a RemoveAttribs this could be
// /recognize by the empty itemset, but then it would have to be caught in
@@ -626,12 +603,9 @@ void EditUndoSetAttribs::ImpSetSelection( EditView* /*pView*/ )
pEE->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
-EditUndoTransliteration::EditUndoTransliteration( ImpEditEngine* _pImpEE, const ESelection& rESel, sal_Int32 nM )
- : EditUndo( EDITUNDO_TRANSLITERATE, _pImpEE ), aOldESel( rESel )
-{
- nMode = nM;
- pTxtObj = NULL;
-}
+EditUndoTransliteration::EditUndoTransliteration(EditEngine* pEE, const ESelection& rESel, sal_Int32 nM) :
+ EditUndo(EDITUNDO_TRANSLITERATE, pEE),
+ aOldESel(rESel), nMode(nM), pTxtObj(NULL) {}
EditUndoTransliteration::~EditUndoTransliteration()
{
@@ -687,14 +661,10 @@ void EditUndoTransliteration::Redo()
pEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
-EditUndoMarkSelection::EditUndoMarkSelection( ImpEditEngine* _pImpEE, const ESelection& rSel )
- : EditUndo( EDITUNDO_MARKSELECTION, _pImpEE ), aSelection( rSel )
-{
-}
+EditUndoMarkSelection::EditUndoMarkSelection(EditEngine* pEE, const ESelection& rSel) :
+ EditUndo(EDITUNDO_MARKSELECTION, pEE), aSelection(rSel) {}
-EditUndoMarkSelection::~EditUndoMarkSelection()
-{
-}
+EditUndoMarkSelection::~EditUndoMarkSelection() {}
void EditUndoMarkSelection::Undo()
{
diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx
index 67a1b25..63b08cf 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -39,7 +39,7 @@
#define UNDO_EMPTYGROUPDELETED 3
#define UNDO_INVALIDEND 4
-class ImpEditEngine;
+class EditEngine;
class EditView;
// -----------------------------------------------------------------------
@@ -55,7 +55,7 @@ private:
public:
TYPEINFO();
- EditUndoDelContent(ImpEditEngine* pImpEE, ContentNode* pNode, size_t nPortion);
+ EditUndoDelContent(EditEngine* pEE, ContentNode* pNode, size_t nPortion);
virtual ~EditUndoDelContent();
virtual void Undo();
@@ -79,14 +79,14 @@ private:
SfxStyleFamily eLeftStyleFamily;
SfxStyleFamily eRightStyleFamily;
- sal_Bool bBackward;
+ bool bBackward;
public:
- TYPEINFO();
- EditUndoConnectParas( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos,
- const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
- const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBackward );
- ~EditUndoConnectParas();
+ TYPEINFO();
+ EditUndoConnectParas(EditEngine* pEE, sal_uInt16 nNode, sal_uInt16 nSepPos,
+ const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
+ const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBackward);
+ virtual ~EditUndoConnectParas();
virtual void Undo();
virtual void Redo();
@@ -102,9 +102,9 @@ private:
sal_uInt16 nSepPos;
public:
- TYPEINFO();
- EditUndoSplitPara( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos );
- ~EditUndoSplitPara();
+ TYPEINFO();
+ EditUndoSplitPara(EditEngine* pEE, sal_uInt16 nNode, sal_uInt16 nSepPos);
+ ~EditUndoSplitPara();
virtual void Undo();
virtual void Redo();
@@ -120,8 +120,8 @@ private:
String aText;
public:
- TYPEINFO();
- EditUndoInsertChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
+ TYPEINFO();
+ EditUndoInsertChars(EditEngine* pEE, const EPaM& rEPaM, const String& rStr);
const EPaM& GetEPaM() { return aEPaM; }
String& GetStr() { return aText; }
@@ -142,8 +142,8 @@ private:
String aText;
public:
- TYPEINFO();
- EditUndoRemoveChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
+ TYPEINFO();
+ EditUndoRemoveChars(EditEngine* pEE, const EPaM& rEPaM, const String& rStr);
const EPaM& GetEPaM() { return aEPaM; }
String& GetStr() { return aText; }
@@ -162,10 +162,9 @@ private:
SfxPoolItem* pFeature;
public:
- TYPEINFO();
- EditUndoInsertFeature( ImpEditEngine* pImpEE, const EPaM& rEPaM,
- const SfxPoolItem& rFeature);
- ~EditUndoInsertFeature();
+ TYPEINFO();
+ EditUndoInsertFeature(EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature);
+ virtual ~EditUndoInsertFeature();
virtual void Undo();
virtual void Redo();
@@ -181,9 +180,9 @@ private:
sal_uInt16 nDest;
public:
- TYPEINFO();
- EditUndoMoveParagraphs( ImpEditEngine* pImpEE, const Range& rParas, sal_uInt16 nDest );
- ~EditUndoMoveParagraphs();
+ TYPEINFO();
+ EditUndoMoveParagraphs(EditEngine* pEE, const Range& rParas, sal_uInt16 nDest);
+ virtual ~EditUndoMoveParagraphs();
virtual void Undo();
virtual void Redo();
@@ -196,20 +195,19 @@ class EditUndoSetStyleSheet: public EditUndo
{
private:
sal_uInt16 nPara;
- XubString aPrevName;
- XubString aNewName;
+ String aPrevName;
+ String aNewName;
SfxStyleFamily ePrevFamily;
SfxStyleFamily eNewFamily;
SfxItemSet aPrevParaAttribs;
public:
- TYPEINFO();
-
- EditUndoSetStyleSheet( ImpEditEngine* pImpEE, sal_uInt16 nPara,
- const XubString& rPrevName, SfxStyleFamily ePrevFamily,
- const XubString& rNewName, SfxStyleFamily eNewFamily,
- const SfxItemSet& rPrevParaAttribs );
- ~EditUndoSetStyleSheet();
+ TYPEINFO();
+ EditUndoSetStyleSheet(EditEngine* pEE, sal_uInt16 nPara,
+ const String& rPrevName, SfxStyleFamily ePrevFamily,
+ const String& rNewName, SfxStyleFamily eNewFamily,
+ const SfxItemSet& rPrevParaAttribs);
+ virtual ~EditUndoSetStyleSheet();
virtual void Undo();
virtual void Redo();
@@ -226,9 +224,9 @@ private:
SfxItemSet aNewItems;
public:
- TYPEINFO();
- EditUndoSetParaAttribs( ImpEditEngine* pImpEE, sal_uInt16 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems );
- ~EditUndoSetParaAttribs();
+ TYPEINFO();
+ EditUndoSetParaAttribs(EditEngine* pEE, sal_uInt16 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems);
+ virtual ~EditUndoSetParaAttribs();
virtual void Undo();
virtual void Redo();
@@ -255,9 +253,9 @@ private:
public:
- TYPEINFO();
- EditUndoSetAttribs( ImpEditEngine* pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems );
- ~EditUndoSetAttribs();
+ TYPEINFO();
+ EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems);
+ virtual ~EditUndoSetAttribs();
SfxItemSet& GetNewAttribs() { return aNewAttribs; }
@@ -286,9 +284,9 @@ private:
String aText;
public:
- TYPEINFO();
- EditUndoTransliteration( ImpEditEngine* pImpEE, const ESelection& rESel, sal_Int32 nMode );
- ~EditUndoTransliteration();
+ TYPEINFO();
+ EditUndoTransliteration(EditEngine* pEE, const ESelection& rESel, sal_Int32 nMode);
+ virtual ~EditUndoTransliteration();
void SetText( const String& rText ) { aText = rText; }
void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
@@ -307,9 +305,9 @@ private:
ESelection aSelection;
public:
- TYPEINFO();
- EditUndoMarkSelection( ImpEditEngine* pImpEE, const ESelection& rSel );
- ~EditUndoMarkSelection();
+ TYPEINFO();
+ EditUndoMarkSelection(EditEngine* pEE, const ESelection& rSel);
+ virtual ~EditUndoMarkSelection();
virtual void Undo();
virtual void Redo();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 6b013bc..29d5e81 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -37,6 +37,7 @@
#include <editeng/svxacorr.hxx>
#include <editeng/SpellPortions.hxx>
#include <editeng/eedata.hxx>
+#include "editeng/editeng.hxx"
#include <vcl/virdev.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/cursor.hxx>
@@ -384,7 +385,7 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditDbg;
public:
- typedef std::vector<EditView*> ViewsType;
+ typedef EditEngine::ViewsType ViewsType;
private:
@@ -1073,7 +1074,7 @@ inline void ImpEditEngine::IdleFormatAndUpdate( EditView* pCurView )
inline EditUndoManager& ImpEditEngine::GetUndoManager()
{
if ( !pUndoManager )
- pUndoManager = new EditUndoManager( this );
+ pUndoManager = new EditUndoManager(pEditEngine);
return *pUndoManager;
}
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 4c1f1a8..66671c2 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2136,7 +2136,7 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, Edit
if ( pCurUndo && ( CreateEditPaM( pCurUndo->GetEPaM() ) == rPaM ) )
pCurUndo->GetStr() += aStr;
else
- InsertUndo( new EditUndoRemoveChars( this, CreateEPaM( rPaM ), aStr ) );
+ InsertUndo(new EditUndoRemoveChars(pEditEngine, CreateEPaM(rPaM), aStr));
}
aEditDoc.RemoveChars( rPaM, nChars );
@@ -2196,7 +2196,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
aBeginMovingParagraphsHdl.Call( &aMoveParagraphsInfo );
if ( IsUndoEnabled() && !IsInUndo())
- InsertUndo( new EditUndoMoveParagraphs( this, aOldPositions, nNewPos ) );
+ InsertUndo(new EditUndoMoveParagraphs(pEditEngine, aOldPositions, nNewPos));
// do not lose sight of the Position !
ParaPortion* pDestPortion = GetParaPortions().SafeGetObject( nNewPos );
@@ -2275,7 +2275,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
if ( IsUndoEnabled() && !IsInUndo() )
{
- InsertUndo( new EditUndoConnectParas( this,
+ InsertUndo( new EditUndoConnectParas(pEditEngine,
aEditDoc.GetPos( pLeft ), pLeft->Len(),
pLeft->GetContentAttribs().GetItems(), pRight->GetContentAttribs().GetItems(),
pLeft->GetStyleSheet(), pRight->GetStyleSheet(), bBackward ) );
@@ -2514,7 +2514,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
ParaAttribsChanged( pNextNode );
if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoDelContent( this, pNode, nPara ) );
+ InsertUndo(new EditUndoDelContent(pEditEngine, pNode, nPara));
else
{
aEditDoc.RemoveItemsFromPool(*pNode);
@@ -2670,7 +2670,7 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel,
if ( IsUndoEnabled() && !IsInUndo() )
{
- EditUndoInsertChars* pNewUndo = new EditUndoInsertChars( this, CreateEPaM( aPaM ), c );
+ EditUndoInsertChars* pNewUndo = new EditUndoInsertChars(pEditEngine, CreateEPaM(aPaM), c);
sal_Bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? sal_True : sal_False;
InsertUndo( pNewUndo, bTryMerge );
}
@@ -2738,7 +2738,7 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const String&
aLine.Erase( nMaxNewChars ); // Delete the Rest...
}
if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), aLine ) );
+ InsertUndo(new EditUndoInsertChars(pEditEngine, CreateEPaM(aPaM), aLine));
// Tabs ?
if ( aLine.Search( '\t' ) == STRING_NOTFOUND )
aPaM = aEditDoc.InsertText( aPaM, aLine );
@@ -2798,7 +2798,7 @@ EditPaM ImpEditEngine::ImpFastInsertText( EditPaM aPaM, const XubString& rStr )
if ( ( aPaM.GetNode()->Len() + rStr.Len() ) < MAXCHARSINPARA )
{
if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), rStr ) );
+ InsertUndo(new EditUndoInsertChars(pEditEngine, CreateEPaM(aPaM), rStr));
aPaM = aEditDoc.InsertText( aPaM, rStr );
TextModified();
@@ -2823,7 +2823,7 @@ EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolIte
return aPaM;
if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertFeature( this, CreateEPaM( aPaM ), rItem ) );
+ InsertUndo(new EditUndoInsertFeature(pEditEngine, CreateEPaM(aPaM), rItem));
aPaM = aEditDoc.InsertFeature( aPaM, rItem );
ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
@@ -2855,7 +2855,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttrib
}
if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoSplitPara( this, aEditDoc.GetPos( rPaM.GetNode() ), rPaM.GetIndex() ) );
+ InsertUndo(new EditUndoSplitPara(pEditEngine, aEditDoc.GetPos(rPaM.GetNode()), rPaM.GetIndex()));
EditPaM aPaM( aEditDoc.InsertParaBreak( rPaM, bKeepEndingAttribs ) );
@@ -2914,10 +2914,10 @@ EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara )
if ( nPara )
{
OSL_ENSURE( aEditDoc.GetObject( nPara-1 ), "FastInsertParagraph: Prev does not exist" );
- InsertUndo( new EditUndoSplitPara( this, nPara-1, aEditDoc.GetObject( nPara-1 )->Len() ) );
+ InsertUndo(new EditUndoSplitPara(pEditEngine, nPara-1, aEditDoc.GetObject( nPara-1 )->Len()));
}
else
- InsertUndo( new EditUndoSplitPara( this, 0, 0 ) );
+ InsertUndo(new EditUndoSplitPara(pEditEngine, 0, 0));
}
ContentNode* pNode = new ContentNode( aEditDoc.GetItemPool() );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 2b991e9..89dce47 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2948,7 +2948,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
aNewSel = aSel;
ESelection aESel( CreateESel( aSel ) );
- pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
+ pUndo = new EditUndoTransliteration(pEditEngine, aESel, nTransliterationMode);
const bool bSingleNode = aSel.Min().GetNode()== aSel.Max().GetNode();
const bool bHasAttribs = aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index a8e8601..2d14262 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -92,7 +92,7 @@ void ImpEditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
aNewStyleName = pStyle->GetName();
InsertUndo(
- new EditUndoSetStyleSheet( this, aEditDoc.GetPos( pNode ),
+ new EditUndoSetStyleSheet(pEditEngine, aEditDoc.GetPos( pNode ),
aPrevStyleName, pCurStyle ? pCurStyle->GetFamily() : SFX_STYLE_FAMILY_PARA,
aNewStyleName, pStyle ? pStyle->GetFamily() : SFX_STYLE_FAMILY_PARA,
pNode->GetContentAttribs().GetItems() ) );
@@ -205,11 +205,11 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S
{
SfxItemSet aTmpSet( GetEmptyItemSet() );
aTmpSet.Put( rSet );
- pUndo = new EditUndoSetAttribs( this, aESel, aTmpSet );
+ pUndo = new EditUndoSetAttribs(pEditEngine, aESel, aTmpSet);
}
else
{
- pUndo = new EditUndoSetAttribs( this, aESel, rSet );
+ pUndo = new EditUndoSetAttribs(pEditEngine, aESel, rSet);
}
SfxItemPool* pPool = pUndo->GetNewAttribs().GetPool();
@@ -268,7 +268,7 @@ void ImpEditEngine::InsertUndo( EditUndo* pUndo, bool bTryMerge )
DBG_ASSERT( !IsInUndo(), "InsertUndo in Undomodus!" );
if ( pUndoMarkSelection )
{
- EditUndoMarkSelection* pU = new EditUndoMarkSelection( this, *pUndoMarkSelection );
+ EditUndoMarkSelection* pU = new EditUndoMarkSelection(pEditEngine, *pUndoMarkSelection);
GetUndoManager().AddUndoAction( pU, false );
delete pUndoMarkSelection;
pUndoMarkSelection = NULL;
@@ -709,11 +709,11 @@ void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
{
SfxItemSet aTmpSet( GetEmptyItemSet() );
aTmpSet.Put( rSet );
- InsertUndo( new EditUndoSetParaAttribs( this, nPara, pNode->GetContentAttribs().GetItems(), aTmpSet ) );
+ InsertUndo(new EditUndoSetParaAttribs(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), aTmpSet));
}
else
{
- InsertUndo( new EditUndoSetParaAttribs( this, nPara, pNode->GetContentAttribs().GetItems(), rSet ) );
+ InsertUndo(new EditUndoSetParaAttribs(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), rSet));
}
}
pNode->GetContentAttribs().GetItems().Set( rSet );
commit d5c2846b37c506e58e10a6a18dd34f3d9b8f49aa
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 17 10:59:19 2012 -0400
None of the edit undo classes access ImpEditEngine directly.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 043776b..523addf 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -171,8 +171,6 @@ private:
EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
const ParaPortion* pParaPortion, const EditLine* pLine) const;
- EDITENG_DLLPRIVATE bool IsFormatted() const;
-
EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const;
EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
@@ -233,6 +231,7 @@ public:
LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
+ EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
void SetAsianCompressionMode( sal_uInt16 nCompression );
@@ -514,6 +513,7 @@ public:
EditDoc& GetEditDoc();
const EditDoc& GetEditDoc() const;
+ bool IsFormatted() const;
bool IsImportHandlerSet() const;
bool IsImportRTFStyleSheetsSet() const;
@@ -527,6 +527,7 @@ public:
EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
+ EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel);
EditPaM InsertParaBreak(
const EditSelection& rEditSelection, bool bKeepEndingAttribs = true);
EditPaM InsertLineBreak(const EditSelection& rEditSelection);
@@ -542,12 +543,14 @@ public:
EditPaM DeleteSelection(const EditSelection& rSel);
ESelection CreateESelection(const EditSelection& rSel);
+ EditSelection CreateSelection(const ESelection& rSel);
const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const;
void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet);
void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
+ EditPaM DeleteSelected(const EditSelection& rSel);
sal_uInt16 GetScriptType(const EditSelection& rSel) const;
@@ -566,6 +569,9 @@ public:
EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
EditSelection MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView);
+
+ void RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
+ void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 81ad880..2f9e901 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -534,6 +534,11 @@ void EditEngine::TransliterateText( const ESelection& rSelection, sal_Int32 nTra
pImpEditEngine->TransliterateText( pImpEditEngine->CreateSel( rSelection ), nTransliterationMode );
}
+EditSelection EditEngine::TransliterateText(const EditSelection& rSelection, sal_Int32 nTransliterationMode)
+{
+ return pImpEditEngine->TransliterateText(rSelection, nTransliterationMode);
+}
+
void EditEngine::SetAsianCompressionMode( sal_uInt16 n )
{
DBG_CHKTHIS( EditView, 0 );
@@ -792,6 +797,16 @@ EditSelection EditEngine::MoveParagraphs(const Range& rParagraphs, sal_uInt16 nN
return pImpEditEngine->MoveParagraphs(rParagraphs, nNewPos, pCurView);
}
+void EditEngine::RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich, bool bRemoveFeatures)
+{
+ pImpEditEngine->RemoveCharAttribs(nPara, nWhich, bRemoveFeatures);
+}
+
+void EditEngine::RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich)
+{
+ pImpEditEngine->RemoveCharAttribs(rSel, bRemoveParaAttribs, nWhich);
+}
+
uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const EditSelection& rSelection)
{
return pImpEditEngine->CreateTransferable(rSelection);
@@ -823,6 +838,11 @@ EditPaM EditEngine::InsertText(const EditSelection& aCurEditSelection, const Str
return pImpEditEngine->InsertText(aCurEditSelection, rStr);
}
+EditSelection EditEngine::InsertText(const EditTextObject& rTextObject, const EditSelection& rSel)
+{
+ return pImpEditEngine->InsertText(rTextObject, rSel);
+}
+
EditSelection EditEngine::InsertText(
uno::Reference<datatransfer::XTransferable >& rxDataObj,
const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial)
@@ -909,6 +929,11 @@ ESelection EditEngine::CreateESelection(const EditSelection& rSel)
return pImpEditEngine->CreateESel(rSel);
}
+EditSelection EditEngine::CreateSelection(const ESelection& rSel)
+{
+ return pImpEditEngine->CreateSel(rSel);
+}
+
const SfxItemSet& EditEngine::GetBaseParaAttribs(sal_uInt16 nPara) const
{
return pImpEditEngine->GetParaAttribs(nPara);
@@ -929,6 +954,11 @@ String EditEngine::GetSelected(const EditSelection& rSel, const LineEnd eParaSep
return pImpEditEngine->GetSelected(rSel, eParaSep);
}
+EditPaM EditEngine::DeleteSelected(const EditSelection& rSel)
+{
+ return pImpEditEngine->DeleteSelected(rSel);
+}
+
void EditEngine::HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos)
{
pImpEditEngine->aBeginPasteOrDropHdl.Call(&rInfos);
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 067d84f..ebbc6e9 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -494,17 +494,17 @@ EditUndoSetStyleSheet::~EditUndoSetStyleSheet()
void EditUndoSetStyleSheet::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aPrevName, ePrevFamily ) );
- GetImpEditEngine()->SetParaAttribs( nPara, aPrevParaAttribs );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ GetEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetEditEngine()->GetStyleSheetPool()->Find( aPrevName, ePrevFamily ) );
+ GetEditEngine()->SetParaAttribsOnly( nPara, aPrevParaAttribs );
+ lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
void EditUndoSetStyleSheet::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aNewName, eNewFamily ) );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ GetEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetEditEngine()->GetStyleSheetPool()->Find( aNewName, eNewFamily ) );
+ lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
EditUndoSetParaAttribs::EditUndoSetParaAttribs( ImpEditEngine* _pImpEE, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems )
@@ -521,16 +521,16 @@ EditUndoSetParaAttribs::~EditUndoSetParaAttribs()
void EditUndoSetParaAttribs::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetParaAttribs( nPara, aPrevItems );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ GetEditEngine()->SetParaAttribsOnly( nPara, aPrevItems );
+ lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
void EditUndoSetParaAttribs::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetParaAttribs( nPara, aNewItems );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ GetEditEngine()->SetParaAttribsOnly( nPara, aNewItems );
+ lcl_DoSetSelection( GetEditEngine()->GetActiveView(), nPara );
}
EditUndoSetAttribs::EditUndoSetAttribs( ImpEditEngine* _pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems )
@@ -571,47 +571,47 @@ EditUndoSetAttribs::~EditUndoSetAttribs()
void EditUndoSetAttribs::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditEngine* pEE = GetEditEngine();
bool bFields = false;
for ( sal_uInt16 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ )
{
const ContentAttribsInfo& rInf = aPrevAttribs[nPara-aESel.nStartPara];
// first the paragraph attributes ...
- _pImpEE->SetParaAttribs(nPara, rInf.GetPrevParaAttribs());
+ pEE->SetParaAttribsOnly(nPara, rInf.GetPrevParaAttribs());
// Then the character attributes ...
// Remove all attributes including features, are later re-established.
- _pImpEE->RemoveCharAttribs(nPara, 0, true);
- DBG_ASSERT( _pImpEE->GetEditDoc().GetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
- ContentNode* pNode = _pImpEE->GetEditDoc().GetObject( nPara );
+ pEE->RemoveCharAttribs(nPara, 0, true);
+ DBG_ASSERT( pEE->GetEditDoc().GetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
+ ContentNode* pNode = pEE->GetEditDoc().GetObject( nPara );
for (size_t nAttr = 0; nAttr < rInf.GetPrevCharAttribs().size(); ++nAttr)
{
const EditCharAttrib& rX = rInf.GetPrevCharAttribs()[nAttr];
// is automatically "poolsized"
- _pImpEE->GetEditDoc().InsertAttrib(pNode, rX.GetStart(), rX.GetEnd(), *rX.GetItem());
+ pEE->GetEditDoc().InsertAttrib(pNode, rX.GetStart(), rX.GetEnd(), *rX.GetItem());
if (rX.Which() == EE_FEATURE_FIELD)
bFields = true;
}
}
if ( bFields )
- _pImpEE->UpdateFields();
- ImpSetSelection( GetImpEditEngine()->GetActiveView() );
+ pEE->UpdateFieldsOnly();
+ ImpSetSelection(pEE->GetActiveView());
}
void EditUndoSetAttribs::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditEngine* pEE = GetEditEngine();
- EditSelection aSel( _pImpEE->CreateSel( aESel ) );
+ EditSelection aSel = pEE->CreateSelection(aESel);
if ( !bSetIsRemove )
- _pImpEE->SetAttribs( aSel, aNewAttribs, nSpecial );
+ pEE->SetAttribs( aSel, aNewAttribs, nSpecial );
else
- _pImpEE->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
+ pEE->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
- ImpSetSelection( GetImpEditEngine()->GetActiveView() );
+ ImpSetSelection( GetEditEngine()->GetActiveView() );
}
void EditUndoSetAttribs::AppendContentInfo(ContentAttribsInfo* pNew)
@@ -621,9 +621,9 @@ void EditUndoSetAttribs::AppendContentInfo(ContentAttribsInfo* pNew)
void EditUndoSetAttribs::ImpSetSelection( EditView* /*pView*/ )
{
- ImpEditEngine* _pImpEE = GetImpEditEngine();
- EditSelection aSel( _pImpEE->CreateSel( aESel ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
+ EditEngine* pEE = GetEditEngine();
+ EditSelection aSel = pEE->CreateSelection(aESel);
+ pEE->GetActiveView()->GetImpEditView()->SetEditSelection(aSel);
}
EditUndoTransliteration::EditUndoTransliteration( ImpEditEngine* _pImpEE, const ESelection& rESel, sal_Int32 nM )
@@ -640,26 +640,26 @@ EditUndoTransliteration::~EditUndoTransliteration()
void EditUndoTransliteration::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
+ EditEngine* pEE = GetEditEngine();
- EditSelection aSel( _pImpEE->CreateSel( aNewESel ) );
+ EditSelection aSel = pEE->CreateSelection(aNewESel);
// Insert text, but don't expand Atribs at the current position:
- aSel = _pImpEE->DeleteSelected( aSel );
+ aSel = pEE->DeleteSelected( aSel );
EditSelection aDelSel( aSel );
- aSel = _pImpEE->InsertParaBreak( aSel );
+ aSel = pEE->InsertParaBreak( aSel );
aDelSel.Max() = aSel.Min();
- aDelSel.Max().GetNode()->GetCharAttribs().DeleteEmptyAttribs( _pImpEE->GetEditDoc().GetItemPool() );
+ aDelSel.Max().GetNode()->GetCharAttribs().DeleteEmptyAttribs( pEE->GetEditDoc().GetItemPool() );
EditSelection aNewSel;
if ( pTxtObj )
{
- aNewSel = _pImpEE->InsertText( *pTxtObj, aSel );
+ aNewSel = pEE->InsertText( *pTxtObj, aSel );
}
else
{
- aNewSel = _pImpEE->InsertText( aSel, aText );
+ aNewSel = pEE->InsertText( aSel, aText );
}
if ( aNewSel.Min().GetNode() == aDelSel.Max().GetNode() )
{
@@ -673,19 +673,18 @@ void EditUndoTransliteration::Undo()
aNewSel.Max().GetIndex() =
aNewSel.Max().GetIndex() + aDelSel.Min().GetIndex();
}
- _pImpEE->DeleteSelected( aDelSel );
-
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ pEE->DeleteSelected( aDelSel );
+ pEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
void EditUndoTransliteration::Redo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ EditEngine* pEE = GetEditEngine();
- EditSelection aSel( _pImpEE->CreateSel( aOldESel ) );
- EditSelection aNewSel = _pImpEE->TransliterateText( aSel, nMode );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
+ EditSelection aSel = pEE->CreateSelection(aOldESel);
+ EditSelection aNewSel = pEE->TransliterateText( aSel, nMode );
+ pEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
}
EditUndoMarkSelection::EditUndoMarkSelection( ImpEditEngine* _pImpEE, const ESelection& rSel )
@@ -699,13 +698,13 @@ EditUndoMarkSelection::~EditUndoMarkSelection()
void EditUndoMarkSelection::Undo()
{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- if ( GetImpEditEngine()->GetActiveView() )
+ DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
+ if ( GetEditEngine()->GetActiveView() )
{
- if ( GetImpEditEngine()->IsFormatted() )
- GetImpEditEngine()->GetActiveView()->SetSelection( aSelection );
+ if ( GetEditEngine()->IsFormatted() )
+ GetEditEngine()->GetActiveView()->SetSelection( aSelection );
else
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( GetImpEditEngine()->CreateSel( aSelection ) );
+ GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( GetEditEngine()->CreateSelection(aSelection) );
}
}
More information about the Libreoffice-commits
mailing list