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