summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorSören Möller <soerenmoeller2001@gmail.com>2012-07-09 21:48:26 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-07-11 23:54:33 +0200
commitc5653e812eb9729581e24c5e7822441b00b6d059 (patch)
treee2ccfd3167298072e398a5786e750c3eace2c402 /unotools
parentefd131357462aa16848f308fdb788e3e41f90e6b (diff)
Replaced deprecated tools/String with OUString in sc/../chgviset
Added new TextSearch::SearchForward mirroring TextSearch::SearchFrwrd using OUString and sal_Int32 to make it possible to replace all uses of tools/String Change-Id: I260d8d3a23d634eab37f28a5ceaf61ace5040540
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/textsearch.hxx3
-rw-r--r--unotools/source/i18n/textsearch.cxx33
2 files changed, 36 insertions, 0 deletions
diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx
index 58e49aa824d2..1f955bc3e83c 100644
--- a/unotools/inc/unotools/textsearch.hxx
+++ b/unotools/inc/unotools/textsearch.hxx
@@ -159,6 +159,9 @@ public:
int SearchFrwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 );
+ sal_Bool SearchForward( const ::rtl::OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ ::com::sun::star::util::SearchResult* pRes = 0 );
int SearchBkwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 70cd7aecba00..b78a45f63956 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -247,6 +247,39 @@ int TextSearch::SearchFrwrd( const String & rStr, xub_StrLen* pStart,
return nRet;
}
+sal_Bool TextSearch::SearchForward( const ::rtl::OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ ::com::sun::star::util::SearchResult* pRes)
+{
+ sal_Bool nRet = sal_False;
+ try
+ {
+ if( xTextSearch.is() )
+ {
+ SearchResult aRet( xTextSearch->searchForward(
+ rStr, *pStart, *pEnd ));
+ if( aRet.subRegExpressions > 0 )
+ {
+ nRet = sal_True;
+ // the XTextsearch returns in startOffset the higher position
+ // and the endposition is allways exclusive.
+ // The caller of this function will have in startPos the
+ // lower pos. and end
+ *pStart = aRet.startOffset[ 0 ];
+ *pEnd = aRet.endOffset[ 0 ];
+ if( pRes )
+ *pRes = aRet;
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "unotools.i18n", "SearchForward: Exception caught!" );
+ }
+ return nRet;
+}
+
+
int TextSearch::SearchBkwrd( const String & rStr, xub_StrLen* pStart,
xub_StrLen* pEnde, SearchResult* pRes )
{