diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-01-23 18:13:01 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-22 23:15:54 +0100 |
commit | ee37a9f7c219461e7042c84c21e1c9b95e464cd7 (patch) | |
tree | 2cdff8b3217c82f6d10b288779e0e6e7b502989e | |
parent | bd3372fa67bb6f9fcb4a5905981ed5fe5167fffb (diff) |
lokdialog: Convert the Table -> Properties... to async exec.
Change-Id: Iac937f5032ddaa614f8364a85b0b8db2a0828cbd
Reviewed-on: https://gerrit.libreoffice.org/48454
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit c3a085d22742f88e91ff92f319a26d6e8d1d9a98)
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 61814a10b53a..a318d08e1234 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -579,7 +579,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); @@ -590,37 +590,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(), &aCoreSet, &rSh)); - OSL_ENSURE(pDlg, "Dialog creation failed!"); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetView().GetWindow(), &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: |