summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-27 19:49:02 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-30 09:23:55 +0200
commit99394c8e09631280f9d76a790832133f5ef7b873 (patch)
treea0fe4223609d39fbde44afc61afd336ba5dcab9e
parentdc755a3f7581b915f1f278e87af04d164514061d (diff)
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
-rw-r--r--include/svx/sdr/table/tablecontroller.hxx2
-rw-r--r--include/svx/selectioncontroller.hxx3
-rw-r--r--sd/source/ui/view/viewshel.cxx7
-rw-r--r--svx/source/svdraw/selectioncontroller.cxx4
-rw-r--r--svx/source/table/tablecontroller.cxx18
5 files changed, 34 insertions, 0 deletions
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
index b6d610cbd9d3..6145dc4eab1b 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -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 );
diff --git a/include/svx/selectioncontroller.hxx b/include/svx/selectioncontroller.hxx
index f629b20cffd1..214ccd9cff75 100644
--- a/include/svx/selectioncontroller.hxx
+++ b/include/svx/selectioncontroller.hxx
@@ -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);
};
}
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a0ab3f03c107..48451783aa18 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -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);
+ }
}
}
diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx
index a2ff8758b009..6d8493436680 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -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: */
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index fdd8481cff2c..e487b06585fc 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -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: */