include/svx/svddrgv.hxx                                     |    4 
 officecfg/registry/schema/org/openoffice/Office/Draw.xcs    |    7 
 officecfg/registry/schema/org/openoffice/Office/Impress.xcs |    7 
 sd/source/ui/app/optsitem.cxx                               |  102 +++++++-----
 sd/source/ui/func/fucon3d.cxx                               |    2 
 sd/source/ui/func/fuconarc.cxx                              |    2 
 sd/source/ui/func/fuconcs.cxx                               |    2 
 sd/source/ui/func/fuconrec.cxx                              |    2 
 sd/source/ui/func/fuconstr.cxx                              |    4 
 sd/source/ui/func/fuconuno.cxx                              |    2 
 sd/source/ui/func/fuediglu.cxx                              |    4 
 sd/source/ui/func/fusel.cxx                                 |    6 
 sd/source/ui/func/futext.cxx                                |   10 -
 sd/source/ui/func/fuzoom.cxx                                |    2 
 sd/source/ui/inc/fupoor.hxx                                 |    1 
 sd/source/ui/inc/optsitem.hxx                               |    6 
 sd/source/ui/view/drviews5.cxx                              |    3 
 sd/source/ui/view/frmview.cxx                               |    1 
 svx/source/svdraw/svddrgv.cxx                               |    1 
 19 files changed, 111 insertions(+), 57 deletions(-)

New commits:
commit 83f7c6fe5bb233fa9827ff968710822b95562075
Author:     Sarper Akdemir <sarper.akdemir.ext...@allotropia.de>
AuthorDate: Wed Jul 12 17:15:13 2023 +0300
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Jul 21 14:32:16 2023 +0200

    tdf#50725: sd: add new configuration option DragThresholdPixels
    
    Adds new expert configuration option DragThresholdPixels for
    Impress and Draw under Misc/DragThresholdPixels.
    
    Also bumps up the previous hardcoded default
    value from 2 to 6.
    Assuming this value was set when 640x480 resolution was the
    most common resolution, currently scaling the hardcoded
    default by 3 makes sense.
    
    (eg. GTK uses 8 pixels as the default)
    
    Change-Id: I35c0eed3ce477685c759f517471ce0bdc8315864
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154379
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx
index 4e47a6bd85ea..2fb7543e0970 100644
--- a/include/svx/svddrgv.hxx
+++ b/include/svx/svddrgv.hxx
@@ -44,6 +44,7 @@ protected:
     tools::Rectangle            maDragLimit;
     OUString                    maInsPointUndoStr;
     SdrHdlKind                  meDragHdl;
+    sal_Int32                   mnDragThresholdPixels;
 
     bool mbFramDrag : 1;        // currently frame dragging
     bool mbMarkedHitMovesAlways : 1; // Persistent
@@ -112,6 +113,9 @@ public:
     void SetDragWithCopy(bool bOn) { mbDragWithCopy = bOn; }
     bool IsDragWithCopy() const { return mbDragWithCopy; }
 
+    void SetDragThresholdPixels(sal_Int32 nDragThresholdPixels) { 
mnDragThresholdPixels = nDragThresholdPixels; }
+    sal_Int32 GetDragThresholdPixels() const { return mnDragThresholdPixels; }
+
     void SetInsertGluePoint(bool bOn) { mbInsGluePoint = bOn; }
     bool IsInsertGluePoint() const { return mbInsGluePoint; }
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
index 91dce3db345d..069479636c8b 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
@@ -308,6 +308,13 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="DragThresholdPixels" oor:type="xs:int" 
oor:nillable="false">
+        <info>
+          <desc>Defines number of pixels the cursor can move before 
dragging.</desc>
+          <label>Drag Threshold</label>
+        </info>
+        <value>6</value>
+      </prop>
       <group oor:name="TextObject">
         <info>
           <desc>Defines text editing related configuration items.</desc>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
index cd7f06b87070..adb6d257b01e 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
@@ -509,6 +509,13 @@
         </info>
         <value>false</value>
       </prop>
