Kaydet (Commit) 76ce1630 authored tarafından Caolán McNamara's avatar Caolán McNamara

refactor to create a HasMarked, no logic change

Change-Id: I667a8582a740f5fbbcdbcd82907e40e82f6165a1
üst f4d2337e
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE; SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE; SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
SVX_DLLPRIVATE virtual bool HasMarked() SAL_OVERRIDE;
SVX_DLLPRIVATE virtual bool DeleteMarked() SAL_OVERRIDE; SVX_DLLPRIVATE virtual bool DeleteMarked() SAL_OVERRIDE;
SVX_DLLPRIVATE virtual void onSelectionHasChanged() SAL_OVERRIDE; SVX_DLLPRIVATE virtual void onSelectionHasChanged() SAL_OVERRIDE;
......
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
virtual void GetState( SfxItemSet& rSet ); virtual void GetState( SfxItemSet& rSet );
virtual void Execute( SfxRequest& rReq ); virtual void Execute( SfxRequest& rReq );
virtual bool HasMarked();
virtual bool DeleteMarked(); virtual bool DeleteMarked();
virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const; virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
......
...@@ -55,6 +55,11 @@ void SelectionController::Execute( SfxRequest& /*rReq*/ ) ...@@ -55,6 +55,11 @@ void SelectionController::Execute( SfxRequest& /*rReq*/ )
{ {
} }
bool SelectionController::HasMarked()
{
return false;
}
bool SelectionController::DeleteMarked() bool SelectionController::DeleteMarked()
{ {
return false; return false;
......
...@@ -1325,41 +1325,41 @@ void SvxTableController::DistributeRows() ...@@ -1325,41 +1325,41 @@ void SvxTableController::DistributeRows()
} }
} }
bool SvxTableController::HasMarked()
{
return mbCellSelectionMode && mxTable.is();
}
bool SvxTableController::DeleteMarked() 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(); CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
if (bUndo) if (xCell.is() && xCell->hasText())
mpModel->BegUndo(ImpGetResStr(STR_TABLE_DELETE_CELL_CONTENTS));
CellPos aStart, aEnd;
getSelectedCells( aStart, aEnd );
for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
{ {
for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) if (bUndo)
{ xCell->AddUndo();
CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); xCell->SetOutlinerParaObject(0);
if (xCell.is() && xCell->hasText())
{
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 bool SvxTableController::GetStyleSheet( SfxStyleSheet*& rpStyleSheet ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment