[Libreoffice-commits] .: tools/inc tools/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Thu Oct 20 12:16:49 PDT 2011


 tools/inc/tools/multisel.hxx       |    3 
 tools/source/memtools/multisel.cxx |  158 -------------------------------------
 2 files changed, 161 deletions(-)

New commits:
commit d72701bba66817fbd0ddcb8dea969aea49f8426a
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Thu Oct 20 23:11:17 2011 +0400

    bye-bye old range parser

diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx
index 6d3c3de..a979c23 100644
--- a/tools/inc/tools/multisel.hxx
+++ b/tools/inc/tools/multisel.hxx
@@ -71,9 +71,6 @@ public:
                     MultiSelection();
                     MultiSelection( const MultiSelection& rOrig );
                     MultiSelection( const Range& rRange );
-                    MultiSelection( const UniString& rString,
-                                    sal_Unicode cRange = '-',
-                                    sal_Unicode cSep = ';' );
                     ~MultiSelection();
 
     MultiSelection& operator= ( const MultiSelection& rOrig );
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index 1a21f0a..4d6d577 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -137,164 +137,6 @@ MultiSelection::MultiSelection():
 
 // -----------------------------------------------------------------------
 
-MultiSelection::MultiSelection( const UniString& rString, sal_Unicode cRange, sal_Unicode cSep ):
-    aTotRange(0,RANGE_MAX),
-    nCurSubSel(0),
-    nSelCount(0),
-    bCurValid(sal_False),
-    bSelectNew(sal_False)
-{
-    // Dies ist nur ein Schnellschuss und sollte bald optimiert,
-    // an die verschiedenen Systeme (UNIX etc.)
-    // und die gewuenschte Eingabe-Syntax angepasst werden.
-
-    UniString           aStr( rString );
-    sal_Unicode*        pStr   = aStr.GetBufferAccess();
-    sal_Unicode*        pOld = pStr;
-    sal_Bool                bReady = sal_False;
-    sal_Bool                bUntil = sal_False;
-    xub_StrLen          nCut   = 0;
-
-    // Hier normieren wir den String, sodass nur Ziffern,
-    // Semikola als Trenn- und Minus als VonBis-Zeichen
-    // uebrigbleiben, z.B. "99-117;55;34;-17;37-43"
-    while ( *pOld )
-    {
-        switch( *pOld )
-        {
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                DBG_ASSERT( *pOld != cRange, "digit for range char not allowed" );
-                DBG_ASSERT( *pOld != cSep, "digit for separator not allowed" );
-                if( bReady )
-                {
-                    *pStr++ = ';';
-                    nCut++;
-                    bReady = sal_False;
-                }
-                *pStr++ = *pOld;
-                nCut++;
-                bUntil = sal_False;
-                break;
-
-            case '-':
-            case ':':
-            case '/':
-                if ( *pOld != cSep )
-                {
-                    if ( !bUntil )
-                    {
-                        *pStr++ = '-';
-                        nCut++;
-                        bUntil = sal_True;
-                    }
-                    bReady = sal_False;
-                }
-                else
-                    bReady = sal_True;
-                break;
-
-            case ' ':
-                DBG_ASSERT( *pOld != cRange, "SPACE for range char not allowed" );
-                DBG_ASSERT( *pOld != cSep, "SPACE for separator not allowed" );
-                bReady = !bUntil;
-                break;
-
-            default:
-                if ( *pOld == cRange )
-                {
-                    if ( !bUntil )
-                    {
-                        *pStr++ = '-';
-                        nCut++;
-                        bUntil = sal_True;
-                    }
-                    bReady = sal_False;
-                }
-                else
-                    bReady = sal_True;
-                break;
-        }
-
-        pOld++;
-    }
-    aStr.ReleaseBufferAccess( nCut );
-
-    // Jetzt wird der normierte String ausgewertet ..
-    UniString           aNumStr;
-    Range               aRg( 1, RANGE_MAX );
-    const sal_Unicode*  pCStr = aStr.GetBuffer();
-    long                nPage = 1;
-    long                nNum  = 1;
-    bUntil = sal_False;
-    while ( *pCStr )
-    {
-        switch ( *pCStr )
-        {
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                aNumStr += *pCStr;
-                break;
-            case ';':
-                nNum = aNumStr.ToInt32();
-                if ( bUntil )
-                {
-                    if ( !aNumStr.Len() )
-                        nNum = RANGE_MAX;
-                    aRg.Min() = nPage;
-                    aRg.Max() = nNum;
-                    aRg.Justify();
-                    Select( aRg );
-                }
-                else
-                    Select( nNum );
-                nPage = 0;
-                aNumStr.Erase();
-                bUntil = sal_False;
-                break;
-
-            case '-':
-                nPage = aNumStr.ToInt32();
-                aNumStr.Erase();
-                bUntil = sal_True;
-                break;
-        }
-
-        pCStr++;
-    }
-
-    nNum = aNumStr.ToInt32();
-    if ( bUntil )
-    {
-        if ( !aNumStr.Len() )
-            nNum = RANGE_MAX;
-        aRg.Min() = nPage;
-        aRg.Max() = nNum;
-        aRg.Justify();
-        Select( aRg );
-    }
-    else
-        Select( nNum );
-}
-
-// -----------------------------------------------------------------------
-
 MultiSelection::MultiSelection( const MultiSelection& rOrig ) :
     aTotRange(rOrig.aTotRange),
     nSelCount(rOrig.nSelCount),


More information about the Libreoffice-commits mailing list