LibreOffice Module sc (master)  1
PivotLayoutDialog.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 
12 #include <PivotLayoutTreeList.hxx>
13 #include <PivotLayoutDialog.hxx>
14 #include <reffact.hxx>
15 
16 #include <rangeutl.hxx>
17 #include <uiitems.hxx>
18 #include <dputil.hxx>
19 #include <dbdocfun.hxx>
20 #include <dpsave.hxx>
21 #include <dpshttab.hxx>
22 
23 #include <memory>
24 #include <vector>
25 
26 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
27 #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
28 
29 using namespace css::uno;
30 using namespace css::sheet;
31 
32 ScItemValue::ScItemValue(OUString const & aName, SCCOL nColumn, PivotFunc nFunctionMask) :
33  maName(aName),
34  maFunctionData(nColumn, nFunctionMask),
35  mpOriginalItemValue(this)
36 {}
37 
38 ScItemValue::ScItemValue(const ScItemValue* pInputItemValue) :
39  maName(pInputItemValue->maName),
40  maFunctionData(pInputItemValue->maFunctionData),
41  mpOriginalItemValue(this)
42 {}
43 
45 {}
46 
47 namespace
48 {
49 
50 ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument* pDocument)
51 {
53  ScRangeName* pRangeName = pDocument->GetRangeName();
54  if (pRangeName == nullptr)
55  return aInvalidRange;
56 
57  const ScRangeData* pData = pRangeName->findByUpperName(aName.toAsciiUpperCase());
58  if (pData == nullptr)
59  return aInvalidRange;
60 
61  ScRange aRange;
62  if (pData->IsReference(aRange))
63  return aRange;
64 
65  return aInvalidRange;
66 }
67 
68 }
69 
71  SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
72  ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable)
73  : ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent, "modules/scalc/ui/pivottablelayoutdialog.ui", "PivotTableLayout")
74  , maPivotTableObject(*pPivotTableObject)
75  , mpPreviouslyFocusedListBox(nullptr)
76  , mpViewData(pViewData)
77  , mrDocument(*pViewData->GetDocument())
78  , mbNewPivotTable(bNewPivotTable)
79  , maAddressDetails(mrDocument.GetAddressConvention(), 0, 0)
80  , mbDialogLostFocus(false)
81  , mpActiveEdit(nullptr)
82  , mxListBoxField(new ScPivotLayoutTreeListLabel(m_xBuilder->weld_tree_view("listbox-fields")))
83  , mxListBoxPage(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-page")))
84  , mxListBoxColumn(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-column")))
85  , mxListBoxRow(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-row")))
86  , mxListBoxData(new ScPivotLayoutTreeListData(m_xBuilder->weld_tree_view("listbox-data")))
87  , mxCheckIgnoreEmptyRows(m_xBuilder->weld_check_button("check-ignore-empty-rows"))
88  , mxCheckTotalColumns(m_xBuilder->weld_check_button("check-total-columns"))
89  , mxCheckAddFilter(m_xBuilder->weld_check_button("check-add-filter"))
90  , mxCheckIdentifyCategories(m_xBuilder->weld_check_button("check-identify-categories"))
91  , mxCheckTotalRows(m_xBuilder->weld_check_button("check-total-rows"))
92  , mxCheckDrillToDetail(m_xBuilder->weld_check_button("check-drill-to-details"))
93  , mxSourceRadioNamedRange(m_xBuilder->weld_radio_button("source-radio-named-range"))
94  , mxSourceRadioSelection(m_xBuilder->weld_radio_button("source-radio-selection"))
95  , mxSourceListBox(m_xBuilder->weld_combo_box("source-list"))
96  , mxSourceEdit(new formula::RefEdit(m_xBuilder->weld_entry("source-edit")))
97  , mxSourceButton(new formula::RefButton(m_xBuilder->weld_button("source-button")))
98  , mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button("destination-radio-new-sheet"))
99  , mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button("destination-radio-named-range"))
100  , mxDestinationRadioSelection(m_xBuilder->weld_radio_button("destination-radio-selection"))
101  , mxDestinationListBox(m_xBuilder->weld_combo_box("destination-list"))
102  , mxDestinationEdit(new formula::RefEdit(m_xBuilder->weld_entry("destination-edit")))
103  , mxDestinationButton(new formula::RefButton(m_xBuilder->weld_button("destination-button")))
104  , mxBtnOK(m_xBuilder->weld_button("ok"))
105  , mxBtnCancel(m_xBuilder->weld_button("cancel"))
106  , mxSourceFrame(m_xBuilder->weld_frame("frame2"))
107  , mxSourceLabel(mxSourceFrame->weld_label_widget())
108  , mxDestFrame(m_xBuilder->weld_frame("frame1"))
109  , mxDestLabel(mxDestFrame->weld_label_widget())
110  , mxOptions(m_xBuilder->weld_expander("options"))
111  , mxMore(m_xBuilder->weld_expander("more"))
112 {
113  // Source UI
115  mxSourceRadioNamedRange->connect_toggled(aLink2);
116  mxSourceRadioSelection->connect_toggled(aLink2);
117 
118  mxSourceEdit->SetReferences(this, mxSourceLabel.get());
119  mxSourceButton->SetReferences(this, mxSourceEdit.get());
120 
121  Link<formula::RefEdit&,void> aEditLink = LINK(this, ScPivotLayoutDialog, GetEditFocusHandler);
122  mxDestinationEdit->SetGetFocusHdl(aEditLink);
123  mxSourceEdit->SetGetFocusHdl(aEditLink);
124 
125  aEditLink = LINK(this, ScPivotLayoutDialog, LoseEditFocusHandler);
126  mxDestinationEdit->SetLoseFocusHdl(aEditLink);
127  mxSourceEdit->SetLoseFocusHdl(aEditLink);
128 
129  mxSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
130  mxSourceListBox->connect_changed(LINK(this, ScPivotLayoutDialog, SourceListSelected));
131 
132  // Destination UI
133  aLink2 = LINK(this, ScPivotLayoutDialog, ToggleDestination);
134  mxDestinationRadioNewSheet->connect_toggled(aLink2);
135  mxDestinationRadioNamedRange->connect_toggled(aLink2);
136  mxDestinationRadioSelection->connect_toggled(aLink2);
137 
138  mxDestinationEdit->SetReferences(this, mxDestLabel.get());
139  mxDestinationButton->SetReferences(this, mxDestinationEdit.get());
140 
141  Link<formula::RefButton&,void> aButtonLink = LINK(this, ScPivotLayoutDialog, GetButtonFocusHandler);
142  mxSourceButton->SetGetFocusHdl(aButtonLink);
143  mxDestinationButton->SetGetFocusHdl(aButtonLink);
144 
145  aButtonLink = LINK(this, ScPivotLayoutDialog, LoseButtonFocusHandler);
146  mxSourceButton->SetLoseFocusHdl(aButtonLink);
147  mxDestinationButton->SetLoseFocusHdl(aButtonLink);
148 
149  // Buttons
150  mxBtnCancel->connect_clicked(LINK(this, ScPivotLayoutDialog, CancelClicked));
151  mxBtnOK->connect_clicked(LINK(this, ScPivotLayoutDialog, OKClicked));
152 
153  // Initialize Data
156 
157  mxListBoxField->Setup (this);
161  mxListBoxData->Setup (this);
162 
164 
165  // Initialize Options
166  const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData();
167  if (pSaveData == nullptr)
168  {
169  mxCheckAddFilter->set_active(false);
170  mxCheckDrillToDetail->set_active(false);
171  }
172  else
173  {
174  mxCheckAddFilter->set_active(pSaveData->GetFilterButton());
175  mxCheckDrillToDetail->set_active(pSaveData->GetDrillDown());
176  }
177 
182 
183  SetupSource();
185 }
186 
188 {
189 }
190 
192 {
193  mxSourceListBox->clear();
194 
195  ScRange aSourceRange;
196  OUString sSourceNamedRangeName;
197 
199  {
200  const ScSheetSourceDesc* pSheetSourceDesc = maPivotTableObject.GetSheetDesc();
201  aSourceRange = pSheetSourceDesc->GetSourceRange();
202 
203  if(!aSourceRange.IsValid())
204  {
205  // Source is probably a DB Range
206  mxSourceRadioNamedRange->set_sensitive(false);
207  mxSourceRadioSelection->set_sensitive(false);
208  ToggleSource();
209  return;
210  }
211  else
212  {
213  OUString aSourceRangeName = aSourceRange.Format(mrDocument, ScRefFlags::RANGE_ABS_3D, maAddressDetails);
214  mxSourceEdit->SetText(aSourceRangeName);
215  }
216  }
217  else
218  {
219  mxSourceRadioNamedRange->set_sensitive(false);
220  mxSourceRadioSelection->set_sensitive(false);
221  ToggleSource();
222  return;
223  }
224 
225  // Setup Named Ranges
226  bool bIsNamedRange = false;
227 
228  ScAreaNameIterator aIterator(&mrDocument);
229  OUString aEachName;
230  ScRange aEachRange;
231 
232  while (aIterator.Next(aEachName, aEachRange))
233  {
234  if (!aIterator.WasDBName())
235  {
236  mxSourceListBox->append_text(aEachName);
237  if (aEachRange == aSourceRange)
238  {
239  sSourceNamedRangeName = aEachName;
240  bIsNamedRange = true;
241  }
242  }
243  }
244 
245  if (bIsNamedRange)
246  {
247  mxSourceListBox->set_active_text(sSourceNamedRangeName);
248  mxSourceRadioNamedRange->set_active(true);
249  }
250  else
251  {
252  mxSourceListBox->set_active(0);
253  mxSourceRadioSelection->set_active(true);
254  }
255 
256  // If entries - select first entry, otherwise disable the radio button.
257  if (mxSourceListBox->get_count() <= 0)
258  mxSourceRadioNamedRange->set_sensitive(false);
259 
260  ToggleSource();
261 }
262 
264 {
265  mxDestinationListBox->clear();
266 
267  // Fill up named ranges
268  ScAreaNameIterator aIterator(&mrDocument);
269  OUString aName;
270  ScRange aRange;
271 
272  while (aIterator.Next(aName, aRange))
273  {
274  if (!aIterator.WasDBName())
275  {
276  mxDestinationListBox->append_text(aName);
277  }
278  }
279 
280  // If entries - select first entry, otherwise disable the radio button.
281  if (mxDestinationListBox->get_count() > 0)
282  mxDestinationListBox->set_active(0);
283  else
284  mxDestinationRadioNamedRange->set_sensitive(false);
285 
286  //
287  if (mbNewPivotTable)
288  {
289  mxDestinationRadioNewSheet->set_active(true);
290  }
291  else
292  {
293  if (maPivotParameters.nTab != MAXTAB + 1)
294  {
296  OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, &mrDocument, maAddressDetails);
297  mxDestinationEdit->SetText(aAddressString);
298  mxDestinationRadioSelection->set_active(true);
299  }
300  }
301 
303 }
304 
306 {
312 }
313 
315 {
316  if (mbDialogLostFocus)
317  {
318  mbDialogLostFocus = false;
319  if(mpActiveEdit != nullptr)
320  {
322  if (mpActiveEdit == mxSourceEdit.get())
324  }
325  }
326  else
327  {
328  m_xDialog->grab_focus();
329  }
330 
331  RefInputDone();
332 }
333 
334 void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocument& rDocument)
335 {
336  if (!mbDialogLostFocus)
337  return;
338 
339  if (mpActiveEdit == nullptr)
340  return;
341 
342  if (rReferenceRange.aStart != rReferenceRange.aEnd)
344 
345  OUString aReferenceString = rReferenceRange.Format(rDocument, ScRefFlags::RANGE_ABS_3D, maAddressDetails);
346 
347  if (mpActiveEdit == mxSourceEdit.get())
348  {
349  mxSourceEdit->SetRefString(aReferenceString);
350  }
351  else if (mpActiveEdit == mxDestinationEdit.get())
352  {
353  mxDestinationEdit->SetRefString(aReferenceString);
354  }
355 }
356 
358 {
359  return mbDialogLostFocus;
360 }
361 
363 {
364  if (pItemValue == nullptr)
365  return;
366 
367  switch (eType)
368  {
372  {
373  mxListBoxRow->RemoveEntryForItem(pItemValue);
374  mxListBoxColumn->RemoveEntryForItem(pItemValue);
375  mxListBoxPage->RemoveEntryForItem(pItemValue);
376  }
377  break;
379  {
380  mxListBoxRow->RemoveEntryForItem(pItemValue);
381  mxListBoxColumn->RemoveEntryForItem(pItemValue);
382  mxListBoxPage->RemoveEntryForItem(pItemValue);
383  mxListBoxData->RemoveEntryForItem(pItemValue);
384  }
385  break;
386  default:
387  break;
388  }
389 }
390 
392 {
394  return;
395 
397 
398  if (mxSourceRadioNamedRange->get_active())
399  {
400  OUString aEntryString = mxSourceListBox->get_active_text();
401  ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, &mrDocument);
402  if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange)
403  return;
404  aSourceSheet.SetRangeName(aEntryString);
405  }
406  else if (mxSourceRadioSelection->get_active())
407  {
408  OUString aSourceString = mxSourceEdit->GetText();
409  ScRange aSourceRange;
410  ScRefFlags nResult = aSourceRange.Parse(aSourceString, &mrDocument, maAddressDetails);
411 
412  bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
413 
414  mxSourceEdit->SetRefValid(true);
415 
416  if (bIsValid)
417  {
418  ScRefAddress aStart;
419  ScRefAddress aEnd;
420 
421  ConvertDoubleRef(&mrDocument, aSourceString, 1, aStart, aEnd, maAddressDetails);
422  aSourceRange.aStart = aStart.GetAddress();
423  aSourceRange.aEnd = aEnd.GetAddress();
424  }
425  else
426  {
427  aSourceRange = lclGetRangeForNamedRange(aSourceString, &mrDocument);
428  }
429 
430  if (!aSourceRange.IsValid())
431  {
432  mxSourceEdit->SetRefValid(false);
433  return;
434  }
435 
436  if (aSourceSheet.GetSourceRange() == aSourceRange)
437  return;
438 
439  aSourceSheet.SetSourceRange(aSourceRange);
440  if (aSourceSheet.CheckSourceRange() != nullptr)
441  {
442  mxSourceEdit->SetRefValid(false);
443  return;
444  }
445  }
446  else
447  {
448  return;
449  }
450 
451  maPivotTableObject.SetSheetDesc(aSourceSheet);
454 
456 }
457 
459 {
460  ScDPSaveData aSaveData;
461  ApplySaveData(aSaveData);
462  ApplyLabelData(aSaveData);
463 
465  ScRange aDestinationRange;
466  bool bToNewSheet = false;
467 
468  if (!GetDestination(aDestinationRange, bToNewSheet))
469  return;
470 
471  SetDispatcherLock(false);
473 
474  sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
475  ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
476  mpViewData->GetViewShell()->SetDialogDPObject(std::make_unique<ScDPObject>(maPivotTableObject));
477 
478 
479  SfxDispatcher* pDispatcher = GetBindings().GetDispatcher();
480  SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
481  const SfxPoolItem* pResult = pDispatcher->ExecuteList(SID_PIVOT_TABLE,
482  nCallMode, { &aPivotItem });
483 
484  if (pResult != nullptr)
485  {
486  // existing pivot table might have moved to a new range or a new sheet
487  if ( pOldDPObj != nullptr )
488  {
489  const ScRange& rOldRange = pOldDPObj->GetOutRange();
490 
491  ScDPObject *pDPObj = nullptr;
492  // FIXME: if the new range overlaps with the old one, the table actually doesn't move
493  // and shouldn't therefore be deleted
494  if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.In( aDestinationRange ) )
495  || bToNewSheet )
496  {
498  }
499  if (pDPObj)
500  {
501  ScDBDocFunc aFunc( *(mpViewData->GetDocShell() ));
502  aFunc.RemovePivotTable( *pDPObj, true, false);
504  }
505  }
506  return;
507  }
508 
509  SetDispatcherLock(true);
510 }
511 
513 {
514  rSaveData.SetIgnoreEmptyRows(mxCheckIgnoreEmptyRows->get_active());
515  rSaveData.SetRepeatIfEmpty(mxCheckIdentifyCategories->get_active());
516  rSaveData.SetColumnGrand(mxCheckTotalColumns->get_active());
517  rSaveData.SetRowGrand(mxCheckTotalRows->get_active());
518  rSaveData.SetFilterButton(mxCheckAddFilter->get_active());
519  rSaveData.SetDrillDown(mxCheckDrillToDetail->get_active());
520 
521  Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource();
522 
523  ScPivotFieldVector aPageFieldVector;
524  mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
525  ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE,
527 
528  ScPivotFieldVector aColFieldVector;
529  mxListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
530  ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN,
532 
533  ScPivotFieldVector aRowFieldVector;
534  mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
535  ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW,
537 
538  ScPivotFieldVector aDataFieldVector;
539  mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
540  ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA,
542  &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
543 }
544 
546 {
547  ScDPLabelDataVector& rLabelDataVector = GetLabelDataVector();
548 
549  for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelDataVector)
550  {
551  OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData->maName, pLabelData->mnDupCount);
552  ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
553 
554  if (pSaveDimensions == nullptr)
555  continue;
556 
557  pSaveDimensions->SetUsedHierarchy(pLabelData->mnUsedHier);
558  pSaveDimensions->SetShowEmpty(pLabelData->mbShowAll);
559  pSaveDimensions->SetRepeatItemLabels(pLabelData->mbRepeatItemLabels);
560  pSaveDimensions->SetSortInfo(&pLabelData->maSortInfo);
561  pSaveDimensions->SetLayoutInfo(&pLabelData->maLayoutInfo);
562  pSaveDimensions->SetAutoShowInfo(&pLabelData->maShowInfo);
563 
564  bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
565 
566  for (ScDPLabelData::Member const & rLabelMember : pLabelData->maMembers)
567  {
568  ScDPSaveMember* pMember = pSaveDimensions->GetMemberByName(rLabelMember.maName);
569 
570  if (bManualSort || !rLabelMember.mbVisible || !rLabelMember.mbShowDetails)
571  {
572  pMember->SetIsVisible(rLabelMember.mbVisible);
573  pMember->SetShowDetails(rLabelMember.mbShowDetails);
574  }
575  }
576  }
577 }
578 
579 bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNewSheet)
580 {
581  bToNewSheet = false;
582 
583  if (mxDestinationRadioNamedRange->get_active())
584  {
585  OUString aName = mxDestinationListBox->get_active_text();
586  aDestinationRange = lclGetRangeForNamedRange(aName, &mrDocument);
587  if (!aDestinationRange.IsValid())
588  return false;
589  }
590  else if (mxDestinationRadioSelection->get_active())
591  {
592  ScAddress aAddress;
593  aAddress.Parse(mxDestinationEdit->GetText(), &mrDocument, maAddressDetails);
594  aDestinationRange = ScRange(aAddress);
595  }
596  else
597  {
598  bToNewSheet = true;
600  }
601  return true;
602 }
603 
605 {
606  return mxListBoxField->GetItem(nColumn);
607 }
608 
610 {
611  return mxListBoxField->IsDataElement(nColumn);
612 }
613 
615 {
616  return *maPivotParameters.maLabelArray[nColumn];
617 }
618 
619 void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
620 {
621  mxListBoxData->PushDataFieldNames(rDataFieldNames);
622 }
623 
625 {
626  DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
627 }
628 
630 {
631  ApplyChanges();
632  m_xDialog->response(RET_OK);
633 }
634 
636 {
637  m_xDialog->response(RET_CANCEL);
638 }
639 
640 IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit&, rCtrl, void)
641 {
642  mpActiveEdit = &rCtrl;
643  mpActiveEdit->SelectAll();
644 }
645 
646 IMPL_LINK(ScPivotLayoutDialog, GetButtonFocusHandler, formula::RefButton&, rCtrl, void)
647 {
648  mpActiveEdit = nullptr;
649 
650  if (&rCtrl == mxSourceButton.get())
651  mpActiveEdit = mxSourceEdit.get();
652  else if (&rCtrl == mxDestinationButton.get())
653  mpActiveEdit = mxDestinationEdit.get();
654 
655  if (mpActiveEdit)
656  mpActiveEdit->SelectAll();
657 }
658 
660 {
661  mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
662 }
663 
665 {
666  mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
667 }
668 
670 {
671  UpdateSourceRange();
672 }
673 
675 {
676  UpdateSourceRange();
677 }
678 
680 {
681  ToggleSource();
682 }
683 
685 {
686  bool bNamedRange = mxSourceRadioNamedRange->get_active();
687  bool bSelection = mxSourceRadioSelection->get_active();
688  mxSourceListBox->set_sensitive(bNamedRange);
689  mxSourceButton->GetWidget()->set_sensitive(bSelection);
690  mxSourceEdit->GetWidget()->set_sensitive(bSelection);
692 }
693 
695 {
696  ToggleDestination();
697 }
698 
700 {
701  bool bNamedRange = mxDestinationRadioNamedRange->get_active();
702  bool bSelection = mxDestinationRadioSelection->get_active();
703  mxDestinationListBox->set_sensitive(bNamedRange);
704  mxDestinationButton->GetWidget()->set_sensitive(bSelection);
705  mxDestinationEdit->GetWidget()->set_sensitive(bSelection);
706 }
707 
708 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool Next(OUString &rName, ScRange &rRange)
Definition: rangeutl.cxx:949
ScDBFunc * GetView() const
Definition: viewdata.hxx:356
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
Definition: dpsave.cxx:999
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:358
static SC_DLLPUBLIC OUString createDuplicateDimensionName(const OUString &rOriginal, size_t nDupCount)
Definition: dputil.cxx:90
std::unique_ptr< ScPivotLayoutTreeListData > mxListBoxData
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2111
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
ScPivotFieldVector maDataFields
Definition: pivot.hxx:141
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScAddress aStart
Definition: address.hxx:500
std::unique_ptr< weld::CheckButton > mxCheckAddFilter
virtual bool IsRefInputMode() const override
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
Definition: dpsave.cxx:456
void FillOldParam(ScPivotParam &rParam) const
Definition: dpobject.cxx:2286
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1797
static void ConvertOrientation(ScDPSaveData &rSaveData, const ScPivotFieldVector &rFields, css::sheet::DataPilotFieldOrientation nOrient, const css::uno::Reference< css::sheet::XDimensionsSupplier > &xSource, const ScDPLabelDataVector &rLabels, const ScPivotFieldVector *pRefColFields=nullptr, const ScPivotFieldVector *pRefRowFields=nullptr, const ScPivotFieldVector *pRefPageFields=nullptr)
Definition: dpobject.cxx:2604
std::unique_ptr< ContentProperties > pData
ScDPLabelData & GetLabelData(SCCOL nColumn)
void CursorPosChanged()
Definition: tabview3.cxx:619
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxPage
std::unique_ptr< formula::RefEdit > mxSourceEdit
std::unique_ptr< ScPivotLayoutTreeListLabel > mxListBoxField
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
bool IsDataElement(SCCOL nColumn)
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
Definition: dpobject.cxx:2436
std::unique_ptr< weld::ComboBox > mxSourceListBox
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:700
bool WasDBName() const
Definition: rangeutl.hxx:263
std::unique_ptr< formula::RefButton > mxDestinationButton
ScAddress aEnd
Definition: address.hxx:501
std::unique_ptr< weld::RadioButton > mxDestinationRadioNamedRange
ScPivotLayoutDialog(SfxBindings *pSfxBindings, SfxChildWindow *pChildWindow, weld::Window *pParent, ScViewData *pViewData, const ScDPObject *pPivotTableObject, bool bCreateNewPivotTable)
virtual void SetActive() override
void SetUsedHierarchy(long nNew)
Definition: dpsave.cxx:348
std::unique_ptr< weld::Label > mxSourceLabel
RET_CANCEL
SCTAB nTab
Definition: pivot.hxx:135
SC_DLLPUBLIC void SetIsVisible(bool bSet)
Definition: dpsave.cxx:95
void ApplyLabelData(const ScDPSaveData &rSaveData)
IMPL_LINK_NOARG(ScPivotLayoutDialog, OKClicked, weld::Button &, void)
const char * CheckSourceRange() const
Check the sanity of the data source range.
Definition: dpshttab.cxx:306
std::unique_ptr< weld::RadioButton > mxDestinationRadioNewSheet
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
Definition: dpshttab.cxx:223
ScAddress::Details maAddressDetails
const ScRange & GetOutRange() const
Definition: dpobject.cxx:409
std::unique_ptr< weld::RadioButton > mxSourceRadioSelection
void PushDataFieldNames(std::vector< ScDPName > &rDataFieldNames)
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
Definition: dpshttab.cxx:229
PivotFunc
Definition: dpglobal.hxx:25
formula::RefEdit * mpActiveEdit
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
Definition: dpobject.cxx:414
ScItemValue(OUString const &aName, SCCOL nColumn, PivotFunc nFunctionMask)
ScPivotParam maPivotParameters
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
virtual void Close() override
ScDPLabelDataVector maLabelArray
Definition: pivot.hxx:137
bool GetDrillDown() const
Definition: dpsave.hxx:342
std::unique_ptr< weld::Button > mxBtnCancel
bool ConvertDoubleRef(const ScDocument *pDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1517
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:682
bool bMakeTotalCol
Definition: pivot.hxx:145
std::unique_ptr< weld::ComboBox > mxDestinationListBox
ScPivotFieldVector maColFields
Definition: pivot.hxx:139
std::unique_ptr< weld::CheckButton > mxCheckTotalRows
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
Definition: pivot.hxx:113
std::unique_ptr< weld::CheckButton > mxCheckIdentifyCategories
std::vector< ScPivotField > ScPivotFieldVector
Definition: pivot.hxx:129
std::unique_ptr< weld::CheckButton > mxCheckTotalColumns
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
Definition: dpobject.cxx:515
virtual ~ScPivotLayoutDialog() override
sal_Int16 SCCOL
Definition: types.hxx:22
#define SC_MOD()
Definition: scmod.hxx:253
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxColumn
SC_DLLPUBLIC OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2207
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(const OUString &rName) const
Definition: dpsave.cxx:846
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:755
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
void ApplySaveData(ScDPSaveData &rSaveData)
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
Definition: dpsave.cxx:994
bool In(const ScAddress &) const
is Address& in Range?
Definition: address.hxx:733
const SCTAB MAXTAB
Definition: address.hxx:71
std::unique_ptr< weld::Button > mxBtnOK
SC_DLLPUBLIC void SetFilterButton(bool bSet)
Definition: dpsave.cxx:1004
SCCOL nCol
Cursor Position /.
Definition: pivot.hxx:133
bool IsValid() const
Definition: address.hxx:547
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument *=nullptr, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1737
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxRow
bool GetFilterButton() const
Definition: dpsave.hxx:338
SC_DLLPUBLIC void SetShowDetails(bool bSet)
Definition: dpsave.cxx:105
bool bMakeTotalRow
Definition: pivot.hxx:146
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pNew)
Definition: dpsave.cxx:410
IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit &, rCtrl, void)
SC_DLLPUBLIC void SetDrillDown(bool bSet)
Definition: dpsave.cxx:1009
ScItemValue * GetItem(SCCOL nColumn)
bool RemovePivotTable(ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1341
const ScAddress & GetAddress() const
Definition: address.hxx:888
virtual void SetReference(const ScRange &rReferenceRange, ScDocument &rDocument) override
SfxBindings & GetBindings() const
void SetRepeatItemLabels(bool bSet)
Definition: dpsave.cxx:338
std::unique_ptr< weld::CheckButton > mxCheckIgnoreEmptyRows
std::unique_ptr< weld::Label > mxDestLabel
void ItemInserted(const ScItemValue *pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType)
OUString maName
SCROW nRow
or start of destination area
Definition: pivot.hxx:134
RET_OK
ScDPLabelDataVector & GetLabelDataVector()
const ScSheetSourceDesc * GetSheetDesc() const
Definition: dpobject.hxx:156
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::RadioButton > mxSourceRadioNamedRange
ScPivotFieldVector maRowFields
Definition: pivot.hxx:140
SfxCallMode
void SwitchToDocument()
Definition: anyrefdg.cxx:649
void SetShowEmpty(bool bSet)
Definition: dpsave.cxx:333
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
Definition: dpsave.cxx:984
SC_DLLPUBLIC bool IsReference(ScRange &rRef) const
Definition: rangenam.cxx:369
SfxDispatcher * GetDispatcher() const
SC_DLLPUBLIC void SetRowGrand(bool bSet)
Definition: dpsave.cxx:989
std::unique_ptr< formula::RefButton > mxSourceButton
bool bIgnoreEmptyRows
Definition: pivot.hxx:143
ScPivotFieldVector maPageFields
Definition: pivot.hxx:138
ScRefFlags
Definition: address.hxx:145
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
Definition: dpshttab.cxx:259
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:694
bool bDetectCategories
Definition: pivot.hxx:144
std::unique_ptr< formula::RefEdit > mxDestinationEdit
std::unique_ptr< weld::RadioButton > mxDestinationRadioSelection
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument *=nullptr, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1543
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:39
std::unique_ptr< weld::CheckButton > mxCheckDrillToDetail
bool GetDestination(ScRange &aDestinationRange, bool &bToNewSheet)
void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pNew)
Definition: dpsave.cxx:418
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:725
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo *pNew)
Definition: dpsave.cxx:402