sc/source/core/inc/interpre.hxx | 3 ++- sc/source/core/tool/interpr1.cxx | 10 +++++----- unotools/inc/unotools/textsearch.hxx | 13 +++++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-)
New commits: commit c1b73536343ae0a7b6dd940b1c8a01784c4d7a30 Author: Sören Möller <[email protected]> Date: Sat Aug 18 01:01:08 2012 +0200 Partial replaced String with OUString in ScInterpreter Added wrapper using OUString instead of String to textsearch Change-Id: I866a109d60085da67ffa2fed3131c4e60b074bbf Reviewed-on: https://gerrit.libreoffice.org/425 Reviewed-by: Kohei Yoshida <[email protected]> Tested-by: Norbert Thiebaud <[email protected]> diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index d36f965..3affc4e 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -31,6 +31,7 @@ #include <math.h> #include <rtl/math.hxx> +#include <rtl/ustring.hxx> #include "formula/errorcodes.hxx" #include "cell.hxx" #include "scdll.hxx" @@ -107,7 +108,7 @@ public: /// If pDoc!=NULL the document options are taken into account and if /// RegularExpressions are disabled the function returns false regardless /// of the string content. - static bool MayBeRegExp( const String& rStr, const ScDocument* pDoc ); + static bool MayBeRegExp( const OUString& rStr, const ScDocument* pDoc ); /// Fail safe division, returning an errDivisionByZero coded into a double /// if denominator is 0.0 diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 489a53b..2fa0bb2 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7856,7 +7856,7 @@ void ScInterpreter::ScSearch() else fAnz = 1.0; String sStr = GetString(); - String SearchStr = GetString(); + OUString SearchStr = GetString(); xub_StrLen nPos = (xub_StrLen) fAnz - 1; xub_StrLen nEndPos = sStr.Len(); if( nPos >= nEndPos ) @@ -8148,15 +8148,15 @@ void ScInterpreter::ScErrorType() } -bool ScInterpreter::MayBeRegExp( const String& rStr, const ScDocument* pDoc ) +bool ScInterpreter::MayBeRegExp( const OUString& rStr, const ScDocument* pDoc ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MayBeRegExp" ); if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() ) return false; - if ( !rStr.Len() || (rStr.Len() == 1 && rStr.GetChar(0) != '.') ) - return false; // einzelnes Metazeichen kann keine RegExp sein + if ( rStr.isEmpty() || (rStr.getLength() == 1 && rStr[0] != '.') ) + return false; // single meta characters can not be a regexp static const sal_Unicode cre[] = { '.','*','+','?','[',']','^','$','\\','<','>','(',')','|', 0 }; - const sal_Unicode* p1 = rStr.GetBuffer(); + const sal_Unicode* p1 = rStr.getStr(); sal_Unicode c1; while ( ( c1 = *p1++ ) != 0 ) { diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx index b070c98..be34f6f 100644 --- a/unotools/inc/unotools/textsearch.hxx +++ b/unotools/inc/unotools/textsearch.hxx @@ -21,6 +21,7 @@ #ifndef _UNOTOOLS_TEXTSEARCH_HXX #define _UNOTOOLS_TEXTSEARCH_HXX #include <i18npool/lang.h> +#include <rtl/ustring.hxx> #include <tools/string.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/lang/Locale.hpp> @@ -75,6 +76,18 @@ public: sal_Bool bCaseSens = sal_True, sal_Bool bWrdOnly = sal_False, sal_Bool bSrchInSel = sal_False ); + + // Wrapper to use OUString as parameter + SearchParam( const OUString &rText, + SearchType eSrchType = SearchParam::SRCH_NORMAL, + sal_Bool bCaseSens = sal_True, + sal_Bool bWrdOnly = sal_False, + sal_Bool bSrchInSel = sal_False ) + { + String rText2(rText); + SearchParam( rText2, eSrchType, bCaseSens, bWrdOnly, bSrchInSel ); + } + SearchParam( const SearchParam& ); const String& GetSrchStr() const { return sSrchStr; }
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
