summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-01 16:46:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-01 19:50:10 +0100
commit76ce16307dc19d8bd955cbc43da401855ac58e38 (patch)
tree80c3664bc756d46c6fea39fba067b0806d83c100 /svx
parentf4d2337ef2ef324b67e231ebb63259d03d3e3470 (diff)
refactor to create a HasMarked, no logic change
Change-Id: I667a8582a740f5fbbcdbcd82907e40e82f6165a1
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/selectioncontroller.cxx5
-rw-r--r--svx/source/table/tablecontroller.cxx52
2 files changed, 31 insertions, 26 deletions
diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx
index d8f7fbfcd51a..3138f379d307 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -55,6 +55,11 @@ void SelectionController::Execute( SfxRequest& /*rReq*/ )
{
}
+bool SelectionController::HasMarked()
+{
+ return false;
+}
+
bool SelectionController::DeleteMarked()
{
return false;
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