summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormerttumer <mert.tumer@collabora.com>2021-05-17 05:52:01 +0300
committerAndras Timar <andras.timar@collabora.com>2021-06-15 09:18:44 +0200
commit690d7b87eda38b54585fed2fc16181897ecbf98d (patch)
tree2966327fb0e287e1256ac2b7efae18a4bead1474
parentFix Row size change is not updated (diff)
downloadcore-690d7b87eda38b54585fed2fc16181897ecbf98d.tar.gz
core-690d7b87eda38b54585fed2fc16181897ecbf98d.zip
Implemented Delete key deletes the table when all the cells are selected
Change-Id: I8a17c73781a3399b214d5655b83036652933a90a Signed-off-by: merttumer <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115689 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117191 Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--svx/source/table/tablecontroller.cxx30
1 files changed, 22 insertions, 8 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 04d0d7a17bc6..d7028fe42c0c 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1386,30 +1386,44 @@ bool SvxTableController::DeleteMarked()
SdrTableObj& rTableObj(*mxTableObj.get());
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
const bool bUndo(rModel.IsUndoEnabled());
+ bool bDeleteTable = false;
if (bUndo)
rModel.BegUndo(SvxResId(STR_TABLE_DELETE_CELL_CONTENTS));
CellPos aStart, aEnd;
getSelectedCells( aStart, aEnd );
- for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ const sal_Int32 nRemovedColumns = aEnd.mnCol - aStart.mnCol + 1;
+ const sal_Int32 nRemovedRows = aEnd.mnRow - aStart.mnRow + 1;
+ if( nRemovedColumns == mxTable->getColumnCount() && nRemovedRows == mxTable->getRowCount())
{
- for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ bDeleteTable = true;
+ }
+ else
+ {
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
{
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if (xCell.is() && xCell->hasText())
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
- if (bUndo)
- xCell->AddUndo();
- xCell->SetOutlinerParaObject(nullptr);
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if (xCell.is() && xCell->hasText())
+ {
+ if (bUndo)
+ xCell->AddUndo();
+ xCell->SetOutlinerParaObject(nullptr);
+ }
}
}
}
+ if (bDeleteTable)
+ mrView.DeleteMarkedObj();
+
if (bUndo)
rModel.EndUndo();
- UpdateTableShape();
+ if (!bDeleteTable)
+ UpdateTableShape();
return true;
}