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