xref: /trunk/main/sc/source/ui/inc/filtdlg.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_FILTDLG_HXX
25 #define SC_FILTDLG_HXX
26 
27 #ifndef _MOREBTN_HXX //autogen
28 #include <vcl/morebtn.hxx>
29 #endif
30 #ifndef _COMBOBOX_HXX //autogen
31 #include <vcl/combobox.hxx>
32 #endif
33 #ifndef _LSTBOX_HXX //autogen
34 #include <vcl/lstbox.hxx>
35 #endif
36 #include <svtools/stdctrl.hxx>
37 #include "global.hxx" // -> ScQueryParam
38 #include "address.hxx"
39 #include "anyrefdg.hxx"
40 
41 
42 //----------------------------------------------------------------------------
43 
44 class ScFilterOptionsMgr;
45 class ScRangeData;
46 class ScViewData;
47 class ScDocument;
48 class ScQueryItem;
49 class TypedScStrCollection;
50 
51 //==================================================================
52 // Gemeinsame Resource-Objekte:
53 
54 #define _COMMON_FILTER_RSCOBJS \
55 	CheckBox		aBtnCase; \
56 	CheckBox		aBtnRegExp; \
57 	CheckBox		aBtnHeader; \
58 	CheckBox		aBtnUnique; \
59 	CheckBox		aBtnCopyResult; \
60 	ListBox			aLbCopyArea; \
61 	formula::RefEdit		aEdCopyArea; \
62 	formula::RefButton		aRbCopyArea; \
63 	CheckBox		aBtnDestPers; \
64 	FixedText		aFtDbAreaLabel; \
65 	FixedInfo		aFtDbArea; \
66 	const String	aStrUndefined; \
67 	const String	aStrNoName; \
68 	const String	aStrNone;
69 
70 
71 #define _INIT_COMMON_FILTER_RSCOBJS \
72 	aBtnCase		( this, ScResId( BTN_CASE ) ), \
73 	aBtnRegExp		( this, ScResId( BTN_REGEXP ) ), \
74 	aBtnHeader		( this, ScResId( BTN_HEADER ) ), \
75 	aBtnUnique		( this, ScResId( BTN_UNIQUE ) ), \
76 	aBtnCopyResult	( this, ScResId( BTN_COPY_RESULT ) ), \
77 	aLbCopyArea		( this, ScResId( LB_COPY_AREA ) ), \
78     aEdCopyArea     ( this, this, ScResId( ED_COPY_AREA ) ), \
79 	aRbCopyArea		( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, this ), \
80 	aBtnDestPers	( this, ScResId( BTN_DEST_PERS ) ), \
81 	aFtDbAreaLabel	( this, ScResId( FT_DBAREA_LABEL ) ), \
82 	aFtDbArea		( this, ScResId( FT_DBAREA ) ), \
83 	aStrUndefined	( ScResId( SCSTR_UNDEFINED ) ), \
84 	aStrNoName		( ScGlobal::GetRscString(STR_DB_NONAME) ), \
85 	aStrNone		( ScResId( SCSTR_NONE ) ),
86 
87 
88 //============================================================================
89 class ScFilterDlg : public ScAnyRefDlg
90 {
91 public:
92 					ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
93 								 const SfxItemSet&	rArgSet );
94 					~ScFilterDlg();
95 
96 	virtual void	SetReference( const ScRange& rRef, ScDocument* pDoc );
97 
98 	virtual sal_Bool	IsRefInputMode() const;
99 	virtual void	SetActive();
100 
101 	virtual sal_Bool	Close();
102 	void			SliderMoved();
103 	sal_uInt16			GetSliderPos();
104 	void			RefreshEditRow( sal_uInt16 nOffset );
105 
106 private:
107     FixedLine       aFlCriteria;
108 	//----------------------------
109 	ListBox			aLbConnect1;
110 	ListBox			aLbField1;
111 	ListBox			aLbCond1;
112 	ComboBox		aEdVal1;
113 	//----------------------------
114 	ListBox			aLbConnect2;
115 	ListBox			aLbField2;
116 	ListBox			aLbCond2;
117 	ComboBox		aEdVal2;
118 	//----------------------------
119 	ListBox			aLbConnect3;
120 	ListBox			aLbField3;
121 	ListBox			aLbCond3;
122 	ComboBox		aEdVal3;
123 	//----------------------------
124 	ListBox			aLbConnect4;
125 	ListBox			aLbField4;
126 	ListBox			aLbCond4;
127 	ComboBox		aEdVal4;
128 	//----------------------------
129 	FixedText		aFtConnect;
130 	FixedText		aFtField;
131 	FixedText		aFtCond;
132 	FixedText		aFtVal;
133 	FixedLine       aFlSeparator;
134 
135 	ScrollBar       aScrollBar;
136 
137     FixedLine       aFlOptions;
138     MoreButton      aBtnMore;
139     HelpButton      aBtnHelp;
140     OKButton        aBtnOk;
141     CancelButton    aBtnCancel;
142 
143 	_COMMON_FILTER_RSCOBJS
144 
145 	const String	aStrEmpty;
146 	const String	aStrNotEmpty;
147 	const String	aStrRow;
148 	const String	aStrColumn;
149 
150 	ScFilterOptionsMgr*	pOptionsMgr;
151 
152 	const sal_uInt16		nWhichQuery;
153 	const ScQueryParam	theQueryData;
154 	ScQueryItem*		pOutItem;
155 	ScViewData*			pViewData;
156 	ScDocument*			pDoc;
157 	SCTAB				nSrcTab;
158 
159 	ComboBox*			aValueEdArr[4];
160 	ListBox*			aFieldLbArr[4];
161 	ListBox*			aCondLbArr[4];
162 	ListBox*			aConnLbArr[4];
163     bool                mbHasDates[MAXQUERY];
164 	sal_Bool                bRefreshExceptQuery[MAXQUERY];
165 	sal_uInt16				nFieldCount;
166 	sal_Bool				bRefInputMode;
167 
168 	TypedScStrCollection*	pEntryLists[MAXCOLCOUNT];
169 	sal_uInt16				nHeaderPos[MAXCOLCOUNT];
170 
171 	// Hack: RefInput-Kontrolle
172 	Timer*	pTimer;
173 
174 #ifdef _FILTDLG_CXX
175 private:
176 	void			Init			( const SfxItemSet&	rArgSet );
177 	void			FillFieldLists	();
178 	void			FillAreaList	();
179 	void			UpdateValueList	( sal_uInt16 nList );
180 	void			UpdateHdrInValueList( sal_uInt16 nList );
181 	void			ClearValueList	( sal_uInt16 nList );
182 	sal_uInt16			GetFieldSelPos	( SCCOL nField );
183 	ScQueryItem*	GetOutputItem	();
184 
185 	// Handler:
186 	DECL_LINK( LbSelectHdl,	 ListBox* );
187 	DECL_LINK( ValModifyHdl, ComboBox* );
188 	DECL_LINK( CheckBoxHdl,	 CheckBox* );
189 	DECL_LINK( EndDlgHdl,	 Button* );
190 	DECL_LINK( MoreClickHdl, MoreButton* );
191 	DECL_LINK( ScrollHdl, ScrollBar* );
192 
193 	// Hack: RefInput-Kontrolle
194 	DECL_LINK( TimeOutHdl,	 Timer* );
195 #endif
196 };
197 
198 
199 //============================================================================
200 class ScSpecialFilterDlg : public ScAnyRefDlg
201 {
202 public:
203 					ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
204 										const SfxItemSet&	rArgSet );
205 					~ScSpecialFilterDlg();
206 
207 	virtual void	SetReference( const ScRange& rRef, ScDocument* pDoc );
208 
209 	virtual sal_Bool	IsRefInputMode() const;
210 	virtual void	SetActive();
211 
212 	virtual sal_Bool	Close();
213 
214 private:
215 	FixedText	aFtFilterArea;
216 	ListBox		aLbFilterArea;
217 	formula::RefEdit	aEdFilterArea;
218 	formula::RefButton	aRbFilterArea;
219 
220     FixedLine       aFlOptions;
221 
222 	_COMMON_FILTER_RSCOBJS
223 
224     OKButton        aBtnOk;
225     CancelButton    aBtnCancel;
226     HelpButton      aBtnHelp;
227     MoreButton      aBtnMore;
228 
229 	ScFilterOptionsMgr*	pOptionsMgr;
230 
231 	const sal_uInt16		nWhichQuery;
232 	const ScQueryParam	theQueryData;
233 	ScQueryItem*		pOutItem;
234 	ScViewData*			pViewData;
235 	ScDocument*			pDoc;
236 
237 	formula::RefEdit*			pRefInputEdit;
238 	sal_Bool				bRefInputMode;
239 
240 	// Hack: RefInput-Kontrolle
241 	Timer*	pTimer;
242 
243 #ifdef _SFILTDLG_CXX
244 private:
245 	void			Init( const SfxItemSet& rArgSet );
246 	ScQueryItem*	GetOutputItem( const ScQueryParam& rParam,
247 									const ScRange& rSource );
248 
249 	// Handler
250 	DECL_LINK( FilterAreaSelHdl, ListBox* );
251 	DECL_LINK( FilterAreaModHdl, formula::RefEdit* );
252 	DECL_LINK( EndDlgHdl,		 Button* );
253 	DECL_LINK( ScrollHdl, ScrollBar* );
254 
255 	// Hack: RefInput-Kontrolle
256 	DECL_LINK( TimeOutHdl,		 Timer* );
257 #endif
258 };
259 
260 
261 
262 #endif // SC_FILTDLG_HXX
263 
264