Blame SOURCES/0001-implement-undo-of-delete-impress-cell-contents.patch

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