LibreOffice Module sc (master) 1
filtdlg.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 <address.hxx>
23#include "anyrefdg.hxx"
24#include <queryparam.hxx>
25#include <filterentries.hxx>
26#include <queryentry.hxx>
27
28#include <memory>
29#include <deque>
30#include <vector>
31#include <map>
32
34class ScViewData;
35class ScDocument;
36class ScQueryItem;
37
39{
40 struct EntryList
41 {
44
45 EntryList(const EntryList&) = delete;
46 const EntryList& operator=(const EntryList&) = delete;
47
48 EntryList();
49 };
50 typedef std::map<SCCOL, std::unique_ptr<EntryList>> EntryListsMap;
51public:
53 const SfxItemSet& rArgSet);
54 virtual ~ScFilterDlg() override;
55
56 virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
57
58 virtual bool IsRefInputMode() const override;
59 virtual void SetActive() override;
60
61 virtual void Close() override;
62 void SliderMoved();
63 size_t GetSliderPos() const;
64 void RefreshEditRow( size_t nOffset );
65
66private:
67 const OUString aStrUndefined;
68 const OUString aStrNone;
69
70 const OUString aStrEmpty;
71 const OUString aStrNotEmpty;
72 const OUString aStrColumn;
73 const OUString aStrFontColor;
74 const OUString aStrBackgroundColor;
75
76 std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
77
78 const sal_uInt16 nWhichQuery;
80 std::unique_ptr<ScQueryItem> pOutItem;
84
85 std::vector<weld::ComboBox*> maValueEdArr;
86 std::vector<weld::ComboBox*> maFieldLbArr;
87 std::vector<weld::ComboBox*> maCondLbArr;
88 std::vector<weld::ComboBox*> maConnLbArr;
89 std::vector<weld::ComboBox*> maColorLbArr;
90 std::vector<weld::Button*> maRemoveBtnArr;
91
92 std::deque<bool> maHasDates;
93 std::deque<bool> maRefreshExceptQuery;
95
97
98 // Hack: RefInput control
99 std::unique_ptr<Timer> pTimer;
100
101 std::unique_ptr<weld::ComboBox> m_xLbConnect1;
102 std::unique_ptr<weld::ComboBox> m_xLbField1;
103 std::unique_ptr<weld::ComboBox> m_xLbCond1;
104 std::unique_ptr<weld::ComboBox> m_xEdVal1;
105 std::unique_ptr<weld::ComboBox> m_xLbColor1;
106 std::unique_ptr<weld::Button> m_xBtnRemove1;
107
108 std::unique_ptr<weld::ComboBox> m_xLbConnect2;
109 std::unique_ptr<weld::ComboBox> m_xLbField2;
110 std::unique_ptr<weld::ComboBox> m_xLbCond2;
111 std::unique_ptr<weld::ComboBox> m_xEdVal2;
112 std::unique_ptr<weld::ComboBox> m_xLbColor2;
113 std::unique_ptr<weld::Button> m_xBtnRemove2;
114
115 std::unique_ptr<weld::ComboBox> m_xLbConnect3;
116 std::unique_ptr<weld::ComboBox> m_xLbField3;
117 std::unique_ptr<weld::ComboBox> m_xLbCond3;
118 std::unique_ptr<weld::ComboBox> m_xEdVal3;
119 std::unique_ptr<weld::ComboBox> m_xLbColor3;
120 std::unique_ptr<weld::Button> m_xBtnRemove3;
121
122 std::unique_ptr<weld::ComboBox> m_xLbConnect4;
123 std::unique_ptr<weld::ComboBox> m_xLbField4;
124 std::unique_ptr<weld::ComboBox> m_xLbCond4;
125 std::unique_ptr<weld::ComboBox> m_xEdVal4;
126 std::unique_ptr<weld::ComboBox> m_xLbColor4;
127 std::unique_ptr<weld::Button> m_xBtnRemove4;
128
129 std::unique_ptr<weld::Widget> m_xContents;
130 std::unique_ptr<weld::ScrolledWindow> m_xScrollBar;
131 std::unique_ptr<weld::Expander> m_xExpander;
132
133 std::unique_ptr<weld::Button> m_xBtnClear;
134 std::unique_ptr<weld::Button> m_xBtnOk;
135 std::unique_ptr<weld::Button> m_xBtnCancel;
136
137 std::unique_ptr<weld::CheckButton> m_xBtnCase;
138 std::unique_ptr<weld::CheckButton> m_xBtnRegExp;
139 std::unique_ptr<weld::CheckButton> m_xBtnHeader;
140 std::unique_ptr<weld::CheckButton> m_xBtnUnique;
141 std::unique_ptr<weld::CheckButton> m_xBtnCopyResult;
142 std::unique_ptr<weld::ComboBox> m_xLbCopyArea;
143 std::unique_ptr<formula::RefEdit> m_xEdCopyArea;
144 std::unique_ptr<formula::RefButton> m_xRbCopyArea;
145 std::unique_ptr<weld::CheckButton> m_xBtnDestPers;
146 std::unique_ptr<weld::Label> m_xFtDbAreaLabel;
147 std::unique_ptr<weld::Label> m_xFtDbArea;
148
149private:
150 void Init ( const SfxItemSet& rArgSet );
151 void FillFieldLists ();
152 void UpdateValueList ( size_t nList );
153 void UpdateHdrInValueList( size_t nList );
154 void ClearValueList ( size_t nList );
155 void UpdateColorList ( size_t nList );
156 size_t GetFieldSelPos ( SCCOL nField );
158 void SetValString ( const OUString& rQueryStr,
159 const ScQueryEntry::Item& rItem,
160 OUString& rValStr );
161
162 // Handler:
163 DECL_LINK( LbSelectHdl, weld::ComboBox&, void );
164 DECL_LINK( ValModifyHdl, weld::ComboBox&, void );
165 DECL_LINK( CheckBoxHdl, weld::Toggleable&, void );
166 DECL_LINK( BtnClearHdl, weld::Button&, void );
167 DECL_LINK( BtnRemoveHdl, weld::Button&, void );
168 DECL_LINK( EndDlgHdl, weld::Button&, void );
169 DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
170 DECL_LINK( MoreExpandedHdl, weld::Expander&, void );
171
172 // Hack: RefInput control
173 DECL_LINK( TimeOutHdl, Timer*, void );
174};
175
177{
178public:
180 const SfxItemSet& rArgSet);
181 virtual ~ScSpecialFilterDlg() override;
182
183 virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
184
185 virtual bool IsRefInputMode() const override;
186 virtual void SetActive() override;
187
188 virtual void Close() override;
189
190private:
191 const OUString aStrUndefined;
192
193 std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
194
195 const sal_uInt16 nWhichQuery;
197 std::unique_ptr<ScQueryItem> pOutItem;
200
202
204
205 std::unique_ptr<weld::ComboBox> m_xLbFilterArea;
206 std::unique_ptr<formula::RefEdit> m_xEdFilterArea;
207 std::unique_ptr<formula::RefButton> m_xRbFilterArea;
208
209 std::unique_ptr<weld::Expander> m_xExpander;
210 std::unique_ptr<weld::CheckButton> m_xBtnCase;
211 std::unique_ptr<weld::CheckButton> m_xBtnRegExp;
212 std::unique_ptr<weld::CheckButton> m_xBtnHeader;
213 std::unique_ptr<weld::CheckButton> m_xBtnUnique;
214 std::unique_ptr<weld::CheckButton> m_xBtnCopyResult;
215 std::unique_ptr<weld::ComboBox> m_xLbCopyArea;
216 std::unique_ptr<formula::RefEdit> m_xEdCopyArea;
217 std::unique_ptr<formula::RefButton> m_xRbCopyArea;
218 std::unique_ptr<weld::CheckButton> m_xBtnDestPers;
219 std::unique_ptr<weld::Label> m_xFtDbAreaLabel;
220 std::unique_ptr<weld::Label> m_xFtDbArea;
221
222 std::unique_ptr<weld::Button> m_xBtnOk;
223 std::unique_ptr<weld::Button> m_xBtnCancel;
224
225 std::unique_ptr<weld::Frame> m_xFilterFrame;
226 std::unique_ptr<weld::Label> m_xFilterLabel;
227
228private:
229 void Init( const SfxItemSet& rArgSet );
230 ScQueryItem* GetOutputItem( const ScQueryParam& rParam,
231 const ScRange& rSource );
232
233 // Handler
234 DECL_LINK( FilterAreaSelHdl, weld::ComboBox&, void );
235 DECL_LINK( FilterAreaModHdl, formula::RefEdit&, void );
236 DECL_LINK( EndDlgHdl, weld::Button&, void );
237
238 // RefInput control
239 DECL_LINK( RefInputEditHdl, formula::RefEdit&, void );
240 DECL_LINK( RefInputButtonHdl, formula::RefButton&, void );
241 void RefInputHdl();
242};
243
244/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< formula::RefButton > m_xRbCopyArea
Definition: filtdlg.hxx:144
ScDocument * pDoc
Definition: filtdlg.hxx:82
std::unique_ptr< weld::Label > m_xFtDbAreaLabel
Definition: filtdlg.hxx:146
std::unique_ptr< weld::Expander > m_xExpander
Definition: filtdlg.hxx:131
std::unique_ptr< weld::Label > m_xFtDbArea
Definition: filtdlg.hxx:147
std::unique_ptr< weld::Button > m_xBtnClear
Definition: filtdlg.hxx:133
ScQueryParam theQueryData
Definition: filtdlg.hxx:79
ScViewData * pViewData
Definition: filtdlg.hxx:81
std::unique_ptr< weld::CheckButton > m_xBtnRegExp
Definition: filtdlg.hxx:138
std::unique_ptr< weld::ComboBox > m_xLbField4
Definition: filtdlg.hxx:123
std::unique_ptr< weld::ComboBox > m_xLbCond3
Definition: filtdlg.hxx:117
void UpdateHdrInValueList(size_t nList)
Definition: filtdlg.cxx:573
const OUString aStrFontColor
Definition: filtdlg.hxx:73
DECL_LINK(MoreExpandedHdl, weld::Expander &, void)
std::unique_ptr< weld::Button > m_xBtnRemove2
Definition: filtdlg.hxx:113
std::unique_ptr< weld::Button > m_xBtnOk
Definition: filtdlg.hxx:134
std::unique_ptr< ScFilterOptionsMgr > pOptionsMgr
Definition: filtdlg.hxx:76
DECL_LINK(CheckBoxHdl, weld::Toggleable &, void)
std::vector< weld::ComboBox * > maValueEdArr
Definition: filtdlg.hxx:85
void Init(const SfxItemSet &rArgSet)
Definition: filtdlg.cxx:164
std::unique_ptr< weld::ComboBox > m_xLbColor4
Definition: filtdlg.hxx:126
virtual ~ScFilterDlg() override
Definition: filtdlg.cxx:127
std::unique_ptr< weld::ComboBox > m_xEdVal4
Definition: filtdlg.hxx:125
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: filtdlg.hxx:137
virtual void SetActive() override
Definition: filtdlg.cxx:429
std::unique_ptr< weld::ComboBox > m_xLbColor3
Definition: filtdlg.hxx:119
std::unique_ptr< weld::ComboBox > m_xLbField2
Definition: filtdlg.hxx:109
std::unique_ptr< weld::ComboBox > m_xLbCopyArea
Definition: filtdlg.hxx:142
void SetValString(const OUString &rQueryStr, const ScQueryEntry::Item &rItem, OUString &rValStr)
Definition: filtdlg.cxx:1534
bool bRefInputMode
Definition: filtdlg.hxx:94
std::unique_ptr< weld::CheckButton > m_xBtnHeader
Definition: filtdlg.hxx:139
const OUString aStrNone
Definition: filtdlg.hxx:68
std::unique_ptr< weld::ComboBox > m_xLbConnect4
Definition: filtdlg.hxx:122
virtual bool IsRefInputMode() const override
Definition: filtdlg.cxx:734
std::vector< weld::ComboBox * > maConnLbArr
Definition: filtdlg.hxx:88
std::unique_ptr< weld::ComboBox > m_xLbConnect3
Definition: filtdlg.hxx:115
const OUString aStrEmpty
Definition: filtdlg.hxx:70
void RefreshEditRow(size_t nOffset)
Definition: filtdlg.cxx:1414
std::unique_ptr< weld::ComboBox > m_xLbCond4
Definition: filtdlg.hxx:124
std::unique_ptr< weld::ComboBox > m_xLbConnect2
Definition: filtdlg.hxx:108
std::deque< bool > maRefreshExceptQuery
Definition: filtdlg.hxx:93
EntryListsMap m_EntryLists
Definition: filtdlg.hxx:96
std::vector< weld::Button * > maRemoveBtnArr
Definition: filtdlg.hxx:90
const OUString aStrNotEmpty
Definition: filtdlg.hxx:71
std::unique_ptr< weld::CheckButton > m_xBtnCopyResult
Definition: filtdlg.hxx:141
size_t GetSliderPos() const
Definition: filtdlg.cxx:1409
ScQueryItem * GetOutputItem()
Definition: filtdlg.cxx:692
SCTAB nSrcTab
Definition: filtdlg.hxx:83
virtual void Close() override
Definition: filtdlg.cxx:407
std::unique_ptr< weld::ComboBox > m_xEdVal3
Definition: filtdlg.hxx:118
const OUString aStrBackgroundColor
Definition: filtdlg.hxx:74
std::map< SCCOL, std::unique_ptr< EntryList > > EntryListsMap
Definition: filtdlg.hxx:50
std::unique_ptr< weld::Widget > m_xContents
Definition: filtdlg.hxx:129
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: filtdlg.hxx:135
std::unique_ptr< Timer > pTimer
Definition: filtdlg.hxx:99
std::unique_ptr< weld::ComboBox > m_xLbColor1
Definition: filtdlg.hxx:105
std::unique_ptr< weld::ComboBox > m_xLbColor2
Definition: filtdlg.hxx:112
std::unique_ptr< weld::CheckButton > m_xBtnDestPers
Definition: filtdlg.hxx:145
void UpdateColorList(size_t nList)
Definition: filtdlg.cxx:631
DECL_LINK(BtnClearHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xBtnRemove1
Definition: filtdlg.hxx:106
const OUString aStrColumn
Definition: filtdlg.hxx:72
DECL_LINK(BtnRemoveHdl, weld::Button &, void)
DECL_LINK(EndDlgHdl, weld::Button &, void)
std::vector< weld::ComboBox * > maColorLbArr
Definition: filtdlg.hxx:89
std::unique_ptr< ScQueryItem > pOutItem
Definition: filtdlg.hxx:80
const OUString aStrUndefined
Definition: filtdlg.hxx:67
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
Definition: filtdlg.cxx:418
void UpdateValueList(size_t nList)
Definition: filtdlg.cxx:487
std::unique_ptr< formula::RefEdit > m_xEdCopyArea
Definition: filtdlg.hxx:143
std::unique_ptr< weld::ComboBox > m_xEdVal2
Definition: filtdlg.hxx:111
std::unique_ptr< weld::ComboBox > m_xLbField1
Definition: filtdlg.hxx:102
DECL_LINK(TimeOutHdl, Timer *, void)
std::vector< weld::ComboBox * > maFieldLbArr
Definition: filtdlg.hxx:86
std::unique_ptr< weld::ComboBox > m_xLbConnect1
Definition: filtdlg.hxx:101
std::unique_ptr< weld::Button > m_xBtnRemove4
Definition: filtdlg.hxx:127
const sal_uInt16 nWhichQuery
Definition: filtdlg.hxx:78
DECL_LINK(ValModifyHdl, weld::ComboBox &, void)
DECL_LINK(LbSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > m_xLbCond2
Definition: filtdlg.hxx:110
ScFilterDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const SfxItemSet &rArgSet)
Definition: filtdlg.cxx:53
std::vector< weld::ComboBox * > maCondLbArr
Definition: filtdlg.hxx:87
std::deque< bool > maHasDates
Definition: filtdlg.hxx:92
void ClearValueList(size_t nList)
Definition: filtdlg.cxx:619
void SliderMoved()
Definition: filtdlg.cxx:1403
size_t GetFieldSelPos(SCCOL nField)
Definition: filtdlg.cxx:684
std::unique_ptr< weld::ScrolledWindow > m_xScrollBar
Definition: filtdlg.hxx:130
std::unique_ptr< weld::ComboBox > m_xLbField3
Definition: filtdlg.hxx:116
std::unique_ptr< weld::CheckButton > m_xBtnUnique
Definition: filtdlg.hxx:140
std::unique_ptr< weld::ComboBox > m_xEdVal1
Definition: filtdlg.hxx:104
std::unique_ptr< weld::ComboBox > m_xLbCond1
Definition: filtdlg.hxx:103
std::unique_ptr< weld::Button > m_xBtnRemove3
Definition: filtdlg.hxx:120
DECL_LINK(ScrollHdl, weld::ScrolledWindow &, void)
void FillFieldLists()
Definition: filtdlg.cxx:442
virtual bool IsRefInputMode() const override
Definition: sfiltdlg.cxx:244
std::unique_ptr< formula::RefEdit > m_xEdFilterArea
Definition: filtdlg.hxx:206
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: filtdlg.hxx:223
ScQueryItem * GetOutputItem(const ScQueryParam &rParam, const ScRange &rSource)
Definition: sfiltdlg.cxx:236
DECL_LINK(FilterAreaSelHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > m_xLbCopyArea
Definition: filtdlg.hxx:215
std::unique_ptr< formula::RefButton > m_xRbFilterArea
Definition: filtdlg.hxx:207
DECL_LINK(EndDlgHdl, weld::Button &, void)
virtual void Close() override
Definition: sfiltdlg.cxx:185
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
Definition: sfiltdlg.cxx:196
void Init(const SfxItemSet &rArgSet)
Definition: sfiltdlg.cxx:113
virtual void SetActive() override
Definition: sfiltdlg.cxx:215
std::unique_ptr< ScQueryItem > pOutItem
Definition: filtdlg.hxx:197
std::unique_ptr< formula::RefButton > m_xRbCopyArea
Definition: filtdlg.hxx:217
std::unique_ptr< weld::ComboBox > m_xLbFilterArea
Definition: filtdlg.hxx:205
const ScQueryParam theQueryData
Definition: filtdlg.hxx:196
ScSpecialFilterDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const SfxItemSet &rArgSet)
Definition: sfiltdlg.cxx:53
std::unique_ptr< formula::RefEdit > m_xEdCopyArea
Definition: filtdlg.hxx:216
std::unique_ptr< weld::Label > m_xFtDbAreaLabel
Definition: filtdlg.hxx:219
DECL_LINK(RefInputButtonHdl, formula::RefButton &, void)
std::unique_ptr< weld::CheckButton > m_xBtnRegExp
Definition: filtdlg.hxx:211
ScViewData * pViewData
Definition: filtdlg.hxx:198
std::unique_ptr< weld::Frame > m_xFilterFrame
Definition: filtdlg.hxx:225
formula::RefEdit * m_pRefInputEdit
Definition: filtdlg.hxx:203
std::unique_ptr< weld::Label > m_xFtDbArea
Definition: filtdlg.hxx:220
std::unique_ptr< weld::CheckButton > m_xBtnUnique
Definition: filtdlg.hxx:213
const OUString aStrUndefined
Definition: filtdlg.hxx:191
std::unique_ptr< weld::Button > m_xBtnOk
Definition: filtdlg.hxx:222
DECL_LINK(RefInputEditHdl, formula::RefEdit &, void)
DECL_LINK(FilterAreaModHdl, formula::RefEdit &, void)
std::unique_ptr< ScFilterOptionsMgr > pOptionsMgr
Definition: filtdlg.hxx:193
std::unique_ptr< weld::CheckButton > m_xBtnCopyResult
Definition: filtdlg.hxx:214
std::unique_ptr< weld::Expander > m_xExpander
Definition: filtdlg.hxx:209
std::unique_ptr< weld::CheckButton > m_xBtnDestPers
Definition: filtdlg.hxx:218
virtual ~ScSpecialFilterDlg() override
Definition: sfiltdlg.cxx:106
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: filtdlg.hxx:210
ScDocument * pDoc
Definition: filtdlg.hxx:199
const sal_uInt16 nWhichQuery
Definition: filtdlg.hxx:195
std::unique_ptr< weld::Label > m_xFilterLabel
Definition: filtdlg.hxx:226
std::unique_ptr< weld::CheckButton > m_xBtnHeader
Definition: filtdlg.hxx:212
EntryList(const EntryList &)=delete
ScFilterEntries maFilterEntries
Definition: filtdlg.hxx:42
const EntryList & operator=(const EntryList &)=delete
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21