bump product version to 6.3.0.0.beta1
[LibreOffice.git] / svl / source / items / srchitem.cxx
blobd8995e6b0a8f31e6a403fa0b3aff81e732ec1756
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <unotools/searchopt.hxx>
28 #include <com/sun/star/util/XReplaceable.hpp>
29 #include <com/sun/star/util/XSearchable.hpp>
30 #include <com/sun/star/util/XSearchDescriptor.hpp>
31 #include <com/sun/star/util/XPropertyReplace.hpp>
32 #include <com/sun/star/util/XReplaceDescriptor.hpp>
33 #include <com/sun/star/lang/Locale.hpp>
34 #include <svl/memberid.h>
35 #include <i18nlangtag/languagetag.hxx>
37 using namespace utl;
38 using namespace com::sun::star;
39 using namespace com::sun::star::beans;
40 using namespace com::sun::star::uno;
41 using namespace com::sun::star::util;
43 #define CFG_ROOT_NODE "Office.Common/SearchOptions"
45 #define SRCH_PARAMS 13
46 #define SRCH_PARA_OPTIONS "Options"
47 #define SRCH_PARA_FAMILY "Family"
48 #define SRCH_PARA_COMMAND "Command"
49 #define SRCH_PARA_CELLTYPE "CellType"
50 #define SRCH_PARA_APPFLAG "AppFlag"
51 #define SRCH_PARA_ROWDIR "RowDirection"
52 #define SRCH_PARA_ALLTABLES "AllTables"
53 #define SRCH_PARA_SEARCHFILTERED "SearchFiltered"
54 #define SRCH_PARA_SEARCHFORMATTED "SearchFormatted"
55 #define SRCH_PARA_BACKWARD "Backward"
56 #define SRCH_PARA_PATTERN "Pattern"
57 #define SRCH_PARA_CONTENT "Content"
58 #define SRCH_PARA_ASIANOPT "AsianOptions"
60 SfxPoolItem* SvxSearchItem::CreateDefault() { return new SvxSearchItem(0);}
63 static Sequence< OUString > lcl_GetNotifyNames()
65 // names of transliteration relevant properties
66 static const char* aTranslitNames[] =
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
91 const int nCount = SAL_N_ELEMENTS( aTranslitNames );
92 Sequence< OUString > aNames( nCount );
93 OUString* pNames = aNames.getArray();
94 for (sal_Int32 i = 0; i < nCount; ++i)
95 pNames[i] = OUString::createFromAscii( aTranslitNames[i] );
97 return aNames;
101 SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
103 SfxPoolItem( nId ),
104 ConfigItem( CFG_ROOT_NODE ),
106 m_aSearchOpt ( SearchAlgorithms_ABSOLUTE,
107 SearchFlags::LEV_RELAXED,
108 OUString(),
109 OUString(),
110 lang::Locale(),
111 2, 2, 2,
112 TransliterationFlags::IGNORE_CASE,
113 SearchAlgorithms2::ABSOLUTE, '\\' ),
114 m_eFamily ( SfxStyleFamily::Para ),
115 m_nCommand ( SvxSearchCmd::FIND ),
116 m_nCellType ( SvxSearchCellType::FORMULA ),
117 m_nAppFlag ( SvxSearchApp::WRITER ),
118 m_bRowDirection ( true ),
119 m_bAllTables ( false ),
120 m_bSearchFiltered ( false ),
121 m_bSearchFormatted( false ),
122 m_bNotes ( false),
123 m_bBackward ( false ),
124 m_bPattern ( false ),
125 m_bContent ( false ),
126 m_bAsianOptions ( false ),
127 m_nStartPointX(0),
128 m_nStartPointY(0)
130 EnableNotification( lcl_GetNotifyNames() );
132 SvtSearchOptions aOpt;
134 m_bBackward = aOpt.IsBackwards();
135 m_bAsianOptions = aOpt.IsUseAsianOptions();
136 m_bNotes = aOpt.IsNotes();
138 if (aOpt.IsUseWildcard())
140 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD;
141 m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid
143 if (aOpt.IsUseRegularExpression())
145 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP;
146 m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
148 if (aOpt.IsSimilaritySearch())
150 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE;
151 m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
153 if (aOpt.IsWholeWordsOnly())
154 m_aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
156 TransliterationFlags& rFlags = m_aSearchOpt.transliterateFlags;
158 if (!aOpt.IsMatchCase())
159 rFlags |= TransliterationFlags::IGNORE_CASE;
160 if ( aOpt.IsMatchFullHalfWidthForms())
161 rFlags |= TransliterationFlags::IGNORE_WIDTH;
162 if ( aOpt.IsIgnoreDiacritics_CTL())
163 rFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL ;
164 if ( aOpt.IsIgnoreKashida_CTL())
165 rFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL ;
166 if ( !m_bAsianOptions )
167 return;
169 if ( aOpt.IsMatchHiraganaKatakana())
170 rFlags |= TransliterationFlags::IGNORE_KANA;
171 if ( aOpt.IsMatchContractions())
172 rFlags |= TransliterationFlags::ignoreSize_ja_JP;
173 if ( aOpt.IsMatchMinusDashChoon())
174 rFlags |= TransliterationFlags::ignoreMinusSign_ja_JP;
175 if ( aOpt.IsMatchRepeatCharMarks())
176 rFlags |= TransliterationFlags::ignoreIterationMark_ja_JP;
177 if ( aOpt.IsMatchVariantFormKanji())
178 rFlags |= TransliterationFlags::ignoreTraditionalKanji_ja_JP;
179 if ( aOpt.IsMatchOldKanaForms())
180 rFlags |= TransliterationFlags::ignoreTraditionalKana_ja_JP;
181 if ( aOpt.IsMatchDiziDuzu())
182 rFlags |= TransliterationFlags::ignoreZiZu_ja_JP;
183 if ( aOpt.IsMatchBavaHafa())
184 rFlags |= TransliterationFlags::ignoreBaFa_ja_JP;
185 if ( aOpt.IsMatchTsithichiDhizi())
186 rFlags |= TransliterationFlags::ignoreTiJi_ja_JP;
187 if ( aOpt.IsMatchHyuiyuByuvyu())
188 rFlags |= TransliterationFlags::ignoreHyuByu_ja_JP;
189 if ( aOpt.IsMatchSesheZeje())
190 rFlags |= TransliterationFlags::ignoreSeZe_ja_JP;
191 if ( aOpt.IsMatchIaiya())
192 rFlags |= TransliterationFlags::ignoreIandEfollowedByYa_ja_JP;
193 if ( aOpt.IsMatchKiku())
194 rFlags |= TransliterationFlags::ignoreKiKuFollowedBySa_ja_JP;
195 if ( aOpt.IsIgnorePunctuation())
196 rFlags |= TransliterationFlags::ignoreSeparator_ja_JP;
197 if ( aOpt.IsIgnoreWhitespace())
198 rFlags |= TransliterationFlags::ignoreSpace_ja_JP;
199 if ( aOpt.IsIgnoreProlongedSoundMark())
200 rFlags |= TransliterationFlags::ignoreProlongedSoundMark_ja_JP;
201 if ( aOpt.IsIgnoreMiddleDot())
202 rFlags |= TransliterationFlags::ignoreMiddleDot_ja_JP;
206 SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) :
208 SfxPoolItem ( rItem ),
209 ConfigItem( CFG_ROOT_NODE ),
211 m_aSearchOpt ( rItem.m_aSearchOpt ),
212 m_eFamily ( rItem.m_eFamily ),
213 m_nCommand ( rItem.m_nCommand ),
214 m_nCellType ( rItem.m_nCellType ),
215 m_nAppFlag ( rItem.m_nAppFlag ),
216 m_bRowDirection ( rItem.m_bRowDirection ),
217 m_bAllTables ( rItem.m_bAllTables ),
218 m_bSearchFiltered ( rItem.m_bSearchFiltered ),
219 m_bSearchFormatted ( rItem.m_bSearchFormatted ),
220 m_bNotes ( rItem.m_bNotes),
221 m_bBackward ( rItem.m_bBackward ),
222 m_bPattern ( rItem.m_bPattern ),
223 m_bContent ( rItem.m_bContent ),
224 m_bAsianOptions ( rItem.m_bAsianOptions ),
225 m_nStartPointX(rItem.m_nStartPointX),
226 m_nStartPointY(rItem.m_nStartPointY)
228 EnableNotification( lcl_GetNotifyNames() );
232 SvxSearchItem::~SvxSearchItem()
237 SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const
239 return new SvxSearchItem(*this);
243 //! used below
244 static bool equalsWithoutLocale( const i18nutil::SearchOptions2& rItem1, const i18nutil::SearchOptions2& rItem2 )
246 return rItem1.algorithmType == rItem2.algorithmType &&
247 rItem1.searchFlag == rItem2.searchFlag &&
248 rItem1.searchString == rItem2.searchString &&
249 rItem1.replaceString == rItem2.replaceString &&
250 //rItem1.Locale == rItem2.Locale &&
251 rItem1.changedChars == rItem2.changedChars &&
252 rItem1.deletedChars == rItem2.deletedChars &&
253 rItem1.insertedChars == rItem2.insertedChars &&
254 rItem1.transliterateFlags == rItem2.transliterateFlags &&
255 rItem1.AlgorithmType2 == rItem2.AlgorithmType2 &&
256 rItem1.WildcardEscapeCharacter == rItem2.WildcardEscapeCharacter;
260 bool SvxSearchItem::operator==( const SfxPoolItem& rItem ) const
262 assert(SfxPoolItem::operator==(rItem));
263 const SvxSearchItem &rSItem = static_cast<const SvxSearchItem &>(rItem);
264 return ( m_nCommand == rSItem.m_nCommand ) &&
265 ( m_bBackward == rSItem.m_bBackward ) &&
266 ( m_bPattern == rSItem.m_bPattern ) &&
267 ( m_bContent == rSItem.m_bContent ) &&
268 ( m_eFamily == rSItem.m_eFamily ) &&
269 ( m_bRowDirection == rSItem.m_bRowDirection ) &&
270 ( m_bAllTables == rSItem.m_bAllTables ) &&
271 ( m_bSearchFiltered == rSItem.m_bSearchFiltered ) &&
272 ( m_bSearchFormatted == rSItem.m_bSearchFormatted ) &&
273 ( m_nCellType == rSItem.m_nCellType ) &&
274 ( m_nAppFlag == rSItem.m_nAppFlag ) &&
275 ( m_bAsianOptions == rSItem.m_bAsianOptions ) &&
276 ( equalsWithoutLocale(m_aSearchOpt,rSItem.m_aSearchOpt )) &&
277 ( m_bNotes == rSItem.m_bNotes );
281 bool SvxSearchItem::GetPresentation
283 SfxItemPresentation ,
284 MapUnit ,
285 MapUnit ,
286 OUString& ,
287 const IntlWrapper&
288 ) const
290 return false;
293 void SvxSearchItem::Notify( const Sequence< OUString > & )
295 // applies transliteration changes in the configuration database
296 // to the current SvxSearchItem
297 SetTransliterationFlags( SvtSearchOptions().GetTransliterationFlags() );
300 void SvxSearchItem::ImplCommit()
304 void SvxSearchItem::SetMatchFullHalfWidthForms( bool bVal )
306 if (bVal)
307 m_aSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_WIDTH;
308 else
309 m_aSearchOpt.transliterateFlags &= ~TransliterationFlags::IGNORE_WIDTH;
313 void SvxSearchItem::SetWordOnly( bool bVal )
315 if (bVal)
316 m_aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
317 else
318 m_aSearchOpt.searchFlag &= ~SearchFlags::NORM_WORD_ONLY;
322 void SvxSearchItem::SetExact( bool bVal )
324 if (!bVal)
325 m_aSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
326 else
327 m_aSearchOpt.transliterateFlags &= ~TransliterationFlags::IGNORE_CASE;
331 void SvxSearchItem::SetSelection( bool bVal )
333 if (bVal)
335 m_aSearchOpt.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE |
336 SearchFlags::REG_NOT_ENDOFLINE);
338 else
340 m_aSearchOpt.searchFlag &= ~(SearchFlags::REG_NOT_BEGINOFLINE |
341 SearchFlags::REG_NOT_ENDOFLINE);
346 void SvxSearchItem::SetRegExp( bool bVal )
348 if ( bVal )
350 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP;
351 m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
353 else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 )
355 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
356 m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
361 void SvxSearchItem::SetWildcard( bool bVal )
363 if ( bVal )
365 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD;
366 m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid
368 else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 )
370 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
371 m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
376 void SvxSearchItem::SetLEVRelaxed( bool bVal )
378 if (bVal)
379 m_aSearchOpt.searchFlag |= SearchFlags::LEV_RELAXED;
380 else
381 m_aSearchOpt.searchFlag &= ~SearchFlags::LEV_RELAXED;
385 void SvxSearchItem::SetLevenshtein( bool bVal )
387 if ( bVal )
389 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE;
390 m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
392 else if ( SearchAlgorithms2::APPROXIMATE == m_aSearchOpt.AlgorithmType2 )
394 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
395 m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
400 void SvxSearchItem::SetTransliterationFlags( TransliterationFlags nFlags )
402 m_aSearchOpt.transliterateFlags = nFlags;
405 bool SvxSearchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
407 nMemberId &= ~CONVERT_TWIPS;
408 switch ( nMemberId )
410 case 0 :
412 Sequence< PropertyValue > aSeq( SRCH_PARAMS );
413 aSeq[0].Name = SRCH_PARA_OPTIONS;
414 aSeq[0].Value <<= m_aSearchOpt.toUnoSearchOptions2();
415 aSeq[1].Name = SRCH_PARA_FAMILY;
416 aSeq[1].Value <<= sal_Int16( m_eFamily );
417 aSeq[2].Name = SRCH_PARA_COMMAND;
418 aSeq[2].Value <<= static_cast<sal_uInt16>(m_nCommand);
419 aSeq[3].Name = SRCH_PARA_CELLTYPE;
420 aSeq[3].Value <<= static_cast<sal_uInt16>(m_nCellType);
421 aSeq[4].Name = SRCH_PARA_APPFLAG;
422 aSeq[4].Value <<= static_cast<sal_uInt16>(m_nAppFlag);
423 aSeq[5].Name = SRCH_PARA_ROWDIR;
424 aSeq[5].Value <<= m_bRowDirection;
425 aSeq[6].Name = SRCH_PARA_ALLTABLES;
426 aSeq[6].Value <<= m_bAllTables;
427 aSeq[7].Name = SRCH_PARA_SEARCHFILTERED;
428 aSeq[7].Value <<= m_bSearchFiltered;
429 aSeq[8].Name = SRCH_PARA_SEARCHFORMATTED;
430 aSeq[8].Value <<= m_bSearchFormatted;
431 aSeq[9].Name = SRCH_PARA_BACKWARD;
432 aSeq[9].Value <<= m_bBackward;
433 aSeq[10].Name = SRCH_PARA_PATTERN;
434 aSeq[10].Value <<= m_bPattern;
435 aSeq[11].Name = SRCH_PARA_CONTENT;
436 aSeq[11].Value <<= m_bContent;
437 aSeq[12].Name = SRCH_PARA_ASIANOPT;
438 aSeq[12].Value <<= m_bAsianOptions;
439 rVal <<= aSeq;
441 break;
442 case MID_SEARCH_COMMAND:
443 rVal <<= static_cast<sal_Int16>(m_nCommand); break;
444 case MID_SEARCH_STYLEFAMILY:
445 rVal <<= static_cast<sal_Int16>(m_eFamily); break;
446 case MID_SEARCH_CELLTYPE:
447 rVal <<= static_cast<sal_Int32>(m_nCellType); break;
448 case MID_SEARCH_ROWDIRECTION:
449 rVal <<= m_bRowDirection; break;
450 case MID_SEARCH_ALLTABLES:
451 rVal <<= m_bAllTables; break;
452 case MID_SEARCH_SEARCHFILTERED:
453 rVal <<= m_bSearchFiltered; break;
454 case MID_SEARCH_SEARCHFORMATTED:
455 rVal <<= m_bSearchFormatted; break;
456 case MID_SEARCH_BACKWARD:
457 rVal <<= m_bBackward; break;
458 case MID_SEARCH_PATTERN:
459 rVal <<= m_bPattern; break;
460 case MID_SEARCH_CONTENT:
461 rVal <<= m_bContent; break;
462 case MID_SEARCH_ASIANOPTIONS:
463 rVal <<= m_bAsianOptions; break;
464 case MID_SEARCH_ALGORITHMTYPE:
465 rVal <<= static_cast<sal_Int16>(m_aSearchOpt.algorithmType); break;
466 case MID_SEARCH_ALGORITHMTYPE2:
467 rVal <<= m_aSearchOpt.AlgorithmType2; break;
468 case MID_SEARCH_FLAGS:
469 rVal <<= m_aSearchOpt.searchFlag; break;
470 case MID_SEARCH_SEARCHSTRING:
471 rVal <<= m_aSearchOpt.searchString; break;
472 case MID_SEARCH_REPLACESTRING:
473 rVal <<= m_aSearchOpt.replaceString; break;
474 case MID_SEARCH_CHANGEDCHARS:
475 rVal <<= m_aSearchOpt.changedChars; break;
476 case MID_SEARCH_DELETEDCHARS:
477 rVal <<= m_aSearchOpt.deletedChars; break;
478 case MID_SEARCH_INSERTEDCHARS:
479 rVal <<= m_aSearchOpt.insertedChars; break;
480 case MID_SEARCH_TRANSLITERATEFLAGS:
481 rVal <<= static_cast<sal_Int32>(m_aSearchOpt.transliterateFlags); break;
482 case MID_SEARCH_LOCALE:
484 LanguageType nLocale;
485 if (!m_aSearchOpt.Locale.Language.isEmpty() || !m_aSearchOpt.Locale.Country.isEmpty() )
486 nLocale = LanguageTag::convertToLanguageType( m_aSearchOpt.Locale );
487 else
488 nLocale = LANGUAGE_NONE;
489 rVal <<= static_cast<sal_Int16>(static_cast<sal_uInt16>(nLocale));
490 break;
493 default:
494 SAL_WARN( "svl.items", "SvxSearchItem::QueryValue(): Unknown MemberId" );
495 return false;
498 return true;
502 bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
504 nMemberId &= ~CONVERT_TWIPS;
505 bool bRet = false;
506 sal_Int32 nInt = 0;
507 switch ( nMemberId )
509 case 0 :
511 Sequence< PropertyValue > aSeq;
512 if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) )
514 sal_Int16 nConvertedCount( 0 );
515 for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i )
517 if ( aSeq[i].Name == SRCH_PARA_OPTIONS )
519 css::util::SearchOptions2 nTmpSearchOpt2;
520 if ( aSeq[i].Value >>= nTmpSearchOpt2 )
522 m_aSearchOpt = nTmpSearchOpt2;
523 ++nConvertedCount;
526 else if ( aSeq[i].Name == SRCH_PARA_FAMILY )
528 sal_uInt16 nTemp( 0 );
529 if ( aSeq[i].Value >>= nTemp )
531 m_eFamily = SfxStyleFamily( nTemp );
532 ++nConvertedCount;
535 else if ( aSeq[i].Name == SRCH_PARA_COMMAND )
537 sal_uInt16 nTmp;
538 if ( aSeq[i].Value >>= nTmp )
540 m_nCommand = static_cast<SvxSearchCmd>(nTmp);
541 ++nConvertedCount;
544 else if ( aSeq[i].Name == SRCH_PARA_CELLTYPE )
546 sal_uInt16 nTmp;
547 if ( aSeq[i].Value >>= nTmp )
549 m_nCellType = static_cast<SvxSearchCellType>(nTmp);
550 ++nConvertedCount;
553 else if ( aSeq[i].Name == SRCH_PARA_APPFLAG )
555 sal_uInt16 nTmp;
556 if ( aSeq[i].Value >>= nTmp )
558 m_nAppFlag = static_cast<SvxSearchApp>(nTmp);
559 ++nConvertedCount;
562 else if ( aSeq[i].Name == SRCH_PARA_ROWDIR )
564 if ( aSeq[i].Value >>= m_bRowDirection )
565 ++nConvertedCount;
567 else if ( aSeq[i].Name == SRCH_PARA_ALLTABLES )
569 if ( aSeq[i].Value >>= m_bAllTables )
570 ++nConvertedCount;
572 else if ( aSeq[i].Name == SRCH_PARA_SEARCHFILTERED )
574 if ( aSeq[i].Value >>= m_bSearchFiltered )
575 ++nConvertedCount;
577 else if ( aSeq[i].Name == SRCH_PARA_SEARCHFORMATTED )
579 if ( aSeq[i].Value >>= m_bSearchFormatted )
580 ++nConvertedCount;
582 else if ( aSeq[i].Name == SRCH_PARA_BACKWARD )
584 if ( aSeq[i].Value >>= m_bBackward )
585 ++nConvertedCount;
587 else if ( aSeq[i].Name == SRCH_PARA_PATTERN )
589 if ( aSeq[i].Value >>= m_bPattern )
590 ++nConvertedCount;
592 else if ( aSeq[i].Name == SRCH_PARA_CONTENT )
594 if ( aSeq[i].Value >>= m_bContent )
595 ++nConvertedCount;
597 else if ( aSeq[i].Name == SRCH_PARA_ASIANOPT )
599 if ( aSeq[i].Value >>= m_bAsianOptions )
600 ++nConvertedCount;
604 bRet = ( nConvertedCount == SRCH_PARAMS );
606 break;
608 case MID_SEARCH_COMMAND:
609 bRet = (rVal >>= nInt); m_nCommand = static_cast<SvxSearchCmd>(nInt); break;
610 case MID_SEARCH_STYLEFAMILY:
611 bRet = (rVal >>= nInt); m_eFamily = static_cast<SfxStyleFamily>(static_cast<sal_Int16>(nInt)); break;
612 case MID_SEARCH_CELLTYPE:
613 bRet = (rVal >>= nInt); m_nCellType = static_cast<SvxSearchCellType>(nInt); break;
614 case MID_SEARCH_ROWDIRECTION:
615 bRet = (rVal >>= m_bRowDirection); break;
616 case MID_SEARCH_ALLTABLES:
617 bRet = (rVal >>= m_bAllTables); break;
618 case MID_SEARCH_SEARCHFILTERED:
619 bRet = (rVal >>= m_bSearchFiltered); break;
620 case MID_SEARCH_SEARCHFORMATTED:
621 bRet = (rVal >>= m_bSearchFormatted); break;
622 case MID_SEARCH_BACKWARD:
623 bRet = (rVal >>= m_bBackward); break;
624 case MID_SEARCH_PATTERN:
625 bRet = (rVal >>= m_bPattern); break;
626 case MID_SEARCH_CONTENT:
627 bRet = (rVal >>= m_bContent); break;
628 case MID_SEARCH_ASIANOPTIONS:
629 bRet = (rVal >>= m_bAsianOptions); break;
630 case MID_SEARCH_ALGORITHMTYPE:
631 bRet = (rVal >>= nInt); m_aSearchOpt.algorithmType = static_cast<SearchAlgorithms>(static_cast<sal_Int16>(nInt)); break;
632 case MID_SEARCH_ALGORITHMTYPE2:
633 bRet = (rVal >>= nInt); m_aSearchOpt.AlgorithmType2 = static_cast<sal_Int16>(nInt); break;
634 case MID_SEARCH_FLAGS:
635 bRet = (rVal >>= m_aSearchOpt.searchFlag); break;
636 case MID_SEARCH_SEARCHSTRING:
637 bRet = (rVal >>= m_aSearchOpt.searchString); break;
638 case MID_SEARCH_REPLACESTRING:
639 bRet = (rVal >>= m_aSearchOpt.replaceString); break;
640 case MID_SEARCH_CHANGEDCHARS:
641 bRet = (rVal >>= m_aSearchOpt.changedChars); break;
642 case MID_SEARCH_DELETEDCHARS:
643 bRet = (rVal >>= m_aSearchOpt.deletedChars); break;
644 case MID_SEARCH_INSERTEDCHARS:
645 bRet = (rVal >>= m_aSearchOpt.insertedChars); break;
646 case MID_SEARCH_TRANSLITERATEFLAGS:
648 bRet = (rVal >>= nInt);
649 if (bRet)
650 m_aSearchOpt.transliterateFlags = static_cast<TransliterationFlags>(nInt);
651 break;
653 case MID_SEARCH_LOCALE:
655 bRet = (rVal >>= nInt);
656 if ( bRet )
658 if ( LanguageType(nInt) == LANGUAGE_NONE )
660 m_aSearchOpt.Locale = css::lang::Locale();
662 else
664 m_aSearchOpt.Locale = LanguageTag::convertToLocale( LanguageType(nInt) );
667 break;
669 case MID_SEARCH_STARTPOINTX:
671 bRet = (rVal >>= m_nStartPointX);
672 break;
674 case MID_SEARCH_STARTPOINTY:
676 bRet = (rVal >>= m_nStartPointY);
677 break;
679 default:
680 OSL_FAIL( "Unknown MemberId" );
683 return bRet;
686 sal_Int32 SvxSearchItem::GetStartPointX() const
688 return m_nStartPointX;
691 sal_Int32 SvxSearchItem::GetStartPointY() const
693 return m_nStartPointY;
696 bool SvxSearchItem::HasStartPoint() const
698 return m_nStartPointX > 0 || m_nStartPointY > 0;
701 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */