[Libreoffice-commits] core.git: svx/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 21 07:50:24 UTC 2020


 svx/source/table/tablecontroller.cxx |   58 ++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 27 deletions(-)

New commits:
commit 368146c29d0280964399fc86fa0117965d510130
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jul 22 16:17:37 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Sep 21 09:49:48 2020 +0200

    Make Table Properties dialog async
    
    Change-Id: I0fb84ed3660f9a153ad89126a927299954360c2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99228
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102987
    Tested-by: Jenkins

diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 317135b6c260..1b52f835180c 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -925,46 +925,50 @@ void SvxTableController::onFormatTable(const SfxRequest& rReq)
     aNewAttr.Put( aBoxInfoItem );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    ScopedVclPtr<SfxAbstractTabDialog> xDlg( pFact->CreateSvxFormatCellsDialog(
+    VclPtr<SfxAbstractTabDialog> xDlg( pFact->CreateSvxFormatCellsDialog(
         rReq.GetFrameWeld(),
         &aNewAttr,
         rModel) );
 
     // Even Cancel Button is returning positive(101) value,
-    if (xDlg->Execute() != RET_OK)
-        return;
+    xDlg->StartExecuteAsync([xDlg, this, aBoxItem, aBoxInfoItem](int nResult){
+        if (nResult == RET_OK)
+        {
+            SfxItemSet aNewSet(*(xDlg->GetOutputItemSet()));
 
-    SfxItemSet aNewSet(*(xDlg->GetOutputItemSet()));
+            //Only properties that were unchanged by the dialog appear in this
+            //itemset.  We had constructed these two properties from other
+            //ones, so if they were not changed, then forcible set them back to
+            //their originals in the new result set so we can decompose that
+            //unchanged state back to their input properties
+            if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER, false) != SfxItemState::SET)
+            {
+                aNewSet.Put(aBoxItem);
+            }
+            if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER_INNER, false) != SfxItemState::SET)
+            {
+                aNewSet.Put(aBoxInfoItem);
+            }
 
-    //Only properties that were unchanged by the dialog appear in this
-    //itemset.  We had constructed these two properties from other
-    //ones, so if they were not changed, then forcible set them back to
-    //their originals in the new result set so we can decompose that
-    //unchanged state back to their input properties
-    if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER, false) != SfxItemState::SET)
-    {
-        aNewSet.Put(aBoxItem);
-    }
-    if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER_INNER, false) != SfxItemState::SET)
-    {
-        aNewSet.Put(aBoxInfoItem);
-    }
+            SvxBoxItem aNewBoxItem( aNewSet.Get( SDRATTR_TABLE_BORDER ) );
 
-    SvxBoxItem aNewBoxItem( aNewSet.Get( SDRATTR_TABLE_BORDER ) );
+            if( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) != aBoxItem.GetDistance( SvxBoxItemLine::LEFT ) )
+                aNewSet.Put(makeSdrTextLeftDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) ) );
 
-    if( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) != aBoxItem.GetDistance( SvxBoxItemLine::LEFT ) )
-        aNewSet.Put(makeSdrTextLeftDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) ) );
+            if( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) != aBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) )
+                aNewSet.Put(makeSdrTextRightDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) ) );
 
-    if( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) != aBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) )
-        aNewSet.Put(makeSdrTextRightDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) ) );
+            if( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) != aBoxItem.GetDistance( SvxBoxItemLine::TOP ) )
+                aNewSet.Put(makeSdrTextUpperDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) ) );
 
-    if( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) != aBoxItem.GetDistance( SvxBoxItemLine::TOP ) )
-        aNewSet.Put(makeSdrTextUpperDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) ) );
+            if( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) != aBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) )
+                aNewSet.Put(makeSdrTextLowerDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) ) );
 
-    if( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) != aBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) )
-        aNewSet.Put(makeSdrTextLowerDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) ) );
+            this->SetAttrToSelectedCells(aNewSet, false);
+        }
 
-    SetAttrToSelectedCells(aNewSet, false);
+        xDlg->disposeOnce();
+    });
 }
 
 void SvxTableController::Execute( SfxRequest& rReq )


More information about the Libreoffice-commits mailing list