LibreOffice Module sc (master) 1
tpsubt.cxx
Go to the documentation of this file.
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#undef SC_DLLIMPLEMENTATION
21
22#include <scitems.hxx>
23#include <uiitems.hxx>
24#include <global.hxx>
25#include <userlist.hxx>
26#include <viewdata.hxx>
27#include <document.hxx>
28#include <scresid.hxx>
29#include <sc.hrc>
30#include <strings.hrc>
31#include <subtotals.hrc>
32
33#include <tpsubt.hxx>
34#include <tpsort.hxx>
35#include <memory>
36
37#include <osl/diagnose.h>
38
39// Subtotals group tabpage:
40
41ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet, const sal_uInt16& rTabNumber)
42 : SfxTabPage(pPage, pController, "modules/scalc/ui/subtotalgrppage.ui", "SubTotalGrpPage", &rArgSet)
43 , aStrNone(ScResId(SCSTR_NONE))
44 , aStrColumn(ScResId(SCSTR_COLUMN_LETTER))
45 , pViewData(nullptr)
46 , pDoc(nullptr)
47 , nWhichSubTotals(rArgSet.GetPool()->GetWhich(SID_SUBTOTALS))
48 , rSubTotalData(rArgSet.Get(nWhichSubTotals).GetSubTotalData())
49 , nFieldCount(0)
50 , mxLbGroup(m_xBuilder->weld_combo_box("group_by"))
51 , mxLbColumns(m_xBuilder->weld_tree_view("columns"))
52 , mxLbFunctions(m_xBuilder->weld_tree_view("functions"))
53 , mxLbSelectAllColumns(m_xBuilder->weld_check_button("select_all_columns_button"))
54{
55 for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_SUBTOTALS); ++i)
56 mxLbFunctions->append_text(ScResId(SCSTR_SUBTOTALS[i]));
57
58 auto nHeight = mxLbColumns->get_height_rows(14);
59 mxLbColumns->set_size_request(-1, nHeight);
60 mxLbFunctions->set_size_request(-1, nHeight);
61
62 mxLbColumns->enable_toggle_buttons(weld::ColumnToggleType::Check);
63
64 Init();
65
66 // UI tests
67 mxLbGroup->set_buildable_name(mxLbGroup->get_buildable_name() + OUString::number(rTabNumber));
68 mxLbColumns->set_buildable_name(mxLbColumns->get_buildable_name() + OUString::number(rTabNumber));
69}
70
72{
73}
74
76{
77 const ScSubTotalItem& rSubTotalItem = GetItemSet().Get( nWhichSubTotals );
78
79 pViewData = rSubTotalItem.GetViewData();
80 assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
82 assert(pDoc && "Document not found :-(");
83
84 mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
85 mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
86 mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
87 mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl) );
88 mxLbSelectAllColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckBoxHdl ) );
89
91 mnFieldArr[0] = 0;
93}
94
95namespace
96{
97 int GetCheckedEntryCount(weld::TreeView& rTreeView)
98 {
99 int nRet = 0;
100
101 rTreeView.all_foreach([&](const weld::TreeIter& rEntry) {
102 if ( rTreeView.get_toggle(rEntry) == TRISTATE_TRUE )
103 ++nRet;
104 return false;
105 });
106
107 return nRet;
108 }
109}
110
111bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
112 const SfxItemSet& rArgSet )
113{
114 sal_uInt16 nGroupIdx = 0;
115
116 OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
117
118 if ( (nGroupNo > 3) || (nGroupNo == 0) )
119 return false;
120 else
121 nGroupIdx = nGroupNo-1;
122
123 // first we have to clear the listboxes...
124 for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
125 {
126 mxLbColumns->set_toggle(nLbEntry, TRISTATE_FALSE);
127 mxLbColumns->set_id(nLbEntry, "0");
128 }
129 mxLbFunctions->select(0);
130
131 const ScSubTotalParam & theSubTotalData( rArgSet.Get( nWhichSubTotals ).GetSubTotalData() );
132
133 if ( theSubTotalData.bGroupActive[nGroupIdx] )
134 {
135 SCCOL nField = theSubTotalData.nField[nGroupIdx];
136 SCCOL nSubTotals = theSubTotalData.nSubTotals[nGroupIdx];
137 SCCOL* pSubTotals = theSubTotalData.pSubTotals[nGroupIdx].get();
138 ScSubTotalFunc* pFunctions = theSubTotalData.pFunctions[nGroupIdx].get();
139
140 mxLbGroup->set_active( GetFieldSelPos( nField )+1 );
141
142 sal_uInt16 nFirstChecked = 0;
143 for ( sal_uInt16 i=0; i<nSubTotals; i++ )
144 {
145 sal_uInt16 nCheckPos = GetFieldSelPos( pSubTotals[i] );
146
147 mxLbColumns->set_toggle(nCheckPos, TRISTATE_TRUE);
148 mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(pFunctions[i])));
149
150 if (i == 0 || nCheckPos < nFirstChecked)
151 nFirstChecked = nCheckPos;
152 }
153 // Select the first checked field from the top.
154 mxLbColumns->select(nFirstChecked);
155 }
156 else
157 {
158 mxLbGroup->set_active( (nGroupNo == 1) ? 1 : 0 );
159 mxLbColumns->select( 0 );
160 mxLbFunctions->select( 0 );
161 }
162
163 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
164 mxLbSelectAllColumns->set_active( true );
165 else
166 mxLbSelectAllColumns->set_active( false );
167
168 return true;
169}
170
171bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
172 SfxItemSet& rArgSet )
173{
174 sal_uInt16 nGroupIdx = 0;
175
176 OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
177 OSL_ENSURE( (mxLbGroup->get_count() > 0)
178 && (mxLbColumns->n_children() > 0)
179 && (mxLbFunctions->n_children() > 0),
180 "Non-initialized Lists" );
181
182 if ( (nGroupNo > 3) || (nGroupNo == 0)
183 || (mxLbGroup->get_count() == 0)
184 || (mxLbColumns->n_children() == 0)
185 || (mxLbFunctions->n_children() == 0)
186 )
187 return false;
188 else
189 nGroupIdx = nGroupNo-1;
190
191 ScSubTotalParam theSubTotalData; // read out, if already partly filled
192 const SfxItemSet* pExample = GetDialogExampleSet();
193 if (pExample)
194 {
195 if (const ScSubTotalItem* pItem = pExample->GetItemIfSet(nWhichSubTotals))
196 theSubTotalData = pItem->GetSubTotalData();
197 }
198
199 std::unique_ptr<ScSubTotalFunc[]> pFunctions;
200 std::unique_ptr<SCCOL[]> pSubTotals;
201 const sal_Int32 nGroup = mxLbGroup->get_active();
202 const sal_Int32 nEntryCount = mxLbColumns->n_children();
203 const sal_Int32 nCheckCount = GetCheckedEntryCount(*mxLbColumns);
204
205 theSubTotalData.nCol1 = rSubTotalData.nCol1;
206 theSubTotalData.nRow1 = rSubTotalData.nRow1;
207 theSubTotalData.nCol2 = rSubTotalData.nCol2;
208 theSubTotalData.nRow2 = rSubTotalData.nRow2;
209 theSubTotalData.bGroupActive[nGroupIdx] = (nGroup != 0);
210 theSubTotalData.nField[nGroupIdx] = (nGroup != 0)
211 ? mnFieldArr[nGroup-1]
212 : static_cast<SCCOL>(0);
213
214 if ( nEntryCount>0 && nCheckCount>0 && nGroup!=0 )
215 {
216 sal_uInt16 nFunction = 0;
217
218 pSubTotals.reset(new SCCOL [nCheckCount]);
219 pFunctions.reset(new ScSubTotalFunc [nCheckCount]);
220
221 for ( sal_Int32 i=0, nCheck=0; i<nEntryCount; i++ )
222 {
223 if (mxLbColumns->get_toggle(i) == TRISTATE_TRUE)
224 {
225 OSL_ENSURE( nCheck <= nCheckCount,
226 "Range error :-(" );
227 nFunction = mxLbColumns->get_id(i).toUInt32();
228 pSubTotals[nCheck] = mnFieldArr[i];
229 pFunctions[nCheck] = LbPosToFunc( nFunction );
230 nCheck++;
231 }
232 }
233 theSubTotalData.SetSubTotals( nGroupNo, // group number
234 pSubTotals.get(),
235 pFunctions.get(),
236 nCheckCount ); // number of array elements
237
238 }
239
240 rArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, nullptr, &theSubTotalData ) );
241
242 return true;
243}
244
246{
247 assert(pViewData && pDoc && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
248
249 SCCOL nFirstCol = rSubTotalData.nCol1;
250 SCROW nFirstRow = rSubTotalData.nRow1;
251 SCTAB nTab = pViewData->GetTabNo();
252 SCCOL nMaxCol = rSubTotalData.nCol2;
253 SCCOL col;
254 OUString aFieldName;
255
256 mxLbGroup->clear();
257 mxLbColumns->clear();
258 mxLbGroup->insert_text(0, aStrNone );
259
260 mxLbColumns->freeze();
261 sal_uInt16 i=0;
262 for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS(pDoc->GetSheetLimits()); col++ )
263 {
264 aFieldName = pDoc->GetString(col, nFirstRow, nTab);
265 if ( aFieldName.isEmpty() )
266 {
267 aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", ScColToAlpha( col ));
268 }
269 mnFieldArr[i] = col;
270 mxLbGroup->insert_text(i+1, aFieldName);
271 mxLbColumns->insert(i);
272 mxLbColumns->set_toggle(i, TRISTATE_FALSE);
273 mxLbColumns->set_text(i, aFieldName, 0);
274 mxLbColumns->set_id(i, "0");
275 i++;
276 }
277 mxLbColumns->thaw();
278
279 // subsequent initialization of the constant:
280 nFieldCount = i;
281}
282
284{
285 sal_uInt16 nFieldPos = 0;
286 bool bFound = false;
287
288 for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
289 {
290 if ( mnFieldArr[n] == nField )
291 {
292 nFieldPos = n;
293 bFound = true;
294 }
295 }
296
297 return nFieldPos;
298}
299
301{
302 switch ( nPos )
303 {
304// case 0: return SUBTOTAL_FUNC_NONE;
305 case 2: return SUBTOTAL_FUNC_AVE;
306 case 6: return SUBTOTAL_FUNC_CNT;
307 case 1: return SUBTOTAL_FUNC_CNT2;
308 case 3: return SUBTOTAL_FUNC_MAX;
309 case 4: return SUBTOTAL_FUNC_MIN;
310 case 5: return SUBTOTAL_FUNC_PROD;
311 case 7: return SUBTOTAL_FUNC_STD;
312 case 8: return SUBTOTAL_FUNC_STDP;
313 case 0: return SUBTOTAL_FUNC_SUM;
314 case 9: return SUBTOTAL_FUNC_VAR;
315 case 10: return SUBTOTAL_FUNC_VARP;
316 default:
317 OSL_FAIL( "ScTpSubTotalGroup::LbPosToFunc" );
318 return SUBTOTAL_FUNC_NONE;
319 }
320}
321
323{
324 switch ( eFunc )
325 {
326// case SUBTOTAL_FUNC_NONE: return 0;
327 case SUBTOTAL_FUNC_AVE: return 2;
328 case SUBTOTAL_FUNC_CNT: return 6;
329 case SUBTOTAL_FUNC_CNT2: return 1;
330 case SUBTOTAL_FUNC_MAX: return 3;
331 case SUBTOTAL_FUNC_MIN: return 4;
332 case SUBTOTAL_FUNC_PROD: return 5;
333 case SUBTOTAL_FUNC_STD: return 7;
334 case SUBTOTAL_FUNC_STDP: return 8;
335 case SUBTOTAL_FUNC_SUM: return 0;
336 case SUBTOTAL_FUNC_VAR: return 9;
337 case SUBTOTAL_FUNC_VARP: return 10;
338 default:
339 OSL_FAIL( "ScTpSubTotalGroup::FuncToLbPos" );
340 return 0;
341 }
342}
343
344// Handler:
345
346IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
347{
348 SelectHdl(&rLb);
349
350 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
351 mxLbSelectAllColumns->set_active( true );
352 else
353 mxLbSelectAllColumns->set_active( false );
354}
355
356IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
357{
358 SelectHdl(&rLb);
359}
360
362{
363 const sal_Int32 nColumn = mxLbColumns->get_selected_index();
364 if (nColumn == -1)
365 return;
366
367 const sal_Int32 nFunction = mxLbFunctions->get_selected_index();
368 sal_uInt16 nOldFunction = mxLbColumns->get_id(nColumn).toUInt32();
369
370 if ( pLb == mxLbColumns.get() )
371 {
372 mxLbFunctions->select(nOldFunction);
373 }
374 else if ( pLb == mxLbFunctions.get() )
375 {
376 mxLbColumns->set_id(nColumn, OUString::number(nFunction));
377 mxLbColumns->set_toggle(nColumn, TRISTATE_TRUE);
378 }
379}
380
381IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const weld::TreeView::iter_col&, rRowCol, void )
382{
383 mxLbColumns->select(rRowCol.first);
384 SelectHdl(mxLbColumns.get());
385
386 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
387 mxLbSelectAllColumns->set_active( true );
388 else
389 mxLbSelectAllColumns->set_active( false );
390}
391
392// Derived Group TabPages:
393
394std::unique_ptr<SfxTabPage> ScTpSubTotalGroup1::Create( weld::Container* pPage, weld::DialogController* pController,
395 const SfxItemSet* rArgSet )
396{
397 return std::make_unique<ScTpSubTotalGroup1>( pPage, pController, *rArgSet );
398}
399
400std::unique_ptr<SfxTabPage> ScTpSubTotalGroup2::Create( weld::Container* pPage, weld::DialogController* pController,
401 const SfxItemSet* rArgSet )
402{
403 return std::make_unique<ScTpSubTotalGroup2>( pPage, pController, *rArgSet );
404}
405
406std::unique_ptr<SfxTabPage> ScTpSubTotalGroup3::Create( weld::Container* pPage, weld::DialogController* pController,
407 const SfxItemSet* rArgSet )
408{
409 return std::make_unique<ScTpSubTotalGroup3>( pPage, pController, *rArgSet );
410}
411
413 ScTpSubTotalGroup( pPage, pController, rArgSet, 1 )
414{}
415
417 ScTpSubTotalGroup( pPage, pController, rArgSet, 2 )
418{}
419
421 ScTpSubTotalGroup( pPage, pController, rArgSet, 3 )
422{}
423
424#define RESET(i) (ScTpSubTotalGroup::DoReset( (i), *rArgSet ))
425void ScTpSubTotalGroup1::Reset( const SfxItemSet* rArgSet ) { RESET(1); }
426void ScTpSubTotalGroup2::Reset( const SfxItemSet* rArgSet ) { RESET(2); }
427void ScTpSubTotalGroup3::Reset( const SfxItemSet* rArgSet ) { RESET(3); }
428#undef RESET
429
430#define FILLSET(i) (ScTpSubTotalGroup::DoFillItemSet( (i), *rArgSet ))
434#undef FILL
435
436// options tab page:
437
439
440 : SfxTabPage ( pPage, pController,
441 "modules/scalc/ui/subtotaloptionspage.ui", "SubTotalOptionsPage",
442 &rArgSet ),
443 pViewData ( nullptr ),
444 pDoc ( nullptr ),
445 nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
446 rSubTotalData ( rArgSet.Get( nWhichSubTotals ).GetSubTotalData() )
447 , m_xBtnPagebreak(m_xBuilder->weld_check_button("pagebreak"))
448 , m_xBtnCase(m_xBuilder->weld_check_button("case"))
449 , m_xBtnSort(m_xBuilder->weld_check_button("sort"))
450 , m_xFlSort(m_xBuilder->weld_label("label2"))
451 , m_xBtnAscending(m_xBuilder->weld_radio_button("ascending"))
452 , m_xBtnDescending(m_xBuilder->weld_radio_button("descending"))
453 , m_xBtnFormats(m_xBuilder->weld_check_button("formats"))
454 , m_xBtnUserDef(m_xBuilder->weld_check_button("btnuserdef"))
455 , m_xLbUserDef(m_xBuilder->weld_combo_box("lbuserdef"))
456{
457 m_xLbUserDef->set_accessible_description(ScResId(STR_A11Y_DESC_USERDEF));
458 m_xBtnUserDef->set_accessible_description(ScResId(STR_A11Y_DESC_USERDEF));
459 Init();
460}
461
463{
464}
465
467{
468 const ScSubTotalItem& rSubTotalItem = GetItemSet().Get( nWhichSubTotals );
469
470 pViewData = rSubTotalItem.GetViewData();
471 assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
473 assert(pDoc && "Document not found!");
474
475 m_xBtnSort->connect_toggled( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
476 m_xBtnUserDef->connect_toggled( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
477
479}
480
481std::unique_ptr<SfxTabPage> ScTpSubTotalOptions::Create(weld::Container* pPage, weld::DialogController* pController,
482 const SfxItemSet* rArgSet)
483{
484 return std::make_unique<ScTpSubTotalOptions>(pPage, pController, *rArgSet);
485}
486
487void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ )
488{
490 m_xBtnCase->set_active( rSubTotalData.bCaseSens );
492 m_xBtnSort->set_active( rSubTotalData.bDoSort );
495
497 {
498 m_xBtnUserDef->set_active(true);
499 m_xLbUserDef->set_sensitive(true);
501 }
502 else
503 {
504 m_xBtnUserDef->set_active( false );
505 m_xLbUserDef->set_sensitive(false);
506 m_xLbUserDef->set_active(0);
507 }
508
509 CheckHdl(*m_xBtnSort);
510}
511
513{
514 ScSubTotalParam theSubTotalData; // read out, if already partly filled
515 const SfxItemSet* pExample = GetDialogExampleSet();
516 if (pExample)
517 {
518 if (const ScSubTotalItem* pItem = pExample->GetItemIfSet(nWhichSubTotals))
519 theSubTotalData = pItem->GetSubTotalData();
520 }
521
522 theSubTotalData.bPagebreak = m_xBtnPagebreak->get_active();
523 theSubTotalData.bReplace = true;
524 theSubTotalData.bCaseSens = m_xBtnCase->get_active();
525 theSubTotalData.bIncludePattern = m_xBtnFormats->get_active();
526 theSubTotalData.bDoSort = m_xBtnSort->get_active();
527 theSubTotalData.bAscending = m_xBtnAscending->get_active();
528 theSubTotalData.bUserDef = m_xBtnUserDef->get_active();
529 theSubTotalData.nUserIndex = (m_xBtnUserDef->get_active())
530 ? m_xLbUserDef->get_active()
531 : 0;
532
533 rArgSet->Put( ScSubTotalItem( nWhichSubTotals, nullptr, &theSubTotalData ) );
534
535 return true;
536}
537
539{
540 ScUserList* pUserLists = ScGlobal::GetUserList();
541
542 m_xLbUserDef->freeze();
543 m_xLbUserDef->clear();
544 if ( pUserLists )
545 {
546 size_t nCount = pUserLists->size();
547 for ( size_t i=0; i<nCount; ++i )
548 m_xLbUserDef->append_text((*pUserLists)[i].GetString() );
549 }
550 m_xLbUserDef->thaw();
551}
552
553// Handler:
554
556{
557 if (&rBox == m_xBtnSort.get())
558 {
559 if ( m_xBtnSort->get_active() )
560 {
561 m_xFlSort->set_sensitive(true);
562 m_xBtnFormats->set_sensitive(true);
563 m_xBtnUserDef->set_sensitive(true);
564 m_xBtnAscending->set_sensitive(true);
565 m_xBtnDescending->set_sensitive(true);
566
567 if ( m_xBtnUserDef->get_active() )
568 m_xLbUserDef->set_sensitive(true);
569 }
570 else
571 {
572 m_xFlSort->set_sensitive(false);
573 m_xBtnFormats->set_sensitive(false);
574 m_xBtnUserDef->set_sensitive(false);
575 m_xBtnAscending->set_sensitive(false);
576 m_xBtnDescending->set_sensitive(false);
577 m_xLbUserDef->set_sensitive(false);
578 }
579 }
580 else if (&rBox == m_xBtnUserDef.get())
581 {
582 if ( m_xBtnUserDef->get_active() )
583 {
584 m_xLbUserDef->set_sensitive(true);
585 m_xLbUserDef->grab_focus();
586 }
587 else
588 m_xLbUserDef->set_sensitive(false);
589 }
590}
591
593{
594 if (&rBox != mxLbSelectAllColumns.get())
595 return;
596
597 bool bChecked = mxLbSelectAllColumns->get_active();
598
599 mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) {
600 if ( bChecked )
601 mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE);
602 else
603 mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE);
604
605 return false;
606 });
607}
608
610{
611}
612
614{
615}
616
618{
619}
620
621/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1884
#define GetWhich(nSlot)
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3505
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, std::u16string_view rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Definition: global.cxx:1147
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:288
ScViewData * GetViewData() const
Definition: uiitems.hxx:186
virtual ~ScTpSubTotalGroup1() override
Definition: tpsubt.cxx:609
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:394
ScTpSubTotalGroup1(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:412
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:431
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:425
ScTpSubTotalGroup2(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:416
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:400
virtual ~ScTpSubTotalGroup2() override
Definition: tpsubt.cxx:613
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:432
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:426
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:427
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:433
virtual ~ScTpSubTotalGroup3() override
Definition: tpsubt.cxx:617
ScTpSubTotalGroup3(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:420
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:406
sal_uInt16 nFieldCount
Definition: tpsubt.hxx:65
std::unique_ptr< weld::TreeView > mxLbFunctions
Definition: tpsubt.hxx:69
const OUString aStrColumn
Definition: tpsubt.hxx:57
sal_uInt16 GetFieldSelPos(SCCOL nField)
Definition: tpsubt.cxx:283
bool DoReset(sal_uInt16 nGroupNo, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:111
std::unique_ptr< weld::CheckButton > mxLbSelectAllColumns
Definition: tpsubt.hxx:70
ScDocument * pDoc
Definition: tpsubt.hxx:60
void FillListBoxes()
Definition: tpsubt.cxx:245
static sal_uInt16 FuncToLbPos(ScSubTotalFunc eFunc)
Definition: tpsubt.cxx:322
bool DoFillItemSet(sal_uInt16 nGroupNo, SfxItemSet &rArgSet)
Definition: tpsubt.cxx:171
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:63
const OUString aStrNone
Definition: tpsubt.hxx:56
std::vector< SCCOL > mnFieldArr
Definition: tpsubt.hxx:64
ScViewData * pViewData
Definition: tpsubt.hxx:59
static ScSubTotalFunc LbPosToFunc(sal_uInt16 nPos)
Definition: tpsubt.cxx:300
std::unique_ptr< weld::TreeView > mxLbColumns
Definition: tpsubt.hxx:68
std::unique_ptr< weld::ComboBox > mxLbGroup
Definition: tpsubt.hxx:67
void SelectHdl(const weld::Widget *)
Definition: tpsubt.cxx:361
const TypedWhichId< ScSubTotalItem > nWhichSubTotals
Definition: tpsubt.hxx:62
ScTpSubTotalGroup(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet, const sal_uInt16 &nTabNumber)
Definition: tpsubt.cxx:41
virtual ~ScTpSubTotalGroup() override
Definition: tpsubt.cxx:71
std::unique_ptr< weld::CheckButton > m_xBtnSort
Definition: tpsubt.hxx:137
ScDocument * pDoc
Definition: tpsubt.hxx:131
ScTpSubTotalOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:438
std::unique_ptr< weld::CheckButton > m_xBtnUserDef
Definition: tpsubt.hxx:142
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:133
const TypedWhichId< ScSubTotalItem > nWhichSubTotals
Definition: tpsubt.hxx:132
std::unique_ptr< weld::CheckButton > m_xBtnPagebreak
Definition: tpsubt.hxx:135
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:487
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: tpsubt.hxx:136
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:481
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:512
std::unique_ptr< weld::RadioButton > m_xBtnDescending
Definition: tpsubt.hxx:140
std::unique_ptr< weld::CheckButton > m_xBtnFormats
Definition: tpsubt.hxx:141
std::unique_ptr< weld::ComboBox > m_xLbUserDef
Definition: tpsubt.hxx:143
virtual ~ScTpSubTotalOptions() override
Definition: tpsubt.cxx:462
ScViewData * pViewData
Definition: tpsubt.hxx:130
void FillUserSortListBox()
Definition: tpsubt.cxx:538
std::unique_ptr< weld::RadioButton > m_xBtnAscending
Definition: tpsubt.hxx:139
Collection of user-defined sort lists.
Definition: userlist.hxx:62
size_t size() const
Definition: userlist.hxx:84
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetItemSet() const
const SfxItemSet * GetDialogExampleSet() const
std::pair< const TreeIter &, int > iter_col
virtual TriState get_toggle(int row, int col=-1) const=0
virtual void all_foreach(const std::function< bool(TreeIter &)> &func)=0
int nCount
float u
TRISTATE_FALSE
TRISTATE_TRUE
ScSubTotalFunc
Definition: global.hxx:860
@ SUBTOTAL_FUNC_STDP
Definition: global.hxx:869
@ SUBTOTAL_FUNC_MAX
Definition: global.hxx:865
@ SUBTOTAL_FUNC_CNT2
Definition: global.hxx:864
@ SUBTOTAL_FUNC_AVE
Definition: global.hxx:862
@ SUBTOTAL_FUNC_VARP
Definition: global.hxx:872
@ SUBTOTAL_FUNC_VAR
Definition: global.hxx:871
@ SUBTOTAL_FUNC_NONE
Definition: global.hxx:861
@ SUBTOTAL_FUNC_SUM
Definition: global.hxx:870
@ SUBTOTAL_FUNC_STD
Definition: global.hxx:868
@ SUBTOTAL_FUNC_MIN
Definition: global.hxx:866
@ SUBTOTAL_FUNC_CNT
Definition: global.hxx:863
@ SUBTOTAL_FUNC_PROD
Definition: global.hxx:867
sal_Int64 n
sal_uInt16 nPos
#define SAL_N_ELEMENTS(arr)
RttiCompleteObjectLocator col
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
int i
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SCITEM_SUBTDATA
Definition: scitems.hxx:92
bool bUserDef
sort user defined
bool bPagebreak
page break at change of group
bool bAscending
sort ascending
bool bGroupActive[MAXSUBTOTAL]
active groups
sal_uInt16 nUserIndex
index into list
SCCOL nField[MAXSUBTOTAL]
associated field
SCCOL nSubTotals[MAXSUBTOTAL]
number of SubTotals
bool bDoSort
presort
std::unique_ptr< ScSubTotalFunc[]> pFunctions[MAXSUBTOTAL]
array of associated functions
std::unique_ptr< SCCOL[]> pSubTotals[MAXSUBTOTAL]
array of columns to be calculated
SCCOL nCol1
selected area
void SetSubTotals(sal_uInt16 nGroup, const SCCOL *ptrSubTotals, const ScSubTotalFunc *ptrFunctions, sal_uInt16 nCount)
bool bIncludePattern
sort formats
bool bReplace
replace existing results
SCCOL SC_MAXFIELDS(const ScSheetLimits &rLimits)
Definition: tpsort.hxx:37
IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView &, rLb, void)
Definition: tpsubt.cxx:346
#define FILLSET(i)
Definition: tpsubt.cxx:430
#define RESET(i)
Definition: tpsubt.cxx:424
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17