1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <sal/log.hxx>
23 #include <svl/srchitem.hxx>
24 #include <sal/macros.h>
25 #include <osl/diagnose.h>
27 #include <comphelper/propertyvalue.hxx>
28 #include <unotools/searchopt.hxx>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/lang/Locale.hpp>
31 #include <svl/memberid.h>
32 #include <i18nlangtag/languagetag.hxx>
34 #include <unordered_set>
37 using namespace com::sun::star
;
38 using namespace com::sun::star::beans
;
39 using namespace com::sun::star::uno
;
40 using namespace com::sun::star::util
;
42 constexpr OUString CFG_ROOT_NODE
= u
"Office.Common/SearchOptions"_ustr
;
44 #define SRCH_PARAMS 13
45 constexpr OUString SRCH_PARA_OPTIONS
= u
"Options"_ustr
;
46 constexpr OUString SRCH_PARA_FAMILY
= u
"Family"_ustr
;
47 constexpr OUString SRCH_PARA_COMMAND
= u
"Command"_ustr
;
48 constexpr OUString SRCH_PARA_CELLTYPE
= u
"CellType"_ustr
;
49 constexpr OUString SRCH_PARA_APPFLAG
= u
"AppFlag"_ustr
;
50 constexpr OUString SRCH_PARA_ROWDIR
= u
"RowDirection"_ustr
;
51 constexpr OUString SRCH_PARA_ALLTABLES
= u
"AllTables"_ustr
;
52 constexpr OUString SRCH_PARA_SEARCHFILTERED
= u
"SearchFiltered"_ustr
;
53 constexpr OUString SRCH_PARA_SEARCHFORMATTED
= u
"SearchFormatted"_ustr
;
54 constexpr OUString SRCH_PARA_BACKWARD
= u
"Backward"_ustr
;
55 constexpr OUString SRCH_PARA_PATTERN
= u
"Pattern"_ustr
;
56 constexpr OUString SRCH_PARA_CONTENT
= u
"Content"_ustr
;
57 constexpr OUString SRCH_PARA_ASIANOPT
= u
"AsianOptions"_ustr
;
59 SfxPoolItem
* SvxSearchItem::CreateDefault() { return new SvxSearchItem(0);}
62 static Sequence
< OUString
> lcl_GetNotifyNames()
64 // names of transliteration relevant properties
67 u
"IsMatchCase"_ustr
, // 0
68 u
"Japanese/IsMatchFullHalfWidthForms"_ustr
, // 1
69 u
"Japanese/IsMatchHiraganaKatakana"_ustr
, // 2
70 u
"Japanese/IsMatchContractions"_ustr
, // 3
71 u
"Japanese/IsMatchMinusDashCho-on"_ustr
, // 4
72 u
"Japanese/IsMatchRepeatCharMarks"_ustr
, // 5
73 u
"Japanese/IsMatchVariantFormKanji"_ustr
, // 6
74 u
"Japanese/IsMatchOldKanaForms"_ustr
, // 7
75 u
"Japanese/IsMatch_DiZi_DuZu"_ustr
, // 8
76 u
"Japanese/IsMatch_BaVa_HaFa"_ustr
, // 9
77 u
"Japanese/IsMatch_TsiThiChi_DhiZi"_ustr
, // 10
78 u
"Japanese/IsMatch_HyuIyu_ByuVyu"_ustr
, // 11
79 u
"Japanese/IsMatch_SeShe_ZeJe"_ustr
, // 12
80 u
"Japanese/IsMatch_IaIya"_ustr
, // 13
81 u
"Japanese/IsMatch_KiKu"_ustr
, // 14
82 u
"Japanese/IsIgnorePunctuation"_ustr
, // 15
83 u
"Japanese/IsIgnoreWhitespace"_ustr
, // 16
84 u
"Japanese/IsIgnoreProlongedSoundMark"_ustr
, // 17
85 u
"Japanese/IsIgnoreMiddleDot"_ustr
, // 18
86 u
"IsIgnoreDiacritics_CTL"_ustr
, // 19
87 u
"IsIgnoreKashida_CTL"_ustr
// 20
92 SvxSearchItem::SvxSearchItem( const sal_uInt16 nId
) :
94 SfxPoolItem( nId
, SfxItemType::SvxSearchItemType
),
95 ConfigItem( CFG_ROOT_NODE
),
97 m_aSearchOpt ( SearchFlags::LEV_RELAXED
,
102 TransliterationFlags::IGNORE_CASE
,
103 SearchAlgorithms2::ABSOLUTE
, '\\' ),
104 m_eFamily ( SfxStyleFamily::Para
),
105 m_nCommand ( SvxSearchCmd::FIND
),
106 m_nCellType ( SvxSearchCellType::FORMULA
),
107 m_nAppFlag ( SvxSearchApp::WRITER
),
108 m_bRowDirection ( true ),
109 m_bAllTables ( false ),
110 m_bSearchFiltered ( false ),
111 m_bSearchFormatted( false ),
113 m_bBackward ( false ),
114 m_bPattern ( false ),
115 m_bContent ( false ),
116 m_bAsianOptions ( false ),
120 EnableNotification( lcl_GetNotifyNames() );
122 SvtSearchOptions aOpt
;
124 m_bBackward
= aOpt
.IsBackwards();
125 m_bAsianOptions
= aOpt
.IsUseAsianOptions();
126 m_bNotes
= aOpt
.IsNotes();
128 if (aOpt
.IsUseWildcard())
130 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::WILDCARD
;
132 if (aOpt
.IsUseRegularExpression())
134 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::REGEXP
;
136 if (aOpt
.IsSimilaritySearch())
138 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::APPROXIMATE
;
140 if (aOpt
.IsWholeWordsOnly())
141 m_aSearchOpt
.searchFlag
|= SearchFlags::NORM_WORD_ONLY
;
143 TransliterationFlags
& rFlags
= m_aSearchOpt
.transliterateFlags
;
145 if (!aOpt
.IsMatchCase())
146 rFlags
|= TransliterationFlags::IGNORE_CASE
;
147 if ( aOpt
.IsMatchFullHalfWidthForms())
148 rFlags
|= TransliterationFlags::IGNORE_WIDTH
;
149 if ( aOpt
.IsIgnoreDiacritics_CTL())
150 rFlags
|= TransliterationFlags::IGNORE_DIACRITICS_CTL
;
151 if ( aOpt
.IsIgnoreKashida_CTL())
152 rFlags
|= TransliterationFlags::IGNORE_KASHIDA_CTL
;
153 if ( !m_bAsianOptions
)
156 if ( aOpt
.IsMatchHiraganaKatakana())
157 rFlags
|= TransliterationFlags::IGNORE_KANA
;
158 if ( aOpt
.IsMatchContractions())
159 rFlags
|= TransliterationFlags::ignoreSize_ja_JP
;
160 if ( aOpt
.IsMatchMinusDashChoon())
161 rFlags
|= TransliterationFlags::ignoreMinusSign_ja_JP
;
162 if ( aOpt
.IsMatchRepeatCharMarks())
163 rFlags
|= TransliterationFlags::ignoreIterationMark_ja_JP
;
164 if ( aOpt
.IsMatchVariantFormKanji())
165 rFlags
|= TransliterationFlags::ignoreTraditionalKanji_ja_JP
;
166 if ( aOpt
.IsMatchOldKanaForms())
167 rFlags
|= TransliterationFlags::ignoreTraditionalKana_ja_JP
;
168 if ( aOpt
.IsMatchDiziDuzu())
169 rFlags
|= TransliterationFlags::ignoreZiZu_ja_JP
;
170 if ( aOpt
.IsMatchBavaHafa())
171 rFlags
|= TransliterationFlags::ignoreBaFa_ja_JP
;
172 if ( aOpt
.IsMatchTsithichiDhizi())
173 rFlags
|= TransliterationFlags::ignoreTiJi_ja_JP
;
174 if ( aOpt
.IsMatchHyuiyuByuvyu())
175 rFlags
|= TransliterationFlags::ignoreHyuByu_ja_JP
;
176 if ( aOpt
.IsMatchSesheZeje())
177 rFlags
|= TransliterationFlags::ignoreSeZe_ja_JP
;
178 if ( aOpt
.IsMatchIaiya())
179 rFlags
|= TransliterationFlags::ignoreIandEfollowedByYa_ja_JP
;
180 if ( aOpt
.IsMatchKiku())
181 rFlags
|= TransliterationFlags::ignoreKiKuFollowedBySa_ja_JP
;
182 if ( aOpt
.IsIgnorePunctuation())
183 rFlags
|= TransliterationFlags::ignoreSeparator_ja_JP
;
184 if ( aOpt
.IsIgnoreWhitespace())
185 rFlags
|= TransliterationFlags::ignoreSpace_ja_JP
;
186 if ( aOpt
.IsIgnoreProlongedSoundMark())
187 rFlags
|= TransliterationFlags::ignoreProlongedSoundMark_ja_JP
;
188 if ( aOpt
.IsIgnoreMiddleDot())
189 rFlags
|= TransliterationFlags::ignoreMiddleDot_ja_JP
;
193 SvxSearchItem::SvxSearchItem( const SvxSearchItem
& rItem
) :
195 SfxPoolItem ( rItem
),
196 ConfigItem( CFG_ROOT_NODE
),
198 m_aSearchOpt ( rItem
.m_aSearchOpt
),
199 m_eFamily ( rItem
.m_eFamily
),
200 m_nCommand ( rItem
.m_nCommand
),
201 m_nCellType ( rItem
.m_nCellType
),
202 m_nAppFlag ( rItem
.m_nAppFlag
),
203 m_bRowDirection ( rItem
.m_bRowDirection
),
204 m_bAllTables ( rItem
.m_bAllTables
),
205 m_bSearchFiltered ( rItem
.m_bSearchFiltered
),
206 m_bSearchFormatted ( rItem
.m_bSearchFormatted
),
207 m_bNotes ( rItem
.m_bNotes
),
208 m_bBackward ( rItem
.m_bBackward
),
209 m_bPattern ( rItem
.m_bPattern
),
210 m_bContent ( rItem
.m_bContent
),
211 m_bAsianOptions ( rItem
.m_bAsianOptions
),
212 m_nStartPointX(rItem
.m_nStartPointX
),
213 m_nStartPointY(rItem
.m_nStartPointY
)
215 EnableNotification( lcl_GetNotifyNames() );
218 SvxSearchItem::~SvxSearchItem()
222 SvxSearchItem
* SvxSearchItem::Clone( SfxItemPool
*) const
224 return new SvxSearchItem(*this);
228 static bool equalsWithoutLocaleOrReplace(const i18nutil::SearchOptions2
& rItem1
,
229 const i18nutil::SearchOptions2
& rItem2
)
231 return rItem1
.searchFlag
== rItem2
.searchFlag
&&
232 rItem1
.searchString
== rItem2
.searchString
&&
233 //rItem1.replaceString == rItem2.replaceString &&
234 //rItem1.Locale == rItem2.Locale &&
235 rItem1
.changedChars
== rItem2
.changedChars
&&
236 rItem1
.deletedChars
== rItem2
.deletedChars
&&
237 rItem1
.insertedChars
== rItem2
.insertedChars
&&
238 rItem1
.transliterateFlags
== rItem2
.transliterateFlags
&&
239 rItem1
.AlgorithmType2
== rItem2
.AlgorithmType2
&&
240 rItem1
.WildcardEscapeCharacter
== rItem2
.WildcardEscapeCharacter
;
244 bool SvxSearchItem::operator==( const SfxPoolItem
& rItem
) const
246 assert(SfxPoolItem::operator==(rItem
));
247 const SvxSearchItem
&rSItem
= static_cast<const SvxSearchItem
&>(rItem
);
248 return equalsIgnoring(rSItem
, /*bIgnoreReplace=*/false, /*bIgnoreCommand=*/false);
251 bool SvxSearchItem::equalsIgnoring(const SvxSearchItem
& rSItem
, bool bIgnoreReplace
,
252 bool bIgnoreCommand
) const
254 if (!bIgnoreReplace
&& m_aSearchOpt
.replaceString
!= rSItem
.m_aSearchOpt
.replaceString
)
256 if (!bIgnoreCommand
&& m_nCommand
!= rSItem
.m_nCommand
)
259 return ( m_bBackward
== rSItem
.m_bBackward
) &&
260 ( m_bPattern
== rSItem
.m_bPattern
) &&
261 ( m_bContent
== rSItem
.m_bContent
) &&
262 ( m_eFamily
== rSItem
.m_eFamily
) &&
263 ( m_bRowDirection
== rSItem
.m_bRowDirection
) &&
264 ( m_bAllTables
== rSItem
.m_bAllTables
) &&
265 ( m_bSearchFiltered
== rSItem
.m_bSearchFiltered
) &&
266 ( m_bSearchFormatted
== rSItem
.m_bSearchFormatted
) &&
267 ( m_nCellType
== rSItem
.m_nCellType
) &&
268 ( m_nAppFlag
== rSItem
.m_nAppFlag
) &&
269 ( m_bAsianOptions
== rSItem
.m_bAsianOptions
) &&
270 ( equalsWithoutLocaleOrReplace(m_aSearchOpt
, rSItem
.m_aSearchOpt
)) &&
271 ( m_bNotes
== rSItem
.m_bNotes
);
275 bool SvxSearchItem::GetPresentation
277 SfxItemPresentation
,
287 void SvxSearchItem::Notify( const Sequence
< OUString
> & )
289 // applies transliteration changes in the configuration database
290 // to the current SvxSearchItem
291 SetTransliterationFlags( SvtSearchOptions().GetTransliterationFlags() );
294 void SvxSearchItem::ImplCommit()
298 void SvxSearchItem::SetMatchFullHalfWidthForms( bool bVal
)
301 m_aSearchOpt
.transliterateFlags
|= TransliterationFlags::IGNORE_WIDTH
;
303 m_aSearchOpt
.transliterateFlags
&= ~TransliterationFlags::IGNORE_WIDTH
;
307 void SvxSearchItem::SetWordOnly( bool bVal
)
310 m_aSearchOpt
.searchFlag
|= SearchFlags::NORM_WORD_ONLY
;
312 m_aSearchOpt
.searchFlag
&= ~SearchFlags::NORM_WORD_ONLY
;
316 void SvxSearchItem::SetExact( bool bVal
)
319 m_aSearchOpt
.transliterateFlags
|= TransliterationFlags::IGNORE_CASE
;
321 m_aSearchOpt
.transliterateFlags
&= ~TransliterationFlags::IGNORE_CASE
;
325 void SvxSearchItem::SetSelection( bool bVal
)
329 m_aSearchOpt
.searchFlag
|= (SearchFlags::REG_NOT_BEGINOFLINE
|
330 SearchFlags::REG_NOT_ENDOFLINE
);
334 m_aSearchOpt
.searchFlag
&= ~(SearchFlags::REG_NOT_BEGINOFLINE
|
335 SearchFlags::REG_NOT_ENDOFLINE
);
340 void SvxSearchItem::SetRegExp( bool bVal
)
344 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::REGEXP
;
346 else if ( SearchAlgorithms2::REGEXP
== m_aSearchOpt
.AlgorithmType2
)
348 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::ABSOLUTE
;
353 void SvxSearchItem::SetWildcard( bool bVal
)
357 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::WILDCARD
;
359 else if ( SearchAlgorithms2::WILDCARD
== m_aSearchOpt
.AlgorithmType2
)
361 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::ABSOLUTE
;
366 void SvxSearchItem::SetLEVRelaxed( bool bVal
)
369 m_aSearchOpt
.searchFlag
|= SearchFlags::LEV_RELAXED
;
371 m_aSearchOpt
.searchFlag
&= ~SearchFlags::LEV_RELAXED
;
375 void SvxSearchItem::SetLevenshtein( bool bVal
)
379 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::APPROXIMATE
;
381 else if ( SearchAlgorithms2::APPROXIMATE
== m_aSearchOpt
.AlgorithmType2
)
383 m_aSearchOpt
.AlgorithmType2
= SearchAlgorithms2::ABSOLUTE
;
388 void SvxSearchItem::SetTransliterationFlags( TransliterationFlags nFlags
)
390 m_aSearchOpt
.transliterateFlags
= nFlags
;
393 bool SvxSearchItem::QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
) const
395 nMemberId
&= ~CONVERT_TWIPS
;
400 Sequence
<PropertyValue
> aSeq
{
401 comphelper::makePropertyValue(SRCH_PARA_OPTIONS
,
402 m_aSearchOpt
.toUnoSearchOptions2()),
403 comphelper::makePropertyValue(SRCH_PARA_FAMILY
, sal_Int16(m_eFamily
)),
404 comphelper::makePropertyValue(SRCH_PARA_COMMAND
,
405 static_cast<sal_uInt16
>(m_nCommand
)),
406 comphelper::makePropertyValue(SRCH_PARA_CELLTYPE
,
407 static_cast<sal_uInt16
>(m_nCellType
)),
408 comphelper::makePropertyValue(SRCH_PARA_APPFLAG
,
409 static_cast<sal_uInt16
>(m_nAppFlag
)),
410 comphelper::makePropertyValue(SRCH_PARA_ROWDIR
, m_bRowDirection
),
411 comphelper::makePropertyValue(SRCH_PARA_ALLTABLES
, m_bAllTables
),
412 comphelper::makePropertyValue(SRCH_PARA_SEARCHFILTERED
, m_bSearchFiltered
),
413 comphelper::makePropertyValue(SRCH_PARA_SEARCHFORMATTED
, m_bSearchFormatted
),
414 comphelper::makePropertyValue(SRCH_PARA_BACKWARD
, m_bBackward
),
415 comphelper::makePropertyValue(SRCH_PARA_PATTERN
, m_bPattern
),
416 comphelper::makePropertyValue(SRCH_PARA_CONTENT
, m_bContent
),
417 comphelper::makePropertyValue(SRCH_PARA_ASIANOPT
, m_bAsianOptions
)
419 assert(aSeq
.getLength() == SRCH_PARAMS
);
423 case MID_SEARCH_COMMAND
:
424 rVal
<<= static_cast<sal_Int16
>(m_nCommand
); break;
425 case MID_SEARCH_STYLEFAMILY
:
426 rVal
<<= static_cast<sal_Int16
>(m_eFamily
); break;
427 case MID_SEARCH_CELLTYPE
:
428 rVal
<<= static_cast<sal_Int32
>(m_nCellType
); break;
429 case MID_SEARCH_ROWDIRECTION
:
430 rVal
<<= m_bRowDirection
; break;
431 case MID_SEARCH_ALLTABLES
:
432 rVal
<<= m_bAllTables
; break;
433 case MID_SEARCH_SEARCHFILTERED
:
434 rVal
<<= m_bSearchFiltered
; break;
435 case MID_SEARCH_SEARCHFORMATTED
:
436 rVal
<<= m_bSearchFormatted
; break;
437 case MID_SEARCH_BACKWARD
:
438 rVal
<<= m_bBackward
; break;
439 case MID_SEARCH_PATTERN
:
440 rVal
<<= m_bPattern
; break;
441 case MID_SEARCH_CONTENT
:
442 rVal
<<= m_bContent
; break;
443 case MID_SEARCH_ASIANOPTIONS
:
444 rVal
<<= m_bAsianOptions
; break;
445 case MID_SEARCH_ALGORITHMTYPE
:
446 rVal
<<= static_cast<sal_Int16
>(i18nutil::downgradeSearchAlgorithms2(m_aSearchOpt
.AlgorithmType2
)); break;
447 case MID_SEARCH_ALGORITHMTYPE2
:
448 rVal
<<= m_aSearchOpt
.AlgorithmType2
; break;
449 case MID_SEARCH_FLAGS
:
450 rVal
<<= m_aSearchOpt
.searchFlag
; break;
451 case MID_SEARCH_SEARCHSTRING
:
452 rVal
<<= m_aSearchOpt
.searchString
; break;
453 case MID_SEARCH_REPLACESTRING
:
454 rVal
<<= m_aSearchOpt
.replaceString
; break;
455 case MID_SEARCH_CHANGEDCHARS
:
456 rVal
<<= m_aSearchOpt
.changedChars
; break;
457 case MID_SEARCH_DELETEDCHARS
:
458 rVal
<<= m_aSearchOpt
.deletedChars
; break;
459 case MID_SEARCH_INSERTEDCHARS
:
460 rVal
<<= m_aSearchOpt
.insertedChars
; break;
461 case MID_SEARCH_TRANSLITERATEFLAGS
:
462 rVal
<<= static_cast<sal_Int32
>(m_aSearchOpt
.transliterateFlags
); break;
463 case MID_SEARCH_LOCALE
:
465 LanguageType nLocale
;
466 if (!m_aSearchOpt
.Locale
.Language
.isEmpty() || !m_aSearchOpt
.Locale
.Country
.isEmpty() )
467 nLocale
= LanguageTag::convertToLanguageType( m_aSearchOpt
.Locale
);
469 nLocale
= LANGUAGE_NONE
;
470 rVal
<<= static_cast<sal_Int16
>(static_cast<sal_uInt16
>(nLocale
));
475 SAL_WARN( "svl.items", "SvxSearchItem::QueryValue(): Unknown MemberId" );
483 bool SvxSearchItem::PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
)
485 nMemberId
&= ~CONVERT_TWIPS
;
486 auto ExtractNumericAny
= [](const css::uno::Any
& a
, auto& target
)
491 target
= static_cast<std::remove_reference_t
<decltype(target
)>>(nInt
);
498 Sequence
< PropertyValue
> aSeq
;
499 if (!(rVal
>>= aSeq
) || aSeq
.getLength() != SRCH_PARAMS
)
501 std::unordered_set
<OUString
> aConvertedParams
;
502 for (const auto& rProp
: aSeq
)
504 if (rProp
.Name
== SRCH_PARA_OPTIONS
)
506 if (css::util::SearchOptions2 nTmpSearchOpt2
; rProp
.Value
>>= nTmpSearchOpt2
)
508 m_aSearchOpt
= nTmpSearchOpt2
;
509 aConvertedParams
.insert(rProp
.Name
);
512 else if (rProp
.Name
== SRCH_PARA_FAMILY
)
514 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_STYLEFAMILY
))
515 aConvertedParams
.insert(rProp
.Name
);
517 else if (rProp
.Name
== SRCH_PARA_COMMAND
)
519 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_COMMAND
))
520 aConvertedParams
.insert(rProp
.Name
);
522 else if (rProp
.Name
== SRCH_PARA_CELLTYPE
)
524 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_CELLTYPE
))
525 aConvertedParams
.insert(rProp
.Name
);
527 else if (rProp
.Name
== SRCH_PARA_APPFLAG
)
529 if (ExtractNumericAny(rProp
.Value
, m_nAppFlag
))
530 aConvertedParams
.insert(rProp
.Name
);
532 else if (rProp
.Name
== SRCH_PARA_ROWDIR
)
534 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_ROWDIRECTION
))
535 aConvertedParams
.insert(rProp
.Name
);
537 else if (rProp
.Name
== SRCH_PARA_ALLTABLES
)
539 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_ALLTABLES
))
540 aConvertedParams
.insert(rProp
.Name
);
542 else if (rProp
.Name
== SRCH_PARA_SEARCHFILTERED
)
544 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_SEARCHFILTERED
))
545 aConvertedParams
.insert(rProp
.Name
);
547 else if (rProp
.Name
== SRCH_PARA_SEARCHFORMATTED
)
549 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_SEARCHFORMATTED
))
550 aConvertedParams
.insert(rProp
.Name
);
552 else if (rProp
.Name
== SRCH_PARA_BACKWARD
)
554 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_BACKWARD
))
555 aConvertedParams
.insert(rProp
.Name
);
557 else if (rProp
.Name
== SRCH_PARA_PATTERN
)
559 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_PATTERN
))
560 aConvertedParams
.insert(rProp
.Name
);
562 else if (rProp
.Name
== SRCH_PARA_CONTENT
)
564 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_CONTENT
))
565 aConvertedParams
.insert(rProp
.Name
);
567 else if (rProp
.Name
== SRCH_PARA_ASIANOPT
)
569 if (SvxSearchItem::PutValue(rProp
.Value
, MID_SEARCH_ASIANOPTIONS
))
570 aConvertedParams
.insert(rProp
.Name
);
573 return aConvertedParams
.size() == SRCH_PARAMS
;
575 case MID_SEARCH_COMMAND
:
576 return ExtractNumericAny(rVal
, m_nCommand
);
577 case MID_SEARCH_STYLEFAMILY
:
578 return ExtractNumericAny(rVal
, m_eFamily
);
579 case MID_SEARCH_CELLTYPE
:
580 return ExtractNumericAny(rVal
, m_nCellType
);
581 case MID_SEARCH_ROWDIRECTION
:
582 return (rVal
>>= m_bRowDirection
);
583 case MID_SEARCH_ALLTABLES
:
584 return (rVal
>>= m_bAllTables
);
585 case MID_SEARCH_SEARCHFILTERED
:
586 return (rVal
>>= m_bSearchFiltered
);
587 case MID_SEARCH_SEARCHFORMATTED
:
588 return (rVal
>>= m_bSearchFormatted
);
589 case MID_SEARCH_BACKWARD
:
590 return (rVal
>>= m_bBackward
);
591 case MID_SEARCH_PATTERN
:
592 return (rVal
>>= m_bPattern
);
593 case MID_SEARCH_CONTENT
:
594 return (rVal
>>= m_bContent
);
595 case MID_SEARCH_ASIANOPTIONS
:
596 return (rVal
>>= m_bAsianOptions
);
597 case MID_SEARCH_ALGORITHMTYPE
:
598 if (SearchAlgorithms eVal
; ExtractNumericAny(rVal
, eVal
))
600 m_aSearchOpt
.AlgorithmType2
= i18nutil::upgradeSearchAlgorithms(eVal
);
604 case MID_SEARCH_ALGORITHMTYPE2
:
605 return (rVal
>>= m_aSearchOpt
.AlgorithmType2
);
606 case MID_SEARCH_FLAGS
:
607 return (rVal
>>= m_aSearchOpt
.searchFlag
);
608 case MID_SEARCH_SEARCHSTRING
:
609 return (rVal
>>= m_aSearchOpt
.searchString
);
610 case MID_SEARCH_REPLACESTRING
:
611 return (rVal
>>= m_aSearchOpt
.replaceString
);
612 case MID_SEARCH_CHANGEDCHARS
:
613 return (rVal
>>= m_aSearchOpt
.changedChars
);
614 case MID_SEARCH_DELETEDCHARS
:
615 return (rVal
>>= m_aSearchOpt
.deletedChars
);
616 case MID_SEARCH_INSERTEDCHARS
:
617 return (rVal
>>= m_aSearchOpt
.insertedChars
);
618 case MID_SEARCH_TRANSLITERATEFLAGS
:
619 return ExtractNumericAny(rVal
, m_aSearchOpt
.transliterateFlags
);
620 case MID_SEARCH_LOCALE
:
621 if (LanguageType aVal
; ExtractNumericAny(rVal
, aVal
))
623 m_aSearchOpt
.Locale
= (aVal
== LANGUAGE_NONE
) ? css::lang::Locale()
624 : LanguageTag::convertToLocale(aVal
);
628 case MID_SEARCH_STARTPOINTX
:
629 return (rVal
>>= m_nStartPointX
);
630 case MID_SEARCH_STARTPOINTY
:
631 return (rVal
>>= m_nStartPointY
);
633 OSL_FAIL( "Unknown MemberId" );
639 sal_Int32
SvxSearchItem::GetStartPointX() const
641 return m_nStartPointX
;
644 sal_Int32
SvxSearchItem::GetStartPointY() const
646 return m_nStartPointY
;
649 bool SvxSearchItem::HasStartPoint() const
651 return m_nStartPointX
> 0 || m_nStartPointY
> 0;
654 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */