LCOV - code coverage report
Current view: top level - svl/source/items - srchitem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 90 288 31.2 %
Date: 2015-06-13 12:38:46 Functions: 21 29 72.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11