LCOV - code coverage report
Current view: top level - cui/source/inc - cuifmsearch.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 9 0.0 %
Date: 2014-11-03 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             :     RadioButton     *m_prbSearchForText;
      51             :     RadioButton     *m_prbSearchForNull;
      52             :     RadioButton     *m_prbSearchForNotNull;
      53             :     ComboBox        *m_pcmbSearchText;
      54             :     FixedText       *m_pftForm;
      55             :     ListBox         *m_plbForm;
      56             :     RadioButton     *m_prbAllFields;
      57             :     RadioButton     *m_prbSingleField;
      58             :     ListBox         *m_plbField;
      59             :     FixedText       *m_pftPosition;
      60             :     ListBox         *m_plbPosition;
      61             :     CheckBox        *m_pcbUseFormat;
      62             :     CheckBox        *m_pcbCase;
      63             :     CheckBox        *m_pcbBackwards;
      64             :     CheckBox        *m_pcbStartOver;
      65             :     CheckBox        *m_pcbWildCard;
      66             :     CheckBox        *m_pcbRegular;
      67             :     CheckBox        *m_pcbApprox;
      68             :     PushButton      *m_ppbApproxSettings;
      69             :     CheckBox        *m_pHalfFullFormsCJK;
      70             :     CheckBox        *m_pSoundsLikeCJK;
      71             :     PushButton      *m_pSoundsLikeCJKSettings;
      72             :     FixedText       *m_pftRecord;
      73             :     FixedText       *m_pftHint;
      74             :     PushButton      *m_pbSearchAgain;
      75             :     CancelButton    *m_pbClose;
      76             :     OUString        m_sSearch;
      77             :     OUString        m_sCancel;
      78             : 
      79             :     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             : 
     115             :     /** The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure
     116             :         (which is only valid in the handler; so if one needs to memorize the data, don't copy the pointer but
     117             :         the structure).
     118             :         This handler MUST be set.
     119             :         Furthermore, it should be considered, that during the handler the search-dialog is still modal.
     120             :     */
     121           0 :     void SetFoundHandler(const Link& lnk) { m_lnkFoundHandler = lnk; }
     122             :     /**
     123             :         If the search has been cancelled or has been finished without success, the current data set is always displayed in the
     124             :         search dialog. This handler exists to make this synchronous with the possible display of the caller (it does not
     125             :         necessarily need to be set).
     126             :         The pointer that is passed to the handler points to a FmFoundRecordInformation-structure, for which aPosition and
     127             :         possibly (in a search with contexts) nContext are valid.
     128             :     */
     129           0 :     void SetCanceledNotFoundHdl(const Link& lnk) { m_lnkCanceledNotFoundHdl = lnk; }
     130             : 
     131             :     inline void SetActiveField(const OUString& strField);
     132             : 
     133             : protected:
     134             :     virtual bool Close() SAL_OVERRIDE;
     135             : 
     136             :     void Init(const OUString& strVisibleFields, const OUString& strInitialText);
     137             :     // only to be used out of the constructors
     138             : 
     139             :     void OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos);
     140             :     /** When searching in an own thread I naturally want to disable the UI for starting the search and for setting search
     141             :         parameters. If bEnable == sal_False, for all affected controls painting is turned off and shortly after turned on
     142             :         again using m_aDelayedPaint. If there is a demand with bEnable == sal_True inbetween, the timer is stopped and
     143             :         painting is turned on immediately. As a consequence for this intricateness there is no flickering when turning
     144             :         off and on quickly.
     145             :     */
     146             :     void EnableSearchUI(bool bEnable);
     147             : 
     148             :     void EnableSearchForDependees(bool bEnable);
     149             : 
     150             :     void EnableControlPaint(bool bEnable);
     151             : 
     152             :     void InitContext(sal_Int16 nContext);
     153             : 
     154             :     void LoadParams();
     155             :     void SaveParams() const;
     156             : 
     157             : private:
     158             :     // Handler for the Controls
     159             :     DECL_LINK( OnClickedFieldRadios, Button* );
     160             :     DECL_LINK(OnClickedSearchAgain, void *);
     161             :     DECL_LINK( OnClickedSpecialSettings, Button* );
     162             : 
     163             :     DECL_LINK(OnSearchTextModified, void *);
     164             : 
     165             :     DECL_LINK( OnPositionSelected, ListBox* );
     166             :     DECL_LINK( OnFieldSelected, ListBox* );
     167             : 
     168             :     DECL_LINK( OnFocusGrabbed, ComboBox* );
     169             :     DECL_LINK( OnCheckBoxToggled, CheckBox* );
     170             : 
     171             :     DECL_LINK( OnContextSelection, ListBox* );
     172             : 
     173             :     DECL_LINK( OnSearchProgress, FmSearchProgress* );
     174             : 
     175             :     DECL_LINK( OnDelayedPaint, void* ); ///< see EnableSearchUI
     176             : 
     177             :     void initCommon( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _rxCursor );
     178             : };
     179             : 
     180           0 : inline void FmSearchDialog::SetActiveField(const OUString& strField)
     181             : {
     182           0 :     sal_Int32 nInitialField = m_plbField->GetEntryPos(strField);
     183           0 :     if (nInitialField == LISTBOX_ENTRY_NOTFOUND)
     184           0 :         nInitialField = 0;
     185           0 :     m_plbField->SelectEntryPos(nInitialField);
     186           0 :     LINK(this, FmSearchDialog, OnFieldSelected).Call(m_plbField);
     187           0 : }
     188             : 
     189             : #endif // INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10