Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <svl/srchitem.hxx>
21 : #include <sal/macros.h>
22 :
23 : #include <unotools/searchopt.hxx>
24 : #include <com/sun/star/util/XReplaceable.hpp>
25 : #include <com/sun/star/util/XSearchable.hpp>
26 : #include <com/sun/star/util/XSearchDescriptor.hpp>
27 : #include <com/sun/star/util/XPropertyReplace.hpp>
28 : #include <com/sun/star/util/XReplaceDescriptor.hpp>
29 : #include <com/sun/star/lang/Locale.hpp>
30 : #include <svl/memberid.hrc>
31 : #include <i18nlangtag/languagetag.hxx>
32 : #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
33 :
34 : using namespace utl;
35 : using namespace com::sun::star::beans;
36 : using namespace com::sun::star::i18n;
37 : using namespace com::sun::star::lang;
38 : using namespace com::sun::star::uno;
39 : using namespace com::sun::star::util;
40 :
41 : #define CFG_ROOT_NODE "Office.Common/SearchOptions"
42 :
43 : #define SRCH_PARAMS 12
44 : #define SRCH_PARA_OPTIONS "Options"
45 : #define SRCH_PARA_FAMILY "Family"
46 : #define SRCH_PARA_COMMAND "Command"
47 : #define SRCH_PARA_CELLTYPE "CellType"
48 : #define SRCH_PARA_APPFLAG "AppFlag"
49 : #define SRCH_PARA_ROWDIR "RowDirection"
50 : #define SRCH_PARA_ALLTABLES "AllTables"
51 : #define SRCH_PARA_SEARCHFILTERED "SearchFiltered"
52 : #define SRCH_PARA_BACKWARD "Backward"
53 : #define SRCH_PARA_PATTERN "Pattern"
54 : #define SRCH_PARA_CONTENT "Content"
55 : #define SRCH_PARA_ASIANOPT "AsianOptions"
56 :
57 : // STATIC DATA -----------------------------------------------------------
58 :
59 0 : TYPEINIT1_FACTORY(SvxSearchItem, SfxPoolItem, new SvxSearchItem(0));
60 :
61 :
62 :
63 0 : static Sequence< OUString > lcl_GetNotifyNames()
64 : {
65 : // names of transliteration relevant properties
66 : static const char* aTranslitNames[] =
67 : {
68 : "IsMatchCase", // 0
69 : "Japanese/IsMatchFullHalfWidthForms", // 1
70 : "Japanese/IsMatchHiraganaKatakana", // 2
71 : "Japanese/IsMatchContractions", // 3
72 : "Japanese/IsMatchMinusDashCho-on", // 4
73 : "Japanese/IsMatchRepeatCharMarks", // 5
74 : "Japanese/IsMatchVariantFormKanji", // 6
75 : "Japanese/IsMatchOldKanaForms", // 7
76 : "Japanese/IsMatch_DiZi_DuZu", // 8
77 : "Japanese/IsMatch_BaVa_HaFa", // 9
78 : "Japanese/IsMatch_TsiThiChi_DhiZi", // 10
79 : "Japanese/IsMatch_HyuIyu_ByuVyu", // 11
80 : "Japanese/IsMatch_SeShe_ZeJe", // 12
81 : "Japanese/IsMatch_IaIya", // 13
82 : "Japanese/IsMatch_KiKu", // 14
83 : "Japanese/IsIgnorePunctuation", // 15
84 : "Japanese/IsIgnoreWhitespace", // 16
85 : "Japanese/IsIgnoreProlongedSoundMark", // 17
86 : "Japanese/IsIgnoreMiddleDot", // 18
87 : "IsIgnoreDiacritics_CTL", // 19
88 : "IsIgnoreKashida_CTL" // 20
89 : };
90 :
91 0 : const int nCount = SAL_N_ELEMENTS( aTranslitNames );
92 0 : Sequence< OUString > aNames( nCount );
93 0 : OUString* pNames = aNames.getArray();
94 0 : for (sal_Int32 i = 0; i < nCount; ++i)
95 0 : pNames[i] = OUString::createFromAscii( aTranslitNames[i] );
96 :
97 0 : return aNames;
98 : }
99 :
100 :
101 0 : SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
102 :
103 : SfxPoolItem( nId ),
104 : ConfigItem( OUString(CFG_ROOT_NODE ) ),
105 :
106 : aSearchOpt ( SearchAlgorithms_ABSOLUTE,
107 : SearchFlags::LEV_RELAXED,
108 : OUString(),
109 : OUString(),
110 : Locale(),
111 : 2, 2, 2,
112 : TransliterationModules_IGNORE_CASE ),
113 : eFamily ( SFX_STYLE_FAMILY_PARA ),
114 : nCommand ( 0 ),
115 : nCellType ( SVX_SEARCHIN_FORMULA ),
116 : nAppFlag ( SVX_SEARCHAPP_WRITER ),
117 : bRowDirection ( true ),
118 : bAllTables ( false ),
119 : bSearchFiltered ( false ),
120 : bNotes ( false),
121 : bBackward ( false ),
122 : bPattern ( false ),
123 : bContent ( false ),
124 0 : bAsianOptions ( false )
125 : {
126 0 : EnableNotification( lcl_GetNotifyNames() );
127 :
128 0 : SvtSearchOptions aOpt;
129 :
130 0 : bBackward = aOpt.IsBackwards();
131 0 : bAsianOptions = aOpt.IsUseAsianOptions();
132 0 : bNotes = aOpt.IsNotes();
133 :
134 0 : if (aOpt.IsUseRegularExpression())
135 0 : aSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
136 0 : if (aOpt.IsSimilaritySearch())
137 0 : aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
138 0 : if (aOpt.IsWholeWordsOnly())
139 0 : aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
140 :
141 0 : sal_Int32 &rFlags = aSearchOpt.transliterateFlags;
142 :
143 0 : if (!aOpt.IsMatchCase())
144 0 : rFlags |= TransliterationModules_IGNORE_CASE;
145 0 : if ( aOpt.IsMatchFullHalfWidthForms())
146 0 : rFlags |= TransliterationModules_IGNORE_WIDTH;
147 0 : if ( aOpt.IsIgnoreDiacritics_CTL())
148 0 : rFlags |= TransliterationModulesExtra::IGNORE_DIACRITICS_CTL ;
149 0 : if ( aOpt.IsIgnoreKashida_CTL())
150 0 : rFlags |= TransliterationModulesExtra::IGNORE_KASHIDA_CTL ;
151 0 : if ( bAsianOptions )
152 : {
153 0 : if ( aOpt.IsMatchHiraganaKatakana())
154 0 : rFlags |= TransliterationModules_IGNORE_KANA;
155 0 : if ( aOpt.IsMatchContractions())
156 0 : rFlags |= TransliterationModules_ignoreSize_ja_JP;
157 0 : if ( aOpt.IsMatchMinusDashChoon())
158 0 : rFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
159 0 : if ( aOpt.IsMatchRepeatCharMarks())
160 0 : rFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
161 0 : if ( aOpt.IsMatchVariantFormKanji())
162 0 : rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
163 0 : if ( aOpt.IsMatchOldKanaForms())
164 0 : rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
165 0 : if ( aOpt.IsMatchDiziDuzu())
166 0 : rFlags |= TransliterationModules_ignoreZiZu_ja_JP;
167 0 : if ( aOpt.IsMatchBavaHafa())
168 0 : rFlags |= TransliterationModules_ignoreBaFa_ja_JP;
169 0 : if ( aOpt.IsMatchTsithichiDhizi())
170 0 : rFlags |= TransliterationModules_ignoreTiJi_ja_JP;
171 0 : if ( aOpt.IsMatchHyuiyuByuvyu())
172 0 : rFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
173 0 : if ( aOpt.IsMatchSesheZeje())
174 0 : rFlags |= TransliterationModules_ignoreSeZe_ja_JP;
175 0 : if ( aOpt.IsMatchIaiya())
176 0 : rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
177 0 : if ( aOpt.IsMatchKiku())
178 0 : rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
179 0 : if ( aOpt.IsIgnorePunctuation())
180 0 : rFlags |= TransliterationModules_ignoreSeparator_ja_JP;
181 0 : if ( aOpt.IsIgnoreWhitespace())
182 0 : rFlags |= TransliterationModules_ignoreSpace_ja_JP;
183 0 : if ( aOpt.IsIgnoreProlongedSoundMark())
184 0 : rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
185 0 : if ( aOpt.IsIgnoreMiddleDot())
186 0 : rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
187 0 : }
188 :
189 0 : }
190 :
191 :
192 :
193 0 : SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) :
194 :
195 : SfxPoolItem ( rItem ),
196 : ConfigItem( OUString(CFG_ROOT_NODE ) ),
197 :
198 : aSearchOpt ( rItem.aSearchOpt ),
199 : eFamily ( rItem.eFamily ),
200 : nCommand ( rItem.nCommand ),
201 : nCellType ( rItem.nCellType ),
202 : nAppFlag ( rItem.nAppFlag ),
203 : bRowDirection ( rItem.bRowDirection ),
204 : bAllTables ( rItem.bAllTables ),
205 : bSearchFiltered ( rItem.bSearchFiltered ),
206 : bNotes ( rItem.bNotes),
207 : bBackward ( rItem.bBackward ),
208 : bPattern ( rItem.bPattern ),
209 : bContent ( rItem.bContent ),
210 0 : bAsianOptions ( rItem.bAsianOptions )
211 : {
212 0 : EnableNotification( lcl_GetNotifyNames() );
213 0 : }
214 :
215 :
216 :
217 0 : SvxSearchItem::~SvxSearchItem()
218 : {
219 0 : }
220 :
221 :
222 0 : SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const
223 : {
224 0 : return new SvxSearchItem(*this);
225 : }
226 :
227 :
228 :
229 : //! used below
230 0 : static bool operator == ( const SearchOptions& rItem1, const SearchOptions& rItem2 )
231 : {
232 0 : return rItem1.algorithmType == rItem2.algorithmType &&
233 0 : rItem1.searchFlag == rItem2.searchFlag &&
234 0 : rItem1.searchString == rItem2.searchString &&
235 0 : rItem1.replaceString == rItem2.replaceString &&
236 : //rItem1.Locale == rItem2.Locale &&
237 0 : rItem1.changedChars == rItem2.changedChars &&
238 0 : rItem1.deletedChars == rItem2.deletedChars &&
239 0 : rItem1.insertedChars == rItem2.insertedChars &&
240 0 : rItem1.transliterateFlags == rItem2.transliterateFlags;
241 : }
242 :
243 :
244 0 : bool SvxSearchItem::operator==( const SfxPoolItem& rItem ) const
245 : {
246 : DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
247 0 : const SvxSearchItem &rSItem = (SvxSearchItem &) rItem;
248 0 : return ( nCommand == rSItem.nCommand ) &&
249 0 : ( bBackward == rSItem.bBackward ) &&
250 0 : ( bPattern == rSItem.bPattern ) &&
251 0 : ( bContent == rSItem.bContent ) &&
252 0 : ( eFamily == rSItem.eFamily ) &&
253 0 : ( bRowDirection == rSItem.bRowDirection ) &&
254 0 : ( bAllTables == rSItem.bAllTables ) &&
255 0 : ( bSearchFiltered == rSItem.bSearchFiltered ) &&
256 0 : ( nCellType == rSItem.nCellType ) &&
257 0 : ( nAppFlag == rSItem.nAppFlag ) &&
258 0 : ( bAsianOptions == rSItem.bAsianOptions ) &&
259 0 : ( aSearchOpt == rSItem.aSearchOpt ) &&
260 0 : ( bNotes == rSItem.bNotes );
261 : }
262 :
263 :
264 :
265 0 : SfxItemPresentation SvxSearchItem::GetPresentation
266 : (
267 : SfxItemPresentation ,
268 : SfxMapUnit ,
269 : SfxMapUnit ,
270 : OUString& ,
271 : const IntlWrapper *
272 : ) const
273 : {
274 0 : return SFX_ITEM_PRESENTATION_NONE;
275 : }
276 :
277 0 : void SvxSearchItem::Notify( const Sequence< OUString > & )
278 : {
279 : // applies transliteration changes in the configuration database
280 : // to the current SvxSearchItem
281 0 : SetTransliterationFlags( SvtSearchOptions().GetTransliterationFlags() );
282 0 : }
283 :
284 0 : void SvxSearchItem::Commit()
285 : {
286 0 : }
287 :
288 0 : void SvxSearchItem::SetMatchFullHalfWidthForms( bool bVal )
289 : {
290 0 : if (bVal)
291 0 : aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_WIDTH;
292 : else
293 0 : aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_WIDTH;
294 0 : }
295 :
296 :
297 0 : void SvxSearchItem::SetWordOnly( bool bVal )
298 : {
299 0 : if (bVal)
300 0 : aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
301 : else
302 0 : aSearchOpt.searchFlag &= ~SearchFlags::NORM_WORD_ONLY;
303 0 : }
304 :
305 :
306 0 : void SvxSearchItem::SetExact( bool bVal )
307 : {
308 0 : if (!bVal)
309 0 : aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_CASE;
310 : else
311 0 : aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_CASE;
312 0 : }
313 :
314 :
315 0 : void SvxSearchItem::SetSelection( bool bVal )
316 : {
317 0 : if (bVal)
318 : {
319 : aSearchOpt.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE |
320 0 : SearchFlags::REG_NOT_ENDOFLINE);
321 : }
322 : else
323 : {
324 : aSearchOpt.searchFlag &= ~(SearchFlags::REG_NOT_BEGINOFLINE |
325 0 : SearchFlags::REG_NOT_ENDOFLINE);
326 : }
327 0 : }
328 :
329 :
330 0 : void SvxSearchItem::SetRegExp( bool bVal )
331 : {
332 0 : if ( bVal )
333 0 : aSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
334 0 : else if ( SearchAlgorithms_REGEXP == aSearchOpt.algorithmType )
335 0 : aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
336 0 : }
337 :
338 :
339 0 : void SvxSearchItem::SetLEVRelaxed( bool bVal )
340 : {
341 0 : if (bVal)
342 0 : aSearchOpt.searchFlag |= SearchFlags::LEV_RELAXED;
343 : else
344 0 : aSearchOpt.searchFlag &= ~SearchFlags::LEV_RELAXED;
345 0 : }
346 :
347 :
348 0 : void SvxSearchItem::SetLevenshtein( bool bVal )
349 : {
350 0 : if ( bVal )
351 0 : aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
352 0 : else if ( SearchAlgorithms_APPROXIMATE == aSearchOpt.algorithmType )
353 0 : aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
354 0 : }
355 :
356 :
357 0 : void SvxSearchItem::SetTransliterationFlags( sal_Int32 nFlags )
358 : {
359 0 : aSearchOpt.transliterateFlags = nFlags;
360 0 : }
361 :
362 0 : bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
363 : {
364 0 : nMemberId &= ~CONVERT_TWIPS;
365 0 : switch ( nMemberId )
366 : {
367 : case 0 :
368 : {
369 0 : Sequence< PropertyValue > aSeq( SRCH_PARAMS );
370 0 : aSeq[0].Name = OUString( SRCH_PARA_OPTIONS );
371 0 : aSeq[0].Value <<= aSearchOpt;
372 0 : aSeq[1].Name = OUString( SRCH_PARA_FAMILY );
373 0 : aSeq[1].Value <<= sal_Int16( eFamily );
374 0 : aSeq[2].Name = OUString( SRCH_PARA_COMMAND );
375 0 : aSeq[2].Value <<= nCommand;
376 0 : aSeq[3].Name = OUString( SRCH_PARA_CELLTYPE );
377 0 : aSeq[3].Value <<= nCellType;
378 0 : aSeq[4].Name = OUString( SRCH_PARA_APPFLAG );
379 0 : aSeq[4].Value <<= nAppFlag;
380 0 : aSeq[5].Name = OUString( SRCH_PARA_ROWDIR );
381 0 : aSeq[5].Value <<= bRowDirection;
382 0 : aSeq[6].Name = OUString( SRCH_PARA_ALLTABLES );
383 0 : aSeq[6].Value <<= bAllTables;
384 0 : aSeq[6].Name = OUString( SRCH_PARA_SEARCHFILTERED );
385 0 : aSeq[6].Value <<= bSearchFiltered;
386 0 : aSeq[7].Name = OUString( SRCH_PARA_BACKWARD );
387 0 : aSeq[7].Value <<= bBackward;
388 0 : aSeq[8].Name = OUString( SRCH_PARA_PATTERN );
389 0 : aSeq[8].Value <<= bPattern;
390 0 : aSeq[9].Name = OUString( SRCH_PARA_CONTENT );
391 0 : aSeq[9].Value <<= bContent;
392 0 : aSeq[10].Name = OUString( SRCH_PARA_ASIANOPT );
393 0 : aSeq[10].Value <<= bAsianOptions;
394 0 : rVal <<= aSeq;
395 : }
396 0 : break;
397 : case MID_SEARCH_COMMAND:
398 0 : rVal <<= (sal_Int16) nCommand; break;
399 : case MID_SEARCH_STYLEFAMILY:
400 0 : rVal <<= (sal_Int16) eFamily; break;
401 : case MID_SEARCH_CELLTYPE:
402 0 : rVal <<= (sal_Int32) nCellType; break;
403 : case MID_SEARCH_ROWDIRECTION:
404 0 : rVal <<= bRowDirection; break;
405 : case MID_SEARCH_ALLTABLES:
406 0 : rVal <<= bAllTables; break;
407 : case MID_SEARCH_SEARCHFILTERED:
408 0 : rVal <<= bSearchFiltered; break;
409 : case MID_SEARCH_BACKWARD:
410 0 : rVal <<= bBackward; break;
411 : case MID_SEARCH_PATTERN:
412 0 : rVal <<= bPattern; break;
413 : case MID_SEARCH_CONTENT:
414 0 : rVal <<= bContent; break;
415 : case MID_SEARCH_ASIANOPTIONS:
416 0 : rVal <<= bAsianOptions; break;
417 : case MID_SEARCH_ALGORITHMTYPE:
418 0 : rVal <<= (sal_Int16) aSearchOpt.algorithmType; break;
419 : case MID_SEARCH_FLAGS:
420 0 : rVal <<= aSearchOpt.searchFlag; break;
421 : case MID_SEARCH_SEARCHSTRING:
422 0 : rVal <<= aSearchOpt.searchString; break;
423 : case MID_SEARCH_REPLACESTRING:
424 0 : rVal <<= aSearchOpt.replaceString; break;
425 : case MID_SEARCH_CHANGEDCHARS:
426 0 : rVal <<= aSearchOpt.changedChars; break;
427 : case MID_SEARCH_DELETEDCHARS:
428 0 : rVal <<= aSearchOpt.deletedChars; break;
429 : case MID_SEARCH_INSERTEDCHARS:
430 0 : rVal <<= aSearchOpt.insertedChars; break;
431 : case MID_SEARCH_TRANSLITERATEFLAGS:
432 0 : rVal <<= aSearchOpt.transliterateFlags; break;
433 : case MID_SEARCH_LOCALE:
434 : {
435 : sal_Int16 nLocale;
436 0 : if (!aSearchOpt.Locale.Language.isEmpty() || !aSearchOpt.Locale.Country.isEmpty() )
437 0 : nLocale = LanguageTag::convertToLanguageType( aSearchOpt.Locale );
438 : else
439 0 : nLocale = LANGUAGE_NONE;
440 0 : rVal <<= nLocale;
441 0 : break;
442 : }
443 :
444 : default:
445 : SAL_WARN( "svl.items", "SvxSearchItem::QueryValue(): Unknown MemberId" );
446 0 : return false;
447 : }
448 :
449 0 : return true;
450 : }
451 :
452 :
453 :
454 0 : bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
455 : {
456 0 : nMemberId &= ~CONVERT_TWIPS;
457 0 : bool bRet = false;
458 0 : sal_Int32 nInt = 0;
459 0 : switch ( nMemberId )
460 : {
461 : case 0 :
462 : {
463 0 : Sequence< PropertyValue > aSeq;
464 0 : if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) )
465 : {
466 0 : sal_Int16 nConvertedCount( 0 );
467 0 : for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i )
468 : {
469 0 : if ( aSeq[i].Name == SRCH_PARA_OPTIONS )
470 : {
471 0 : if ( aSeq[i].Value >>= aSearchOpt )
472 0 : ++nConvertedCount;
473 : }
474 0 : else if ( aSeq[i].Name == SRCH_PARA_FAMILY )
475 : {
476 0 : sal_uInt16 nTemp( 0 );
477 0 : if ( aSeq[i].Value >>= nTemp )
478 : {
479 0 : eFamily = SfxStyleFamily( nTemp );
480 0 : ++nConvertedCount;
481 : }
482 : }
483 0 : else if ( aSeq[i].Name == SRCH_PARA_COMMAND )
484 : {
485 0 : if ( aSeq[i].Value >>= nCommand )
486 0 : ++nConvertedCount;
487 : }
488 0 : else if ( aSeq[i].Name == SRCH_PARA_CELLTYPE )
489 : {
490 0 : if ( aSeq[i].Value >>= nCellType )
491 0 : ++nConvertedCount;
492 : }
493 0 : else if ( aSeq[i].Name == SRCH_PARA_APPFLAG )
494 : {
495 0 : if ( aSeq[i].Value >>= nAppFlag )
496 0 : ++nConvertedCount;
497 : }
498 0 : else if ( aSeq[i].Name == SRCH_PARA_ROWDIR )
499 : {
500 0 : if ( aSeq[i].Value >>= bRowDirection )
501 0 : ++nConvertedCount;
502 : }
503 0 : else if ( aSeq[i].Name == SRCH_PARA_ALLTABLES )
504 : {
505 0 : if ( aSeq[i].Value >>= bAllTables )
506 0 : ++nConvertedCount;
507 : }
508 0 : else if ( aSeq[i].Name == SRCH_PARA_SEARCHFILTERED )
509 : {
510 0 : if ( aSeq[i].Value >>= bSearchFiltered )
511 0 : ++nConvertedCount;
512 : }
513 0 : else if ( aSeq[i].Name == SRCH_PARA_BACKWARD )
514 : {
515 0 : if ( aSeq[i].Value >>= bBackward )
516 0 : ++nConvertedCount;
517 : }
518 0 : else if ( aSeq[i].Name == SRCH_PARA_PATTERN )
519 : {
520 0 : if ( aSeq[i].Value >>= bPattern )
521 0 : ++nConvertedCount;
522 : }
523 0 : else if ( aSeq[i].Name == SRCH_PARA_CONTENT )
524 : {
525 0 : if ( aSeq[i].Value >>= bContent )
526 0 : ++nConvertedCount;
527 : }
528 0 : else if ( aSeq[i].Name == SRCH_PARA_ASIANOPT )
529 : {
530 0 : if ( aSeq[i].Value >>= bAsianOptions )
531 0 : ++nConvertedCount;
532 : }
533 : }
534 :
535 0 : bRet = ( nConvertedCount == SRCH_PARAMS );
536 : }
537 0 : break;
538 : }
539 : case MID_SEARCH_COMMAND:
540 0 : bRet = (rVal >>= nInt); nCommand = (sal_uInt16) nInt; break;
541 : case MID_SEARCH_STYLEFAMILY:
542 0 : bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break;
543 : case MID_SEARCH_CELLTYPE:
544 0 : bRet = (rVal >>= nInt); nCellType = (sal_uInt16) nInt; break;
545 : case MID_SEARCH_ROWDIRECTION:
546 0 : bRet = (rVal >>= bRowDirection); break;
547 : case MID_SEARCH_ALLTABLES:
548 0 : bRet = (rVal >>= bAllTables); break;
549 : case MID_SEARCH_SEARCHFILTERED:
550 0 : bRet = (rVal >>= bSearchFiltered); break;
551 : case MID_SEARCH_BACKWARD:
552 0 : bRet = (rVal >>= bBackward); break;
553 : case MID_SEARCH_PATTERN:
554 0 : bRet = (rVal >>= bPattern); break;
555 : case MID_SEARCH_CONTENT:
556 0 : bRet = (rVal >>= bContent); break;
557 : case MID_SEARCH_ASIANOPTIONS:
558 0 : bRet = (rVal >>= bAsianOptions); break;
559 : case MID_SEARCH_ALGORITHMTYPE:
560 0 : bRet = (rVal >>= nInt); aSearchOpt.algorithmType = (SearchAlgorithms)(sal_Int16)nInt; break;
561 : case MID_SEARCH_FLAGS:
562 0 : bRet = (rVal >>= aSearchOpt.searchFlag); break;
563 : case MID_SEARCH_SEARCHSTRING:
564 0 : bRet = (rVal >>= aSearchOpt.searchString); break;
565 : case MID_SEARCH_REPLACESTRING:
566 0 : bRet = (rVal >>= aSearchOpt.replaceString); break;
567 : case MID_SEARCH_CHANGEDCHARS:
568 0 : bRet = (rVal >>= aSearchOpt.changedChars); break;
569 : case MID_SEARCH_DELETEDCHARS:
570 0 : bRet = (rVal >>= aSearchOpt.deletedChars); break;
571 : case MID_SEARCH_INSERTEDCHARS:
572 0 : bRet = (rVal >>= aSearchOpt.insertedChars); break;
573 : case MID_SEARCH_TRANSLITERATEFLAGS:
574 0 : bRet = (rVal >>= aSearchOpt.transliterateFlags); break;
575 : case MID_SEARCH_LOCALE:
576 : {
577 0 : bRet = (rVal >>= nInt);
578 0 : if ( bRet )
579 : {
580 0 : if ( nInt == LANGUAGE_NONE )
581 : {
582 0 : aSearchOpt.Locale = ::com::sun::star::lang::Locale();
583 : }
584 : else
585 : {
586 0 : aSearchOpt.Locale = LanguageTag::convertToLocale( nInt);
587 : }
588 : }
589 0 : break;
590 : }
591 : default:
592 : OSL_FAIL( "Unknown MemberId" );
593 : }
594 :
595 0 : return bRet;
596 : }
597 :
598 :
599 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|