Kaydet (Commit) 2a43ffd3 authored tarafından Noel Grandin's avatar Noel Grandin

make Format->Bullets and Numbering dialog async

this includes
    commit 84acbfd2
    Date:   Wed Jan 16 08:56:44 2019 +0200
    fix crash in draw Format->Bullets and Numbering dialog

Reviewed-on: https://gerrit.libreoffice.org/66098
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit a2b78c13)

Change-Id: Ib69c2be7c8ddaa616c08796ad2b8c8cf20ee2db9
Reviewed-on: https://gerrit.libreoffice.org/66157Reviewed-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 9da3e7e5
...@@ -70,63 +70,61 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) ...@@ -70,63 +70,61 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq )
const SfxItemSet* pArgs = rReq.GetArgs(); const SfxItemSet* pArgs = rReq.GetArgs();
const SfxStringItem* pPageItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, FN_PARAM_1, false); const SfxStringItem* pPageItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, FN_PARAM_1, false);
if ( !pArgs || pPageItem ) if ( pArgs && !pPageItem )
{ {
// fill ItemSet for Dialog /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
SfxItemSet aEditAttr( mpDoc->GetPool() ); changes to master page and redirect to a template */
mpView->GetAttributes( aEditAttr ); mpView->SetAttributes(*pArgs);
return;
}
SfxItemSet aNewAttr( mpViewShell->GetPool(), // fill ItemSet for Dialog
svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} ); SfxItemSet aEditAttr( mpDoc->GetPool() );
aNewAttr.Put( aEditAttr, false ); mpView->GetAttributes( aEditAttr );
// create and execute dialog SfxItemSet aNewAttr( mpViewShell->GetPool(),
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) : nullptr); aNewAttr.Put( aEditAttr, false );
if( pDlg )
{
if ( pPageItem )
pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
sal_uInt16 nResult = pDlg->Execute();
switch( nResult ) // create and execute dialog
{ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
case RET_OK: VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) );
{ if ( pPageItem )
SfxItemSet aSet( *pDlg->GetOutputItemSet() ); pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq));
rReq.Ignore(); // the 'old' request is not relevant any more
std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard; // do not capture this, because this will go way before the dialog finishes executing
auto pView = mpView;
auto pViewShell = mpViewShell;
pDlg->StartExecuteAsync([pView, pViewShell, pDlg, xRequest](sal_Int32 nResult){
if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView)) if( nResult == RET_OK )
{ {
pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow()); SfxItemSet aSet( *pDlg->GetOutputItemSet() );
aGuard.reset(new OutlineViewModelChangeGuard(*pView));
}
if( pOLV ) OutlinerView* pOLV = pView->GetTextEditOutlinerView();
pOLV->EnableBullets();
rReq.Done( aSet ); std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
pArgs = rReq.GetArgs();
}
break;
default: if (OutlineView* pOutlineView = dynamic_cast<OutlineView*>(pView))
return; {
pOLV = pOutlineView->GetViewByWindow(pViewShell->GetActiveWindow());
aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
} }
}
}
/* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch if( pOLV )
changes to master page and redirect to a template */ pOLV->EnableBullets();
mpView->SetAttributes(*pArgs);
/* #i35937# xRequest->Done( aSet );
// invalidate possible affected fields
mpViewShell->Invalidate( FN_NUM_BULLET_ON ); /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
*/ changes to master page and redirect to a template */
pView->SetAttributes(*xRequest->GetArgs());
}
pDlg->disposeOnce();
});
} }
void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq) void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
......
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