[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sd/source

Paul Trojahn paul.trojahn at gmail.com
Tue Jul 3 23:39:19 UTC 2018


 sd/source/ui/func/fuinsert.cxx |   18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

New commits:
commit f066b54fb4af1d3f08242d81dd08100b7266eaaf
Author: Paul Trojahn <paul.trojahn at gmail.com>
Date:   Thu Jun 21 15:51:05 2018 +0200

    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 at cib.de>
    (cherry picked from commit 3f3c16e433f727bf52a6f894956b489187ab6dce)
    Reviewed-on: https://gerrit.libreoffice.org/56838
    Reviewed-by: Paul Trojahn <paul.trojahn at gmail.com>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index e0ad64bd7169..39d3e89458c1 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -156,18 +156,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;
@@ -203,11 +198,6 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
                 }
                 pGrafObj->SetGraphicLink(aFileName, aReferer, aFilterName);
             }
-
-            if(bSelectionReplaced && pGrafObj)
-            {
-                mpView->MarkObj(pGrafObj, mpView->GetSdrPageView());
-            }
         }
     }
     else


More information about the Libreoffice-commits mailing list