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
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#include <scmod.hxx>
23
24#include <memory>
25#include <utility>
26#include <vector>
27
28#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
30
31using namespace css::uno;
32using namespace css::sheet;
33
34ScItemValue::ScItemValue(OUString aName, SCCOL nColumn, PivotFunc nFunctionMask) :
35 maName(std::move(aName)),
36 maFunctionData(nColumn, nFunctionMask),
37 mpOriginalItemValue(this)
38{}
39
40ScItemValue::ScItemValue(const ScItemValue* pInputItemValue) :
41 maName(pInputItemValue->maName),
42 maFunctionData(pInputItemValue->maFunctionData),
43 mpOriginalItemValue(this)
44{}
45
47{}
48
49namespace
50{
51
52ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument& rDocument)
53{
55 ScRangeName* pRangeName = rDocument.GetRangeName();
56 if (pRangeName == nullptr)
57 return aInvalidRange;
58
59 const ScRangeData* pData = pRangeName->findByUpperName(aName.toAsciiUpperCase());
60 if (pData == nullptr)
61 return aInvalidRange;
62
63 ScRange aRange;
64 if (pData->IsReference(aRange))
65 return aRange;
66
67 return aInvalidRange;
68}
69
70}
71
73 SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
74 ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable)
75 : ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent, "modules/scalc/ui/pivottablelayoutdialog.ui", "PivotTableLayout")
76 , maPivotTableObject(*pPivotTableObject)
77 , mpPreviouslyFocusedListBox(nullptr)
78 , mpViewData(pViewData)
79 , mrDocument(pViewData->GetDocument())
80 , mbNewPivotTable(bNewPivotTable)
81 , maAddressDetails(mrDocument.GetAddressConvention(), 0, 0)
82 , mbDialogLostFocus(false)
83 , mpActiveEdit(nullptr)
84 , mxListBoxField(new ScPivotLayoutTreeListLabel(m_xBuilder->weld_tree_view("listbox-fields")))
85 , mxListBoxPage(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-page")))
86 , mxListBoxColumn(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-column")))
87 , mxListBoxRow(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-row")))
88 , mxListBoxData(new ScPivotLayoutTreeListData(m_xBuilder->weld_tree_view("listbox-data")))
89 , mxCheckIgnoreEmptyRows(m_xBuilder->weld_check_button("check-ignore-empty-rows"))
90 , mxCheckTotalColumns(m_xBuilder->weld_check_button("check-total-columns"))
91 , mxCheckAddFilter(m_xBuilder->weld_check_button("check-add-filter"))
92 , mxCheckIdentifyCategories(m_xBuilder->weld_check_button("check-identify-categories"))
93 , mxCheckTotalRows(m_xBuilder->weld_check_button("check-total-rows"))
94 , mxCheckDrillToDetail(m_xBuilder->weld_check_button("check-drill-to-details"))
95 , mxSourceRadioNamedRange(m_xBuilder->weld_radio_button("source-radio-named-range"))
96 , mxSourceRadioSelection(m_xBuilder->weld_radio_button("source-radio-selection"))
97 , mxSourceListBox(m_xBuilder->weld_combo_box("source-list"))
98 , mxSourceEdit(new formula::RefEdit(m_xBuilder->weld_entry("source-edit")))
99 , mxSourceButton(new formula::RefButton(m_xBuilder->weld_button("source-button")))
100 , mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button("destination-radio-new-sheet"))
101 , mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button("destination-radio-named-range"))
102 , mxDestinationRadioSelection(m_xBuilder->weld_radio_button("destination-radio-selection"))
103 , mxDestinationListBox(m_xBuilder->weld_combo_box("destination-list"))
104 , mxDestinationEdit(new formula::RefEdit(m_xBuilder->weld_entry("destination-edit")))
105 , mxDestinationButton(new formula::RefButton(m_xBuilder->weld_button("destination-button")))
106 , mxBtnOK(m_xBuilder->weld_button("ok"))
107 , mxBtnCancel(m_xBuilder->weld_button("cancel"))
108 , mxSourceFrame(m_xBuilder->weld_frame("frame2"))
109 , mxSourceLabel(mxSourceFrame->weld_label_widget())
110 , mxDestFrame(m_xBuilder->weld_frame("frame1"))
111 , mxDestLabel(mxDestFrame->weld_label_widget())
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
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
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 bool bSourceBoxHasEntries = mxSourceListBox->get_count() > 0;
246
247 if (bIsNamedRange)
248 {
249 mxSourceListBox->set_active_text(sSourceNamedRangeName);
250 mxSourceRadioNamedRange->set_active(true);
251 }
252 else
253 {
254 // If entries - select first entry
255 mxSourceListBox->set_active(bSourceBoxHasEntries ? 0 : -1);
256 mxSourceRadioSelection->set_active(true);
257 }
258
259 // If no entries disable the radio button.
260 if (!bSourceBoxHasEntries)
261 mxSourceRadioNamedRange->set_sensitive(false);
262
263 ToggleSource();
264}
265
267{
268 mxDestinationListBox->clear();
269
270 // Fill up named ranges
272 OUString aName;
273 ScRange aRange;
274
275 while (aIterator.Next(aName, aRange))
276 {
277 if (!aIterator.WasDBName())
278 {
279 mxDestinationListBox->append_text(aName);
280 }
281 }
282
283 // If entries - select first entry, otherwise disable the radio button.
284 if (mxDestinationListBox->get_count() > 0)
285 mxDestinationListBox->set_active(0);
286 else
287 mxDestinationRadioNamedRange->set_sensitive(false);
288
289 //
290 if (mbNewPivotTable)
291 {
292 mxDestinationRadioNewSheet->set_active(true);
293 }
294 else
295 {
296 if (maPivotParameters.nTab != MAXTAB + 1)
297 {
299 OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, &mrDocument, maAddressDetails);
300 mxDestinationEdit->SetText(aAddressString);
301 mxDestinationRadioSelection->set_active(true);
302 }
303 }
304
306}
307
309{
315}
316
318{
320 {
321 mbDialogLostFocus = false;
322 if(mpActiveEdit != nullptr)
323 {
325 if (mpActiveEdit == mxSourceEdit.get())
327 }
328 }
329 else
330 {
331 m_xDialog->grab_focus();
332 }
333
334 RefInputDone();
335}
336
337void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocument& rDocument)
338{
340 return;
341
342 if (mpActiveEdit == nullptr)
343 return;
344
345 if (rReferenceRange.aStart != rReferenceRange.aEnd)
347
348 OUString aReferenceString = rReferenceRange.Format(rDocument, ScRefFlags::RANGE_ABS_3D, maAddressDetails);
349
350 if (mpActiveEdit == mxSourceEdit.get())
351 {
352 mxSourceEdit->SetRefString(aReferenceString);
353 }
354 else if (mpActiveEdit == mxDestinationEdit.get())
355 {
356 mxDestinationEdit->SetRefString(aReferenceString);
357 }
358}
359
361{
362 return mbDialogLostFocus;
363}
364
366{
367 if (pItemValue == nullptr)
368 return;
369
370 switch (eType)
371 {
375 {
376 mxListBoxRow->RemoveEntryForItem(pItemValue);
377 mxListBoxColumn->RemoveEntryForItem(pItemValue);
378 mxListBoxPage->RemoveEntryForItem(pItemValue);
379 }
380 break;
382 {
383 mxListBoxRow->RemoveEntryForItem(pItemValue);
384 mxListBoxColumn->RemoveEntryForItem(pItemValue);
385 mxListBoxPage->RemoveEntryForItem(pItemValue);
386 mxListBoxData->RemoveEntryForItem(pItemValue);
387 }
388 break;
389 default:
390 break;
391 }
392}
393
395{
397 return;
398
400
401 if (mxSourceRadioNamedRange->get_active())
402 {
403 OUString aEntryString = mxSourceListBox->get_active_text();
404 ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mrDocument);
405 if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange)
406 return;
407 aSourceSheet.SetRangeName(aEntryString);
408 }
409 else if (mxSourceRadioSelection->get_active())
410 {
411 OUString aSourceString = mxSourceEdit->GetText();
412 ScRange aSourceRange;
413 ScRefFlags nResult = aSourceRange.Parse(aSourceString, mrDocument, maAddressDetails);
414
415 bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
416
417 mxSourceEdit->SetRefValid(true);
418
419 if (bIsValid)
420 {
421 ScRefAddress aStart;
422 ScRefAddress aEnd;
423
424 ConvertDoubleRef(mrDocument, aSourceString, 1, aStart, aEnd, maAddressDetails);
425 aSourceRange.aStart = aStart.GetAddress();
426 aSourceRange.aEnd = aEnd.GetAddress();
427 }
428 else
429 {
430 aSourceRange = lclGetRangeForNamedRange(aSourceString, mrDocument);
431 }
432
433 if (!aSourceRange.IsValid())
434 {
435 mxSourceEdit->SetRefValid(false);
436 return;
437 }
438
439 if (aSourceSheet.GetSourceRange() == aSourceRange)
440 return;
441
442 aSourceSheet.SetSourceRange(aSourceRange);
443 if (aSourceSheet.CheckSourceRange())
444 {
445 mxSourceEdit->SetRefValid(false);
446 return;
447 }
448 }
449 else
450 {
451 return;
452 }
453
454 maPivotTableObject.SetSheetDesc(aSourceSheet);
457
459}
460
462{
463 ScDPSaveData aSaveData;
464 ApplySaveData(aSaveData);
465 ApplyLabelData(aSaveData);
466
468 ScRange aDestinationRange;
469 bool bToNewSheet = false;
470
471 if (!GetDestination(aDestinationRange, bToNewSheet))
472 return;
473
474 SetDispatcherLock(false);
476
477 sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
478 ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
479 mpViewData->GetViewShell()->SetDialogDPObject(std::make_unique<ScDPObject>(maPivotTableObject));
480
481
482 SfxDispatcher* pDispatcher = GetBindings().GetDispatcher();
483 SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
484 const SfxPoolItem* pResult = pDispatcher->ExecuteList(SID_PIVOT_TABLE,
485 nCallMode, { &aPivotItem });
486
487 if (pResult != nullptr)
488 {
489 // existing pivot table might have moved to a new range or a new sheet
490 if ( pOldDPObj != nullptr )
491 {
492 const ScRange& rOldRange = pOldDPObj->GetOutRange();
493
494 ScDPObject *pDPObj = nullptr;
495 // FIXME: if the new range overlaps with the old one, the table actually doesn't move
496 // and shouldn't therefore be deleted
497 if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.Contains( aDestinationRange ) )
498 || bToNewSheet )
499 {
501 }
502 if (pDPObj)
503 {
504 ScDBDocFunc aFunc( *(mpViewData->GetDocShell() ));
505 aFunc.RemovePivotTable( *pDPObj, true, false);
507 }
508 }
509 return;
510 }
511
512 SetDispatcherLock(true);
513}
514
516{
517 rSaveData.SetIgnoreEmptyRows(mxCheckIgnoreEmptyRows->get_active());
518 rSaveData.SetRepeatIfEmpty(mxCheckIdentifyCategories->get_active());
519 rSaveData.SetColumnGrand(mxCheckTotalColumns->get_active());
520 rSaveData.SetRowGrand(mxCheckTotalRows->get_active());
521 rSaveData.SetFilterButton(mxCheckAddFilter->get_active());
522 rSaveData.SetDrillDown(mxCheckDrillToDetail->get_active());
523
524 Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource();
525
526 ScPivotFieldVector aPageFieldVector;
527 mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
528 ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE,
530
531 ScPivotFieldVector aColFieldVector;
532 mxListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
533 ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN,
535
536 ScPivotFieldVector aRowFieldVector;
537 mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
538 ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW,
540
541 ScPivotFieldVector aDataFieldVector;
542 mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
543 ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA,
545 &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
546}
547
549{
550 ScDPLabelDataVector& rLabelDataVector = GetLabelDataVector();
551
552 for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelDataVector)
553 {
554 OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData->maName, pLabelData->mnDupCount);
555 ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
556
557 if (pSaveDimensions == nullptr)
558 continue;
559
560 pSaveDimensions->SetUsedHierarchy(pLabelData->mnUsedHier);
561 pSaveDimensions->SetShowEmpty(pLabelData->mbShowAll);
562 pSaveDimensions->SetRepeatItemLabels(pLabelData->mbRepeatItemLabels);
563 pSaveDimensions->SetSortInfo(&pLabelData->maSortInfo);
564 pSaveDimensions->SetLayoutInfo(&pLabelData->maLayoutInfo);
565 pSaveDimensions->SetAutoShowInfo(&pLabelData->maShowInfo);
566
567 bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
568
569 for (ScDPLabelData::Member const & rLabelMember : pLabelData->maMembers)
570 {
571 ScDPSaveMember* pMember = pSaveDimensions->GetMemberByName(rLabelMember.maName);
572
573 if (bManualSort || !rLabelMember.mbVisible || !rLabelMember.mbShowDetails)
574 {
575 pMember->SetIsVisible(rLabelMember.mbVisible);
576 pMember->SetShowDetails(rLabelMember.mbShowDetails);
577 }
578 }
579 }
580}
581
582bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNewSheet)
583{
584 bToNewSheet = false;
585
586 if (mxDestinationRadioNamedRange->get_active())
587 {
588 OUString aName = mxDestinationListBox->get_active_text();
589 aDestinationRange = lclGetRangeForNamedRange(aName, mrDocument);
590 if (!aDestinationRange.IsValid())
591 return false;
592 }
593 else if (mxDestinationRadioSelection->get_active())
594 {
595 ScAddress aAddress;
596 aAddress.Parse(mxDestinationEdit->GetText(), mrDocument, maAddressDetails);
597 aDestinationRange = ScRange(aAddress);
598 }
599 else
600 {
601 bToNewSheet = true;
603 }
604 return true;
605}
606
608{
609 return mxListBoxField->GetItem(nColumn);
610}
611
613{
614 return mxListBoxField->IsDataElement(nColumn);
615}
616
618{
619 return *maPivotParameters.maLabelArray[nColumn];
620}
621
622void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
623{
624 mxListBoxData->PushDataFieldNames(rDataFieldNames);
625}
626
628{
629 DoClose(ScPivotLayoutWrapper::GetChildWindowId());
631}
632
634{
635 /* tdf#137726 hide so it's not a candidate to be parent of any error
636 messages that may appear because this dialog is going to disappear on
637 response(RET_OK) and the error dialog is not run in its own event loop
638 but instead async */
639 m_xDialog->hide();
640
641 ApplyChanges();
642 m_xDialog->response(RET_OK);
643}
644
646{
647 m_xDialog->response(RET_CANCEL);
648}
649
650IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit&, rCtrl, void)
651{
652 mpActiveEdit = &rCtrl;
653 mpActiveEdit->SelectAll();
654}
655
656IMPL_LINK(ScPivotLayoutDialog, GetButtonFocusHandler, formula::RefButton&, rCtrl, void)
657{
658 mpActiveEdit = nullptr;
659
660 if (&rCtrl == mxSourceButton.get())
661 mpActiveEdit = mxSourceEdit.get();
662 else if (&rCtrl == mxDestinationButton.get())
663 mpActiveEdit = mxDestinationEdit.get();
664
665 if (mpActiveEdit)
666 mpActiveEdit->SelectAll();
667}
668
670{
671 mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
672}
673
675{
676 mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
677}
678
680{
681 UpdateSourceRange();
682}
683
685{
686 UpdateSourceRange();
687}
688
690{
691 ToggleSource();
692}
693
695{
696 bool bNamedRange = mxSourceRadioNamedRange->get_active();
697 bool bSelection = mxSourceRadioSelection->get_active();
698 mxSourceListBox->set_sensitive(bNamedRange);
699 mxSourceButton->GetWidget()->set_sensitive(bSelection);
700 mxSourceEdit->GetWidget()->set_sensitive(bSelection);
702}
703
705{
706 ToggleDestination();
707}
708
710{
711 bool bNamedRange = mxDestinationRadioNamedRange->get_active();
712 bool bSelection = mxDestinationRadioSelection->get_active();
713 mxDestinationListBox->set_sensitive(bNamedRange);
714 mxDestinationButton->GetWidget()->set_sensitive(bSelection);
715 mxDestinationEdit->GetWidget()->set_sensitive(bSelection);
716}
717
718/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit &, rCtrl, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, OKClicked, weld::Button &, void)
bool ConvertDoubleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1511
ScRefFlags
Definition: address.hxx:158
const SCTAB MAXTAB
Definition: address.hxx:70
Reference< XExecutableDialog > m_xDialog
OUString maName
SfxCallMode
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2074
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, 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:1537
@ INITIALIZE_INVALID
Definition: address.hxx:221
bool WasDBName() const
Definition: rangeutl.hxx:271
bool Next(OUString &rName, ScRange &rRange)
Definition: rangeutl.cxx:1007
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1399
const ScRange & GetOutRange() const
Definition: dpobject.cxx:410
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
Definition: dpobject.cxx:516
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
Definition: dpobject.cxx:415
const ScSheetSourceDesc * GetSheetDesc() const
Definition: dpobject.hxx:156
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:2616
void FillOldParam(ScPivotParam &rParam) const
Definition: dpobject.cxx:2298
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
Definition: dpobject.cxx:2448
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
Definition: dpsave.cxx:995
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
Definition: dpsave.cxx:847
bool GetDrillDown() const
Definition: dpsave.hxx:342
bool GetFilterButton() const
Definition: dpsave.hxx:338
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
Definition: dpsave.cxx:1000
SC_DLLPUBLIC void SetFilterButton(bool bSet)
Definition: dpsave.cxx:1005
SC_DLLPUBLIC void SetRowGrand(bool bSet)
Definition: dpsave.cxx:990
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
Definition: dpsave.cxx:985
SC_DLLPUBLIC void SetDrillDown(bool bSet)
Definition: dpsave.cxx:1010
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pNew)
Definition: dpsave.cxx:412
void SetRepeatItemLabels(bool bSet)
Definition: dpsave.cxx:340
void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pNew)
Definition: dpsave.cxx:420
void SetUsedHierarchy(tools::Long nNew)
Definition: dpsave.cxx:350
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo *pNew)
Definition: dpsave.cxx:404
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
Definition: dpsave.cxx:458
void SetShowEmpty(bool bSet)
Definition: dpsave.cxx:335
SC_DLLPUBLIC void SetIsVisible(bool bSet)
Definition: dpsave.cxx:97
SC_DLLPUBLIC void SetShowDetails(bool bSet)
Definition: dpsave.cxx:107
static SC_DLLPUBLIC OUString createDuplicateDimensionName(const OUString &rOriginal, size_t nDupCount)
Definition: dputil.cxx:92
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:383
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:174
ScItemValue(OUString aName, SCCOL nColumn, PivotFunc nFunctionMask)
void ItemInserted(const ScItemValue *pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType)
std::unique_ptr< formula::RefButton > mxDestinationButton
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxColumn
std::unique_ptr< weld::CheckButton > mxCheckIdentifyCategories
std::unique_ptr< weld::CheckButton > mxCheckAddFilter
void ApplyLabelData(const ScDPSaveData &rSaveData)
std::unique_ptr< weld::RadioButton > mxDestinationRadioNewSheet
std::unique_ptr< ScPivotLayoutTreeListData > mxListBoxData
std::unique_ptr< weld::RadioButton > mxDestinationRadioNamedRange
std::unique_ptr< weld::RadioButton > mxSourceRadioNamedRange
virtual void SetActive() override
std::unique_ptr< formula::RefEdit > mxDestinationEdit
virtual void Close() override
std::unique_ptr< weld::ComboBox > mxDestinationListBox
std::unique_ptr< weld::RadioButton > mxDestinationRadioSelection
ScDPLabelDataVector & GetLabelDataVector()
virtual ~ScPivotLayoutDialog() override
std::unique_ptr< ScPivotLayoutTreeListLabel > mxListBoxField
std::unique_ptr< weld::ComboBox > mxSourceListBox
void ApplySaveData(ScDPSaveData &rSaveData)
std::unique_ptr< weld::Button > mxBtnCancel
std::unique_ptr< weld::CheckButton > mxCheckTotalRows
ScAddress::Details maAddressDetails
std::unique_ptr< weld::CheckButton > mxCheckTotalColumns
std::unique_ptr< weld::Button > mxBtnOK
ScDPLabelData & GetLabelData(SCCOL nColumn)
ScPivotLayoutDialog(SfxBindings *pSfxBindings, SfxChildWindow *pChildWindow, weld::Window *pParent, ScViewData *pViewData, const ScDPObject *pPivotTableObject, bool bCreateNewPivotTable)
ScPivotParam maPivotParameters
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxRow
std::unique_ptr< weld::Label > mxSourceLabel
bool GetDestination(ScRange &aDestinationRange, bool &bToNewSheet)
std::unique_ptr< weld::CheckButton > mxCheckDrillToDetail
std::unique_ptr< weld::Label > mxDestLabel
virtual void SetReference(const ScRange &rReferenceRange, ScDocument &rDocument) override
bool IsDataElement(SCCOL nColumn)
std::unique_ptr< formula::RefEdit > mxSourceEdit
std::unique_ptr< weld::RadioButton > mxSourceRadioSelection
std::unique_ptr< weld::CheckButton > mxCheckIgnoreEmptyRows
std::unique_ptr< formula::RefButton > mxSourceButton
formula::RefEdit * mpActiveEdit
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxPage
virtual bool IsRefInputMode() const override
ScItemValue * GetItem(SCCOL nColumn)
void PushDataFieldNames(std::vector< ScDPName > &rDataFieldNames)
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:704
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:2170
ScAddress aEnd
Definition: address.hxx:498
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
bool IsValid() const
Definition: address.hxx:544
ScRefFlags Parse(const OUString &, const ScDocument &, 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:1700
ScAddress aStart
Definition: address.hxx:497
const ScAddress & GetAddress() const
Definition: address.hxx:881
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:749
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:779
void SwitchToDocument()
Definition: anyrefdg.cxx:673
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:718
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:724
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:40
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
Definition: dpshttab.cxx:307
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
Definition: dpshttab.cxx:224
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
Definition: dpshttab.cxx:260
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
Definition: dpshttab.cxx:230
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1862
void CursorPosChanged()
Definition: tabview3.cxx:626
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScDBFunc * GetView() const
Definition: viewdata.cxx:863
SfxDispatcher * GetDispatcher() const
virtual void Close()
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 * >())
SfxBindings & GetBindings() const
PivotFunc
Definition: dpglobal.hxx:24
DocumentType eType
OUString aName
std::unique_ptr< sal_Int32[]> pData
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
Definition: pivot.hxx:113
std::vector< ScPivotField > ScPivotFieldVector
Definition: pivot.hxx:129
#define SC_MOD()
Definition: scmod.hxx:249
bool bMakeTotalRow
Definition: pivot.hxx:146
ScDPLabelDataVector maLabelArray
Definition: pivot.hxx:137
ScPivotFieldVector maDataFields
Definition: pivot.hxx:141
ScPivotFieldVector maRowFields
Definition: pivot.hxx:140
SCTAB nTab
Definition: pivot.hxx:135
bool bDetectCategories
Definition: pivot.hxx:144
SCCOL nCol
Cursor Position /.
Definition: pivot.hxx:133
SCROW nRow
or start of destination area
Definition: pivot.hxx:134
bool bIgnoreEmptyRows
Definition: pivot.hxx:143
bool bMakeTotalCol
Definition: pivot.hxx:145
ScPivotFieldVector maColFields
Definition: pivot.hxx:139
ScPivotFieldVector maPageFields
Definition: pivot.hxx:138
sal_Int16 SCCOL
Definition: types.hxx:21
RET_OK
RET_CANCEL