sw/source/uibase/shells/tabsh.cxx |   58 ++++++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 23 deletions(-)

New commits:
commit c3a085d22742f88e91ff92f319a26d6e8d1d9a98
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/48454
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 0d4d05993909..90457117d63d 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -578,7 +578,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);
@@ -589,37 +589,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:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to