From 35a3fb2ca34b30a1bdaf64f0091fcd42af6bfd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 1 Sep 2015 16:32:15 +0100 Subject: [PATCH] implement undo of delete impress cell contents Change-Id: I7aa99f3a6668e66b8d02e20b7ea1cf0862e5d760 (cherry picked from commit d38e4b2ee73ad38881465f9f97eb8d8397ee98ff) --- include/svx/svdstr.hrc | 1 + svx/source/svdraw/svdstr.src | 5 +++++ svx/source/table/tablecontroller.cxx | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/svx/svdstr.hrc b/include/svx/svdstr.hrc index 90ef697..f45b55f 100644 --- a/include/svx/svdstr.hrc +++ b/include/svx/svdstr.hrc @@ -711,5 +711,6 @@ #define STR_TABLE_STYLE (SIP_Begin + 274) #define STR_TABLE_STYLE_SETTINGS (SIP_Begin + 275) #define SIP_SA_CROP_MARKERS (SIP_Begin + 276) +#define STR_TABLE_DELETE_CELL_CONTENTS (SIP_Begin + 277) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 364749a..c7977c1 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -2770,6 +2770,11 @@ String STR_TABLE_DISTRIBUTE_COLUMNS Text [ en-US ] = "Distribute columns" ; }; +String STR_TABLE_DELETE_CELL_CONTENTS +{ + Text [ en-US ] = "Delete cell contents" ; +}; + String STR_TABLE_STYLE { Text [ en-US ] = "Table style" ; diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 64b40da..6a8bd3f 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1331,6 +1331,10 @@ bool SvxTableController::DeleteMarked() { if( mxTable.is() ) { + const bool bUndo = mpModel && mpModel->IsUndoEnabled(); + if (bUndo) + mpModel->BegUndo(ImpGetResStr(STR_TABLE_DELETE_CELL_CONTENTS)); + CellPos aStart, aEnd; getSelectedCells( aStart, aEnd ); for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ ) @@ -1338,11 +1342,18 @@ bool SvxTableController::DeleteMarked() for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); - if( xCell.is() ) - xCell->SetOutlinerParaObject( 0 ); + if (xCell.is() && xCell->hasText()) + { + if (bUndo) + xCell->AddUndo(); + xCell->SetOutlinerParaObject(0); + } } } + if (bUndo) + mpModel->EndUndo(); + UpdateTableShape(); return true; } -- 2.4.0