[Libreoffice-commits] core.git: sc/source sd/source sw/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Wed Mar 16 10:27:39 UTC 2016
sc/source/ui/drawfunc/fupoor.cxx | 12 +++++++++---
sd/source/ui/func/fupoor.cxx | 13 ++++++++-----
sw/source/uibase/docvw/edtwin.cxx | 17 +++++++++++------
3 files changed, 28 insertions(+), 14 deletions(-)
New commits:
commit e41d23abb03a0c5a5c50be290c2265513e178889
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Tue Mar 15 19:43:36 2016 +0100
tdf#84953 Only resize proportionally when dragging on a corner
Change-Id: Iec4eda867216575e058fa673788d9345da05c872
Reviewed-on: https://gerrit.libreoffice.org/23291
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index cdb0ac3..f0b8639 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -297,9 +297,15 @@ bool FuPoor::doConstructOrthogonal() const
if (rMarkList.GetMarkCount() == 1)
{
sal_uInt16 aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier();
- return aObjIdentifier == OBJ_GRAF ||
- aObjIdentifier == OBJ_MEDIA ||
- aObjIdentifier == OBJ_OLE2;
+ bool bIsMediaSelected = aObjIdentifier == OBJ_GRAF ||
+ aObjIdentifier == OBJ_MEDIA ||
+ aObjIdentifier == OBJ_OLE2;
+
+ SdrHdl* pHdl = pView->PickHandle(aMDPos);
+ // Resize proportionally when media is selected and the user drags on a corner
+ if (pHdl)
+ return bIsMediaSelected && pHdl->IsCornerHdl();
+ return bIsMediaSelected;
}
}
else if (aSfxRequest.GetSlot() == SID_DRAW_XPOLYGON || aSfxRequest.GetSlot() == SID_DRAW_XPOLYGON_NOFILL)
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index c1f4989..b39c569 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -1124,23 +1124,26 @@ bool FuPoor::cancel()
bool FuPoor::doConstructOrthogonal() const
{
// Check whether a media object is selected
- bool bIsMediaSelected = false;
+ bool bResizeKeepRatio = false;
// tdf#89758 Avoid interactive crop preview from being proportionally scaled by default.
if (mpView->AreObjectsMarked() && mpView->GetDragMode() != SDRDRAG_CROP)
{
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if (rMarkList.GetMarkCount() == 1)
{
- SdrMark* pMark = rMarkList.GetMark(0);
- sal_uInt16 aObjIdentifier = pMark->GetMarkedSdrObj()->GetObjIdentifier();
- bIsMediaSelected = aObjIdentifier == OBJ_GRAF ||
+ sal_uInt16 aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier();
+ bResizeKeepRatio = aObjIdentifier == OBJ_GRAF ||
aObjIdentifier == OBJ_MEDIA ||
aObjIdentifier == OBJ_OLE2;
}
}
+ SdrHdl* pHdl = mpView->PickHandle(aMDPos);
+ // Resize proportionally when media is selected and the user drags on a corner
+ if (pHdl)
+ bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
return (
- bIsMediaSelected ||
+ bResizeKeepRatio ||
SID_DRAW_XLINE == nSlotId ||
SID_DRAW_CIRCLEARC == nSlotId ||
SID_DRAW_SQUARE == nSlotId ||
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d7be3c0..ad12634 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4079,29 +4079,34 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
if( bIsDocReadOnly )
break;
- bool bIsMediaSelected = rSh.GetSelectionType() & nsSelectionType::SEL_GRF ||
+ bool bResizeKeepRatio = rSh.GetSelectionType() & nsSelectionType::SEL_GRF ||
rSh.GetSelectionType() & nsSelectionType::SEL_MEDIA ||
rSh.GetSelectionType() & nsSelectionType::SEL_OLE;
bool bisResize = g_eSdrMoveHdl != HDL_MOVE;
+ // Resize proportionally when media is selected and the user drags on a corner
+ const Point aSttPt(PixelToLogic(m_aStartPos));
+ SdrHdl* pHdl = pSdrView->PickHandle(aSttPt);
+ if (pHdl)
+ bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
+
if (pSdrView)
{
if (pSdrView->GetDragMode() == SDRDRAG_CROP)
bisResize = false;
-
if (rMEvt.IsShift())
{
- pSdrView->SetAngleSnapEnabled(!bIsMediaSelected);
+ pSdrView->SetAngleSnapEnabled(!bResizeKeepRatio);
if (bisResize)
- pSdrView->SetOrtho(!bIsMediaSelected);
+ pSdrView->SetOrtho(!bResizeKeepRatio);
else
pSdrView->SetOrtho(true);
}
else
{
- pSdrView->SetAngleSnapEnabled(bIsMediaSelected);
+ pSdrView->SetAngleSnapEnabled(bResizeKeepRatio);
if (bisResize)
- pSdrView->SetOrtho(bIsMediaSelected);
+ pSdrView->SetOrtho(bResizeKeepRatio);
else
pSdrView->SetOrtho(false);
}
More information about the Libreoffice-commits
mailing list