[Libreoffice-commits] core.git: sc/source

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 28 23:39:51 UTC 2019


 sc/source/ui/drawfunc/drawsh.cxx |   67 ++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 25 deletions(-)

New commits:
commit c2cb467a1e5194c56bb65706b7965fb2c9241b8f
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Fri Jun 28 23:37:10 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Jun 29 01:39:04 2019 +0200

    lokdialog: Convert the Format -> Position and Size... to async exec for sc
    
    Change-Id: I715ed025d97de8eb69b6e9ba227b955b49add855
    Reviewed-on: https://gerrit.libreoffice.org/74861
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 701f7c970659..5e680fa598d7 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -92,6 +92,20 @@ static void lcl_setModified( const SfxObjectShell*  pShell )
     }
 }
 
+static void lcl_invalidateTransformAttr(const ScTabViewShell* pViewShell)
+{
+    SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings();
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH);
+    rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT);
+}
+
 void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 {
     sal_uInt16              nSlot       = rReq.GetSlot();
@@ -249,6 +263,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                         if( rMarkList.GetMark(0) != nullptr )
                         {
                             SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+                            std::shared_ptr<SfxRequest> pRequest;
+                            pRequest.reset(new SfxRequest(rReq));
+
                             if( pObj->GetObjIdentifier() == OBJ_CAPTION )
                             {
                                 // Caption Itemset
@@ -258,7 +275,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                                 SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked());
 
                                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-                                ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog(pWin ? pWin->GetFrameWeld() : nullptr, pView));
+                                VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog(pWin ? pWin->GetFrameWeld() : nullptr, pView));
 
                                 const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
                                 SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
@@ -266,23 +283,34 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                                 aCombSet.Put( aNewGeoAttr );
                                 pDlg->SetInputSet( &aCombSet );
 
-                                if (pDlg->Execute() == RET_OK)
-                                {
-                                    rReq.Done(*(pDlg->GetOutputItemSet()));
-                                    pView->SetAttributes(*pDlg->GetOutputItemSet());
-                                    pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
-                                }
+                                pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                                    if (nResult == RET_OK)
+                                    {
+                                        pRequest->Done(*(pDlg->GetOutputItemSet()));
+                                        pView->SetAttributes(*pDlg->GetOutputItemSet());
+                                        pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
+                                    }
+
+                                    lcl_invalidateTransformAttr(pViewData->GetViewShell());
+                                    pDlg->disposeOnce();
+                                });
                             }
                             else
                             {
                                 SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked());
                                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-                                ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog(pWin ? pWin->GetFrameWeld() : nullptr, &aNewAttr, pView));
-                                if (pDlg->Execute() == RET_OK)
-                                {
-                                    rReq.Done(*(pDlg->GetOutputItemSet()));
-                                    pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
-                                }
+                                VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog(pWin ? pWin->GetFrameWeld() : nullptr, &aNewAttr, pView));
+
+                                pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                                    if (nResult == RET_OK)
+                                    {
+                                        pRequest->Done(*(pDlg->GetOutputItemSet()));
+                                        pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
+                                    }
+
+                                    lcl_invalidateTransformAttr(pViewData->GetViewShell());
+                                    pDlg->disposeOnce();
+                                });
                             }
                         }
 
@@ -291,18 +319,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                         pView->SetGeoAttrToMarked( *pArgs );
                 }
 
-                ScTabViewShell* pViewShell = pViewData->GetViewShell();
-                SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings();
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH);
-                rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT);
-
+                lcl_invalidateTransformAttr(pViewData->GetViewShell());
             }
             break;
 


More information about the Libreoffice-commits mailing list