summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-10 12:27:22 +0200
committerAndras Timar <andras.timar@collabora.com>2019-09-19 16:29:41 +0200
commitd28924afbd15cf9fec9ef00708595b55e95bb0aa (patch)
treed8e97b488e0f5aeeeb0c5f6a547a85099311ca85
parentdd1a810b6b6eedab2b0809db538b8296982f7373 (diff)
make format->page dialog async
Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7 Reviewed-on: https://gerrit.libreoffice.org/66074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit b7baedb4d0df3f1421e701d2a943d947dfb67010) Reviewed-on: https://gerrit.libreoffice.org/79125 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/source/ui/docshell/docsh4.cxx66
1 files changed, 35 insertions, 31 deletions
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();
+ }
+ });
}
}
}