+      <prop oor:name="DragThresholdPixels" oor:type="xs:int" 
oor:nillable="false">
+        <info>
+          <desc>Defines number of pixels the cursor can move before 
dragging.</desc>
+          <label>Drag Threshold</label>
+        </info>
+        <value>6</value>
+      </prop>
       <group oor:name="TextObject">
         <info>
           <desc>Contains text editing related configuration items.</desc>
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index 91c0048246e6..fe8bf5ea3b9f 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -426,7 +426,8 @@ SdOptionsMisc::SdOptionsMisc( bool bImpress, bool 
bUseConfig ) :
 
     // The default for 6.1-and-above documents is to use printer-independent
     // formatting.
-    mnPrinterIndependentLayout (1)
+    mnPrinterIndependentLayout (1),
+    mnDragThresholdPixels(6)
 {
     EnableModify( true );
 }
@@ -461,7 +462,8 @@ bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) 
const
             GetDisplay() == rOpt.GetDisplay() &&
             IsShowComments() == rOpt.IsShowComments() &&
             GetPresentationPenColor() == rOpt.GetPresentationPenColor() &&
-            GetPresentationPenWidth() == rOpt.GetPresentationPenWidth()
+            GetPresentationPenWidth() == rOpt.GetPresentationPenWidth() &&
+            GetDragThresholdPixels() == rOpt.GetDragThresholdPixels()
         );
 }
 
@@ -485,6 +487,7 @@ void SdOptionsMisc::GetPropNameArray( const char**& 
ppNames, sal_uLong& rCount )
         "Compatibility/PrinterIndependentLayout",
 
         "ShowComments",
+        "DragThresholdPixels",
 
         // just for impress
         "NewDoc/AutoPilot",
@@ -506,7 +509,7 @@ void SdOptionsMisc::GetPropNameArray( const char**& 
ppNames, sal_uLong& rCount )
         "TabBarVisible"
     };
 
-    rCount = ( IsImpress() ? SAL_N_ELEMENTS(aPropNames) : 14 );
+    rCount = ( IsImpress() ? SAL_N_ELEMENTS(aPropNames) : 15 );
     ppNames = aPropNames;
 }
 
@@ -527,49 +530,51 @@ bool SdOptionsMisc::ReadData( const Any* pValues )
 
     if( pValues[13].hasValue() )
         SetShowComments(  *o3tl::doAccess<bool>(pValues[ 13 ]) );
+    if (pValues[14].hasValue())
+        SetDragThreshold(*o3tl::doAccess<sal_Int32>(pValues[ 14 ]));
 
     // just for Impress
     if (IsImpress())
     {
-        if( pValues[14].hasValue() )
-            SetStartWithTemplate( *o3tl::doAccess<bool>(pValues[ 14 ]) );
         if( pValues[15].hasValue() )
-            SetSummationOfParagraphs( *o3tl::doAccess<bool>(pValues[ 15 ]) );
+            SetStartWithTemplate( *o3tl::doAccess<bool>(pValues[ 15 ]) );
         if( pValues[16].hasValue() )
-            SetShowUndoDeleteWarning( *o3tl::doAccess<bool>(pValues[ 16 ]) );
-
+            SetSummationOfParagraphs( *o3tl::doAccess<bool>(pValues[ 16 ]) );
         if( pValues[17].hasValue() )
-            SetSlideshowRespectZOrder(*o3tl::doAccess<bool>(pValues[ 17 ]));
+            SetShowUndoDeleteWarning( *o3tl::doAccess<bool>(pValues[ 17 ]) );
 
         if( pValues[18].hasValue() )
-            SetPreviewNewEffects(*o3tl::doAccess<bool>(pValues[ 18 ]));
+            SetSlideshowRespectZOrder(*o3tl::doAccess<bool>(pValues[ 18 ]));
 
         if( pValues[19].hasValue() )
-            SetPreviewChangedEffects(*o3tl::doAccess<bool>(pValues[ 19 ]));
+            SetPreviewNewEffects(*o3tl::doAccess<bool>(pValues[ 19 ]));
 
         if( pValues[20].hasValue() )
-            SetPreviewTransitions(*o3tl::doAccess<bool>(pValues[ 20 ]));
+            SetPreviewChangedEffects(*o3tl::doAccess<bool>(pValues[ 20 ]));
 
         if( pValues[21].hasValue() )
-            SetDisplay(*o3tl::doAccess<sal_Int32>(pValues[ 21 ]));
+            SetPreviewTransitions(*o3tl::doAccess<bool>(pValues[ 21 ]));
 
         if( pValues[22].hasValue() )
-            SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 22 ] 
) );
+            SetDisplay(*o3tl::doAccess<sal_Int32>(pValues[ 22 ]));
 
         if( pValues[23].hasValue() )
