Kaydet (Commit) d98c817c authored tarafından Matúš Kukan's avatar Matúš Kukan

Allow to move only callout handle with shift key (cp#1000084)

When line callout was used, you couldn't move the point next to
the rectangle.
Now it's possible with shift key pressed.

Change-Id: I70565e4e3f80daf0e1007031ef7d49036fb0e26b
üst d5dd1216
...@@ -127,6 +127,7 @@ private: ...@@ -127,6 +127,7 @@ private:
// bitfield // bitfield
bool mbMoveOnly : 1; bool mbMoveOnly : 1;
bool mbSolidDraggingActive : 1; bool mbSolidDraggingActive : 1;
bool mbShiftPressed : 1;
protected: protected:
// access for derivated classes to maSdrDragEntries // access for derivated classes to maSdrDragEntries
...@@ -193,6 +194,8 @@ public: ...@@ -193,6 +194,8 @@ public:
void Show(); void Show();
void Hide(); void Hide();
bool IsShiftPressed() { return mbShiftPressed; }
void SetShiftPressed(bool bShiftPressed) { mbShiftPressed = bShiftPressed; }
virtual void TakeSdrDragComment(OUString& rStr) const=0; virtual void TakeSdrDragComment(OUString& rStr) const=0;
virtual bool BeginSdrDrag()=0; virtual bool BeginSdrDrag()=0;
virtual void MoveSdrDrag(const Point& rPnt)=0; virtual void MoveSdrDrag(const Point& rPnt)=0;
......
...@@ -110,7 +110,8 @@ public: ...@@ -110,7 +110,8 @@ public:
SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag ); SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const; SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const;
SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const; SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination,
const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj, bool bMoveCalloutRectangle ) const;
// #i37011# centralize throw-away of render geometry // #i37011# centralize throw-away of render geometry
void InvalidateRenderGeometry(); void InvalidateRenderGeometry();
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <svx/svddrag.hxx> #include <svx/svddrag.hxx>
#include <svx/xpool.hxx> #include <svx/xpool.hxx>
#include <svx/xpoly.hxx> #include <svx/xpoly.hxx>
#include <svx/svddrgmt.hxx>
#include <svx/svdmodel.hxx> #include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx> #include <svx/svdpage.hxx>
#include "svx/svditer.hxx" #include "svx/svditer.hxx"
...@@ -2069,7 +2070,8 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj ...@@ -2069,7 +2070,8 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObj
} }
} }
void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination,
const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj, bool bMoveCalloutRectangle ) const
{ {
std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) ); std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) );
if ( nCustomShapeHdlNum < aInteractionHandles.size() ) if ( nCustomShapeHdlNum < aInteractionHandles.size() )
...@@ -2080,7 +2082,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination, const ...@@ -2080,7 +2082,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination, const
try try
{ {
com::sun::star::awt::Point aPt( aDestination.X(), aDestination.Y() ); com::sun::star::awt::Point aPt( aDestination.X(), aDestination.Y() );
if ( aInteractionHandle.nMode & CUSTOMSHAPE_HANDLE_MOVE_SHAPE ) if ( aInteractionHandle.nMode & CUSTOMSHAPE_HANDLE_MOVE_SHAPE && bMoveCalloutRectangle )
{ {
sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X; sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y; sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
...@@ -2120,7 +2122,7 @@ bool SdrObjCustomShape::applySpecialDrag(SdrDragStat& rDrag) ...@@ -2120,7 +2122,7 @@ bool SdrObjCustomShape::applySpecialDrag(SdrDragStat& rDrag)
case HDL_CUSTOMSHAPE1 : case HDL_CUSTOMSHAPE1 :
{ {
rDrag.SetEndDragChangesGeoAndAttributes(true); rDrag.SetEndDragChangesGeoAndAttributes(true);
DragMoveCustomShapeHdl( rDrag.GetNow(), (sal_uInt16)pHdl->GetPointNum(), this ); DragMoveCustomShapeHdl( rDrag.GetNow(), (sal_uInt16)pHdl->GetPointNum(), this, !rDrag.GetDragMethod()->IsShiftPressed() );
SetRectsDirty(); SetRectsDirty();
InvalidateRenderGeometry(); InvalidateRenderGeometry();
SetChanged(); SetChanged();
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "hintids.hxx" #include "hintids.hxx"
#include <svx/sdrobjectfilter.hxx> #include <svx/sdrobjectfilter.hxx>
#include <svx/svddrgmt.hxx>
#include <svx/svditer.hxx> #include <svx/svditer.hxx>
#include <svx/svdobj.hxx> #include <svx/svdobj.hxx>
#include <svx/svdouno.hxx> #include <svx/svdouno.hxx>
...@@ -599,14 +600,15 @@ void SwFEShell::SetDragMode( sal_uInt16 eDragMode ) ...@@ -599,14 +600,15 @@ void SwFEShell::SetDragMode( sal_uInt16 eDragMode )
Imp()->GetDrawView()->SetDragMode( (SdrDragMode)eDragMode ); Imp()->GetDrawView()->SetDragMode( (SdrDragMode)eDragMode );
} }
long SwFEShell::BeginDrag( const Point* pPt, bool ) long SwFEShell::BeginDrag( const Point* pPt, bool bIsShift)
{ {
SdrView *pView = Imp()->GetDrawView(); SdrView *pView = Imp()->GetDrawView();
if ( pView && pView->AreObjectsMarked() ) if ( pView && pView->AreObjectsMarked() )
{ {
delete pChainFrom; delete pChainTo; pChainFrom = pChainTo = 0; delete pChainFrom; delete pChainTo; pChainFrom = pChainTo = 0;
SdrHdl* pHdl = pView->PickHandle( *pPt ); SdrHdl* pHdl = pView->PickHandle( *pPt );
pView->BegDragObj( *pPt, 0, pHdl ); if (pView->BegDragObj( *pPt, 0, pHdl ))
pView->GetDragMethod()->SetShiftPressed( bIsShift );
::FrameNotify( this, FLY_DRAG ); ::FrameNotify( this, FLY_DRAG );
return 1; return 1;
} }
......
...@@ -648,16 +648,16 @@ void SwWrtShell::SetRedlineModeAndCheckInsMode( sal_uInt16 eMode ) ...@@ -648,16 +648,16 @@ void SwWrtShell::SetRedlineModeAndCheckInsMode( sal_uInt16 eMode )
// Edit frame // Edit frame
long SwWrtShell::BeginFrmDrag(const Point *pPt, bool) long SwWrtShell::BeginFrmDrag(const Point *pPt, bool bIsShift)
{ {
fnDrag = &SwFEShell::Drag; fnDrag = &SwFEShell::Drag;
if(bStartDrag) if(bStartDrag)
{ {
Point aTmp( nStartDragX, nStartDragY ); Point aTmp( nStartDragX, nStartDragY );
SwFEShell::BeginDrag( &aTmp, false ); SwFEShell::BeginDrag( &aTmp, bIsShift );
} }
else else
SwFEShell::BeginDrag( pPt, false ); SwFEShell::BeginDrag( pPt, bIsShift );
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment