xref: /aoo41x/main/sc/source/ui/inc/tpsort.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_TPSORT_HXX
29 #define SC_TPSORT_HXX
30 
31 
32 #include <sfx2/tabdlg.hxx>
33 #include <vcl/edit.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <svtools/stdctrl.hxx>
37 #include <svx/langbox.hxx>
38 
39 
40 #include "global.hxx"
41 #include "address.hxx"
42 
43 //------------------------------------------------------------------------
44 
45 // +1 because one field is reserved for the "- undefined -" entry
46 #define SC_MAXFIELDS	MAXCOLCOUNT+1
47 
48 class ScViewData;
49 class ScSortDlg;
50 struct ScSortParam;
51 
52 //========================================================================
53 // Kriterien
54 
55 class ScTabPageSortFields : public SfxTabPage
56 {
57 public:
58 				ScTabPageSortFields( Window*			 pParent,
59 									 const SfxItemSet&	 rArgSet );
60 				~ScTabPageSortFields();
61 
62 	static	SfxTabPage*	Create		( Window*				pParent,
63 									  const SfxItemSet& 	rArgSet );
64 	static	sal_uInt16*		GetRanges	();
65 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
66 	virtual	void		Reset		( const SfxItemSet& rArgSet );
67 
68 protected:
69 // fuer Datenaustausch (sollte noch umgestellt werden!)
70 //	virtual void		ActivatePage	( const SfxItemSet& rSet );
71     using SfxTabPage::ActivatePage;
72     using SfxTabPage::DeactivatePage;
73 	virtual void		ActivatePage	();
74 	virtual int			DeactivatePage	( SfxItemSet* pSet = 0);
75 
76 private:
77     FixedLine       aFlSort1;
78 	ListBox			aLbSort1;
79 	RadioButton		aBtnUp1;
80 	RadioButton 	aBtnDown1;
81 
82     FixedLine       aFlSort2;
83 	ListBox			aLbSort2;
84 	RadioButton		aBtnUp2;
85 	RadioButton 	aBtnDown2;
86 
87     FixedLine       aFlSort3;
88 	ListBox			aLbSort3;
89 	RadioButton		aBtnUp3;
90 	RadioButton 	aBtnDown3;
91 
92 	String			aStrUndefined;
93 	String			aStrColumn;
94 	String			aStrRow;
95 
96 	const sal_uInt16		nWhichSort;
97 	ScSortDlg*			pDlg;
98 	ScViewData*			pViewData;
99 	const ScSortParam&	rSortData;
100 	SCCOLROW			nFieldArr[SC_MAXFIELDS];
101 	sal_uInt16				nFieldCount;
102 	SCCOL				nFirstCol;
103 	SCROW				nFirstRow;
104 	sal_Bool				bHasHeader;
105 	sal_Bool				bSortByRows;
106 
107 	ListBox*			aSortLbArr[3];
108 	RadioButton*		aDirBtnArr[3][2];
109     FixedLine*          aFlArr[3];
110 
111 #ifdef _TPSORT_CXX
112 private:
113 	void	Init			();
114 	void	DisableField	( sal_uInt16 nField );
115 	void	EnableField		( sal_uInt16 nField );
116 	void	FillFieldLists	();
117 	sal_uInt16	GetFieldSelPos	( SCCOLROW nField );
118 
119 	// Handler ------------------------
120 	DECL_LINK( SelectHdl, ListBox * );
121 #endif
122 };
123 
124 //========================================================================
125 // Sortieroptionen:
126 
127 class ScDocument;
128 class ScRangeData;
129 class CollatorRessource;
130 class CollatorWrapper;
131 
132 #if ENABLE_LAYOUT_EXPERIMENTAL
133 #include <sfx2/layout.hxx>
134 #include <layout/layout-pre.hxx>
135 #else /* !ENABLE_LAYOUT_EXPERIMENTAL */
136 #define LocalizedString String
137 #endif /* !ENABLE_LAYOUT_EXPERIMENTAL */
138 
139 class ScTabPageSortOptions : public SfxTabPage
140 {
141 public:
142 				ScTabPageSortOptions( Window*			 pParent,
143 									  const SfxItemSet&	 rArgSet );
144 				~ScTabPageSortOptions();
145 
146 #undef SfxTabPage
147 #define SfxTabPage ::SfxTabPage
148 	static	SfxTabPage*	Create		( Window*				pParent,
149 									  const SfxItemSet& 	rArgSet );
150 	static	sal_uInt16*		GetRanges	();
151 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
152 	virtual	void		Reset		( const SfxItemSet& rArgSet );
153 
154 protected:
155 // fuer Datenaustausch (sollte noch umgestellt werden!)
156 //	virtual void		ActivatePage	( const SfxItemSet& rSet );
157     using SfxTabPage::ActivatePage;
158     using SfxTabPage::DeactivatePage;
159 	virtual void		ActivatePage	();
160 	virtual int			DeactivatePage	( SfxItemSet* pSet = 0);
161 
162 private:
163 
164     CheckBox            aBtnCase;
165     CheckBox            aBtnHeader;
166     CheckBox            aBtnFormats;
167 
168     CheckBox            aBtnCopyResult;
169     ListBox             aLbOutPos;
170     Edit                aEdOutPos;
171 
172     CheckBox            aBtnSortUser;
173     ListBox             aLbSortUser;
174 
175     FixedText           aFtLanguage;
176     SvxLanguageBox      aLbLanguage;
177     FixedText           aFtAlgorithm;
178     ListBox             aLbAlgorithm;
179 
180     FixedLine           aLineDirection;
181     RadioButton         aBtnTopDown;
182     RadioButton         aBtnLeftRight;
183 
184     FixedText           aFtAreaLabel;
185 //  FixedInfo           aFtArea;
186     LocalizedString aStrRowLabel;
187     LocalizedString aStrColLabel;
188     LocalizedString aStrUndefined;
189     String              aStrNoName;
190     String              aStrAreaLabel;
191 
192 	const sal_uInt16		nWhichSort;
193 	const ScSortParam&	rSortData;
194 	ScViewData*			pViewData;
195 	ScDocument*			pDoc;
196 	ScSortDlg*			pDlg;
197 	ScAddress			theOutPos;
198 
199 	CollatorRessource*	pColRes;
200 	CollatorWrapper*	pColWrap;
201 
202 #ifdef _TPSORT_CXX
203 private:
204 	void Init					();
205 	void FillUserSortListBox	();
206 	void FillOutPosList 		();
207 
208 	// Handler ------------------------
209 	DECL_LINK( EnableHdl, CheckBox * );
210 	DECL_LINK( SelOutPosHdl, ListBox * );
211 	void EdOutPosModHdl	( Edit* pEd );
212 	DECL_LINK( SortDirHdl, RadioButton * );
213 	DECL_LINK( FillAlgorHdl, void * );
214 #endif
215 };
216 
217 #if ENABLE_LAYOUT_EXPERIMENTAL
218 #include <layout/layout-post.hxx>
219 #endif /* ENABLE_LAYOUT_EXPERIMENTAL */
220 
221 #endif // SC_TPSORT_HXX
222 
223