summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMaxime de Roucy <mderoucy@linagora.com>2014-01-07 09:31:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-25 10:00:50 +0000
commit32c28a6d131284c1602f57a8220d1b736b538288 (patch)
tree0db044bb4c8510f3500140d9e559f7f1c6f74cdc /svx
parenta3b68ba2dea21f9af1cab90c549c75d25afa1f5a (diff)
Resolves: #i74651# remove image via should change document state
Now when an image is removed from a Calc document using the API it changes the modified state of the document. Change-Id: I5dad550ec78a12227f3fb04fd934c7d0c5066a9f Reviewed-on: https://gerrit.libreoffice.org/7286 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unopage.cxx33
1 files changed, 26 insertions, 7 deletions
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 0ede8d07190d..3dde9efcc47d 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -32,10 +32,13 @@
#include <svx/svdoole2.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/svdstr.hrc>
#include <svx/svdview.hxx>
#include <svx/svdpagv.hxx>
+#include <svx/svdundo.hxx>
#include <svx/unopage.hxx>
#include "shapeimpl.hxx"
+#include "svdglob.hxx"
#include "svx/globl3d.hxx"
#include <svx/polysc3d.hxx>
#include <svx/unoprov.hxx>
@@ -285,27 +288,43 @@ void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
SvxShape* pShape = SvxShape::getImplementation( xShape );
- if(pShape)
+ if (pShape)
{
- SdrObject* pObj = pShape->GetSdrObject();
- if(pObj)
+ SdrObject* pObj = pShape->GetSdrObject();
+ if (pObj)
{
- // SdrObject aus der Page loeschen
+ // remove SdrObject from page
sal_uInt32 nCount = mpPage->GetObjCount();
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++ )
{
if(mpPage->GetObj(nNum) == pObj)
{
+ const bool bUndoEnabled = mpModel->IsUndoEnabled();
+
+ if (bUndoEnabled)
+ {
+ mpModel->BegUndo(ImpGetResStr(STR_EditDelete),
+ pObj->TakeObjNameSingul(), SDRREPFUNC_OBJ_DELETE);
+
+ SdrUndoAction * pAction = mpModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj);
+ mpModel->AddUndo(pAction);
+ }
+
OSL_VERIFY( mpPage->RemoveObject( nNum ) == pObj );
- SdrObject::Free( pObj );
+
+ if (!bUndoEnabled)
+ SdrObject::Free(pObj);
+
+ if (bUndoEnabled)
+ mpModel->EndUndo();
+
break;
}
}
}
}
- if( mpModel )
- mpModel->SetChanged();
+ mpModel->SetChanged();
}
// ::com::sun::star::container::XIndexAccess