summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2024-06-08 23:39:13 +0200
committerLászló Németh <nemeth@numbertext.org>2024-06-10 23:22:20 +0200
commitb285cf49dffe8a74f0ba54b88b781db6a68a4f3b (patch)
tree876739c8dde8e64505dfa50bc2fd44af23360f65 /svtools
parent4cd4be3e7cc77953813a6f1713b6b8245ca92214 (diff)
tdf#157833 tdf#155692 sw: fix hit area to resize row/col
Fix 1) missing or too narrow hit area (tdf#157833), and 2) not recognized click inside hit area (tdf#155692). It was impossible or very hard to resize text table columns and rows using the mouse: 1) Double arrow, i.e. "resize row/col" mouse pointer shows the hit area of text table row/column borders. This was missing or was very narrow with normal zoom, because of an obsolete constant for low resolution displays. Change this constant used in IsSame() with scale-dependent values to support the same hit area on different zoom levels and with different screen resolutions. 2) Especially on bigger zoom, "resize row/col" mouse pointer, i. e. the visible hit area didn't guarantee drag & drop any more because of too small hit area in pixels in the svruler code base: clicking on not exactly center of the hit area resulted selection of cells or the cell content instead of drag & drop the border, violating WYSIWYG. Enlarge the default 1 pixel to 5 pixels to cover the whole hit area. Note: only for resizing table borders inside the document, not on the horizontal and vertical rulers. Change-Id: I398a0de782040b0ad18835658ed625117a6e0e06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168605 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/ruler.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index b5b49047a064..074df6afabcc 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -1416,7 +1416,8 @@ void Ruler::ImplUpdate( bool bMustCalc )
}
bool Ruler::ImplDoHitTest( const Point& rPos, RulerSelection* pHitTest,
- bool bRequireStyle, RulerIndentStyle nRequiredStyle ) const
+ bool bRequireStyle, RulerIndentStyle nRequiredStyle,
+ tools::Long nTolerance ) const
{
sal_Int32 i;
sal_uInt16 nStyle;
@@ -1557,7 +1558,7 @@ bool Ruler::ImplDoHitTest( const Point& rPos, RulerSelection* pHitTest,
}
// test the borders
- int nBorderTolerance = 1;
+ int nBorderTolerance = nTolerance;
if(pHitTest->bExpandTest)
{
nBorderTolerance++;
@@ -1573,7 +1574,6 @@ bool Ruler::ImplDoHitTest( const Point& rPos, RulerSelection* pHitTest,
{
n1 -= nBorderTolerance;
n2 += nBorderTolerance;
-
}
if ( (nX >= n1) && (nX <= n2) )
@@ -1707,7 +1707,7 @@ bool Ruler::ImplDoHitTest( const Point& rPos, RulerSelection* pHitTest,
}
bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
- RulerSelection* pHitTest ) const
+ RulerSelection* pHitTest, tools::Long nTolerance ) const
{
Point aPos = rPos;
bool bRequiredStyle = false;
@@ -1731,7 +1731,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
else
aPos.setX( RULER_OFF + 1 );
- if ( ImplDoHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle ) )
+ if ( ImplDoHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle, nTolerance ) )
{
if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) )
return true;
@@ -1747,7 +1747,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
else
aPos.setX( mnWidth - RULER_OFF - 1 );
- if ( ImplDoHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle ) )
+ if ( ImplDoHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle, nTolerance ) )
{
if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) )
return true;
@@ -1762,7 +1762,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
else
aPos.setX( RULER_OFF + (mnVirHeight / 2) );
- if ( ImplDoHitTest( aPos, pHitTest ) )
+ if ( ImplDoHitTest( aPos, pHitTest, false, RulerIndentStyle::Top, nTolerance ) )
{
if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) )
return true;
@@ -2235,7 +2235,7 @@ void Ruler::Deactivate()
mbActive = false;
}
-bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
+bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType, tools::Long nTolerance )
{
if ( !mbDrag )
{
@@ -2261,7 +2261,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
if ( nMouseClicks == 1 )
{
- if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest ) )
+ if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest, nTolerance ) )
{
PointerStyle aPtr = PointerStyle::Arrow;
@@ -2285,7 +2285,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
}
else if ( nMouseClicks == 2 )
{
- if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest ) )
+ if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest, nTolerance ) )
{
mnDragPos = aHitTest.nPos;
mnDragAryPos = aHitTest.nAryPos;