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