Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / filtdlg.hxx
blob2e3e8b9303a632a5a211c482644fe685ca821742
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 <vcl/combobox.hxx>
24 #include <vcl/lstbox.hxx>
25 #include <vcl/layout.hxx>
26 #include <vcl/morebtn.hxx>
27 #include <svtools/stdctrl.hxx>
28 #include "global.hxx"
29 #include "address.hxx"
30 #include "anyrefdg.hxx"
31 #include "queryparam.hxx"
32 #include "typedstrdata.hxx"
34 #include <memory>
35 #include <deque>
36 #include <vector>
37 #include <map>
39 class ScFilterOptionsMgr;
40 class ScViewData;
41 class ScDocument;
42 class ScQueryItem;
44 class ScFilterDlg : public ScAnyRefDlg
46 struct EntryList
48 std::vector<ScTypedStrData> maList;
49 size_t mnHeaderPos;
51 EntryList(const EntryList&) = delete;
52 const EntryList& operator=(const EntryList&) = delete;
54 EntryList();
56 typedef std::map<SCCOL, std::unique_ptr<EntryList>> EntryListsMap;
57 public:
58 ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
59 const SfxItemSet& rArgSet );
60 virtual ~ScFilterDlg();
61 virtual void dispose() override;
63 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
65 virtual bool IsRefInputMode() const override;
66 virtual void SetActive() override;
68 virtual bool Close() override;
69 void SliderMoved();
70 size_t GetSliderPos();
71 void RefreshEditRow( size_t nOffset );
73 private:
74 VclPtr<ListBox> pLbConnect1;
75 VclPtr<ListBox> pLbField1;
76 VclPtr<ListBox> pLbCond1;
77 VclPtr<ComboBox> pEdVal1;
79 VclPtr<ListBox> pLbConnect2;
80 VclPtr<ListBox> pLbField2;
81 VclPtr<ListBox> pLbCond2;
82 VclPtr<ComboBox> pEdVal2;
84 VclPtr<ListBox> pLbConnect3;
85 VclPtr<ListBox> pLbField3;
86 VclPtr<ListBox> pLbCond3;
87 VclPtr<ComboBox> pEdVal3;
89 VclPtr<ListBox> pLbConnect4;
90 VclPtr<ListBox> pLbField4;
91 VclPtr<ListBox> pLbCond4;
92 VclPtr<ComboBox> pEdVal4;
94 VclPtr<ScrollBar> pScrollBar;
95 VclPtr<VclExpander> pExpander;
97 VclPtr<OKButton> pBtnOk;
98 VclPtr<CancelButton> pBtnCancel;
100 VclPtr<CheckBox> pBtnCase;
101 VclPtr<CheckBox> pBtnRegExp;
102 VclPtr<CheckBox> pBtnHeader;
103 VclPtr<CheckBox> pBtnUnique;
104 VclPtr<CheckBox> pBtnCopyResult;
105 VclPtr<ListBox> pLbCopyArea;
106 VclPtr<formula::RefEdit> pEdCopyArea;
107 VclPtr<formula::RefButton> pRbCopyArea;
108 VclPtr<CheckBox> pBtnDestPers;
109 VclPtr<FixedText> pFtDbAreaLabel;
110 VclPtr<FixedText> pFtDbArea;
111 const OUString aStrUndefined;
112 const OUString aStrNone;
114 const OUString aStrEmpty;
115 const OUString aStrNotEmpty;
116 const OUString aStrColumn;
118 ScFilterOptionsMgr* pOptionsMgr;
120 const sal_uInt16 nWhichQuery;
121 ScQueryParam theQueryData;
122 ScQueryItem* pOutItem;
123 ScViewData* pViewData;
124 ScDocument* pDoc;
125 SCTAB nSrcTab;
127 std::vector<VclPtr<ComboBox>> maValueEdArr;
128 std::vector<VclPtr<ListBox>> maFieldLbArr;
129 std::vector<VclPtr<ListBox>> maCondLbArr;
130 std::vector<VclPtr<ListBox>> maConnLbArr;
132 std::deque<bool> maHasDates;
133 std::deque<bool> maRefreshExceptQuery;
134 bool bRefInputMode;
136 EntryListsMap m_EntryLists;
138 // Hack: RefInput control
139 Timer* pTimer;
141 private:
142 void Init ( const SfxItemSet& rArgSet );
143 void FillFieldLists ();
144 void UpdateValueList ( size_t nList );
145 void UpdateHdrInValueList( size_t nList );
146 void ClearValueList ( size_t nList );
147 size_t GetFieldSelPos ( SCCOL nField );
148 ScQueryItem* GetOutputItem ();
150 // Handler:
151 DECL_LINK_TYPED( LbSelectHdl, ListBox&, void );
152 DECL_LINK_TYPED( ValModifyHdl, Edit&, void );
153 DECL_LINK_TYPED( CheckBoxHdl, Button*, void );
154 DECL_LINK_TYPED( EndDlgHdl, Button*, void );
155 DECL_LINK_TYPED( ScrollHdl, ScrollBar*, void );
156 DECL_LINK_TYPED( MoreExpandedHdl, VclExpander&, void );
158 // Hack: RefInput control
159 DECL_LINK_TYPED( TimeOutHdl, Timer*, void );
162 class ScSpecialFilterDlg : public ScAnyRefDlg
164 public:
165 ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
166 const SfxItemSet& rArgSet );
167 virtual ~ScSpecialFilterDlg();
168 virtual void dispose() override;
170 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
172 virtual bool IsRefInputMode() const override;
173 virtual void SetActive() override;
175 virtual bool Close() override;
177 private:
178 VclPtr<ListBox> pLbFilterArea;
179 VclPtr<formula::RefEdit> pEdFilterArea;
180 VclPtr<formula::RefButton> pRbFilterArea;
182 VclPtr<VclExpander> pExpander;
183 VclPtr<CheckBox> pBtnCase;
184 VclPtr<CheckBox> pBtnRegExp;
185 VclPtr<CheckBox> pBtnHeader;
186 VclPtr<CheckBox> pBtnUnique;
187 VclPtr<CheckBox> pBtnCopyResult;
188 VclPtr<ListBox> pLbCopyArea;
189 VclPtr<formula::RefEdit> pEdCopyArea;
190 VclPtr<formula::RefButton> pRbCopyArea;
191 VclPtr<CheckBox> pBtnDestPers;
192 VclPtr<FixedText> pFtDbAreaLabel;
193 VclPtr<FixedText> pFtDbArea;
194 const OUString aStrUndefined;
196 VclPtr<OKButton> pBtnOk;
197 VclPtr<CancelButton> pBtnCancel;
199 ScFilterOptionsMgr* pOptionsMgr;
201 const sal_uInt16 nWhichQuery;
202 const ScQueryParam theQueryData;
203 ScQueryItem* pOutItem;
204 ScViewData* pViewData;
205 ScDocument* pDoc;
207 VclPtr<formula::RefEdit> pRefInputEdit;
208 bool bRefInputMode;
210 // Hack: RefInput control
211 Idle* pIdle;
213 private:
214 void Init( const SfxItemSet& rArgSet );
215 ScQueryItem* GetOutputItem( const ScQueryParam& rParam,
216 const ScRange& rSource );
218 // Handler
219 DECL_LINK_TYPED( FilterAreaSelHdl, ListBox&, void );
220 DECL_LINK_TYPED( FilterAreaModHdl, Edit&, void );
221 DECL_LINK_TYPED( EndDlgHdl, Button*, void );
223 // Hack: RefInput control
224 DECL_LINK_TYPED( TimeOutHdl, Idle*, void );
227 #endif // INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */