diff options
Diffstat (limited to 'svx/source/table/tablecontroller.cxx')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index cee5e2b7dc51..1c4cfcd751d0 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1325,41 +1325,41 @@ void SvxTableController::DistributeRows() } } +bool SvxTableController::HasMarked() +{ + return mbCellSelectionMode && mxTable.is(); +} + bool SvxTableController::DeleteMarked() { - if( mbCellSelectionMode ) + if (!HasMarked()) + return false; + + 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++ ) { - if( mxTable.is() ) + for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - 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++ ) + 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++ ) - { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); - if (xCell.is() && xCell->hasText()) - { - if (bUndo) - xCell->AddUndo(); - xCell->SetOutlinerParaObject(0); - } - } + if (bUndo) + xCell->AddUndo(); + xCell->SetOutlinerParaObject(0); } - - if (bUndo) - mpModel->EndUndo(); - - UpdateTableShape(); - return true; } } - return false; + if (bUndo) + mpModel->EndUndo(); + + UpdateTableShape(); + return true; } bool SvxTableController::GetStyleSheet( SfxStyleSheet*& rpStyleSheet ) const |