diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-03-01 23:27:23 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-03-02 20:18:01 +0100 |
commit | 7cfccf98c18f5402b9e4a0e1e01937a36837e19d (patch) | |
tree | d21d2891e5a2398e0ccd37b26ff599123e7272f6 /editeng | |
parent | Use EditSelection::HasRange (diff) | |
download | core-7cfccf98c18f5402b9e4a0e1e01937a36837e19d.tar.gz core-7cfccf98c18f5402b9e4a0e1e01937a36837e19d.zip |
sal_Bool to bool, with some optimizations
Change-Id: Ia1c73cf97e93a999147ce82ebb18767743adf2fc
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 35 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 15 |
2 files changed, 17 insertions, 33 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index ebbd68d3735d..c5a49189c17e 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1174,26 +1174,16 @@ void EditPaM::SetNode(ContentNode* p) pNode = p; } -sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc ) +bool EditPaM::DbgIsBuggy( EditDoc& rDoc ) { - if ( !pNode ) - return sal_True; - if ( rDoc.GetPos( pNode ) >= rDoc.Count() ) - return sal_True; - if ( nIndex > pNode->Len() ) - return sal_True; - - return sal_False; + return !pNode || + rDoc.GetPos( pNode ) >= rDoc.Count() || + nIndex > pNode->Len(); } -sal_Bool EditSelection::DbgIsBuggy( EditDoc& rDoc ) +bool EditSelection::DbgIsBuggy( EditDoc& rDoc ) { - if ( aStartPaM.DbgIsBuggy( rDoc ) ) - return sal_True; - if ( aEndPaM.DbgIsBuggy( rDoc ) ) - return sal_True; - - return sal_False; + return aStartPaM.DbgIsBuggy( rDoc ) || aEndPaM.DbgIsBuggy( rDoc ); } EditSelection::EditSelection() @@ -1265,15 +1255,10 @@ sal_Bool EditSelection::Adjust( const EditDoc& rNodes ) return bSwap; } -sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 ) +bool operator == ( const EditPaM& r1, const EditPaM& r2 ) { - if ( r1.GetNode() != r2.GetNode() ) - return sal_False; - - if ( r1.GetIndex() != r2.GetIndex() ) - return sal_False; - - return sal_True; + return ( r1.GetNode() == r2.GetNode() ) && + ( r1.GetIndex() == r2.GetIndex() ); } EditPaM& EditPaM::operator = ( const EditPaM& rPaM ) @@ -1283,7 +1268,7 @@ EditPaM& EditPaM::operator = ( const EditPaM& rPaM ) return *this; } -sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 ) +bool operator != ( const EditPaM& r1, const EditPaM& r2 ) { return !( r1 == r2 ); } diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 1d793f0427e9..fb490ada3a52 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -327,11 +327,11 @@ public: sal_Int32 GetIndex() const { return nIndex; } void SetIndex( sal_Int32 n ) { nIndex = n; } - sal_Bool DbgIsBuggy( EditDoc& rDoc ); + bool DbgIsBuggy( EditDoc& rDoc ); EditPaM& operator = ( const EditPaM& rPaM ); - friend sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 ); - friend sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 ); + friend bool operator == ( const EditPaM& r1, const EditPaM& r2 ); + friend bool operator != ( const EditPaM& r1, const EditPaM& r2 ); }; #define PORTIONKIND_TEXT 0 @@ -712,15 +712,14 @@ public: sal_Bool HasRange() const { return aStartPaM != aEndPaM; } sal_Bool IsInvalid() const; - sal_Bool DbgIsBuggy( EditDoc& rDoc ); + bool DbgIsBuggy( EditDoc& rDoc ); sal_Bool Adjust( const EditDoc& rNodes ); EditSelection& operator = ( const EditPaM& r ); - sal_Bool operator == ( const EditSelection& r ) const - { return ( ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ) ) - ? sal_True : sal_False; } - sal_Bool operator != ( const EditSelection& r ) const { return !( r == *this ); } + bool operator == ( const EditSelection& r ) const + { return ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ); } + bool operator != ( const EditSelection& r ) const { return !( r == *this ); } }; |