[Libreoffice-commits] core.git: Branch 'libreoffice-5-2-0' - sd/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Thu Jul 28 21:54:05 UTC 2016
sd/source/ui/func/fuinsert.cxx | 17 ++++++++++-------
sd/source/ui/inc/fuinsert.hxx | 9 +++++++--
sd/source/ui/view/drviews2.cxx | 3 ++-
3 files changed, 19 insertions(+), 10 deletions(-)
New commits:
commit 6033d910aa7a6ac7f9ce477d59df6c4766128a59
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Tue Jul 5 12:05:28 2016 +0000
tdf#73742 Don't replace existing image when inserting one
If we want to replace an image, we have an entry in the context menu for that.
Change-Id: I7a5326fecb72896c0709c9272769b8d51e4a5ca2
Reviewed-on: https://gerrit.libreoffice.org/26947
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
(cherry picked from commit fd6655080e181de4b78e31f13fe8ba35de8edfe5)
Reviewed-on: https://gerrit.libreoffice.org/27114
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 63410aa..a26a6b1 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -98,14 +98,17 @@ FuInsertGraphic::FuInsertGraphic (
::sd::Window* pWin,
::sd::View* pView,
SdDrawDocument* pDoc,
- SfxRequest& rReq)
- : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+ SfxRequest& rReq,
+ bool replaceExistingImage)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ mbReplaceExistingImage(replaceExistingImage)
{
}
-rtl::Reference<FuPoor> FuInsertGraphic::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+rtl::Reference<FuPoor> FuInsertGraphic::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq, bool replaceExistingImage )
{
- rtl::Reference<FuPoor> xFunc( new FuInsertGraphic( pViewSh, pWin, pView, pDoc, rReq ) );
+ rtl::Reference<FuPoor> xFunc( new FuInsertGraphic( pViewSh, pWin, pView, pDoc, rReq, replaceExistingImage ) );
xFunc->DoExecute(rReq);
return xFunc;
}
@@ -153,14 +156,14 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
{
sal_Int8 nAction = DND_ACTION_COPY;
- SdrObject* pPickObj;
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
bool bSelectionReplaced(false);
- if( ( pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() ) ) || ( pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC ) ) )
+ if( pPickObj )
{
nAction = DND_ACTION_LINK;
}
- else if(1 == mpView->GetMarkedObjectCount())
+ else if(mbReplaceExistingImage && mpView->GetMarkedObjectCount() == 1)
{
pPickObj = mpView->GetMarkedObjectByIndex(0);
nAction = DND_ACTION_MOVE;
diff --git a/sd/source/ui/inc/fuinsert.hxx b/sd/source/ui/inc/fuinsert.hxx
index 74e251a..2a946e8 100644
--- a/sd/source/ui/inc/fuinsert.hxx
+++ b/sd/source/ui/inc/fuinsert.hxx
@@ -30,7 +30,9 @@ class FuInsertGraphic
{
public:
- static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin,
+ ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq,
+ bool replaceExistingImage);
virtual void DoExecute( SfxRequest& rReq ) override;
private:
@@ -40,7 +42,10 @@ private:
::sd::Window* pWin,
::sd::View* pView,
SdDrawDocument* pDoc,
- SfxRequest& rReq);
+ SfxRequest& rReq,
+ bool replaceExistingImage);
+
+ bool mbReplaceExistingImage;
};
/************************************************************************/
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 6a88b01..8d4ebec 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1114,7 +1114,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_CHANGE_PICTURE:
case SID_INSERT_GRAPHIC:
{
- SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq,
+ nSId == SID_CHANGE_PICTURE ) );
Cancel();
rReq.Ignore ();
}
More information about the Libreoffice-commits
mailing list