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

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 27 21:39:20 UTC 2019


 sc/source/ui/drawfunc/drawsh.cxx    |   26 ++++++++++------
 sw/source/uibase/shells/drawdlg.cxx |   56 +++++++++++++++++++++---------------
 sw/source/uibase/shells/frmsh.cxx   |   52 +++++++++++++++++----------------
 3 files changed, 76 insertions(+), 58 deletions(-)

New commits:
commit b82fdec369449e87df24acc8fa0daa54f2aeb4da
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Thu Jun 27 18:06:06 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Thu Jun 27 23:38:01 2019 +0200

    lokdialog: Convert the Format -> ... -> Area... to async exec.
    
    For sw and sc
    
    Change-Id: I83ad76658545d8df135e1a08abff4d0b5a81b46a
    Reviewed-on: https://gerrit.libreoffice.org/74808
    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 66b776f2f9e0..1f31a09cf439 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -404,26 +404,32 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq )
     ScDrawView* pView       = pViewData->GetScDrawView();
     bool        bHasMarked  = pView->AreObjectsMarked();
 
+    std::shared_ptr<SfxRequest> pRequest;
+    pRequest.reset(new SfxRequest(rReq));
+
     SfxItemSet  aNewAttr( pView->GetDefaultAttr() );
     if( bHasMarked )
         pView->MergeAttrFromMarked( aNewAttr, false );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     weld::Window* pWin = pViewData->GetDialogParent();
-    ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
+    VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
         pWin, &aNewAttr,
         pViewData->GetDocument()->GetDrawLayer(), true));
 
-    if ( pDlg->Execute() == RET_OK )
-    {
-        if( bHasMarked )
-            pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), false );
-        else
-            pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), false );
+    pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+        if ( nResult == RET_OK )
+        {
+            if( bHasMarked )
+                pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), false );
+            else
+                pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), false );
 
-        pView->InvalidateAttribs();
-        rReq.Done();
-    }
+            pView->InvalidateAttribs();
+            pRequest->Done();
+        }
+        pDlg->disposeOnce();
+    });
 }
 
 void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq )
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index ca2035850536..c2232bfa413b 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -93,34 +93,44 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
             bool bHasMarked = pView->AreObjectsMarked();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-            ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(rReq.GetFrameWeld(),
+            VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(rReq.GetFrameWeld(),
                                                                             &aNewAttr,
                                                                             pDoc,
                                                                             true));
-            if (pDlg->Execute() == RET_OK)
-            {
-                pSh->StartAction();
-                if (bHasMarked)
-                    pView->SetAttributes(*pDlg->GetOutputItemSet());
-                else
-                    pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
-                pSh->EndAction();
 
-                static sal_uInt16 aInval[] =
+            pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                if (nResult == RET_OK)
                 {
-                    SID_ATTR_FILL_STYLE,
-                    SID_ATTR_FILL_COLOR,
-                    SID_ATTR_FILL_TRANSPARENCE,
-                    SID_ATTR_FILL_FLOATTRANSPARENCE,
-                    0
-                };
-                SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
-                rBnd.Invalidate(aInval);
-                rBnd.Update(SID_ATTR_FILL_STYLE);
-                rBnd.Update(SID_ATTR_FILL_COLOR);
-                rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
-                rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
-            }
+                    pSh->StartAction();
+                    if (bHasMarked)
+                        pView->SetAttributes(*pDlg->GetOutputItemSet());
+                    else
+                        pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
+                    pSh->EndAction();
+
+                    static sal_uInt16 aInval[] =
+                    {
+                        SID_ATTR_FILL_STYLE,
+                        SID_ATTR_FILL_COLOR,
+                        SID_ATTR_FILL_TRANSPARENCE,
+                        SID_ATTR_FILL_FLOATTRANSPARENCE,
+                        0
+                    };
+                    SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
+                    rBnd.Invalidate(aInval);
+                    rBnd.Update(SID_ATTR_FILL_STYLE);
+                    rBnd.Update(SID_ATTR_FILL_COLOR);
+                    rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
+                    rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
+                }
+
+                if (pDoc->IsChanged())
+                    GetShell().SetModified();
+                else if (bChanged)
+                    pDoc->SetChanged();
+
+                pDlg->disposeOnce();
+            });
         }
         break;
 
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 41a6994204ed..31f1cc9ff4d4 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1343,42 +1343,44 @@ void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest const & rReq)
 
             if(rSh.IsFrameSelected())
             {
-                SdrView* pView = rSh.GetDrawView();
-                SdrModel* pDoc = pView->GetModel();
+                SdrModel* pDoc = rSh.GetDrawView()->GetModel();
                 SfxItemSet aNewAttr(pDoc->GetItemPool());
 
                 // get attributes from FlyFrame
                 rSh.GetFlyFrameAttr(aNewAttr);
 
                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-                ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
-                    nullptr,
+                VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
+                    GetView().GetFrameWeld(),
                     &aNewAttr,
                     pDoc,
                     false));
 
-                if(RET_OK == pDlg->Execute())
-                {
-                    // set attributes at FlyFrame
-                    rSh.SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
-
-                    static sal_uInt16 aInval[] =
+                pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                    if(nResult == RET_OK)
                     {
-                        SID_ATTR_FILL_STYLE,
-                        SID_ATTR_FILL_COLOR,
-                        SID_ATTR_FILL_TRANSPARENCE,
-                        SID_ATTR_FILL_FLOATTRANSPARENCE,
-                        0
-                    };
-
-                    SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
-
-                    rBnd.Invalidate(aInval);
-                    rBnd.Update(SID_ATTR_FILL_STYLE);
-                    rBnd.Update(SID_ATTR_FILL_COLOR);
-                    rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
-                    rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
-                }
+                        // set attributes at FlyFrame
+                        GetShell().SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
+
+                        static sal_uInt16 aInval[] =
+                        {
+                            SID_ATTR_FILL_STYLE,
+                            SID_ATTR_FILL_COLOR,
+                            SID_ATTR_FILL_TRANSPARENCE,
+                            SID_ATTR_FILL_FLOATTRANSPARENCE,
+                            0
+                        };
+
+                        SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
+
+                        rBnd.Invalidate(aInval);
+                        rBnd.Update(SID_ATTR_FILL_STYLE);
+                        rBnd.Update(SID_ATTR_FILL_COLOR);
+                        rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
+                        rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
+                    }
+                    pDlg->disposeOnce();
+                });
             }
 
             break;


More information about the Libreoffice-commits mailing list