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