summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-09-30 10:49:12 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2020-11-13 09:38:36 +0100
commit817a06d857bff5be35f8eb7bf830b75871556bc5 (patch)
treec6999a58916183489cb1652af74b48e9098134b0 /svx
parent0d3fb848a2995a0869c4c5fa8916214a513865ac (diff)
Make Split Table Cell dialog async
Change-Id: I4efbb24f721aa50cc4dbbe78ae1e7e6087f8c876 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103670 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105594 Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/table/tablecontroller.cxx71
1 files changed, 36 insertions, 35 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index c30f71201277..ee40835ec5d8 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1284,52 +1284,53 @@ void SvxTableController::SplitMarkedCells(const SfxRequest& rReq)
return;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SvxAbstractSplitTableDialog> xDlg(pFact->CreateSvxSplitTableDialog(rReq.GetFrameWeld(), false, 99));
+ VclPtr<SvxAbstractSplitTableDialog> xDlg(pFact->CreateSvxSplitTableDialog(rReq.GetFrameWeld(), false, 99));
- if( !xDlg->Execute() )
- return;
+ xDlg->StartExecuteAsync([xDlg, this](int) {
+ const sal_Int32 nCount = xDlg->GetCount() - 1;
- const sal_Int32 nCount = xDlg->GetCount() - 1;
+ if( nCount < 1 )
+ return;
- if( nCount < 1 )
- return;
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ Reference< XMergeableCellRange > xRange( mxTable->createCursorByRange( mxTable->getCellRangeByPosition( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow ) ), UNO_QUERY_THROW );
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+ SdrTableObj& rTableObj(*mxTableObj);
- CellPos aStart, aEnd;
- getSelectedCells( aStart, aEnd );
- Reference< XMergeableCellRange > xRange( mxTable->createCursorByRange( mxTable->getCellRangeByPosition( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow ) ), UNO_QUERY_THROW );
- const sal_Int32 nRowCount = mxTable->getRowCount();
- const sal_Int32 nColCount = mxTable->getColumnCount();
- SdrTableObj& rTableObj(*mxTableObj);
+ if( rTableObj.IsTextEditActive() )
+ mrView.SdrEndTextEdit(true);
- if( rTableObj.IsTextEditActive() )
- mrView.SdrEndTextEdit(true);
+ TableModelNotifyGuard aGuard( mxTable.get() );
+ SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
+ const bool bUndo(rModel.IsUndoEnabled());
- TableModelNotifyGuard aGuard( mxTable.get() );
- SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
- const bool bUndo(rModel.IsUndoEnabled());
+ if( bUndo )
+ {
+ rModel.BegUndo( SvxResId(STR_TABLE_SPLIT) );
+ rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
+ }
- if( bUndo )
- {
- rModel.BegUndo( SvxResId(STR_TABLE_SPLIT) );
- rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
- }
+ if( xDlg->IsHorizontal() )
+ {
+ xRange->split( 0, nCount );
+ }
+ else
+ {
+ xRange->split( nCount, 0 );
+ }
- if( xDlg->IsHorizontal() )
- {
- xRange->split( 0, nCount );
- }
- else
- {
- xRange->split( nCount, 0 );
- }
+ if( bUndo )
+ rModel.EndUndo();
- if( bUndo )
- rModel.EndUndo();
+ aEnd.mnRow += mxTable->getRowCount() - nRowCount;
+ aEnd.mnCol += mxTable->getColumnCount() - nColCount;
- aEnd.mnRow += mxTable->getRowCount() - nRowCount;
- aEnd.mnCol += mxTable->getColumnCount() - nColCount;
+ setSelectedCells( aStart, aEnd );
- setSelectedCells( aStart, aEnd );
+ xDlg->disposeOnce();
+ });
}
void SvxTableController::DistributeColumns(const bool bOptimize, const bool bMinimize)