diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-19 17:56:24 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-19 17:14:17 +0000 |
commit | 6819992113947e7a6272bf750fee712c2df41905 (patch) | |
tree | c2d21091487dd39f2e913658ffc87786735acc85 /svx | |
parent | 219d1f3385907f8bb375b626b0a35f8239fa1550 (diff) |
tdf#99396 SvxTableController::SetVertical: implement undo support
All the table and cell objects know how to undo this change, what was
missing is the begin/end undo calls and the broadcast of the cell
format change.
Change-Id: I3dfd203faf5c579da2937fedab5647129a8e903a
Reviewed-on: https://gerrit.libreoffice.org/24247
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index b98feb21c87b..aba6dedfc148 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1172,6 +1172,13 @@ void SvxTableController::SetVertical( sal_uInt16 nSId ) { TableModelNotifyGuard aGuard( mxTable.get() ); + bool bUndo = mpModel && mpModel->IsUndoEnabled(); + if (bUndo) + { + mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT)); + mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj)); + } + CellPos aStart, aEnd; getSelectedCells( aStart, aEnd ); @@ -1198,11 +1205,20 @@ void SvxTableController::SetVertical( sal_uInt16 nSId ) { CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); if( xCell.is() ) - xCell->SetMergedItem(aItem); + { + if (bUndo) + xCell->AddUndo(); + SfxItemSet aSet(xCell->GetItemSet()); + aSet.Put(aItem); + xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false); + } } } UpdateTableShape(); + + if (bUndo) + mpModel->EndUndo(); } } |