1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir #include "svx/fmsrccfg.hxx" 31*cdf0e10cSrcweir #include <svl/filerec.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp> 33*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 37*cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir //........................................................................ 40*cdf0e10cSrcweir namespace svxform 41*cdf0e10cSrcweir { 42*cdf0e10cSrcweir //........................................................................ 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir // ==================================================================== 45*cdf0e10cSrcweir // = struct FmSearchParams - Parameter einer Suche 46*cdf0e10cSrcweir // ==================================================================== 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir //--------------------------------------------------------------------- 49*cdf0e10cSrcweir //--- 20.08.01 18:17:34 ----------------------------------------------- 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir FmSearchParams::FmSearchParams() 52*cdf0e10cSrcweir :nTransliterationFlags( 0 ) 53*cdf0e10cSrcweir ,nSearchForType ( 0 ) 54*cdf0e10cSrcweir ,nPosition ( MATCHING_ANYWHERE ) 55*cdf0e10cSrcweir ,nLevOther ( 2 ) 56*cdf0e10cSrcweir ,nLevShorter ( 2 ) 57*cdf0e10cSrcweir ,nLevLonger ( 2 ) 58*cdf0e10cSrcweir ,bLevRelaxed ( sal_True ) 59*cdf0e10cSrcweir ,bAllFields ( sal_False ) 60*cdf0e10cSrcweir ,bUseFormatter ( sal_True ) 61*cdf0e10cSrcweir ,bBackwards ( sal_False ) 62*cdf0e10cSrcweir ,bWildcard ( sal_False ) 63*cdf0e10cSrcweir ,bRegular ( sal_False ) 64*cdf0e10cSrcweir ,bApproxSearch ( sal_False ) 65*cdf0e10cSrcweir ,bSoundsLikeCJK ( sal_False ) 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir nTransliterationFlags = 68*cdf0e10cSrcweir TransliterationModules_ignoreSpace_ja_JP 69*cdf0e10cSrcweir | TransliterationModules_ignoreMiddleDot_ja_JP 70*cdf0e10cSrcweir | TransliterationModules_ignoreProlongedSoundMark_ja_JP 71*cdf0e10cSrcweir | TransliterationModules_ignoreSeparator_ja_JP 72*cdf0e10cSrcweir | TransliterationModules_IGNORE_CASE; 73*cdf0e10cSrcweir } 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir //--------------------------------------------------------------------- 76*cdf0e10cSrcweir //--- 21.08.01 13:31:48 ----------------------------------------------- 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir sal_Bool FmSearchParams::isIgnoreWidthCJK( ) const 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir return 0 != (nTransliterationFlags & TransliterationModules_IGNORE_WIDTH); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir //--------------------------------------------------------------------- 84*cdf0e10cSrcweir //--- 21.08.01 13:32:03 ----------------------------------------------- 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir void FmSearchParams::setIgnoreWidthCJK( sal_Bool _bIgnore ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir if ( _bIgnore ) 89*cdf0e10cSrcweir nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH; 90*cdf0e10cSrcweir else 91*cdf0e10cSrcweir nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir //--------------------------------------------------------------------- 95*cdf0e10cSrcweir //--- 21.08.01 13:47:52 ----------------------------------------------- 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir sal_Bool FmSearchParams::isCaseSensitive( ) const 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir return 0 == (nTransliterationFlags & TransliterationModules_IGNORE_CASE); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir //--------------------------------------------------------------------- 103*cdf0e10cSrcweir //--- 21.08.01 13:48:00 ----------------------------------------------- 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir void FmSearchParams::setCaseSensitive( sal_Bool _bCase ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir if ( _bCase ) 108*cdf0e10cSrcweir nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE; 109*cdf0e10cSrcweir else 110*cdf0e10cSrcweir nTransliterationFlags |= TransliterationModules_IGNORE_CASE; 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // ==================================================================== 114*cdf0e10cSrcweir // = maps from ascii values to int values 115*cdf0e10cSrcweir // ==================================================================== 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir struct Ascii2Int16 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir const sal_Char* pAscii; 120*cdf0e10cSrcweir sal_Int16 nValue; 121*cdf0e10cSrcweir }; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir //--------------------------------------------------------------------- 124*cdf0e10cSrcweir //--- 20.08.01 18:28:38 ----------------------------------------------- 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir static const Ascii2Int16* lcl_getSearchForTypeValueMap() 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir static const Ascii2Int16 s_aSearchForTypeMap[] = 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir { "text", 0 }, 131*cdf0e10cSrcweir { "null", 1 }, 132*cdf0e10cSrcweir { "non-null", 2 }, 133*cdf0e10cSrcweir { NULL, -1 } 134*cdf0e10cSrcweir }; 135*cdf0e10cSrcweir return s_aSearchForTypeMap; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir //--------------------------------------------------------------------- 139*cdf0e10cSrcweir //--- 20.08.01 18:28:38 ----------------------------------------------- 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir static const Ascii2Int16* lcl_getSearchPositionValueMap() 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir static const Ascii2Int16 s_aSearchPositionMap[] = 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir { "anywhere-in-field", MATCHING_ANYWHERE }, 146*cdf0e10cSrcweir { "beginning-of-field", MATCHING_BEGINNING }, 147*cdf0e10cSrcweir { "end-of-field", MATCHING_END }, 148*cdf0e10cSrcweir { "complete-field", MATCHING_WHOLETEXT }, 149*cdf0e10cSrcweir { NULL, -1 } 150*cdf0e10cSrcweir }; 151*cdf0e10cSrcweir return s_aSearchPositionMap; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir //--------------------------------------------------------------------- 155*cdf0e10cSrcweir //--- 20.08.01 18:30:15 ----------------------------------------------- 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir static sal_Int16 lcl_implMapAsciiValue( const ::rtl::OUString& _rAsciiValue, const Ascii2Int16* _pMap ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir // search the map for the given ascii value 160*cdf0e10cSrcweir const Ascii2Int16* pSearch = _pMap; 161*cdf0e10cSrcweir while ( pSearch && pSearch->pAscii ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir if ( 0 == _rAsciiValue.compareToAscii( pSearch->pAscii ) ) 164*cdf0e10cSrcweir // found 165*cdf0e10cSrcweir return pSearch->nValue; 166*cdf0e10cSrcweir ++pSearch; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir DBG_ERROR( 170*cdf0e10cSrcweir ( ::rtl::OString( "lcl_implMapAsciiValue: could not convert the ascii value " ) 171*cdf0e10cSrcweir += ::rtl::OString( _rAsciiValue.getStr(), _rAsciiValue.getLength(), RTL_TEXTENCODING_ASCII_US ) 172*cdf0e10cSrcweir += ::rtl::OString( " !" ) 173*cdf0e10cSrcweir ).getStr() 174*cdf0e10cSrcweir ); 175*cdf0e10cSrcweir return -1; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir //--------------------------------------------------------------------- 179*cdf0e10cSrcweir //--- 20.08.01 18:33:06 ----------------------------------------------- 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir static const sal_Char* lcl_implMapIntValue( const sal_Int16 _nValue, const Ascii2Int16* _pMap ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir // search the map for the given integer value 184*cdf0e10cSrcweir const Ascii2Int16* pSearch = _pMap; 185*cdf0e10cSrcweir while ( pSearch && pSearch->pAscii ) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir if ( _nValue == pSearch->nValue ) 188*cdf0e10cSrcweir // found 189*cdf0e10cSrcweir return pSearch->pAscii; 190*cdf0e10cSrcweir ++pSearch; 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir DBG_ERROR( 194*cdf0e10cSrcweir ( ::rtl::OString( "lcl_implMapIntValue: could not convert the integer value " ) 195*cdf0e10cSrcweir += ::rtl::OString::valueOf( (sal_Int32)_nValue ) 196*cdf0e10cSrcweir += ::rtl::OString( " !" ) 197*cdf0e10cSrcweir ).getStr() 198*cdf0e10cSrcweir ); 199*cdf0e10cSrcweir static const sal_Char* s_pDummy = ""; 200*cdf0e10cSrcweir // just as a fallback .... 201*cdf0e10cSrcweir return s_pDummy; 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // ==================================================================== 205*cdf0e10cSrcweir // = class FmSearchConfigItem - ein ConfigItem, dass sich Suchparameter merkt 206*cdf0e10cSrcweir // ==================================================================== 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir #define TA( c ) &c, getCppuType( &c ) 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir //--------------------------------------------------------------------- 211*cdf0e10cSrcweir //--- 20.08.01 18:19:59 ----------------------------------------------- 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir FmSearchConfigItem::FmSearchConfigItem() 214*cdf0e10cSrcweir :OConfigurationValueContainer( ::comphelper::getProcessServiceFactory(), m_aMutex, "/org.openoffice.Office.DataAccess/FormSearchOptions", CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE, 2 ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir // register our members so the data exchange with the node values is done automatically 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir registerExchangeLocation( "SearchHistory", TA( aHistory ) ); 219*cdf0e10cSrcweir registerExchangeLocation( "LevenshteinOther", TA( nLevOther ) ); 220*cdf0e10cSrcweir registerExchangeLocation( "LevenshteinShorter", TA( nLevShorter ) ); 221*cdf0e10cSrcweir registerExchangeLocation( "LevenshteinLonger", TA( nLevLonger ) ); 222*cdf0e10cSrcweir registerExchangeLocation( "IsLevenshteinRelaxed", TA( bLevRelaxed ) ); 223*cdf0e10cSrcweir registerExchangeLocation( "IsSearchAllFields", TA( bAllFields ) ); 224*cdf0e10cSrcweir registerExchangeLocation( "IsUseFormatter", TA( bUseFormatter ) ); 225*cdf0e10cSrcweir registerExchangeLocation( "IsBackwards", TA( bBackwards ) ); 226*cdf0e10cSrcweir registerExchangeLocation( "IsWildcardSearch", TA( bWildcard ) ); 227*cdf0e10cSrcweir registerExchangeLocation( "IsUseRegularExpression", TA( bRegular ) ); 228*cdf0e10cSrcweir registerExchangeLocation( "IsSimilaritySearch", TA( bApproxSearch ) ); 229*cdf0e10cSrcweir registerExchangeLocation( "IsUseAsianOptions", TA( bSoundsLikeCJK ) ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // the properties which need to be translated 232*cdf0e10cSrcweir registerExchangeLocation( "SearchType", TA( m_sSearchForType ) ); 233*cdf0e10cSrcweir registerExchangeLocation( "SearchPosition", TA( m_sSearchPosition ) ); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir registerExchangeLocation( "IsMatchCase", TA( m_bIsMatchCase ) ); 236*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchFullHalfWidthForms", TA( m_bIsMatchFullHalfWidthForms ) ); 237*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchHiraganaKatakana", TA( m_bIsMatchHiraganaKatakana ) ); 238*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchContractions", TA( m_bIsMatchContractions ) ); 239*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchMinusDashCho-on", TA( m_bIsMatchMinusDashCho_on ) ); 240*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchRepeatCharMarks", TA( m_bIsMatchRepeatCharMarks ) ); 241*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchVariantFormKanji", TA( m_bIsMatchVariantFormKanji ) ); 242*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatchOldKanaForms", TA( m_bIsMatchOldKanaForms ) ); 243*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_DiZi_DuZu", TA( m_bIsMatch_DiZi_DuZu ) ); 244*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_BaVa_HaFa", TA( m_bIsMatch_BaVa_HaFa ) ); 245*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_TsiThiChi_DhiZi", TA( m_bIsMatch_TsiThiChi_DhiZi ) ); 246*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_HyuIyu_ByuVyu", TA( m_bIsMatch_HyuIyu_ByuVyu ) ); 247*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_SeShe_ZeJe", TA( m_bIsMatch_SeShe_ZeJe ) ); 248*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_IaIya", TA( m_bIsMatch_IaIya ) ); 249*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsMatch_KiKu", TA( m_bIsMatch_KiKu ) ); 250*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsIgnorePunctuation", TA( m_bIsIgnorePunctuation ) ); 251*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsIgnoreWhitespace", TA( m_bIsIgnoreWhitespace ) ); 252*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsIgnoreProlongedSoundMark",TA( m_bIsIgnoreProlongedSoundMark ) ); 253*cdf0e10cSrcweir registerExchangeLocation( "Japanese/IsIgnoreMiddleDot", TA( m_bIsIgnoreMiddleDot ) ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir read( ); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir //--------------------------------------------------------------------- 259*cdf0e10cSrcweir //--- 20.08.01 18:19:57 ----------------------------------------------- 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir FmSearchConfigItem::~FmSearchConfigItem() 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir commit( ); 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir //--------------------------------------------------------------------- 267*cdf0e10cSrcweir //--- 20.08.01 18:20:48 ----------------------------------------------- 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir void FmSearchConfigItem::implTranslateFromConfig( ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir // the search-for string 272*cdf0e10cSrcweir nSearchForType = lcl_implMapAsciiValue( m_sSearchForType, lcl_getSearchForTypeValueMap() ); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir // the search position 275*cdf0e10cSrcweir nPosition = lcl_implMapAsciiValue( m_sSearchPosition, lcl_getSearchPositionValueMap() ); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir // the transliteration flags 278*cdf0e10cSrcweir nTransliterationFlags = 0; 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir if ( !m_bIsMatchCase ) nTransliterationFlags |= TransliterationModules_IGNORE_CASE; 281*cdf0e10cSrcweir if ( m_bIsMatchFullHalfWidthForms ) nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH; 282*cdf0e10cSrcweir if ( m_bIsMatchHiraganaKatakana ) nTransliterationFlags |= TransliterationModules_IGNORE_KANA; 283*cdf0e10cSrcweir if ( m_bIsMatchContractions ) nTransliterationFlags |= TransliterationModules_ignoreSize_ja_JP; 284*cdf0e10cSrcweir if ( m_bIsMatchMinusDashCho_on ) nTransliterationFlags |= TransliterationModules_ignoreMinusSign_ja_JP; 285*cdf0e10cSrcweir if ( m_bIsMatchRepeatCharMarks ) nTransliterationFlags |= TransliterationModules_ignoreIterationMark_ja_JP; 286*cdf0e10cSrcweir if ( m_bIsMatchVariantFormKanji ) nTransliterationFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; 287*cdf0e10cSrcweir if ( m_bIsMatchOldKanaForms ) nTransliterationFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; 288*cdf0e10cSrcweir if ( m_bIsMatch_DiZi_DuZu ) nTransliterationFlags |= TransliterationModules_ignoreZiZu_ja_JP; 289*cdf0e10cSrcweir if ( m_bIsMatch_BaVa_HaFa ) nTransliterationFlags |= TransliterationModules_ignoreBaFa_ja_JP; 290*cdf0e10cSrcweir if ( m_bIsMatch_TsiThiChi_DhiZi ) nTransliterationFlags |= TransliterationModules_ignoreTiJi_ja_JP; 291*cdf0e10cSrcweir if ( m_bIsMatch_HyuIyu_ByuVyu ) nTransliterationFlags |= TransliterationModules_ignoreHyuByu_ja_JP; 292*cdf0e10cSrcweir if ( m_bIsMatch_SeShe_ZeJe ) nTransliterationFlags |= TransliterationModules_ignoreSeZe_ja_JP; 293*cdf0e10cSrcweir if ( m_bIsMatch_IaIya ) nTransliterationFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; 294*cdf0e10cSrcweir if ( m_bIsMatch_KiKu ) nTransliterationFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir if ( m_bIsIgnorePunctuation ) nTransliterationFlags |= TransliterationModules_ignoreSeparator_ja_JP; 297*cdf0e10cSrcweir if ( m_bIsIgnoreWhitespace ) nTransliterationFlags |= TransliterationModules_ignoreSpace_ja_JP; 298*cdf0e10cSrcweir if ( m_bIsIgnoreProlongedSoundMark ) nTransliterationFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; 299*cdf0e10cSrcweir if ( m_bIsIgnoreMiddleDot ) nTransliterationFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir //--------------------------------------------------------------------- 303*cdf0e10cSrcweir //--- 20.08.01 18:42:23 ----------------------------------------------- 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir void FmSearchConfigItem::implTranslateToConfig( ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir // the search-for string 308*cdf0e10cSrcweir m_sSearchForType = ::rtl::OUString::createFromAscii( lcl_implMapIntValue( nSearchForType, lcl_getSearchForTypeValueMap() ) ); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir // the search position 311*cdf0e10cSrcweir m_sSearchPosition = ::rtl::OUString::createFromAscii( lcl_implMapIntValue( nPosition, lcl_getSearchPositionValueMap() ) ); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir // the transliteration flags 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir m_bIsMatchCase = ( 0 == ( nTransliterationFlags & TransliterationModules_IGNORE_CASE ) ); 316*cdf0e10cSrcweir m_bIsMatchFullHalfWidthForms = ( 0 != ( nTransliterationFlags & TransliterationModules_IGNORE_WIDTH ) ); 317*cdf0e10cSrcweir m_bIsMatchHiraganaKatakana = ( 0 != ( nTransliterationFlags & TransliterationModules_IGNORE_KANA ) ); 318*cdf0e10cSrcweir m_bIsMatchContractions = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSize_ja_JP ) ); 319*cdf0e10cSrcweir m_bIsMatchMinusDashCho_on = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreMinusSign_ja_JP ) ); 320*cdf0e10cSrcweir m_bIsMatchRepeatCharMarks = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreIterationMark_ja_JP ) ); 321*cdf0e10cSrcweir m_bIsMatchVariantFormKanji = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTraditionalKanji_ja_JP ) ); 322*cdf0e10cSrcweir m_bIsMatchOldKanaForms = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTraditionalKana_ja_JP ) ); 323*cdf0e10cSrcweir m_bIsMatch_DiZi_DuZu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreZiZu_ja_JP ) ); 324*cdf0e10cSrcweir m_bIsMatch_BaVa_HaFa = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreBaFa_ja_JP ) ); 325*cdf0e10cSrcweir m_bIsMatch_TsiThiChi_DhiZi = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTiJi_ja_JP ) ); 326*cdf0e10cSrcweir m_bIsMatch_HyuIyu_ByuVyu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreHyuByu_ja_JP ) ); 327*cdf0e10cSrcweir m_bIsMatch_SeShe_ZeJe = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSeZe_ja_JP ) ); 328*cdf0e10cSrcweir m_bIsMatch_IaIya = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreIandEfollowedByYa_ja_JP ) ); 329*cdf0e10cSrcweir m_bIsMatch_KiKu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP ) ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir m_bIsIgnorePunctuation = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSeparator_ja_JP ) ); 332*cdf0e10cSrcweir m_bIsIgnoreWhitespace = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSpace_ja_JP ) ); 333*cdf0e10cSrcweir m_bIsIgnoreProlongedSoundMark = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreProlongedSoundMark_ja_JP ) ); 334*cdf0e10cSrcweir m_bIsIgnoreMiddleDot = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreMiddleDot_ja_JP ) ); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir //--------------------------------------------------------------------- 338*cdf0e10cSrcweir //--- 20.08.01 18:20:01 ----------------------------------------------- 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir const FmSearchParams& FmSearchConfigItem::getParams() const 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir // ensure that the properties which are not stored directly are up-to-date 343*cdf0e10cSrcweir const_cast< FmSearchConfigItem* >( this )->implTranslateFromConfig( ); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir // and return our FmSearchParams part 346*cdf0e10cSrcweir return *this; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir //--------------------------------------------------------------------- 350*cdf0e10cSrcweir //--- 20.08.01 18:41:57 ----------------------------------------------- 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir void FmSearchConfigItem::setParams( const FmSearchParams& _rParams ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir // copy the FmSearchParams part 355*cdf0e10cSrcweir *static_cast< FmSearchParams* >( this ) = _rParams; 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir // translate the settings not represented by a direct config value 358*cdf0e10cSrcweir implTranslateToConfig(); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir //........................................................................ 362*cdf0e10cSrcweir } // namespace svxform 363*cdf0e10cSrcweir //........................................................................ 364