diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-22 16:17:37 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-09-21 09:49:48 +0200 |
commit | 368146c29d0280964399fc86fa0117965d510130 (patch) | |
tree | e2ac184295fd74c1e2e76e0066f0e7de0f6bfaea /svx | |
parent | df86ec5d465875a5c59017c24578ca9153440d0b (diff) |
Make Table Properties dialog async
Change-Id: I0fb84ed3660f9a153ad89126a927299954360c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99228
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102987
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 58 |
1 files changed, 31 insertions, 27 deletions
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 ) |