sc/source/ui/docshell/docsh4.cxx | 66 ++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 31 deletions(-)
New commits: commit b7baedb4d0df3f1421e701d2a943d947dfb67010 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jan 10 12:27:22 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 10 15:25:25 2019 +0100 make format->page dialog async Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7 Reviewed-on: https://gerrit.libreoffice.org/66074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index c05d552ffa19..66a7048fd3b0 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1693,46 +1693,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(); + } + }); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits