diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-14 21:21:23 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-14 21:28:09 +0100 |
commit | 8b28c064fa7863b365cbb7fc920bc3ac3067dd27 (patch) | |
tree | 21340b6aefa72a2de48bc5f1c0aa52ba72b636e2 | |
parent | 0c9d002ecdd410b8b5be1fc91f4b84c7cbe5f5bc (diff) |
bool improvements
Change-Id: I27609462f2daba6b2289aff7a6a96686c961f3ce
-rw-r--r-- | sc/inc/address.hxx | 14 | ||||
-rw-r--r-- | sc/inc/bigrange.hxx | 8 | ||||
-rw-r--r-- | sc/inc/conditio.hxx | 4 | ||||
-rw-r--r-- | sc/inc/detdata.hxx | 2 | ||||
-rw-r--r-- | sc/inc/viewopti.hxx | 4 | ||||
-rw-r--r-- | sc/inc/zforauto.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/viewopti.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/inputhdl.hxx | 4 |
13 files changed, 33 insertions, 32 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index f764e083e626..7e9724580e61 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -627,8 +627,8 @@ public: inline ScRangePair& operator= ( const ScRangePair& r ); const ScRange& GetRange( sal_uInt16 n ) const { return aRange[n]; } ScRange& GetRange( sal_uInt16 n ) { return aRange[n]; } - inline int operator==( const ScRangePair& ) const; - inline int operator!=( const ScRangePair& ) const; + inline bool operator==( const ScRangePair& ) const; + inline bool operator!=( const ScRangePair& ) const; }; inline ScRangePair& ScRangePair::operator= ( const ScRangePair& r ) @@ -638,12 +638,12 @@ inline ScRangePair& ScRangePair::operator= ( const ScRangePair& r ) return *this; } -inline int ScRangePair::operator==( const ScRangePair& r ) const +inline bool ScRangePair::operator==( const ScRangePair& r ) const { return ( (aRange[0] == r.aRange[0]) && (aRange[1] == r.aRange[1]) ); } -inline int ScRangePair::operator!=( const ScRangePair& r ) const +inline bool ScRangePair::operator!=( const ScRangePair& r ) const { return !operator==( r ); } @@ -693,8 +693,8 @@ public: inline SCROW Row() const { return aAdr.Row(); } inline SCTAB Tab() const { return aAdr.Tab(); } - inline int operator == ( const ScRefAddress& r ) const; - inline int operator != ( const ScRefAddress& r ) const + inline bool operator == ( const ScRefAddress& r ) const; + inline bool operator != ( const ScRefAddress& r ) const { return !(operator==(r)); } OUString GetRefString( ScDocument* pDoc, SCTAB nActTab, @@ -728,7 +728,7 @@ inline void ScRefAddress::Set( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, bRelTab = bNewRelTab; } -inline int ScRefAddress::operator==( const ScRefAddress& r ) const +inline bool ScRefAddress::operator==( const ScRefAddress& r ) const { return aAdr == r.aAdr && bRelCol == r.bRelCol && bRelRow == r.bRelRow && bRelTab == r.bRelTab; diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx index 5abb2b09ec6b..8db2b3460f8b 100644 --- a/sc/inc/bigrange.hxx +++ b/sc/inc/bigrange.hxx @@ -66,9 +66,9 @@ public: { nCol = r.nCol; nRow = r.nRow; nTab = r.nTab; return *this; } ScBigAddress& operator=( const ScAddress& r ) { nCol = r.Col(); nRow = r.Row(); nTab = r.Tab(); return *this; } - int operator==( const ScBigAddress& r ) const + bool operator==( const ScBigAddress& r ) const { return nCol == r.nCol && nRow == r.nRow && nTab == r.nTab; } - int operator!=( const ScBigAddress& r ) const + bool operator!=( const ScBigAddress& r ) const { return !operator==( r ); } friend inline SvStream& operator<< ( SvStream& rStream, const ScBigAddress& rAdr ); @@ -191,9 +191,9 @@ public: ScBigRange& operator=( const ScBigRange& r ) { aStart = r.aStart; aEnd = r.aEnd; return *this; } - int operator==( const ScBigRange& r ) const + bool operator==( const ScBigRange& r ) const { return (aStart == r.aStart) && (aEnd == r.aEnd); } - int operator!=( const ScBigRange& r ) const + bool operator!=( const ScBigRange& r ) const { return !operator==( r ); } friend inline SvStream& operator<< ( SvStream& rStream, const ScBigRange& rRange ); diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 5de482741db2..b90bb9bbdecb 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -202,7 +202,7 @@ public: ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r ); virtual ~ScConditionEntry(); - int operator== ( const ScConditionEntry& r ) const; + bool operator== ( const ScConditionEntry& r ) const; virtual void SetParent( ScConditionalFormat* pNew ) { pCondFormat = pNew; } @@ -308,7 +308,7 @@ public: ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r ); virtual ~ScCondFormatEntry(); - int operator== ( const ScCondFormatEntry& r ) const; + bool operator== ( const ScCondFormatEntry& r ) const; const OUString& GetStyle() const { return aStyleName; } void UpdateStyleName(const OUString& rNew) { aStyleName=rNew; } diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx index f71becd0524e..8f975c95742e 100644 --- a/sc/inc/detdata.hxx +++ b/sc/inc/detdata.hxx @@ -50,7 +50,7 @@ public: // for UpdateRef: void SetPos(const ScAddress& rNew) { aPos=rNew; } - int operator== ( const ScDetOpData& r ) const + bool operator== ( const ScDetOpData& r ) const { return eOperation == r.eOperation && aPos == r.aPos; } }; diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx index 0c7cfd656ac0..0277a1e86d04 100644 --- a/sc/inc/viewopti.hxx +++ b/sc/inc/viewopti.hxx @@ -99,8 +99,8 @@ public: SvxGridItem* CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const; const ScViewOptions& operator= ( const ScViewOptions& rCpy ); - int operator== ( const ScViewOptions& rOpt ) const; - int operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } + bool operator== ( const ScViewOptions& rOpt ) const; + bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } private: bool aOptArr [MAX_OPT]; diff --git a/sc/inc/zforauto.hxx b/sc/inc/zforauto.hxx index dfadff3e6443..3e927970dcac 100644 --- a/sc/inc/zforauto.hxx +++ b/sc/inc/zforauto.hxx @@ -41,7 +41,7 @@ public: void Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const; // saving of the numberformats void PutFormatIndex(sal_uLong nFormat, SvNumberFormatter& rFormatter); sal_uLong GetFormatIndex( SvNumberFormatter& rFormatter); - inline int operator==(const ScNumFormatAbbrev& rNumFormat) const + inline bool operator==(const ScNumFormatAbbrev& rNumFormat) const { return ((sFormatstring == rNumFormat.sFormatstring) && (eLnge == rNumFormat.eLnge) diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 1a9f8698f760..3d2b0c75878f 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -592,7 +592,7 @@ static bool lcl_IsEqual( const ScTokenArray* pArr1, const ScTokenArray* pArr2 ) return !pArr1 && !pArr2; // beide 0 -> gleich } -int ScConditionEntry::operator== ( const ScConditionEntry& r ) const +bool ScConditionEntry::operator== ( const ScConditionEntry& r ) const { bool bEq = (eOp == r.eOp && nOptions == r.nOptions && lcl_IsEqual( pFormula1, r.pFormula1 ) && @@ -1085,12 +1085,12 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const { OUString aStr = OUString::number(nVal1); OUString aStr2 = OUString::number(nArg); - bValid = aStr2.endsWith(aStr) == 0; + bValid = !aStr2.endsWith(aStr); } else { OUString aStr2 = OUString::number(nArg); - bValid = aStr2.endsWith(aStrVal1) == 0; + bValid = !aStr2.endsWith(aStrVal1); } break; case SC_COND_CONTAINS_TEXT: @@ -1576,7 +1576,7 @@ ScCondFormatEntry::ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatE { } -int ScCondFormatEntry::operator== ( const ScCondFormatEntry& r ) const +bool ScCondFormatEntry::operator== ( const ScCondFormatEntry& r ) const { return ScConditionEntry::operator==( r ) && aStyleName == r.aStyleName; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 721f2681c67d..4837e3cf5959 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -115,8 +115,7 @@ lcl_checkRangeDimensions( const bool bSameTabs(lcl_checkRangeDimension(rPos, rRef1, rRef2, lcl_GetTab)); // Test if exactly two dimensions are equal - if (!(bSameCols ^ bSameRows ^ bSameTabs) - && (bSameCols || bSameRows || bSameTabs)) + if (int(bSameCols) + int(bSameRows) + int(bSameTabs) == 2) { bCol = !bSameCols; bRow = !bSameRows; @@ -2676,7 +2675,8 @@ bool ScFormulaCell::UpdateReferenceOnMove( bValChanged = false; - if ( ( bCompile = (bCompile || bValChanged || bRefModified || bColRowNameCompile) ) != 0 ) + bCompile = (bCompile || bValChanged || bRefModified || bColRowNameCompile); + if ( bCompile ) { CompileTokenArray( bNewListening ); // no Listening bNeedDirty = true; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index bda4a5a1d932..ff43877e1b1d 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1991,8 +1991,9 @@ bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) bool ScRange::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) { - // single & to process both - return aStart.Move( dx, dy, dz, pDoc ) & aEnd.Move( dx, dy, dz, pDoc ); + bool b = aStart.Move( dx, dy, dz, pDoc ); + b &= aEnd.Move( dx, dy, dz, pDoc ); + return b; } OUString ScAddress::GetColRowString( bool bAbsolute, diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index eb5d076e62f9..dce896588b3f 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2055,7 +2055,7 @@ void ScInterpreter::ScGammaDist( int nMinParamCount ) sal_uInt8 nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) ) return; - double bCumulative; + bool bCumulative; if (nParamCount == 4) bCumulative = GetBool(); else diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index 18ecb3488646..0e105c3b16d2 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -159,9 +159,9 @@ const ScViewOptions& ScViewOptions::operator=( const ScViewOptions& rCpy ) return *this; } -int ScViewOptions::operator==( const ScViewOptions& rOpt ) const +bool ScViewOptions::operator==( const ScViewOptions& rOpt ) const { - sal_Bool bEqual = sal_True; + bool bEqual = true; sal_uInt16 i; for ( i=0; i<MAX_OPT && bEqual; i++ ) bEqual = (aOptArr [i] == rOpt.aOptArr[i]); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d0e030ce5786..e175839bccba 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3948,7 +3948,7 @@ ScInputHdlState::~ScInputHdlState() //------------------------------------------------------------------------ -int ScInputHdlState::operator==( const ScInputHdlState& r ) const +bool ScInputHdlState::operator==( const ScInputHdlState& r ) const { return ( (aStartPos == r.aStartPos) && (aEndPos == r.aEndPos) diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index d3fc3b9f151f..bc7afcae014b 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -276,8 +276,8 @@ public: ~ScInputHdlState(); ScInputHdlState& operator= ( const ScInputHdlState& r ); - int operator==( const ScInputHdlState& r ) const; - int operator!=( const ScInputHdlState& r ) const + bool operator==( const ScInputHdlState& r ) const; + bool operator!=( const ScInputHdlState& r ) const { return !operator==( r ); } const ScAddress& GetPos() const { return aCursorPos; } |