Kaydet (Commit) 99394c8e authored tarafından Miklos Vajna's avatar Miklos Vajna

Add SvxTableController::setCursorLogicPosition()

With this, it's possible to drag the start or end handle of an Impress
table selection and let it grow/shrink.

Change-Id: Icdee1207c1c3a6b1c4fb15d00008db6327d6e2de
üst dc755a3f
......@@ -93,6 +93,8 @@ public:
SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) SAL_OVERRIDE;
SVX_DLLPRIVATE virtual bool hasSelectedCells() const SAL_OVERRIDE { return mbCellSelectionMode || mpView->IsTextEdit(); }
/// @see sdr::SelectionController::setCursorLogicPosition().
SVX_DLLPRIVATE virtual void setCursorLogicPosition(const Point& rPosition, bool bPoint) SAL_OVERRIDE;
void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
......
......@@ -32,6 +32,7 @@ class SfxRequest;
class SfxStyleSheet;
class SdrPage;
class SdrModel;
class Point;
namespace sdr
{
......@@ -70,6 +71,8 @@ public:
virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
/// This is a table object, and one or more of its cells are selected.
virtual bool hasSelectedCells() const;
/// Allows adjusting the point or mark of the selection to a document coordinate.
virtual void setCursorLogicPosition(const Point& rPosition, bool bPoint);
};
}
......
......@@ -541,6 +541,13 @@ void ViewShell::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool
EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
rEditView.SetCursorLogicPosition(rPosition, bPoint, bClearMark);
}
else
{
// No text edit object, then try to adjust table selection.
rtl::Reference<sdr::SelectionController> xSelectionController(GetView()->getSelectionController());
if (xSelectionController.is())
xSelectionController->setCursorLogicPosition(rPosition, bPoint);
}
}
}
......
......@@ -105,6 +105,10 @@ bool SelectionController::hasSelectedCells() const
return false;
}
void SelectionController::setCursorLogicPosition(const Point& /*rPosition*/, bool /*bPoint*/)
{
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -3148,6 +3148,24 @@ bool SvxTableController::isColumnHeader()
return aSettings.mbUseFirstColumn;
}
void SvxTableController::setCursorLogicPosition(const Point& rPosition, bool bPoint)
{
if (mxTableObj->GetObjIdentifier() != OBJ_TABLE)
return;
SdrTableObj* pTableObj = static_cast<SdrTableObj*>(mxTableObj.get());
CellPos aCellPos;
if (pTableObj->CheckTableHit(rPosition, aCellPos.mnCol, aCellPos.mnRow, 0) != SDRTABLEHIT_NONE)
{
if (bPoint)
maCursorLastPos = aCellPos;
else
maCursorFirstPos = aCellPos;
mpView->MarkListHasChanged();
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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