Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sfx2/dispatch.hxx>
21 :
22 : #include "tabvwsh.hxx"
23 : #include "uiitems.hxx"
24 : #include "dbdata.hxx"
25 : #include "rangenam.hxx"
26 : #include "rangeutl.hxx"
27 : #include "reffact.hxx"
28 : #include "document.hxx"
29 : #include "scresid.hxx"
30 :
31 : #include "globstr.hrc"
32 : #include "sc.hrc"
33 :
34 : #define _CONSDLG_CXX
35 : #include "consdlg.hxx"
36 : #undef _CONSDLG_CXX
37 : #include <vcl/msgbox.hxx>
38 :
39 : #define INFOBOX(id) InfoBox(this, ScGlobal::GetRscString(id)).Execute()
40 :
41 :
42 : class ScAreaData
43 : {
44 : public:
45 0 : ScAreaData()
46 0 : : bIsDbArea(false)
47 : {
48 0 : }
49 :
50 0 : ~ScAreaData() {}
51 :
52 0 : void Set( const OUString& rName, const OUString& rArea, sal_Bool bDb )
53 : {
54 0 : aStrName = rName;
55 0 : aStrArea = rArea;
56 0 : bIsDbArea = bDb;
57 0 : }
58 :
59 : OUString aStrName;
60 : OUString aStrArea;
61 : sal_Bool bIsDbArea;
62 : };
63 :
64 :
65 0 : ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
66 : const SfxItemSet& rArgSet )
67 :
68 : : ScAnyRefDlg ( pB, pCW, pParent, "ConsolidateDialog" , "modules/scalc/ui/consolidatedialog.ui" ),
69 : aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
70 : theConsData ( ((const ScConsolidateItem&)
71 : rArgSet.Get( rArgSet.GetPool()->
72 0 : GetWhich( SID_CONSOLIDATE ) )
73 0 : ).GetData() ),
74 0 : pViewData ( ((ScTabViewShell*)SfxViewShell::Current())->
75 0 : GetViewData() ),
76 0 : pDoc ( ((ScTabViewShell*)SfxViewShell::Current())->
77 0 : GetViewData()->GetDocument() ),
78 0 : pRangeUtil ( new ScRangeUtil ),
79 : pAreaData ( NULL ),
80 : nAreaDataCount ( 0 ),
81 0 : nWhichCons ( rArgSet.GetPool()->GetWhich( SID_CONSOLIDATE ) )
82 : {
83 0 : get(pLbFunc,"func");
84 0 : get(pLbConsAreas,"consareas");
85 :
86 0 : get(pLbDataArea,"lbdataarea");
87 0 : get(pEdDataArea,"eddataarea");
88 0 : get(pRbDataArea,"rbdataarea");
89 :
90 0 : pRefInputEdit = pEdDataArea;
91 :
92 0 : get(pLbDestArea,"lbdestarea");
93 0 : get(pEdDestArea,"eddestarea");
94 0 : get(pRbDestArea,"rbdestarea");
95 :
96 0 : get(pExpander,"more");
97 0 : get(pBtnByRow,"byrow");
98 0 : get(pBtnByCol,"bycol");
99 0 : get(pBtnRefs,"refs");
100 :
101 0 : get(pBtnOk,"ok");
102 0 : get(pBtnCancel,"cancel");
103 0 : get(pBtnAdd,"add");
104 0 : get(pBtnRemove,"delete");
105 :
106 0 : Init();
107 0 : }
108 :
109 0 : ScConsolidateDlg::~ScConsolidateDlg()
110 : {
111 0 : delete [] pAreaData;
112 0 : delete pRangeUtil;
113 0 : }
114 :
115 0 : void ScConsolidateDlg::Init()
116 : {
117 : OSL_ENSURE( pViewData && pDoc && pRangeUtil, "Error in Ctor" );
118 :
119 0 : OUString aStr;
120 0 : sal_uInt16 i=0;
121 :
122 0 : pRbDataArea->SetReferences(this, pEdDataArea);
123 0 : pEdDataArea->SetReferences(this, get<FixedText>("ftdataarea"));
124 0 : pRbDestArea->SetReferences(this, pEdDestArea);
125 0 : pEdDestArea->SetReferences(this, get<FixedText>("ftdestarea"));
126 :
127 0 : pEdDataArea ->SetGetFocusHdl( LINK( this, ScConsolidateDlg, GetFocusHdl ) );
128 0 : pEdDestArea ->SetGetFocusHdl( LINK( this, ScConsolidateDlg, GetFocusHdl ) );
129 0 : pLbDataArea ->SetGetFocusHdl( LINK( this, ScConsolidateDlg, GetFocusHdl ) );
130 0 : pLbDestArea ->SetGetFocusHdl( LINK( this, ScConsolidateDlg, GetFocusHdl ) );
131 0 : pEdDataArea ->SetModifyHdl ( LINK( this, ScConsolidateDlg, ModifyHdl ) );
132 0 : pEdDestArea ->SetModifyHdl ( LINK( this, ScConsolidateDlg, ModifyHdl ) );
133 0 : pLbConsAreas->SetSelectHdl ( LINK( this, ScConsolidateDlg, SelectHdl ) );
134 0 : pLbDataArea ->SetSelectHdl ( LINK( this, ScConsolidateDlg, SelectHdl ) );
135 0 : pLbDestArea ->SetSelectHdl ( LINK( this, ScConsolidateDlg, SelectHdl ) );
136 0 : pBtnOk ->SetClickHdl ( LINK( this, ScConsolidateDlg, OkHdl ) );
137 0 : pBtnCancel ->SetClickHdl ( LINK( this, ScConsolidateDlg, ClickHdl ) );
138 0 : pBtnAdd ->SetClickHdl ( LINK( this, ScConsolidateDlg, ClickHdl ) );
139 0 : pBtnRemove ->SetClickHdl ( LINK( this, ScConsolidateDlg, ClickHdl ) );
140 :
141 0 : pBtnAdd->Disable();
142 0 : pBtnRemove->Disable();
143 :
144 0 : pBtnByRow->Check( theConsData.bByRow );
145 0 : pBtnByCol->Check( theConsData.bByCol );
146 0 : pBtnRefs->Check( theConsData.bReferenceData );
147 :
148 0 : pLbFunc->SelectEntryPos( FuncToLbPos( theConsData.eFunction ) );
149 :
150 : // Hack: pLbConsAreas used to be MultiLB. We don't have VCL builder equivalent
151 : // of it yet. So enable selecting multiple items here
152 0 : pLbConsAreas->EnableMultiSelection( true );
153 :
154 0 : pLbConsAreas->set_width_request(pLbConsAreas->approximate_char_width() * 16);
155 0 : pLbConsAreas->SetDropDownLineCount(5);
156 :
157 : // read consolidation areas
158 0 : pLbConsAreas->Clear();
159 0 : const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
160 0 : for ( i=0; i<theConsData.nDataAreaCount; i++ )
161 : {
162 0 : const ScArea& rArea = *(theConsData.ppDataAreas[i] );
163 0 : if ( rArea.nTab < pDoc->GetTableCount() )
164 : {
165 0 : aStr = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
166 : rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format(
167 0 : SCR_ABS_3D, pDoc, eConv );
168 0 : pLbConsAreas->InsertEntry( aStr );
169 : }
170 : }
171 :
172 0 : if ( theConsData.nTab < pDoc->GetTableCount() )
173 : {
174 0 : aStr = ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab
175 0 : ).Format( SCA_ABS_3D, pDoc, eConv );
176 0 : pEdDestArea->SetText( aStr );
177 : }
178 : else
179 0 : pEdDestArea->SetText(OUString());
180 :
181 :
182 : // Use the ScAreaData helper class to save those range names from the
183 : // RangeNames and database ranges that appear in the ListBoxes.
184 :
185 0 : ScRangeName* pRangeNames = pDoc->GetRangeName();
186 0 : ScDBCollection* pDbNames = pDoc->GetDBCollection();
187 0 : size_t nRangeCount = pRangeNames ? pRangeNames->size() : 0;
188 0 : size_t nDbCount = pDbNames ? pDbNames->getNamedDBs().size() : 0;
189 :
190 0 : nAreaDataCount = nRangeCount+nDbCount;
191 0 : pAreaData = NULL;
192 :
193 0 : if ( nAreaDataCount > 0 )
194 : {
195 0 : pAreaData = new ScAreaData[nAreaDataCount];
196 :
197 0 : OUString aStrName;
198 0 : sal_uInt16 nAt = 0;
199 0 : ScRange aRange;
200 0 : ScAreaNameIterator aIter( pDoc );
201 0 : while ( aIter.Next( aStrName, aRange ) )
202 : {
203 0 : OUString aStrArea(aRange.Format(SCA_ABS_3D, pDoc, eConv));
204 0 : pAreaData[nAt++].Set( aStrName, aStrArea, aIter.WasDBName() );
205 0 : }
206 : }
207 :
208 0 : FillAreaLists();
209 0 : ModifyHdl( pEdDestArea );
210 0 : pLbDataArea->SelectEntryPos( 0 );
211 0 : pEdDataArea->SetText(OUString());
212 0 : pEdDataArea->GrabFocus();
213 :
214 : //aFlSep.SetStyle( aFlSep.GetStyle() | WB_VERT );
215 :
216 : //@BugID 54702 enable/disable only in base class
217 : //SFX_APPWINDOW->Enable();
218 0 : }
219 :
220 0 : void ScConsolidateDlg::FillAreaLists()
221 : {
222 0 : pLbDataArea->Clear();
223 0 : pLbDestArea->Clear();
224 0 : pLbDataArea->InsertEntry( aStrUndefined );
225 0 : pLbDestArea->InsertEntry( aStrUndefined );
226 :
227 0 : if ( pRangeUtil && pAreaData && (nAreaDataCount > 0) )
228 : {
229 0 : for ( size_t i=0;
230 0 : (i<nAreaDataCount) && (!pAreaData[i].aStrName.isEmpty());
231 : i++ )
232 : {
233 0 : pLbDataArea->InsertEntry( pAreaData[i].aStrName, i+1 );
234 :
235 : // if ( !pAreaData[i].bIsDbArea )
236 0 : pLbDestArea->InsertEntry( pAreaData[i].aStrName, i+1 );
237 : }
238 : }
239 0 : }
240 :
241 :
242 : // Handover of a range within a table that has been selected by the mouse.
243 : // This range is then shown in the reference window as new selection.
244 :
245 0 : void ScConsolidateDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
246 : {
247 0 : if ( pRefInputEdit )
248 : {
249 0 : if ( rRef.aStart != rRef.aEnd )
250 0 : RefInputStart( pRefInputEdit );
251 :
252 0 : OUString aStr;
253 0 : sal_uInt16 nFmt = SCR_ABS_3D; //!!! nCurTab is still missing
254 0 : const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
255 :
256 0 : if ( rRef.aStart.Tab() != rRef.aEnd.Tab() )
257 0 : nFmt |= SCA_TAB2_3D;
258 :
259 0 : if ( pRefInputEdit == pEdDataArea)
260 0 : aStr = rRef.Format(nFmt, pDocP, eConv);
261 0 : else if ( pRefInputEdit == pEdDestArea )
262 0 : aStr = rRef.aStart.Format(nFmt, pDocP, eConv);
263 :
264 0 : pRefInputEdit->SetRefString( aStr );
265 0 : ModifyHdl( pRefInputEdit );
266 : }
267 0 : }
268 :
269 :
270 0 : bool ScConsolidateDlg::Close()
271 : {
272 0 : return DoClose( ScConsolidateDlgWrapper::GetChildWindowId() );
273 : }
274 :
275 :
276 0 : void ScConsolidateDlg::SetActive()
277 : {
278 0 : if ( bDlgLostFocus )
279 : {
280 0 : bDlgLostFocus = false;
281 :
282 0 : if ( pRefInputEdit )
283 : {
284 0 : pRefInputEdit->GrabFocus();
285 0 : ModifyHdl( pRefInputEdit );
286 : }
287 : }
288 : else
289 0 : GrabFocus();
290 :
291 0 : RefInputDone();
292 0 : }
293 :
294 :
295 0 : void ScConsolidateDlg::Deactivate()
296 : {
297 0 : bDlgLostFocus = true;
298 0 : }
299 :
300 :
301 0 : bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
302 : {
303 0 : if ( !pRangeUtil || !pDoc || !pViewData ||
304 0 : ((pEd != pEdDataArea) && (pEd != pEdDestArea)) )
305 0 : return false;
306 :
307 0 : SCTAB nTab = pViewData->GetTabNo();
308 0 : bool bEditOk = false;
309 0 : OUString theCompleteStr;
310 0 : const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
311 :
312 0 : if ( pEd == pEdDataArea )
313 : {
314 0 : bEditOk = pRangeUtil->IsAbsArea( pEd->GetText(), pDoc,
315 0 : nTab, &theCompleteStr, NULL, NULL, eConv );
316 : }
317 0 : else if ( pEd == pEdDestArea )
318 : {
319 0 : OUString aPosStr;
320 :
321 0 : pRangeUtil->CutPosString( pEd->GetText(), aPosStr );
322 : bEditOk = pRangeUtil->IsAbsPos( aPosStr, pDoc,
323 0 : nTab, &theCompleteStr, NULL, eConv );
324 : }
325 :
326 0 : if ( bEditOk )
327 0 : pEd->SetText( theCompleteStr );
328 :
329 0 : return bEditOk;
330 : }
331 :
332 :
333 : // Handler:
334 :
335 0 : IMPL_LINK( ScConsolidateDlg, GetFocusHdl, Control*, pCtr )
336 : {
337 0 : if ( pCtr ==(Control*)pEdDataArea ||
338 0 : pCtr ==(Control*)pEdDestArea)
339 : {
340 0 : pRefInputEdit = (formula::RefEdit*)pCtr;
341 : }
342 0 : else if(pCtr ==(Control*)pLbDataArea )
343 : {
344 0 : pRefInputEdit = pEdDataArea;
345 : }
346 0 : else if(pCtr ==(Control*)pLbDestArea )
347 : {
348 0 : pRefInputEdit = pEdDestArea;
349 : }
350 0 : return 0;
351 : }
352 :
353 :
354 0 : IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl)
355 : {
356 0 : sal_uInt16 nDataAreaCount = pLbConsAreas->GetEntryCount();
357 :
358 0 : if ( nDataAreaCount > 0 )
359 : {
360 0 : ScRefAddress aDestAddress;
361 0 : SCTAB nTab = pViewData->GetTabNo();
362 0 : OUString aDestPosStr( pEdDestArea->GetText() );
363 0 : const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
364 :
365 0 : if ( pRangeUtil->IsAbsPos( aDestPosStr, pDoc, nTab, NULL, &aDestAddress, eConv ) )
366 : {
367 0 : ScConsolidateParam theOutParam( theConsData );
368 0 : ScArea** ppDataAreas = new ScArea*[nDataAreaCount];
369 : ScArea* pArea;
370 0 : sal_uInt16 i=0;
371 :
372 0 : for ( i=0; i<nDataAreaCount; i++ )
373 : {
374 0 : pArea = new ScArea;
375 : pRangeUtil->MakeArea( pLbConsAreas->GetEntry( i ),
376 0 : *pArea, pDoc, nTab, eConv );
377 0 : ppDataAreas[i] = pArea;
378 : }
379 :
380 0 : theOutParam.nCol = aDestAddress.Col();
381 0 : theOutParam.nRow = aDestAddress.Row();
382 0 : theOutParam.nTab = aDestAddress.Tab();
383 0 : theOutParam.eFunction = LbPosToFunc( pLbFunc->GetSelectEntryPos() );
384 0 : theOutParam.bByCol = pBtnByCol->IsChecked();
385 0 : theOutParam.bByRow = pBtnByRow->IsChecked();
386 0 : theOutParam.bReferenceData = pBtnRefs->IsChecked();
387 0 : theOutParam.SetAreas( ppDataAreas, nDataAreaCount );
388 :
389 0 : for ( i=0; i<nDataAreaCount; i++ )
390 0 : delete ppDataAreas[i];
391 0 : delete [] ppDataAreas;
392 :
393 0 : ScConsolidateItem aOutItem( nWhichCons, &theOutParam );
394 :
395 0 : SetDispatcherLock( false );
396 0 : SwitchToDocument();
397 0 : GetBindings().GetDispatcher()->Execute( SID_CONSOLIDATE,
398 : SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
399 0 : &aOutItem, 0L, 0L );
400 0 : Close();
401 : }
402 : else
403 : {
404 0 : INFOBOX( STR_INVALID_TABREF );
405 0 : pEdDestArea->GrabFocus();
406 0 : }
407 : }
408 : else
409 0 : Close(); // no area defined -> Cancel
410 0 : return 0;
411 : }
412 :
413 :
414 0 : IMPL_LINK( ScConsolidateDlg, ClickHdl, PushButton*, pBtn )
415 : {
416 0 : if ( pBtn == pBtnCancel )
417 0 : Close();
418 0 : else if ( pBtn == pBtnAdd )
419 : {
420 0 : if ( !pEdDataArea->GetText().isEmpty() )
421 : {
422 0 : OUString aNewEntry( pEdDataArea->GetText() );
423 0 : ScArea** ppAreas = NULL;
424 0 : sal_uInt16 nAreaCount = 0;
425 0 : const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
426 :
427 0 : if ( pRangeUtil->IsAbsTabArea( aNewEntry, pDoc, &ppAreas, &nAreaCount, true, eConv ) )
428 : {
429 : // IsAbsTabArea() creates an array of ScArea pointers,
430 : // which have been created dynamically as well.
431 : // These objects need to be deleted here.
432 :
433 0 : for ( sal_uInt16 i=0; i<nAreaCount; i++ )
434 : {
435 0 : OUString aNewArea;
436 :
437 0 : if ( ppAreas[i] )
438 : {
439 0 : const ScArea& rArea = *(ppAreas[i]);
440 0 : aNewArea = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
441 : rArea.nColEnd, rArea.nRowEnd, rArea.nTab
442 0 : ).Format(SCR_ABS_3D, pDoc, eConv);
443 :
444 0 : if ( pLbConsAreas->GetEntryPos( aNewArea )
445 : == LISTBOX_ENTRY_NOTFOUND )
446 : {
447 0 : pLbConsAreas->InsertEntry( aNewArea );
448 : }
449 0 : delete ppAreas[i];
450 : }
451 0 : }
452 0 : delete [] ppAreas;
453 : }
454 0 : else if ( VerifyEdit( pEdDataArea ) )
455 : {
456 0 : OUString aNewArea( pEdDataArea->GetText() );
457 :
458 0 : if ( pLbConsAreas->GetEntryPos( aNewArea ) == LISTBOX_ENTRY_NOTFOUND )
459 0 : pLbConsAreas->InsertEntry( aNewArea );
460 : else
461 0 : INFOBOX( STR_AREA_ALREADY_INSERTED );
462 : }
463 : else
464 : {
465 0 : INFOBOX( STR_INVALID_TABREF );
466 0 : pEdDataArea->GrabFocus();
467 0 : }
468 : }
469 : }
470 0 : else if ( pBtn == pBtnRemove )
471 : {
472 0 : while ( pLbConsAreas->GetSelectEntryCount() )
473 0 : pLbConsAreas->RemoveEntry( pLbConsAreas->GetSelectEntryPos() );
474 0 : pBtnRemove->Disable();
475 : }
476 0 : return 0;
477 : }
478 :
479 :
480 0 : IMPL_LINK( ScConsolidateDlg, SelectHdl, ListBox*, pLb )
481 : {
482 0 : if ( pLb == pLbConsAreas )
483 : {
484 0 : if ( pLbConsAreas->GetSelectEntryCount() > 0 )
485 0 : pBtnRemove->Enable();
486 : else
487 0 : pBtnRemove->Disable();
488 : }
489 0 : else if ( (pLb == pLbDataArea) || (pLb == pLbDestArea) )
490 : {
491 0 : Edit* pEd = (pLb == pLbDataArea) ? pEdDataArea : pEdDestArea;
492 0 : sal_uInt16 nSelPos = pLb->GetSelectEntryPos();
493 :
494 0 : if ( pRangeUtil
495 0 : && (nSelPos > 0)
496 0 : && (nAreaDataCount > 0)
497 0 : && (pAreaData != NULL) )
498 : {
499 0 : if ( static_cast<size_t>(nSelPos) <= nAreaDataCount )
500 : {
501 0 : OUString aString( pAreaData[nSelPos-1].aStrArea );
502 :
503 0 : if ( pLb == pLbDestArea )
504 0 : pRangeUtil->CutPosString( aString, aString );
505 :
506 0 : pEd->SetText( aString );
507 :
508 0 : if ( pEd == pEdDataArea )
509 0 : pBtnAdd->Enable();
510 0 : }
511 : }
512 : else
513 : {
514 0 : pEd->SetText( EMPTY_OUSTRING );
515 0 : if ( pEd == pEdDataArea )
516 0 : pBtnAdd->Enable();
517 : }
518 : }
519 0 : return 0;
520 : }
521 :
522 :
523 0 : IMPL_LINK( ScConsolidateDlg, ModifyHdl, formula::RefEdit*, pEd )
524 : {
525 0 : if ( pEd == pEdDataArea )
526 : {
527 0 : OUString aAreaStr( pEd->GetText() );
528 0 : if ( !aAreaStr.isEmpty() )
529 : {
530 0 : pBtnAdd->Enable();
531 : }
532 : else
533 0 : pBtnAdd->Disable();
534 : }
535 0 : else if ( pEd == pEdDestArea )
536 : {
537 0 : pLbDestArea->SelectEntryPos(0);
538 : }
539 0 : return 0;
540 : }
541 :
542 :
543 : // TODO: generalize!
544 : // Resource of the ListBox and these two conversion methods are also in
545 : // tpsubt and everywhere, where StarCalc functions are selectable.
546 :
547 0 : ScSubTotalFunc ScConsolidateDlg::LbPosToFunc( sal_uInt16 nPos )
548 : {
549 0 : switch ( nPos )
550 : {
551 0 : case 2: return SUBTOTAL_FUNC_AVE;
552 0 : case 6: return SUBTOTAL_FUNC_CNT;
553 0 : case 1: return SUBTOTAL_FUNC_CNT2;
554 0 : case 3: return SUBTOTAL_FUNC_MAX;
555 0 : case 4: return SUBTOTAL_FUNC_MIN;
556 0 : case 5: return SUBTOTAL_FUNC_PROD;
557 0 : case 7: return SUBTOTAL_FUNC_STD;
558 0 : case 8: return SUBTOTAL_FUNC_STDP;
559 0 : case 9: return SUBTOTAL_FUNC_VAR;
560 0 : case 10: return SUBTOTAL_FUNC_VARP;
561 : case 0:
562 : default:
563 0 : return SUBTOTAL_FUNC_SUM;
564 : }
565 : }
566 :
567 0 : sal_uInt16 ScConsolidateDlg::FuncToLbPos( ScSubTotalFunc eFunc )
568 : {
569 0 : switch ( eFunc )
570 : {
571 0 : case SUBTOTAL_FUNC_AVE: return 2;
572 0 : case SUBTOTAL_FUNC_CNT: return 6;
573 0 : case SUBTOTAL_FUNC_CNT2: return 1;
574 0 : case SUBTOTAL_FUNC_MAX: return 3;
575 0 : case SUBTOTAL_FUNC_MIN: return 4;
576 0 : case SUBTOTAL_FUNC_PROD: return 5;
577 0 : case SUBTOTAL_FUNC_STD: return 7;
578 0 : case SUBTOTAL_FUNC_STDP: return 8;
579 0 : case SUBTOTAL_FUNC_VAR: return 9;
580 0 : case SUBTOTAL_FUNC_VARP: return 10;
581 : case SUBTOTAL_FUNC_NONE:
582 : case SUBTOTAL_FUNC_SUM:
583 : default:
584 0 : return 0;
585 : }
586 0 : }
587 :
588 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|