diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2018-06-21 15:51:05 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-06-29 10:26:30 +0200 |
commit | 3f3c16e433f727bf52a6f894956b489187ab6dce (patch) | |
tree | 8cfb2fcc00d7c21aaf24195aaf81dc6e917fd65b /sd/source/ui/func | |
parent | cb000556d49ba4a9bdf7d9fb4d05069291a41665 (diff) |
tdf#115233 Don't reset crop when replacing a graphic
When passing DND_ACTION_MOVE to View::InsertGraphic, the whole object gets
replaced. DND_ACTION_LINK should be used, because it just replaces the
graphic and keeps crop information.
Marking the object is not needed, because InsertObjectAtView and
ReplaceObjectAtView already take care of that.
Change-Id: I0d829ec39a9d484a7c8946252e90eddb12ea9756
Reviewed-on: https://gerrit.libreoffice.org/56401
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sd/source/ui/func')
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 393bc24bcda2..8743db87416e 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -170,18 +170,13 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { sal_Int8 nAction = DND_ACTION_COPY; - SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC ); - bool bSelectionReplaced(false); + SdrObject* pPickObj; - if( pPickObj ) + if( ( ( pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() ) ) && mbReplaceExistingImage ) || (pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC ) ) ) { nAction = DND_ACTION_LINK; - } - else if(mbReplaceExistingImage && mpView->GetMarkedObjectCount() == 1) - { - pPickObj = mpView->GetMarkedObjectByIndex(0); - nAction = DND_ACTION_MOVE; - bSelectionReplaced = true; + } else { + pPickObj = nullptr; } Point aPos = mpWindow->GetVisibleCenter(); @@ -204,11 +199,6 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) } pGrafObj->SetGraphicLink(aFileName, aReferer, aFilterName); } - - if(bSelectionReplaced && pGrafObj) - { - mpView->MarkObj(pGrafObj, mpView->GetSdrPageView()); - } } } else |