-            SetPresentationPenWidth( getSafeValue< double >( pValues[ 23 ] ) );
+            SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 23 ] 
) );
 
         if( pValues[24].hasValue() )
-            SetEnableSdremote( *o3tl::doAccess<bool>(pValues[ 24 ]) );
+            SetPresentationPenWidth( getSafeValue< double >( pValues[ 24 ] ) );
 
         if( pValues[25].hasValue() )
-            SetEnablePresenterScreen( *o3tl::doAccess<bool>(pValues[ 25 ]) );
+            SetEnableSdremote( *o3tl::doAccess<bool>(pValues[ 25 ]) );
+
+        if( pValues[26].hasValue() )
+            SetEnablePresenterScreen( *o3tl::doAccess<bool>(pValues[ 26 ]) );
 
-        if (pValues[26].hasValue() )
-            SetPresenterScreenFullScreen( *o3tl::doAccess<bool>(pValues[ 26 ]) 
);
+        if (pValues[27].hasValue() )
+            SetPresenterScreenFullScreen( *o3tl::doAccess<bool>(pValues[ 27 ]) 
);
 
-        if( pValues[27].hasValue() ) {
-            SetTabBarVisible( *o3tl::doAccess<bool>(pValues[ 27 ]) );
+        if( pValues[28].hasValue() ) {
+            SetTabBarVisible( *o3tl::doAccess<bool>(pValues[ 28 ]) );
         }
     }
 
@@ -593,27 +598,29 @@ bool SdOptionsMisc::WriteData( Any* pValues ) const
     pValues[ 11 ] <<= GetDefaultObjectSizeHeight();
     pValues[ 12 ] <<= GetPrinterIndependentLayout();
     pValues[ 13 ] <<= IsShowComments();
+    pValues[ 14 ] <<= GetDragThresholdPixels();
 
     // just for Impress
     if (IsImpress())
     {
-        pValues[ 14 ] <<= IsStartWithTemplate();
-        pValues[ 15 ] <<= IsSummationOfParagraphs();
-        pValues[ 16 ] <<= IsShowUndoDeleteWarning();
-        pValues[ 17 ] <<= IsSlideshowRespectZOrder();
-
-        pValues[ 18 ] <<= IsPreviewNewEffects();
-        pValues[ 19 ] <<= IsPreviewChangedEffects();
-        pValues[ 20 ] <<= IsPreviewTransitions();
-
-        pValues[ 21 ] <<= GetDisplay();
-
-        pValues[ 22 ] <<= GetPresentationPenColor();
-        pValues[ 23 ] <<= GetPresentationPenWidth();
-        pValues[ 24 ] <<= IsEnableSdremote();
-        pValues[ 25 ] <<= IsEnablePresenterScreen();
-        pValues[ 26 ] <<= IsPresenterScreenFullScreen();
-        pValues[ 27 ] <<= IsTabBarVisible();
+        pValues[ 15 ] <<= IsStartWithTemplate();
+        pValues[ 16 ] <<= IsSummationOfParagraphs();
+        pValues[ 17 ] <<= IsShowUndoDeleteWarning();
+        pValues[ 18 ] <<= IsSlideshowRespectZOrder();
+
+        pValues[ 19 ] <<= IsPreviewNewEffects();
+        pValues[ 20 ] <<= IsPreviewChangedEffects();
+        pValues[ 21 ] <<= IsPreviewTransitions();
+
+        pValues[ 22 ] <<= GetDisplay();
+
+        pValues[ 23 ] <<= GetPresentationPenColor();
+        pValues[ 24 ] <<= GetPresentationPenWidth();
+        pValues[ 25 ] <<= IsEnableSdremote();
+        pValues[ 26 ] <<= IsEnablePresenterScreen();
+        pValues[ 27 ] <<= IsPresenterScreenFullScreen();
+        pValues[ 28 ] <<= IsTabBarVisible();
+
     }
 
     return true;
