diff options
author | Eike Rathke <erack@erack.de> | 2011-08-14 16:46:18 +0200 |
---|---|---|
committer | Eike Rathke <erack@erack.de> | 2011-08-14 16:46:18 +0200 |
commit | b5cd7f10b88340b53ce108f3667e70bc4ccb2dd0 (patch) | |
tree | 6591aa1205a8acc78e6aa53ef1594c0b37357ab4 | |
parent | 5849f748704b3a7312997f30461c001f37bf6969 (diff) |
sal_Bool -> bool and cosmetics
-rw-r--r-- | formula/inc/formula/FormulaCompiler.hxx | 67 | ||||
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 116 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 34 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 58 | ||||
-rw-r--r-- | sc/inc/token.hxx | 2 | ||||
-rw-r--r-- | sc/inc/tokenarray.hxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 222 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 36 |
8 files changed, 271 insertions, 272 deletions
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx index e053c57751df..825a31e9863b 100644 --- a/formula/inc/formula/FormulaCompiler.hxx +++ b/formula/inc/formula/FormulaCompiler.hxx @@ -65,7 +65,7 @@ struct FormulaArrayStack { FormulaArrayStack* pNext; FormulaTokenArray* pArr; - sal_Bool bTemp; + bool bTemp; }; @@ -221,26 +221,26 @@ public: */ OpCode GetEnglishOpCode( const String& rName ) const; - void SetCompileForFAP( sal_Bool bVal ) + void SetCompileForFAP( bool bVal ) { bCompileForFAP = bVal; bIgnoreErrors = bVal; } static bool IsOpCodeVolatile( OpCode eOp ); - static sal_Bool DeQuote( String& rStr ); + static bool DeQuote( String& rStr ); static const String& GetNativeSymbol( OpCode eOp ); - static sal_Bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix + static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix short GetNumFormatType() const { return nNumFmt; } - sal_Bool CompileTokenArray(); + bool CompileTokenArray(); void CreateStringFromTokenArray( String& rFormula ); void CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer ); FormulaToken* CreateStringFromToken( String& rFormula, FormulaToken* pToken, - sal_Bool bAllowArrAdvance = sal_False ); + bool bAllowArrAdvance = false ); FormulaToken* CreateStringFromToken( rtl::OUStringBuffer& rBuffer, FormulaToken* pToken, - sal_Bool bAllowArrAdvance = sal_False ); + bool bAllowArrAdvance = false ); void AppendBoolean( rtl::OUStringBuffer& rBuffer, bool bVal ); void AppendDouble( rtl::OUStringBuffer& rBuffer, double fVal ); @@ -254,7 +254,7 @@ public: static void ResetNativeSymbols(); static void SetNativeSymbols( const OpCodeMapPtr& xMap ); protected: - virtual String FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const; + virtual String FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const; virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const; virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, FormulaGrammar::Grammar _eGrammar ) const; virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const; @@ -262,10 +262,10 @@ protected: virtual void SetError(sal_uInt16 nError); virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef ); - virtual sal_Bool HandleExternalReference(const FormulaToken& _aToken); - virtual sal_Bool HandleRange(); - virtual sal_Bool HandleSingleRef(); - virtual sal_Bool HandleDbData(); + virtual bool HandleExternalReference(const FormulaToken& _aToken); + virtual bool HandleRange(); + virtual bool HandleSingleRef(); + virtual bool HandleDbData(); virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, FormulaToken* pTokenP); virtual void CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,FormulaToken* pTokenP); @@ -273,12 +273,12 @@ protected: virtual void CreateStringFromMatrix(rtl::OUStringBuffer& rBuffer,FormulaToken* pTokenP); virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,FormulaToken* pTokenP); virtual void LocalizeString( String& rName ); // modify rName - input: exact name - virtual sal_Bool IsImportingXML() const; + virtual bool IsImportingXML() const; sal_uInt16 GetErrorConstant( const String& rName ); void AppendErrorConstant( rtl::OUStringBuffer& rBuffer, sal_uInt16 nError ); - sal_Bool GetToken(); + bool GetToken(); OpCode NextToken(); void PutCode( FormulaTokenRef& ); void Factor(); @@ -295,17 +295,17 @@ protected: void NotLine(); OpCode Expression(); void PopTokenArray(); - void PushTokenArray( FormulaTokenArray*, sal_Bool = sal_False ); + void PushTokenArray( FormulaTokenArray*, bool = false ); bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 ); - String aCorrectedFormula; // autocorrected Formula - String aCorrectedSymbol; // autocorrected Symbol + String aCorrectedFormula; // autocorrected Formula + String aCorrectedSymbol; // autocorrected Symbol - OpCodeMapPtr mxSymbols; // which symbols are used + OpCodeMapPtr mxSymbols; // which symbols are used - FormulaTokenRef pToken; // current token - FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method) + FormulaTokenRef pToken; // current token + FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method) FormulaTokenArray* pArr; ExternalReferenceHelper* pExternalRef; @@ -313,20 +313,19 @@ protected: FormulaArrayStack* pStack; OpCode eLastOp; - short nRecursion; // GetToken() recursions - short nNumFmt; // set during CompileTokenArray() - sal_uInt16 pc; - - FormulaGrammar::Grammar - meGrammar; // The grammar used, language plus convention. - - sal_Bool bAutoCorrect; // whether to apply AutoCorrection - sal_Bool bCorrected; // AutoCorrection was applied - sal_Bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot, - // will not be resolved - sal_Bool bIgnoreErrors; // on AutoCorrect and CompileForFAP - // ignore errors and create RPN nevertheless - sal_Bool glSubTotal; // if code contains one or more subtotal functions + short nRecursion; // GetToken() recursions + short nNumFmt; // set during CompileTokenArray() + sal_uInt16 pc; // program counter + + FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention. + + bool bAutoCorrect; // whether to apply AutoCorrection + bool bCorrected; // AutoCorrection was applied + bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot + // will not be resolved + bool bIgnoreErrors; // on AutoCorrect and CompileForFAP + // ignore errors and create RPN nevertheless + bool glSubTotal; // if code contains one or more subtotal functions private: void InitSymbolsNative() const; /// only SymbolsNative, on first document creation void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index c1b4e5f9ae3b..346c8e3bd235 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -299,7 +299,7 @@ uno::Sequence< sheet::FormulaToken > FormulaCompiler::OpCodeMap::createSequenceO // interest. } if (!aIntName.getLength()) - aIntName = _rCompiler.FindAddInFunction(*pName, !isEnglish()); // bLocalFirst=sal_False for english + aIntName = _rCompiler.FindAddInFunction(*pName, !isEnglish()); // bLocalFirst=false for english if (!aIntName.getLength()) pToken->OpCode = getOpCodeUnknown(); else @@ -514,10 +514,10 @@ FormulaCompiler::FormulaCompiler(FormulaTokenArray& _rArr) nRecursion(0), nNumFmt( NUMBERFORMAT_UNDEFINED ), meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ), - bAutoCorrect( sal_False ), - bCorrected( sal_False ), - bCompileForFAP( sal_False ), - bIgnoreErrors( sal_False ) + bAutoCorrect( false ), + bCorrected( false ), + bCompileForFAP( false ), + bIgnoreErrors( false ) { DBG_CTOR(FormulaCompiler,NULL); @@ -530,10 +530,10 @@ FormulaCompiler::FormulaCompiler() nRecursion(0), nNumFmt( NUMBERFORMAT_UNDEFINED ), meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ), - bAutoCorrect( sal_False ), - bCorrected( sal_False ), - bCompileForFAP( sal_False ), - bIgnoreErrors( sal_False ) + bAutoCorrect( false ), + bCorrected( false ), + bCompileForFAP( false ), + bIgnoreErrors( false ) { DBG_CTOR(FormulaCompiler,NULL); @@ -581,7 +581,7 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::GetOpCodeMap( const sal_Int32 nLa } // ----------------------------------------------------------------------------- -String FormulaCompiler::FindAddInFunction( const String& /*rUpperName*/, sal_Bool /*bLocalFirst*/ ) const +String FormulaCompiler::FindAddInFunction( const String& /*rUpperName*/, bool /*bLocalFirst*/ ) const { return String(); } @@ -755,7 +755,7 @@ bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp ) } // Remove quotes, escaped quotes are unescaped. -sal_Bool FormulaCompiler::DeQuote( String& rStr ) +bool FormulaCompiler::DeQuote( String& rStr ) { xub_StrLen nLen = rStr.Len(); if ( nLen > 1 && rStr.GetChar(0) == '\'' && rStr.GetChar( nLen-1 ) == '\'' ) @@ -768,16 +768,16 @@ sal_Bool FormulaCompiler::DeQuote( String& rStr ) rStr.Erase( nPos, 1 ); ++nPos; } - return sal_True; + return true; } - return sal_False; + return false; } // ----------------------------------------------------------------------------- void FormulaCompiler::fillAddInToken(::std::vector< sheet::FormulaOpCodeMapEntry >& /*_rVec*/,bool /*_bIsEnglish*/) const { } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::IsMatrixFunction(OpCode _eOpCode) +bool FormulaCompiler::IsMatrixFunction(OpCode _eOpCode) { switch ( _eOpCode ) { @@ -791,13 +791,13 @@ sal_Bool FormulaCompiler::IsMatrixFunction(OpCode _eOpCode) case ocMatMult : case ocMatInv : case ocMatrixUnit : - return sal_True; + return true; default: { // added to avoid warnings } } - return sal_False; + return false; } // ----------------------------------------------------------------------------- @@ -903,7 +903,7 @@ sal_Int32 FormulaCompiler::OpCodeMap::getOpCodeUnknown() return kOpCodeUnknown; } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::GetToken() +bool FormulaCompiler::GetToken() { static const short nRecursionMax = 42; FormulaCompilerRecursionGuard aRecursionGuard( nRecursion ); @@ -911,16 +911,16 @@ sal_Bool FormulaCompiler::GetToken() { SetError( errStackOverflow ); pToken = new FormulaByteToken( ocStop ); - return sal_False; + return false; } if ( bAutoCorrect && !pStack ) { // don't merge stacked subroutine code into entered formula aCorrectedFormula += aCorrectedSymbol; aCorrectedSymbol.Erase(); } - sal_Bool bStop = sal_False; + bool bStop = false; if( pArr->GetCodeError() && !bIgnoreErrors ) - bStop = sal_True; + bStop = true; else { short nWasColRowName; @@ -948,7 +948,7 @@ sal_Bool FormulaCompiler::GetToken() return GetToken(); } else - bStop = sal_True; + bStop = true; } else { @@ -962,10 +962,10 @@ sal_Bool FormulaCompiler::GetToken() if( bStop ) { pToken = new FormulaByteToken( ocStop ); - return sal_False; + return false; } if( pToken->GetOpCode() == ocSubTotal ) - glSubTotal = sal_True; + glSubTotal = true; else if ( pToken->IsExternalRef() ) { return HandleExternalReference(*pToken); @@ -990,7 +990,7 @@ sal_Bool FormulaCompiler::GetToken() { pArr->nRefs++; } - return sal_True; + return true; } //--------------------------------------------------------------------------- // RPN creation by recursion @@ -1022,7 +1022,7 @@ void FormulaCompiler::Factor() if ( bAutoCorrect && !pStack ) { // assume multiplication aCorrectedFormula += mxSymbols->getSymbol(ocMul); - bCorrected = sal_True; + bCorrected = true; NextToken(); eOp = Expression(); if( eOp != ocClose ) @@ -1079,7 +1079,7 @@ void FormulaCompiler::Factor() pArr->SetRecalcModeOnRefMove(); break; case ocHyperLink : - pArr->SetHyperLink(sal_True); + pArr->SetHyperLink(true); break; default: ; // nothing @@ -1245,7 +1245,7 @@ void FormulaCompiler::Factor() if ( bAutoCorrect && !pStack ) { aCorrectedSymbol.Erase(); - bCorrected = sal_True; + bCorrected = true; } } else if ( pToken->IsExternalRef() ) @@ -1264,7 +1264,7 @@ void FormulaCompiler::Factor() if ( nLen ) aCorrectedFormula.Erase( nLen - 1 ); aCorrectedSymbol.Erase(); - bCorrected = sal_True; + bCorrected = true; } } } @@ -1484,10 +1484,10 @@ bool FormulaCompiler::MergeRangeReference(FormulaToken * * const pCode1, Formula return true; } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::CompileTokenArray() +bool FormulaCompiler::CompileTokenArray() { - glSubTotal = sal_False; - bCorrected = sal_False; + glSubTotal = false; + bCorrected = false; if( !pArr->GetCodeError() || bIgnoreErrors ) { if ( bAutoCorrect ) @@ -1500,7 +1500,7 @@ sal_Bool FormulaCompiler::CompileTokenArray() pStack = NULL; FormulaToken* pData[ MAXCODE ]; pCode = pData; - sal_Bool bWasForced = pArr->IsRecalcModeForced(); + bool bWasForced = pArr->IsRecalcModeForced(); if ( bWasForced ) { if ( bAutoCorrect ) @@ -1534,7 +1534,7 @@ sal_Bool FormulaCompiler::CompileTokenArray() if( pArr->GetCodeError() && !bIgnoreErrors ) { pArr->DelRPN(); - pArr->SetHyperLink(sal_False); + pArr->SetHyperLink(false); } if ( bWasForced ) @@ -1596,7 +1596,7 @@ void FormulaCompiler::CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer ) rBuffer.append(sal_Unicode('=')); FormulaToken* t = pArr->First(); while( t ) - t = CreateStringFromToken( rBuffer, t, sal_True ); + t = CreateStringFromToken( rBuffer, t, true ); if (pSaveArr != pArr) { @@ -1605,7 +1605,7 @@ void FormulaCompiler::CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer ) } } // ----------------------------------------------------------------------------- -FormulaToken* FormulaCompiler::CreateStringFromToken( String& rFormula, FormulaToken* pTokenP,sal_Bool bAllowArrAdvance ) +FormulaToken* FormulaCompiler::CreateStringFromToken( String& rFormula, FormulaToken* pTokenP,bool bAllowArrAdvance ) { rtl::OUStringBuffer aBuffer; FormulaToken* p = CreateStringFromToken( aBuffer, pTokenP, bAllowArrAdvance ); @@ -1613,10 +1613,10 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( String& rFormula, FormulaT return p; } -FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuffer, FormulaToken* pTokenP,sal_Bool bAllowArrAdvance ) +FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuffer, FormulaToken* pTokenP,bool bAllowArrAdvance ) { - sal_Bool bNext = sal_True; - sal_Bool bSpaces = sal_False; + bool bNext = true; + bool bSpaces = false; FormulaToken* t = pTokenP; OpCode eOp = t->GetOpCode(); if( eOp >= ocAnd && eOp <= ocOr ) @@ -1626,7 +1626,7 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuff t = pArr->Next(); else t = pArr->PeekNext(); - bNext = sal_False; + bNext = false; bSpaces = ( !t || t->GetOpCode() != ocOpen ); } if( bSpaces ) @@ -1750,7 +1750,7 @@ void FormulaCompiler::AppendDouble( rtl::OUStringBuffer& rBuffer, double fVal ) { ::rtl::math::doubleToUStringBuffer( rBuffer, fVal, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', sal_True ); + rtl_math_DecimalPlaces_Max, '.', true ); } else { @@ -1759,7 +1759,7 @@ void FormulaCompiler::AppendDouble( rtl::OUStringBuffer& rBuffer, double fVal ) rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, aSysLocale.GetLocaleDataPtr()->getNumDecimalSep().GetChar(0), - sal_True ); + true ); } } // ----------------------------------------------------------------------------- @@ -1768,9 +1768,9 @@ void FormulaCompiler::AppendBoolean( rtl::OUStringBuffer& rBuffer, bool bVal ) rBuffer.append( mxSymbols->getSymbol(static_cast<OpCode>(bVal ? ocTrue : ocFalse)) ); } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::IsImportingXML() const +bool FormulaCompiler::IsImportingXML() const { - return sal_False; + return false; } // ----------------------------------------------------------------------------- void FormulaCompiler::AppendString( rtl::OUStringBuffer& rBuffer, const String & rStr ) @@ -1846,7 +1846,7 @@ OpCode FormulaCompiler::NextToken() if ( eOp == eLastOp || eLastOp == ocOpen ) { // throw away duplicated operator aCorrectedSymbol.Erase(); - bCorrected = sal_True; + bCorrected = true; } else { @@ -1863,7 +1863,7 @@ OpCode FormulaCompiler::NextToken() aCorrectedFormula.SetChar( nPos, mxSymbols->getSymbol(ocGreater).GetChar(0) ); aCorrectedSymbol = c; - bCorrected = sal_True; + bCorrected = true; } break; case ocLess: @@ -1872,14 +1872,14 @@ OpCode FormulaCompiler::NextToken() aCorrectedFormula.SetChar( nPos, mxSymbols->getSymbol(ocLess).GetChar(0) ); aCorrectedSymbol = c; - bCorrected = sal_True; + bCorrected = true; } else if ( c == mxSymbols->getSymbol(ocGreater).GetChar(0) ) { // <> instead of >< aCorrectedFormula.SetChar( nPos, mxSymbols->getSymbol(ocLess).GetChar(0) ); aCorrectedSymbol = c; - bCorrected = sal_True; + bCorrected = true; } break; case ocMul: @@ -1888,7 +1888,7 @@ OpCode FormulaCompiler::NextToken() aCorrectedFormula.SetChar( nPos, mxSymbols->getSymbol(ocMul).GetChar(0) ); aCorrectedSymbol = c; - bCorrected = sal_True; + bCorrected = true; } break; case ocDiv: @@ -1897,7 +1897,7 @@ OpCode FormulaCompiler::NextToken() aCorrectedFormula.SetChar( nPos, mxSymbols->getSymbol(ocDiv).GetChar(0) ); aCorrectedSymbol = c; - bCorrected = sal_True; + bCorrected = true; } break; default: @@ -1934,24 +1934,24 @@ void FormulaCompiler::PutCode( FormulaTokenRef& p ) } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::HandleExternalReference(const FormulaToken& /*_aToken*/) +bool FormulaCompiler::HandleExternalReference(const FormulaToken& /*_aToken*/) { - return sal_True; + return true; } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::HandleRange() +bool FormulaCompiler::HandleRange() { - return sal_True; + return true; } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::HandleSingleRef() +bool FormulaCompiler::HandleSingleRef() { - return sal_True; + return true; } // ----------------------------------------------------------------------------- -sal_Bool FormulaCompiler::HandleDbData() +bool FormulaCompiler::HandleDbData() { - return sal_True; + return true; } // ----------------------------------------------------------------------------- void FormulaCompiler::CreateStringFromSingleRef(rtl::OUStringBuffer& /*rBuffer*/,FormulaToken* /*pTokenP*/) @@ -1977,7 +1977,7 @@ void FormulaCompiler::CreateStringFromExternal(rtl::OUStringBuffer& /*rBuffer*/, void FormulaCompiler::LocalizeString( String& /*rName*/ ) { } -void FormulaCompiler::PushTokenArray( FormulaTokenArray* pa, sal_Bool bTemp ) +void FormulaCompiler::PushTokenArray( FormulaTokenArray* pa, bool bTemp ) { if ( bAutoCorrect && !pStack ) { // don't merge stacked subroutine code into entered formula diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 703c5d6bb6b2..8703fd8ba5fc 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -64,7 +64,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken, nMemPoolStringToken, nMemPoolS // --- helpers -------------------------------------------------------------- -inline sal_Bool lcl_IsReference( OpCode eOp, StackVar eType ) +inline bool lcl_IsReference( OpCode eOp, StackVar eType ) { return (eOp == ocPush && (eType == svSingleRef || eType == svDoubleRef)) @@ -81,7 +81,7 @@ FormulaToken::~FormulaToken() bool FormulaToken::Is3DRef() const { - return sal_False; + return false; } bool FormulaToken::IsFunction() const @@ -108,7 +108,7 @@ sal_uInt8 FormulaToken::GetParamCount() const eOp != ocIf && eOp != ocChose && eOp != ocPercentSign ) return 0; // parameters and specials // ocIf and ocChose not for FAP, have cByte then -//2do: sal_Bool parameter whether FAP or not? +//2do: bool parameter whether FAP or not? else if ( GetByte() ) return GetByte(); // all functions, also ocExternal and ocMacro else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP) @@ -570,9 +570,9 @@ bool FormulaTokenArray::HasOpCode( OpCode eOp ) const for ( sal_uInt16 j=0; j < nLen; j++ ) { if ( pCode[j]->GetOpCode() == eOp ) - return sal_True; + return true; } - return sal_False; + return false; } bool FormulaTokenArray::HasOpCodeRPN( OpCode eOp ) const @@ -580,9 +580,9 @@ bool FormulaTokenArray::HasOpCodeRPN( OpCode eOp ) const for ( sal_uInt16 j=0; j < nRPN; j++ ) { if ( pRPN[j]->GetOpCode() == eOp ) - return sal_True; + return true; } - return sal_False; + return false; } bool FormulaTokenArray::HasNameOrColRowName() const @@ -590,9 +590,9 @@ bool FormulaTokenArray::HasNameOrColRowName() const for ( sal_uInt16 j=0; j < nLen; j++ ) { if( pCode[j]->GetType() == svIndex || pCode[j]->GetOpCode() == ocColRowName ) - return sal_True; + return true; } - return sal_False; + return false; } @@ -600,7 +600,7 @@ FormulaTokenArray::FormulaTokenArray() { pCode = NULL; pRPN = NULL; nError = nLen = nIndex = nRPN = nRefs = 0; - bHyperLink = sal_False; + bHyperLink = false; ClearRecalcMode(); } @@ -714,7 +714,7 @@ void FormulaTokenArray::Clear() } pCode = NULL; pRPN = NULL; nError = nLen = nIndex = nRPN = nRefs = 0; - bHyperLink = sal_False; + bHyperLink = false; ClearRecalcMode(); } @@ -851,7 +851,7 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() { pResult->Delete(); delete [] pStack; - return sal_True; + return true; } } } @@ -883,7 +883,7 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() delete [] pStack; } - return sal_False; + return false; } @@ -932,21 +932,21 @@ void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const Missi if (mnCurArg == 2) { pNewArr->AddOpCode( ocSep ); - pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=sal_True() + pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=true() } break; case ocPoissonDist: if (mnCurArg == 1) { pNewArr->AddOpCode( ocSep ); - pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=sal_True() + pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=true() } break; case ocNormDist: if ( mnCurArg == 2 ) { pNewArr->AddOpCode( ocSep ); - pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=sal_True() + pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=true() } break; case ocLogNormDist: @@ -1207,7 +1207,7 @@ FormulaToken* FormulaTokenArray::AddOpCode( OpCode eOp ) } break; default: - pRet = new FormulaByteToken( eOp, 0, sal_False ); + pRet = new FormulaByteToken( eOp, 0, false ); break; } return AddToken( *pRet ); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 8d54b873869a..7f418e32486d 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -101,17 +101,17 @@ class ScTokenArray; // constants and data types internal to compiler /* - OpCode eOp; // OpCode - formula::StackVar eType; // type of data - sal_uInt16 nRefCnt; // reference count - sal_Bool bRaw; // not cloned yet and trimmed to real size + OpCode eOp; // OpCode + formula::StackVar eType; // type of data + sal_uInt16 nRefCnt; // reference count + bool bRaw; // not cloned yet and trimmed to real size */ #define SC_TOKEN_FIX_MEMBERS \ OpCode eOp; \ formula::StackVar eType; \ mutable sal_uInt16 nRefCnt; \ - sal_Bool bRaw; + bool bRaw; struct ScDoubleRawToken { @@ -166,7 +166,7 @@ public: }; //! other members not initialized - ScRawToken() : bRaw( sal_True ) {} + ScRawToken() : bRaw( true ) {} private: ~ScRawToken() {} //! only delete via Delete() public: @@ -240,7 +240,7 @@ public: virtual void MakeRefStr( rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler, const ScComplexRefData& rRef, - sal_Bool bSingleRef ) const = 0; + bool bSingleRef ) const = 0; virtual ::com::sun::star::i18n::ParseResult parseAnyToken( const String& rFormula, xub_StrLen nSrcPos, @@ -334,23 +334,23 @@ private: bool mbExtendedErrorDetection; bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis - sal_Bool NextNewToken(bool bInArray = false); + bool NextNewToken(bool bInArray = false); virtual void SetError(sal_uInt16 nError); xub_StrLen NextSymbol(bool bInArray); - sal_Bool IsValue( const String& ); - sal_Bool IsOpCode( const String&, bool bInArray ); - sal_Bool IsOpCode2( const String& ); - sal_Bool IsString(); - sal_Bool IsReference( const String& ); - sal_Bool IsSingleReference( const String& ); - sal_Bool IsPredetectedReference( const String& ); - sal_Bool IsDoubleReference( const String& ); - sal_Bool IsMacro( const String& ); + bool IsValue( const String& ); + bool IsOpCode( const String&, bool bInArray ); + bool IsOpCode2( const String& ); + bool IsString(); + bool IsReference( const String& ); + bool IsSingleReference( const String& ); + bool IsPredetectedReference( const String& ); + bool IsDoubleReference( const String& ); + bool IsMacro( const String& ); bool IsNamedRange( const String& ); bool IsExternalNamedRange( const String& rSymbol ); bool IsDBRange( const String& ); - sal_Bool IsColRowName( const String& ); + bool IsColRowName( const String& ); bool IsBoolean( const String& ); bool IsErrorConstant( const String& ); void AutoCorrectParsedSymbol(); @@ -371,7 +371,7 @@ public: static void CheckTabQuotes( String& aTabName, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ); - static sal_Bool EnQuote( String& rStr ); + static bool EnQuote( String& rStr ); sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const; @@ -380,7 +380,7 @@ public: //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both // #i101512# SetCompileForFAP is in formula::FormulaCompiler - void SetAutoCorrection( sal_Bool bVal ) + void SetAutoCorrection( bool bVal ) { bAutoCorrect = bVal; bIgnoreErrors = bVal; } void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; } void SetRefConvention( const Convention *pConvP ); @@ -419,7 +419,7 @@ public: void SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; } - sal_Bool IsCorrected() { return bCorrected; } + bool IsCorrected() { return bCorrected; } const String& GetCorrectedFormula() { return aCorrectedFormula; } // Use convention from this->aPos by default @@ -490,8 +490,8 @@ public: /** If the character is allowed as tested by nFlags (SC_COMPILER_C_... bits) for all known address conventions. If more than one bit is given - in nFlags, all bits must match. If bTestLetterNumeric is sal_False and - char>=128, no LetterNumeric test is done and sal_False is returned. */ + in nFlags, all bits must match. If bTestLetterNumeric is false and + char>=128, no LetterNumeric test is done and false is returned. */ static inline bool IsCharFlagAllConventions( String const & rStr, xub_StrLen nPos, sal_uLong nFlags, @@ -519,16 +519,16 @@ public: private: // FormulaCompiler - virtual String FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const; + virtual String FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const; virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const; virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const; virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, formula::FormulaGrammar::Grammar _eGrammar ) const; virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const; - virtual sal_Bool HandleExternalReference(const formula::FormulaToken& _aToken); - virtual sal_Bool HandleRange(); - virtual sal_Bool HandleSingleRef(); - virtual sal_Bool HandleDbData(); + virtual bool HandleExternalReference(const formula::FormulaToken& _aToken); + virtual bool HandleRange(); + virtual bool HandleSingleRef(); + virtual bool HandleDbData(); virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef ); virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP); @@ -537,7 +537,7 @@ private: virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP); virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); virtual void LocalizeString( String& rName ); // modify rName - input: exact name - virtual sal_Bool IsImportingXML() const; + virtual bool IsImportingXML() const; /// Access the CharTable flags inline sal_uLong GetCharTableFlags( sal_Unicode c, sal_Unicode cLast ) diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index c56b2a6c01f6..d7cefab1982a 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -102,7 +102,7 @@ public: The formula's position, used to calculate absolute positions from relative references. @param bReuseDoubleRef - If sal_True, a DoubleRef token is reused if passed as rTok1 or rTok2, + If true, a DoubleRef token is reused if passed as rTok1 or rTok2, else a new DoubleRef token is created and returned. @return A reused or new'ed ScDoubleRefToken, or a NULL TokenRef if rTok1 or diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index b6a97ecff9c9..740bbfa54e3c 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -43,7 +43,7 @@ class ScMatrix; class SC_DLLPUBLIC ScTokenArray : public formula::FormulaTokenArray { friend class ScCompiler; - sal_Bool ImplGetReference( ScRange& rRange, sal_Bool bValidOnly ) const; + bool ImplGetReference( ScRange& rRange, bool bValidOnly ) const; public: ScTokenArray(); @@ -53,15 +53,15 @@ public: ScTokenArray* Clone() const; /// True copy! /// Exactly and only one range (valid or deleted) - sal_Bool IsReference( ScRange& rRange ) const; + bool IsReference( ScRange& rRange ) const; /// Exactly and only one valid range (no #REF!s) - sal_Bool IsValidReference( ScRange& rRange ) const; + bool IsValidReference( ScRange& rRange ) const; /** Determines the extent of direct adjacent references. Only use with real functions, e.g. GetOuterFuncOpCode() == ocSum ! */ - sal_Bool GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, + bool GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, const ScAddress& rPos, ScDirection ); formula::FormulaToken* AddRawToken( const ScRawToken& ); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index e17b44c005b1..ab918071e09e 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -325,9 +325,9 @@ void ScCompiler::SetGrammarAndRefConvention( SetRefConvention( eConv ); } -String ScCompiler::FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const +String ScCompiler::FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const { - return ScGlobal::GetAddInCollection()->FindFunction(rUpperName, bLocalFirst); // bLocalFirst=sal_False for english + return ScGlobal::GetAddInCollection()->FindFunction(rUpperName, bLocalFirst); // bLocalFirst=false for english } @@ -887,7 +887,7 @@ struct ConventionOOO_A1 : public Convention_A1 void MakeRefStr( rtl::OUStringBuffer& rBuffer, const ScCompiler& rComp, const ScComplexRefData& rRef, - sal_Bool bSingleRef ) const + bool bSingleRef ) const { MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, false); } @@ -1074,7 +1074,7 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1 void MakeRefStr( rtl::OUStringBuffer& rBuffer, const ScCompiler& rComp, const ScComplexRefData& rRef, - sal_Bool bSingleRef ) const + bool bSingleRef ) const { MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, true); } @@ -1331,7 +1331,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL void MakeRefStr( rtl::OUStringBuffer& rBuf, const ScCompiler& rComp, const ScComplexRefData& rRef, - sal_Bool bSingleRef ) const + bool bSingleRef ) const { ScComplexRefData aRef( rRef ); @@ -1533,7 +1533,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL void MakeRefStr( rtl::OUStringBuffer& rBuf, const ScCompiler& rComp, const ScComplexRefData& rRef, - sal_Bool bSingleRef ) const + bool bSingleRef ) const { ScComplexRefData aRef( rRef ); @@ -2470,10 +2470,10 @@ Label_MaskStateMachine: // Convert symbol to token //--------------------------------------------------------------------------- -sal_Bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) +bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) { OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName)); - sal_Bool bFound = (iLook != mxSymbols->getHashMap()->end()); + bool bFound = (iLook != mxSymbols->getHashMap()->end()); if (bFound) { ScRawToken aToken; @@ -2516,7 +2516,7 @@ sal_Bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) ScRawToken aToken; aToken.SetOpCode( aOdffAliases[i].eOp); pRawToken = aToken.Clone(); - bFound = sal_True; + bFound = true; break; // for } } @@ -2555,7 +2555,7 @@ sal_Bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) pRawToken = aToken.Clone(); } else - // bLocalFirst=sal_False for (English) upper full original name + // bLocalFirst=false for (English) upper full original name // (service.function) aIntName = ScGlobal::GetAddInCollection()->FindFunction( rName, !mxSymbols->isEnglish()); @@ -2565,7 +2565,7 @@ sal_Bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) ScRawToken aToken; aToken.SetExternal( aIntName.GetBuffer() ); // international name pRawToken = aToken.Clone(); - bFound = sal_True; + bFound = true; } } OpCode eOp; @@ -2585,9 +2585,9 @@ sal_Bool ScCompiler::IsOpCode( const String& rName, bool bInArray ) return bFound; } -sal_Bool ScCompiler::IsOpCode2( const String& rName ) +bool ScCompiler::IsOpCode2( const String& rName ) { - sal_Bool bFound = false; + bool bFound = false; sal_uInt16 i; for( i = ocInternalBegin; i <= ocInternalEnd && !bFound; i++ ) @@ -2602,7 +2602,7 @@ sal_Bool ScCompiler::IsOpCode2( const String& rName ) return bFound; } -sal_Bool ScCompiler::IsValue( const String& rSym ) +bool ScCompiler::IsValue( const String& rSym ) { double fVal; sal_uInt32 nIndex = ( mxSymbols->isEnglish() ? @@ -2635,19 +2635,19 @@ sal_Bool ScCompiler::IsValue( const String& rSym ) ScRawToken aToken; aToken.SetDouble( fVal ); pRawToken = aToken.Clone(); - return sal_True; + return true; } else return false; } -sal_Bool ScCompiler::IsString() +bool ScCompiler::IsString() { register const sal_Unicode* p = cSymbol; while ( *p ) p++; xub_StrLen nLen = sal::static_int_cast<xub_StrLen>( p - cSymbol - 1 ); - sal_Bool bQuote = ((cSymbol[0] == '"') && (cSymbol[nLen] == '"')); + bool bQuote = ((cSymbol[0] == '"') && (cSymbol[nLen] == '"')); if ((bQuote ? nLen-2 : nLen) > MAXSTRLEN-1) { SetError(errStringOverflow); @@ -2659,13 +2659,13 @@ sal_Bool ScCompiler::IsString() ScRawToken aToken; aToken.SetString( cSymbol+1 ); pRawToken = aToken.Clone(); - return sal_True; + return true; } return false; } -sal_Bool ScCompiler::IsPredetectedReference( const String& rName ) +bool ScCompiler::IsPredetectedReference( const String& rName ) { // Speedup documents with lots of broken references, e.g. sheet deleted. xub_StrLen nPos = rName.SearchAscii( "#REF!"); @@ -2723,7 +2723,7 @@ sal_Bool ScCompiler::IsPredetectedReference( const String& rName ) } -sal_Bool ScCompiler::IsDoubleReference( const String& rName ) +bool ScCompiler::IsDoubleReference( const String& rName ) { ScRange aRange( aPos, aPos ); const ScAddress::Details aDetails( pConv->meConv, aPos ); @@ -2738,13 +2738,13 @@ sal_Bool ScCompiler::IsDoubleReference( const String& rName ) aRef.Ref1.SetRowRel( (nFlags & SCA_ROW_ABSOLUTE) == 0 ); aRef.Ref1.SetTabRel( (nFlags & SCA_TAB_ABSOLUTE) == 0 ); if ( !(nFlags & SCA_VALID_TAB) ) - aRef.Ref1.SetTabDeleted( sal_True ); // #REF! + aRef.Ref1.SetTabDeleted( true ); // #REF! aRef.Ref1.SetFlag3D( ( nFlags & SCA_TAB_3D ) != 0 ); aRef.Ref2.SetColRel( (nFlags & SCA_COL2_ABSOLUTE) == 0 ); aRef.Ref2.SetRowRel( (nFlags & SCA_ROW2_ABSOLUTE) == 0 ); aRef.Ref2.SetTabRel( (nFlags & SCA_TAB2_ABSOLUTE) == 0 ); if ( !(nFlags & SCA_VALID_TAB2) ) - aRef.Ref2.SetTabDeleted( sal_True ); // #REF! + aRef.Ref2.SetTabDeleted( true ); // #REF! aRef.Ref2.SetFlag3D( ( nFlags & SCA_TAB2_3D ) != 0 ); aRef.CalcRelFromAbs( aPos ); if (aExtInfo.mbExternal) @@ -2765,7 +2765,7 @@ sal_Bool ScCompiler::IsDoubleReference( const String& rName ) } -sal_Bool ScCompiler::IsSingleReference( const String& rName ) +bool ScCompiler::IsSingleReference( const String& rName ) { ScAddress aAddr( aPos ); const ScAddress::Details aDetails( pConv->meConv, aPos ); @@ -2811,7 +2811,7 @@ sal_Bool ScCompiler::IsSingleReference( const String& rName ) } -sal_Bool ScCompiler::IsReference( const String& rName ) +bool ScCompiler::IsReference( const String& rName ) { // Has to be called before IsValue sal_Unicode ch1 = rName.GetChar(0); @@ -2903,7 +2903,7 @@ sal_Bool ScCompiler::IsReference( const String& rName ) return false; } -sal_Bool ScCompiler::IsMacro( const String& rName ) +bool ScCompiler::IsMacro( const String& rName ) { String aName( rName); StarBASIC* pObj = 0; @@ -2939,7 +2939,7 @@ sal_Bool ScCompiler::IsMacro( const String& rName ) aToken.SetExternal( aName.GetBuffer() ); aToken.eOp = ocMacro; pRawToken = aToken.Clone(); - return sal_True; + return true; } bool ScCompiler::IsNamedRange( const String& rUpperName ) @@ -3020,10 +3020,10 @@ bool ScCompiler::IsDBRange( const String& rName ) return true; } -sal_Bool ScCompiler::IsColRowName( const String& rName ) +bool ScCompiler::IsColRowName( const String& rName ) { - sal_Bool bInList = false; - sal_Bool bFound = false; + bool bInList = false; + bool bFound = false; ScSingleRefData aRef; String aName( rName ); DeQuote( aName ); @@ -3054,10 +3054,10 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) // recursive.. // Furthermore, *this* cell won't be touched, since no RPN exists yet. CellType eType = pCell->GetCellType(); - sal_Bool bOk = sal::static_int_cast<sal_Bool>( (eType == CELLTYPE_FORMULA ? + bool bOk = ( (eType == CELLTYPE_FORMULA ? ((ScFormulaCell*)pCell)->GetCode()->GetCodeLen() > 0 && ((ScFormulaCell*)pCell)->aPos != aPos // noIter - : sal_True ) ); + : true ) ); if ( bOk && pCell->HasStringData() ) { String aStr; @@ -3089,11 +3089,11 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) aRef.nRow = aIter.GetRow(); aRef.nTab = aIter.GetTab(); if ( !jRow ) - aRef.SetColRel( sal_True ); // ColName + aRef.SetColRel( true ); // ColName else - aRef.SetRowRel( sal_True ); // RowName + aRef.SetRowRel( true ); // RowName aRef.CalcRelFromAbs( aPos ); - bInList = bFound = sal_True; + bInList = bFound = true; } } } @@ -3105,7 +3105,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) long nDistance = 0, nMax = 0; long nMyCol = (long) aPos.Col(); long nMyRow = (long) aPos.Row(); - sal_Bool bTwo = false; + bool bTwo = false; ScAddress aOne( 0, 0, aPos.Tab() ); ScAddress aTwo( MAXCOL, MAXROW, aPos.Tab() ); @@ -3145,7 +3145,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) { if ( nC < 0 || nR < 0 ) { // right or below - bTwo = sal_True; + bTwo = true; aTwo.Set( nCol, nRow, aAddress.Tab() ); nMax = Max( nMyCol + Abs( nC ), nMyRow + Abs( nR ) ); nDistance = nD; @@ -3168,7 +3168,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) nDistance = nC * nC + nR * nR; nMax = Max( nMyCol + Abs( nC ), nMyRow + Abs( nR ) ); } - bFound = sal_True; + bFound = true; } } } @@ -3183,10 +3183,10 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) break; // aIter } CellType eType = pCell->GetCellType(); - sal_Bool bOk = sal::static_int_cast<sal_Bool>( (eType == CELLTYPE_FORMULA ? + bool bOk = ( (eType == CELLTYPE_FORMULA ? ((ScFormulaCell*)pCell)->GetCode()->GetCodeLen() > 0 && ((ScFormulaCell*)pCell)->aPos != aPos // noIter - : sal_True ) ); + : true ) ); if ( bOk && pCell->HasStringData() ) { String aStr; @@ -3224,7 +3224,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) { if ( nC < 0 || nR < 0 ) { // right or below - bTwo = sal_True; + bTwo = true; aTwo.Set( nCol, nRow, aIter.GetTab() ); nMax = Max( nMyCol + Abs( nC ), nMyRow + Abs( nR ) ); nDistance = nD; @@ -3247,7 +3247,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) nDistance = nC * nC + nR * nR; nMax = Max( nMyCol + Abs( nC ), nMyRow + Abs( nR ) ); } - bFound = sal_True; + bFound = true; } } } @@ -3289,9 +3289,9 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) aRef.nCol, aRef.nRow + 1, aRef.nTab )) || (aRef.nRow != 0 && pDoc->HasStringData( aRef.nCol, aRef.nRow - 1, aRef.nTab )) ) - aRef.SetRowRel( sal_True ); // RowName + aRef.SetRowRel( true ); // RowName else - aRef.SetColRel( sal_True ); // ColName + aRef.SetColRel( true ); // ColName aRef.CalcRelFromAbs( aPos ); } } @@ -3301,7 +3301,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName ) aToken.SetSingleReference( aRef ); aToken.eOp = ocColRowName; pRawToken = aToken.Clone(); - return sal_True; + return true; } else return false; @@ -3364,17 +3364,17 @@ void ScCompiler::AutoCorrectParsedSymbol() aCorrectedSymbol.SetChar( nPos, cQuote ); // '"' the 255th character else aCorrectedSymbol.Insert( cQuote, nPos + 1 ); - bCorrected = sal_True; + bCorrected = true; } else if ( c1 != cQuote && c2 == cQuote ) { // ..." aCorrectedSymbol.Insert( cQuote, 0 ); - bCorrected = sal_True; + bCorrected = true; } else if ( nPos == 0 && (c1 == cx || c1 == cX) ) { // x => * aCorrectedSymbol = mxSymbols->getSymbol(ocMul); - bCorrected = sal_True; + bCorrected = true; } else if ( (GetCharTableFlags( c1, 0 ) & SC_COMPILER_C_CHAR_VALUE) && (GetCharTableFlags( c2, c2p ) & SC_COMPILER_C_CHAR_VALUE) ) @@ -3387,7 +3387,7 @@ void ScCompiler::AutoCorrectParsedSymbol() while ( (nIndex = aCorrectedSymbol.SearchAndReplace( cx, c, nIndex )) != STRING_NOTFOUND ) nIndex++; - bCorrected = sal_True; + bCorrected = true; } if ( (nXcount = aCorrectedSymbol.GetTokenCount( cX )) > 1 ) { // X => * @@ -3396,7 +3396,7 @@ void ScCompiler::AutoCorrectParsedSymbol() while ( (nIndex = aCorrectedSymbol.SearchAndReplace( cX, c, nIndex )) != STRING_NOTFOUND ) nIndex++; - bCorrected = sal_True; + bCorrected = true; } } else @@ -3411,16 +3411,16 @@ void ScCompiler::AutoCorrectParsedSymbol() aSymbol.Erase( 0, nPosition + 2 ); } xub_StrLen nRefs = aSymbol.GetTokenCount( ':' ); - sal_Bool bColons; + bool bColons; if ( nRefs > 2 ) { // duplicated or too many ':'? B:2::C10 => B2:C10 - bColons = sal_True; + bColons = true; xub_StrLen nIndex = 0; String aTmp1( aSymbol.GetToken( 0, ':', nIndex ) ); xub_StrLen nLen1 = aTmp1.Len(); String aSym, aTmp2; - sal_Bool bLastAlp, bNextNum; - bLastAlp = bNextNum = sal_True; + bool bLastAlp, bNextNum; + bLastAlp = bNextNum = true; xub_StrLen nStrip = 0; xub_StrLen nCount = nRefs; for ( xub_StrLen j=1; j<nCount; j++ ) @@ -3487,8 +3487,8 @@ void ScCompiler::AutoCorrectParsedSymbol() else aRef[0] = aSymbol; - sal_Bool bChanged = false; - sal_Bool bOk = sal_True; + bool bChanged = false; + bool bOk = true; sal_uInt16 nMask = SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW; for ( int j=0; j<nRefs; j++ ) { @@ -3510,7 +3510,7 @@ void ScCompiler::AutoCorrectParsedSymbol() aRef[j] += aStr2; if ( bColons || aRef[j] != aOld ) { - bChanged = sal_True; + bChanged = true; ScAddress aAdr; bOk &= ((aAdr.Parse( aRef[j], pDoc, aDetails ) & nMask) == nMask); } @@ -3526,7 +3526,7 @@ void ScCompiler::AutoCorrectParsedSymbol() aCorrectedSymbol += aTab[1]; aCorrectedSymbol += aRef[1]; } - bCorrected = sal_True; + bCorrected = true; } } } @@ -3550,7 +3550,7 @@ inline bool lcl_UpperAsciiOrI18n( String& rUpper, const String& rOrg, FormulaGra } } -sal_Bool ScCompiler::NextNewToken( bool bInArray ) +bool ScCompiler::NextNewToken( bool bInArray ) { bool bAllowBooleans = bInArray; xub_StrLen nSpaces = NextSymbol(bInArray); @@ -3812,7 +3812,7 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula ) SetError( errPairExpected ); if ( bAutoCorrect ) { - bCorrected = sal_True; + bCorrected = true; aCorrectedSymbol.Erase(); } } @@ -3854,7 +3854,7 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula ) SetError( errPairExpected ); if ( bAutoCorrect ) { - bCorrected = sal_True; + bCorrected = true; aCorrectedSymbol.Erase(); } } @@ -3975,7 +3975,7 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula, const String& r } -sal_Bool ScCompiler::HandleRange() +bool ScCompiler::HandleRange() { ScRangeData* pRangeData = NULL; @@ -4009,18 +4009,18 @@ sal_Bool ScCompiler::HandleRange() FormulaToken* p2 = pArr->PeekNextNoSpaces(); OpCode eOp1 = (p1 ? p1->GetOpCode() : static_cast<OpCode>( ocSep ) ); OpCode eOp2 = (p2 ? p2->GetOpCode() : static_cast<OpCode>( ocSep ) ); - sal_Bool bBorder1 = (eOp1 == ocSep || eOp1 == ocOpen); - sal_Bool bBorder2 = (eOp2 == ocSep || eOp2 == ocClose); - sal_Bool bAddPair = !(bBorder1 && bBorder2); + bool bBorder1 = (eOp1 == ocSep || eOp1 == ocOpen); + bool bBorder2 = (eOp2 == ocSep || eOp2 == ocClose); + bool bAddPair = !(bBorder1 && bBorder2); if ( bAddPair ) { pNew = new ScTokenArray(); pNew->AddOpCode( ocClose ); - PushTokenArray( pNew, sal_True ); + PushTokenArray( pNew, true ); pNew->Reset(); } pNew = pRangeData->GetCode()->Clone(); - PushTokenArray( pNew, sal_True ); + PushTokenArray( pNew, true ); if( pRangeData->HasReferences() ) { SetRelNameReference(); @@ -4031,7 +4031,7 @@ sal_Bool ScCompiler::HandleRange() { pNew = new ScTokenArray(); pNew->AddOpCode( ocOpen ); - PushTokenArray( pNew, sal_True ); + PushTokenArray( pNew, true ); pNew->Reset(); } return GetToken(); @@ -4039,10 +4039,10 @@ sal_Bool ScCompiler::HandleRange() } else SetError(errNoName); - return sal_True; + return true; } // ----------------------------------------------------------------------------- -sal_Bool ScCompiler::HandleExternalReference(const FormulaToken& _aToken) +bool ScCompiler::HandleExternalReference(const FormulaToken& _aToken) { // Handle external range names. switch (_aToken.GetType()) @@ -4085,7 +4085,7 @@ sal_Bool ScCompiler::HandleExternalReference(const FormulaToken& _aToken) OSL_FAIL("Wrong type for external reference!"); return false; } - return sal_True; + return true; } @@ -4133,7 +4133,7 @@ bool ScCompiler::HasModifiedRange() //--------------------------------------------------------------------------- template< typename T, typename S > -S lcl_adjval( S& n, T pos, T max, sal_Bool bRel ) +S lcl_adjval( S& n, T pos, T max, bool bRel ) { max++; if( bRel ) @@ -4157,12 +4157,12 @@ void ScCompiler::SetRelNameReference() { ScSingleRefData& rRef1 = t->GetSingleRef(); if ( rRef1.IsColRel() || rRef1.IsRowRel() || rRef1.IsTabRel() ) - rRef1.SetRelName( sal_True ); + rRef1.SetRelName( true ); if ( t->GetType() == svDoubleRef ) { ScSingleRefData& rRef2 = t->GetDoubleRef().Ref2; if ( rRef2.IsColRel() || rRef2.IsRowRel() || rRef2.IsTabRel() ) - rRef2.SetRelName( sal_True ); + rRef2.SetRelName( true ); } } } @@ -4343,12 +4343,12 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, } } #if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE - sal_Bool bEasyShared, bPosInRange; + bool bEasyShared, bPosInRange; if ( !pRangeData ) bEasyShared = bPosInRange = false; else { - bEasyShared = sal_True; + bEasyShared = true; bPosInRange = r.In( eUpdateRefMode == URM_MOVE ? aPos : rOldPos ); } #endif @@ -4726,7 +4726,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool || (nTab+nSheets) >= pDoc->GetTableCount() ) { rRef.nTab = MAXTAB+1; - rRef.SetTabDeleted( sal_True ); + rRef.SetTabDeleted( true ); } // else: nTab later points to what's nTable+1 now // => area shrunk @@ -4734,7 +4734,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool else { rRef.nTab = MAXTAB+1; - rRef.SetTabDeleted( sal_True ); + rRef.SetTabDeleted( true ); } rChanged = true; } @@ -4763,7 +4763,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool else { rRef.nTab = MAXTAB+1; - rRef.SetTabDeleted( sal_True ); + rRef.SetTabDeleted( true ); } rChanged = true; } @@ -4812,7 +4812,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool || (nTab+1) >= pDoc->GetTableCount() ) { rRef1.nTab = MAXTAB+1; - rRef1.SetTabDeleted( sal_True ); + rRef1.SetTabDeleted( true ); } // else: nTab later points to what's nTable+1 now // => area shrunk @@ -4820,7 +4820,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool else { rRef1.nTab = MAXTAB+1; - rRef1.SetTabDeleted( sal_True ); + rRef1.SetTabDeleted( true ); } rChanged = true; } @@ -4847,7 +4847,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool else { rRef2.nTab = MAXTAB+1; - rRef2.SetTabDeleted( sal_True ); + rRef2.SetTabDeleted( true ); } rChanged = true; } @@ -5137,11 +5137,11 @@ void ScCompiler::CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,FormulaT else { rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF)); - pConv->MakeRefStr (rBuffer, *this, aRef, sal_True ); + pConv->MakeRefStr (rBuffer, *this, aRef, true ); } } else - pConv->MakeRefStr( rBuffer, *this, aRef, sal_True ); + pConv->MakeRefStr( rBuffer, *this, aRef, true ); } // ----------------------------------------------------------------------------- void ScCompiler::CreateStringFromDoubleRef(rtl::OUStringBuffer& rBuffer,FormulaToken* _pTokenP) @@ -5200,14 +5200,14 @@ void ScCompiler::LocalizeString( String& rName ) ScGlobal::GetAddInCollection()->LocalizeString( rName ); } // ----------------------------------------------------------------------------- -sal_Bool ScCompiler::IsImportingXML() const +bool ScCompiler::IsImportingXML() const { return pDoc->IsImportingXML(); } // Put quotes around string if non-alphanumeric characters are contained, // quote characters contained within are escaped by '\\'. -sal_Bool ScCompiler::EnQuote( String& rStr ) +bool ScCompiler::EnQuote( String& rStr ) { sal_Int32 nType = ScGlobal::pCharClass->getStringType( rStr, 0, rStr.Len() ); if ( !CharClass::isNumericType( nType ) @@ -5222,7 +5222,7 @@ sal_Bool ScCompiler::EnQuote( String& rStr ) } rStr.Insert( '\'', 0 ); rStr += '\''; - return sal_True; + return true; } sal_Unicode ScCompiler::GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const @@ -5260,24 +5260,24 @@ void ScCompiler::fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaO // FIXME: what about those old non-UNO AddIns? } // ----------------------------------------------------------------------------- -sal_Bool ScCompiler::HandleSingleRef() +bool ScCompiler::HandleSingleRef() { ScSingleRefData& rRef = static_cast<ScToken*>(pToken.get())->GetSingleRef(); rRef.CalcAbsIfRel( aPos ); if ( !rRef.Valid() ) { SetError( errNoRef ); - return sal_True; + return true; } SCCOL nCol = rRef.nCol; SCROW nRow = rRef.nRow; SCTAB nTab = rRef.nTab; ScAddress aLook( nCol, nRow, nTab ); - sal_Bool bColName = rRef.IsColRel(); + bool bColName = rRef.IsColRel(); SCCOL nMyCol = aPos.Col(); SCROW nMyRow = aPos.Row(); - sal_Bool bInList = false; - sal_Bool bValidName = false; + bool bInList = false; + bool bValidName = false; ScRangePairList* pRL = (bColName ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges()); ScRange aRange; @@ -5286,7 +5286,7 @@ sal_Bool ScCompiler::HandleSingleRef() ScRangePair* pR = (*pRL)[i]; if ( pR->GetRange(0).In( aLook ) ) { - bInList = bValidName = sal_True; + bInList = bValidName = true; aRange = pR->GetRange(1); if ( bColName ) { @@ -5303,12 +5303,12 @@ sal_Bool ScCompiler::HandleSingleRef() } if ( !bInList && pDoc->GetDocOptions().IsLookUpColRowNames() ) { // automagically or created by copying and NamePos isn't in list - sal_Bool bString = pDoc->HasStringData( nCol, nRow, nTab ); + bool bString = pDoc->HasStringData( nCol, nRow, nTab ); if ( !bString && !pDoc->GetCell( aLook ) ) - bString = sal_True; // empty cell is ok + bString = true; // empty cell is ok if ( bString ) { //! coresponds with ScInterpreter::ScColRowNameAuto() - bValidName = sal_True; + bValidName = true; if ( bColName ) { // ColName SCROW nStartRow = nRow + 1; @@ -5386,10 +5386,10 @@ sal_Bool ScCompiler::HandleSingleRef() // generated. A ocColRowName or ocIntersect as a neighbor results // in a range. Special case: if label is valid for a single cell, a // position independent SingleRef is generated. - sal_Bool bSingle = (aRange.aStart == aRange.aEnd); - sal_Bool bFound; + bool bSingle = (aRange.aStart == aRange.aEnd); + bool bFound; if ( bSingle ) - bFound = sal_True; + bFound = true; else { FormulaToken* p1 = pArr->PeekPrevNoSpaces(); @@ -5402,7 +5402,7 @@ sal_Bool ScCompiler::HandleSingleRef() { if ( (SC_OPCODE_START_BIN_OP <= eOp1 && eOp1 < SC_OPCODE_STOP_BIN_OP) || (SC_OPCODE_START_BIN_OP <= eOp2 && eOp2 < SC_OPCODE_STOP_BIN_OP)) - bSingle = sal_True; + bSingle = true; } if ( bSingle ) { // column and/or row must match range @@ -5422,7 +5422,7 @@ sal_Bool ScCompiler::HandleSingleRef() } } else - bFound = sal_True; + bFound = true; } if ( !bFound ) SetError(errNoRef); @@ -5434,9 +5434,9 @@ sal_Bool ScCompiler::HandleSingleRef() ScSingleRefData aRefData; aRefData.InitAddress( aRange.aStart ); if ( bColName ) - aRefData.SetColRel( sal_True ); + aRefData.SetColRel( true ); else - aRefData.SetRowRel( sal_True ); + aRefData.SetRowRel( true ); aRefData.CalcRelFromAbs( aPos ); pNew->AddSingleReference( aRefData ); } @@ -5446,13 +5446,13 @@ sal_Bool ScCompiler::HandleSingleRef() aRefData.InitRange( aRange ); if ( bColName ) { - aRefData.Ref1.SetColRel( sal_True ); - aRefData.Ref2.SetColRel( sal_True ); + aRefData.Ref1.SetColRel( true ); + aRefData.Ref2.SetColRel( true ); } else { - aRefData.Ref1.SetRowRel( sal_True ); - aRefData.Ref2.SetRowRel( sal_True ); + aRefData.Ref1.SetRowRel( true ); + aRefData.Ref2.SetRowRel( true ); } aRefData.CalcRelFromAbs( aPos ); if ( bInList ) @@ -5462,17 +5462,17 @@ sal_Bool ScCompiler::HandleSingleRef() pNew->Add( new ScDoubleRefToken( aRefData, ocColRowNameAuto ) ); } } - PushTokenArray( pNew, sal_True ); + PushTokenArray( pNew, true ); pNew->Reset(); return GetToken(); } } else SetError(errNoName); - return sal_True; + return true; } // ----------------------------------------------------------------------------- -sal_Bool ScCompiler::HandleDbData() +bool ScCompiler::HandleDbData() { ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(pToken->GetIndex()); if ( !pDBData ) @@ -5490,11 +5490,11 @@ sal_Bool ScCompiler::HandleDbData() aRefData.CalcRelFromAbs( aPos ); ScTokenArray* pNew = new ScTokenArray(); pNew->AddDoubleReference( aRefData ); - PushTokenArray( pNew, sal_True ); + PushTokenArray( pNew, true ); pNew->Reset(); return GetToken(); } - return sal_True; + return true; } // ----------------------------------------------------------------------------- diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index b947f1d63ca5..baee145b70d8 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -125,7 +125,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken, nMemPoolDoubleRefToken, nMemPoolDoub // --- helpers -------------------------------------------------------------- -inline sal_Bool lcl_IsReference( OpCode eOp, StackVar eType ) +inline bool lcl_IsReference( OpCode eOp, StackVar eType ) { return (eOp == ocPush && (eType == svSingleRef || eType == svDoubleRef)) @@ -523,11 +523,11 @@ bool ScToken::Is3DRef() const { case svDoubleRef : if ( GetSingleRef2().IsFlag3D() ) - return sal_True; + return true; //! fallthru case svSingleRef : if ( GetSingleRef().IsFlag3D() ) - return sal_True; + return true; break; default: { @@ -1275,9 +1275,9 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a } return bError; } -sal_Bool ScTokenArray::ImplGetReference( ScRange& rRange, sal_Bool bValidOnly ) const +bool ScTokenArray::ImplGetReference( ScRange& rRange, bool bValidOnly ) const { - sal_Bool bIs = false; + bool bIs = false; if ( pCode && nLen == 1 ) { const FormulaToken* pToken = pCode[0]; @@ -1303,14 +1303,14 @@ sal_Bool ScTokenArray::ImplGetReference( ScRange& rRange, sal_Bool bValidOnly ) return bIs; } -sal_Bool ScTokenArray::IsReference( ScRange& rRange ) const +bool ScTokenArray::IsReference( ScRange& rRange ) const { return ImplGetReference( rRange, false ); } -sal_Bool ScTokenArray::IsValidReference( ScRange& rRange ) const +bool ScTokenArray::IsValidReference( ScRange& rRange ) const { - return ImplGetReference( rRange, sal_True ); + return ImplGetReference( rRange, true ); } //////////////////////////////////////////////////////////////////////////// @@ -1655,7 +1655,7 @@ FormulaToken* ScTokenArray::AddColRowName( const ScSingleRefData& rRef ) return Add( new ScSingleRefToken( rRef, ocColRowName ) ); } -sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, +bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, const ScAddress& rPos, ScDirection eDir ) { SCCOL nCol = 0; @@ -1698,7 +1698,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, sal_uInt8 nParamCount = t->GetByte(); if ( nParamCount && nRPN > nParamCount ) { - sal_Bool bRet = false; + bool bRet = false; sal_uInt16 nParam = nRPN - nParamCount - 1; for ( ; nParam < nRPN-1; nParam++ ) { @@ -1716,7 +1716,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, && rRef.nRow > nExtend ) { nExtend = rRef.nRow; - bRet = sal_True; + bRet = true; } break; case DIR_RIGHT : @@ -1725,7 +1725,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, > nExtend ) { nExtend = rRef.nCol; - bRet = sal_True; + bRet = true; } break; case DIR_TOP : @@ -1733,7 +1733,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, && rRef.nRow < nExtend ) { nExtend = rRef.nRow; - bRet = sal_True; + bRet = true; } break; case DIR_LEFT : @@ -1742,7 +1742,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, < nExtend ) { nExtend = rRef.nCol; - bRet = sal_True; + bRet = true; } break; } @@ -1759,7 +1759,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, && rRef.Ref2.nRow > nExtend ) { nExtend = rRef.Ref2.nRow; - bRet = sal_True; + bRet = true; } break; case DIR_RIGHT : @@ -1768,7 +1768,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, > nExtend ) { nExtend = rRef.Ref2.nCol; - bRet = sal_True; + bRet = true; } break; case DIR_TOP : @@ -1776,7 +1776,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, && rRef.Ref1.nRow < nExtend ) { nExtend = rRef.Ref1.nRow; - bRet = sal_True; + bRet = true; } break; case DIR_LEFT : @@ -1785,7 +1785,7 @@ sal_Bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, < nExtend ) { nExtend = rRef.Ref1.nCol; - bRet = sal_True; + bRet = true; } break; } |