LibreOffice Module cui (master)  1
cuifmsearch.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 
24 #include <svx/fmsearch.hxx>
25 #include <vcl/weld.hxx>
26 #include <tools/link.hxx>
27 #include <rtl/ustring.hxx>
28 
29 namespace svxform
30 {
31 class FmSearchConfigItem;
32 }
33 
34 struct FmSearchProgress;
35 
36 class FmSearchEngine;
37 
40 {
41  friend class FmSearchEngine;
42 
43  OUString m_sSearch;
44  OUString m_sCancel;
45 
49 
51 
53  std::vector<OUString> m_arrContextFields;
54 
55  std::unique_ptr<FmSearchEngine> m_pSearchEngine;
56 
57  // see EnableSearchUI
58  std::unique_ptr<::svxform::FmSearchConfigItem> m_pConfig;
59 
60  // my all Controls
61  std::unique_ptr<weld::RadioButton> m_prbSearchForText;
62  std::unique_ptr<weld::RadioButton> m_prbSearchForNull;
63  std::unique_ptr<weld::RadioButton> m_prbSearchForNotNull;
64  std::unique_ptr<weld::ComboBox> m_pcmbSearchText;
65  std::unique_ptr<weld::Label> m_pftForm;
66  std::unique_ptr<weld::ComboBox> m_plbForm;
67  std::unique_ptr<weld::RadioButton> m_prbAllFields;
68  std::unique_ptr<weld::RadioButton> m_prbSingleField;
69  std::unique_ptr<weld::ComboBox> m_plbField;
70  std::unique_ptr<weld::Label> m_pftPosition;
71  std::unique_ptr<weld::ComboBox> m_plbPosition;
72  std::unique_ptr<weld::CheckButton> m_pcbUseFormat;
73  std::unique_ptr<weld::CheckButton> m_pcbCase;
74  std::unique_ptr<weld::CheckButton> m_pcbBackwards;
75  std::unique_ptr<weld::CheckButton> m_pcbStartOver;
76  std::unique_ptr<weld::CheckButton> m_pcbWildCard;
77  std::unique_ptr<weld::CheckButton> m_pcbRegular;
78  std::unique_ptr<weld::CheckButton> m_pcbApprox;
79  std::unique_ptr<weld::Button> m_ppbApproxSettings;
80  std::unique_ptr<weld::CheckButton> m_pHalfFullFormsCJK;
81  std::unique_ptr<weld::CheckButton> m_pSoundsLikeCJK;
82  std::unique_ptr<weld::Button> m_pSoundsLikeCJKSettings;
83  std::unique_ptr<weld::Label> m_pftRecord;
84  std::unique_ptr<weld::Label> m_pftHint;
85  std::unique_ptr<weld::Button> m_pbSearchAgain;
86  std::unique_ptr<weld::Button> m_pbClose;
87 
88 public:
103  FmSearchDialog(weld::Window* pParent, const OUString& strInitialText,
104  const std::vector<OUString>& _rContexts, sal_Int16 nInitialContext,
105  const Link<FmSearchContext&, sal_uInt32>& lnkContextSupplier);
106 
107  virtual short run() override;
108 
109  virtual ~FmSearchDialog() override;
110 
118  {
119  m_lnkFoundHandler = lnk;
120  }
129  {
131  }
132 
133  inline void SetActiveField(const OUString& strField);
134 
135 private:
136  void Init(const OUString& strVisibleFields, const OUString& strInitialText);
137  // only to be used out of the constructors
138 
139  void OnFound(const css::uno::Any& aCursorPos, sal_Int16 nFieldPos);
140 
141  void EnableSearchUI(bool bEnable);
142 
143  void EnableSearchForDependees(bool bEnable);
144 
145  void InitContext(sal_Int16 nContext);
146 
147  void LoadParams();
148  void SaveParams() const;
149 
150  // Handler for the Controls
151  DECL_LINK(OnClickedFieldRadios, weld::Button&, void);
152  DECL_LINK(OnClickedSearchAgain, weld::Button&, void);
153  DECL_LINK(OnClickedSpecialSettings, weld::Button&, void);
154 
155  DECL_LINK(OnSearchTextModified, weld::ComboBox&, void);
156 
157  DECL_LINK(OnPositionSelected, weld::ComboBox&, void);
158  DECL_LINK(OnFieldSelected, weld::ComboBox&, void);
159 
160  DECL_LINK(OnFocusGrabbed, weld::Widget&, void);
161  DECL_LINK(OnCheckBoxToggled, weld::ToggleButton&, void);
162 
163  DECL_LINK(OnContextSelection, weld::ComboBox&, void);
164 
165  DECL_LINK(OnSearchProgress, const FmSearchProgress*, void);
166 
167  void initCommon(const css::uno::Reference<css::sdbc::XResultSet>& _rxCursor);
168 };
169 
170 inline void FmSearchDialog::SetActiveField(const OUString& strField)
171 {
172  int nInitialField = m_plbField->find_text(strField);
173  if (nInitialField == -1)
174  nInitialField = 0;
175  m_plbField->set_active(nInitialField);
176  OnFieldSelected(*m_plbField);
177 }
178 
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_plbPosition
Definition: cuifmsearch.hxx:71
std::unique_ptr< weld::Button > m_pSoundsLikeCJKSettings
Definition: cuifmsearch.hxx:82
void SaveParams() const
DECL_LINK(OnClickedFieldRadios, weld::Button &, void)
std::unique_ptr< weld::RadioButton > m_prbSingleField
Definition: cuifmsearch.hxx:68
std::unique_ptr< weld::ComboBox > m_plbForm
Definition: cuifmsearch.hxx:66
std::unique_ptr< weld::CheckButton > m_pcbCase
Definition: cuifmsearch.hxx:73
std::unique_ptr< weld::Button > m_pbClose
Definition: cuifmsearch.hxx:86
std::unique_ptr< weld::CheckButton > m_pcbStartOver
Definition: cuifmsearch.hxx:75
std::unique_ptr< weld::ComboBox > m_pcmbSearchText
Definition: cuifmsearch.hxx:64
std::unique_ptr< weld::CheckButton > m_pcbBackwards
Definition: cuifmsearch.hxx:74
void EnableSearchUI(bool bEnable)
std::unique_ptr< weld::Label > m_pftPosition
Definition: cuifmsearch.hxx:70
std::unique_ptr< weld::Label > m_pftRecord
Definition: cuifmsearch.hxx:83
Link< FmFoundRecordInformation &, void > m_lnkCanceledNotFoundHdl
Handler for Positioning the Cursors.
Definition: cuifmsearch.hxx:48
Link< FmFoundRecordInformation &, void > m_lnkFoundHandler
Handler for "found".
Definition: cuifmsearch.hxx:46
std::unique_ptr< weld::Label > m_pftForm
Definition: cuifmsearch.hxx:65
void SetActiveField(const OUString &strField)
void SetCanceledNotFoundHdl(const Link< FmFoundRecordInformation &, void > &lnk)
If the search has been cancelled or has been finished without success, the current data set is always...
std::unique_ptr< weld::RadioButton > m_prbSearchForNull
Definition: cuifmsearch.hxx:62
OUString m_sCancel
Definition: cuifmsearch.hxx:44
std::unique_ptr< weld::CheckButton > m_pcbRegular
Definition: cuifmsearch.hxx:77
std::unique_ptr< weld::CheckButton > m_pSoundsLikeCJK
Definition: cuifmsearch.hxx:81
std::unique_ptr< weld::ComboBox > m_plbField
Definition: cuifmsearch.hxx:69
std::unique_ptr< weld::Button > m_ppbApproxSettings
Definition: cuifmsearch.hxx:79
std::unique_ptr< weld::CheckButton > m_pHalfFullFormsCJK
Definition: cuifmsearch.hxx:80
std::vector< OUString > m_arrContextFields
memorize the currently selected field for every context
Definition: cuifmsearch.hxx:53
std::unique_ptr< weld::CheckButton > m_pcbWildCard
Definition: cuifmsearch.hxx:76
FmSearchDialog(weld::Window *pParent, const OUString &strInitialText, const std::vector< OUString > &_rContexts, sal_Int16 nInitialContext, const Link< FmSearchContext &, sal_uInt32 > &lnkContextSupplier)
This can search in different sets of fields.
Definition: cuifmsearch.cxx:71
std::unique_ptr< weld::RadioButton > m_prbSearchForText
Definition: cuifmsearch.hxx:61
void EnableSearchForDependees(bool bEnable)
std::unique_ptr< FmSearchEngine > m_pSearchEngine
Definition: cuifmsearch.hxx:55
Dialog for searching in Forms/Tables.
Definition: cuifmsearch.hxx:39
std::unique_ptr< weld::Button > m_pbSearchAgain
Definition: cuifmsearch.hxx:85
std::unique_ptr< weld::CheckButton > m_pcbApprox
Definition: cuifmsearch.hxx:78
std::unique_ptr< weld::RadioButton > m_prbAllFields
Definition: cuifmsearch.hxx:67
void initCommon(const css::uno::Reference< css::sdbc::XResultSet > &_rxCursor)
Definition: cuifmsearch.cxx:43
std::unique_ptr< weld::CheckButton > m_pcbUseFormat
Definition: cuifmsearch.hxx:72
void InitContext(sal_Int16 nContext)
std::unique_ptr< weld::Label > m_pftHint
Definition: cuifmsearch.hxx:84
std::unique_ptr< weld::RadioButton > m_prbSearchForNotNull
Definition: cuifmsearch.hxx:63
std::unique_ptr<::svxform::FmSearchConfigItem > m_pConfig
Definition: cuifmsearch.hxx:58
OUString m_sSearch
Definition: cuifmsearch.hxx:43
virtual ~FmSearchDialog() override
void SetFoundHandler(const Link< FmFoundRecordInformation &, void > &lnk)
The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure (which i...
void Init(const OUString &strVisibleFields, const OUString &strInitialText)
void OnFound(const css::uno::Any &aCursorPos, sal_Int16 nFieldPos)
Link< FmSearchContext &, sal_uInt32 > m_lnkContextSupplier
for search in contexts
Definition: cuifmsearch.hxx:50
virtual short run() override