[Libreoffice-commits] core.git: include/svx svx/source

Caolán McNamara caolanm at redhat.com
Tue Sep 1 08:33:18 PDT 2015


 include/svx/svdstr.hrc               |    1 +
 svx/source/svdraw/svdstr.src         |    5 +++++
 svx/source/table/tablecontroller.cxx |   15 +++++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit d38e4b2ee73ad38881465f9f97eb8d8397ee98ff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 1 16:32:15 2015 +0100

    implement undo of delete impress cell contents
    
    Change-Id: I7aa99f3a6668e66b8d02e20b7ea1cf0862e5d760

diff --git a/include/svx/svdstr.hrc b/include/svx/svdstr.hrc
index 36e8719..6663f01 100644
--- a/include/svx/svdstr.hrc
+++ b/include/svx/svdstr.hrc
@@ -713,5 +713,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 6dc4420..f790f00 100644
--- a/svx/source/svdraw/svdstr.src
+++ b/svx/source/svdraw/svdstr.src
@@ -2778,6 +2778,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 2fbb606..cee5e2b 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;
         }


More information about the Libreoffice-commits mailing list