[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Mar 14 06:12:08 PDT 2013
vcl/source/control/field2.cxx | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 533be98148ff40f6205e2ac3b489748cae14ef0d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 14 13:06:34 2013 +0000
restore incrementing time fields by area cursor is in
regression from String->OUString conversion with
tricky unsigned xub_StrLen of 0xFFFF for not-found
> any found position, vs -1 for OUString for not-found
Change-Id: I4a2babae085916a86cd1e60b74b4ea839dd8b87a
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 49ad88e..b988cb8 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2492,20 +2492,27 @@ void TimeField::ImplTimeSpinArea( sal_Bool bUp )
{
if ( GetField() )
{
- xub_StrLen nTimeArea = 0;
+ sal_Int32 nTimeArea = 0;
Time aTime( GetTime() );
OUString aText( GetText() );
Selection aSelection( GetField()->GetSelection() );
- // Area suchen
+ // Area search
if ( GetFormat() != TIMEF_SEC_CS )
{
- for ( xub_StrLen i = 1, nPos = 0; i <= 4; i++ )
+ //Which area is the cursor in of HH:MM:SS.TT
+ for ( sal_Int32 i = 1, nPos = 0; i <= 4; i++ )
{
sal_Int32 nPos1 = aText.indexOf( ImplGetLocaleDataWrapper().getTimeSep(), nPos );
sal_Int32 nPos2 = aText.indexOf( ImplGetLocaleDataWrapper().getTime100SecSep(), nPos );
- nPos = nPos1 < nPos2 ? nPos1 : nPos2;
- if ( nPos >= (xub_StrLen)aSelection.Max() )
+ //which ever comes first, bearing in mind that one might not be there
+ if (nPos1 >= 0 && nPos2 >= 0)
+ nPos = nPos1 < nPos2 ? nPos1 : nPos2;
+ else if (nPos1 >= 0)
+ nPos = nPos1;
+ else
+ nPos = nPos2;
+ if ( nPos < 0 || nPos >= aSelection.Max() )
{
nTimeArea = i;
break;
@@ -2517,7 +2524,7 @@ void TimeField::ImplTimeSpinArea( sal_Bool bUp )
else
{
sal_Int32 nPos = aText.indexOf( ImplGetLocaleDataWrapper().getTime100SecSep() );
- if ( nPos < 0 || nPos >= (xub_StrLen)aSelection.Max() )
+ if ( nPos < 0 || nPos >= aSelection.Max() )
nTimeArea = 3;
else
nTimeArea = 4;
More information about the Libreoffice-commits
mailing list