Removed all references to ImpEditEngine from all of edit undo classes.

This commit is contained in:
Kohei Yoshida 2012-04-17 12:12:43 -04:00
parent d5c2846b37
commit 56ef4ea055
9 changed files with 182 additions and 181 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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 );
@ -152,11 +149,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()
{

View file

@ -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();

View file

@ -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;
}

View file

@ -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() );

View file

@ -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() );

View file

@ -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 );