@@ -674,6 +681,7 @@ SdOptionsMiscItem::SdOptionsMiscItem( SdOptions const * 
pOpts, ::sd::FrameView c
         maOptionsMisc.SetDoubleClickTextEdit( pView->IsDoubleClickTextEdit() );
         maOptionsMisc.SetClickChangeRotation( pView->IsClickChangeRotation() );
         maOptionsMisc.SetSolidDragging( pView->IsSolidDragging() );
+        maOptionsMisc.SetDragThreshold(pView->GetDragThresholdPixels());
     }
     else if( pOpts )
     {
@@ -687,6 +695,7 @@ SdOptionsMiscItem::SdOptionsMiscItem( SdOptions const * 
pOpts, ::sd::FrameView c
         maOptionsMisc.SetDoubleClickTextEdit( pOpts->IsDoubleClickTextEdit() );
         maOptionsMisc.SetClickChangeRotation( pOpts->IsClickChangeRotation() );
         maOptionsMisc.SetSolidDragging( pOpts->IsSolidDragging() );
+        maOptionsMisc.SetDragThreshold(pOpts->GetDragThresholdPixels());
     }
 }
 
@@ -737,6 +746,8 @@ void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
 
     pOpts->SetPresentationPenColor( maOptionsMisc.GetPresentationPenColor() );
     pOpts->SetPresentationPenWidth( maOptionsMisc.GetPresentationPenWidth() );
