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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 19 14:30:26 UTC 2019


 sc/source/ui/docshell/docsh4.cxx |   66 ++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 31 deletions(-)

New commits:
commit d28924afbd15cf9fec9ef00708595b55e95bb0aa
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 12:27:22 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Sep 19 16:29:41 2019 +0200

    make format->page dialog async
    
    Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7
    Reviewed-on: https://gerrit.libreoffice.org/66074
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit b7baedb4d0df3f1421e701d2a943d947dfb67010)
    Reviewed-on: https://gerrit.libreoffice.org/79125
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 6c08b6a234cd..319481947672 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1703,46 +1703,50 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller,
                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
 
                         vcl::Window* pParent = GetActiveDialogParent();
-                        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg(pParent ? pParent->GetFrameWeld() : nullptr, *pStyleSheet, true));
+                        VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg(pParent ? pParent->GetFrameWeld() : nullptr, *pStyleSheet, true));
 
-                        if ( pDlg->Execute() == RET_OK )
-                        {
-                            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+                        std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
+                        rReq.Ignore(); // the 'old' request is not relevant any more
+                        pDlg->StartExecuteAsync([this, pDlg, pRequest, pStyleSheet, aOldData, aOldName, &rStyleSet, nCurTab, &rCaller, bUndo](sal_Int32 nResult){
+                            if ( nResult == RET_OK )
+                            {
+                                const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
 
-                            WaitObject aWait( GetActiveDialogParent() );
+                                WaitObject aWait( GetActiveDialogParent() );
 
-                            OUString aNewName = pStyleSheet->GetName();
-                            if ( aNewName != aOldName &&
-                                m_aDocument.RenamePageStyleInUse( aOldName, aNewName ) )
-                            {
-                                SfxBindings* pBindings = GetViewBindings();
-                                if (pBindings)
+                                OUString aNewName = pStyleSheet->GetName();
+                                if ( aNewName != aOldName &&
+                                    m_aDocument.RenamePageStyleInUse( aOldName, aNewName ) )
                                 {
-                                    pBindings->Invalidate( SID_STATUS_PAGESTYLE );
-                                    pBindings->Invalidate( FID_RESET_PRINTZOOM );
+                                    SfxBindings* pBindings = GetViewBindings();
+                                    if (pBindings)
+                                    {
+                                        pBindings->Invalidate( SID_STATUS_PAGESTYLE );
+                                        pBindings->Invalidate( FID_RESET_PRINTZOOM );
+                                    }
                                 }
-                            }
 
-                            if ( pOutSet )
-                                m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
+                                if ( pOutSet )
+                                    m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
 
-                            // memorizing for GetState():
-                            GetPageOnFromPageStyleSet( &rStyleSet, nCurTab, m_bHeaderOn, m_bFooterOn );
-                            rCaller.GetViewFrame()->GetBindings().Invalidate( SID_HFEDIT );
+                                // memorizing for GetState():
+                                GetPageOnFromPageStyleSet( &rStyleSet, nCurTab, m_bHeaderOn, m_bFooterOn );
+                                rCaller.GetViewFrame()->GetBindings().Invalidate( SID_HFEDIT );
 
-                            ScStyleSaveData aNewData;
-                            aNewData.InitFromStyle( pStyleSheet );
-                            if (bUndo)
-                            {
-                                GetUndoManager()->AddUndoAction(
-                                        o3tl::make_unique<ScUndoModifyStyle>( this, SfxStyleFamily::Page,
-                                                    aOldData, aNewData ) );
-                            }
+                                ScStyleSaveData aNewData;
+                                aNewData.InitFromStyle( pStyleSheet );
+                                if (bUndo)
+                                {
+                                    GetUndoManager()->AddUndoAction(
+                                            o3tl::make_unique<ScUndoModifyStyle>( this, SfxStyleFamily::Page,
+                                                        aOldData, aNewData ) );
+                                }
 
-                            PageStyleModified( aNewName, false );
-                            rReq.Done();
-                        }
-                        pDlg.disposeAndClear();
+                                PageStyleModified( aNewName, false );
+                                pRequest->Done();
+                                pDlg->disposeOnce();
+                            }
+                        });
                     }
                 }
             }


More information about the Libreoffice-commits mailing list