sc/source/ui/inc/gridwin.hxx | 2 ++ sc/source/ui/view/gridwin.cxx | 1 + sc/source/ui/view/gridwin3.cxx | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-)
New commits: commit d10ad0a8836c19a332b17eb308bee82640825e99 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Mon Apr 14 11:59:22 2025 +0200 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Tue Apr 22 17:04:20 2025 +0200 tdf#166177 Fixes unintende switch to rotate mode Fixes switch to rotate mode after inserting or moving a shape. Change-Id: I4e8ce8b5891a08c6c3f20a9c29fa4bef4428eb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184229 Tested-by: allotropia jenkins <jenk...@allotropia.de> Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 48c47dd57714..1d3d260db8c6 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -211,6 +211,8 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::DocWindow, public DropTarget ScAddress aAutoMarkPos; ScAddress aListValPos; + Point aDrawSelectionPos; + tools::Rectangle aInvertRect; RfCorner aRFSelectedCorned; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 6041bd929db9..62c1e875c387 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -390,6 +390,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData& rData, ScSplitPos aComboButton( GetOutDev() ), aCurMousePos( 0,0 ), nPaintCount( 0 ), + aDrawSelectionPos( 0,0 ), aRFSelectedCorned( NONE ), maShowPageBreaksTimer("ScGridWindow maShowPageBreaksTimer"), bEEMouse( false ), diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 78397f54d6e8..0645ea6aab47 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -31,6 +31,7 @@ #include <output.hxx> #include <drawview.hxx> #include <fupoor.hxx> +#include <fusel.hxx> #include <scmod.hxx> #include <appoptio.hxx> @@ -51,6 +52,12 @@ static bool lcl_HasSelectionChanged(const SdrMarkList & rBeforeList, const SdrMa return false; } +static bool lcl_PosUnchanged(const tools::Rectangle& rSelectionRect, const Point& rDrawSelectionPos) +{ + return rDrawSelectionPos.X() == rSelectionRect.Left() && + rDrawSelectionPos.Y() == rSelectionRect.Top(); +} + bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) { bool bRet = false; @@ -66,6 +73,15 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) pDraw->SetWindow( this ); Point aLogicPos = PixelToLogic(rMEvt.GetPosPixel()); + SdrMarkList aPreMarkList = pDrView->GetMarkedObjectList(); + if(!aPreMarkList.GetMarkCount()) + aDrawSelectionPos = Point(0,0); + else + { + tools::Rectangle aRect = pDrView->GetAllMarkedRect(); + aDrawSelectionPos = Point(aRect.Left(), aRect.Top()); + } + if ( pDraw->IsDetectiveHit( aLogicPos ) ) { // nothing on detective arrows (double click is evaluated on ButtonUp) @@ -73,7 +89,6 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) } else { - SdrMarkList aPreMarkList = pDrView->GetMarkedObjectList(); bRet = pDraw->MouseButtonDown( rMEvt ); if (bRet) { @@ -129,7 +144,9 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) && rMEvt.IsLeft() && rMEvt.GetClicks() == 1 && SC_MOD()->GetAppOptions().IsClickChangeRotation() - && !pDraw->HasSelectionChanged()) + && !pDraw->HasSelectionChanged() + && dynamic_cast<FuSelection*>(pDraw) + && lcl_PosUnchanged(pDrView->GetAllMarkedRect(), aDrawSelectionPos)) { mrViewData.GetView()->SwitchRotateMode(); }