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-07-23 10:39:09 +0200 |
commit | f5c74d4deecce1e0adc9fc0ac4545b880e3b2564 (patch) | |
tree | 6d39ec909f1795eaa3929beb2d76e619bd51e4d2 /svx | |
parent | 353a093c508562c14dada49c2e1d937e5e02e642 (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>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index a153c2b6db62..d5d0468c530f 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -910,46 +910,51 @@ void SvxTableController::onFormatTable(const SfxRequest& rReq) aNewAttr.Put( aBoxInfoItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> xDlg( pFact->CreateSvxFormatCellsDialog( + std::shared_ptr<AbstractTabController> xDlg( pFact->CreateSvxFormatCellsDialog( rReq.GetFrameWeld(), &aNewAttr, rModel) ); - // Even Cancel Button is returning positive(101) value, - if (xDlg->Execute() == RET_OK) - { - 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) + SvxTableController* pThis = this; + VclAbstractDialog::AsyncContext aContext; + aContext.maEndDialogFn = [xDlg, pThis, aBoxItem, aBoxInfoItem](int nResult){ + if (nResult == RET_OK) { - aNewSet.Put(aBoxInfoItem); - } + 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); + } - 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 ) ) ); - SetAttrToSelectedCells(aNewSet, false); - } + pThis->SetAttrToSelectedCells(aNewSet, false); + } + }; + + xDlg->StartExecuteAsync(aContext); } } |