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 
42  : SfxTabPage(pPage, pController, "modules/scalc/ui/subtotalgrppage.ui", "SubTotalGrpPage", &rArgSet)
43  , aStrNone(ScResId(SCSTR_NONE))
44  , aStrColumn(ScResId(SCSTR_COLUMN))
45  , pViewData(nullptr)
46  , pDoc(nullptr)
47  , nWhichSubTotals(rArgSet.GetPool()->GetWhich(SID_SUBTOTALS))
48  , rSubTotalData(static_cast<const ScSubTotalItem&>(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 
68 {
69 }
70 
72 {
73  const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
75 
76  pViewData = rSubTotalItem.GetViewData();
77  assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
79  assert(pDoc && "Document not found :-(");
80 
81  mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
82  mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
83  mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
84  mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl) );
85  mxLbSelectAllColumns->connect_clicked( LINK( this, ScTpSubTotalGroup, CheckBoxHdl ) );
86 
88  mnFieldArr[0] = 0;
89  FillListBoxes();
90 }
91 
92 namespace
93 {
94  int GetCheckedEntryCount(weld::TreeView& rTreeView)
95  {
96  int nRet = 0;
97 
98  rTreeView.all_foreach([&](const weld::TreeIter& rEntry) {
99  if ( rTreeView.get_toggle(rEntry) == TRISTATE_TRUE )
100  ++nRet;
101  return false;
102  });
103 
104  return nRet;
105  }
106 }
107 
108 bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
109  const SfxItemSet& rArgSet )
110 {
111  sal_uInt16 nGroupIdx = 0;
112 
113  OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
114 
115  if ( (nGroupNo > 3) || (nGroupNo == 0) )
116  return false;
117  else
118  nGroupIdx = nGroupNo-1;
119 
120  // first we have to clear the listboxes...
121  for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
122  {
123  mxLbColumns->set_toggle(nLbEntry, TRISTATE_FALSE);
124  mxLbColumns->set_id(nLbEntry, "0");
125  }
126  mxLbFunctions->select(0);
127 
128  ScSubTotalParam theSubTotalData( static_cast<const ScSubTotalItem&>(
129  rArgSet.Get( nWhichSubTotals )).
130  GetSubTotalData() );
131 
132  if ( theSubTotalData.bGroupActive[nGroupIdx] )
133  {
134  SCCOL nField = theSubTotalData.nField[nGroupIdx];
135  SCCOL nSubTotals = theSubTotalData.nSubTotals[nGroupIdx];
136  SCCOL* pSubTotals = theSubTotalData.pSubTotals[nGroupIdx];
137  ScSubTotalFunc* pFunctions = theSubTotalData.pFunctions[nGroupIdx];
138 
139  mxLbGroup->set_active( GetFieldSelPos( nField )+1 );
140 
141  sal_uInt16 nFirstChecked = 0;
142  for ( sal_uInt16 i=0; i<nSubTotals; i++ )
143  {
144  sal_uInt16 nCheckPos = GetFieldSelPos( pSubTotals[i] );
145 
146  mxLbColumns->set_toggle(nCheckPos, TRISTATE_TRUE);
147  mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(pFunctions[i])));
148 
149  if (i == 0 || nCheckPos < nFirstChecked)
150  nFirstChecked = nCheckPos;
151  }
152  // Select the first checked field from the top.
153  mxLbColumns->select(nFirstChecked);
154  }
155  else
156  {
157  mxLbGroup->set_active( (nGroupNo == 1) ? 1 : 0 );
158  mxLbColumns->select( 0 );
159  mxLbFunctions->select( 0 );
160  }
161 
162  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
163  mxLbSelectAllColumns->set_active( true );
164  else
165  mxLbSelectAllColumns->set_active( false );
166 
167  return true;
168 }
169 
170 bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
171  SfxItemSet& rArgSet )
172 {
173  sal_uInt16 nGroupIdx = 0;
174 
175  OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
176  OSL_ENSURE( (mxLbGroup->get_count() > 0)
177  && (mxLbColumns->n_children() > 0)
178  && (mxLbFunctions->n_children() > 0),
179  "Non-initialized Lists" );
180 
181  if ( (nGroupNo > 3) || (nGroupNo == 0)
182  || (mxLbGroup->get_count() == 0)
183  || (mxLbColumns->n_children() == 0)
184  || (mxLbFunctions->n_children() == 0)
185  )
186  return false;
187  else
188  nGroupIdx = nGroupNo-1;
189 
190  ScSubTotalParam theSubTotalData; // read out, if already partly filled
191  const SfxItemSet* pExample = GetDialogExampleSet();
192  if (pExample)
193  {
194  const SfxPoolItem* pItem;
195  if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
196  theSubTotalData = static_cast<const ScSubTotalItem*>(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  sal_uInt16 i=0;
261  for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS(pDoc->GetSheetLimits()); col++ )
262  {
263  aFieldName = pDoc->GetString(col, nFirstRow, nTab);
264  if ( aFieldName.isEmpty() )
265  {
266  aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", ScColToAlpha( col ));
267  }
268  mnFieldArr[i] = col;
269  mxLbGroup->insert_text(i+1, aFieldName);
270  mxLbColumns->insert(i);
271  mxLbColumns->set_toggle(i, TRISTATE_FALSE);
272  mxLbColumns->set_text(i, aFieldName, 0);
273  mxLbColumns->set_id(i, "0");
274  i++;
275  }
276  // subsequent initialization of the constant:
277  nFieldCount = i;
278 }
279 
281 {
282  sal_uInt16 nFieldPos = 0;
283  bool bFound = false;
284 
285  for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
286  {
287  if ( mnFieldArr[n] == nField )
288  {
289  nFieldPos = n;
290  bFound = true;
291  }
292  }
293 
294  return nFieldPos;
295 }
296 
298 {
299  switch ( nPos )
300  {
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;
316  }
317 }
318 
320 {
321  switch ( eFunc )
322  {
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;
338  }
339 }
340 
341 // Handler:
342 
343 IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
344 {
345  SelectHdl(&rLb);
346 
347  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
348  mxLbSelectAllColumns->set_active( true );
349  else
350  mxLbSelectAllColumns->set_active( false );
351 }
352 
353 IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
354 {
355  SelectHdl(&rLb);
356 }
357 
359 {
360  const sal_Int32 nColumn = mxLbColumns->get_selected_index();
361  if (nColumn == -1)
362  return;
363 
364  const sal_Int32 nFunction = mxLbFunctions->get_selected_index();
365  sal_uInt16 nOldFunction = mxLbColumns->get_id(nColumn).toUInt32();
366 
367  if ( pLb == mxLbColumns.get() )
368  {
369  mxLbFunctions->select(nOldFunction);
370  }
371  else if ( pLb == mxLbFunctions.get() )
372  {
373  mxLbColumns->set_id(nColumn, OUString::number(nFunction));
374  mxLbColumns->set_toggle(nColumn, TRISTATE_TRUE);
375  }
376 }
377 
378 IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const weld::TreeView::iter_col&, rRowCol, void )
379 {
380  mxLbColumns->select(rRowCol.first);
381  SelectHdl(mxLbColumns.get());
382 
383  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
384  mxLbSelectAllColumns->set_active( true );
385  else
386  mxLbSelectAllColumns->set_active( false );
387 }
388 
389 // Derived Group TabPages:
390 
391 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup1::Create( weld::Container* pPage, weld::DialogController* pController,
392  const SfxItemSet* rArgSet )
393 {
394  return std::make_unique<ScTpSubTotalGroup1>( pPage, pController, *rArgSet );
395 }
396 
397 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup2::Create( weld::Container* pPage, weld::DialogController* pController,
398  const SfxItemSet* rArgSet )
399 {
400  return std::make_unique<ScTpSubTotalGroup2>( pPage, pController, *rArgSet );
401 }
402 
403 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup3::Create( weld::Container* pPage, weld::DialogController* pController,
404  const SfxItemSet* rArgSet )
405 {
406  return std::make_unique<ScTpSubTotalGroup3>( pPage, pController, *rArgSet );
407 }
408 
410  ScTpSubTotalGroup( pPage, pController, rArgSet )
411 {}
412 
414  ScTpSubTotalGroup( pPage, pController, rArgSet )
415 {}
416 
418  ScTpSubTotalGroup( pPage, pController, rArgSet )
419 {}
420 
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
426 
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
432 
433 // options tab page:
434 
436 
437  : SfxTabPage ( pPage, pController,
438  "modules/scalc/ui/subtotaloptionspage.ui", "SubTotalOptionsPage",
439  &rArgSet ),
440  pViewData ( nullptr ),
441  pDoc ( nullptr ),
442  nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
443  rSubTotalData ( static_cast<const ScSubTotalItem&>(
444  rArgSet.Get( nWhichSubTotals )).
445  GetSubTotalData() )
446  , m_xBtnPagebreak(m_xBuilder->weld_check_button("pagebreak"))
447  , m_xBtnCase(m_xBuilder->weld_check_button("case"))
448  , m_xBtnSort(m_xBuilder->weld_check_button("sort"))
449  , m_xFlSort(m_xBuilder->weld_label("label2"))
450  , m_xBtnAscending(m_xBuilder->weld_radio_button("ascending"))
451  , m_xBtnDescending(m_xBuilder->weld_radio_button("descending"))
452  , m_xBtnFormats(m_xBuilder->weld_check_button("formats"))
453  , m_xBtnUserDef(m_xBuilder->weld_check_button("btnuserdef"))
454  , m_xLbUserDef(m_xBuilder->weld_combo_box("lbuserdef"))
455 {
456  Init();
457 }
458 
460 {
461 }
462 
464 {
465  const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
467 
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!");
472 
473  m_xBtnSort->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
474  m_xBtnUserDef->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
475 
477 }
478 
479 std::unique_ptr<SfxTabPage> ScTpSubTotalOptions::Create(weld::Container* pPage, weld::DialogController* pController,
480  const SfxItemSet* rArgSet)
481 {
482  return std::make_unique<ScTpSubTotalOptions>(pPage, pController, *rArgSet);
483 }
484 
485 void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ )
486 {
488  m_xBtnCase->set_active( rSubTotalData.bCaseSens );
490  m_xBtnSort->set_active( rSubTotalData.bDoSort );
492  m_xBtnDescending->set_active( !rSubTotalData.bAscending );
493 
494  if ( rSubTotalData.bUserDef )
495  {
496  m_xBtnUserDef->set_active(true);
497  m_xLbUserDef->set_sensitive(true);
499  }
500  else
501  {
502  m_xBtnUserDef->set_active( false );
503  m_xLbUserDef->set_sensitive(false);
504  m_xLbUserDef->set_active(0);
505  }
506 
507  CheckHdl(*m_xBtnSort);
508 }
509 
511 {
512  ScSubTotalParam theSubTotalData; // read out, if already partly filled
513  const SfxItemSet* pExample = GetDialogExampleSet();
514  if (pExample)
515  {
516  const SfxPoolItem* pItem;
517  if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
518  theSubTotalData = static_cast<const ScSubTotalItem*>(pItem)->GetSubTotalData();
519  }
520 
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();
526  theSubTotalData.bAscending = m_xBtnAscending->get_active();
527  theSubTotalData.bUserDef = m_xBtnUserDef->get_active();
528  theSubTotalData.nUserIndex = (m_xBtnUserDef->get_active())
529  ? m_xLbUserDef->get_active()
530  : 0;
531 
532  rArgSet->Put( ScSubTotalItem( nWhichSubTotals, nullptr, &theSubTotalData ) );
533 
534  return true;
535 }
536 
538 {
539  ScUserList* pUserLists = ScGlobal::GetUserList();
540 
541  m_xLbUserDef->freeze();
542  m_xLbUserDef->clear();
543  if ( pUserLists )
544  {
545  size_t nCount = pUserLists->size();
546  for ( size_t i=0; i<nCount; ++i )
547  m_xLbUserDef->append_text((*pUserLists)[i].GetString() );
548  }
549  m_xLbUserDef->thaw();
550 }
551 
552 // Handler:
553 
555 {
556  if (&rBox == m_xBtnSort.get())
557  {
558  if ( m_xBtnSort->get_active() )
559  {
560  m_xFlSort->set_sensitive(true);
561  m_xBtnFormats->set_sensitive(true);
562  m_xBtnUserDef->set_sensitive(true);
563  m_xBtnAscending->set_sensitive(true);
564  m_xBtnDescending->set_sensitive(true);
565 
566  if ( m_xBtnUserDef->get_active() )
567  m_xLbUserDef->set_sensitive(true);
568  }
569  else
570  {
571  m_xFlSort->set_sensitive(false);
572  m_xBtnFormats->set_sensitive(false);
573  m_xBtnUserDef->set_sensitive(false);
574  m_xBtnAscending->set_sensitive(false);
575  m_xBtnDescending->set_sensitive(false);
576  m_xLbUserDef->set_sensitive(false);
577  }
578  }
579  else if (&rBox == m_xBtnUserDef.get())
580  {
581  if ( m_xBtnUserDef->get_active() )
582  {
583  m_xLbUserDef->set_sensitive(true);
584  m_xLbUserDef->grab_focus();
585  }
586  else
587  m_xLbUserDef->set_sensitive(false);
588  }
589 }
590 
591 IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void)
592 {
593  if (&rBox != mxLbSelectAllColumns.get())
594  return;
595 
596  bool bChecked = mxLbSelectAllColumns->get_active();
597 
598  mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) {
599  if ( bChecked )
600  mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE);
601  else
602  mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE);
603 
604  return false;
605  });
606 }
607 
609 {
610 }
611 
613 {
614 }
615 
617 {
618 }
619 
620 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bGroupActive[MAXSUBTOTAL]
active groups
static sal_uInt16 FuncToLbPos(ScSubTotalFunc eFunc)
Definition: tpsubt.cxx:319
Collection of user-defined sort lists.
Definition: userlist.hxx:66
ScDocument * pDoc
Definition: tpsubt.hxx:132
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:1068
SCCOL nField[MAXSUBTOTAL]
associated field
bool bUserDef
sort user defined
SCCOL nCol1
selected area
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:397
virtual ~ScTpSubTotalGroup() override
Definition: tpsubt.cxx:67
std::unique_ptr< weld::CheckButton > m_xBtnPagebreak
Definition: tpsubt.hxx:136
std::vector< SCCOL > mnFieldArr
Definition: tpsubt.hxx:51
sal_Int64 n
ScTpSubTotalGroup2(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:413
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1926
virtual ~ScTpSubTotalGroup1() override
Definition: tpsubt.cxx:608
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:485
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
size_t size() const
Definition: userlist.cxx:345
bool bDoSort
presort
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:422
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:429
bool bPagebreak
page break at change of group
#define SCITEM_SUBTDATA
Definition: scitems.hxx:91
ScViewData * GetViewData() const
Definition: uiitems.hxx:186
TRISTATE_TRUE
virtual TriState get_toggle(int row, int col=-1) const =0
ScTpSubTotalGroup(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:41
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: tpsubt.hxx:137
sal_uInt16 nUserIndex
index into list
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:403
std::pair< const TreeIter &, int > iter_col
int nCount
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3478
void SelectHdl(const weld::Widget *)
Definition: tpsubt.cxx:358
virtual ~ScTpSubTotalGroup3() override
Definition: tpsubt.cxx:616
std::unique_ptr< weld::RadioButton > m_xBtnAscending
Definition: tpsubt.hxx:140
ScDocument * pDoc
Definition: tpsubt.hxx:47
const SfxItemSet & GetItemSet() const
#define SAL_N_ELEMENTS(arr)
bool DoFillItemSet(sal_uInt16 nGroupNo, SfxItemSet &rArgSet)
Definition: tpsubt.cxx:170
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:391
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
void FillUserSortListBox()
Definition: tpsubt.cxx:537
const OUString aStrColumn
Definition: tpsubt.hxx:44
std::unique_ptr< weld::CheckButton > m_xBtnFormats
Definition: tpsubt.hxx:142
sal_Int16 SCCOL
Definition: types.hxx:21
void SetSubTotals(sal_uInt16 nGroup, const SCCOL *ptrSubTotals, const ScSubTotalFunc *ptrFunctions, sal_uInt16 nCount)
ScTpSubTotalGroup3(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:417
sal_uInt16 GetFieldSelPos(SCCOL nField)
Definition: tpsubt.cxx:280
TRISTATE_FALSE
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:872
float u
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:274
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:479
std::unique_ptr< weld::CheckButton > m_xBtnUserDef
Definition: tpsubt.hxx:143
bool DoReset(sal_uInt16 nGroupNo, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:108
std::unique_ptr< weld::TreeView > mxLbColumns
Definition: tpsubt.hxx:55
sal_uInt16 nFieldCount
Definition: tpsubt.hxx:52
std::unique_ptr< weld::CheckButton > m_xBtnSort
Definition: tpsubt.hxx:138
ScViewData * pViewData
Definition: tpsubt.hxx:46
const SfxItemSet * GetDialogExampleSet() const
IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView &, rLb, void)
Definition: tpsubt.cxx:343
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:428
bool bReplace
replace existing results
virtual ~ScTpSubTotalGroup2() override
Definition: tpsubt.cxx:612
static ScSubTotalFunc LbPosToFunc(sal_uInt16 nPos)
Definition: tpsubt.cxx:297
#define RESET(i)
Definition: tpsubt.cxx:421
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
ScViewData * pViewData
Definition: tpsubt.hxx:131
virtual void all_foreach(const std::function< bool(TreeIter &)> &func)=0
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define GetWhich(nSlot)
#define FILLSET(i)
Definition: tpsubt.cxx:427
std::unique_ptr< weld::RadioButton > m_xBtnDescending
Definition: tpsubt.hxx:141
std::unique_ptr< weld::CheckButton > mxLbSelectAllColumns
Definition: tpsubt.hxx:57
std::unique_ptr< weld::ComboBox > m_xLbUserDef
Definition: tpsubt.hxx:144
bool bIncludePattern
sort formats
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:430
std::unique_ptr< weld::TreeView > mxLbFunctions
Definition: tpsubt.hxx:56
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:424
ScTpSubTotalGroup1(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:409
SCCOL SC_MAXFIELDS(const ScSheetLimits &rLimits)
Definition: tpsort.hxx:37
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:510
const sal_uInt16 nWhichSubTotals
Definition: tpsubt.hxx:133
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:50
const sal_uInt16 nWhichSubTotals
Definition: tpsubt.hxx:49
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
ScTpSubTotalOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:435
ScSubTotalFunc
Definition: global.hxx:844
virtual ~ScTpSubTotalOptions() override
Definition: tpsubt.cxx:459
const OUString aStrNone
Definition: tpsubt.hxx:43
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:134
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:423
void FillListBoxes()
Definition: tpsubt.cxx:245
bool bAscending
sort ascending
std::unique_ptr< weld::ComboBox > mxLbGroup
Definition: tpsubt.hxx:54
sal_Int16 SCTAB
Definition: types.hxx:22