svx/inc/svx/svdundo.hxx | 9 ++++++++- svx/source/svdraw/svdundo.cxx | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-)
New commits: commit e462a30d03c16aa4202f8d28ad52b15feb3d9255 Author: David Tardon <dtar...@redhat.com> Date: Wed Feb 13 08:52:52 2013 +0100 fdo#34558 don't crash on undoing text frame removal Change-Id: I48b95c6c0cbfb2f4c4b09cc90b254b96de40b3e9 diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx index 0d3713e..8066c72 100644 --- a/svx/inc/svx/svdundo.hxx +++ b/svx/inc/svx/svdundo.hxx @@ -20,6 +20,7 @@ #ifndef _SVDUNDO_HXX #define _SVDUNDO_HXX +#include <svl/lstner.hxx> #include <svl/solar.hrc> #include <svl/undo.hxx> #include <tools/gen.hxx> @@ -252,9 +253,12 @@ public: // //************************************************************ -class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj { +class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj, public SfxListener { bool bOwner; +public: + TYPEINFO(); + protected: SdrObjList* pObjList; SdrView* pView; // um bei ObjDel, Undo die @@ -270,6 +274,9 @@ protected: void SetView(SdrView* pView1, SdrPageView* pPageView1) { pView=pView1; pPageView=pPageView1; } bool IsOwner() { return bOwner; } void SetOwner(bool bNew); + +private: + virtual void Notify(SfxBroadcaster& rBroadcaster, const SfxHint& rHint); }; //************************************************************ diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 452761d..5e53ab1 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -655,6 +655,8 @@ OUString SdrUndoGeoObj::GetComment() const //////////////////////////////////////////////////////////////////////////////////////////////////// +TYPEINIT1(SdrUndoObjList, SfxListener); + SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect) : SdrUndoObj(rNewObj), bOwner(sal_False), @@ -667,10 +669,14 @@ SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect) } else { nOrdNum=pObj->GetOrdNum(); } + + StartListening(*pObjList->GetModel()); } SdrUndoObjList::~SdrUndoObjList() { + EndListening(*pObjList->GetModel()); + if (pObj!=NULL && IsOwner()) { // Attribute have to go back to the regular Pool @@ -686,6 +692,20 @@ void SdrUndoObjList::SetOwner(bool bNew) bOwner = bNew; } +void SdrUndoObjList::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + const SdrHint* pSdrHint(dynamic_cast<const SdrHint*>(&rHint)); + if (pSdrHint) + { + if ((pSdrHint->GetObject() == pObj) && (pSdrHint->GetKind() == HINT_OBJCHG)) + { + const sal_uInt32 nNewOrdNum(pObj->GetOrdNum()); + if (nNewOrdNum != nOrdNum) + nOrdNum = nNewOrdNum; + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////// void SdrUndoRemoveObj::Undo() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits