include/svx/sdr/table/tablecontroller.hxx | 2 +- include/svx/selectioncontroller.hxx | 2 +- sd/source/ui/view/viewshel.cxx | 17 +++++++---------- svx/source/svdraw/selectioncontroller.cxx | 3 ++- svx/source/table/tablecontroller.cxx | 24 +++++++++++++++++------- 5 files changed, 28 insertions(+), 20 deletions(-)
New commits: commit 077d0fa17f002d08376d415c04651892a4704617 Author: Miklos Vajna <[email protected]> Date: Mon Mar 30 16:20:13 2015 +0200 sd tiled rendering: support turning an editeng selection into a table one With this, it's possible to drag the selection handle of an editeng selection in an Impress table and drag it outside the table cell to create an Impress table selection. Some unexpected graphic selection still appears, though. Change-Id: Ia7b36036ce2bda5cca570e8b6075238d5167090f diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index 6145dc4..b366a58 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -94,7 +94,7 @@ public: 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; + SVX_DLLPRIVATE virtual bool 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 214ccd9..52bb9aa 100644 --- a/include/svx/selectioncontroller.hxx +++ b/include/svx/selectioncontroller.hxx @@ -72,7 +72,7 @@ public: /// 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); + virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint); }; } diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 4845178..541963e 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -536,17 +536,14 @@ void ViewShell::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool { if (SdrView* pSdrView = GetView()) { - if (pSdrView->GetTextEditObject()) + rtl::Reference<sdr::SelectionController> xSelectionController(GetView()->getSelectionController()); + if (!xSelectionController.is() || !xSelectionController->setCursorLogicPosition(rPosition, bPoint)) { - 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); + if (pSdrView->GetTextEditObject()) + { + EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView(); + rEditView.SetCursorLogicPosition(rPosition, bPoint, bClearMark); + } } } } diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx index 6d84934..d8f7fbf 100644 --- a/svx/source/svdraw/selectioncontroller.cxx +++ b/svx/source/svdraw/selectioncontroller.cxx @@ -105,8 +105,9 @@ bool SelectionController::hasSelectedCells() const return false; } -void SelectionController::setCursorLogicPosition(const Point& /*rPosition*/, bool /*bPoint*/) +bool SelectionController::setCursorLogicPosition(const Point& /*rPosition*/, bool /*bPoint*/) { + return false; } } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index e487b06..496da15 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -3149,21 +3149,31 @@ bool SvxTableController::isColumnHeader() return aSettings.mbUseFirstColumn; } -void SvxTableController::setCursorLogicPosition(const Point& rPosition, bool bPoint) +bool SvxTableController::setCursorLogicPosition(const Point& rPosition, bool bPoint) { if (mxTableObj->GetObjIdentifier() != OBJ_TABLE) - return; + return false; 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(); + // Position is a table cell. + if (mbCellSelectionMode) + { + // We have a table selection already: adjust the point or the mark. + if (bPoint) + setSelectedCells(maCursorFirstPos, aCellPos); + else + setSelectedCells(aCellPos, maCursorLastPos); + return true; + } + else if (aCellPos != maMouseDownPos) + // No selection, but rPosition is at an other cell: start table selection. + StartSelection(maMouseDownPos); } + + return false; } } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
