summaryrefslogtreecommitdiff
path: root/include/unotools
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-02-05 16:56:54 +0100
committerEike Rathke <erack@redhat.com>2016-02-05 17:02:47 +0100
commit599f0cbe1ddc1d54828489b389b78fdffa4ce39f (patch)
tree25173fd65460b33ef43910514559c203987a6c42 /include/unotools
parent4c4976f717b3ddce68a872dffc2079ae49c41616 (diff)
interface to new XTextSearch2 with SearchOptions2, tdf#72196
Places that had utl::TextSearch::UpgradeToSearchOptions2() introduced are worth an inspection if the new SearchAlgorithms2::WILDCARD search should be supported or at least use SearchOptions2 instead of SearchOptions to eliminate the small performance penalty that conversion involves. Change-Id: I565f73af2b551ae9ad0f488e672823dc6c5c1109
Diffstat (limited to 'include/unotools')
-rw-r--r--include/unotools/textsearch.hxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx
index 20c9e65d261c..7ddfbf0ed4e8 100644
--- a/include/unotools/textsearch.hxx
+++ b/include/unotools/textsearch.hxx
@@ -25,8 +25,8 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/util/XTextSearch.hpp>
-#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/XTextSearch2.hpp>
+#include <com/sun/star/util/SearchOptions2.hpp>
class CharClass;
@@ -47,7 +47,7 @@ namespace utl
class UNOTOOLS_DLLPUBLIC SearchParam
{
public:
- enum SearchType{ SRCH_NORMAL, SRCH_REGEXP, SRCH_LEVDIST };
+ enum SearchType{ SRCH_NORMAL, SRCH_REGEXP, SRCH_LEVDIST, SRCH_WILDCARD };
private:
OUString sSrchStr; // the search string
@@ -100,15 +100,16 @@ public:
// - ordinary text (Bayer/Moore)
// - regular expressions
// - weighted Levenshtein distance
+// - wildcards '*' and '?'
// This class allows forward and backward searching!
class UNOTOOLS_DLLPUBLIC TextSearch
{
- static css::uno::Reference< css::util::XTextSearch >
- getXTextSearch( const css::util::SearchOptions& rPara );
+ static css::uno::Reference< css::util::XTextSearch2 >
+ getXTextSearch( const css::util::SearchOptions2& rPara );
- css::uno::Reference < css::util::XTextSearch >
+ css::uno::Reference < css::util::XTextSearch2 >
xTextSearch;
void Init( const SearchParam & rParam,
@@ -120,7 +121,7 @@ public:
TextSearch( const SearchParam & rPara, LanguageType nLanguage );
TextSearch( const SearchParam & rPara, const CharClass& rCClass );
- TextSearch( const css::util::SearchOptions& rPara );
+ TextSearch( const css::util::SearchOptions2& rPara );
~TextSearch();
/* search in the (selected) text the search string:
@@ -149,12 +150,18 @@ public:
sal_Int32* pStart, sal_Int32* pEnd,
css::util::SearchResult* pRes = nullptr );
- void SetLocale( const css::util::SearchOptions& rOpt,
+ void SetLocale( const css::util::SearchOptions2& rOpt,
const css::lang::Locale& rLocale );
/* replace back references in the replace string by the sub expressions from the search result */
void ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const css::util::SearchResult& rResult );
+ /** Upgrade SearchOptions to SearchOptions2 for places that don't handle
+ SearchOptions2 yet. Better fix your module if you want to support
+ wildcard search.
+ */
+ static css::util::SearchOptions2 UpgradeToSearchOptions2( const css::util::SearchOptions& rOptions );
+
};
} // namespace utl