sw/source/core/bastyp/calc.cxx | 223 ----------------------------------------- 1 file changed, 223 deletions(-)
New commits: commit 6e781d5c9356e4cfa98cb5d9e2e51c4944f4b615 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Sep 1 08:49:23 2016 +0200 sw: remove the old calculator implementation It was disabled build-time + also one had to turn it on from a debugger, doesn't seem to be useful anymore. Change-Id: Id04a763e8dc9f09ce28374210da4ec39fbb2b3e1 Reviewed-on: https://gerrit.libreoffice.org/28579 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 6d12a7d..cf28e19 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -635,14 +635,6 @@ void SwCalc::Pop() SwCalcOper SwCalc::GetToken() { -#if OSL_DEBUG_LEVEL > 1 - // static for switch back to the "old" implementation of the calculator - // which doesn't use the I18N routines. - static int nUseOld = 0; - if( !nUseOld ) - { -#endif - if( m_nCommandPos >= m_sCommand.getLength() ) return m_eCurrOper = CALC_ENDCALC; @@ -854,221 +846,6 @@ SwCalcOper SwCalc::GetToken() m_nCommandPos = aRes.EndPos; }; -#if OSL_DEBUG_LEVEL > 1 -#define NextCh( s, n ) (nCommandPos < sCommand.getLength() ? sCommand[nCommandPos++] : 0) - - } - else - { - sal_Unicode ch; - sal_Unicode cTSep = pLclData->getNumThousandSep()[0], - cDSep = pLclData->getNumDecimalSep()[0]; - - do { - if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) ) - return eCurrOper = CALC_ENDCALC; - } while ( ch == '\t' || ch == ' ' || ch == cTSep ); - - if( ch == cDSep ) - ch = '.'; - - switch( ch ) - { - case ';': - if( CALC_MONTH == eCurrListOper || CALC_DAY == eCurrListOper ) - { - eCurrOper = eCurrListOper; - break; - } // else .. no break - case '\n': - { - sal_Unicode c; - while( nCommandPos < sCommand.getLength() && - ( ( c = sCommand[nCommandPos] ) == ' ' || - c == '\t' || c == '\x0a' || c == '\x0d' )) - { - ++nCommandPos; - } - eCurrOper = CALC_PRINT; - } - break; - - case '%': - case '^': - case '*': - case '/': - case '+': - case '-': - case '(': - case ')': - eCurrOper = SwCalcOper(ch); - break; - - case '=': - if( '=' == sCommand[nCommandPos] ) - { - ++nCommandPos; - eCurrOper = CALC_EQ; - } - else - { - eCurrOper = SwCalcOper(ch); - } - break; - - case '!': - if( '=' == sCommand[nCommandPos] ) - { - ++nCommandPos; - eCurrOper = CALC_NEQ; - } - else - { - eCurrOper = CALC_NOT; - } - break; - - case '>': - case '<': - eCurrOper = '>' == ch ? CALC_GRE : CALC_LES; - if( '=' == (ch = sCommand[nCommandPos] ) ) - { - ++nCommandPos; - eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ; - } - else if( ' ' != ch ) - { - eError = CALC_SYNTAX; - eCurrOper = CALC_PRINT; - } - break; - - case cListDelim : - eCurrOper = eCurrListOper; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case ',': - case '.': - { - double nVal; - --nCommandPos; // back to the first char - if( Str2Double( sCommand, nCommandPos, nVal, pLclData )) - { - nNumberValue.PutDouble( nVal ); - eCurrOper = CALC_NUMBER; - } - else - { - // erroneous number - eError = CALC_SYNTAX; - eCurrOper = CALC_PRINT; - } - } - break; - - case '[': - { - OUString aStr; - bool bIgnore = false; - do { - while( 0 != ( ch = NextCh( sCommand, nCommandPos )) && - ch != ']' ) - { - if( !bIgnore && '\\' == ch ) - bIgnore = true; - else if( bIgnore ) - bIgnore = false; - aStr += OUString(ch); - } - - if( !bIgnore ) - break; - - aStr = aStr.replaceAt(aStr.getLength() - 1, 1, OUString(ch)); - } while( ch ); - - aVarName = aStr; - eCurrOper = CALC_NAME; - } - break; - - case '"': - { - sal_Int32 nStt = nCommandPos; - while( 0 != ( ch = NextCh( sCommand, nCommandPos ) ) && - '"' != ch ) - { - ; - } - - sal_Int32 nLen = nCommandPos - nStt; - if( '"' == ch ) - --nLen; - nNumberValue.PutString( sCommand.copy( nStt, nLen )); - eCurrOper = CALC_NUMBER; - } - break; - - default: - if (ch && (pCharClass->isLetter( sCommand, nCommandPos - 1) || - '_' == ch)) - { - sal_Int32 nStt = nCommandPos-1; - while( 0 != (ch = NextCh( sCommand, nCommandPos )) && - (pCharClass->isLetterNumeric( sCommand, nCommandPos - 1) || - ch == '_' || ch == '.' ) ) - { - ; - } - - if( ch ) - --nCommandPos; - - OUString aStr( sCommand.copy( nStt, nCommandPos-nStt )); - aStr = pCharClass->lowercase( aStr ); - - // catch currency symbol - if( aStr == sCurrSym ) - return GetToken(); // call again - - // catch operators - CalcOp* pFnd = ::FindOperator( aStr ); - if( pFnd ) - { - switch( ( eCurrOper = static_cast<CalcOp*>(pFnd)->eOp ) ) - { - case CALC_SUM : - case CALC_MEAN : - eCurrListOper = CALC_PLUS; - break; - case CALC_MIN : - eCurrListOper = CALC_MIN_IN; - break; - case CALC_MAX : - eCurrListOper = CALC_MAX_IN; - break; - case CALC_DATE : - eCurrListOper = CALC_MONTH; - break; - default : - break; - } - return eCurrOper; - } - aVarName = aStr; - eCurrOper = CALC_NAME; - } - else - { - eError = CALC_SYNTAX; - eCurrOper = CALC_PRINT; - } - break; - } - } -#endif return m_eCurrOper; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits