Kaydet (Commit) 1e532297 authored tarafından Noel Grandin's avatar Noel Grandin

make format->page dialog async

Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7
Reviewed-on: https://gerrit.libreoffice.org/66113Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: 's avatarMert Tümer <mert.tumer@collabora.com>
Tested-by: 's avatarMert Tümer <mert.tumer@collabora.com>
üst 8597df19
......@@ -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();
}
});
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment