summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSören Möller <soerenmoeller2001@gmail.com>2012-08-18 01:01:08 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-08-18 18:37:28 +0000
commitc1b73536343ae0a7b6dd940b1c8a01784c4d7a30 (patch)
treec6b39d72359be1a568eb502d7020eb9aff2afb81
parenta20f32d8e225ac0452a56b38029890e5068fd827 (diff)
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 <kohei.yoshida@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r--sc/source/core/inc/interpre.hxx3
-rw-r--r--sc/source/core/tool/interpr1.cxx10
-rw-r--r--unotools/inc/unotools/textsearch.hxx13
3 files changed, 20 insertions, 6 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index d36f965c00b7..3affc4e2b479 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 489a53bd2d28..2fa0bb27aa06 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 b070c988b5ee..be34f6f1af53 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; }