diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-08-16 17:42:03 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-17 13:06:03 +0000 |
commit | 2145d6e8b3c5bead1db97e33f60f5ae0e34add38 (patch) | |
tree | ab9df33679d74eb63202d86d66c340548ae5946e | |
parent | 4cf1c9058610b10a8081b10342653ae08a9181a3 (diff) |
sal_Bool to bool and early bail out
Change-Id: I2cac3cdd24a1e9ad322724e0819aa43cad63855e
Reviewed-on: https://gerrit.libreoffice.org/5458
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | include/svx/ctredlin.hxx | 6 | ||||
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 48 |
2 files changed, 19 insertions, 35 deletions
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index c7b7b7128d33..6b3685dc7c90 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -133,9 +133,9 @@ public: void SetCalcView(sal_Bool bFlag=sal_True); // no NULL-pointer checking { - sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment); - sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime); - sal_Bool IsValidComment(const String* pComment); + bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment); + bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime); + bool IsValidComment(const String* pComment); // } SvTreeListEntry* InsertEntry(const OUString& ,RedlinData *pUserData, diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 62e3f7db53ca..c7fc3337e90b 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -302,48 +302,32 @@ void SvxRedlinTable::SetCommentParams( const utl::SearchParam* pSearchPara ) } } -sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr, +bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr, const DateTime *pDateTime,const String* pCommentStr) { return IsValidEntry(pAuthorStr, pDateTime) && IsValidComment(pCommentStr); } -sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,const DateTime *pDateTime) +bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,const DateTime *pDateTime) { - sal_Bool nTheFlag=sal_True; - if(bAuthor) - { - if(aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL) - nTheFlag=sal_True; - else - nTheFlag=sal_False; - } - if(bDate && nTheFlag) - { - if(nDaTiMode!=FLT_DATE_NOTEQUAL) - { - nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast); - } - else - { - nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast)); - } - } - return nTheFlag; + if (bAuthor && !aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL) + return false; + + if (!bDate) + return true; + + const bool bRes = pDateTime->IsBetween(aDaTiFilterFirst, aDaTiFilterLast); + return nDaTiMode!=FLT_DATE_NOTEQUAL ? bRes : !bRes; } -sal_Bool SvxRedlinTable::IsValidComment(const String* pCommentStr) +bool SvxRedlinTable::IsValidComment(const String* pCommentStr) { - bool nTheFlag=true; + if (!bComment) + return true; - if(bComment) - { - sal_Int32 nStartPos = 0; - sal_Int32 nEndPos = pCommentStr->Len(); - - nTheFlag=pCommentSearcher->SearchForward( *pCommentStr, &nStartPos, &nEndPos); - } - return nTheFlag; + sal_Int32 nStartPos = 0; + sal_Int32 nEndPos = pCommentStr->Len(); + return pCommentSearcher->SearchForward( *pCommentStr, &nStartPos, &nEndPos); } SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,RedlinData *pUserData, |