Kaydet (Commit) 183bde5b authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#81641 implement undo of Conditional Text style creation

and deletion

Change-Id: I694ae8f917c74305cd30037c3c3833a980354948
üst 11fab6b7
...@@ -907,6 +907,13 @@ SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const OUString &rFmtName, ...@@ -907,6 +907,13 @@ SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const OUString &rFmtName,
pFmtColl->SetAuto( false ); pFmtColl->SetAuto( false );
SetModified(); SetModified();
if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoCondTxtFmtCollCreate(pFmtColl, pDerivedFrom,
this);
GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if (bBroadcast) if (bBroadcast)
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
SFX_STYLESHEET_CREATED); SFX_STYLESHEET_CREATED);
...@@ -942,8 +949,15 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast) ...@@ -942,8 +949,15 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast)
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
{ {
SwUndoTxtFmtCollDelete * pUndo = SwUndoTxtFmtCollDelete * pUndo;
new SwUndoTxtFmtCollDelete(pDel, this); if (RES_CONDTXTFMTCOLL == pDel->Which())
{
pUndo = new SwUndoCondTxtFmtCollDelete(pDel, this);
}
else
{
pUndo = new SwUndoTxtFmtCollDelete(pDel, this);
}
GetIDocumentUndoRedo().AppendUndo(pUndo); GetIDocumentUndoRedo().AppendUndo(pUndo);
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
class SwDoc; class SwDoc;
class SwTxtFmtColl; class SwTxtFmtColl;
class SwConditionTxtFmtColl;
class SwRewriter; class SwRewriter;
class SfxItemSet; class SfxItemSet;
...@@ -120,6 +121,20 @@ public: ...@@ -120,6 +121,20 @@ public:
virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE; virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
}; };
class SwUndoCondTxtFmtCollCreate : public SwUndoTxtFmtCollCreate
{
public:
SwUndoCondTxtFmtCollCreate(SwConditionTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom, SwDoc * pDoc);
virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
};
class SwUndoCondTxtFmtCollDelete : public SwUndoTxtFmtCollDelete
{
public:
SwUndoCondTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
};
class SwUndoRenameFmtColl : public SwUndoRenameFmt class SwUndoRenameFmtColl : public SwUndoRenameFmt
{ {
public: public:
......
...@@ -232,6 +232,28 @@ SwFmt * SwUndoTxtFmtCollDelete::Find(const OUString & rName) const ...@@ -232,6 +232,28 @@ SwFmt * SwUndoTxtFmtCollDelete::Find(const OUString & rName) const
return pDoc->FindTxtFmtCollByName(rName); return pDoc->FindTxtFmtCollByName(rName);
} }
SwUndoCondTxtFmtCollCreate::SwUndoCondTxtFmtCollCreate(SwConditionTxtFmtColl *_pNew,
SwTxtFmtColl *_pDerivedFrom, SwDoc *_pDoc)
: SwUndoTxtFmtCollCreate(_pNew, _pDerivedFrom, _pDoc)
{
}
SwFmt * SwUndoCondTxtFmtCollCreate::Create(SwFmt * pDerivedFrom)
{
return pDoc->MakeCondTxtFmtColl(sNewName, (SwTxtFmtColl *)pDerivedFrom, true);
}
SwUndoCondTxtFmtCollDelete::SwUndoCondTxtFmtCollDelete(SwTxtFmtColl * _pOld,
SwDoc * _pDoc)
: SwUndoTxtFmtCollDelete(_pOld, _pDoc)
{
}
SwFmt * SwUndoCondTxtFmtCollDelete::Create(SwFmt * pDerivedFrom)
{
return pDoc->MakeCondTxtFmtColl(sOldName, (SwTxtFmtColl *) pDerivedFrom, true);
}
SwUndoRenameFmtColl::SwUndoRenameFmtColl(const OUString & sInitOldName, SwUndoRenameFmtColl::SwUndoRenameFmtColl(const OUString & sInitOldName,
const OUString & sInitNewName, const OUString & sInitNewName,
SwDoc * _pDoc) SwDoc * _pDoc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment