LCOV - code coverage report
Current view: top level - cui/source/dialogs - cuifmsearch.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 456 0.0 %
Date: 2014-04-11 Functions: 0 37 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 <tools/debug.hxx>
      21             : #include <vcl/msgbox.hxx>
      22             : #include <vcl/svapp.hxx>
      23             : #include <tools/shl.hxx>
      24             : #include <dialmgr.hxx>
      25             : #include <sfx2/tabdlg.hxx>
      26             : #include <osl/mutex.hxx>
      27             : #include <sfx2/app.hxx>
      28             : #include <cuires.hrc>
      29             : #include <svx/fmsrccfg.hxx>
      30             : #include <svx/fmsrcimp.hxx>
      31             : #include "fmsearch.hrc"
      32             : #include "cuifmsearch.hxx"
      33             : #include <svx/srchdlg.hxx>
      34             : #include <svl/cjkoptions.hxx>
      35             : #include <com/sun/star/i18n/TransliterationModules.hpp>
      36             : #include <comphelper/processfactory.hxx>
      37             : #include <comphelper/string.hxx>
      38             : #include <svx/svxdlg.hxx>
      39             : #include <sal/macros.h>
      40             : 
      41             : using namespace ::com::sun::star::uno;
      42             : using namespace ::com::sun::star::i18n;
      43             : using namespace ::svxform;
      44             : using namespace ::com::sun::star::sdbc;
      45             : using namespace ::com::sun::star::util;
      46             : 
      47             : #define MAX_HISTORY_ENTRIES     50
      48             : 
      49           0 : void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor )
      50             : {
      51             :     // init the engine
      52             :     DBG_ASSERT( m_pSearchEngine, "FmSearchDialog::initCommon: have no engine!" );
      53           0 :     m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress));
      54             : 
      55             :     // some layout changes according to available CJK options
      56           0 :     SvtCJKOptions aCJKOptions;
      57           0 :     if (!aCJKOptions.IsJapaneseFindEnabled())
      58             :     {
      59             :         // hide the options for the japanese search
      60           0 :         m_pSoundsLikeCJK->Hide();
      61           0 :         m_pSoundsLikeCJKSettings->Hide();
      62             :     }
      63             : 
      64           0 :     if (!aCJKOptions.IsCJKFontEnabled())
      65             :     {
      66           0 :         m_pHalfFullFormsCJK->Hide();
      67             : 
      68             :         // never ignore the width (ignoring is expensive) if the option is not available at all
      69           0 :         m_pSearchEngine->SetIgnoreWidthCJK( false );
      70             :     }
      71             : 
      72             :     // some initial record texts
      73           0 :     m_pftRecord->SetText( OUString::number(_rxCursor->getRow()) );
      74           0 :     m_pbClose->SetHelpText(OUString());
      75           0 : }
      76             : 
      77           0 : FmSearchDialog::FmSearchDialog(Window* pParent, const OUString& sInitialText, const ::std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
      78             :     const Link& lnkContextSupplier)
      79             :     :ModalDialog(pParent, "RecordSearchDialog", "cui/ui/fmsearchdialog.ui")
      80             :     ,m_sCancel                  ( Button::GetStandardText( BUTTON_CANCEL ) )
      81             :     ,m_pPreSearchFocus( NULL )
      82             :     ,m_lnkContextSupplier(lnkContextSupplier)
      83           0 :     ,m_pConfig( NULL )
      84             : {
      85           0 :     get(m_prbSearchForText,"rbSearchForText");
      86           0 :     get(m_prbSearchForNull,"rbSearchForNull");
      87           0 :     get(m_prbSearchForNotNull,"rbSearchForNotNull");
      88           0 :     get(m_pcmbSearchText,"cmbSearchText");
      89           0 :     m_pcmbSearchText->set_width_request(m_pcmbSearchText->approximate_char_width() * 42);
      90           0 :     get(m_plbForm,"lbForm");
      91           0 :     m_plbForm->set_width_request(m_plbForm->approximate_char_width() * 42);
      92           0 :     get(m_prbAllFields,"rbAllFields");
      93           0 :     get(m_prbSingleField,"rbSingleField");
      94           0 :     get(m_plbField,"lbField");
      95           0 :     get(m_plbPosition,"lbPosition");
      96           0 :     get(m_pcbUseFormat,"cbUseFormat");
      97           0 :     get(m_pcbCase,"cbCase");
      98           0 :     get(m_pcbBackwards,"cbBackwards");
      99           0 :     get(m_pcbStartOver,"cbStartOver");
     100           0 :     get(m_pcbWildCard,"cbWildCard");
     101           0 :     get(m_pcbRegular,"cbRegular");
     102           0 :     get(m_pcbApprox,"cbApprox");
     103           0 :     get(m_ppbApproxSettings,"pbApproxSettings");
     104           0 :     get(m_pHalfFullFormsCJK,"HalfFullFormsCJK");
     105           0 :     get(m_pSoundsLikeCJK,"SoundsLikeCJK");
     106           0 :     get(m_pSoundsLikeCJKSettings,"SoundsLikeCJKSettings");
     107           0 :     get(m_pbSearchAgain,"pbSearchAgain");
     108           0 :     m_sSearch = m_pbSearchAgain->GetText();
     109           0 :     get(m_pftRecord,"ftRecord");
     110           0 :     get(m_pftHint,"ftHint");
     111           0 :     get(m_pftPosition,"ftPosition");
     112           0 :     get(m_pftForm,"ftForm");
     113           0 :     get(m_pbClose,"close");
     114             : 
     115             :     DBG_ASSERT(m_lnkContextSupplier.IsSet(), "FmSearchDialog::FmSearchDialog : have no ContextSupplier !");
     116             : 
     117           0 :     FmSearchContext fmscInitial;
     118           0 :     fmscInitial.nContext = nInitialContext;
     119           0 :     m_lnkContextSupplier.Call(&fmscInitial);
     120             :     DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
     121             :     DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';') == (sal_Int32)fmscInitial.arrFields.size(),
     122             :         "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !");
     123             : #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
     124             :     for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i)
     125             :         DBG_ASSERT(fmscInitial.arrFields.at(i).is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
     126             : #endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL
     127             : 
     128           0 :     for (   ::std::vector< OUString >::const_iterator context = _rContexts.begin();
     129           0 :             context != _rContexts.end();
     130             :             ++context
     131             :         )
     132             :     {
     133           0 :         m_arrContextFields.push_back(OUString());
     134           0 :         m_plbForm->InsertEntry(*context);
     135             :     }
     136           0 :     m_plbForm->SelectEntryPos(nInitialContext);
     137             : 
     138           0 :     m_plbForm->SetSelectHdl(LINK(this, FmSearchDialog, OnContextSelection));
     139             : 
     140           0 :     if (m_arrContextFields.size() == 1)
     141             :     {
     142             :         // hide dispensable controls
     143           0 :         m_pftForm->Hide();
     144           0 :         m_plbForm->Hide();
     145             :     }
     146             : 
     147             :     m_pSearchEngine = new FmSearchEngine(
     148           0 :         ::comphelper::getProcessComponentContext(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields, SM_ALLOWSCHEDULE );
     149           0 :     initCommon( fmscInitial.xCursor );
     150             : 
     151           0 :     if ( !fmscInitial.sFieldDisplayNames.isEmpty() )
     152             :     {   // use the display names if supplied
     153             :         DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.sFieldDisplayNames, ';') == comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';'),
     154             :             "FmSearchDialog::FmSearchDialog : invalid initial context description !");
     155           0 :         Init(fmscInitial.sFieldDisplayNames, sInitialText);
     156             :     }
     157             :     else
     158           0 :         Init(fmscInitial.strUsedFields, sInitialText);
     159           0 : }
     160             : 
     161           0 : FmSearchDialog::~FmSearchDialog()
     162             : {
     163           0 :     if (m_aDelayedPaint.IsActive())
     164           0 :         m_aDelayedPaint.Stop();
     165             : 
     166           0 :     SaveParams();
     167             : 
     168           0 :     if (m_pConfig)
     169             :     {
     170           0 :         delete m_pConfig;
     171           0 :         m_pConfig = NULL;
     172             :     }
     173             : 
     174           0 :     delete m_pSearchEngine;
     175           0 : }
     176             : 
     177           0 : void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
     178             : {
     179             :     //the initialization of all the Controls
     180           0 :     m_prbSearchForText->SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
     181           0 :     m_prbSearchForNull->SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
     182           0 :     m_prbSearchForNotNull->SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
     183             : 
     184           0 :     m_prbAllFields->SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
     185           0 :     m_prbSingleField->SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios));
     186             : 
     187           0 :     m_pbSearchAgain->SetClickHdl(LINK(this, FmSearchDialog, OnClickedSearchAgain));
     188           0 :     m_ppbApproxSettings->SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
     189           0 :     m_pSoundsLikeCJKSettings->SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
     190             : 
     191           0 :     m_plbPosition->SetSelectHdl(LINK(this, FmSearchDialog, OnPositionSelected));
     192           0 :     m_plbField->SetSelectHdl(LINK(this, FmSearchDialog, OnFieldSelected));
     193             : 
     194           0 :     m_pcmbSearchText->SetModifyHdl(LINK(this, FmSearchDialog, OnSearchTextModified));
     195           0 :     m_pcmbSearchText->EnableAutocomplete(false);
     196           0 :     m_pcmbSearchText->SetGetFocusHdl(LINK(this, FmSearchDialog, OnFocusGrabbed));
     197             : 
     198           0 :     m_pcbUseFormat->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     199           0 :     m_pcbBackwards->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     200           0 :     m_pcbStartOver->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     201           0 :     m_pcbCase->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     202           0 :     m_pcbWildCard->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     203           0 :     m_pcbRegular->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     204           0 :     m_pcbApprox->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     205           0 :     m_pHalfFullFormsCJK->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     206           0 :     m_pSoundsLikeCJK->SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled));
     207             : 
     208             :     // fill the listboxes
     209             :     // method of field comparison
     210             :     sal_uInt16 nResIds[] = {
     211             :         RID_STR_SEARCH_ANYWHERE,
     212             :         RID_STR_SEARCH_BEGINNING,
     213             :         RID_STR_SEARCH_END,
     214             :         RID_STR_SEARCH_WHOLE
     215           0 :     };
     216           0 :     for ( size_t i=0; i<SAL_N_ELEMENTS(nResIds); ++i )
     217           0 :         m_plbPosition->InsertEntry( OUString( CUI_RES( nResIds[i] ) ) );
     218           0 :     m_plbPosition->SelectEntryPos(MATCHING_ANYWHERE);
     219             : 
     220             :     // the field listbox
     221           0 :     for (sal_Int32 i=0; i < comphelper::string::getTokenCount(strVisibleFields, ';'); ++i)
     222           0 :         m_plbField->InsertEntry(comphelper::string::getToken(strVisibleFields, i, ';'));
     223             : 
     224             : 
     225           0 :     m_pConfig = new FmSearchConfigItem;
     226           0 :     LoadParams();
     227             : 
     228           0 :     m_pcmbSearchText->SetText(sInitialText);
     229             :     // if the Edit-line has changed the text (e.g. because it contains
     230             :     // control characters, as can be the case with memo fields), I use
     231             :     // an empty OUString.
     232           0 :     OUString sRealSetText = m_pcmbSearchText->GetText();
     233           0 :     if (!sRealSetText.equals(sInitialText))
     234           0 :         m_pcmbSearchText->SetText(OUString());
     235           0 :     LINK(this, FmSearchDialog, OnSearchTextModified).Call(m_pcmbSearchText);
     236             : 
     237             :     // initial
     238           0 :     m_aDelayedPaint.SetTimeoutHdl(LINK(this, FmSearchDialog, OnDelayedPaint));
     239           0 :     m_aDelayedPaint.SetTimeout(500);
     240           0 :     EnableSearchUI(sal_True);
     241             : 
     242           0 :     if ( m_prbSearchForText->IsChecked() )
     243           0 :         m_pcmbSearchText->GrabFocus();
     244             : 
     245           0 : }
     246             : 
     247           0 : bool FmSearchDialog::Close()
     248             : {
     249             :     // If the close button is disabled and ESC is pressed in a dialog,
     250             :     // then Frame will call Close anyway, which I don't want to happen
     251             :     // while I'm in the middle of a search (maybe one that's running
     252             :     // in its own thread)
     253           0 :     if (!m_pbClose->IsEnabled())
     254           0 :         return false;
     255           0 :     return ModalDialog::Close();
     256             : }
     257             : 
     258           0 : IMPL_LINK(FmSearchDialog, OnClickedFieldRadios, Button*, pButton)
     259             : {
     260           0 :     if ((pButton == m_prbSearchForText) || (pButton == m_prbSearchForNull) || (pButton == m_prbSearchForNotNull))
     261             :     {
     262           0 :         EnableSearchForDependees(sal_True);
     263             :     }
     264             :     else
     265             :         // en- or disable field list box accordingly
     266           0 :         if (pButton == m_prbSingleField)
     267             :         {
     268           0 :             m_plbField->Enable();
     269           0 :             m_pSearchEngine->RebuildUsedFields(m_plbField->GetSelectEntryPos());
     270             :         }
     271             :         else
     272             :         {
     273           0 :             m_plbField->Disable();
     274           0 :             m_pSearchEngine->RebuildUsedFields(-1);
     275             :         }
     276             : 
     277           0 :     return 0;
     278             : }
     279             : 
     280           0 : IMPL_LINK_NOARG(FmSearchDialog, OnClickedSearchAgain)
     281             : {
     282           0 :     if (m_pbClose->IsEnabled())
     283             :     {   // the button has the function 'search'
     284           0 :         OUString strThisRoundText = m_pcmbSearchText->GetText();
     285             :         // to history
     286           0 :         m_pcmbSearchText->RemoveEntry(strThisRoundText);
     287           0 :         m_pcmbSearchText->InsertEntry(strThisRoundText, 0);
     288             :         // the remove/insert makes sure that a) the OUString does not appear twice and
     289             :         // that b) the last searched strings are at the beginning and limit the list length
     290           0 :         while (m_pcmbSearchText->GetEntryCount() > MAX_HISTORY_ENTRIES)
     291           0 :             m_pcmbSearchText->RemoveEntryAt(m_pcmbSearchText->GetEntryCount()-1);
     292             : 
     293             :         // take out the 'overflow' hint
     294           0 :         m_pftHint->SetText(OUString());
     295           0 :         m_pftHint->Invalidate();
     296             : 
     297           0 :         if (m_pcbStartOver->IsChecked())
     298             :         {
     299           0 :             m_pcbStartOver->Check(false);
     300           0 :             EnableSearchUI(sal_False);
     301           0 :             if (m_prbSearchForText->IsChecked())
     302           0 :                 m_pSearchEngine->StartOver(strThisRoundText);
     303             :             else
     304           0 :                 m_pSearchEngine->StartOverSpecial(m_prbSearchForNull->IsChecked());
     305             :         }
     306             :         else
     307             :         {
     308           0 :             EnableSearchUI(sal_False);
     309           0 :             if (m_prbSearchForText->IsChecked())
     310           0 :                 m_pSearchEngine->SearchNext(strThisRoundText);
     311             :             else
     312           0 :                 m_pSearchEngine->SearchNextSpecial(m_prbSearchForNull->IsChecked());
     313           0 :         }
     314             :     }
     315             :     else
     316             :     {   // the button has the function 'cancel'
     317             :         DBG_ASSERT(m_pSearchEngine->GetSearchMode() != SM_BRUTE, "FmSearchDialog, OnClickedSearchAgain : falscher Modus !");
     318             :             // the CancelButton is usually only disabled, when working in a thread or with reschedule
     319           0 :         m_pSearchEngine->CancelSearch();
     320             :             // the ProgressHandler is called when it's really finished, here it's only a demand
     321             :     }
     322           0 :     return 0;
     323             : }
     324             : 
     325           0 : IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton )
     326             : {
     327           0 :     if (m_ppbApproxSettings == pButton)
     328             :     {
     329           0 :         AbstractSvxSearchSimilarityDialog* pDlg = NULL;
     330             : 
     331           0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     332           0 :         if ( pFact )
     333           0 :             pDlg = pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
     334           0 :                         m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() );
     335             :         DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" );
     336             : 
     337           0 :         if ( pDlg && pDlg->Execute() == RET_OK )
     338             :         {
     339           0 :             m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() );
     340           0 :             m_pSearchEngine->SetLevOther( pDlg->GetOther() );
     341           0 :             m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
     342           0 :             m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
     343             :         }
     344           0 :         delete pDlg;
     345             :     }
     346           0 :     else if (m_pSoundsLikeCJKSettings == pButton)
     347             :     {
     348           0 :         SfxItemSet aSet( SFX_APP()->GetPool() );
     349           0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     350           0 :         if(pFact)
     351             :         {
     352           0 :             AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() );
     353             :             DBG_ASSERT(aDlg, "Dialogdiet fail!");
     354           0 :             aDlg->Execute();
     355             : 
     356             : 
     357           0 :             sal_Int32 nFlags = aDlg->GetTransliterationFlags();
     358           0 :             m_pSearchEngine->SetTransliterationFlags(nFlags);
     359             : 
     360           0 :             m_pcbCase->Check(m_pSearchEngine->GetCaseSensitive());
     361           0 :             OnCheckBoxToggled( m_pcbCase );
     362           0 :             m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() );
     363           0 :             OnCheckBoxToggled( m_pHalfFullFormsCJK );
     364           0 :             delete aDlg;
     365           0 :         }
     366             :     }
     367             : 
     368           0 :     return 0;
     369             : }
     370             : 
     371           0 : IMPL_LINK_NOARG(FmSearchDialog, OnSearchTextModified)
     372             : {
     373           0 :     if ((!m_pcmbSearchText->GetText().isEmpty()) || !m_prbSearchForText->IsChecked())
     374           0 :         m_pbSearchAgain->Enable();
     375             :     else
     376           0 :         m_pbSearchAgain->Disable();
     377             : 
     378           0 :     m_pSearchEngine->InvalidatePreviousLoc();
     379           0 :     return 0;
     380             : }
     381             : 
     382           0 : IMPL_LINK(FmSearchDialog, OnFocusGrabbed, ComboBox*, EMPTYARG)
     383             : {
     384           0 :     m_pcmbSearchText->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
     385           0 :     return 0;
     386             : }
     387             : 
     388           0 : IMPL_LINK(FmSearchDialog, OnPositionSelected, ListBox*, pBox)
     389             : {
     390             :     (void) pBox; // avoid warning
     391             :     DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnMethodSelected : unerwartet : nicht genau ein Eintrag selektiert !");
     392             : 
     393           0 :     m_pSearchEngine->SetPosition(m_plbPosition->GetSelectEntryPos());
     394           0 :     return 0;
     395             : }
     396             : 
     397           0 : IMPL_LINK(FmSearchDialog, OnFieldSelected, ListBox*, pBox)
     398             : {
     399             :     (void) pBox; // avoid warning
     400             :     DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnFieldSelected : unerwartet : nicht genau ein Eintrag selektiert !");
     401             : 
     402           0 :     m_pSearchEngine->RebuildUsedFields(m_prbAllFields->IsChecked() ? -1 : (sal_Int16)m_plbField->GetSelectEntryPos());
     403             :         // calls m_pSearchEngine->InvalidatePreviousLoc too
     404             : 
     405           0 :     sal_Int32 nCurrentContext = m_plbForm->GetSelectEntryPos();
     406           0 :     if (nCurrentContext != LISTBOX_ENTRY_NOTFOUND)
     407           0 :         m_arrContextFields[nCurrentContext] = OUString(m_plbField->GetSelectEntry());
     408           0 :     return 0;
     409             : }
     410             : 
     411           0 : IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox)
     412             : {
     413           0 :     sal_Bool bChecked = pBox->IsChecked();
     414             : 
     415             :     // formatter or case -> pass on to the engine
     416           0 :     if (pBox == m_pcbUseFormat)
     417           0 :         m_pSearchEngine->SetFormatterUsing(bChecked);
     418           0 :     else if (pBox == m_pcbCase)
     419           0 :         m_pSearchEngine->SetCaseSensitive(bChecked);
     420             :     // direction -> pass on and reset the checkbox-text for StartOver
     421           0 :     else if (pBox == m_pcbBackwards)
     422             :     {
     423           0 :         m_pcbStartOver->SetText( OUString( CUI_RES( bChecked ? RID_STR_FROM_BOTTOM : RID_STR_FROM_TOP ) ) );
     424           0 :         m_pSearchEngine->SetDirection(!bChecked);
     425             :     }
     426             :     // similarity-search or regular expression
     427           0 :     else if ((pBox == m_pcbApprox) || (pBox == m_pcbRegular) || (pBox == m_pcbWildCard))
     428             :     {
     429           0 :         CheckBox* pBoxes[] = { m_pcbWildCard, m_pcbRegular, m_pcbApprox };
     430           0 :         for (sal_uInt32 i=0; i< SAL_N_ELEMENTS(pBoxes); ++i)
     431             :         {
     432           0 :             if (pBoxes[i] != pBox)
     433             :             {
     434           0 :                 if (bChecked)
     435           0 :                     pBoxes[i]->Disable();
     436             :                 else
     437           0 :                     pBoxes[i]->Enable();
     438             :             }
     439             :         }
     440             : 
     441             :         // pass on to the engine
     442           0 :         m_pSearchEngine->SetWildcard(m_pcbWildCard->IsEnabled() ? m_pcbWildCard->IsChecked() : sal_False);
     443           0 :         m_pSearchEngine->SetRegular(m_pcbRegular->IsEnabled() ? m_pcbRegular->IsChecked() : sal_False);
     444           0 :         m_pSearchEngine->SetLevenshtein(m_pcbApprox->IsEnabled() ? m_pcbApprox->IsChecked() : sal_False);
     445             :             // (disabled boxes have to be passed to the engine as sal_False)
     446             : 
     447             :         // adjust the Position-Listbox (which is not allowed during Wildcard-search)
     448           0 :         if (pBox == m_pcbWildCard)
     449             :         {
     450           0 :             if (bChecked)
     451             :             {
     452           0 :                 m_pftPosition->Disable();
     453           0 :                 m_plbPosition->Disable();
     454             :             }
     455             :             else
     456             :             {
     457           0 :                 m_pftPosition->Enable();
     458           0 :                 m_plbPosition->Enable();
     459             :             }
     460             :         }
     461             : 
     462             :         // and the button for similarity-search
     463           0 :         if (pBox == m_pcbApprox)
     464             :         {
     465           0 :             if (bChecked)
     466           0 :                 m_ppbApproxSettings->Enable();
     467             :             else
     468           0 :                 m_ppbApproxSettings->Disable();
     469           0 :         }
     470             :     }
     471           0 :     else if (pBox == m_pHalfFullFormsCJK)
     472             :     {
     473             :         // forward to the search engine
     474           0 :         m_pSearchEngine->SetIgnoreWidthCJK( !bChecked );
     475             :     }
     476           0 :     else if (pBox == m_pSoundsLikeCJK)
     477             :     {
     478           0 :         m_pSoundsLikeCJKSettings->Enable(bChecked);
     479             : 
     480             :         // two other buttons which depend on this one
     481           0 :         sal_Bool bEnable =  (   m_prbSearchForText->IsChecked()
     482           0 :                             &&  !m_pSoundsLikeCJK->IsChecked()
     483             :                             )
     484           0 :                          || !SvtCJKOptions().IsJapaneseFindEnabled();
     485           0 :         m_pcbCase->Enable(bEnable);
     486           0 :         m_pHalfFullFormsCJK->Enable(bEnable);
     487             : 
     488             :         // forward to the search engine
     489           0 :         m_pSearchEngine->SetTransliteration( bChecked );
     490             :     }
     491             : 
     492           0 :     return 0;
     493             : }
     494             : 
     495           0 : void FmSearchDialog::InitContext(sal_Int16 nContext)
     496             : {
     497           0 :     FmSearchContext fmscContext;
     498           0 :     fmscContext.nContext = nContext;
     499             : 
     500             : #ifdef DBG_UTIL
     501             :     sal_uInt32 nResult =
     502             : #endif
     503           0 :     m_lnkContextSupplier.Call(&fmscContext);
     504             :     DBG_ASSERT(nResult > 0, "FmSearchDialog::InitContext : ContextSupplier didn't give me any controls !");
     505             : 
     506             :     // put the field names into the respective listbox
     507           0 :     m_plbField->Clear();
     508             : 
     509           0 :     if (!fmscContext.sFieldDisplayNames.isEmpty())
     510             :     {
     511             :         // use the display names if supplied
     512             :         DBG_ASSERT(comphelper::string::getTokenCount(fmscContext.sFieldDisplayNames, ';') == comphelper::string::getTokenCount(fmscContext.strUsedFields, ';'),
     513             :             "FmSearchDialog::InitContext : invalid context description supplied !");
     514           0 :         for (sal_Int32 i=0; i < comphelper::string::getTokenCount(fmscContext.sFieldDisplayNames, ';'); ++i)
     515           0 :             m_plbField->InsertEntry(comphelper::string::getToken(fmscContext.sFieldDisplayNames, i, ';'));
     516             :     }
     517             :     else
     518             :     {
     519             :         // else use the field names
     520           0 :         for (sal_Int32 i=0; i < comphelper::string::getTokenCount(fmscContext.strUsedFields, ';'); ++i)
     521           0 :             m_plbField->InsertEntry(comphelper::string::getToken(fmscContext.strUsedFields, i, ';'));
     522             :     }
     523             : 
     524           0 :     if (nContext < (sal_Int32)m_arrContextFields.size() && !m_arrContextFields[nContext].isEmpty())
     525             :     {
     526           0 :         m_plbField->SelectEntry(m_arrContextFields[nContext]);
     527             :     }
     528             :     else
     529             :     {
     530           0 :         m_plbField->SelectEntryPos(0);
     531           0 :         if (m_prbSingleField->IsChecked() && (m_plbField->GetEntryCount() > 1))
     532           0 :             m_plbField->GrabFocus();
     533             :     }
     534             : 
     535             :     m_pSearchEngine->SwitchToContext(fmscContext.xCursor, fmscContext.strUsedFields, fmscContext.arrFields,
     536           0 :         m_prbAllFields->IsChecked() ? -1 : 0);
     537             : 
     538           0 :     m_pftRecord->SetText(OUString::number(fmscContext.xCursor->getRow()));
     539           0 : }
     540             : 
     541           0 : IMPL_LINK( FmSearchDialog, OnContextSelection, ListBox*, pBox)
     542             : {
     543           0 :     InitContext(pBox->GetSelectEntryPos());
     544           0 :     return 0L;
     545             : }
     546             : 
     547           0 : void FmSearchDialog::EnableSearchUI(sal_Bool bEnable)
     548             : {
     549             :     // when the controls shall be disabled their paint is turned off and then turned on again after a delay
     550           0 :     if (!bEnable)
     551           0 :         EnableControlPaint(sal_False);
     552             :     else
     553             :     {
     554           0 :         if (m_aDelayedPaint.IsActive())
     555           0 :             m_aDelayedPaint.Stop();
     556             :     }
     557             :     // (the whole thing goes on below)
     558             :     // this small intricateness hopfully leads to no flickering when turning the SearchUI off
     559             :     // and on again shortly after (like it's the case during a short search process)
     560             : 
     561           0 :     if ( !bEnable )
     562             :     {
     563             :         // if one of my children has the focus, remember it
     564           0 :         Window* pFocusWindow = Application::GetFocusWindow( );
     565           0 :         if ( pFocusWindow && IsChild( pFocusWindow ) )
     566           0 :             m_pPreSearchFocus = pFocusWindow;
     567             :         else
     568           0 :             m_pPreSearchFocus = NULL;
     569             :     }
     570             : 
     571             :     // the search button has two functions -> adjust its text accordingly
     572           0 :     OUString sButtonText( bEnable ? m_sSearch : m_sCancel );
     573           0 :     m_pbSearchAgain->SetText( sButtonText );
     574             : 
     575           0 :     if (m_pSearchEngine->GetSearchMode() != SM_BRUTE)
     576             :     {
     577           0 :         m_prbSearchForText->Enable    (bEnable);
     578           0 :         m_prbSearchForNull->Enable    (bEnable);
     579           0 :         m_prbSearchForNotNull->Enable (bEnable);
     580           0 :         m_plbForm->Enable             (bEnable);
     581           0 :         m_prbAllFields->Enable        (bEnable);
     582           0 :         m_prbSingleField->Enable      (bEnable);
     583           0 :         m_plbField->Enable            (bEnable && m_prbSingleField->IsChecked());
     584           0 :         m_pcbBackwards->Enable        (bEnable);
     585           0 :         m_pcbStartOver->Enable        (bEnable);
     586           0 :         m_pbClose->Enable            (bEnable);
     587           0 :         EnableSearchForDependees    (bEnable);
     588             : 
     589           0 :         if ( !bEnable )
     590             :         {   // this means we're preparing for starting a search
     591             :             // In this case, EnableSearchForDependees disabled the search button
     592             :             // But as we're about to use it for cancelling the search, we really need to enable it, again
     593           0 :             m_pbSearchAgain->Enable( true );
     594             :         }
     595             :     }
     596             : 
     597           0 :     if (!bEnable)
     598           0 :         m_aDelayedPaint.Start();
     599             :     else
     600           0 :         EnableControlPaint(sal_True);
     601             : 
     602           0 :     if ( bEnable )
     603             :     {   // restore focus
     604           0 :         if ( m_pPreSearchFocus )
     605             :         {
     606           0 :             m_pPreSearchFocus->GrabFocus();
     607           0 :             if ( WINDOW_EDIT == m_pPreSearchFocus->GetType() )
     608             :             {
     609           0 :                 Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus );
     610           0 :                 pEdit->SetSelection( Selection( 0, pEdit->GetText().getLength() ) );
     611             :             }
     612             :         }
     613           0 :         m_pPreSearchFocus = NULL;
     614           0 :     }
     615             : 
     616           0 : }
     617             : 
     618           0 : void FmSearchDialog::EnableSearchForDependees(sal_Bool bEnable)
     619             : {
     620           0 :     sal_Bool bSearchingForText = m_prbSearchForText->IsChecked();
     621           0 :     m_pbSearchAgain->Enable(bEnable && (!bSearchingForText || (!m_pcmbSearchText->GetText().isEmpty())));
     622             : 
     623           0 :     bEnable = bEnable && bSearchingForText;
     624             : 
     625           0 :     sal_Bool bEnableRedundants = !m_pSoundsLikeCJK->IsChecked() || !SvtCJKOptions().IsJapaneseFindEnabled();
     626             : 
     627           0 :     m_pcmbSearchText->Enable          (bEnable);
     628           0 :     m_pftPosition->Enable             (bEnable && !m_pcbWildCard->IsChecked());
     629           0 :     m_pcbWildCard->Enable             (bEnable && !m_pcbRegular->IsChecked() && !m_pcbApprox->IsChecked());
     630           0 :     m_pcbRegular->Enable              (bEnable && !m_pcbWildCard->IsChecked() && !m_pcbApprox->IsChecked());
     631           0 :     m_pcbApprox->Enable               (bEnable && !m_pcbWildCard->IsChecked() && !m_pcbRegular->IsChecked());
     632           0 :     m_ppbApproxSettings->Enable       (bEnable && m_pcbApprox->IsChecked());
     633           0 :     m_pHalfFullFormsCJK->Enable      (bEnable && bEnableRedundants);
     634           0 :     m_pSoundsLikeCJK->Enable         (bEnable);
     635           0 :     m_pSoundsLikeCJKSettings->Enable (bEnable && m_pSoundsLikeCJK->IsChecked());
     636           0 :     m_plbPosition->Enable             (bEnable && !m_pcbWildCard->IsChecked());
     637           0 :     m_pcbUseFormat->Enable            (bEnable);
     638           0 :     m_pcbCase->Enable                 (bEnable && bEnableRedundants);
     639           0 : }
     640             : 
     641           0 : void FmSearchDialog::EnableControlPaint(sal_Bool bEnable)
     642             : {
     643             :     Control* pAffectedControls[] = { m_prbSearchForText, m_pcmbSearchText, m_prbSearchForNull, m_prbSearchForNotNull,
     644             :         m_prbSearchForText, m_prbAllFields, m_prbSingleField, m_plbField, m_pftPosition, m_plbPosition,
     645             :         m_pcbUseFormat, m_pcbCase, m_pcbBackwards, m_pcbStartOver, m_pcbWildCard, m_pcbRegular, m_pcbApprox, m_ppbApproxSettings,
     646           0 :         m_pbSearchAgain, m_pbClose };
     647             : 
     648           0 :     if (!bEnable)
     649           0 :         for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
     650             :         {
     651           0 :             pAffectedControls[i]->SetUpdateMode(bEnable);
     652           0 :             pAffectedControls[i]->EnablePaint(bEnable);
     653             :         }
     654             :     else
     655           0 :         for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
     656             :         {
     657           0 :             pAffectedControls[i]->EnablePaint(bEnable);
     658           0 :             pAffectedControls[i]->SetUpdateMode(bEnable);
     659             :         }
     660           0 : }
     661             : 
     662           0 : IMPL_LINK_NOARG(FmSearchDialog, OnDelayedPaint)
     663             : {
     664           0 :     EnableControlPaint(sal_True);
     665           0 :     return 0L;
     666             : }
     667             : 
     668           0 : void FmSearchDialog::OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos)
     669             : {
     670           0 :     FmFoundRecordInformation friInfo;
     671           0 :     friInfo.nContext = m_plbForm->GetSelectEntryPos();
     672             :     // if I don't do a search in a context, this has an invalid value - but then it doesn't matter anyway
     673           0 :     friInfo.aPosition = aCursorPos;
     674           0 :     if (m_prbAllFields->IsChecked())
     675           0 :         friInfo.nFieldPos = nFieldPos;
     676             :     else
     677           0 :         friInfo.nFieldPos = m_plbField->GetSelectEntryPos();
     678             :         // this of course implies that I have really searched in the field that is selected in the listbox,
     679             :         // which is made sure in RebuildUsedFields
     680             : 
     681           0 :     m_lnkFoundHandler.Call(&friInfo);
     682             : 
     683           0 :     m_pcmbSearchText->GrabFocus();
     684           0 : }
     685             : 
     686           0 : IMPL_LINK(FmSearchDialog, OnSearchProgress, FmSearchProgress*, pProgress)
     687             : {
     688           0 :     SolarMutexGuard aGuard;
     689             :         // make this single method thread-safe (it's an overkill to block the whole application for this,
     690             :         // but we don't have another safety concept at the moment)
     691             : 
     692           0 :     switch (pProgress->aSearchState)
     693             :     {
     694             :         case FmSearchProgress::STATE_PROGRESS:
     695           0 :             if (pProgress->bOverflow)
     696             :             {
     697           0 :                 OUString sHint( CUI_RES( m_pcbBackwards->IsChecked() ? RID_STR_OVERFLOW_BACKWARD : RID_STR_OVERFLOW_FORWARD ) );
     698           0 :                 m_pftHint->SetText( sHint );
     699           0 :                 m_pftHint->Invalidate();
     700             :             }
     701             : 
     702           0 :             m_pftRecord->SetText(OUString::number(1 + pProgress->nCurrentRecord));
     703           0 :             m_pftRecord->Invalidate();
     704           0 :             break;
     705             : 
     706             :         case FmSearchProgress::STATE_PROGRESS_COUNTING:
     707           0 :             m_pftHint->SetText(CUI_RESSTR(RID_STR_SEARCH_COUNTING));
     708           0 :             m_pftHint->Invalidate();
     709             : 
     710           0 :             m_pftRecord->SetText(OUString::number(pProgress->nCurrentRecord));
     711           0 :             m_pftRecord->Invalidate();
     712           0 :             break;
     713             : 
     714             :         case FmSearchProgress::STATE_SUCCESSFULL:
     715           0 :             OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex);
     716           0 :             EnableSearchUI(sal_True);
     717           0 :             break;
     718             : 
     719             :         case FmSearchProgress::STATE_ERROR:
     720             :         case FmSearchProgress::STATE_NOTHINGFOUND:
     721             :         {
     722           0 :             sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == pProgress->aSearchState)
     723             :                 ? RID_SVXERR_SEARCH_GENERAL_ERROR
     724           0 :                 : RID_SVXERR_SEARCH_NORECORD;
     725           0 :             ErrorBox(this, CUI_RES(nErrorId)).Execute();
     726             :         }
     727             :             // NO break !
     728             :         case FmSearchProgress::STATE_CANCELED:
     729           0 :             EnableSearchUI(sal_True);
     730           0 :             if (m_lnkCanceledNotFoundHdl.IsSet())
     731             :             {
     732           0 :                 FmFoundRecordInformation friInfo;
     733           0 :                 friInfo.nContext = m_plbForm->GetSelectEntryPos();
     734             :                 // if I don't do a search in a context, this has an invalid value - but then it doesn't matter anyway
     735           0 :                 friInfo.aPosition = pProgress->aBookmark;
     736           0 :                 m_lnkCanceledNotFoundHdl.Call(&friInfo);
     737             :             }
     738           0 :             break;
     739             :     }
     740             : 
     741           0 :     m_pftRecord->SetText(OUString::number(1 + pProgress->nCurrentRecord));
     742             : 
     743           0 :     return 0L;
     744             : }
     745             : 
     746           0 : void FmSearchDialog::LoadParams()
     747             : {
     748           0 :     FmSearchParams aParams(m_pConfig->getParams());
     749             : 
     750           0 :     const OUString* pHistory     =                   aParams.aHistory.getConstArray();
     751           0 :     const OUString* pHistoryEnd  =   pHistory    +   aParams.aHistory.getLength();
     752           0 :     for (; pHistory != pHistoryEnd; ++pHistory)
     753           0 :         m_pcmbSearchText->InsertEntry( *pHistory );
     754             : 
     755             :     // I do the settings at my UI-elements and then I simply call the respective change-handler,
     756             :     // that way the data is handed on to the SearchEngine and all dependent settings are done
     757             : 
     758             :     // current field
     759           0 :     sal_Int32 nInitialField = m_plbField->GetEntryPos( OUString( aParams.sSingleSearchField ) );
     760           0 :     if (nInitialField == LISTBOX_ENTRY_NOTFOUND)
     761           0 :         nInitialField = 0;
     762           0 :     m_plbField->SelectEntryPos(nInitialField);
     763           0 :     LINK(this, FmSearchDialog, OnFieldSelected).Call(m_plbField);
     764             :     // all fields/single field (AFTER selcting the field because OnClickedFieldRadios expects a valid value there)
     765           0 :     if (aParams.bAllFields)
     766             :     {
     767           0 :         m_prbSingleField->Check(false);
     768           0 :         m_prbAllFields->Check(true);
     769           0 :         LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(m_prbAllFields);
     770             :         // OnClickedFieldRadios also calls to RebuildUsedFields
     771             :     }
     772             :     else
     773             :     {
     774           0 :         m_prbAllFields->Check(false);
     775           0 :         m_prbSingleField->Check(true);
     776           0 :         LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(m_prbSingleField);
     777             :     }
     778             : 
     779           0 :     m_plbPosition->SelectEntryPos(aParams.nPosition);
     780           0 :     LINK(this, FmSearchDialog, OnPositionSelected).Call(m_plbPosition);
     781             : 
     782             :     // field formatting/case sensitivity/direction
     783           0 :     m_pcbUseFormat->Check(aParams.bUseFormatter);
     784           0 :     m_pcbCase->Check( aParams.isCaseSensitive() );
     785           0 :     m_pcbBackwards->Check(aParams.bBackwards);
     786           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbUseFormat);
     787           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbCase);
     788           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbBackwards);
     789             : 
     790           0 :     m_pHalfFullFormsCJK->Check( !aParams.isIgnoreWidthCJK( ) );  // BEWARE: this checkbox has a inverse semantics!
     791           0 :     m_pSoundsLikeCJK->Check( aParams.bSoundsLikeCJK );
     792           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pHalfFullFormsCJK);
     793           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pSoundsLikeCJK);
     794             : 
     795           0 :     m_pcbWildCard->Check(false);
     796           0 :     m_pcbRegular->Check(false);
     797           0 :     m_pcbApprox->Check(false);
     798           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbWildCard);
     799           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbRegular);
     800           0 :     LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(m_pcbApprox);
     801             : 
     802           0 :     CheckBox* pToCheck = NULL;
     803           0 :     if (aParams.bWildcard)
     804           0 :         pToCheck = m_pcbWildCard;
     805           0 :     if (aParams.bRegular)
     806           0 :         pToCheck = m_pcbRegular;
     807           0 :     if (aParams.bApproxSearch)
     808           0 :         pToCheck = m_pcbApprox;
     809           0 :     if (aParams.bSoundsLikeCJK)
     810           0 :         pToCheck = m_pSoundsLikeCJK;
     811           0 :     if (pToCheck)
     812             :     {
     813           0 :         pToCheck->Check(true);
     814           0 :         LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(pToCheck);
     815             :     }
     816             : 
     817             :     // set Levenshtein-parameters directly at the SearchEngine
     818           0 :     m_pSearchEngine->SetLevRelaxed(aParams.bLevRelaxed);
     819           0 :     m_pSearchEngine->SetLevOther(aParams.nLevOther);
     820           0 :     m_pSearchEngine->SetLevShorter(aParams.nLevShorter);
     821           0 :     m_pSearchEngine->SetLevLonger(aParams.nLevLonger);
     822             : 
     823           0 :     m_pSearchEngine->SetTransliterationFlags( aParams.getTransliterationFlags( ) );
     824             : 
     825           0 :     m_prbSearchForText->Check(false);
     826           0 :     m_prbSearchForNull->Check(false);
     827           0 :     m_prbSearchForNotNull->Check(false);
     828           0 :     switch (aParams.nSearchForType)
     829             :     {
     830           0 :         case 1: m_prbSearchForNull->Check(true); break;
     831           0 :         case 2: m_prbSearchForNotNull->Check(true); break;
     832           0 :         default: m_prbSearchForText->Check(true); break;
     833             :     }
     834           0 :     LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(m_prbSearchForText);
     835           0 : }
     836             : 
     837           0 : void FmSearchDialog::SaveParams() const
     838             : {
     839           0 :     if (!m_pConfig)
     840           0 :         return;
     841             : 
     842           0 :     FmSearchParams aCurrentSettings;
     843             : 
     844           0 :     aCurrentSettings.aHistory.realloc( m_pcmbSearchText->GetEntryCount() );
     845           0 :     OUString* pHistory = aCurrentSettings.aHistory.getArray();
     846           0 :     for (sal_Int32 i=0; i<m_pcmbSearchText->GetEntryCount(); ++i, ++pHistory)
     847           0 :         *pHistory = m_pcmbSearchText->GetEntry(i);
     848             : 
     849           0 :     aCurrentSettings.sSingleSearchField         = m_plbField->GetSelectEntry();
     850           0 :     aCurrentSettings.bAllFields                 = m_prbAllFields->IsChecked();
     851           0 :     aCurrentSettings.nPosition                  = m_pSearchEngine->GetPosition();
     852           0 :     aCurrentSettings.bUseFormatter              = m_pSearchEngine->GetFormatterUsing();
     853           0 :     aCurrentSettings.setCaseSensitive           ( m_pSearchEngine->GetCaseSensitive() );
     854           0 :     aCurrentSettings.bBackwards                 = !m_pSearchEngine->GetDirection();
     855           0 :     aCurrentSettings.bWildcard                  = m_pSearchEngine->GetWildcard();
     856           0 :     aCurrentSettings.bRegular                   = m_pSearchEngine->GetRegular();
     857           0 :     aCurrentSettings.bApproxSearch              = m_pSearchEngine->GetLevenshtein();
     858           0 :     aCurrentSettings.bLevRelaxed                = m_pSearchEngine->GetLevRelaxed();
     859           0 :     aCurrentSettings.nLevOther                  = m_pSearchEngine->GetLevOther();
     860           0 :     aCurrentSettings.nLevShorter                = m_pSearchEngine->GetLevShorter();
     861           0 :     aCurrentSettings.nLevLonger                 = m_pSearchEngine->GetLevLonger();
     862             : 
     863           0 :     aCurrentSettings.bSoundsLikeCJK             = m_pSearchEngine->GetTransliteration();
     864           0 :     aCurrentSettings.setTransliterationFlags    ( m_pSearchEngine->GetTransliterationFlags() );
     865             : 
     866           0 :     if (m_prbSearchForNull->IsChecked())
     867           0 :         aCurrentSettings.nSearchForType = 1;
     868           0 :     else if (m_prbSearchForNotNull->IsChecked())
     869           0 :         aCurrentSettings.nSearchForType = 2;
     870             :     else
     871           0 :         aCurrentSettings.nSearchForType = 0;
     872             : 
     873           0 :     m_pConfig->setParams( aCurrentSettings );
     874           0 : }
     875             : 
     876             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10