cid#1607171 Data race condition
[LibreOffice.git] / sc / source / ui / dbgui / tpsubt.cxx
blob6acfabef6fa6babf98fbdb9a35ef072b80e41b15
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
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>
33 #include <tpsubt.hxx>
34 #include <tpsort.hxx>
35 #include <memory>
37 #include <osl/diagnose.h>
39 // Subtotals group tabpage:
41 ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet, const sal_uInt16& rTabNumber)
42 : SfxTabPage(pPage, pController, u"modules/scalc/ui/subtotalgrppage.ui"_ustr, u"SubTotalGrpPage"_ustr, &rArgSet)
43 , aStrNone(ScResId(SCSTR_NONE))
44 , aStrColumn(ScResId(SCSTR_COLUMN_LETTER))
45 , pViewData(nullptr)
46 , pDoc(nullptr)
47 , nWhichSubTotals(rArgSet.GetPool()->GetWhichIDFromSlotID(SID_SUBTOTALS))
48 , rSubTotalData(rArgSet.Get(nWhichSubTotals).GetSubTotalData())
49 , nFieldCount(0)
50 , mxLbGroup(m_xBuilder->weld_combo_box(u"group_by"_ustr))
51 , mxLbColumns(m_xBuilder->weld_tree_view(u"columns"_ustr))
52 , mxLbFunctions(m_xBuilder->weld_tree_view(u"functions"_ustr))
53 , mxLbSelectAllColumns(m_xBuilder->weld_check_button(u"select_all_columns_button"_ustr))
55 for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_SUBTOTALS); ++i)
56 mxLbFunctions->append_text(ScResId(SCSTR_SUBTOTALS[i]));
58 auto nHeight = mxLbColumns->get_height_rows(14);
59 mxLbColumns->set_size_request(-1, nHeight);
60 mxLbFunctions->set_size_request(-1, nHeight);
62 mxLbColumns->enable_toggle_buttons(weld::ColumnToggleType::Check);
64 Init();
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));
71 ScTpSubTotalGroup::~ScTpSubTotalGroup()
75 void ScTpSubTotalGroup::Init()
77 const ScSubTotalItem& rSubTotalItem = GetItemSet().Get( nWhichSubTotals );
79 pViewData = rSubTotalItem.GetViewData();
80 assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
81 pDoc = &pViewData->GetDocument();
82 assert(pDoc && "Document not found :-(");
84 mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
85 mxLbColumns->connect_selection_changed(LINK(this, ScTpSubTotalGroup, SelectTreeListBoxHdl));
86 mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
87 mxLbFunctions->connect_selection_changed(LINK(this, ScTpSubTotalGroup, SelectTreeListBoxHdl));
88 mxLbSelectAllColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckBoxHdl ) );
90 mnFieldArr.resize(SC_MAXFIELDS(pDoc->GetSheetLimits()));
91 mnFieldArr[0] = 0;
92 FillListBoxes();
95 namespace
97 int GetCheckedEntryCount(weld::TreeView& rTreeView)
99 int nRet = 0;
101 rTreeView.all_foreach([&](const weld::TreeIter& rEntry) {
102 if ( rTreeView.get_toggle(rEntry) == TRISTATE_TRUE )
103 ++nRet;
104 return false;
107 return nRet;
111 bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
112 const SfxItemSet& rArgSet )
114 sal_uInt16 nGroupIdx = 0;
116 OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
118 if ( (nGroupNo > 3) || (nGroupNo == 0) )
119 return false;
120 else
121 nGroupIdx = nGroupNo-1;
123 // first we have to clear the listboxes...
124 for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
126 mxLbColumns->set_toggle(nLbEntry, TRISTATE_FALSE);
127 mxLbColumns->set_id(nLbEntry, u"0"_ustr);
129 mxLbFunctions->select(0);
131 const ScSubTotalParam & theSubTotalData( rArgSet.Get( nWhichSubTotals ).GetSubTotalData() );
133 if (theSubTotalData.aGroups[nGroupIdx].bActive)
135 const auto& group = theSubTotalData.aGroups[nGroupIdx];
137 mxLbGroup->set_active(GetFieldSelPos(group.nField) + 1);
139 sal_uInt16 nFirstChecked = 0;
140 for (sal_uInt16 i = 0; i < group.nSubTotals; i++)
142 sal_uInt16 nCheckPos = GetFieldSelPos(group.col(i));
144 mxLbColumns->set_toggle(nCheckPos, TRISTATE_TRUE);
145 mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(group.func(i))));
147 if (i == 0 || nCheckPos < nFirstChecked)
148 nFirstChecked = nCheckPos;
150 // Select the first checked field from the top.
151 mxLbColumns->select(nFirstChecked);
153 else
155 mxLbGroup->set_active( (nGroupNo == 1) ? 1 : 0 );
156 mxLbColumns->select( 0 );
157 mxLbFunctions->select( 0 );
160 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
161 mxLbSelectAllColumns->set_active( true );
162 else
163 mxLbSelectAllColumns->set_active( false );
165 return true;
168 bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
169 SfxItemSet& rArgSet )
171 sal_uInt16 nGroupIdx = 0;
173 OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
174 OSL_ENSURE( (mxLbGroup->get_count() > 0)
175 && (mxLbColumns->n_children() > 0)
176 && (mxLbFunctions->n_children() > 0),
177 "Non-initialized Lists" );
179 if ( (nGroupNo > 3) || (nGroupNo == 0)
180 || (mxLbGroup->get_count() == 0)
181 || (mxLbColumns->n_children() == 0)
182 || (mxLbFunctions->n_children() == 0)
184 return false;
185 else
186 nGroupIdx = nGroupNo-1;
188 ScSubTotalParam theSubTotalData; // read out, if already partly filled
189 const SfxItemSet* pExample = GetDialogExampleSet();
190 if (pExample)
192 if (const ScSubTotalItem* pItem = pExample->GetItemIfSet(nWhichSubTotals))
193 theSubTotalData = pItem->GetSubTotalData();
196 std::unique_ptr<ScSubTotalFunc[]> pFunctions;
197 std::unique_ptr<SCCOL[]> pSubTotals;
198 const sal_Int32 nGroup = mxLbGroup->get_active();
199 const sal_Int32 nEntryCount = mxLbColumns->n_children();
200 const sal_Int32 nCheckCount = GetCheckedEntryCount(*mxLbColumns);
202 theSubTotalData.nCol1 = rSubTotalData.nCol1;
203 theSubTotalData.nRow1 = rSubTotalData.nRow1;
204 theSubTotalData.nCol2 = rSubTotalData.nCol2;
205 theSubTotalData.nRow2 = rSubTotalData.nRow2;
206 theSubTotalData.aGroups[nGroupIdx].bActive = (nGroup != 0);
207 theSubTotalData.aGroups[nGroupIdx].nField = (nGroup != 0)
208 ? mnFieldArr[nGroup-1]
209 : static_cast<SCCOL>(0);
211 if ( nEntryCount>0 && nCheckCount>0 && nGroup!=0 )
213 sal_uInt16 nFunction = 0;
215 pSubTotals.reset(new SCCOL [nCheckCount]);
216 pFunctions.reset(new ScSubTotalFunc [nCheckCount]);
218 for ( sal_Int32 i=0, nCheck=0; i<nEntryCount; i++ )
220 if (mxLbColumns->get_toggle(i) == TRISTATE_TRUE)
222 OSL_ENSURE( nCheck <= nCheckCount,
223 "Range error :-(" );
224 nFunction = mxLbColumns->get_id(i).toUInt32();
225 pSubTotals[nCheck] = mnFieldArr[i];
226 pFunctions[nCheck] = LbPosToFunc( nFunction );
227 nCheck++;
230 theSubTotalData.SetSubTotals( nGroupNo, // group number
231 pSubTotals.get(),
232 pFunctions.get(),
233 nCheckCount ); // number of array elements
237 rArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, nullptr, &theSubTotalData ) );
239 return true;
242 void ScTpSubTotalGroup::FillListBoxes()
244 assert(pViewData && pDoc && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
246 SCCOL nFirstCol = rSubTotalData.nCol1;
247 SCROW nFirstRow = rSubTotalData.nRow1;
248 SCTAB nTab = pViewData->GetTabNo();
249 SCCOL nMaxCol = rSubTotalData.nCol2;
250 SCCOL col;
251 OUString aFieldName;
253 mxLbGroup->clear();
254 mxLbColumns->clear();
255 mxLbGroup->insert_text(0, aStrNone );
257 mxLbColumns->freeze();
258 sal_uInt16 i=0;
259 for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS(pDoc->GetSheetLimits()); col++ )
261 aFieldName = pDoc->GetString(col, nFirstRow, nTab);
262 if ( aFieldName.isEmpty() )
264 aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", ScColToAlpha( col ));
266 mnFieldArr[i] = col;
267 mxLbGroup->insert_text(i+1, aFieldName);
268 mxLbColumns->insert(i);
269 mxLbColumns->set_toggle(i, TRISTATE_FALSE);
270 mxLbColumns->set_text(i, aFieldName, 0);
271 mxLbColumns->set_id(i, u"0"_ustr);
272 i++;
274 mxLbColumns->thaw();
276 // subsequent initialization of the constant:
277 nFieldCount = i;
280 sal_uInt16 ScTpSubTotalGroup::GetFieldSelPos( SCCOL nField )
282 sal_uInt16 nFieldPos = 0;
283 bool bFound = false;
285 for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
287 if ( mnFieldArr[n] == nField )
289 nFieldPos = n;
290 bFound = true;
294 return nFieldPos;
297 ScSubTotalFunc ScTpSubTotalGroup::LbPosToFunc( sal_uInt16 nPos )
299 switch ( nPos )
301 // case 0: return SUBTOTAL_FUNC_NONE;
302 case 2: return SUBTOTAL_FUNC_AVE;
303 case 6: return SUBTOTAL_FUNC_CNT;
304 case 1: return SUBTOTAL_FUNC_CNT2;
305 case 3: return SUBTOTAL_FUNC_MAX;
306 case 4: return SUBTOTAL_FUNC_MIN;
307 case 5: return SUBTOTAL_FUNC_PROD;
308 case 7: return SUBTOTAL_FUNC_STD;
309 case 8: return SUBTOTAL_FUNC_STDP;
310 case 0: return SUBTOTAL_FUNC_SUM;
311 case 9: return SUBTOTAL_FUNC_VAR;
312 case 10: return SUBTOTAL_FUNC_VARP;
313 default:
314 OSL_FAIL( "ScTpSubTotalGroup::LbPosToFunc" );
315 return SUBTOTAL_FUNC_NONE;
319 sal_uInt16 ScTpSubTotalGroup::FuncToLbPos( ScSubTotalFunc eFunc )
321 switch ( eFunc )
323 // case SUBTOTAL_FUNC_NONE: return 0;
324 case SUBTOTAL_FUNC_AVE: return 2;
325 case SUBTOTAL_FUNC_CNT: return 6;
326 case SUBTOTAL_FUNC_CNT2: return 1;
327 case SUBTOTAL_FUNC_MAX: return 3;
328 case SUBTOTAL_FUNC_MIN: return 4;
329 case SUBTOTAL_FUNC_PROD: return 5;
330 case SUBTOTAL_FUNC_STD: return 7;
331 case SUBTOTAL_FUNC_STDP: return 8;
332 case SUBTOTAL_FUNC_SUM: return 0;
333 case SUBTOTAL_FUNC_VAR: return 9;
334 case SUBTOTAL_FUNC_VARP: return 10;
335 default:
336 OSL_FAIL( "ScTpSubTotalGroup::FuncToLbPos" );
337 return 0;
341 // Handler:
343 IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
345 SelectHdl(&rLb);
347 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
348 mxLbSelectAllColumns->set_active( true );
349 else
350 mxLbSelectAllColumns->set_active( false );
353 IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
355 SelectHdl(&rLb);
358 void ScTpSubTotalGroup::SelectHdl(const weld::Widget *pLb)
360 const sal_Int32 nColumn = mxLbColumns->get_selected_index();
361 if (nColumn == -1)
362 return;
364 const sal_Int32 nFunction = mxLbFunctions->get_selected_index();
365 sal_uInt16 nOldFunction = mxLbColumns->get_id(nColumn).toUInt32();
367 if ( pLb == mxLbColumns.get() )
369 mxLbFunctions->select(nOldFunction);
371 else if ( pLb == mxLbFunctions.get() )
373 mxLbColumns->set_id(nColumn, OUString::number(nFunction));
374 mxLbColumns->set_toggle(nColumn, TRISTATE_TRUE);
378 IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const weld::TreeView::iter_col&, rRowCol, void )
380 mxLbColumns->select(rRowCol.first);
381 SelectHdl(mxLbColumns.get());
383 if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
384 mxLbSelectAllColumns->set_active( true );
385 else
386 mxLbSelectAllColumns->set_active( false );
389 // Derived Group TabPages:
391 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup1::Create( weld::Container* pPage, weld::DialogController* pController,
392 const SfxItemSet* rArgSet )
394 return std::make_unique<ScTpSubTotalGroup1>( pPage, pController, *rArgSet );
397 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup2::Create( weld::Container* pPage, weld::DialogController* pController,
398 const SfxItemSet* rArgSet )
400 return std::make_unique<ScTpSubTotalGroup2>( pPage, pController, *rArgSet );
403 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup3::Create( weld::Container* pPage, weld::DialogController* pController,
404 const SfxItemSet* rArgSet )
406 return std::make_unique<ScTpSubTotalGroup3>( pPage, pController, *rArgSet );
409 ScTpSubTotalGroup1::ScTpSubTotalGroup1( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet ) :
410 ScTpSubTotalGroup( pPage, pController, rArgSet, 1 )
413 ScTpSubTotalGroup2::ScTpSubTotalGroup2( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet ) :
414 ScTpSubTotalGroup( pPage, pController, rArgSet, 2 )
417 ScTpSubTotalGroup3::ScTpSubTotalGroup3( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet ) :
418 ScTpSubTotalGroup( pPage, pController, rArgSet, 3 )
421 #define RESET(i) (ScTpSubTotalGroup::DoReset( (i), *rArgSet ))
422 void ScTpSubTotalGroup1::Reset( const SfxItemSet* rArgSet ) { RESET(1); }
423 void ScTpSubTotalGroup2::Reset( const SfxItemSet* rArgSet ) { RESET(2); }
424 void ScTpSubTotalGroup3::Reset( const SfxItemSet* rArgSet ) { RESET(3); }
425 #undef RESET
427 #define FILLSET(i) (ScTpSubTotalGroup::DoFillItemSet( (i), *rArgSet ))
428 bool ScTpSubTotalGroup1::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(1); }
429 bool ScTpSubTotalGroup2::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(2); }
430 bool ScTpSubTotalGroup3::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(3); }
431 #undef FILL
433 // options tab page:
435 ScTpSubTotalOptions::ScTpSubTotalOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet)
437 : SfxTabPage ( pPage, pController,
438 u"modules/scalc/ui/subtotaloptionspage.ui"_ustr, u"SubTotalOptionsPage"_ustr,
439 &rArgSet ),
440 pViewData ( nullptr ),
441 pDoc ( nullptr ),
442 nWhichSubTotals ( rArgSet.GetPool()->GetWhichIDFromSlotID( SID_SUBTOTALS ) ),
443 rSubTotalData ( rArgSet.Get( nWhichSubTotals ).GetSubTotalData() )
444 , m_xBtnPagebreak(m_xBuilder->weld_check_button(u"pagebreak"_ustr))
445 , m_xBtnCase(m_xBuilder->weld_check_button(u"case"_ustr))
446 , m_xBtnSort(m_xBuilder->weld_check_button(u"sort"_ustr))
447 , m_xBtnSummary(m_xBuilder->weld_check_button(u"summarybelow"_ustr))
448 , m_xFlSort(m_xBuilder->weld_label(u"label2"_ustr))
449 , m_xBtnAscending(m_xBuilder->weld_radio_button(u"ascending"_ustr))
450 , m_xBtnDescending(m_xBuilder->weld_radio_button(u"descending"_ustr))
451 , m_xBtnFormats(m_xBuilder->weld_check_button(u"formats"_ustr))
452 , m_xBtnUserDef(m_xBuilder->weld_check_button(u"btnuserdef"_ustr))
453 , m_xLbUserDef(m_xBuilder->weld_combo_box(u"lbuserdef"_ustr))
455 m_xLbUserDef->set_accessible_description(ScResId(STR_A11Y_DESC_USERDEF));
456 m_xBtnUserDef->set_accessible_description(ScResId(STR_A11Y_DESC_USERDEF));
457 Init();
460 ScTpSubTotalOptions::~ScTpSubTotalOptions()
464 void ScTpSubTotalOptions::Init()
466 const ScSubTotalItem& rSubTotalItem = GetItemSet().Get( nWhichSubTotals );
468 pViewData = rSubTotalItem.GetViewData();
469 assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
470 pDoc = &pViewData->GetDocument();
471 assert(pDoc && "Document not found!");
473 m_xBtnSort->connect_toggled( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
474 m_xBtnUserDef->connect_toggled( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
476 FillUserSortListBox();
479 std::unique_ptr<SfxTabPage> ScTpSubTotalOptions::Create(weld::Container* pPage, weld::DialogController* pController,
480 const SfxItemSet* rArgSet)
482 return std::make_unique<ScTpSubTotalOptions>(pPage, pController, *rArgSet);
485 void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ )
487 m_xBtnPagebreak->set_active( rSubTotalData.bPagebreak );
488 m_xBtnCase->set_active( rSubTotalData.bCaseSens );
489 m_xBtnFormats->set_active( rSubTotalData.bIncludePattern );
490 m_xBtnSort->set_active( rSubTotalData.bDoSort );
491 m_xBtnSummary->set_active( rSubTotalData.bSummaryBelow );
492 m_xBtnAscending->set_active( rSubTotalData.bAscending );
493 m_xBtnDescending->set_active( !rSubTotalData.bAscending );
495 if ( rSubTotalData.bUserDef )
497 m_xBtnUserDef->set_active(true);
498 m_xLbUserDef->set_sensitive(true);
499 m_xLbUserDef->set_active(rSubTotalData.nUserIndex);
501 else
503 m_xBtnUserDef->set_active( false );
504 m_xLbUserDef->set_sensitive(false);
505 m_xLbUserDef->set_active(0);
508 CheckHdl(*m_xBtnSort);
511 bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* rArgSet )
513 ScSubTotalParam theSubTotalData; // read out, if already partly filled
514 const SfxItemSet* pExample = GetDialogExampleSet();
515 if (pExample)
517 if (const ScSubTotalItem* pItem = pExample->GetItemIfSet(nWhichSubTotals))
518 theSubTotalData = pItem->GetSubTotalData();
521 theSubTotalData.bPagebreak = m_xBtnPagebreak->get_active();
522 theSubTotalData.bReplace = true;
523 theSubTotalData.bCaseSens = m_xBtnCase->get_active();
524 theSubTotalData.bIncludePattern = m_xBtnFormats->get_active();
525 theSubTotalData.bDoSort = m_xBtnSort->get_active();
527 theSubTotalData.bSummaryBelow = m_xBtnSummary->get_active();
528 pDoc->SetTotalsRowBelow(pViewData->GetTabNo(), theSubTotalData.bSummaryBelow);
530 theSubTotalData.bAscending = m_xBtnAscending->get_active();
531 theSubTotalData.bUserDef = m_xBtnUserDef->get_active();
532 theSubTotalData.nUserIndex = (m_xBtnUserDef->get_active())
533 ? m_xLbUserDef->get_active()
534 : 0;
536 rArgSet->Put( ScSubTotalItem( nWhichSubTotals, nullptr, &theSubTotalData ) );
538 return true;
541 void ScTpSubTotalOptions::FillUserSortListBox()
543 ScUserList& rUserLists = ScGlobal::GetUserList();
545 m_xLbUserDef->freeze();
546 m_xLbUserDef->clear();
547 size_t nCount = rUserLists.size();
548 for ( size_t i=0; i<nCount; ++i )
549 m_xLbUserDef->append_text(rUserLists[i].GetString());
550 m_xLbUserDef->thaw();
553 // Handler:
555 IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Toggleable&, rBox, void)
557 if (&rBox == m_xBtnSort.get())
559 if ( m_xBtnSort->get_active() )
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);
567 if ( m_xBtnUserDef->get_active() )
568 m_xLbUserDef->set_sensitive(true);
570 else
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);
580 else if (&rBox == m_xBtnUserDef.get())
582 if ( m_xBtnUserDef->get_active() )
584 m_xLbUserDef->set_sensitive(true);
585 m_xLbUserDef->grab_focus();
587 else
588 m_xLbUserDef->set_sensitive(false);
592 IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Toggleable&, rBox, void)
594 if (&rBox != mxLbSelectAllColumns.get())
595 return;
597 bool bChecked = mxLbSelectAllColumns->get_active();
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);
605 return false;
609 ScTpSubTotalGroup1::~ScTpSubTotalGroup1()
613 ScTpSubTotalGroup2::~ScTpSubTotalGroup2()
617 ScTpSubTotalGroup3::~ScTpSubTotalGroup3()
621 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */