sw/source/uibase/shells/tabsh.cxx | 58 ++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-)
New commits: commit 89d777a6b8e3f6ab4ec97491e35f5135edd0d9f5 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Jan 23 18:13:01 2018 +0100 lokdialog: Convert the Table -> Properties... to async exec. Change-Id: Iac937f5032ddaa614f8364a85b0b8db2a0828cbd Reviewed-on: https://gerrit.libreoffice.org/48460 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index b2286fa09538..9324394cd16a 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -584,7 +584,7 @@ void SwTableShell::Execute(SfxRequest &rReq) FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); - std::unique_ptr<SwTableRep> pTableRep(::lcl_TableParamToItemSet( aCoreSet, rSh )); + std::shared_ptr<SwTableRep> pTableRep(::lcl_TableParamToItemSet(aCoreSet, rSh)); aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); rSh.GetTableAttr(aCoreSet); @@ -595,37 +595,49 @@ void SwTableShell::Execute(SfxRequest &rReq) else aCoreSet.InvalidateItem( RES_BACKGROUND ); - ScopedVclPtr<SfxAbstractTabDialog> pDlg; - { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.disposeAndReset(pFact->CreateSwTableTabDlg(GetView().GetWindow(), GetPool(), &aCoreSet, &rSh)); - OSL_ENSURE(pDlg, "Dialog creation failed!"); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetView().GetWindow(), GetPool(), &aCoreSet, &rSh)); + OSL_ENSURE(pDlg, "Dialog creation failed!"); + if (pDlg) + { if (pItem) pDlg->SetCurPageId(OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8)); - } + std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + rReq.Ignore(); // the 'old' request is not relevant any more - if ( (!pDlg && rReq.GetArgs()) || (pDlg && pDlg->Execute() == RET_OK) ) + pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh](sal_Int32 nResult){ + if (RET_OK == nResult) + { + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + + //to record FN_INSERT_TABLE correctly + pRequest->SetSlot(FN_FORMAT_TABLE_DLG); + pRequest->Done(*pOutSet); + + ItemSetToTableParam(*pOutSet, rSh); + } + + rBindings.Update(SID_RULER_BORDERS); + rBindings.Update(SID_ATTR_TABSTOP); + rBindings.Update(SID_RULER_BORDERS_VERTICAL); + rBindings.Update(SID_ATTR_TABSTOP_VERTICAL); + }); + } + else { - const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs(); - if ( pDlg ) - { - //to record FN_INSERT_TABLE correctly - rReq.SetSlot(FN_FORMAT_TABLE_DLG); - rReq.Done( *pOutSet ); - } - ItemSetToTableParam( *pOutSet, rSh ); + if (rReq.GetArgs()) + ItemSetToTableParam(*rReq.GetArgs(), rSh); + + rBindings.Update(SID_RULER_BORDERS); + rBindings.Update(SID_ATTR_TABSTOP); + rBindings.Update(SID_RULER_BORDERS_VERTICAL); + rBindings.Update(SID_ATTR_TABSTOP_VERTICAL); } - pDlg.disposeAndClear(); - pTableRep.reset(); - rBindings.Update(SID_RULER_BORDERS); - rBindings.Update(SID_ATTR_TABSTOP); - rBindings.Update(SID_RULER_BORDERS_VERTICAL); - rBindings.Update(SID_ATTR_TABSTOP_VERTICAL); break; } case SID_ATTR_BRUSH: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits