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

Generated by: LCOV version 1.10