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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 11 10:31:48 UTC 2019


 sd/source/ui/func/fuolbull.cxx |   73 +++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 34 deletions(-)

New commits:
commit a2b78c131db2bbe3555a89dfae32aefcd00949f5
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 11 11:31:25 2019 +0100

    make Format->Bullets and Numbering dialog async
    
    Change-Id: Ib69c2be7c8ddaa616c08796ad2b8c8cf20ee2db9
    Reviewed-on: https://gerrit.libreoffice.org/66098
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 286d95a8cd1a..14dc697e71be 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -70,53 +70,58 @@ 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(),
+    // fill ItemSet for Dialog
+    SfxItemSet aEditAttr( mpDoc->GetPool() );
+    mpView->GetAttributes( aEditAttr );
+
+    SfxItemSet aNewAttr( mpViewShell->GetPool(),
                              svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
-        aNewAttr.Put( aEditAttr, false );
+    aNewAttr.Put( aEditAttr, false );
 
-        // create and execute dialog
-        SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetFrameWeld(), &aNewAttr, mpView) );
-        if ( pPageItem )
-            pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
-        sal_uInt16 nResult = pDlg->Execute();
+    // create and execute dialog
+    SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+    VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetFrameWeld(), &aNewAttr, mpView) );
+    if ( pPageItem )
+        pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
 
-        if( nResult != RET_OK )
-            return;
+    std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq));
+    rReq.Ignore(); // the 'old' request is not relevant any more
 
-        SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+    pDlg->StartExecuteAsync([this, pDlg, xRequest](sal_Int32 nResult){
 
-        OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+        if( nResult == RET_OK )
+        {
+            SfxItemSet aSet( *pDlg->GetOutputItemSet() );
 
-        std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
+            OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
 
-        if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView))
-        {
-            pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow());
-            aGuard.reset(new OutlineViewModelChangeGuard(*pView));
-        }
+            std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
 
-        if( pOLV )
-            pOLV->EnableBullets();
+            if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView))
+            {
+                pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow());
+                aGuard.reset(new OutlineViewModelChangeGuard(*pView));
+            }
 
-        rReq.Done( aSet );
-        pArgs = rReq.GetArgs();
-    }
+            if( pOLV )
+                pOLV->EnableBullets();
 
-    /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
-       changes to master page and redirect to a template */
-    mpView->SetAttributes(*pArgs);
+            xRequest->Done( aSet );
 
-/* #i35937#
-    // invalidate possible affected fields
-    mpViewShell->Invalidate( FN_NUM_BULLET_ON );
-*/
+            /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
+               changes to master page and redirect to a template */
+            mpView->SetAttributes(*xRequest->GetArgs());
+        }
+        pDlg->disposeOnce();
+    });
 }
 
 void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)


More information about the Libreoffice-commits mailing list