summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-23 18:13:01 +0100
committerAndras Timar <andras.timar@collabora.com>2018-01-23 21:10:18 +0100
commit89d777a6b8e3f6ab4ec97491e35f5135edd0d9f5 (patch)
treef7c105e17b4b0488fa96cc4b5f3e13b0ec7a2bb2 /sw
parent92d7a58b8cafd80308b9a72bb7269e09f98d30db (diff)
lokdialog: Convert the Table -> Properties... to async exec.
Change-Id: Iac937f5032ddaa614f8364a85b0b8db2a0828cbd Reviewed-on: https://gerrit.libreoffice.org/48460 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/tabsh.cxx58
1 files changed, 35 insertions, 23 deletions
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: