summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Kitzinger <Ulrich.Kitzinger@muenchen.de>2013-11-11 17:57:42 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2014-10-06 10:52:43 +0200
commit3ae68dd9f80ca0da2288562359e23de50ff383c8 (patch)
treead2173cd663fc8a4aff84e3130feba622587b7e2
parent825ed7562530011277c336deca07b5cf4182952c (diff)
Fix für AO Bug 74651
-rw-r--r--svx/source/svdraw/svdmrkv.cxx31
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx7
-rw-r--r--svx/source/unodraw/unopage.cxx11
3 files changed, 38 insertions, 11 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index ff27728c1d09..e9052ed5d8c2 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1130,8 +1130,16 @@ void SdrMarkView::CheckMarked()
nm--;
SdrMark* pM=GetSdrMarkByIndex(nm);
SdrObject* pObj=pM->GetMarkedSdrObj();
+ // fix crash of #74651, when an object
+ // is selected and removed by macro
+ if (pObj == NULL) {
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ continue;
+ }
+
SdrPageView* pPV=pM->GetPageView();
SdrLayerID nLay=pObj->GetLayer();
+
bool bRaus=!pObj->IsInserted(); // Obj deleted?
if (!pObj->Is3DObj()) {
bRaus=bRaus || pObj->GetPage()!=pPV->GetPage(); // Obj suddenly in different Page or Group
@@ -1917,15 +1925,18 @@ const Rectangle& SdrMarkView::GetMarkedObjRect() const
for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
SdrMark* pM=GetSdrMarkByIndex(nm);
SdrObject* pO=pM->GetMarkedSdrObj();
- Rectangle aR1(pO->GetSnapRect());
- // apply calc offset to marked object rect
- // ( necessary for handles to be displayed in
- // correct position )
- if (aRect2.IsEmpty()) aRect2=aR1;
- else aRect2.Union( aR1 );
- aR1 += pO->GetGridOffset();
- if (aRect.IsEmpty()) aRect=aR1;
- else aRect.Union(aR1);
+ // fix crash of #74651
+ if (pO != NULL) {
+ Rectangle aR1(pO->GetSnapRect());
+ // apply calc offset to marked object rect
+ // ( necessary for handles to be displayed in
+ // correct position )
+ if (aRect2.IsEmpty()) aRect2=aR1;
+ else aRect2.Union( aR1 );
+ aR1 += pO->GetGridOffset();
+ if (aRect.IsEmpty()) aRect=aR1;
+ else aRect.Union(aR1);
+ }
}
((SdrMarkView*)this)->aMarkedObjRect=aRect;
((SdrMarkView*)this)->aMarkedObjRectNoOffset=aRect2;
@@ -2013,7 +2024,7 @@ void SdrMarkView::MarkListHasChanged()
sal_Bool bOneEdgeMarked=sal_False;
if (GetMarkedObjectCount()==1) {
const SdrObject* pObj=GetMarkedObjectByIndex(0);
- if (pObj->GetObjInventor()==SdrInventor) {
+ if ((pObj != NULL) && (pObj->GetObjInventor()==SdrInventor)) {
sal_uInt16 nIdent=pObj->GetObjIdentifier();
bOneEdgeMarked=nIdent==OBJ_EDGE;
}
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
index 00a2da73e55d..791e52dc261a 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -323,6 +323,13 @@ void SdrMarkView::UndirtyMrkPnt() const
for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
const SdrObject* pObj=pM->GetMarkedSdrObj();
+
+ // fix crash of #74651, when an object
+ // is selected and removed by macro
+ if (pObj == NULL) {
+ continue;
+ }
+
// PolyPoints
SdrUShortCont* pPts=pM->GetMarkedPoints();
if (pPts!=NULL) {
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 4cd98006ff1e..763c3d6cf16d 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -40,6 +40,9 @@
#include <svx/svdopath.hxx>
#include "svx/unoapi.hxx"
#include <svx/svdomeas.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdglob.hxx>
+#include <svx/svdstr.hrc>
#include <svx/extrud3d.hxx>
#include <svx/lathe3d.hxx>
#include <vcl/svapp.hxx>
@@ -260,6 +263,7 @@ void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
if( (mpModel == 0) || (mpPage == 0) )
throw lang::DisposedException();
+ mpModel->BegUndo( ImpGetResStr( STR_EditDelete ) );
SvxShape* pShape = SvxShape::getImplementation( xShape );
if(pShape)
@@ -273,7 +277,10 @@ void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
{
if(mpPage->GetObj(nNum) == pObj)
{
+ SdrUndoAction * action = mpModel->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj );
+ mpModel->AddUndo(action);
OSL_VERIFY( mpPage->RemoveObject( nNum ) == pObj );
+ pShape->InvalidateSdrObject();
SdrObject::Free( pObj );
break;
}
@@ -281,8 +288,10 @@ void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
}
}
- if( mpModel )
+ if( mpModel ){
mpModel->SetChanged();
+ mpModel->EndUndo();
+ }
}
//----------------------------------------------------------------------