diff options
Diffstat (limited to 'sw/source/core/bastyp/calc.cxx')
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index baf76e5fe5ec..b5622c150801 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -218,16 +218,16 @@ _CalcOp* FindOperator( const String& rSrch ) //----------------------------------------------------------------------------- -SwHash* Find( const String& rStr, SwHash** ppTable, USHORT nTblSize, - USHORT* pPos ) +SwHash* Find( const String& rStr, SwHash** ppTable, sal_uInt16 nTblSize, + sal_uInt16* pPos ) { - ULONG ii = 0; + sal_uLong ii = 0; for( xub_StrLen n = 0; n < rStr.Len(); ++n ) ii = ii << 1 ^ rStr.GetChar( n ); ii %= nTblSize; if( pPos ) - *pPos = (USHORT)ii; + *pPos = (sal_uInt16)ii; for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext ) if( rStr == pEntry->aStr ) @@ -239,7 +239,7 @@ inline LanguageType GetDocAppScriptLang( SwDoc& rDoc ) { return ((SvxLanguageItem&)rDoc.GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, - GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() )) + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() )) )).GetLanguage(); } @@ -336,25 +336,25 @@ static const sal_Char* __READONLY_DATA sNTypeTab[ 27 ] = // diese sind mit doppelten HashIds sNType25, sNType26 }; -static USHORT __READONLY_DATA aHashValue[ 27 ] = +static sal_uInt16 __READONLY_DATA aHashValue[ 27 ] = { 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3, 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1, // diese sind mit doppelten HashIds 11, 38 }; -static USHORT __READONLY_DATA aAdrToken[ 12 ] = +static sal_uInt16 __READONLY_DATA aAdrToken[ 12 ] = { USER_OPT_COMPANY, USER_OPT_STREET, USER_OPT_COUNTRY, USER_OPT_ZIP, USER_OPT_CITY, USER_OPT_TITLE, USER_OPT_POSITION, USER_OPT_TELEPHONEWORK, USER_OPT_TELEPHONEHOME, USER_OPT_FAX, USER_OPT_EMAIL, USER_OPT_STATE }; -static USHORT SwDocStat::* __READONLY_DATA aDocStat1[ 3 ] = +static sal_uInt16 SwDocStat::* __READONLY_DATA aDocStat1[ 3 ] = { &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE }; -static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] = +static sal_uLong SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] = { &SwDocStat::nPage, &SwDocStat::nPara, &SwDocStat::nWord, &SwDocStat::nChar @@ -368,7 +368,7 @@ static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] = SwSbxValue nVal; String sTmpStr; - USHORT n; + sal_uInt16 n; for( n = 0; n < 25; ++n ) { @@ -376,8 +376,8 @@ static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] = VarTable[ aHashValue[ n ] ] = new SwCalcExp( sTmpStr, nVal, 0 ); } - ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( FALSE ); - ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( TRUE ); + ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( sal_False ); + ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( sal_True ); ((SwCalcExp*)VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI ); ((SwCalcExp*)VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 ); @@ -418,7 +418,7 @@ static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] = SwCalc::~SwCalc() { - for( USHORT n = 0; n < TBLSZ; ++n ) + for( sal_uInt16 n = 0; n < TBLSZ; ++n ) delete VarTable[n]; if( pLclData != m_aSysLocale.GetLocaleDataPtr() ) delete pLclData; @@ -460,9 +460,9 @@ SwSbxValue SwCalc::Calculate( const String& rStr ) /****************************************************************************** |* -|* String SwCalc::GetStrResult( SwSbxValue nValue, BOOL bRound = TRUE ) -|* Beschreibung Der Parameter bRound ist auf TRUE defaultet und darf -|* nur beim errechnen von Tabellenzellen auf FALSE gesetzt +|* String SwCalc::GetStrResult( SwSbxValue nValue, sal_Bool bRound = sal_True ) +|* Beschreibung Der Parameter bRound ist auf sal_True defaultet und darf +|* nur beim errechnen von Tabellenzellen auf sal_False gesetzt |* werden, damit keine Rundungsfehler beim zusammenstellen |* der Formel entstehen. |* Erstellung OK 12-02-93 11:04am @@ -470,7 +470,7 @@ SwSbxValue SwCalc::Calculate( const String& rStr ) |* |******************************************************************************/ -String SwCalc::GetStrResult( const SwSbxValue& rVal, BOOL bRound ) +String SwCalc::GetStrResult( const SwSbxValue& rVal, sal_Bool bRound ) { if( !rVal.IsDouble() ) return rVal.GetString(); @@ -479,7 +479,7 @@ String SwCalc::GetStrResult( const SwSbxValue& rVal, BOOL bRound ) } -String SwCalc::GetStrResult( double nValue, BOOL ) +String SwCalc::GetStrResult( double nValue, sal_Bool ) { if( nValue >= DBL_MAX ) switch( eError ) @@ -494,7 +494,7 @@ String SwCalc::GetStrResult( double nValue, BOOL ) default : return RESOURCE->aCalc_Default; } - USHORT nDec = 15; //pLclData->getNumDigits(); + sal_uInt16 nDec = 15; //pLclData->getNumDigits(); String aRetStr( ::rtl::math::doubleToUString( nValue, rtl_math_StringFormat_Automatic, nDec, @@ -522,17 +522,17 @@ SwCalcExp* SwCalc::VarInsert( const String &rStr ) /****************************************************************************** |* -|* SwCalcExp* SwCalc::VarLook( const String& , USHORT ins ) +|* SwCalcExp* SwCalc::VarLook( const String& , sal_uInt16 ins ) |* |* Erstellung OK 12-02-93 11:04am |* Letzte Aenderung JP 15.11.99 |* |******************************************************************************/ -SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) +SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins ) { aErrExpr.nValue.SetVoidValue(false); - USHORT ii = 0; + sal_uInt16 ii = 0; String aStr( rStr ); pCharClass->toLower( aStr ); @@ -566,7 +566,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) else if( !pUFld->IsValid() ) { // Die aktuellen Werte sichern . . . - USHORT nOld_ListPor = nListPor; + sal_uInt16 nOld_ListPor = nListPor; SwSbxValue nOld_LastLeft = nLastLeft; SwSbxValue nOld_NumberValue = nNumberValue; xub_StrLen nOld_CommandPos = nCommandPos; @@ -624,7 +624,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) return &aErrExpr; } - ULONG nTmpRec = 0; + sal_uLong nTmpRec = 0; if( 0 != ( pFnd = Find( sDBNum, VarTable, TBLSZ ) ) ) nTmpRec = ((SwCalcExp*)pFnd)->nValue.GetULong(); @@ -679,7 +679,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) /****************************************************************************** |* -|* BOOL SwCalc::VarChange( const String& rStr, const SwSbxValue nValue ) +|* sal_Bool SwCalc::VarChange( const String& rStr, const SwSbxValue nValue ) |* |* Erstellung OK 12-02-93 11:04am |* Letzte Aenderung OK 12-02-93 11:04am @@ -697,7 +697,7 @@ void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue ) String aStr( rStr ); pCharClass->toLower( aStr ); - USHORT nPos = 0; + sal_uInt16 nPos = 0; SwCalcExp* pFnd = (SwCalcExp*)Find( aStr, VarTable, TBLSZ, &nPos ); if( !pFnd ) @@ -712,20 +712,20 @@ void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue ) /****************************************************************************** |* -|* BOOL SwCalc::Push( const void* pPtr ) +|* sal_Bool SwCalc::Push( const void* pPtr ) |* |* Erstellung OK 12-02-93 11:05am |* Letzte Aenderung OK 12-02-93 11:05am |* |******************************************************************************/ -BOOL SwCalc::Push( const VoidPtr pPtr ) +sal_Bool SwCalc::Push( const VoidPtr pPtr ) { if( USHRT_MAX != aRekurStk.GetPos( pPtr ) ) - return FALSE; + return sal_False; aRekurStk.Insert( pPtr, aRekurStk.Count() ); - return TRUE; + return sal_True; } /****************************************************************************** @@ -774,13 +774,13 @@ if( !nUseOld ) coStartFlags, aEmptyStr, coContFlags, aEmptyStr ); - BOOL bSetError = TRUE; + sal_Bool bSetError = sal_True; xub_StrLen nRealStt = nCommandPos + (xub_StrLen)aRes.LeadingWhiteSpace; if( aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER) ) { nNumberValue.PutDouble( aRes.Value ); eCurrOper = CALC_NUMBER; - bSetError = FALSE; + bSetError = sal_False; } else if( aRes.TokenType & KParseType::IDENTNAME ) { @@ -824,20 +824,20 @@ if( !nUseOld ) } aVarName = aName; eCurrOper = CALC_NAME; - bSetError = FALSE; + bSetError = sal_False; } else if ( aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING ) { nNumberValue.PutString( String( aRes.DequotedNameOrString )); eCurrOper = CALC_NUMBER; - bSetError = FALSE; + bSetError = sal_False; } else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR ) { String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt )); if( 1 == aName.Len() ) { - bSetError = FALSE; + bSetError = sal_False; sal_Unicode ch = aName.GetChar( 0 ); switch( ch ) { @@ -914,14 +914,14 @@ if( !nUseOld ) eCurrOper = CALC_NAME; } else - bSetError = TRUE; + bSetError = sal_True; } else - bSetError = TRUE; + bSetError = sal_True; break; default: - bSetError = TRUE; + bSetError = sal_True; break; } } @@ -933,10 +933,10 @@ if( !nUseOld ) { sal_Unicode ch = aName.GetChar(0); - bSetError = TRUE; + bSetError = sal_True; if ('<' == ch || '>' == ch) { - bSetError = FALSE; + bSetError = sal_False; SwCalcOper eTmp2 = ('<' == ch) ? CALC_LEQ : CALC_GEQ; eCurrOper = ('<' == ch) ? CALC_LES : CALC_GRE; @@ -944,14 +944,14 @@ if( !nUseOld ) if( 2 == aName.Len() && '=' == aName.GetChar(1) ) eCurrOper = eTmp2; else if( 1 != aName.Len() ) - bSetError = TRUE; + bSetError = sal_True; } } } else if( nRealStt == sCommand.Len() ) { eCurrOper = CALC_ENDCALC; - bSetError = FALSE; + bSetError = sal_False; } if( bSetError ) @@ -1066,15 +1066,15 @@ else case '[': { String aStr; - BOOL bIgnore = FALSE; + sal_Bool bIgnore = sal_False; do { while( 0 != ( ch = NextCh( sCommand, nCommandPos )) && ch != ']' ) { if( !bIgnore && '\\' == ch ) - bIgnore = TRUE; + bIgnore = sal_True; else if( bIgnore ) - bIgnore = FALSE; + bIgnore = sal_False; aStr += ch; } @@ -1175,7 +1175,7 @@ SwSbxValue SwCalc::Term() nLastLeft = left; for(;;) { - USHORT nSbxOper = USHRT_MAX; + sal_uInt16 nSbxOper = USHRT_MAX; switch( eCurrOper ) { @@ -1185,20 +1185,20 @@ SwSbxValue SwCalc::Term() // case CALC_XOR: eSbxOper = SbxXOR; break; case CALC_AND: { GetToken(); - BOOL bB = Prim().GetBool(); + sal_Bool bB = Prim().GetBool(); left.PutBool( left.GetBool() && bB ); } break; case CALC_OR: { GetToken(); - BOOL bB = Prim().GetBool(); + sal_Bool bB = Prim().GetBool(); left.PutBool( left.GetBool() || bB ); } break; case CALC_XOR: { GetToken(); - BOOL bR = Prim().GetBool(); - BOOL bL = left.GetBool(); + sal_Bool bR = Prim().GetBool(); + sal_Bool bL = left.GetBool(); left.PutBool( (bL && !bR) || (!bL && bR) ); } break; @@ -1235,7 +1235,7 @@ SwSbxValue SwCalc::Term() SwSbxValue e = Prim(); sal_Int32 nYear = (sal_Int32) floor( left.GetDouble() ); nYear = nYear & 0x0000FFFF; - sal_Int32 nMonth = (INT32) floor( e.GetDouble() ); + sal_Int32 nMonth = (sal_Int32) floor( e.GetDouble() ); nMonth = ( nMonth & 0x000000FF ) << 16; left.PutLong( nMonth + nYear ); eCurrOper = CALC_DAY; @@ -1259,7 +1259,7 @@ SwSbxValue SwCalc::Term() double fVal = 0; double fFac = 1; - INT32 nDec = (INT32) floor( e.GetDouble() ); + sal_Int32 nDec = (sal_Int32) floor( e.GetDouble() ); if( nDec < -20 || nDec > 20 ) { eError = CALC_OVERFLOW; @@ -1267,24 +1267,24 @@ SwSbxValue SwCalc::Term() return left; } fVal = left.GetDouble(); - USHORT i; + sal_uInt16 i; if( nDec >= 0) - for (i = 0; i < (USHORT) nDec; ++i ) + for (i = 0; i < (sal_uInt16) nDec; ++i ) fFac *= 10.0; else - for (i = 0; i < (USHORT) -nDec; ++i ) + for (i = 0; i < (sal_uInt16) -nDec; ++i ) fFac /= 10.0; fVal *= fFac; - BOOL bSign; + sal_Bool bSign; if (fVal < 0.0) { fVal *= -1.0; - bSign = TRUE; + bSign = sal_True; } else - bSign = FALSE; + bSign = sal_False; // runden double fNum = fVal; // find the exponent @@ -1380,7 +1380,7 @@ SwSbxValue SwCalc::Prim() pfCalc pFnc = 0; - BOOL bChkTrig = FALSE, bChkPow = FALSE; + sal_Bool bChkTrig = sal_False, bChkPow = sal_False; switch( eCurrOper ) { @@ -1388,8 +1388,8 @@ SwSbxValue SwCalc::Prim() case CALC_COS: pFnc = &cos; break; case CALC_TAN: pFnc = &tan; break; case CALC_ATAN: pFnc = &atan; break; - case CALC_ASIN: pFnc = &asin; bChkTrig = TRUE; break; - case CALC_ACOS: pFnc = &acos; bChkTrig = TRUE; break; + case CALC_ASIN: pFnc = &asin; bChkTrig = sal_True; break; + case CALC_ACOS: pFnc = &acos; bChkTrig = sal_True; break; case CALC_NOT: { GetToken(); @@ -1424,7 +1424,7 @@ SwSbxValue SwCalc::Prim() else { nErg = nNumberValue; - bChkPow = TRUE; + bChkPow = sal_True; } break; @@ -1437,7 +1437,7 @@ SwSbxValue SwCalc::Prim() else { nErg = VarLook( aVarName )->nValue; - bChkPow = TRUE; + bChkPow = sal_True; } break; @@ -1453,7 +1453,7 @@ SwSbxValue SwCalc::Prim() else { GetToken(); - bChkPow = TRUE; // in order for =(7)^2 to work + bChkPow = sal_True; // in order for =(7)^2 to work } } break; @@ -1633,7 +1633,7 @@ lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, double& rVal, } /****************************************************************************** - * Methode : BOOL SwCalc::Str2Double( double& ) + * Methode : sal_Bool SwCalc::Str2Double( double& ) * Beschreibung: * Erstellt : OK 07.06.94 12:56 * Aenderung : JP 27.10.98 @@ -1671,10 +1671,10 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, //------------------------------------------------------------------------------ -BOOL SwCalc::IsValidVarName( const String& rStr, +sal_Bool SwCalc::IsValidVarName( const String& rStr, String* pValidName ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; using namespace ::com::sun::star::i18n; { // Parse any token. @@ -1719,9 +1719,9 @@ SwHash::~SwHash() delete pNext; } -void DeleteHashTable( SwHash **ppHashTable, USHORT nCount ) +void DeleteHashTable( SwHash **ppHashTable, sal_uInt16 nCount ) { - for ( USHORT i = 0; i < nCount; ++i ) + for ( sal_uInt16 i = 0; i < nCount; ++i ) delete *(ppHashTable+i); delete [] ppHashTable; } @@ -1739,7 +1739,7 @@ SwSbxValue::~SwSbxValue() { } -BOOL SwSbxValue::GetBool() const +sal_Bool SwSbxValue::GetBool() const { return SbxSTRING == GetType() ? 0 != GetString().Len() : 0 != SbxValue::GetBool(); |