xref: /aoo42x/main/sc/source/ui/inc/tpsort.hxx (revision 38d50f7b)
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
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	sal_uInt16*		GetRanges	();
61 	virtual	sal_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 sal_uInt16		nWhichSort;
93 	ScSortDlg*			pDlg;
94 	ScViewData*			pViewData;
95 	const ScSortParam&	rSortData;
96 	SCCOLROW			nFieldArr[SC_MAXFIELDS];
97 	sal_uInt16				nFieldCount;
98 	SCCOL				nFirstCol;
99 	SCROW				nFirstRow;
100 	sal_Bool				bHasHeader;
101 	sal_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	( sal_uInt16 nField );
111 	void	EnableField		( sal_uInt16 nField );
112 	void	FillFieldLists	();
113 	sal_uInt16	GetFieldSelPos	( SCCOLROW nField );
114 
115 	// Handler ------------------------
116 	DECL_LINK( SelectHdl, ListBox * );
117 #endif
118 };
119 
120 //========================================================================
121 // Sortieroptionen:
122 
123 class ScDocument;
124 class ScRangeData;
125 class CollatorRessource;
126 class CollatorWrapper;
127 
128 #if ENABLE_LAYOUT_EXPERIMENTAL
129 #include <sfx2/layout.hxx>
130 #include <layout/layout-pre.hxx>
131 #else /* !ENABLE_LAYOUT_EXPERIMENTAL */
132 #define LocalizedString String
133 #endif /* !ENABLE_LAYOUT_EXPERIMENTAL */
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	sal_uInt16*		GetRanges	();
147 	virtual	sal_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 
164     CheckBox            aBtnCopyResult;
165     ListBox             aLbOutPos;
166     Edit                aEdOutPos;
167 
168     CheckBox            aBtnSortUser;
169     ListBox             aLbSortUser;
170 
171     FixedText           aFtLanguage;
172     SvxLanguageBox      aLbLanguage;
173     FixedText           aFtAlgorithm;
174     ListBox             aLbAlgorithm;
175 
176     FixedLine           aLineDirection;
177     RadioButton         aBtnTopDown;
178     RadioButton         aBtnLeftRight;
179 
180     FixedText           aFtAreaLabel;
181 //  FixedInfo           aFtArea;
182     LocalizedString aStrRowLabel;
183     LocalizedString aStrColLabel;
184     LocalizedString aStrUndefined;
185     String              aStrNoName;
186     String              aStrAreaLabel;
187 
188 	const sal_uInt16		nWhichSort;
189 	const ScSortParam&	rSortData;
190 	ScViewData*			pViewData;
191 	ScDocument*			pDoc;
192 	ScSortDlg*			pDlg;
193 	ScAddress			theOutPos;
194 
195 	CollatorRessource*	pColRes;
196 	CollatorWrapper*	pColWrap;
197 
198 #ifdef _TPSORT_CXX
199 private:
200 	void Init					();
201 	void FillUserSortListBox	();
202 	void FillOutPosList 		();
203 
204 	// Handler ------------------------
205 	DECL_LINK( EnableHdl, CheckBox * );
206 	DECL_LINK( SelOutPosHdl, ListBox * );
207 	void EdOutPosModHdl	( Edit* pEd );
208 	DECL_LINK( SortDirHdl, RadioButton * );
209 	DECL_LINK( FillAlgorHdl, void * );
210 #endif
211 };
212 
213 #if ENABLE_LAYOUT_EXPERIMENTAL
214 #include <layout/layout-post.hxx>
215 #endif /* ENABLE_LAYOUT_EXPERIMENTAL */
216 
217 #endif // SC_TPSORT_HXX
218 
219