Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_FILTDLG_HXX
30 : : #define SC_FILTDLG_HXX
31 : :
32 : : #include <vcl/morebtn.hxx>
33 : : #include <vcl/combobox.hxx>
34 : : #include <vcl/lstbox.hxx>
35 : : #include <svtools/stdctrl.hxx>
36 : : #include "global.hxx" // -> ScQueryParam
37 : : #include "address.hxx"
38 : : #include "anyrefdg.hxx"
39 : : #include "queryparam.hxx"
40 : : #include "typedstrdata.hxx"
41 : :
42 : : #include <deque>
43 : : #include <vector>
44 : : #include <map>
45 : : #include <boost/ptr_container/ptr_map.hpp>
46 : : #include <boost/noncopyable.hpp>
47 : : #include <boost/scoped_ptr.hpp>
48 : :
49 : : //----------------------------------------------------------------------------
50 : :
51 : : class ScFilterOptionsMgr;
52 : : class ScViewData;
53 : : class ScDocument;
54 : : class ScQueryItem;
55 : :
56 : : class ScFilterDlg : public ScAnyRefDlg
57 : : {
58 : 0 : struct EntryList : boost::noncopyable
59 : : {
60 : : std::vector<ScTypedStrData> maList;
61 : : size_t mnHeaderPos;
62 : : EntryList();
63 : : };
64 : : typedef boost::ptr_map<SCCOL,EntryList> EntryListsMap;
65 : : public:
66 : : ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
67 : : const SfxItemSet& rArgSet );
68 : : ~ScFilterDlg();
69 : :
70 : : virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
71 : :
72 : : virtual sal_Bool IsRefInputMode() const;
73 : : virtual void SetActive();
74 : :
75 : : virtual sal_Bool Close();
76 : : void SliderMoved();
77 : : size_t GetSliderPos();
78 : : void RefreshEditRow( size_t nOffset );
79 : :
80 : : private:
81 : : FixedLine aFlCriteria;
82 : : //----------------------------
83 : : ListBox aLbConnect1;
84 : : ListBox aLbField1;
85 : : ListBox aLbCond1;
86 : : ComboBox aEdVal1;
87 : : //----------------------------
88 : : ListBox aLbConnect2;
89 : : ListBox aLbField2;
90 : : ListBox aLbCond2;
91 : : ComboBox aEdVal2;
92 : : //----------------------------
93 : : ListBox aLbConnect3;
94 : : ListBox aLbField3;
95 : : ListBox aLbCond3;
96 : : ComboBox aEdVal3;
97 : : //----------------------------
98 : : ListBox aLbConnect4;
99 : : ListBox aLbField4;
100 : : ListBox aLbCond4;
101 : : ComboBox aEdVal4;
102 : : //----------------------------
103 : : FixedText aFtConnect;
104 : : FixedText aFtField;
105 : : FixedText aFtCond;
106 : : FixedText aFtVal;
107 : : FixedLine aFlSeparator;
108 : :
109 : : ScrollBar aScrollBar;
110 : :
111 : : FixedLine aFlOptions;
112 : : MoreButton aBtnMore;
113 : : HelpButton aBtnHelp;
114 : : OKButton aBtnOk;
115 : : CancelButton aBtnCancel;
116 : :
117 : : CheckBox aBtnCase;
118 : : CheckBox aBtnRegExp;
119 : : CheckBox aBtnHeader;
120 : : CheckBox aBtnUnique;
121 : : CheckBox aBtnCopyResult;
122 : : ListBox aLbCopyArea;
123 : : formula::RefEdit aEdCopyArea;
124 : : formula::RefButton aRbCopyArea;
125 : : CheckBox aBtnDestPers;
126 : : FixedText aFtDbAreaLabel;
127 : : FixedInfo aFtDbArea;
128 : : const rtl::OUString aStrUndefined;
129 : : const rtl::OUString aStrNone;
130 : :
131 : : const rtl::OUString aStrEmpty;
132 : : const rtl::OUString aStrNotEmpty;
133 : : const rtl::OUString aStrRow;
134 : : const rtl::OUString aStrColumn;
135 : :
136 : : ScFilterOptionsMgr* pOptionsMgr;
137 : :
138 : : const sal_uInt16 nWhichQuery;
139 : : ScQueryParam theQueryData;
140 : : ScQueryItem* pOutItem;
141 : : ScViewData* pViewData;
142 : : ScDocument* pDoc;
143 : : SCTAB nSrcTab;
144 : :
145 : : std::vector<ComboBox*> maValueEdArr;
146 : : std::vector<ListBox*> maFieldLbArr;
147 : : std::vector<ListBox*> maCondLbArr;
148 : : std::vector<ListBox*> maConnLbArr;
149 : :
150 : : std::deque<bool> maHasDates;
151 : : std::deque<bool> maRefreshExceptQuery;
152 : : bool bRefInputMode;
153 : :
154 : : EntryListsMap maEntryLists;
155 : :
156 : : // Hack: RefInput control
157 : : Timer* pTimer;
158 : :
159 : : #ifdef _FILTDLG_CXX
160 : : private:
161 : : void Init ( const SfxItemSet& rArgSet );
162 : : void FillFieldLists ();
163 : : void FillAreaList ();
164 : : void UpdateValueList ( size_t nList );
165 : : void UpdateHdrInValueList( size_t nList );
166 : : void ClearValueList ( size_t nList );
167 : : size_t GetFieldSelPos ( SCCOL nField );
168 : : ScQueryItem* GetOutputItem ();
169 : :
170 : : // Handler:
171 : : DECL_LINK( LbSelectHdl, ListBox* );
172 : : DECL_LINK( ValModifyHdl, ComboBox* );
173 : : DECL_LINK( CheckBoxHdl, CheckBox* );
174 : : DECL_LINK( EndDlgHdl, Button* );
175 : : DECL_LINK( MoreClickHdl, void* );
176 : : DECL_LINK( ScrollHdl, void* );
177 : :
178 : : // Hack: RefInput control
179 : : DECL_LINK( TimeOutHdl, Timer* );
180 : : #endif
181 : : };
182 : :
183 : : class ScSpecialFilterDlg : public ScAnyRefDlg
184 : : {
185 : : public:
186 : : ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
187 : : const SfxItemSet& rArgSet );
188 : : ~ScSpecialFilterDlg();
189 : :
190 : : virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
191 : :
192 : : virtual sal_Bool IsRefInputMode() const;
193 : : virtual void SetActive();
194 : :
195 : : virtual sal_Bool Close();
196 : :
197 : : private:
198 : : FixedText aFtFilterArea;
199 : : ListBox aLbFilterArea;
200 : : formula::RefEdit aEdFilterArea;
201 : : formula::RefButton aRbFilterArea;
202 : :
203 : : FixedLine aFlOptions;
204 : :
205 : : CheckBox aBtnCase;
206 : : CheckBox aBtnRegExp;
207 : : CheckBox aBtnHeader;
208 : : CheckBox aBtnUnique;
209 : : CheckBox aBtnCopyResult;
210 : : ListBox aLbCopyArea;
211 : : formula::RefEdit aEdCopyArea;
212 : : formula::RefButton aRbCopyArea;
213 : : CheckBox aBtnDestPers;
214 : : FixedText aFtDbAreaLabel;
215 : : FixedInfo aFtDbArea;
216 : : const rtl::OUString aStrUndefined;
217 : : const rtl::OUString aStrNoName;
218 : :
219 : : OKButton aBtnOk;
220 : : CancelButton aBtnCancel;
221 : : HelpButton aBtnHelp;
222 : : MoreButton aBtnMore;
223 : :
224 : : ScFilterOptionsMgr* pOptionsMgr;
225 : :
226 : : const sal_uInt16 nWhichQuery;
227 : : const ScQueryParam theQueryData;
228 : : ScQueryItem* pOutItem;
229 : : ScViewData* pViewData;
230 : : ScDocument* pDoc;
231 : :
232 : : formula::RefEdit* pRefInputEdit;
233 : : bool bRefInputMode;
234 : :
235 : : // Hack: RefInput control
236 : : Timer* pTimer;
237 : :
238 : : #ifdef _SFILTDLG_CXX
239 : : private:
240 : : void Init( const SfxItemSet& rArgSet );
241 : : ScQueryItem* GetOutputItem( const ScQueryParam& rParam,
242 : : const ScRange& rSource );
243 : :
244 : : // Handler
245 : : DECL_LINK( FilterAreaSelHdl, ListBox* );
246 : : DECL_LINK( FilterAreaModHdl, formula::RefEdit* );
247 : : DECL_LINK( EndDlgHdl, Button* );
248 : : DECL_LINK( ScrollHdl, ScrollBar* );
249 : :
250 : : // Hack: RefInput control
251 : : DECL_LINK( TimeOutHdl, Timer* );
252 : : #endif
253 : : };
254 : :
255 : :
256 : :
257 : : #endif // SC_FILTDLG_HXX
258 : :
259 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|