xref: /AOO41X/main/sc/source/ui/dbgui/tpsubt.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #undef SC_DLLIMPLEMENTATION
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include "scitems.hxx"
36*cdf0e10cSrcweir #include "uiitems.hxx"
37*cdf0e10cSrcweir #include "global.hxx"
38*cdf0e10cSrcweir #include "userlist.hxx"
39*cdf0e10cSrcweir #include "viewdata.hxx"
40*cdf0e10cSrcweir #include "document.hxx"
41*cdf0e10cSrcweir #include "scresid.hxx"
42*cdf0e10cSrcweir #include "sc.hrc"       // -> Slot IDs
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include "subtdlg.hxx"
45*cdf0e10cSrcweir #include "subtdlg.hrc"
46*cdf0e10cSrcweir #include "tpsubt.hxx"
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir static sal_uInt16 pSubTotalsRanges[] =
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	SID_SUBTOTALS,
53*cdf0e10cSrcweir 	SID_SUBTOTALS,
54*cdf0e10cSrcweir 	0
55*cdf0e10cSrcweir };
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir //========================================================================
58*cdf0e10cSrcweir // Zwischenergebnisgruppen-Tabpage:
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir ScTpSubTotalGroup::ScTpSubTotalGroup( Window* pParent, sal_uInt16 nResId,
61*cdf0e10cSrcweir 									  const SfxItemSet& rArgSet )
62*cdf0e10cSrcweir 		:	SfxTabPage		( pParent,
63*cdf0e10cSrcweir 							  ScResId( nResId ),
64*cdf0e10cSrcweir 							  rArgSet ),
65*cdf0e10cSrcweir 			//
66*cdf0e10cSrcweir 			aFtGroup		( this, ScResId( FT_GROUP ) ),
67*cdf0e10cSrcweir 			aLbGroup		( this, ScResId( LB_GROUP ) ),
68*cdf0e10cSrcweir 			aFtColumns		( this, ScResId( FT_COLUMNS ) ),
69*cdf0e10cSrcweir 			aLbColumns		( this, ScResId( WND_COLUMNS ) ),
70*cdf0e10cSrcweir 			aFtFunctions	( this, ScResId( FT_FUNCTIONS ) ),
71*cdf0e10cSrcweir 			aLbFunctions	( this, ScResId( LB_FUNCTIONS ) ),
72*cdf0e10cSrcweir 			aStrNone		( ScResId( SCSTR_NONE ) ),
73*cdf0e10cSrcweir 			aStrColumn		( ScResId( SCSTR_COLUMN ) ),
74*cdf0e10cSrcweir 			//
75*cdf0e10cSrcweir 			pViewData		( NULL ),
76*cdf0e10cSrcweir 			pDoc			( NULL ),
77*cdf0e10cSrcweir 			nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
78*cdf0e10cSrcweir 			rSubTotalData	( ((const ScSubTotalItem&)
79*cdf0e10cSrcweir 							  rArgSet.Get( nWhichSubTotals )).
80*cdf0e10cSrcweir 								GetSubTotalData() ),
81*cdf0e10cSrcweir 			nFieldCount 	( 0 )
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir 	// Font is correctly initialized by SvTreeListBox ctor
84*cdf0e10cSrcweir 	aLbColumns.SetSelectionMode( SINGLE_SELECTION );
85*cdf0e10cSrcweir 	aLbColumns.SetDragDropMode( SV_DRAGDROP_NONE );
86*cdf0e10cSrcweir 	aLbColumns.SetSpaceBetweenEntries( 0 );
87*cdf0e10cSrcweir 	aLbColumns.Show();
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	Init ();
90*cdf0e10cSrcweir 	FreeResource();
91*cdf0e10cSrcweir }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir // -----------------------------------------------------------------------
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir __EXPORT ScTpSubTotalGroup::~ScTpSubTotalGroup()
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir 	sal_uInt16	nCount = (sal_uInt16)aLbColumns.GetEntryCount();
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	if ( nCount > 0 )
100*cdf0e10cSrcweir 	{
101*cdf0e10cSrcweir 		sal_uInt16* pData = NULL;
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 		for ( sal_uInt16 i=0; i<nCount; i++ )
104*cdf0e10cSrcweir 		{
105*cdf0e10cSrcweir 			pData = (sal_uInt16*)(aLbColumns.GetEntryData( i ));
106*cdf0e10cSrcweir 			DBG_ASSERT( pData, "EntryData not found" );
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 			delete pData;
109*cdf0e10cSrcweir 		}
110*cdf0e10cSrcweir 	}
111*cdf0e10cSrcweir }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir // -----------------------------------------------------------------------
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir void ScTpSubTotalGroup::Init()
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir 	const ScSubTotalItem& rSubTotalItem = (const ScSubTotalItem&)
118*cdf0e10cSrcweir 										  GetItemSet().Get( nWhichSubTotals );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	pViewData	= rSubTotalItem.GetViewData();
121*cdf0e10cSrcweir 	pDoc		= ( pViewData ) ? pViewData->GetDocument() : NULL;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 	DBG_ASSERT( pViewData && pDoc, "ViewData or Document not found :-(" );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	aLbGroup.SetSelectHdl		( LINK( this, ScTpSubTotalGroup, SelectHdl ) );
126*cdf0e10cSrcweir 	aLbColumns.SetSelectHdl		( LINK( this, ScTpSubTotalGroup, SelectHdl ) );
127*cdf0e10cSrcweir 	aLbColumns.SetCheckButtonHdl	( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
128*cdf0e10cSrcweir 	aLbFunctions.SetSelectHdl	( LINK( this, ScTpSubTotalGroup, SelectHdl ) );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	nFieldArr[0] = 0;
131*cdf0e10cSrcweir 	FillListBoxes();
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir //------------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir sal_uInt16* __EXPORT ScTpSubTotalGroup::GetRanges()
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir 	return pSubTotalsRanges;
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir // -----------------------------------------------------------------------
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir sal_Bool ScTpSubTotalGroup::DoReset( sal_uInt16 			nGroupNo,
144*cdf0e10cSrcweir 								 const SfxItemSet&	rArgSet  )
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir 	sal_uInt16 nGroupIdx = 0;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	DBG_ASSERT( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	if ( (nGroupNo > 3) || (nGroupNo == 0) )
151*cdf0e10cSrcweir 		return sal_False;
152*cdf0e10cSrcweir 	else
153*cdf0e10cSrcweir 		nGroupIdx = nGroupNo-1;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	//----------------------------------------------------------
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     // #79058# first we have to clear the listboxes...
158*cdf0e10cSrcweir     for ( sal_uInt16 nLbEntry = 0; nLbEntry < aLbColumns.GetEntryCount(); ++nLbEntry )
159*cdf0e10cSrcweir     {
160*cdf0e10cSrcweir         aLbColumns.CheckEntryPos( nLbEntry, sal_False );
161*cdf0e10cSrcweir         *((sal_uInt16*)aLbColumns.GetEntryData( nLbEntry )) = 0;
162*cdf0e10cSrcweir     }
163*cdf0e10cSrcweir     aLbFunctions.SelectEntryPos( 0 );
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 	ScSubTotalParam theSubTotalData( ((const ScSubTotalItem&)
166*cdf0e10cSrcweir 									  rArgSet.Get( nWhichSubTotals )).
167*cdf0e10cSrcweir 											GetSubTotalData() );
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 	if ( theSubTotalData.bGroupActive[nGroupIdx] )
170*cdf0e10cSrcweir 	{
171*cdf0e10cSrcweir 		SCCOL			nField		= theSubTotalData.nField[nGroupIdx];
172*cdf0e10cSrcweir 		SCCOL			nSubTotals	= theSubTotalData.nSubTotals[nGroupIdx];
173*cdf0e10cSrcweir 		SCCOL* 		    pSubTotals	= theSubTotalData.pSubTotals[nGroupIdx];
174*cdf0e10cSrcweir 		ScSubTotalFunc* pFunctions	= theSubTotalData.pFunctions[nGroupIdx];
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 		aLbGroup.SelectEntryPos( GetFieldSelPos( nField )+1 );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 		for ( sal_uInt16 i=0; i<nSubTotals; i++ )
179*cdf0e10cSrcweir 		{
180*cdf0e10cSrcweir 			sal_uInt16	nCheckPos = GetFieldSelPos( pSubTotals[i] );
181*cdf0e10cSrcweir 			sal_uInt16* pFunction = (sal_uInt16*)aLbColumns.GetEntryData( nCheckPos );
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 			aLbColumns.CheckEntryPos( nCheckPos );
184*cdf0e10cSrcweir 			*pFunction = FuncToLbPos( pFunctions[i] );
185*cdf0e10cSrcweir 		}
186*cdf0e10cSrcweir         aLbColumns.SelectEntryPos( 0 );
187*cdf0e10cSrcweir 	}
188*cdf0e10cSrcweir 	else
189*cdf0e10cSrcweir 	{
190*cdf0e10cSrcweir 		aLbGroup.SelectEntryPos( (nGroupNo == 1) ? 1 : 0 );
191*cdf0e10cSrcweir 		aLbColumns.SelectEntryPos( 0 );
192*cdf0e10cSrcweir 		aLbFunctions.SelectEntryPos( 0 );
193*cdf0e10cSrcweir 	}
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	return sal_True;
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir // -----------------------------------------------------------------------
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir sal_Bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16		nGroupNo,
201*cdf0e10cSrcweir 									   SfxItemSet&	rArgSet  )
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir 	sal_uInt16 nGroupIdx = 0;
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	DBG_ASSERT( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
206*cdf0e10cSrcweir 	DBG_ASSERT(    (aLbGroup.GetEntryCount() > 0)
207*cdf0e10cSrcweir 				&& (aLbColumns.GetEntryCount() > 0)
208*cdf0e10cSrcweir 				&& (aLbFunctions.GetEntryCount() > 0),
209*cdf0e10cSrcweir 				"Non-initialized Lists" );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	if (  (nGroupNo > 3) || (nGroupNo == 0)
213*cdf0e10cSrcweir 		|| (aLbGroup.GetEntryCount() == 0)
214*cdf0e10cSrcweir 		|| (aLbColumns.GetEntryCount() == 0)
215*cdf0e10cSrcweir 		|| (aLbFunctions.GetEntryCount() == 0)
216*cdf0e10cSrcweir 	   )
217*cdf0e10cSrcweir 		return sal_False;
218*cdf0e10cSrcweir 	else
219*cdf0e10cSrcweir 		nGroupIdx = nGroupNo-1;
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 	//----------------------------------------------------------
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 	ScSubTotalParam theSubTotalData;			// auslesen, wenn schon teilweise gefuellt
224*cdf0e10cSrcweir 	SfxTabDialog* pDlg = GetTabDialog();
225*cdf0e10cSrcweir 	if ( pDlg )
226*cdf0e10cSrcweir 	{
227*cdf0e10cSrcweir 		const SfxItemSet* pExample = pDlg->GetExampleSet();
228*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
229*cdf0e10cSrcweir 		if ( pExample && pExample->GetItemState( nWhichSubTotals, sal_True, &pItem ) == SFX_ITEM_SET )
230*cdf0e10cSrcweir 			theSubTotalData = ((const ScSubTotalItem*)pItem)->GetSubTotalData();
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	ScSubTotalFunc* pFunctions	= NULL;
234*cdf0e10cSrcweir 	SCCOL* 		    pSubTotals	= NULL;
235*cdf0e10cSrcweir 	sal_uInt16			nGroup		= aLbGroup.GetSelectEntryPos();
236*cdf0e10cSrcweir 	sal_uInt16			nEntryCount = (sal_uInt16)aLbColumns.GetEntryCount();
237*cdf0e10cSrcweir 	sal_uInt16			nCheckCount = aLbColumns.GetCheckedEntryCount();
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	theSubTotalData.nCol1					= rSubTotalData.nCol1;
240*cdf0e10cSrcweir 	theSubTotalData.nRow1					= rSubTotalData.nRow1;
241*cdf0e10cSrcweir 	theSubTotalData.nCol2					= rSubTotalData.nCol2;
242*cdf0e10cSrcweir 	theSubTotalData.nRow2					= rSubTotalData.nRow2;
243*cdf0e10cSrcweir 	theSubTotalData.bGroupActive[nGroupIdx] = (nGroup != 0);
244*cdf0e10cSrcweir 	theSubTotalData.nField[nGroupIdx]		= (nGroup != 0)
245*cdf0e10cSrcweir 												? nFieldArr[nGroup-1]
246*cdf0e10cSrcweir 												: static_cast<SCCOL>(0);
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	if ( nEntryCount>0 && nCheckCount>0 && nGroup!=0 )
249*cdf0e10cSrcweir 	{
250*cdf0e10cSrcweir 		sal_uInt16 nFunction	= 0;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 		pSubTotals = new SCCOL  		[nCheckCount];
253*cdf0e10cSrcweir 		pFunctions = new ScSubTotalFunc [nCheckCount];
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 		for ( sal_uInt16 i=0, nCheck=0; i<nEntryCount; i++ )
256*cdf0e10cSrcweir 		{
257*cdf0e10cSrcweir 			if ( aLbColumns.IsChecked( i ) )
258*cdf0e10cSrcweir 			{
259*cdf0e10cSrcweir 				DBG_ASSERT( nCheck <= nCheckCount,
260*cdf0e10cSrcweir 							"Range error :-(" );
261*cdf0e10cSrcweir 				nFunction = *((sal_uInt16*)aLbColumns.GetEntryData( i ));
262*cdf0e10cSrcweir 				pSubTotals[nCheck] = nFieldArr[i];
263*cdf0e10cSrcweir 				pFunctions[nCheck] = LbPosToFunc( nFunction );
264*cdf0e10cSrcweir 				nCheck++;
265*cdf0e10cSrcweir 			}
266*cdf0e10cSrcweir 		}
267*cdf0e10cSrcweir 		theSubTotalData.SetSubTotals( nGroupNo, 	 // Gruppen-Nr.
268*cdf0e10cSrcweir 									  pSubTotals,
269*cdf0e10cSrcweir 									  pFunctions,
270*cdf0e10cSrcweir 									  nCheckCount ); // Anzahl der Array-Elemente
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 	}
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 	rArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &theSubTotalData ) );
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 	if ( pSubTotals ) delete [] pSubTotals;
277*cdf0e10cSrcweir 	if ( pFunctions ) delete [] pFunctions;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	return sal_True;
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir // -----------------------------------------------------------------------
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir void ScTpSubTotalGroup::FillListBoxes()
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir 	DBG_ASSERT( pViewData && pDoc, "ViewData or Document not found :-/" );
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	if ( pViewData && pDoc )
289*cdf0e10cSrcweir 	{
290*cdf0e10cSrcweir 		SCCOL	nFirstCol	= rSubTotalData.nCol1;
291*cdf0e10cSrcweir 		SCROW	nFirstRow	= rSubTotalData.nRow1;
292*cdf0e10cSrcweir 		SCTAB	nTab		= pViewData->GetTabNo();
293*cdf0e10cSrcweir 		SCCOL	nMaxCol 	= rSubTotalData.nCol2;
294*cdf0e10cSrcweir 		SCCOL	col;
295*cdf0e10cSrcweir 		sal_uInt16	i=0;
296*cdf0e10cSrcweir 		String	aFieldName;
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 		aLbGroup.Clear();
299*cdf0e10cSrcweir 		aLbColumns.Clear();
300*cdf0e10cSrcweir 		aLbGroup.InsertEntry( aStrNone, 0 );
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir 		i=0;
303*cdf0e10cSrcweir 		for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
304*cdf0e10cSrcweir 		{
305*cdf0e10cSrcweir 			pDoc->GetString( col, nFirstRow, nTab, aFieldName );
306*cdf0e10cSrcweir 			if ( aFieldName.Len() == 0 )
307*cdf0e10cSrcweir 			{
308*cdf0e10cSrcweir                 aFieldName = aStrColumn;
309*cdf0e10cSrcweir                 aFieldName += ' ';
310*cdf0e10cSrcweir                 aFieldName += ::ScColToAlpha( col );  // from global.hxx
311*cdf0e10cSrcweir 			}
312*cdf0e10cSrcweir 			nFieldArr[i] = col;
313*cdf0e10cSrcweir 			aLbGroup.InsertEntry( aFieldName, i+1 );
314*cdf0e10cSrcweir 			aLbColumns.InsertEntry( aFieldName, i );
315*cdf0e10cSrcweir 			aLbColumns.SetEntryData( i, new sal_uInt16(0) );
316*cdf0e10cSrcweir 			i++;
317*cdf0e10cSrcweir 		}
318*cdf0e10cSrcweir 		// Nachtraegliche "Konstanteninitialisierung":
319*cdf0e10cSrcweir 		(sal_uInt16&)nFieldCount = i;
320*cdf0e10cSrcweir 	}
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir // -----------------------------------------------------------------------
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir sal_uInt16 ScTpSubTotalGroup::GetFieldSelPos( SCCOL nField )
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir 	sal_uInt16	nFieldPos	= 0;
328*cdf0e10cSrcweir 	sal_Bool	bFound		= sal_False;
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
331*cdf0e10cSrcweir 	{
332*cdf0e10cSrcweir 		if ( nFieldArr[n] == nField )
333*cdf0e10cSrcweir 		{
334*cdf0e10cSrcweir 			nFieldPos = n;
335*cdf0e10cSrcweir 			bFound = sal_True;
336*cdf0e10cSrcweir 		}
337*cdf0e10cSrcweir 	}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	return nFieldPos;
340*cdf0e10cSrcweir }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir // -----------------------------------------------------------------------
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir ScSubTotalFunc ScTpSubTotalGroup::LbPosToFunc( sal_uInt16 nPos )
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir 	switch ( nPos )
347*cdf0e10cSrcweir 	{
348*cdf0e10cSrcweir //		case  0:	return SUBTOTAL_FUNC_NONE;
349*cdf0e10cSrcweir 		case  2:	return SUBTOTAL_FUNC_AVE;
350*cdf0e10cSrcweir 		case  6:	return SUBTOTAL_FUNC_CNT;
351*cdf0e10cSrcweir 		case  1:	return SUBTOTAL_FUNC_CNT2;
352*cdf0e10cSrcweir 		case  3:	return SUBTOTAL_FUNC_MAX;
353*cdf0e10cSrcweir 		case  4:	return SUBTOTAL_FUNC_MIN;
354*cdf0e10cSrcweir 		case  5:	return SUBTOTAL_FUNC_PROD;
355*cdf0e10cSrcweir 		case  7:	return SUBTOTAL_FUNC_STD;
356*cdf0e10cSrcweir 		case  8:	return SUBTOTAL_FUNC_STDP;
357*cdf0e10cSrcweir 		case  0:	return SUBTOTAL_FUNC_SUM;
358*cdf0e10cSrcweir 		case  9:	return SUBTOTAL_FUNC_VAR;
359*cdf0e10cSrcweir 		case 10:	return SUBTOTAL_FUNC_VARP;
360*cdf0e10cSrcweir 		default:
361*cdf0e10cSrcweir 			DBG_ERROR( "ScTpSubTotalGroup::LbPosToFunc" );
362*cdf0e10cSrcweir 			return SUBTOTAL_FUNC_NONE;
363*cdf0e10cSrcweir 	}
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir // -----------------------------------------------------------------------
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir sal_uInt16 ScTpSubTotalGroup::FuncToLbPos( ScSubTotalFunc eFunc )
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir 	switch ( eFunc )
371*cdf0e10cSrcweir 	{
372*cdf0e10cSrcweir //		case SUBTOTAL_FUNC_NONE:	return 0;
373*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_AVE: 	return 2;
374*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_CNT: 	return 6;
375*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_CNT2:	return 1;
376*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_MAX: 	return 3;
377*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_MIN: 	return 4;
378*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_PROD:	return 5;
379*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_STD: 	return 7;
380*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_STDP:	return 8;
381*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_SUM: 	return 0;
382*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_VAR: 	return 9;
383*cdf0e10cSrcweir 		case SUBTOTAL_FUNC_VARP:	return 10;
384*cdf0e10cSrcweir 		default:
385*cdf0e10cSrcweir 			DBG_ERROR( "ScTpSubTotalGroup::FuncToLbPos" );
386*cdf0e10cSrcweir 			return 0;
387*cdf0e10cSrcweir 	}
388*cdf0e10cSrcweir }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir // -----------------------------------------------------------------------
391*cdf0e10cSrcweir // Handler:
392*cdf0e10cSrcweir //---------
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir IMPL_LINK( ScTpSubTotalGroup, SelectHdl, ListBox *, pLb )
395*cdf0e10cSrcweir {
396*cdf0e10cSrcweir 	if (   (aLbColumns.GetEntryCount() > 0)
397*cdf0e10cSrcweir 		&& (aLbColumns.GetSelectionCount() > 0) )
398*cdf0e10cSrcweir 	{
399*cdf0e10cSrcweir 		sal_uInt16		nFunction	= aLbFunctions.GetSelectEntryPos();
400*cdf0e10cSrcweir 		sal_uInt16		nColumn 	= aLbColumns.GetSelectEntryPos();
401*cdf0e10cSrcweir 		sal_uInt16* 	pFunction	= (sal_uInt16*)aLbColumns.GetEntryData( nColumn );
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 		DBG_ASSERT( pFunction, "EntryData nicht gefunden!" );
404*cdf0e10cSrcweir 		if ( !pFunction )
405*cdf0e10cSrcweir 			return 0;
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 		if ( ((SvxCheckListBox*)pLb) == &aLbColumns )
408*cdf0e10cSrcweir 		{
409*cdf0e10cSrcweir 			aLbFunctions.SelectEntryPos( *pFunction );
410*cdf0e10cSrcweir 		}
411*cdf0e10cSrcweir 		else if ( pLb == &aLbFunctions )
412*cdf0e10cSrcweir 		{
413*cdf0e10cSrcweir 			*pFunction = nFunction;
414*cdf0e10cSrcweir //			aLbColumns.CheckEntryPos( nColumn, (nFunction != 0) );//XXX
415*cdf0e10cSrcweir 			aLbColumns.CheckEntryPos( nColumn, sal_True );
416*cdf0e10cSrcweir 		}
417*cdf0e10cSrcweir 	}
418*cdf0e10cSrcweir 	return 0;
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir // -----------------------------------------------------------------------
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir IMPL_LINK( ScTpSubTotalGroup, CheckHdl, ListBox *, pLb )
424*cdf0e10cSrcweir {
425*cdf0e10cSrcweir 	if ( ((SvxCheckListBox*)pLb) == &aLbColumns )
426*cdf0e10cSrcweir 	{
427*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = aLbColumns.GetHdlEntry();
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 		if ( pEntry )
430*cdf0e10cSrcweir 		{
431*cdf0e10cSrcweir 			aLbColumns.SelectEntryPos( (sal_uInt16)aLbColumns.GetModel()->GetAbsPos( pEntry ) );
432*cdf0e10cSrcweir 			SelectHdl( pLb );
433*cdf0e10cSrcweir 		}
434*cdf0e10cSrcweir 	}
435*cdf0e10cSrcweir 	return 0;
436*cdf0e10cSrcweir }
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir //========================================================================
439*cdf0e10cSrcweir // Abgeleitete Gruppen-TabPages:
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir SfxTabPage* __EXPORT ScTpSubTotalGroup1::Create( Window*			pParent,
442*cdf0e10cSrcweir 												 const SfxItemSet&	rArgSet )
443*cdf0e10cSrcweir 	{ return ( new ScTpSubTotalGroup1( pParent, rArgSet ) ); }
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir // -----------------------------------------------------------------------
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir SfxTabPage* __EXPORT ScTpSubTotalGroup2::Create( Window*			 pParent,
448*cdf0e10cSrcweir 									   const SfxItemSet&	rArgSet )
449*cdf0e10cSrcweir 	{ return ( new ScTpSubTotalGroup2( pParent, rArgSet ) ); }
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir // -----------------------------------------------------------------------
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir SfxTabPage* __EXPORT ScTpSubTotalGroup3::Create( Window*			 pParent,
454*cdf0e10cSrcweir 									   const SfxItemSet&	rArgSet )
455*cdf0e10cSrcweir 	{ return ( new ScTpSubTotalGroup3( pParent, rArgSet ) ); }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir // -----------------------------------------------------------------------
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir ScTpSubTotalGroup1::ScTpSubTotalGroup1( Window* pParent, const SfxItemSet& rArgSet ) :
460*cdf0e10cSrcweir 	ScTpSubTotalGroup( pParent, RID_SCPAGE_SUBT_GROUP1, rArgSet )
461*cdf0e10cSrcweir {}
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir ScTpSubTotalGroup2::ScTpSubTotalGroup2( Window* pParent, const SfxItemSet& rArgSet ) :
464*cdf0e10cSrcweir 	ScTpSubTotalGroup( pParent, RID_SCPAGE_SUBT_GROUP2, rArgSet )
465*cdf0e10cSrcweir {}
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir ScTpSubTotalGroup3::ScTpSubTotalGroup3( Window* pParent, const SfxItemSet& rArgSet ) :
468*cdf0e10cSrcweir 	ScTpSubTotalGroup( pParent, RID_SCPAGE_SUBT_GROUP3, rArgSet )
469*cdf0e10cSrcweir {}
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir // -----------------------------------------------------------------------
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir #define RESET(i) (ScTpSubTotalGroup::DoReset( (i), rArgSet ))
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir void __EXPORT ScTpSubTotalGroup1::Reset( const SfxItemSet& rArgSet ) { RESET(1); }
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir void __EXPORT ScTpSubTotalGroup2::Reset( const SfxItemSet& rArgSet ) { RESET(2); }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir void __EXPORT ScTpSubTotalGroup3::Reset( const SfxItemSet& rArgSet ) { RESET(3); }
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir #undef RESET
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir // -----------------------------------------------------------------------
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir #define FILLSET(i) (ScTpSubTotalGroup::DoFillItemSet( (i), rArgSet ))
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir sal_Bool __EXPORT ScTpSubTotalGroup1::FillItemSet( SfxItemSet& rArgSet ) { return FILLSET(1); }
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir sal_Bool __EXPORT ScTpSubTotalGroup2::FillItemSet( SfxItemSet& rArgSet ) { return FILLSET(2); }
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir sal_Bool __EXPORT ScTpSubTotalGroup3::FillItemSet( SfxItemSet& rArgSet ) { return FILLSET(3); }
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir #undef FILL
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir //========================================================================
497*cdf0e10cSrcweir // Optionen-Tabpage:
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir ScTpSubTotalOptions::ScTpSubTotalOptions( Window*				pParent,
500*cdf0e10cSrcweir 										  const SfxItemSet& 	rArgSet )
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 		:	SfxTabPage		( pParent,
503*cdf0e10cSrcweir 							  ScResId( RID_SCPAGE_SUBT_OPTIONS ),
504*cdf0e10cSrcweir 							  rArgSet ),
505*cdf0e10cSrcweir 			//
506*cdf0e10cSrcweir             aFlGroup        ( this, ScResId( FL_GROUP ) ),
507*cdf0e10cSrcweir 			aBtnPagebreak	( this, ScResId( BTN_PAGEBREAK ) ),
508*cdf0e10cSrcweir 			aBtnCase		( this, ScResId( BTN_CASE ) ),
509*cdf0e10cSrcweir 			aBtnSort		( this, ScResId( BTN_SORT ) ),
510*cdf0e10cSrcweir             aFlSort         ( this, ScResId( FL_SORT ) ),
511*cdf0e10cSrcweir 			aBtnAscending	( this, ScResId( BTN_ASCENDING ) ),
512*cdf0e10cSrcweir 			aBtnDescending	( this, ScResId( BTN_DESCENDING ) ),
513*cdf0e10cSrcweir 			aBtnFormats 	( this, ScResId( BTN_FORMATS ) ),
514*cdf0e10cSrcweir 			aBtnUserDef 	( this, ScResId( BTN_USERDEF ) ),
515*cdf0e10cSrcweir 			aLbUserDef		( this, ScResId( LB_USERDEF ) ),
516*cdf0e10cSrcweir 			//
517*cdf0e10cSrcweir 			pViewData		( NULL ),
518*cdf0e10cSrcweir 			pDoc			( NULL ),
519*cdf0e10cSrcweir 			nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
520*cdf0e10cSrcweir 			rSubTotalData	( ((const ScSubTotalItem&)
521*cdf0e10cSrcweir 							  rArgSet.Get( nWhichSubTotals )).
522*cdf0e10cSrcweir 								GetSubTotalData() )
523*cdf0e10cSrcweir {
524*cdf0e10cSrcweir 	Init();
525*cdf0e10cSrcweir 	FreeResource();
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir 	aLbUserDef.SetAccessibleRelationLabeledBy(&aBtnUserDef);
528*cdf0e10cSrcweir 	aLbUserDef.SetAccessibleName(aBtnUserDef.GetText());
529*cdf0e10cSrcweir }
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir // -----------------------------------------------------------------------
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir __EXPORT ScTpSubTotalOptions::~ScTpSubTotalOptions()
534*cdf0e10cSrcweir {
535*cdf0e10cSrcweir }
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir // -----------------------------------------------------------------------
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir void ScTpSubTotalOptions::Init()
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir 	const ScSubTotalItem& rSubTotalItem = (const ScSubTotalItem&)
542*cdf0e10cSrcweir 										  GetItemSet().Get( nWhichSubTotals );
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir 	pViewData	= rSubTotalItem.GetViewData();
545*cdf0e10cSrcweir 	pDoc		= ( pViewData ) ? pViewData->GetDocument() : NULL;
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir 	DBG_ASSERT( pViewData && pDoc, "ViewData oder Document nicht gefunden!" );
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 	aBtnSort.SetClickHdl 	( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
550*cdf0e10cSrcweir 	aBtnUserDef.SetClickHdl	( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir 	FillUserSortListBox();
553*cdf0e10cSrcweir }
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir // -----------------------------------------------------------------------
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir SfxTabPage* __EXPORT ScTpSubTotalOptions::Create( Window*				 pParent,
558*cdf0e10cSrcweir 										  const SfxItemSet& 	rArgSet )
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir 	return ( new ScTpSubTotalOptions( pParent, rArgSet ) );
561*cdf0e10cSrcweir }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir // -----------------------------------------------------------------------
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir void __EXPORT ScTpSubTotalOptions::Reset( const SfxItemSet& /* rArgSet */ )
566*cdf0e10cSrcweir {
567*cdf0e10cSrcweir 	aBtnPagebreak.Check ( rSubTotalData.bPagebreak );
568*cdf0e10cSrcweir 	aBtnCase.Check		( rSubTotalData.bCaseSens );
569*cdf0e10cSrcweir 	aBtnFormats.Check	( rSubTotalData.bIncludePattern );
570*cdf0e10cSrcweir 	aBtnSort.Check		( rSubTotalData.bDoSort );
571*cdf0e10cSrcweir 	aBtnAscending.Check ( rSubTotalData.bAscending );
572*cdf0e10cSrcweir 	aBtnDescending.Check( !rSubTotalData.bAscending );
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir 	if ( rSubTotalData.bUserDef )
575*cdf0e10cSrcweir 	{
576*cdf0e10cSrcweir 		aBtnUserDef.Check( sal_True );
577*cdf0e10cSrcweir 		aLbUserDef.Enable();
578*cdf0e10cSrcweir 		aLbUserDef.SelectEntryPos( rSubTotalData.nUserIndex );
579*cdf0e10cSrcweir 	}
580*cdf0e10cSrcweir 	else
581*cdf0e10cSrcweir 	{
582*cdf0e10cSrcweir 		aBtnUserDef.Check( sal_False );
583*cdf0e10cSrcweir 		aLbUserDef.Disable();
584*cdf0e10cSrcweir 		aLbUserDef.SelectEntryPos( 0 );
585*cdf0e10cSrcweir 	}
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 	CheckHdl( &aBtnSort );
588*cdf0e10cSrcweir }
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir // -----------------------------------------------------------------------
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir sal_Bool __EXPORT ScTpSubTotalOptions::FillItemSet( SfxItemSet& rArgSet )
593*cdf0e10cSrcweir {
594*cdf0e10cSrcweir 	ScSubTotalParam theSubTotalData;			// auslesen, wenn schon teilweise gefuellt
595*cdf0e10cSrcweir 	SfxTabDialog* pDlg = GetTabDialog();
596*cdf0e10cSrcweir 	if ( pDlg )
597*cdf0e10cSrcweir 	{
598*cdf0e10cSrcweir 		const SfxItemSet* pExample = pDlg->GetExampleSet();
599*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
600*cdf0e10cSrcweir 		if ( pExample && pExample->GetItemState( nWhichSubTotals, sal_True, &pItem ) == SFX_ITEM_SET )
601*cdf0e10cSrcweir 			theSubTotalData = ((const ScSubTotalItem*)pItem)->GetSubTotalData();
602*cdf0e10cSrcweir 	}
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir 	theSubTotalData.bPagebreak		= aBtnPagebreak.IsChecked();
605*cdf0e10cSrcweir 	theSubTotalData.bReplace		= sal_True;
606*cdf0e10cSrcweir 	theSubTotalData.bCaseSens		= aBtnCase.IsChecked();
607*cdf0e10cSrcweir 	theSubTotalData.bIncludePattern = aBtnFormats.IsChecked();
608*cdf0e10cSrcweir 	theSubTotalData.bDoSort 		= aBtnSort.IsChecked();
609*cdf0e10cSrcweir 	theSubTotalData.bAscending		= aBtnAscending.IsChecked();
610*cdf0e10cSrcweir 	theSubTotalData.bUserDef		= aBtnUserDef.IsChecked();
611*cdf0e10cSrcweir 	theSubTotalData.nUserIndex		= (aBtnUserDef.IsChecked())
612*cdf0e10cSrcweir 									? aLbUserDef.GetSelectEntryPos()
613*cdf0e10cSrcweir 									: 0;
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 	rArgSet.Put( ScSubTotalItem( nWhichSubTotals, &theSubTotalData ) );
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 	return sal_True;
618*cdf0e10cSrcweir }
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir // -----------------------------------------------------------------------
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir void ScTpSubTotalOptions::FillUserSortListBox()
623*cdf0e10cSrcweir {
624*cdf0e10cSrcweir 	ScUserList* pUserLists = ScGlobal::GetUserList();
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 	aLbUserDef.Clear();
627*cdf0e10cSrcweir 	if ( pUserLists )
628*cdf0e10cSrcweir 	{
629*cdf0e10cSrcweir 		sal_uInt16 nCount = pUserLists->GetCount();
630*cdf0e10cSrcweir 		if ( nCount > 0 )
631*cdf0e10cSrcweir 			for ( sal_uInt16 i=0; i<nCount; i++ )
632*cdf0e10cSrcweir 				aLbUserDef.InsertEntry( (*pUserLists)[i]->GetString() );
633*cdf0e10cSrcweir 	}
634*cdf0e10cSrcweir }
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir // -----------------------------------------------------------------------
637*cdf0e10cSrcweir // Handler:
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir IMPL_LINK( ScTpSubTotalOptions, CheckHdl, CheckBox *, pBox )
640*cdf0e10cSrcweir {
641*cdf0e10cSrcweir 	if ( pBox == &aBtnSort )
642*cdf0e10cSrcweir 	{
643*cdf0e10cSrcweir 		if ( aBtnSort.IsChecked() )
644*cdf0e10cSrcweir 		{
645*cdf0e10cSrcweir             aFlSort         .Enable();
646*cdf0e10cSrcweir 			aBtnFormats 	.Enable();
647*cdf0e10cSrcweir 			aBtnUserDef 	.Enable();
648*cdf0e10cSrcweir 			aBtnAscending	.Enable();
649*cdf0e10cSrcweir 			aBtnDescending	.Enable();
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir 			if ( aBtnUserDef.IsChecked() )
652*cdf0e10cSrcweir 				aLbUserDef.Enable();
653*cdf0e10cSrcweir 		}
654*cdf0e10cSrcweir 		else
655*cdf0e10cSrcweir 		{
656*cdf0e10cSrcweir             aFlSort         .Disable();
657*cdf0e10cSrcweir 			aBtnFormats 	.Disable();
658*cdf0e10cSrcweir 			aBtnUserDef 	.Disable();
659*cdf0e10cSrcweir 			aBtnAscending	.Disable();
660*cdf0e10cSrcweir 			aBtnDescending	.Disable();
661*cdf0e10cSrcweir 			aLbUserDef		.Disable();
662*cdf0e10cSrcweir 		}
663*cdf0e10cSrcweir 	}
664*cdf0e10cSrcweir 	else if ( pBox == &aBtnUserDef )
665*cdf0e10cSrcweir 	{
666*cdf0e10cSrcweir 		if ( aBtnUserDef.IsChecked() )
667*cdf0e10cSrcweir 		{
668*cdf0e10cSrcweir 			aLbUserDef.Enable();
669*cdf0e10cSrcweir 			aLbUserDef.GrabFocus();
670*cdf0e10cSrcweir 		}
671*cdf0e10cSrcweir 		else
672*cdf0e10cSrcweir 			aLbUserDef.Disable();
673*cdf0e10cSrcweir 	}
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir 	return 0;
676*cdf0e10cSrcweir }
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir __EXPORT ScTpSubTotalGroup1::~ScTpSubTotalGroup1()
679*cdf0e10cSrcweir {
680*cdf0e10cSrcweir }
681*cdf0e10cSrcweir 
682*cdf0e10cSrcweir __EXPORT ScTpSubTotalGroup2::~ScTpSubTotalGroup2()
683*cdf0e10cSrcweir {
684*cdf0e10cSrcweir }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir __EXPORT ScTpSubTotalGroup3::~ScTpSubTotalGroup3()
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir }
689*cdf0e10cSrcweir 
690