summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-10 12:27:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-18 15:10:15 +0100
commit1e532297119af77cb54b5967eec3625954126e50 (patch)
treef45a427e4966846ecd5687fc0983af95ddcfbbab /sc
parent8597df19549773174b9d8c1ad92d6ba915199f5b (diff)
make format->page dialog async
Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7 Reviewed-on: https://gerrit.libreoffice.org/66113 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mert Tümer <mert.tumer@collabora.com> Tested-by: Mert Tümer <mert.tumer@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docsh4.cxx68
1 files changed, 35 insertions, 33 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 839cf0257617..c157374b21d8 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1655,47 +1655,49 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller,
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg( GetActiveDialogParent(), *pStyleSheet, RID_SCDLG_STYLES_PAGE, RID_SCDLG_STYLES_PAGE ));
- OSL_ENSURE(pDlg, "Dialog create fail!");
-
- if ( pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-
- WaitObject aWait( GetActiveDialogParent() );
+ VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg( GetActiveDialogParent(), *pStyleSheet, RID_SCDLG_STYLES_PAGE, RID_SCDLG_STYLES_PAGE ));
- OUString aNewName = pStyleSheet->GetName();
- if ( aNewName != aOldName &&
- m_aDocument.RenamePageStyleInUse( aOldName, aNewName ) )
+ 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 )
{
- SfxBindings* pBindings = GetViewBindings();
- if (pBindings)
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ WaitObject aWait( GetActiveDialogParent() );
+
+ 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(
- new ScUndoModifyStyle( this, SfxStyleFamily::Page,
- aOldData, aNewData ) );
- }
+ ScStyleSaveData aNewData;
+ aNewData.InitFromStyle( pStyleSheet );
+ if (bUndo)
+ {
+ GetUndoManager()->AddUndoAction(
+ new ScUndoModifyStyle( this, SfxStyleFamily::Page,
+ aOldData, aNewData ) );
+ }
- PageStyleModified( aNewName, false );
- rReq.Done();
- }
- pDlg.disposeAndClear();
+ PageStyleModified( aNewName, false );
+ pRequest->Done();
+ pDlg->disposeOnce();
+ }
+ });
}
}
}