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