[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sd/source

Jan Holesovsky kendy at collabora.com
Thu Mar 15 16:16:03 UTC 2018


 sd/source/ui/func/fuarea.cxx   |    9 +++------
 sd/source/ui/func/fuline.cxx   |    8 ++------
 sd/source/ui/func/futransf.cxx |   27 +--------------------------
 sd/source/ui/view/drviews2.cxx |   12 +++++++++---
 4 files changed, 15 insertions(+), 41 deletions(-)

New commits:
commit 37c5cfe4a6c8c986eadb8c05d31d0ef3d360f271
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 15 16:04:05 2018 +0100

    tdf#115675: Shape selection was breaking when changing pos/size from sidebar.
    
    Fixes also other potential breakages with the same root cause.
    
    Change-Id: I09b3650189f6edb28ab64652cd411b1dca7dca89
    Reviewed-on: https://gerrit.libreoffice.org/51341
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx
index da77b647a84d..bd9bd91f9fae 100644
--- a/sd/source/ui/func/fuarea.cxx
+++ b/sd/source/ui/func/fuarea.cxx
@@ -56,10 +56,7 @@ void FuArea::DoExecute( SfxRequest& rReq )
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     if (pArgs)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     SfxItemSet aNewAttr( mpDoc->GetPool() );
     mpView->GetAttributes( aNewAttr );
@@ -67,10 +64,7 @@ void FuArea::DoExecute( SfxRequest& rReq )
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) : nullptr);
     if (!pDlg)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -90,6 +84,9 @@ void FuArea::DoExecute( SfxRequest& rReq )
 
             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
         }
+
+        // deferred until the dialog ends
+        mpViewShell->Cancel();
     });
 }
 
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
index 046d2f4387f8..9d844b292dce 100644
--- a/sd/source/ui/func/fuline.cxx
+++ b/sd/source/ui/func/fuline.cxx
@@ -64,10 +64,7 @@ void FuLine::DoExecute( SfxRequest& rReq )
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     if (pArgs)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     const SdrObject* pObj = nullptr;
     const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
@@ -81,10 +78,7 @@ void FuLine::DoExecute( SfxRequest& rReq )
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     VclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(mpViewShell->GetActiveWindow(), pNewAttr.get(), mpDoc, pObj, bHasMarked) : nullptr);
     if (!pDlg)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -106,6 +100,8 @@ void FuLine::DoExecute( SfxRequest& rReq )
 
             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
         }
+
+        // deferred until the dialog ends
         mpViewShell->Cancel();
     });
 }
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index 2ed5bdd8ac7d..c0549b30a4ca 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -63,35 +63,10 @@ void setUndo(::sd::View* pView, const SfxItemSet* pArgs)
     pView->EndUndo();
 }
 
-class ScopeCleanup
-{
-    ViewShell* mpViewShell;
-public:
-    ScopeCleanup(ViewShell* pViewShell) : mpViewShell(pViewShell)
-    {
-    }
-
-    ~ScopeCleanup()
-    {
-        if (mpViewShell)
-        {
-            mpViewShell->Invalidate(SID_RULER_OBJECT);
-            mpViewShell->Cancel();
-        }
-    }
-
-    void ignore()
-    {
-        mpViewShell = nullptr;
-    }
-};
-
 }
 
 void FuTransform::DoExecute( SfxRequest& rReq )
 {
-    ScopeCleanup aCleanup(mpViewShell);
-
     if (!mpView->AreObjectsMarked())
         return;
 
@@ -143,7 +118,6 @@ void FuTransform::DoExecute( SfxRequest& rReq )
 
     std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
     rReq.Ignore(); // the 'old' request is not relevant any more
-    aCleanup.ignore(); // the lambda does it
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -152,6 +126,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
             setUndo(mpView, pRequest->GetArgs());
         }
 
+        // deferred until the dialog ends
         mpViewShell->Invalidate(SID_RULER_OBJECT);
         mpViewShell->Cancel();
     });
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 6e9bc31b03e0..df38a846a2c9 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1011,21 +1011,27 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTRIBUTES_LINE:  // BASIC
         {
             SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+                Cancel();
         }
         break;
 
         case SID_ATTRIBUTES_AREA:  // BASIC
         {
             SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+                Cancel();
         }
         break;
 
         case SID_ATTR_TRANSFORM:
         {
             SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() and Invalidate() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+            {
+                Invalidate(SID_RULER_OBJECT);
+                Cancel();
+            }
         }
         break;
 


More information about the Libreoffice-commits mailing list