diff options
-rw-r--r-- | include/svx/sdr/table/tablecontroller.hxx | 2 | ||||
-rw-r--r-- | include/svx/selectioncontroller.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 17 | ||||
-rw-r--r-- | svx/source/svdraw/selectioncontroller.cxx | 3 | ||||
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 24 |
5 files changed, 28 insertions, 20 deletions
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index 6145dc4eab1b..b366a582f845 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 214ccd9cff75..52bb9aa08efd 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 9ffd64317c3d..54e652648db2 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 6d8493436680..d8f7fbfcd51a 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 b2d5d6aeaa10..12c4bf6222c6 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -3152,21 +3152,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; } } } |