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
29namespace svxform
30{
31class FmSearchConfigItem;
32}
33
34struct FmSearchProgress;
35
36class 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
88public:
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
135private:
136 void Init(std::u16string_view 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(OnToggledSearchRadio, weld::Toggleable&, void);
152 DECL_LINK(OnToggledFieldRadios, weld::Toggleable&, void);
153 DECL_LINK(OnClickedSearchAgain, weld::Button&, void);
154 DECL_LINK(OnClickedSpecialSettings, weld::Button&, void);
155
156 DECL_LINK(OnSearchTextModified, weld::ComboBox&, void);
157
158 DECL_LINK(OnPositionSelected, weld::ComboBox&, void);
159 DECL_LINK(OnFieldSelected, weld::ComboBox&, void);
160
161 DECL_LINK(OnFocusGrabbed, weld::Widget&, void);
162 DECL_LINK(OnCheckBoxToggled, weld::Toggleable&, void);
163
164 DECL_LINK(OnContextSelection, weld::ComboBox&, void);
165
166 DECL_LINK(OnSearchProgress, const FmSearchProgress*, void);
167
168 void initCommon(const css::uno::Reference<css::sdbc::XResultSet>& _rxCursor);
169};
170
171inline void FmSearchDialog::SetActiveField(const OUString& strField)
172{
173 int nInitialField = m_plbField->find_text(strField);
174 if (nInitialField == -1)
175 nInitialField = 0;
176 m_plbField->set_active(nInitialField);
177 OnFieldSelected(*m_plbField);
178}
179
180/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Dialog for searching in Forms/Tables.
Definition: cuifmsearch.hxx:40
std::unique_ptr< weld::Button > m_ppbApproxSettings
Definition: cuifmsearch.hxx:79
DECL_LINK(OnToggledFieldRadios, weld::Toggleable &, void)
std::unique_ptr< weld::Button > m_pbSearchAgain
Definition: cuifmsearch.hxx:85
std::unique_ptr< weld::CheckButton > m_pcbWildCard
Definition: cuifmsearch.hxx:76
void SetFoundHandler(const Link< FmFoundRecordInformation &, void > &lnk)
The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure (which i...
DECL_LINK(OnClickedSpecialSettings, weld::Button &, void)
void InitContext(sal_Int16 nContext)
std::unique_ptr< weld::Label > m_pftForm
Definition: cuifmsearch.hxx:65
std::unique_ptr< weld::CheckButton > m_pcbStartOver
Definition: cuifmsearch.hxx:75
DECL_LINK(OnToggledSearchRadio, weld::Toggleable &, void)
std::unique_ptr< weld::RadioButton > m_prbSingleField
Definition: cuifmsearch.hxx:68
OUString m_sCancel
Definition: cuifmsearch.hxx:44
std::unique_ptr< weld::CheckButton > m_pcbBackwards
Definition: cuifmsearch.hxx:74
void OnFound(const css::uno::Any &aCursorPos, sal_Int16 nFieldPos)
DECL_LINK(OnSearchProgress, const FmSearchProgress *, void)
void SaveParams() const
void EnableSearchForDependees(bool bEnable)
std::unique_ptr< weld::ComboBox > m_plbForm
Definition: cuifmsearch.hxx:66
DECL_LINK(OnSearchTextModified, weld::ComboBox &, void)
DECL_LINK(OnFieldSelected, weld::ComboBox &, void)
void SetActiveField(const OUString &strField)
DECL_LINK(OnContextSelection, weld::ComboBox &, void)
std::unique_ptr< weld::CheckButton > m_pcbApprox
Definition: cuifmsearch.hxx:78
std::unique_ptr< weld::CheckButton > m_pcbRegular
Definition: cuifmsearch.hxx:77
std::unique_ptr< weld::CheckButton > m_pcbCase
Definition: cuifmsearch.hxx:73
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::CheckButton > m_pHalfFullFormsCJK
Definition: cuifmsearch.hxx:80
DECL_LINK(OnPositionSelected, weld::ComboBox &, void)
virtual short run() override
std::unique_ptr<::svxform::FmSearchConfigItem > m_pConfig
Definition: cuifmsearch.hxx:58
void initCommon(const css::uno::Reference< css::sdbc::XResultSet > &_rxCursor)
Definition: cuifmsearch.cxx:44
std::unique_ptr< weld::RadioButton > m_prbSearchForNotNull
Definition: cuifmsearch.hxx:63
DECL_LINK(OnCheckBoxToggled, weld::Toggleable &, void)
void EnableSearchUI(bool bEnable)
DECL_LINK(OnFocusGrabbed, weld::Widget &, void)
OUString m_sSearch
Definition: cuifmsearch.hxx:43
std::unique_ptr< weld::Label > m_pftHint
Definition: cuifmsearch.hxx:84
std::unique_ptr< weld::ComboBox > m_plbPosition
Definition: cuifmsearch.hxx:71
void Init(std::u16string_view strVisibleFields, const OUString &strInitialText)
Link< FmFoundRecordInformation &, void > m_lnkFoundHandler
Handler for "found".
Definition: cuifmsearch.hxx:46
DECL_LINK(OnClickedSearchAgain, weld::Button &, void)
std::unique_ptr< weld::RadioButton > m_prbAllFields
Definition: cuifmsearch.hxx:67
std::unique_ptr< weld::CheckButton > m_pSoundsLikeCJK
Definition: cuifmsearch.hxx:81
Link< FmFoundRecordInformation &, void > m_lnkCanceledNotFoundHdl
Handler for Positioning the Cursors.
Definition: cuifmsearch.hxx:48
std::unique_ptr< weld::Label > m_pftPosition
Definition: cuifmsearch.hxx:70
std::unique_ptr< weld::Button > m_pbClose
Definition: cuifmsearch.hxx:86
std::unique_ptr< weld::CheckButton > m_pcbUseFormat
Definition: cuifmsearch.hxx:72
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
virtual ~FmSearchDialog() override
std::unique_ptr< FmSearchEngine > m_pSearchEngine
Definition: cuifmsearch.hxx:55
std::unique_ptr< weld::Button > m_pSoundsLikeCJKSettings
Definition: cuifmsearch.hxx:82
std::unique_ptr< weld::RadioButton > m_prbSearchForText
Definition: cuifmsearch.hxx:61
std::vector< OUString > m_arrContextFields
memorize the currently selected field for every context
Definition: cuifmsearch.hxx:53
Link< FmSearchContext &, sal_uInt32 > m_lnkContextSupplier
for search in contexts
Definition: cuifmsearch.hxx:50
std::unique_ptr< weld::ComboBox > m_plbField
Definition: cuifmsearch.hxx:69
std::unique_ptr< weld::ComboBox > m_pcmbSearchText
Definition: cuifmsearch.hxx:64
std::unique_ptr< weld::RadioButton > m_prbSearchForNull
Definition: cuifmsearch.hxx:62
std::unique_ptr< weld::Label > m_pftRecord
Definition: cuifmsearch.hxx:83