xref: /aoo42x/main/toolkit/workben/layout/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 (Sort Criteria)
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	USHORT*		GetRanges	();
65 	virtual	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 USHORT		nWhichSort;
97 	ScSortDlg*			pDlg;
98 	ScViewData*			pViewData;
99 	const ScSortParam&	rSortData;
100 	SCCOLROW			nFieldArr[SC_MAXFIELDS];
101 	USHORT				nFieldCount;
102 	SCCOL				nFirstCol;
103 	SCROW				nFirstRow;
104 	BOOL				bHasHeader;
105 	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	( USHORT nField );
115 	void	EnableField		( USHORT nField );
116 	void	FillFieldLists	();
117 	USHORT	GetFieldSelPos	( SCCOLROW nField );
118 
119 	// Handler ------------------------
120 	DECL_LINK( SelectHdl, ListBox * );
121 #endif
122 };
123 
124 //========================================================================
125 // Sortieroptionen (Sort Options)
126 
127 class ScDocument;
128 class ScRangeData;
129 class CollatorRessource;
130 class CollatorWrapper;
131 
132 #include <sfx2/layout.hxx>
133 #include <layout/layout-pre.hxx>
134 
135 class ScTabPageSortOptions : public SfxTabPage
136 {
137 public:
138 				ScTabPageSortOptions( Window*			 pParent,
139 									  const SfxItemSet&	 rArgSet );
140 				~ScTabPageSortOptions();
141 
142 #undef SfxTabPage
143 #define SfxTabPage ::SfxTabPage
144 	static	SfxTabPage*	Create		( Window*				pParent,
145 									  const SfxItemSet& 	rArgSet );
146 	static	USHORT*		GetRanges	();
147 	virtual	BOOL		FillItemSet	( SfxItemSet& rArgSet );
148 	virtual	void		Reset		( const SfxItemSet& rArgSet );
149 
150 protected:
151 // fuer Datenaustausch (sollte noch umgestellt werden!)
152 //	virtual void		ActivatePage	( const SfxItemSet& rSet );
153     using SfxTabPage::ActivatePage;
154     using SfxTabPage::DeactivatePage;
155 	virtual void		ActivatePage	();
156 	virtual int			DeactivatePage	( SfxItemSet* pSet = 0);
157 
158 private:
159 
160     CheckBox            aBtnCase;
161     CheckBox            aBtnHeader;
162     CheckBox            aBtnFormats;
163     CheckBox            aBtnCopyResult;
164 
165     CheckBox			aBtnNaturalSort;
166     ListBox             aLbOutPos;
167     Edit                aEdOutPos;
168 
169     CheckBox            aBtnSortUser;
170     ListBox             aLbSortUser;
171 
172     FixedText           aFtLanguage;
173     SvxLanguageBox      aLbLanguage;
174     FixedText           aFtAlgorithm;
175     ListBox             aLbAlgorithm;
176 
177     FixedLine           aLineDirection;
178     RadioButton         aBtnTopDown;
179     RadioButton         aBtnLeftRight;
180 
181 //     FixedText           aFtAreaLabel;
182 //  FixedInfo           aFtArea;
183     LocalizedString aStrRowLabel;
184     LocalizedString aStrColLabel;
185     LocalizedString aStrUndefined;
186     String              aStrNoName;
187     String              aStrAreaLabel;
188 
189 	const USHORT		nWhichSort;
190 	const ScSortParam&	rSortData;
191 	ScViewData*			pViewData;
192 	ScDocument*			pDoc;
193 	ScSortDlg*			pDlg;
194 	ScAddress			theOutPos;
195 
196 	CollatorRessource*	pColRes;
197 	CollatorWrapper*	pColWrap;
198 
199 #ifdef _TPSORT_CXX
200 private:
201 	void Init					();
202 	void FillUserSortListBox	();
203 	void FillOutPosList 		();
204 
205 	// Handler ------------------------
206 	DECL_LINK( EnableHdl, CheckBox * );
207 	DECL_LINK( SelOutPosHdl, ListBox * );
208 	void EdOutPosModHdl	( Edit* pEd );
209 	DECL_LINK( SortDirHdl, RadioButton * );
210 	DECL_LINK( FillAlgorHdl, void * );
211 #endif
212 };
213 
214 #include <layout/layout-post.hxx>
215 
216 #endif // SC_TPSORT_HXX
217 
218