+
+    pOpts->SetDragThreshold( maOptionsMisc.GetDragThresholdPixels() );
 }
 
 /*************************************************************************
@@ -1398,6 +1409,21 @@ void SdOptions::StoreConfig()
     SdOptionsPrint::Store();
 }
 
+sal_Int32 SdOptionsMisc::GetDragThresholdPixels() const
+{
+    Init();
+    return mnDragThresholdPixels;
+}
+
+void SdOptionsMisc::SetDragThreshold(sal_Int32 nDragThresholdPixels)
+{
+    if (mnDragThresholdPixels != nDragThresholdPixels)
+    {
+        OptionsChanged();
+        mnDragThresholdPixels = nDragThresholdPixels;
+    }
+}
+
 sal_Int32 SdOptionsMisc::GetDisplay() const
 {
     Init();
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx
index 812a8e705cd7..b26d634898b5 100644
--- a/sd/source/ui/func/fucon3d.cxx
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -324,7 +324,7 @@ bool FuConstruct3dObject::MouseButtonDown(const MouseEvent& 
rMEvt)
         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
         mpWindow->CaptureMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
         weld::WaitObject aWait(mpViewShell->GetFrameWeld());
 
diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx
index b69eb0cadee1..94718f1ed4c1 100644
--- a/sd/source/ui/func/fuconarc.cxx
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -110,7 +110,7 @@ bool FuConstructArc::MouseButtonDown( const MouseEvent& 
rMEvt )
     {
         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
         mpWindow->CaptureMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
         mpView->BegCreateObj(aPnt, nullptr, nDrgLog);
 
         SdrObject* pObj = mpView->GetCreateObj();
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
index d8df8c699b9a..7ca906c51805 100644
--- a/sd/source/ui/func/fuconcs.cxx
+++ b/sd/source/ui/func/fuconcs.cxx
@@ -89,7 +89,7 @@ bool FuConstructCustomShape::MouseButtonDown(const 
MouseEvent& rMEvt)
         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
         mpWindow->CaptureMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
         mpView->BegCreateObj(aPnt, nullptr, nDrgLog);
 
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index 5d7aeb173bcc..ddd432a6bb8a 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -250,7 +250,7 @@ bool FuConstructRectangle::MouseButtonDown(const 
MouseEvent& rMEvt)
         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
         mpWindow->CaptureMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
         if (mpView->GetCurrentObjIdentifier() == SdrObjKind::Caption)
         {
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index a3ccf35d4f40..36c1f3428a89 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -87,7 +87,7 @@ bool FuConstruct::MouseButtonDown(const MouseEvent& rMEvt)
 
         if ( pHdl != nullptr || mpView->IsMarkedHit(aMDPos, nHitLog) )
         {
-            sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+            sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
             mpView->BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
             bReturn = true;
         }
@@ -164,7 +164,7 @@ bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
     if ( mpView &&  !mpView->IsAction() )
     {
         mpWindow->ReleaseMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
         if ( !mpView->AreObjectsMarked() )
         {
diff --git a/sd/source/ui/func/fuconuno.cxx b/sd/source/ui/func/fuconuno.cxx
index 4bba20eade70..6086d62a0ea4 100644
--- a/sd/source/ui/func/fuconuno.cxx
+++ b/sd/source/ui/func/fuconuno.cxx
@@ -82,7 +82,7 @@ bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& 
rMEvt)
     {
         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
         mpWindow->CaptureMouse();
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
         mpView->BegCreateObj(aPnt, nullptr, nDrgLog);
         bReturn = true;
     }
diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx
index 5d9d614479e9..9d0281e2cc5e 100644
--- a/sd/source/ui/func/fuediglu.cxx
+++ b/sd/source/ui/func/fuediglu.cxx
@@ -90,7 +90,7 @@ bool FuEditGluePoints::MouseButtonDown(const MouseEvent& 
rMEvt)
     {
         bReturn = true;
         sal_uInt16 nHitLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
         mpWindow->CaptureMouse();
 
         SdrViewEvent aVEvt;
@@ -227,7 +227,7 @@ bool FuEditGluePoints::MouseButtonUp(const MouseEvent& 
rMEvt)
 
     FuDraw::MouseButtonUp(rMEvt);
 
-    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
     Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
 
     if (std::abs(aMDPos.X() - aPos.X()) < nDrgLog &&
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 4d7fec5f8d43..501a99369248 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -143,7 +143,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
         return true;
     }
 
-    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
     sal_uInt16 nHitLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
 
     if (comphelper::LibreOfficeKit::isActive())
@@ -657,7 +657,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
 
     Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     sal_uInt16 nHitLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
-    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
     if (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints())
     {
@@ -903,7 +903,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
             {
                 mpView->EndAction();
 
-                sal_uInt16 nDrgLog2 = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+                sal_uInt16 nDrgLog2 = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
                 Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
 
                 if (std::abs(aMDPos.X() - aPos.X()) < nDrgLog2 &&
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 48c166792e70..c1da5f338bee 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -439,7 +439,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
                             eHit = mpView->PickAnything(rMEvt, 
SdrMouseEventKind::BUTTONDOWN, aVEvt);
                             if( (eHit == SdrHitKind::Handle) || (eHit == 
SdrHitKind::MarkedObject) )
                             {
-                                sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+                                sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
                                 mpView->BegDragObj(aMDPos, nullptr, 
aVEvt.mpHdl, nDrgLog);
                             }
                         }
@@ -452,7 +452,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
                     // create object
                     mpView->SetCurrentObj(SdrObjKind::Text);
                     mpView->SetEditMode(SdrViewEditMode::Create);
-                    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+                    sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
                     mpView->BegCreateObj(aMDPos, nullptr, nDrgLog);
                 }
                 else
@@ -623,7 +623,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
         mpView->ForceMarkedToAnotherPage();
         mpView->SetCurrentObj(SdrObjKind::Text);
 
-        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+        sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
         if (bJustEndedEdit)
         {
@@ -720,7 +720,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
 
     ForcePointer(&rMEvt);
     mpWindow->ReleaseMouse();
-    sal_uInt16 nDrgLog1 = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+    sal_uInt16 nDrgLog1 = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
 
     if ( mpView && !mpView->AreObjectsMarked() &&
          std::abs(aMDPos.X() - aPnt.X()) < nDrgLog1 &&
@@ -743,7 +743,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
             // text body (left-justified AutoGrow)
             mpView->SetCurrentObj(SdrObjKind::Text);
             mpView->SetEditMode(SdrViewEditMode::Create);
-            sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+            sal_uInt16 nDrgLog = sal_uInt16 ( 
mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
             mpView->BegCreateObj(aMDPos, nullptr, nDrgLog);
 
             bool bSnapEnabled = mpView->IsSnapEnabled();
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx
index bfa01c179d08..2c966daa2e32 100644
--- a/sd/source/ui/func/fuzoom.cxx
+++ b/sd/source/ui/func/fuzoom.cxx
@@ -158,7 +158,7 @@ bool FuZoom::MouseButtonUp(const MouseEvent& rMEvt)
     {
         // Zoom
         Size aZoomSizePixel = mpWindow->LogicToPixel(aZoomRect).GetSize();
-        sal_uLong nTol = DRGPIX + DRGPIX;
+        sal_uLong nTol = 2 * mpView->GetDragThresholdPixels();
 
         if ( ( aZoomSizePixel.Width() < static_cast<::tools::Long>(nTol) && 
aZoomSizePixel.Height() < static_cast<::tools::Long>(nTol) ) || rMEvt.IsMod1() )
         {
diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx
index 6a2611cb5054..e0103a111d51 100644
--- a/sd/source/ui/inc/fupoor.hxx
+++ b/sd/source/ui/inc/fupoor.hxx
@@ -49,7 +49,6 @@ class FuPoor : public SimpleReferenceComponent
 public:
     static const int HITPIX = 2;                   // hit tolerance in pixel
     static const int HITLOG = 53;                  // hit tolerance in mm100
-    static const int DRGPIX = 2;                   // minimal drag move in 
pixel
     static const int DRGLOG = 53;                  // minimal drag move in 
mm100
 
 
diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx
index 6226e2951c33..ffa8de612c61 100644
--- a/sd/source/ui/inc/optsitem.hxx
+++ b/sd/source/ui/inc/optsitem.hxx
@@ -222,6 +222,9 @@ private:
         the modules.
     */
     sal_uInt16  mnPrinterIndependentLayout;     // 
