From d72701bba66817fbd0ddcb8dea969aea49f8426a Mon Sep 17 00:00:00 2001 From: Ivan Timofeev Date: Thu, 20 Oct 2011 23:11:17 +0400 Subject: [PATCH] bye-bye old range parser --- tools/inc/tools/multisel.hxx | 3 - tools/source/memtools/multisel.cxx | 158 ----------------------------- 2 files changed, 161 deletions(-) diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx index 6d3c3de7a5f6..a979c23b5f6e 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 1a21f0ac0aaa..4d6d577269c7 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),