LCOV - code coverage report
Current view: top level - cui/source/inc - cuifmsearch.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 9 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 3 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             : #ifndef INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
      21             : #define INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
      22             : 
      23             : #include <com/sun/star/sdbc/XResultSet.hpp>
      24             : 
      25             : #include <svx/fmsearch.hxx>
      26             : #include <vcl/dialog.hxx>
      27             : #include <vcl/button.hxx>
      28             : #include <vcl/fixed.hxx>
      29             : #include <vcl/edit.hxx>
      30             : #include <vcl/combobox.hxx>
      31             : #include <vcl/lstbox.hxx>
      32             : #include <tools/link.hxx>
      33             : #include <comphelper/uno3.hxx>
      34             : #include <rtl/ustring.hxx>
      35             : 
      36             : namespace svxform {
      37             :     class FmSearchConfigItem;
      38             : }
      39             : 
      40             : struct FmSearchProgress;
      41             : 
      42             : class FmSearchEngine;
      43             : 
      44             : /// Dialog for searching in Forms/Tables
      45             : class FmSearchDialog : public ModalDialog
      46             : {
      47             :     friend class FmSearchEngine;
      48             : 
      49             :     // my all Controls
      50             :     VclPtr<RadioButton>     m_prbSearchForText;
      51             :     VclPtr<RadioButton>     m_prbSearchForNull;
      52             :     VclPtr<RadioButton>     m_prbSearchForNotNull;
      53             :     VclPtr<ComboBox>        m_pcmbSearchText;
      54             :     VclPtr<FixedText>       m_pftForm;
      55             :     VclPtr<ListBox>         m_plbForm;
      56             :     VclPtr<RadioButton>     m_prbAllFields;
      57             :     VclPtr<RadioButton>     m_prbSingleField;
      58             :     VclPtr<ListBox>         m_plbField;
      59             :     VclPtr<FixedText>       m_pftPosition;
      60             :     VclPtr<ListBox>         m_plbPosition;
      61             :     VclPtr<CheckBox>        m_pcbUseFormat;
      62             :     VclPtr<CheckBox>        m_pcbCase;
      63             :     VclPtr<CheckBox>        m_pcbBackwards;
      64             :     VclPtr<CheckBox>        m_pcbStartOver;
      65             :     VclPtr<CheckBox>        m_pcbWildCard;
      66             :     VclPtr<CheckBox>        m_pcbRegular;
      67             :     VclPtr<CheckBox>        m_pcbApprox;
      68             :     VclPtr<PushButton>      m_ppbApproxSettings;
      69             :     VclPtr<CheckBox>        m_pHalfFullFormsCJK;
      70             :     VclPtr<CheckBox>        m_pSoundsLikeCJK;
      71             :     VclPtr<PushButton>      m_pSoundsLikeCJKSettings;
      72             :     VclPtr<FixedText>       m_pftRecord;
      73             :     VclPtr<FixedText>       m_pftHint;
      74             :     VclPtr<PushButton>      m_pbSearchAgain;
      75             :     VclPtr<CancelButton>    m_pbClose;
      76             :     OUString        m_sSearch;
      77             :     OUString        m_sCancel;
      78             : 
      79             :     VclPtr<vcl::Window>         m_pPreSearchFocus;
      80             : 
      81             :     Link<>  m_lnkFoundHandler;          ///< Handler for "found"
      82             :     Link<>  m_lnkCanceledNotFoundHdl;   ///< Handler for Positioning the Cursors
      83             : 
      84             :     Link<>  m_lnkContextSupplier;       ///< for search in contexts
      85             : 
      86             :     /// memorize the currently selected field for every context
      87             :     ::std::vector<OUString> m_arrContextFields;
      88             : 
      89             :     FmSearchEngine* m_pSearchEngine;
      90             : 
      91             :     Timer           m_aDelayedPaint;
      92             :     // see EnableSearchUI
      93             : 
      94             :     ::svxform::FmSearchConfigItem*      m_pConfig;
      95             : public:
      96             :     /** This can search in different sets of fields. There is a number of contexts; their names are in strContexts (separated
      97             :         by ';'), the user can choose one of them.
      98             :         When the user chooses a context, lnkContextSupplier is called, it gets a pointer on an FmSearchContext-structure,
      99             :         that has to be filled.
     100             :         The following counts for the search :
     101             :         a) in case of formatted search the iterator itself is used (like in the first constructor)
     102             :         b) in case of formatted search NOT the FormatKey at the fields of the iterator is used, but the respective TextComponent
     103             :             is asked (that's why the original iterator is used; by its move the controls behind the TextComponent-interface are
     104             :             updated hopefully)
     105             :         c) in case of not-formatted search a clone of the iterator is used (because the TextComponent-interfaces don't need to
     106             :             be asked)
     107             :         (of course needed : the string number i in strUsedFields of a context must correspond with the interface number i in the
     108             :         arrFields of the context)
     109             :     */
     110             :     FmSearchDialog(vcl::Window* pParent, const OUString& strInitialText, const ::std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
     111             :         const Link<>& lnkContextSupplier);
     112             : 
     113             :     virtual ~FmSearchDialog();
     114             :     virtual void dispose() SAL_OVERRIDE;
     115             : 
     116             :     /** The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure
     117             :         (which is only valid in the handler; so if one needs to memorize the data, don't copy the pointer but
     118             :         the structure).
     119             :         This handler MUST be set.
     120             :         Furthermore, it should be considered, that during the handler the search-dialog is still modal.
     121             :     */
     122           0 :     void SetFoundHandler(const Link<>& lnk) { m_lnkFoundHandler = lnk; }
     123             :     /**
     124             :         If the search has been cancelled or has been finished without success, the current data set is always displayed in the
     125             :         search dialog. This handler exists to make this synchronous with the possible display of the caller (it does not
     126             :         necessarily need to be set).
     127             :         The pointer that is passed to the handler points to a FmFoundRecordInformation-structure, for which aPosition and
     128             :         possibly (in a search with contexts) nContext are valid.
     129             :     */
     130           0 :     void SetCanceledNotFoundHdl(const Link<>& lnk) { m_lnkCanceledNotFoundHdl = lnk; }
     131             : 
     132             :     inline void SetActiveField(const OUString& strField);
     133             : 
     134             : protected:
     135             :     virtual bool Close() SAL_OVERRIDE;
     136             : 
     137             :     void Init(const OUString& strVisibleFields, const OUString& strInitialText);
     138             :     // only to be used out of the constructors
     139             : 
     140             :     void OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos);
     141             :     /** When searching in an own thread I naturally want to disable the UI for starting the search and for setting search
     142             :         parameters. If bEnable == sal_False, for all affected controls painting is turned off and shortly after turned on
     143             :         again using m_aDelayedPaint. If there is a demand with bEnable == sal_True inbetween, the timer is stopped and
     144             :         painting is turned on immediately. As a consequence for this intricateness there is no flickering when turning
     145             :         off and on quickly.
     146             :     */
     147             :     void EnableSearchUI(bool bEnable);
     148             : 
     149             :     void EnableSearchForDependees(bool bEnable);
     150             : 
     151             :     void EnableControlPaint(bool bEnable);
     152             : 
     153             :     void InitContext(sal_Int16 nContext);
     154             : 
     155             :     void LoadParams();
     156             :     void SaveParams() const;
     157             : 
     158             : private:
     159             :     // Handler for the Controls
     160             :     DECL_LINK( OnClickedFieldRadios, Button* );
     161             :     DECL_LINK(OnClickedSearchAgain, void *);
     162             :     DECL_LINK( OnClickedSpecialSettings, Button* );
     163             : 
     164             :     DECL_LINK(OnSearchTextModified, void *);
     165             : 
     166             :     DECL_LINK( OnPositionSelected, ListBox* );
     167             :     DECL_LINK( OnFieldSelected, ListBox* );
     168             : 
     169             :     DECL_LINK( OnFocusGrabbed, ComboBox* );
     170             :     DECL_LINK( OnCheckBoxToggled, CheckBox* );
     171             : 
     172             :     DECL_LINK( OnContextSelection, ListBox* );
     173             : 
     174             :     DECL_LINK( OnSearchProgress, FmSearchProgress* );
     175             : 
     176             :     DECL_LINK_TYPED( OnDelayedPaint, Timer*, void ); ///< see EnableSearchUI
     177             : 
     178             :     void initCommon( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _rxCursor );
     179             : };
     180             : 
     181           0 : inline void FmSearchDialog::SetActiveField(const OUString& strField)
     182             : {
     183           0 :     sal_Int32 nInitialField = m_plbField->GetEntryPos(strField);
     184           0 :     if (nInitialField == LISTBOX_ENTRY_NOTFOUND)
     185           0 :         nInitialField = 0;
     186           0 :     m_plbField->SelectEntryPos(nInitialField);
     187           0 :     LINK(this, FmSearchDialog, OnFieldSelected).Call(m_plbField);
     188           0 : }
     189             : 
     190             : #endif // INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11