xref: /aoo42x/main/sc/source/ui/inc/tpsubt.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_TPSUBT_HXX
29 #define SC_TPSUBT_HXX
30 
31 #include <sfx2/tabdlg.hxx>
32 #include <svx/checklbx.hxx>
33 #include <vcl/fixed.hxx>
34 #include "global.hxx"
35 
36 //------------------------------------------------------------------------
37 
38 // +1 because one field is reserved for the "- none -" entry
39 #define SC_MAXFIELDS	MAXCOLCOUNT+1
40 
41 class ScViewData;
42 class ScDocument;
43 
44 //========================================================================
45 // Gruppenseiten: Basisklasse
46 
47 class ScTpSubTotalGroup : public SfxTabPage
48 {
49 protected:
50 			ScTpSubTotalGroup( Window* pParent, sal_uInt16 nResId,
51 							   const SfxItemSet& rArgSet );
52 
53 public:
54 	virtual ~ScTpSubTotalGroup();
55 
56 	static sal_uInt16*	GetRanges		();
57 	sal_Bool			DoReset			( sal_uInt16			nGroupNo,
58 									  const SfxItemSet&	rArgSet  );
59 	sal_Bool			DoFillItemSet	( sal_uInt16		nGroupNo,
60 									  SfxItemSet&	rArgSet  );
61 protected:
62 	FixedText		aFtGroup;
63 	ListBox			aLbGroup;
64 	FixedText		aFtColumns;
65 	SvxCheckListBox	aLbColumns;
66 	FixedText		aFtFunctions;
67 	ListBox			aLbFunctions;
68 	const String	aStrNone;
69 	const String	aStrColumn;
70 
71 	ScViewData*				pViewData;
72 	ScDocument*				pDoc;
73 
74 	const sal_uInt16			nWhichSubTotals;
75 	const ScSubTotalParam&	rSubTotalData;
76 	SCCOL					nFieldArr[SC_MAXFIELDS];
77 	const sal_uInt16			nFieldCount;
78 
79 private:
80 	void 			Init			();
81 	void 			FillListBoxes	();
82 	ScSubTotalFunc	LbPosToFunc		( sal_uInt16 nPos );
83 	sal_uInt16			FuncToLbPos		( ScSubTotalFunc eFunc );
84 	sal_uInt16			GetFieldSelPos	( SCCOL nField );
85 
86 	// Handler ------------------------
87 	DECL_LINK( SelectHdl, ListBox * );
88 	DECL_LINK( CheckHdl, ListBox * );
89 };
90 
91 //------------------------------------------------------------------------
92 
93 class ScTpSubTotalGroup1 : public ScTpSubTotalGroup
94 {
95 protected:
96 			ScTpSubTotalGroup1( Window*				 pParent,
97 								const SfxItemSet&	 rArgSet );
98 
99 public:
100 	virtual ~ScTpSubTotalGroup1();
101 
102 	static	SfxTabPage*	Create		( Window*				pParent,
103 									  const SfxItemSet& 	rArgSet );
104 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
105 	virtual	void		Reset		( const SfxItemSet& rArgSet );
106 };
107 
108 //------------------------------------------------------------------------
109 
110 class ScTpSubTotalGroup2 : public ScTpSubTotalGroup
111 {
112 protected:
113 			ScTpSubTotalGroup2( Window*				 pParent,
114 								const SfxItemSet&	 rArgSet );
115 
116 public:
117 	virtual ~ScTpSubTotalGroup2();
118 
119 	static	SfxTabPage*	Create		( Window*				pParent,
120 									  const SfxItemSet& 	rArgSet );
121 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
122 	virtual	void		Reset		( const SfxItemSet& rArgSet );
123 };
124 
125 //------------------------------------------------------------------------
126 
127 class ScTpSubTotalGroup3 : public ScTpSubTotalGroup
128 {
129 protected:
130 			ScTpSubTotalGroup3( Window*				 pParent,
131 								const SfxItemSet&	 rArgSet );
132 
133 public:
134 	virtual ~ScTpSubTotalGroup3();
135 
136 	static	SfxTabPage*	Create		( Window*				pParent,
137 									  const SfxItemSet& 	rArgSet );
138 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
139 	virtual	void		Reset		( const SfxItemSet& rArgSet );
140 };
141 
142 //========================================================================
143 // Optionen:
144 
145 class ScTpSubTotalOptions : public SfxTabPage
146 {
147 protected:
148 			ScTpSubTotalOptions( Window*			 pParent,
149 								  const SfxItemSet&  rArgSet );
150 
151 public:
152 	virtual ~ScTpSubTotalOptions();
153 
154 	static sal_uInt16*		GetRanges	();
155 	static SfxTabPage*	Create		( Window*				pParent,
156 									  const SfxItemSet& 	rArgSet );
157 	virtual	sal_Bool		FillItemSet	( SfxItemSet& rArgSet );
158 	virtual	void		Reset		( const SfxItemSet& rArgSet );
159 
160 private:
161     FixedLine   aFlGroup;
162 	CheckBox	aBtnPagebreak;
163 	CheckBox	aBtnCase;
164 	CheckBox	aBtnSort;
165     FixedLine   aFlSort;
166 	RadioButton	aBtnAscending;
167 	RadioButton	aBtnDescending;
168 	CheckBox	aBtnFormats;
169 	CheckBox	aBtnUserDef;
170 	ListBox		aLbUserDef;
171 
172 	ScViewData*				pViewData;
173 	ScDocument*				pDoc;
174 	const sal_uInt16			nWhichSubTotals;
175 	const ScSubTotalParam&	rSubTotalData;
176 
177 private:
178 	void Init					();
179 	void FillUserSortListBox	();
180 
181 	// Handler ------------------------
182 	DECL_LINK( CheckHdl, CheckBox * );
183 };
184 
185 
186 
187 #endif // SC_TPSORT_HXX
188 
189