Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / inc / filtdlg.hxx
blobde306709a2b6b1bc06d06f800773fdf7b8c79966
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
23 #include <address.hxx>
24 #include "anyrefdg.hxx"
25 #include <queryparam.hxx>
26 #include <filterentries.hxx>
28 #include <memory>
29 #include <deque>
30 #include <vector>
31 #include <map>
33 class ScFilterOptionsMgr;
34 class ScViewData;
35 class ScDocument;
36 class ScQueryItem;
38 class ScFilterDlg : public ScAnyRefDlgController
40 struct EntryList
42 ScFilterEntries maFilterEntries;
43 size_t mnHeaderPos;
45 EntryList(const EntryList&) = delete;
46 const EntryList& operator=(const EntryList&) = delete;
48 EntryList();
50 typedef std::map<SCCOL, std::unique_ptr<EntryList>> EntryListsMap;
51 public:
52 ScFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
53 const SfxItemSet& rArgSet);
54 virtual ~ScFilterDlg() override;
56 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
58 virtual bool IsRefInputMode() const override;
59 virtual void SetActive() override;
61 virtual void Close() override;
62 void SliderMoved();
63 size_t GetSliderPos() const;
64 void RefreshEditRow( size_t nOffset );
66 private:
67 const OUString aStrUndefined;
68 const OUString aStrNone;
70 const OUString aStrEmpty;
71 const OUString aStrNotEmpty;
72 const OUString aStrColumn;
74 std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
76 const sal_uInt16 nWhichQuery;
77 ScQueryParam theQueryData;
78 std::unique_ptr<ScQueryItem> pOutItem;
79 ScViewData* pViewData;
80 ScDocument* pDoc;
81 SCTAB nSrcTab;
83 std::vector<weld::ComboBox*> maValueEdArr;
84 std::vector<weld::ComboBox*> maFieldLbArr;
85 std::vector<weld::ComboBox*> maCondLbArr;
86 std::vector<weld::ComboBox*> maConnLbArr;
88 std::deque<bool> maHasDates;
89 std::deque<bool> maRefreshExceptQuery;
90 bool bRefInputMode;
92 EntryListsMap m_EntryLists;
94 // Hack: RefInput control
95 std::unique_ptr<Timer> pTimer;
97 std::unique_ptr<weld::ComboBox> m_xLbConnect1;
98 std::unique_ptr<weld::ComboBox> m_xLbField1;
99 std::unique_ptr<weld::ComboBox> m_xLbCond1;
100 std::unique_ptr<weld::ComboBox> m_xEdVal1;
102 std::unique_ptr<weld::ComboBox> m_xLbConnect2;
103 std::unique_ptr<weld::ComboBox> m_xLbField2;
104 std::unique_ptr<weld::ComboBox> m_xLbCond2;
105 std::unique_ptr<weld::ComboBox> m_xEdVal2;
107 std::unique_ptr<weld::ComboBox> m_xLbConnect3;
108 std::unique_ptr<weld::ComboBox> m_xLbField3;
109 std::unique_ptr<weld::ComboBox> m_xLbCond3;
110 std::unique_ptr<weld::ComboBox> m_xEdVal3;
112 std::unique_ptr<weld::ComboBox> m_xLbConnect4;
113 std::unique_ptr<weld::ComboBox> m_xLbField4;
114 std::unique_ptr<weld::ComboBox> m_xLbCond4;
115 std::unique_ptr<weld::ComboBox> m_xEdVal4;
117 std::unique_ptr<weld::Widget> m_xContents;
118 std::unique_ptr<weld::ScrolledWindow> m_xScrollBar;
119 std::unique_ptr<weld::Expander> m_xExpander;
121 std::unique_ptr<weld::Button> m_xBtnOk;
122 std::unique_ptr<weld::Button> m_xBtnCancel;
124 std::unique_ptr<weld::CheckButton> m_xBtnCase;
125 std::unique_ptr<weld::CheckButton> m_xBtnRegExp;
126 std::unique_ptr<weld::CheckButton> m_xBtnHeader;
127 std::unique_ptr<weld::CheckButton> m_xBtnUnique;
128 std::unique_ptr<weld::CheckButton> m_xBtnCopyResult;
129 std::unique_ptr<weld::ComboBox> m_xLbCopyArea;
130 std::unique_ptr<formula::RefEdit> m_xEdCopyArea;
131 std::unique_ptr<formula::RefButton> m_xRbCopyArea;
132 std::unique_ptr<weld::CheckButton> m_xBtnDestPers;
133 std::unique_ptr<weld::Label> m_xFtDbAreaLabel;
134 std::unique_ptr<weld::Label> m_xFtDbArea;
136 private:
137 void Init ( const SfxItemSet& rArgSet );
138 void FillFieldLists ();
139 void UpdateValueList ( size_t nList );
140 void UpdateHdrInValueList( size_t nList );
141 void ClearValueList ( size_t nList );
142 size_t GetFieldSelPos ( SCCOL nField );
143 ScQueryItem* GetOutputItem ();
145 // Handler:
146 DECL_LINK( LbSelectHdl, weld::ComboBox&, void );
147 DECL_LINK( ValModifyHdl, weld::ComboBox&, void );
148 DECL_LINK( CheckBoxHdl, weld::Button&, void );
149 DECL_LINK( EndDlgHdl, weld::Button&, void );
150 DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
151 DECL_LINK( MoreExpandedHdl, weld::Expander&, void );
153 // Hack: RefInput control
154 DECL_LINK( TimeOutHdl, Timer*, void );
157 class ScSpecialFilterDlg : public ScAnyRefDlgController
159 public:
160 ScSpecialFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
161 const SfxItemSet& rArgSet);
162 virtual ~ScSpecialFilterDlg() override;
164 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
166 virtual bool IsRefInputMode() const override;
167 virtual void SetActive() override;
169 virtual void Close() override;
171 private:
172 const OUString aStrUndefined;
174 std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
176 const sal_uInt16 nWhichQuery;
177 const ScQueryParam theQueryData;
178 std::unique_ptr<ScQueryItem> pOutItem;
179 ScViewData* pViewData;
180 ScDocument* pDoc;
182 bool bRefInputMode;
184 formula::RefEdit* m_pRefInputEdit;
186 std::unique_ptr<weld::ComboBox> m_xLbFilterArea;
187 std::unique_ptr<formula::RefEdit> m_xEdFilterArea;
188 std::unique_ptr<formula::RefButton> m_xRbFilterArea;
190 std::unique_ptr<weld::Expander> m_xExpander;
191 std::unique_ptr<weld::CheckButton> m_xBtnCase;
192 std::unique_ptr<weld::CheckButton> m_xBtnRegExp;
193 std::unique_ptr<weld::CheckButton> m_xBtnHeader;
194 std::unique_ptr<weld::CheckButton> m_xBtnUnique;
195 std::unique_ptr<weld::CheckButton> m_xBtnCopyResult;
196 std::unique_ptr<weld::ComboBox> m_xLbCopyArea;
197 std::unique_ptr<formula::RefEdit> m_xEdCopyArea;
198 std::unique_ptr<formula::RefButton> m_xRbCopyArea;
199 std::unique_ptr<weld::CheckButton> m_xBtnDestPers;
200 std::unique_ptr<weld::Label> m_xFtDbAreaLabel;
201 std::unique_ptr<weld::Label> m_xFtDbArea;
203 std::unique_ptr<weld::Button> m_xBtnOk;
204 std::unique_ptr<weld::Button> m_xBtnCancel;
206 std::unique_ptr<weld::Frame> m_xFilterFrame;
207 std::unique_ptr<weld::Label> m_xFilterLabel;
209 private:
210 void Init( const SfxItemSet& rArgSet );
211 ScQueryItem* GetOutputItem( const ScQueryParam& rParam,
212 const ScRange& rSource );
214 // Handler
215 DECL_LINK( FilterAreaSelHdl, weld::ComboBox&, void );
216 DECL_LINK( FilterAreaModHdl, formula::RefEdit&, void );
217 DECL_LINK( EndDlgHdl, weld::Button&, void );
219 // RefInput control
220 DECL_LINK( RefInputEditHdl, formula::RefEdit&, void );
221 DECL_LINK( RefInputButtonHdl, formula::RefButton&, void );
222 void RefInputHdl();
225 #endif // INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */