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