[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - sc/source sw/source

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 29 14:16:00 UTC 2019


 sc/source/ui/drawfunc/drawsh.cxx    |   50 +++++++++------
 sw/source/uibase/shells/drawdlg.cxx |  114 ++++++++++++++++++++----------------
 sw/source/uibase/shells/frmsh.cxx   |   13 ++--
 3 files changed, 102 insertions(+), 75 deletions(-)

New commits:
commit 368727a8a27b41820488684548e73f1fe973a67e
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Wed Jun 26 21:52:33 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Jun 29 16:15:26 2019 +0200

    lokdialog: Convert the Format -> ... -> Line... to async exec
    
    For sw and sc
    
    Change-Id: If89bff982d16ba8d4e4524445e56ee2fe23d7876
    Reviewed-on: https://gerrit.libreoffice.org/74880
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Tested-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 379d9cf35602..07216e1747b4 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -383,6 +383,9 @@ void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq )
     const SdrObject*    pObj        = nullptr;
     const SdrMarkList&  rMarkList   = pView->GetMarkedObjectList();
 
+    std::shared_ptr<SfxRequest> pRequest;
+    pRequest.reset(new SfxRequest(rReq));
+
     if( rMarkList.GetMarkCount() == 1 )
         pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
 
@@ -392,23 +395,25 @@ void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq )
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     OSL_ENSURE(pFact, "Dialog creation failed!");
-    ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(),
+    VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(),
                 &aNewAttr,
             pViewData->GetDocument()->GetDrawLayer(),
             pObj,
             bHasMarked));
     OSL_ENSURE(pDlg, "Dialog creation failed!");
 
-    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();
+        }
+    });
 }
 
 void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq )
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 8527944f62aa..dbf314c08fd9 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -127,37 +127,45 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             OSL_ENSURE(pFact, "Dialog creation failed!");
-            ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( nullptr,
+            VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( &GetView().GetFrame()->GetWindow(),
                     &aNewAttr,
                 pDoc,
                 pObj,
                 bHasMarked));
             OSL_ENSURE(pDlg, "Dialog creation failed!");
-            if (pDlg->Execute() == RET_OK)
-            {
-                pSh->StartAction();
-                if(bHasMarked)
-                    pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), false);
-                else
-                    pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
-                pSh->EndAction();
-
-                static sal_uInt16 aInval[] =
+
+            pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                if (nResult == RET_OK)
                 {
-                    SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
-                    SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
-                    SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
-                    SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
-                    SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
-                    SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
-                    SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
-                    SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
-                    SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
-                    0
-                };
-
-                GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
-            }
+                    pSh->StartAction();
+                    if(bHasMarked)
+                        pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), false);
+                    else
+                        pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
+                    pSh->EndAction();
+
+                    static sal_uInt16 aInval[] =
+                    {
+                        SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
+                        SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
+                        SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
+                        SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
+                        SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
+                        SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
+                        SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
+                        SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
+                        SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
+                        0
+                    };
+
+                    GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
+                }
+
+                if (pDoc->IsChanged())
+                    GetShell().SetModified();
+                else if (bChanged)
+                    pDoc->SetChanged();
+            });
         }
         break;
 
commit efa8749743dbd0d08f3d317b82f765364cd1d994
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Tue Jun 25 23:49:54 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Jun 29 16:15:08 2019 +0200

    lokdialog: Convert the Format -> ... -> Area... to async exec.
    
    For sw and sc.
    
    Change-Id: I83ad76658545d8df135e1a08abff4d0b5a81b46a
    Reviewed-on: https://gerrit.libreoffice.org/74879
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Tested-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 6fbbabae8315..379d9cf35602 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -416,25 +416,30 @@ 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();
-    ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
+    VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
         pViewData->GetDialogParent(), &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();
+        }
+    });
 }
 
 void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq )
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 1b349911354a..8527944f62aa 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -77,34 +77,42 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
             bool bHasMarked = pView->AreObjectsMarked();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-            ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( &GetView().GetViewFrame()->GetWindow(),
+            VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( &GetView().GetViewFrame()->GetWindow(),
                                                                             &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();
+            });
         }
         break;
 
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 8a5ddeefffd6..3bf07359d1f3 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1318,8 +1318,7 @@ 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
@@ -1327,17 +1326,18 @@ void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest const & rReq)
 
                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
                 assert(pFact);
-                ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
-                    nullptr,
+                VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
+                    &GetView().GetViewFrame()->GetWindow(),
                     &aNewAttr,
                     pDoc,
                     false));
                 assert(pDlg);
 
-                if(RET_OK == pDlg->Execute())
+                pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                if(RET_OK == nResult)
                 {
                     // set attributes at FlyFrame
-                    rSh.SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
+                    GetShell().SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
 
                     static sal_uInt16 aInval[] =
                     {
@@ -1356,6 +1356,7 @@ void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest const & rReq)
                     rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
                     rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
                 }
+                });
             }
 
             break;


More information about the Libreoffice-commits mailing list