1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XTextSearch.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_lang_XTextSearch_idl__
32 #define __com_sun_star_lang_XTextSearch_idl__
35 #include
<com
/sun
/star
/lang
/Locale.idl
>
36 #include
<com
/sun
/star
/uno
/XInterface.idl
>
37 //#include <com/sun/star/lang/CascadeTransliterator.idl>
39 //=============================================================================
41 module com
{ module sun
{ module star
{ module util
{
43 //=============================================================================
46 published
enum SearchAlgorithms
{
47 ABSOLUTE
, // "normal" a kind of Boyer-Moore
48 REGEXP
, // regular expression
49 APPROXIMATE
// Leveinstein distance
52 published constants SearchFlags
54 //Flag for all search methods
57 @deprecated : the constant ALL_IGNORE_CASE is never supported -
58 it must use the transliteration flags of
60 <p>@see TransliterationModulesNew
62 const long ALL_IGNORE_CASE
= 0x00000001;
64 /// Flag for normal (Boyer-Moore) search
65 const long NORM_WORD_ONLY
= 0x00000010;
67 /// Flag for "regular expression" search / interpret as extended regular expression
68 const long REG_EXTENDED
= 0x00000100;
69 /** Flag for "regular expression" search / No replace, i.e., avoid sub regular
70 expresions, return true/false to match
72 <!-- JRH: Check this for sense of the expression. -->
74 const long REG_NOSUB
= 0x00000200;
76 /// Flag for "regular expression" search / Special new line treatment
77 const long REG_NEWLINE
= 0x00000400;
79 /** A NEWLINE character in string will not be matched by a period outside bracket
80 expression or by any form of a non matching list.
81 A circumflex (^) in pattern when used to specify expression anchoring
82 <!-- JRH: anhoring to anchoring. -->
83 will match the zero length string immediately after a newline in string,
84 regardless of the setting of REG_NOTBOL
85 A dollar-sign ($) in pattern when used to specify expression anchoring,
86 will match zero-length string immediately before a new line in string,
87 regardless of the setting of REG_NOTEOL
89 const long REG_NOT_BEGINOFLINE
= 0x00000800;
91 /** The first character in the string is not the beginning of the line therefore ^ will not
92 match with first character of the string
94 const long REG_NOT_ENDOFLINE
= 0x00001000;
97 /// Flags for "Weight Levenshtein-Distance" search
98 const long LEV_RELAXED
= 0x00010000;
102 published
struct SearchOptions
{
103 //-------------------------------------------------------------------------
104 /// search type, can be: ABSOLUTE, REGEXP, APPROXIMATE
105 SearchAlgorithms algorithmType
;
107 /** some flags - can be mixed
117 (is for optional replacing - SearchOption is only the data container for it)*/
118 string replaceString
;
120 /// this is the language for case insensitive search
121 ::com
::sun
::star
::lang
::Locale Locale
;
123 /** this many characters can be different between the found and search word
124 in a "Weight Levenshtein-Distance"*/
127 /** this many characters can be missed in the found word
128 in a "Weight Levenshtein-Distance"*/
131 /// this many characters can be additional in the found word in a "Weight Levenshtein-Distance"
134 /** asian flags for the transliteration. Same meaning as the enum of TransliteratorModule
136 @see com/sun/star/i18n/XTransliteration.idl
138 long transliterateFlags
;
142 published
struct SearchResult
{
143 //-------------------------------------------------------------------------
144 /** Number of subexpressions,
145 if it is 0, then no match found; this value is 1 for ABSOLUTE and APPROXIMATE match.
146 The start and endOffset are always dependent on the search direction.
148 if you search "X" in the text "-X-" the offset are:
149 for forward: start = 1, end = 2
150 for backward: start = 2, end = 1
151 Forward, the startOffset is inclusive, the endOffset exclusive.
152 Backward, the startOffset is exclusive, the endOffset inclusive.
154 For regular expressions it can be greater than 1.
155 If the value is 1, startoffset[0] and endoffset[0] points to the matching sub string
156 if value is > 1, still startoffset[0] and endoffset[0] points to the matching substring for whole regular expression
157 startoffset[i] and endoffset[i] points to the matching substring of i th matching substring.
159 long subRegExpressions
;
160 sequence
<long> startOffset
; // inclusive
161 sequence
<long> endOffset
; // exclusive
166 /** enables an object to search in its content.
168 published
interface XTextSearch
: com
::sun
::star
::uno
::XInterface
170 //-------------------------------------------------------------------------
171 /** set the options for the forward or backward search.
174 void setOptions
([in] SearchOptions options
);
175 //-------------------------------------------------------------------------
176 /** search forward in the searchStr, starts at startPos and ends by endpos.
177 The result is returned in the SearchResult.
180 SearchResult searchForward
([in] string searchStr
, [in] long startPos
, [in] long endPos
);
181 //-------------------------------------------------------------------------
182 /** search backward in the searchStr, starts at startPos and ends by endpos.
183 The endpos must be lower then the startpos, because the function searches backward!
184 The result is returned in the SearchResult.
187 SearchResult searchBackward
([in] string searchStr
, [in] long startPos
, [in] long endPos
);
190 //=============================================================================