summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-12-18 15:11:38 +0100
committerGabor Kelemen <gabor.kelemen.extern@allotropia.de>2025-01-21 12:13:16 +0100
commit47bf215cc7693bde89143f63b88556c61a68a132 (patch)
tree5bf1bf9f6296cf3e1a5232ff155fa5d9719bc9f0 /sw/inc
parent72beaf19974e71abb5f3e9ef99dc7455b6323899 (diff)
tdf#50743 tdf#37507 Improve scrolling while selecting
If the mouse leaves the document window scrolling of selections happens now in smaller steps so the user is able to stop at the intended position easier. Change-Id: Ifd21c92936021f8e2213d34446672e2a8eab568f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178724 Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/crsrsh.hxx8
-rw-r--r--sw/inc/fesh.hxx2
-rw-r--r--sw/inc/mdiexp.hxx4
-rw-r--r--sw/inc/view.hxx7
-rw-r--r--sw/inc/viewsh.hxx9
5 files changed, 21 insertions, 9 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 08aae0878d93..773379e1eb0a 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -168,7 +168,7 @@ public:
SW_DLLPUBLIC void UpdateCursor(
sal_uInt16 eFlags = SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE,
- bool bIdleEnd = false );
+ bool bIdleEnd = false, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault );
private:
@@ -422,7 +422,7 @@ public:
* the cursor is done in order to get at the properties under the mouse pointer.
*/
SW_DLLPUBLIC int SetCursor(const Point& rPt, bool bOnlyText = false, bool bBlock = true,
- bool bFieldInfo = false);
+ bool bFieldInfo = false, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault);
/*
* Notification that the visible area was changed. m_aVisArea is reset, then
@@ -735,7 +735,7 @@ public:
// Place only the visible cursor at the given position in the document.
// Return false if SPoint was corrected by layout.
// (This is needed for displaying the Drag&Drop/Copy-Cursor.)
- bool SetVisibleCursor( const Point &rPt );
+ bool SetVisibleCursor( const Point &rPt, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault );
inline void UnSetVisibleCursor();
SW_DLLPUBLIC SwVisibleCursor* GetVisibleCursor() const;
@@ -817,7 +817,7 @@ public:
bool GotoRegion( std::u16string_view rName );
// show the current selection
- virtual void MakeSelVisible();
+ virtual void MakeSelVisible(ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault);
// set the cursor to a NOT protected/hidden node
bool FindValidContentNode( bool bOnlyText );
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 94f5f0d3c09e..c1b1ae7e9881 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -360,7 +360,7 @@ public:
void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr );
/// Show current selection (frame / draw object as required).
- virtual void MakeSelVisible() override;
+ virtual void MakeSelVisible(ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault) override;
/** @return FrameFormat of object that may be under Point.
Object does not become selected! */
diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
index afe308e1ad89..6d4af73bd80b 100644
--- a/sw/inc/mdiexp.hxx
+++ b/sw/inc/mdiexp.hxx
@@ -22,6 +22,7 @@
#include "tblenum.hxx"
#include "swdllapi.h"
#include <unotools/resmgr.hxx>
+#include "viewsh.hxx"
#include <string_view>
@@ -30,7 +31,8 @@ class Size;
class SwViewShell;
class SwDocShell;
-extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY);
+extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY
+ , ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault);
extern bool IsScrollMDI(SwViewShell const * pVwSh, const SwRect &);
extern void SizeNotify(SwViewShell const * pVwSh, const Size &);
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 3eba3163d333..220c97af2627 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -31,6 +31,7 @@
#include "swdllapi.h"
#include "swtypes.hxx"
#include "shellid.hxx"
+#include "viewsh.hxx"
#include <svx/sdr/overlay/overlayobject.hxx>
@@ -302,7 +303,8 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect,
sal_uInt16 nRangeX,
- sal_uInt16 nRangeY);
+ sal_uInt16 nRangeY,
+ ScrollSizeMode eScrollSizeMode);
SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const;
SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const;
@@ -447,7 +449,8 @@ public:
bool IsScroll(const tools::Rectangle& rRect) const;
void Scroll( const tools::Rectangle& rRect,
sal_uInt16 nRangeX = USHRT_MAX,
- sal_uInt16 nRangeY = USHRT_MAX);
+ sal_uInt16 nRangeY = USHRT_MAX,
+ ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault);
tools::Long SetVScrollMax(tools::Long lMax);
tools::Long SetHScrollMax(tools::Long lMax);
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index b75ff5009d83..7b2565f18703 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -84,6 +84,13 @@ enum class LockPaintReason
ExampleFrame
};
+enum class ScrollSizeMode
+{
+ ScrollSizeDefault, //usually 30% of the visible area
+ ScrollSizeMouseSelection, //make target rectangle visible
+ ScrollSizeTimer, // increase of timer based scrolling
+ ScrollSizeTimer2 // more increase of timer based scrolling
+};
namespace vcl
{
typedef OutputDevice RenderContext;
@@ -286,7 +293,7 @@ public:
void setLOKVisibleArea(const tools::Rectangle& rArea) { maLOKVisibleArea = rArea; }
// If necessary scroll until passed Rect is situated in visible sector.
- void MakeVisible( const SwRect & );
+ void MakeVisible( const SwRect &, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault );
// At nearest occasion pass new document size to UI.
void SizeChgNotify();