1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <address.hxx>
23 #include "anyrefdg.hxx"
24 #include <queryparam.hxx>
25 #include <filterentries.hxx>
26 #include <queryentry.hxx>
33 class ScFilterOptionsMgr
;
38 class ScFilterDlg
: public ScAnyRefDlgController
42 ScFilterEntries maFilterEntries
;
45 EntryList(const EntryList
&) = delete;
46 const EntryList
& operator=(const EntryList
&) = delete;
50 typedef std::map
<SCCOL
, std::unique_ptr
<EntryList
>> EntryListsMap
;
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
& rDoc
) override
;
58 virtual bool IsRefInputMode() const override
;
59 virtual void SetActive() override
;
61 virtual void Close() override
;
63 size_t GetSliderPos() const;
64 void RefreshEditRow( size_t nOffset
);
67 const OUString aStrUndefined
;
68 const OUString aStrNone
;
70 const OUString aStrEmpty
;
71 const OUString aStrNotEmpty
;
72 const OUString aStrColumn
;
73 const OUString aStrFontColor
;
74 const OUString aStrBackgroundColor
;
76 std::unique_ptr
<ScFilterOptionsMgr
> pOptionsMgr
;
78 const sal_uInt16 nWhichQuery
;
79 ScQueryParam theQueryData
;
80 std::unique_ptr
<ScQueryItem
> pOutItem
;
81 ScViewData
* pViewData
;
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
;
92 std::deque
<bool> maHasDates
;
93 std::deque
<bool> maRefreshExceptQuery
;
96 EntryListsMap m_EntryLists
;
98 // Hack: RefInput control
99 std::unique_ptr
<Timer
> pTimer
;
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
;
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
;
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
;
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
;
129 std::unique_ptr
<weld::Widget
> m_xContents
;
130 std::unique_ptr
<weld::ScrolledWindow
> m_xScrollBar
;
131 std::unique_ptr
<weld::Expander
> m_xExpander
;
133 std::unique_ptr
<weld::Button
> m_xBtnClear
;
134 std::unique_ptr
<weld::Button
> m_xBtnOk
;
135 std::unique_ptr
<weld::Button
> m_xBtnCancel
;
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
;
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
);
157 ScQueryItem
* GetOutputItem ();
158 void SetValString ( const OUString
& rQueryStr
,
159 const ScQueryEntry::Item
& rItem
,
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 );
172 // Hack: RefInput control
173 DECL_LINK( TimeOutHdl
, Timer
*, void );
176 class ScSpecialFilterDlg
: public ScAnyRefDlgController
179 ScSpecialFilterDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
, weld::Window
* pParent
,
180 const SfxItemSet
& rArgSet
);
181 virtual ~ScSpecialFilterDlg() override
;
183 virtual void SetReference( const ScRange
& rRef
, ScDocument
& rDoc
) override
;
185 virtual bool IsRefInputMode() const override
;
186 virtual void SetActive() override
;
188 virtual void Close() override
;
191 const OUString aStrUndefined
;
193 std::unique_ptr
<ScFilterOptionsMgr
> pOptionsMgr
;
195 const sal_uInt16 nWhichQuery
;
196 const ScQueryParam theQueryData
;
197 std::unique_ptr
<ScQueryItem
> pOutItem
;
198 ScViewData
* pViewData
;
203 formula::RefEdit
* m_pRefInputEdit
;
205 std::unique_ptr
<weld::ComboBox
> m_xLbFilterArea
;
206 std::unique_ptr
<formula::RefEdit
> m_xEdFilterArea
;
207 std::unique_ptr
<formula::RefButton
> m_xRbFilterArea
;
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
;
222 std::unique_ptr
<weld::Button
> m_xBtnOk
;
223 std::unique_ptr
<weld::Button
> m_xBtnCancel
;
225 std::unique_ptr
<weld::Frame
> m_xFilterFrame
;
226 std::unique_ptr
<weld::Label
> m_xFilterLabel
;
229 void Init( const SfxItemSet
& rArgSet
);
230 ScQueryItem
* GetOutputItem( const ScQueryParam
& rParam
,
231 const ScRange
& rSource
);
234 DECL_LINK( FilterAreaSelHdl
, weld::ComboBox
&, void );
235 DECL_LINK( FilterAreaModHdl
, formula::RefEdit
&, void );
236 DECL_LINK( EndDlgHdl
, weld::Button
&, void );
239 DECL_LINK( RefInputEditHdl
, formula::RefEdit
&, void );
240 DECL_LINK( RefInputButtonHdl
, formula::RefButton
&, void );
244 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */