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 <memory>
35 
36 #include <osl/diagnose.h>
37 
38 // Subtotals group tabpage:
39 
41  : SfxTabPage(pPage, pController, "modules/scalc/ui/subtotalgrppage.ui", "SubTotalGrpPage", &rArgSet)
42  , aStrNone(ScResId(SCSTR_NONE))
43  , aStrColumn(ScResId(SCSTR_COLUMN))
44  , pViewData(nullptr)
45  , pDoc(nullptr)
46  , nWhichSubTotals(rArgSet.GetPool()->GetWhich(SID_SUBTOTALS))
47  , rSubTotalData(static_cast<const ScSubTotalItem&>(rArgSet.Get(nWhichSubTotals)).GetSubTotalData())
48  , nFieldCount(0)
49  , mxLbGroup(m_xBuilder->weld_combo_box("group_by"))
50  , mxLbColumns(m_xBuilder->weld_tree_view("columns"))
51  , mxLbFunctions(m_xBuilder->weld_tree_view("functions"))
52  , mxLbSelectAllColumns(m_xBuilder->weld_check_button("select_all_columns_button"))
53 {
54  for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_SUBTOTALS); ++i)
55  mxLbFunctions->append_text(ScResId(SCSTR_SUBTOTALS[i]));
56 
57  auto nHeight = mxLbColumns->get_height_rows(14);
58  mxLbColumns->set_size_request(-1, nHeight);
59  mxLbFunctions->set_size_request(-1, nHeight);
60 
61  mxLbColumns->enable_toggle_buttons(weld::ColumnToggleType::Check);
62 
63  Init();
64 }
65 
67 {
68 }
69 
71 {
72  const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
74 
75  pViewData = rSubTotalItem.GetViewData();
76  pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
77 
78  OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-(" );
79 
80  mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
81  mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
82  mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
83  mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl) );
84  mxLbSelectAllColumns->connect_clicked( LINK( this, ScTpSubTotalGroup, CheckBoxHdl ) );
85 
86  nFieldArr[0] = 0;
87  FillListBoxes();
88 }
89 
90 namespace
91 {
92  int GetCheckedEntryCount(weld::TreeView& rTreeView)
93  {
94  int nRet = 0;
95 
96  rTreeView.all_foreach([&](const weld::TreeIter& rEntry) {
97  if ( rTreeView.get_toggle(rEntry) == TRISTATE_TRUE )
98  ++nRet;
99  return false;
100  });
101 
102  return nRet;
103  }
104 }
105 
106 bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
107  const SfxItemSet& rArgSet )
108 {
109  sal_uInt16 nGroupIdx = 0;
110 
111  OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
112 
113  if ( (nGroupNo > 3) || (nGroupNo == 0) )
114  return false;
115  else
116  nGroupIdx = nGroupNo-1;
117 
118  // first we have to clear the listboxes...
119  for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
120  {
121  mxLbColumns->set_toggle(nLbEntry, TRISTATE_FALSE);
122  mxLbColumns->set_id(nLbEntry, "0");
123  }
124  mxLbFunctions->select(0);
125 
126  ScSubTotalParam theSubTotalData( static_cast<const ScSubTotalItem&>(
127  rArgSet.Get( nWhichSubTotals )).
128  GetSubTotalData() );
129 
130  if ( theSubTotalData.bGroupActive[nGroupIdx] )
131  {
132  SCCOL nField = theSubTotalData.nField[nGroupIdx];
133  SCCOL nSubTotals = theSubTotalData.nSubTotals[nGroupIdx];
134  SCCOL* pSubTotals = theSubTotalData.pSubTotals[nGroupIdx];
135  ScSubTotalFunc* pFunctions = theSubTotalData.pFunctions[nGroupIdx];
136 
137  mxLbGroup->set_active( GetFieldSelPos( nField )+1 );
138 
139  sal_uInt16 nFirstChecked = 0;
140  for ( sal_uInt16 i=0; i<nSubTotals; i++ )
141  {
142  sal_uInt16 nCheckPos = GetFieldSelPos( pSubTotals[i] );
143 
144  mxLbColumns->set_toggle(nCheckPos, TRISTATE_TRUE);
145  mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(pFunctions[i])));
146 
147  if (i == 0 || nCheckPos < nFirstChecked)
148  nFirstChecked = nCheckPos;
149  }
150  // Select the first checked field from the top.
151  mxLbColumns->select(nFirstChecked);
152  }
153  else
154  {
155  mxLbGroup->set_active( (nGroupNo == 1) ? 1 : 0 );
156  mxLbColumns->select( 0 );
157  mxLbFunctions->select( 0 );
158  }
159 
160  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
161  mxLbSelectAllColumns->set_active( true );
162  else
163  mxLbSelectAllColumns->set_active( false );
164 
165  return true;
166 }
167 
168 bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
169  SfxItemSet& rArgSet )
170 {
171  sal_uInt16 nGroupIdx = 0;
172 
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" );
178 
179  if ( (nGroupNo > 3) || (nGroupNo == 0)
180  || (mxLbGroup->get_count() == 0)
181  || (mxLbColumns->n_children() == 0)
182  || (mxLbFunctions->n_children() == 0)
183  )
184  return false;
185  else
186  nGroupIdx = nGroupNo-1;
187 
188  ScSubTotalParam theSubTotalData; // read out, if already partly filled
189  const SfxItemSet* pExample = GetDialogExampleSet();
190  if (pExample)
191  {
192  const SfxPoolItem* pItem;
193  if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
194  theSubTotalData = static_cast<const ScSubTotalItem*>(pItem)->GetSubTotalData();
195  }
196 
197  std::unique_ptr<ScSubTotalFunc[]> pFunctions;
198  std::unique_ptr<SCCOL[]> pSubTotals;
199  const sal_Int32 nGroup = mxLbGroup->get_active();
200  const sal_Int32 nEntryCount = mxLbColumns->n_children();
201  const sal_Int32 nCheckCount = GetCheckedEntryCount(*mxLbColumns);
202 
203  theSubTotalData.nCol1 = rSubTotalData.nCol1;
204  theSubTotalData.nRow1 = rSubTotalData.nRow1;
205  theSubTotalData.nCol2 = rSubTotalData.nCol2;
206  theSubTotalData.nRow2 = rSubTotalData.nRow2;
207  theSubTotalData.bGroupActive[nGroupIdx] = (nGroup != 0);
208  theSubTotalData.nField[nGroupIdx] = (nGroup != 0)
209  ? nFieldArr[nGroup-1]
210  : static_cast<SCCOL>(0);
211 
212  if ( nEntryCount>0 && nCheckCount>0 && nGroup!=0 )
213  {
214  sal_uInt16 nFunction = 0;
215 
216  pSubTotals.reset(new SCCOL [nCheckCount]);
217  pFunctions.reset(new ScSubTotalFunc [nCheckCount]);
218 
219  for ( sal_Int32 i=0, nCheck=0; i<nEntryCount; i++ )
220  {
221  if (mxLbColumns->get_toggle(i) == TRISTATE_TRUE)
222  {
223  OSL_ENSURE( nCheck <= nCheckCount,
224  "Range error :-(" );
225  nFunction = mxLbColumns->get_id(i).toUInt32();
226  pSubTotals[nCheck] = nFieldArr[i];
227  pFunctions[nCheck] = LbPosToFunc( nFunction );
228  nCheck++;
229  }
230  }
231  theSubTotalData.SetSubTotals( nGroupNo, // group number
232  pSubTotals.get(),
233  pFunctions.get(),
234  nCheckCount ); // number of array elements
235 
236  }
237 
238  rArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &theSubTotalData ) );
239 
240  return true;
241 }
242 
244 {
245  OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-/" );
246 
247  if ( !(pViewData && pDoc) )
248  return;
249 
250  SCCOL nFirstCol = rSubTotalData.nCol1;
251  SCROW nFirstRow = rSubTotalData.nRow1;
252  SCTAB nTab = pViewData->GetTabNo();
253  SCCOL nMaxCol = rSubTotalData.nCol2;
254  SCCOL col;
255  OUString aFieldName;
256 
257  mxLbGroup->clear();
258  mxLbColumns->clear();
259  mxLbGroup->insert_text(0, aStrNone );
260 
261  sal_uInt16 i=0;
262  for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
263  {
264  aFieldName = pDoc->GetString(col, nFirstRow, nTab);
265  if ( aFieldName.isEmpty() )
266  {
267  aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col ));
268  }
269  nFieldArr[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  // subsequent initialization of the constant:
278  nFieldCount = i;
279 }
280 
282 {
283  sal_uInt16 nFieldPos = 0;
284  bool bFound = false;
285 
286  for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
287  {
288  if ( nFieldArr[n] == nField )
289  {
290  nFieldPos = n;
291  bFound = true;
292  }
293  }
294 
295  return nFieldPos;
296 }
297 
299 {
300  switch ( nPos )
301  {
302 // case 0: return SUBTOTAL_FUNC_NONE;
303  case 2: return SUBTOTAL_FUNC_AVE;
304  case 6: return SUBTOTAL_FUNC_CNT;
305  case 1: return SUBTOTAL_FUNC_CNT2;
306  case 3: return SUBTOTAL_FUNC_MAX;
307  case 4: return SUBTOTAL_FUNC_MIN;
308  case 5: return SUBTOTAL_FUNC_PROD;
309  case 7: return SUBTOTAL_FUNC_STD;
310  case 8: return SUBTOTAL_FUNC_STDP;
311  case 0: return SUBTOTAL_FUNC_SUM;
312  case 9: return SUBTOTAL_FUNC_VAR;
313  case 10: return SUBTOTAL_FUNC_VARP;
314  default:
315  OSL_FAIL( "ScTpSubTotalGroup::LbPosToFunc" );
316  return SUBTOTAL_FUNC_NONE;
317  }
318 }
319 
321 {
322  switch ( eFunc )
323  {
324 // case SUBTOTAL_FUNC_NONE: return 0;
325  case SUBTOTAL_FUNC_AVE: return 2;
326  case SUBTOTAL_FUNC_CNT: return 6;
327  case SUBTOTAL_FUNC_CNT2: return 1;
328  case SUBTOTAL_FUNC_MAX: return 3;
329  case SUBTOTAL_FUNC_MIN: return 4;
330  case SUBTOTAL_FUNC_PROD: return 5;
331  case SUBTOTAL_FUNC_STD: return 7;
332  case SUBTOTAL_FUNC_STDP: return 8;
333  case SUBTOTAL_FUNC_SUM: return 0;
334  case SUBTOTAL_FUNC_VAR: return 9;
335  case SUBTOTAL_FUNC_VARP: return 10;
336  default:
337  OSL_FAIL( "ScTpSubTotalGroup::FuncToLbPos" );
338  return 0;
339  }
340 }
341 
342 // Handler:
343 
344 IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
345 {
346  SelectHdl(&rLb);
347 
348  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
349  mxLbSelectAllColumns->set_active( true );
350  else
351  mxLbSelectAllColumns->set_active( false );
352 }
353 
354 IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
355 {
356  SelectHdl(&rLb);
357 }
358 
360 {
361  const sal_Int32 nColumn = mxLbColumns->get_selected_index();
362  if (nColumn == -1)
363  return;
364 
365  const sal_Int32 nFunction = mxLbFunctions->get_selected_index();
366  sal_uInt16 nOldFunction = mxLbColumns->get_id(nColumn).toUInt32();
367 
368  if ( pLb == mxLbColumns.get() )
369  {
370  mxLbFunctions->select(nOldFunction);
371  }
372  else if ( pLb == mxLbFunctions.get() )
373  {
374  mxLbColumns->set_id(nColumn, OUString::number(nFunction));
375  mxLbColumns->set_toggle(nColumn, TRISTATE_TRUE);
376  }
377 }
378 
379 IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const weld::TreeView::iter_col&, rRowCol, void )
380 {
381  mxLbColumns->select(rRowCol.first);
382  SelectHdl(mxLbColumns.get());
383 
384  if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
385  mxLbSelectAllColumns->set_active( true );
386  else
387  mxLbSelectAllColumns->set_active( false );
388 }
389 
390 // Derived Group TabPages:
391 
392 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup1::Create( weld::Container* pPage, weld::DialogController* pController,
393  const SfxItemSet* rArgSet )
394 {
395  return std::make_unique<ScTpSubTotalGroup1>( pPage, pController, *rArgSet );
396 }
397 
398 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup2::Create( weld::Container* pPage, weld::DialogController* pController,
399  const SfxItemSet* rArgSet )
400 {
401  return std::make_unique<ScTpSubTotalGroup2>( pPage, pController, *rArgSet );
402 }
403 
404 std::unique_ptr<SfxTabPage> ScTpSubTotalGroup3::Create( weld::Container* pPage, weld::DialogController* pController,
405  const SfxItemSet* rArgSet )
406 {
407  return std::make_unique<ScTpSubTotalGroup3>( pPage, pController, *rArgSet );
408 }
409 
411  ScTpSubTotalGroup( pPage, pController, rArgSet )
412 {}
413 
415  ScTpSubTotalGroup( pPage, pController, rArgSet )
416 {}
417 
419  ScTpSubTotalGroup( pPage, pController, rArgSet )
420 {}
421 
422 #define RESET(i) (ScTpSubTotalGroup::DoReset( (i), *rArgSet ))
423 void ScTpSubTotalGroup1::Reset( const SfxItemSet* rArgSet ) { RESET(1); }
424 void ScTpSubTotalGroup2::Reset( const SfxItemSet* rArgSet ) { RESET(2); }
425 void ScTpSubTotalGroup3::Reset( const SfxItemSet* rArgSet ) { RESET(3); }
426 #undef RESET
427 
428 #define FILLSET(i) (ScTpSubTotalGroup::DoFillItemSet( (i), *rArgSet ))
429 bool ScTpSubTotalGroup1::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(1); }
430 bool ScTpSubTotalGroup2::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(2); }
431 bool ScTpSubTotalGroup3::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(3); }
432 #undef FILL
433 
434 // options tab page:
435 
437 
438  : SfxTabPage ( pPage, pController,
439  "modules/scalc/ui/subtotaloptionspage.ui", "SubTotalOptionsPage",
440  &rArgSet ),
441  pViewData ( nullptr ),
442  pDoc ( nullptr ),
443  nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
444  rSubTotalData ( static_cast<const ScSubTotalItem&>(
445  rArgSet.Get( nWhichSubTotals )).
446  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  Init();
458 }
459 
461 {
462 }
463 
465 {
466  const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
468 
469  pViewData = rSubTotalItem.GetViewData();
470  pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
471 
472  OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" );
473 
474  m_xBtnSort->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
475  m_xBtnUserDef->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
476 
478 }
479 
480 std::unique_ptr<SfxTabPage> ScTpSubTotalOptions::Create(weld::Container* pPage, weld::DialogController* pController,
481  const SfxItemSet* rArgSet)
482 {
483  return std::make_unique<ScTpSubTotalOptions>(pPage, pController, *rArgSet);
484 }
485 
486 void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ )
487 {
489  m_xBtnCase->set_active( rSubTotalData.bCaseSens );
491  m_xBtnSort->set_active( rSubTotalData.bDoSort );
493  m_xBtnDescending->set_active( !rSubTotalData.bAscending );
494 
495  if ( rSubTotalData.bUserDef )
496  {
497  m_xBtnUserDef->set_active(true);
498  m_xLbUserDef->set_sensitive(true);
500  }
501  else
502  {
503  m_xBtnUserDef->set_active( false );
504  m_xLbUserDef->set_sensitive(false);
505  m_xLbUserDef->set_active(0);
506  }
507 
508  CheckHdl(*m_xBtnSort);
509 }
510 
512 {
513  ScSubTotalParam theSubTotalData; // read out, if already partly filled
514  const SfxItemSet* pExample = GetDialogExampleSet();
515  if (pExample)
516  {
517  const SfxPoolItem* pItem;
518  if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
519  theSubTotalData = static_cast<const ScSubTotalItem*>(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, &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 
592 IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void)
593 {
594  if (&rBox == mxLbSelectAllColumns.get())
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 }
608 
610 {
611 }
612 
614 {
615 }
616 
618 {
619 }
620 
621 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bGroupActive[MAXSUBTOTAL]
active groups
static sal_uInt16 FuncToLbPos(ScSubTotalFunc eFunc)
Definition: tpsubt.cxx:320
Collection of user-defined sort lists.
Definition: userlist.hxx:66
ScDocument * pDoc
Definition: tpsubt.hxx:135
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:398
virtual ~ScTpSubTotalGroup() override
Definition: tpsubt.cxx:66
std::unique_ptr< weld::CheckButton > m_xBtnPagebreak
Definition: tpsubt.hxx:139
sal_Int64 n
ScTpSubTotalGroup2(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:414
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1917
virtual ~ScTpSubTotalGroup1() override
Definition: tpsubt.cxx:609
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:486
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
size_t size() const
Definition: userlist.cxx:345
bool bDoSort
presort
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:423
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:430
bool bPagebreak
page break at change of group
#define SCITEM_SUBTDATA
Definition: scitems.hxx:92
ScViewData * GetViewData() const
Definition: uiitems.hxx:189
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, const OUString &rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Definition: global.cxx:1069
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:40
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: tpsubt.hxx:140
sal_uInt16 nUserIndex
index into list
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:404
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:3486
void SelectHdl(const weld::Widget *)
Definition: tpsubt.cxx:359
virtual ~ScTpSubTotalGroup3() override
Definition: tpsubt.cxx:617
std::unique_ptr< weld::RadioButton > m_xBtnAscending
Definition: tpsubt.hxx:143
ScDocument * pDoc
Definition: tpsubt.hxx:50
const SfxItemSet & GetItemSet() const
#define SAL_N_ELEMENTS(arr)
SCCOL nFieldArr[SC_MAXFIELDS]
Definition: tpsubt.hxx:54
bool DoFillItemSet(sal_uInt16 nGroupNo, SfxItemSet &rArgSet)
Definition: tpsubt.cxx:168
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsubt.cxx:392
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
void FillUserSortListBox()
Definition: tpsubt.cxx:538
const OUString aStrColumn
Definition: tpsubt.hxx:47
std::unique_ptr< weld::CheckButton > m_xBtnFormats
Definition: tpsubt.hxx:145
sal_Int16 SCCOL
Definition: types.hxx:22
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:418
sal_uInt16 GetFieldSelPos(SCCOL nField)
Definition: tpsubt.cxx:281
TRISTATE_FALSE
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
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:480
std::unique_ptr< weld::CheckButton > m_xBtnUserDef
Definition: tpsubt.hxx:146
bool DoReset(sal_uInt16 nGroupNo, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:106
std::unique_ptr< weld::TreeView > mxLbColumns
Definition: tpsubt.hxx:58
sal_uInt16 nFieldCount
Definition: tpsubt.hxx:55
std::unique_ptr< weld::CheckButton > m_xBtnSort
Definition: tpsubt.hxx:141
#define SC_MAXFIELDS
Definition: tpsort.hxx:37
ScViewData * pViewData
Definition: tpsubt.hxx:49
const SfxItemSet * GetDialogExampleSet() const
IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView &, rLb, void)
Definition: tpsubt.cxx:344
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:429
bool bReplace
replace existing results
virtual ~ScTpSubTotalGroup2() override
Definition: tpsubt.cxx:613
static ScSubTotalFunc LbPosToFunc(sal_uInt16 nPos)
Definition: tpsubt.cxx:298
#define RESET(i)
Definition: tpsubt.cxx:422
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:18
ScViewData * pViewData
Definition: tpsubt.hxx:134
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:428
std::unique_ptr< weld::RadioButton > m_xBtnDescending
Definition: tpsubt.hxx:144
std::unique_ptr< weld::CheckButton > mxLbSelectAllColumns
Definition: tpsubt.hxx:60
std::unique_ptr< weld::ComboBox > m_xLbUserDef
Definition: tpsubt.hxx:147
bool bIncludePattern
sort formats
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:431
std::unique_ptr< weld::TreeView > mxLbFunctions
Definition: tpsubt.hxx:59
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:425
ScTpSubTotalGroup1(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:410
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:511
const sal_uInt16 nWhichSubTotals
Definition: tpsubt.hxx:136
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:53
const sal_uInt16 nWhichSubTotals
Definition: tpsubt.hxx:52
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
ScTpSubTotalOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsubt.cxx:436
ScSubTotalFunc
Definition: global.hxx:845
virtual ~ScTpSubTotalOptions() override
Definition: tpsubt.cxx:460
const OUString aStrNone
Definition: tpsubt.hxx:46
const ScSubTotalParam & rSubTotalData
Definition: tpsubt.hxx:137
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsubt.cxx:424
void FillListBoxes()
Definition: tpsubt.cxx:243
bool bAscending
sort ascending
std::unique_ptr< weld::ComboBox > mxLbGroup
Definition: tpsubt.hxx:57
sal_Int16 SCTAB
Definition: types.hxx:23