Misc/Compatibility/PrinterIndependentLayout
+
+    /// Minimum mouse move distance for it to register as a drag action
+    sal_Int32 mnDragThresholdPixels; // Misc/DragThresholdPixels
 // Misc
 
 protected:
@@ -277,6 +280,9 @@ public:
     double    GetPresentationPenWidth() const { Init(); return mnPenWidth; }
     void      SetPresentationPenWidth( double nPenWidth ) { if( mnPenWidth != 
nPenWidth ) { OptionsChanged(); mnPenWidth = nPenWidth; } }
 
+    sal_Int32 GetDragThresholdPixels() const;
+    void SetDragThreshold(sal_Int32 nDragThresholdPixels);
+
     void    SetStartWithTemplate( bool bOn ) { if( bStartWithTemplate != bOn ) 
{ OptionsChanged(); bStartWithTemplate = bOn; } }
     void    SetMarkedHitMovesAlways( bool bOn ) { if( bMarkedHitMovesAlways != 
bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } }
     void    SetMoveOnlyDragging( bool bOn ) { if( bMoveOnlyDragging != bOn ) { 
OptionsChanged(); bMoveOnlyDragging = bOn; } }
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 4ca53557cac1..8583ecc182c7 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -225,6 +225,9 @@ void DrawViewShell::ReadFrameViewData(FrameView* pView)
     if (mpDrawView->IsMasterPagePaintCaching() != 
pView->IsMasterPagePaintCaching())
         mpDrawView->SetMasterPagePaintCaching( 
pView->IsMasterPagePaintCaching() );
 
+    if (mpDrawView->GetDragThresholdPixels() != 
pView->GetDragThresholdPixels())
+        mpDrawView->SetDragThresholdPixels( pView->GetDragThresholdPixels() );
+
     // handle size: 9 pixels
     sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
     if( nTmp != 9 )
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 2e2d742d9579..61b7bfdf2ecf 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -315,6 +315,7 @@ void FrameView::Update(SdOptions const * pOptions)
     SetMasterPagePaintCaching( pOptions->IsMasterPagePaintCaching() );
 
     SetDragWithCopy(pOptions->IsDragWithCopy());
+    SetDragThresholdPixels(pOptions->GetDragThresholdPixels());
     SetDoubleClickTextEdit( pOptions->IsDoubleClickTextEdit() );
     SetClickChangeRotation( pOptions->IsClickChangeRotation() );
 }
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 9616b85bcb4c..8b9567c20be0 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -47,6 +47,7 @@ SdrDragView::SdrDragView(SdrModel& rSdrModel, OutputDevice* 
pOut)
     , mpDragHdl(nullptr)
     , mpInsPointUndo(nullptr)
     , meDragHdl(SdrHdlKind::Move)
+    , mnDragThresholdPixels(6)
     , mbFramDrag(false)
     , mbMarkedHitMovesAlways(false)
     , mbDragLimit(false)

Reply via email to