LCOV - code coverage report
Current view: top level - cui/source/options - optjsearch.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 258 0.0 %
Date: 2014-11-03 Functions: 0 10 0.0 %
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 <unotools/searchopt.hxx>
      21             : #include <com/sun/star/i18n/TransliterationModules.hpp>
      22             : #include <cuires.hrc>
      23             : #include <dialmgr.hxx>
      24             : #include <optjsearch.hxx>
      25             : 
      26             : using namespace com::sun::star::i18n;
      27             : 
      28             : 
      29             : 
      30           0 : SvxJSearchOptionsPage::SvxJSearchOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet ) :
      31           0 :     SfxTabPage( pParent, "OptJSearchPage", "cui/ui/optjsearchpage.ui", &rSet )
      32             : {
      33           0 :     get( m_pMatchCase, "matchcase");
      34           0 :     get( m_pMatchFullHalfWidth, "matchfullhalfwidth");
      35           0 :     get( m_pMatchHiraganaKatakana, "matchhiraganakatakana");
      36           0 :     get( m_pMatchContractions, "matchcontractions");
      37           0 :     get( m_pMatchMinusDashChoon, "matchminusdashchoon");
      38           0 :     get( m_pMatchRepeatCharMarks, "matchrepeatcharmarks");
      39           0 :     get( m_pMatchVariantFormKanji, "matchvariantformkanji");
      40           0 :     get( m_pMatchOldKanaForms, "matcholdkanaforms");
      41           0 :     get( m_pMatchDiziDuzu, "matchdiziduzu");
      42           0 :     get( m_pMatchBavaHafa, "matchbavahafa");
      43           0 :     get( m_pMatchTsithichiDhizi, "matchtsithichidhizi");
      44           0 :     get( m_pMatchHyuiyuByuvyu, "matchhyuiyubyuvyu");
      45           0 :     get( m_pMatchSesheZeje, "matchseshezeje");
      46           0 :     get( m_pMatchIaiya, "matchiaiya");
      47           0 :     get( m_pMatchKiku, "matchkiku");
      48           0 :     get( m_pMatchProlongedSoundMark, "matchprolongedsoundmark");
      49             : 
      50           0 :     get( m_pIgnorePunctuation, "ignorepunctuation");
      51           0 :     get( m_pIgnoreWhitespace, "ignorewhitespace");
      52           0 :     get( m_pIgnoreMiddleDot, "ignoremiddledot");
      53             : 
      54           0 :     bSaveOptions = true;
      55           0 :     nTransliterationFlags = 0x00000000;
      56           0 : }
      57             : 
      58             : 
      59           0 : SvxJSearchOptionsPage::~SvxJSearchOptionsPage()
      60             : {
      61           0 : }
      62             : 
      63             : 
      64           0 : SfxTabPage*  SvxJSearchOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
      65             : {
      66           0 :     return new SvxJSearchOptionsPage( pParent, *rSet );
      67             : }
      68             : 
      69             : 
      70           0 : void SvxJSearchOptionsPage::SetTransliterationFlags( sal_Int32 nSettings )
      71             : {
      72           0 :     bool  bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE);
      73           0 :     m_pMatchCase              ->Check( bVal );    //! treat as equal uppercase/lowercase
      74           0 :     bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH);
      75           0 :     m_pMatchFullHalfWidth     ->Check( bVal );
      76           0 :     bVal = 0 != (nSettings & TransliterationModules_IGNORE_KANA);
      77           0 :     m_pMatchHiraganaKatakana  ->Check( bVal );
      78           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreSize_ja_JP);
      79           0 :     m_pMatchContractions      ->Check( bVal );
      80           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreMinusSign_ja_JP);
      81           0 :     m_pMatchMinusDashChoon    ->Check( bVal );
      82           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreIterationMark_ja_JP);
      83           0 :     m_pMatchRepeatCharMarks   ->Check( bVal );
      84           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKanji_ja_JP);
      85           0 :     m_pMatchVariantFormKanji  ->Check( bVal );
      86           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKana_ja_JP);
      87           0 :     m_pMatchOldKanaForms      ->Check( bVal );
      88           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreZiZu_ja_JP);
      89           0 :     m_pMatchDiziDuzu          ->Check( bVal );
      90           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreBaFa_ja_JP);
      91           0 :     m_pMatchBavaHafa          ->Check( bVal );
      92           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreTiJi_ja_JP);
      93           0 :     m_pMatchTsithichiDhizi    ->Check( bVal );
      94           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreHyuByu_ja_JP);
      95           0 :     m_pMatchHyuiyuByuvyu      ->Check( bVal );
      96           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreSeZe_ja_JP);
      97           0 :     m_pMatchSesheZeje         ->Check( bVal );
      98           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreIandEfollowedByYa_ja_JP);
      99           0 :     m_pMatchIaiya             ->Check( bVal );
     100           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP);
     101           0 :     m_pMatchKiku              ->Check( bVal );
     102           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreSeparator_ja_JP);
     103           0 :     m_pIgnorePunctuation      ->Check( bVal );
     104           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreSpace_ja_JP);
     105           0 :     m_pIgnoreWhitespace       ->Check( bVal );
     106           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreProlongedSoundMark_ja_JP);
     107           0 :     m_pMatchProlongedSoundMark->Check( bVal );
     108           0 :     bVal = 0 != (nSettings & TransliterationModules_ignoreMiddleDot_ja_JP);
     109           0 :     m_pIgnoreMiddleDot        ->Check( bVal );
     110             : 
     111           0 :     nTransliterationFlags = nSettings;
     112           0 : }
     113             : 
     114             : 
     115           0 : sal_Int32 SvxJSearchOptionsPage::GetTransliterationFlags_Impl()
     116             : {
     117           0 :     sal_Int32 nTmp = 0;
     118           0 :     if (m_pMatchCase->IsChecked()) //! treat as equal uppercase/lowercase
     119           0 :         nTmp |= TransliterationModules_IGNORE_CASE;
     120           0 :     if (m_pMatchFullHalfWidth->IsChecked())
     121           0 :         nTmp |= TransliterationModules_IGNORE_WIDTH;
     122           0 :     if (m_pMatchHiraganaKatakana->IsChecked())
     123           0 :         nTmp |= TransliterationModules_IGNORE_KANA;
     124           0 :     if (m_pMatchContractions->IsChecked())
     125           0 :         nTmp |= TransliterationModules_ignoreSize_ja_JP;
     126           0 :     if (m_pMatchMinusDashChoon->IsChecked())
     127           0 :         nTmp |= TransliterationModules_ignoreMinusSign_ja_JP;
     128           0 :     if (m_pMatchRepeatCharMarks->IsChecked())
     129           0 :         nTmp |= TransliterationModules_ignoreIterationMark_ja_JP;
     130           0 :     if (m_pMatchVariantFormKanji->IsChecked())
     131           0 :         nTmp |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
     132           0 :     if (m_pMatchOldKanaForms->IsChecked())
     133           0 :         nTmp |= TransliterationModules_ignoreTraditionalKana_ja_JP;
     134           0 :     if (m_pMatchDiziDuzu->IsChecked())
     135           0 :         nTmp |= TransliterationModules_ignoreZiZu_ja_JP;
     136           0 :     if (m_pMatchBavaHafa->IsChecked())
     137           0 :         nTmp |= TransliterationModules_ignoreBaFa_ja_JP;
     138           0 :     if (m_pMatchTsithichiDhizi->IsChecked())
     139           0 :         nTmp |= TransliterationModules_ignoreTiJi_ja_JP;
     140           0 :     if (m_pMatchHyuiyuByuvyu->IsChecked())
     141           0 :         nTmp |= TransliterationModules_ignoreHyuByu_ja_JP;
     142           0 :     if (m_pMatchSesheZeje->IsChecked())
     143           0 :         nTmp |= TransliterationModules_ignoreSeZe_ja_JP;
     144           0 :     if (m_pMatchIaiya->IsChecked())
     145           0 :         nTmp |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
     146           0 :     if (m_pMatchKiku->IsChecked())
     147           0 :         nTmp |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
     148           0 :     if (m_pIgnorePunctuation->IsChecked())
     149           0 :         nTmp |= TransliterationModules_ignoreSeparator_ja_JP;
     150           0 :     if (m_pIgnoreWhitespace->IsChecked())
     151           0 :         nTmp |= TransliterationModules_ignoreSpace_ja_JP;
     152           0 :     if (m_pMatchProlongedSoundMark->IsChecked())
     153           0 :         nTmp |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
     154           0 :     if (m_pIgnoreMiddleDot->IsChecked())
     155           0 :         nTmp |= TransliterationModules_ignoreMiddleDot_ja_JP;
     156             : 
     157           0 :     nTransliterationFlags = nTmp;
     158           0 :     return nTransliterationFlags;
     159             : }
     160             : 
     161             : 
     162           0 : void SvxJSearchOptionsPage::Reset( const SfxItemSet* )
     163             : {
     164           0 :     SvtSearchOptions aOpt;
     165             : 
     166             :     // read settings from configuration
     167           0 :     m_pMatchCase               ->Check(!aOpt.IsMatchCase() );  //! treat as equal uppercase/lowercase
     168           0 :     m_pMatchFullHalfWidth      ->Check( aOpt.IsMatchFullHalfWidthForms() );
     169           0 :     m_pMatchHiraganaKatakana   ->Check( aOpt.IsMatchHiraganaKatakana() );
     170           0 :     m_pMatchContractions       ->Check( aOpt.IsMatchContractions() );
     171           0 :     m_pMatchMinusDashChoon     ->Check( aOpt.IsMatchMinusDashChoon() );
     172           0 :     m_pMatchRepeatCharMarks    ->Check( aOpt.IsMatchRepeatCharMarks() );
     173           0 :     m_pMatchVariantFormKanji   ->Check( aOpt.IsMatchVariantFormKanji() );
     174           0 :     m_pMatchOldKanaForms       ->Check( aOpt.IsMatchOldKanaForms() );
     175           0 :     m_pMatchDiziDuzu           ->Check( aOpt.IsMatchDiziDuzu() );
     176           0 :     m_pMatchBavaHafa           ->Check( aOpt.IsMatchBavaHafa() );
     177           0 :     m_pMatchTsithichiDhizi     ->Check( aOpt.IsMatchTsithichiDhizi() );
     178           0 :     m_pMatchHyuiyuByuvyu       ->Check( aOpt.IsMatchHyuiyuByuvyu() );
     179           0 :     m_pMatchSesheZeje          ->Check( aOpt.IsMatchSesheZeje() );
     180           0 :     m_pMatchIaiya              ->Check( aOpt.IsMatchIaiya() );
     181           0 :     m_pMatchKiku               ->Check( aOpt.IsMatchKiku() );
     182           0 :     m_pIgnorePunctuation       ->Check( aOpt.IsIgnorePunctuation() );
     183           0 :     m_pIgnoreWhitespace        ->Check( aOpt.IsIgnoreWhitespace() );
     184           0 :     m_pMatchProlongedSoundMark ->Check( aOpt.IsIgnoreProlongedSoundMark() );
     185           0 :     m_pIgnoreMiddleDot         ->Check( aOpt.IsIgnoreMiddleDot() );
     186             : 
     187           0 :     nTransliterationFlags = GetTransliterationFlags_Impl();
     188             :     DBG_ASSERT( nTransliterationFlags == aOpt.GetTransliterationFlags(),
     189             :             "Transliteration settings different" );
     190             : 
     191           0 :     m_pMatchCase               ->SaveValue();
     192           0 :     m_pMatchFullHalfWidth      ->SaveValue();
     193           0 :     m_pMatchHiraganaKatakana   ->SaveValue();
     194           0 :     m_pMatchContractions       ->SaveValue();
     195           0 :     m_pMatchMinusDashChoon     ->SaveValue();
     196           0 :     m_pMatchRepeatCharMarks    ->SaveValue();
     197           0 :     m_pMatchVariantFormKanji   ->SaveValue();
     198           0 :     m_pMatchOldKanaForms       ->SaveValue();
     199           0 :     m_pMatchDiziDuzu           ->SaveValue();
     200           0 :     m_pMatchBavaHafa           ->SaveValue();
     201           0 :     m_pMatchTsithichiDhizi     ->SaveValue();
     202           0 :     m_pMatchHyuiyuByuvyu       ->SaveValue();
     203           0 :     m_pMatchSesheZeje          ->SaveValue();
     204           0 :     m_pMatchIaiya              ->SaveValue();
     205           0 :     m_pMatchKiku               ->SaveValue();
     206           0 :     m_pIgnorePunctuation       ->SaveValue();
     207           0 :     m_pIgnoreWhitespace        ->SaveValue();
     208           0 :     m_pMatchProlongedSoundMark ->SaveValue();
     209           0 :     m_pIgnoreMiddleDot         ->SaveValue();
     210           0 : }
     211             : 
     212             : 
     213           0 : bool SvxJSearchOptionsPage::FillItemSet( SfxItemSet* )
     214             : {
     215           0 :     sal_Int32 nOldVal = nTransliterationFlags;
     216           0 :     nTransliterationFlags = GetTransliterationFlags_Impl();
     217           0 :     bool bModified = nOldVal != nTransliterationFlags;
     218             : 
     219           0 :     if (!IsSaveOptions())
     220           0 :         return bModified;
     221             : 
     222           0 :     bModified = false;
     223           0 :     SvtSearchOptions aOpt;
     224             :     bool bNewVal, bChanged;
     225             : 
     226           0 :     bNewVal  = m_pMatchCase->IsChecked();  //! treat as equal uppercase/lowercase
     227           0 :     bChanged = m_pMatchCase->IsValueChangedFromSaved();
     228           0 :     if (bChanged)
     229             :     {
     230           0 :         aOpt.SetMatchCase(!bNewVal );
     231           0 :         bModified = true;
     232             :     }
     233           0 :     bNewVal  = m_pMatchFullHalfWidth->IsChecked();
     234           0 :     bChanged = m_pMatchFullHalfWidth->IsValueChangedFromSaved();
     235           0 :     if (bChanged)
     236             :     {
     237           0 :         aOpt.SetMatchFullHalfWidthForms( bNewVal );
     238           0 :         bModified = true;
     239             :     }
     240           0 :     bNewVal  = m_pMatchHiraganaKatakana->IsChecked();
     241           0 :     bChanged = m_pMatchHiraganaKatakana->IsValueChangedFromSaved();
     242           0 :     if (bChanged)
     243             :     {
     244           0 :         aOpt.SetMatchHiraganaKatakana( bNewVal );
     245           0 :         bModified = true;
     246             :     }
     247           0 :     bNewVal  = m_pMatchContractions->IsChecked();
     248           0 :     bChanged = m_pMatchContractions->IsValueChangedFromSaved();
     249           0 :     if (bChanged)
     250             :     {
     251           0 :         aOpt.SetMatchContractions( bNewVal );
     252           0 :         bModified = true;
     253             :     }
     254           0 :     bNewVal  = m_pMatchMinusDashChoon->IsChecked();
     255           0 :     bChanged = m_pMatchMinusDashChoon->IsValueChangedFromSaved();
     256           0 :     if (bChanged)
     257             :     {
     258           0 :         aOpt.SetMatchMinusDashChoon( bNewVal );
     259           0 :         bModified = true;
     260             :     }
     261           0 :     bNewVal  = m_pMatchRepeatCharMarks->IsChecked();
     262           0 :     bChanged = m_pMatchRepeatCharMarks->IsValueChangedFromSaved();
     263           0 :     if (bChanged)
     264             :     {
     265           0 :         aOpt.SetMatchRepeatCharMarks( bNewVal );
     266           0 :         bModified = true;
     267             :     }
     268           0 :     bNewVal  = m_pMatchVariantFormKanji->IsChecked();
     269           0 :     bChanged = m_pMatchVariantFormKanji->IsValueChangedFromSaved();
     270           0 :     if (bChanged)
     271             :     {
     272           0 :         aOpt.SetMatchVariantFormKanji( bNewVal );
     273           0 :         bModified = true;
     274             :     }
     275           0 :     bNewVal  = m_pMatchOldKanaForms->IsChecked();
     276           0 :     bChanged = m_pMatchOldKanaForms->IsValueChangedFromSaved();
     277           0 :     if (bChanged)
     278             :     {
     279           0 :         aOpt.SetMatchOldKanaForms( bNewVal );
     280           0 :         bModified = true;
     281             :     }
     282           0 :     bNewVal  = m_pMatchDiziDuzu->IsChecked();
     283           0 :     bChanged = m_pMatchDiziDuzu->IsValueChangedFromSaved();
     284           0 :     if (bChanged)
     285             :     {
     286           0 :         aOpt.SetMatchDiziDuzu( bNewVal );
     287           0 :         bModified = true;
     288             :     }
     289           0 :     bNewVal  = m_pMatchBavaHafa->IsChecked();
     290           0 :     bChanged = m_pMatchBavaHafa->IsValueChangedFromSaved();
     291           0 :     if (bChanged)
     292             :     {
     293           0 :         aOpt.SetMatchBavaHafa( bNewVal );
     294           0 :         bModified = true;
     295             :     }
     296           0 :     bNewVal  = m_pMatchTsithichiDhizi->IsChecked();
     297           0 :     bChanged = m_pMatchTsithichiDhizi->IsValueChangedFromSaved();
     298           0 :     if (bChanged)
     299             :     {
     300           0 :         aOpt.SetMatchTsithichiDhizi( bNewVal );
     301           0 :         bModified = true;
     302             :     }
     303           0 :     bNewVal  = m_pMatchHyuiyuByuvyu->IsChecked();
     304           0 :     bChanged = m_pMatchHyuiyuByuvyu->IsValueChangedFromSaved();
     305           0 :     if (bChanged)
     306             :     {
     307           0 :         aOpt.SetMatchHyuiyuByuvyu( bNewVal );
     308           0 :         bModified = true;
     309             :     }
     310           0 :     bNewVal  = m_pMatchSesheZeje->IsChecked();
     311           0 :     bChanged = m_pMatchSesheZeje->IsValueChangedFromSaved();
     312           0 :     if (bChanged)
     313             :     {
     314           0 :         aOpt.SetMatchSesheZeje( bNewVal );
     315           0 :         bModified = true;
     316             :     }
     317           0 :     bNewVal  = m_pMatchIaiya->IsChecked();
     318           0 :     bChanged = m_pMatchIaiya->IsValueChangedFromSaved();
     319           0 :     if (bChanged)
     320             :     {
     321           0 :         aOpt.SetMatchIaiya( bNewVal );
     322           0 :         bModified = true;
     323             :     }
     324           0 :     bNewVal  = m_pMatchKiku->IsChecked();
     325           0 :     bChanged = m_pMatchKiku->IsValueChangedFromSaved();
     326           0 :     if (bChanged)
     327             :     {
     328           0 :         aOpt.SetMatchKiku( bNewVal );
     329           0 :         bModified = true;
     330             :     }
     331           0 :     bNewVal  = m_pIgnorePunctuation->IsChecked();
     332           0 :     bChanged = m_pIgnorePunctuation->IsValueChangedFromSaved();
     333           0 :     if (bChanged)
     334             :     {
     335           0 :         aOpt.SetIgnorePunctuation( bNewVal );
     336           0 :         bModified = true;
     337             :     }
     338           0 :     bNewVal  = m_pIgnoreWhitespace->IsChecked();
     339           0 :     bChanged = m_pIgnoreWhitespace->IsValueChangedFromSaved();
     340           0 :     if (bChanged)
     341             :     {
     342           0 :         aOpt.SetIgnoreWhitespace( bNewVal );
     343           0 :         bModified = true;
     344             :     }
     345           0 :     bNewVal  = m_pMatchProlongedSoundMark->IsChecked();
     346           0 :     bChanged = m_pMatchProlongedSoundMark->IsValueChangedFromSaved();
     347           0 :     if (bChanged)
     348             :     {
     349           0 :         aOpt.SetIgnoreProlongedSoundMark( bNewVal );
     350           0 :         bModified = true;
     351             :     }
     352           0 :     bNewVal  = m_pIgnoreMiddleDot->IsChecked();
     353           0 :     bChanged = m_pIgnoreMiddleDot->IsValueChangedFromSaved();
     354           0 :     if (bChanged)
     355             :     {
     356           0 :         aOpt.SetIgnoreMiddleDot( bNewVal );
     357           0 :         bModified = true;
     358             :     }
     359             : 
     360           0 :     return bModified;
     361           0 : }
     362             : 
     363             : 
     364             : 
     365             : 
     366             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10