Blob Blame History Raw
From bfb51322f2bee76d7e70588050c38655a432aef0 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Wed, 9 Oct 2013 12:06:41 +0200
Subject: [PATCH 096/109] Make CalcFocusRect look right

...at least for its (only, it appears) uses at the left of the "Insert -
Hyperlink" dialog and at the left of a Database window.  As aBmpRect and
aTextRect never extend aBoundRect (and aTextRect always leaving a gap left and
right towards aBoundRect, it appears, with the text abbreviated with an ellipsis
if it would be too wide), there should be no need to eventually adjust "the
focus rectangle [to] not touch the text," and for calculating the top of the
focus rect aBoundRect can be used just as well as aBmpRect.  (Though for
calculating the bottom, aBoundRect apparently stretches "too far" compareed to
aTextRect; whatever...  The offsets look somewhat "magic" anyway, but appear to
produce the desired visual results.)

Change-Id: Ic324561294fb6172c0d02a697fc261717e01c87c
Reviewed-on: https://gerrit.libreoffice.org/6165
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 143bb92761f54cb7b8e41e5ac83bd274d4f7079b)
Signed-off-by: Eike Rathke <erack@redhat.com>
---
 svtools/source/contnr/imivctl1.cxx | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 01f733d..b0ea082 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2703,18 +2703,11 @@ const Size& SvxIconChoiceCtrl_Impl::GetItemSize( SvxIconChoiceCtrlEntry*,
 
 Rectangle SvxIconChoiceCtrl_Impl::CalcFocusRect( SvxIconChoiceCtrlEntry* pEntry )
 {
-    Rectangle aBmpRect( CalcBmpRect( pEntry ) );
     Rectangle aTextRect( CalcTextRect( pEntry ) );
     Rectangle aBoundRect( GetEntryBoundRect( pEntry ) );
-    Rectangle aFocusRect( aBoundRect.Left(), aBmpRect.Top() - 1,
-                          aBoundRect.Right() - 4, aTextRect.Bottom() + 1 );
-    // the focus rectangle should not touch the text
-    if( aFocusRect.Left() > ::std::numeric_limits<long>::min() && aFocusRect.Left() - 1 >= pEntry->aRect.Left() )
-        aFocusRect.Left()--;
-    if( aFocusRect.Right() < ::std::numeric_limits<long>::max() && aFocusRect.Right() + 1 <= pEntry->aRect.Right() )
-        aFocusRect.Right()++;
-
-    return aFocusRect;
+    return Rectangle(
+        aBoundRect.Left(), aBoundRect.Top() - 1, aBoundRect.Right() - 1,
+        aTextRect.Bottom() + 1);
 }
 
 // the hot spot is the inner 50 % of the rectangle
-- 
1.8.4.2