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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 18 13:34:33 UTC 2019


 sc/source/ui/docshell/docsh4.cxx |   24 ++++++----
 sc/source/ui/pagedlg/tphf.cxx    |   14 +++---
 sd/source/ui/func/fuolbull.cxx   |   86 +++++++++++++++++++--------------------
 3 files changed, 63 insertions(+), 61 deletions(-)

New commits:
commit 848496394b6852a41948162cd530f36af90ae71f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 14:31:21 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 18 14:34:21 2019 +0100

    make insert->header/footer dialogs async
    
    Reviewed-on: https://gerrit.libreoffice.org/66089
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 2281ade467e7dcc9652f74dbc4d9736100b0ad78)
    
    Change-Id: I0e8eac86280d42752db2d7bde8c6aecf452bad6c
    Reviewed-on: https://gerrit.libreoffice.org/66156
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Mert Tümer <mert.tumer at collabora.com>
    Tested-by: Mert Tümer <mert.tumer at collabora.com>

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 22097e55c52c..839cf0257617 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1810,22 +1810,26 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller,
                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg(
+                        VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg(
                                                                                 GetActiveDialogParent(),
                                                                                 rStyleSet,
                                                                                 aStr,
                                                                                 nResId));
-                        OSL_ENSURE(pDlg, "Dialog create fail!");
-                        if ( pDlg->Execute() == RET_OK )
-                        {
-                            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+                        std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq));
+                        rReq.Ignore(); // the 'old' request is not relevant any more
+                        pDlg->StartExecuteAsync([this, pDlg, pStyleSheet, xRequest](sal_Int32 nResult){
+                            if ( nResult == RET_OK )
+                            {
+                                const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
 
-                            if ( pOutSet )
-                                m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
+                                if ( pOutSet )
+                                    m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
 
-                            SetDocumentModified();
-                            rReq.Done();
-                        }
+                                SetDocumentModified();
+                                xRequest->Done();
+                                pDlg->disposeOnce();
+                            }
+                        });
                     }
                 }
             }
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index 5a810ac498e3..a4a95e134990 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -189,14 +189,14 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg(
+        VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg(
             this, aDataSet, aStrPageStyle, nResId));
-
-        OSL_ENSURE(pDlg, "Dialog create fail!");
-        if ( pDlg->Execute() == RET_OK )
-        {
-            aDataSet.Put( *pDlg->GetOutputItemSet() );
-        }
+        pDlg->StartExecuteAsync([this, pDlg](sal_Int32 nResult){
+            if ( nResult == RET_OK )
+            {
+                aDataSet.Put( *pDlg->GetOutputItemSet() );
+            }
+        });
     }
     else
     {
commit 2a43ffd305122c3397b23f49dfa378787e65f8a2
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 14:54:02 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 18 14:34:08 2019 +0100

    make Format->Bullets and Numbering dialog async
    
    this includes
        commit 84acbfd2ef8a895d8689fccfffce03df02240b4e
        Date:   Wed Jan 16 08:56:44 2019 +0200
        fix crash in draw Format->Bullets and Numbering dialog
    
    Reviewed-on: https://gerrit.libreoffice.org/66098
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit a2b78c131db2bbe3555a89dfae32aefcd00949f5)
    
    Change-Id: Ib69c2be7c8ddaa616c08796ad2b8c8cf20ee2db9
    Reviewed-on: https://gerrit.libreoffice.org/66157
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Mert Tümer <mert.tumer at collabora.com>
    Tested-by: Mert Tümer <mert.tumer at collabora.com>

diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 5ef3fb1800fc..e5b35c3824be 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -70,63 +70,61 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq )
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxStringItem* pPageItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, FN_PARAM_1, false);
 
-    if ( !pArgs || pPageItem )
+    if ( pArgs && !pPageItem )
     {
-        // fill ItemSet for Dialog
-        SfxItemSet aEditAttr( mpDoc->GetPool() );
-        mpView->GetAttributes( aEditAttr );
+        /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
+           changes to master page and redirect to a template */
+        mpView->SetAttributes(*pArgs);
+        return;
+    }
 
-        SfxItemSet aNewAttr( mpViewShell->GetPool(),
-                             svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
-        aNewAttr.Put( aEditAttr, false );
+    // fill ItemSet for Dialog
+    SfxItemSet aEditAttr( mpDoc->GetPool() );
+    mpView->GetAttributes( aEditAttr );
 
-        // create and execute dialog
-        SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) : nullptr);
-        if( pDlg )
-        {
-            if ( pPageItem )
-                pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
-            sal_uInt16 nResult = pDlg->Execute();
+    SfxItemSet aNewAttr( mpViewShell->GetPool(),
+                             svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
+    aNewAttr.Put( aEditAttr, false );
 
-            switch( nResult )
-            {
-                case RET_OK:
-                {
-                    SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+    // create and execute dialog
+    SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+    VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) );
+    if ( pPageItem )
+        pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
 
-                    OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+    std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq));
+    rReq.Ignore(); // the 'old' request is not relevant any more
 
-                    std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
+    // do not capture this, because this will go way before the dialog finishes executing
+    auto pView = mpView;
+    auto pViewShell = mpViewShell;
+    pDlg->StartExecuteAsync([pView, pViewShell, pDlg, xRequest](sal_Int32 nResult){
 
-                    if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView))
-                    {
-                        pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow());
-                        aGuard.reset(new OutlineViewModelChangeGuard(*pView));
-                    }
+        if( nResult == RET_OK )
+        {
+            SfxItemSet aSet( *pDlg->GetOutputItemSet() );
 
-                    if( pOLV )
-                        pOLV->EnableBullets();
+            OutlinerView* pOLV = pView->GetTextEditOutlinerView();
 
-                    rReq.Done( aSet );
-                    pArgs = rReq.GetArgs();
-                }
-                break;
+            std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
 
-                default:
-                    return;
+            if (OutlineView* pOutlineView = dynamic_cast<OutlineView*>(pView))
+            {
+                pOLV = pOutlineView->GetViewByWindow(pViewShell->GetActiveWindow());
+                aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
             }
-        }
-    }
 
-    /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
-       changes to master page and redirect to a template */
-    mpView->SetAttributes(*pArgs);
+            if( pOLV )
+                pOLV->EnableBullets();
 
-/* #i35937#
-    // invalidate possible affected fields
-    mpViewShell->Invalidate( FN_NUM_BULLET_ON );
-*/
+            xRequest->Done( aSet );
+
+            /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
+               changes to master page and redirect to a template */
+            pView->SetAttributes(*xRequest->GetArgs());
+        }
+        pDlg->disposeOnce();
+    });
 }
 
 void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)


More information about the Libreoffice-commits mailing list