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 , mxCheckExpandCollapse(m_xBuilder->weld_check_button("check-show-expand-collapse"))
96 , mxSourceRadioNamedRange(m_xBuilder->weld_radio_button("source-radio-named-range"))
97 , mxSourceRadioSelection(m_xBuilder->weld_radio_button("source-radio-selection"))
98 , mxSourceListBox(m_xBuilder->weld_combo_box("source-list"))
99 , mxSourceEdit(new formula::RefEdit(m_xBuilder->weld_entry("source-edit")))
100 , mxSourceButton(new formula::RefButton(m_xBuilder->weld_button("source-button")))
101 , mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button("destination-radio-new-sheet"))
102 , mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button("destination-radio-named-range"))
103 , mxDestinationRadioSelection(m_xBuilder->weld_radio_button("destination-radio-selection"))
104 , mxDestinationListBox(m_xBuilder->weld_combo_box("destination-list"))
105 , mxDestinationEdit(new formula::RefEdit(m_xBuilder->weld_entry("destination-edit")))
106 , mxDestinationButton(new formula::RefButton(m_xBuilder->weld_button("destination-button")))
107 , mxBtnOK(m_xBuilder->weld_button("ok"))
108 , mxBtnCancel(m_xBuilder->weld_button("cancel"))
109 , mxSourceFrame(m_xBuilder->weld_frame("frame2"))
110 , mxSourceLabel(mxSourceFrame->weld_label_widget())
111 , mxDestFrame(m_xBuilder->weld_frame("frame1"))
112 , mxDestLabel(mxDestFrame->weld_label_widget())
113{
114 // Source UI
116 mxSourceRadioNamedRange->connect_toggled(aLink2);
117 mxSourceRadioSelection->connect_toggled(aLink2);
118
119 mxSourceEdit->SetReferences(this, mxSourceLabel.get());
120 mxSourceButton->SetReferences(this, mxSourceEdit.get());
121
122 Link<formula::RefEdit&,void> aEditLink = LINK(this, ScPivotLayoutDialog, GetEditFocusHandler);
123 mxDestinationEdit->SetGetFocusHdl(aEditLink);
124 mxSourceEdit->SetGetFocusHdl(aEditLink);
125
126 aEditLink = LINK(this, ScPivotLayoutDialog, LoseEditFocusHandler);
127 mxDestinationEdit->SetLoseFocusHdl(aEditLink);
128 mxSourceEdit->SetLoseFocusHdl(aEditLink);
129
130 mxSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
131 mxSourceListBox->connect_changed(LINK(this, ScPivotLayoutDialog, SourceListSelected));
132
133 // Destination UI
135 mxDestinationRadioNewSheet->connect_toggled(aLink2);
136 mxDestinationRadioNamedRange->connect_toggled(aLink2);
137 mxDestinationRadioSelection->connect_toggled(aLink2);
138
139 mxDestinationEdit->SetReferences(this, mxDestLabel.get());
140 mxDestinationButton->SetReferences(this, mxDestinationEdit.get());
141
142 Link<formula::RefButton&,void> aButtonLink = LINK(this, ScPivotLayoutDialog, GetButtonFocusHandler);
143 mxSourceButton->SetGetFocusHdl(aButtonLink);
144 mxDestinationButton->SetGetFocusHdl(aButtonLink);
145
146 aButtonLink = LINK(this, ScPivotLayoutDialog, LoseButtonFocusHandler);
147 mxSourceButton->SetLoseFocusHdl(aButtonLink);
148 mxDestinationButton->SetLoseFocusHdl(aButtonLink);
149
150 // Buttons
151 mxBtnCancel->connect_clicked(LINK(this, ScPivotLayoutDialog, CancelClicked));
152 mxBtnOK->connect_clicked(LINK(this, ScPivotLayoutDialog, OKClicked));
153
154 // Initialize Data
157
158 mxListBoxField->Setup (this);
162 mxListBoxData->Setup (this);
163
165
166 // Initialize Options
167 const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData();
168 if (pSaveData == nullptr)
169 {
170 mxCheckAddFilter->set_active(false);
171 mxCheckDrillToDetail->set_active(false);
172 mxCheckExpandCollapse->set_active(false);
173 }
174 else
175 {
176 mxCheckAddFilter->set_active(pSaveData->GetFilterButton());
177 mxCheckDrillToDetail->set_active(pSaveData->GetDrillDown());
178 mxCheckExpandCollapse->set_active(pSaveData->GetExpandCollapse());
179 }
180
185
186 SetupSource();
188}
189
191{
192}
193
195{
196 mxSourceListBox->clear();
197
198 ScRange aSourceRange;
199 OUString sSourceNamedRangeName;
200
202 {
203 const ScSheetSourceDesc* pSheetSourceDesc = maPivotTableObject.GetSheetDesc();
204 aSourceRange = pSheetSourceDesc->GetSourceRange();
205
206 if(!aSourceRange.IsValid())
207 {
208 // Source is probably a DB Range
209 mxSourceRadioNamedRange->set_sensitive(false);
210 mxSourceRadioSelection->set_sensitive(false);
211 ToggleSource();
212 return;
213 }
214 else
215 {
216 OUString aSourceRangeName = aSourceRange.Format(mrDocument, ScRefFlags::RANGE_ABS_3D, maAddressDetails);
217 mxSourceEdit->SetText(aSourceRangeName);
218 }
219 }
220 else
221 {
222 mxSourceRadioNamedRange->set_sensitive(false);
223 mxSourceRadioSelection->set_sensitive(false);
224 ToggleSource();
225 return;
226 }
227
228 // Setup Named Ranges
229 bool bIsNamedRange = false;
230
232 OUString aEachName;
233 ScRange aEachRange;
234
235 while (aIterator.Next(aEachName, aEachRange))
236 {
237 if (!aIterator.WasDBName())
238 {
239 mxSourceListBox->append_text(aEachName);
240 if (aEachRange == aSourceRange)
241 {
242 sSourceNamedRangeName = aEachName;
243 bIsNamedRange = true;
244 }
245 }
246 }
247
248 bool bSourceBoxHasEntries = mxSourceListBox->get_count() > 0;
249
250 if (bIsNamedRange)
251 {
252 mxSourceListBox->set_active_text(sSourceNamedRangeName);
253 mxSourceRadioNamedRange->set_active(true);
254 }
255 else
256 {
257 // If entries - select first entry
258 mxSourceListBox->set_active(bSourceBoxHasEntries ? 0 : -1);
259 mxSourceRadioSelection->set_active(true);
260 }
261
262 // If no entries disable the radio button.
263 if (!bSourceBoxHasEntries)
264 mxSourceRadioNamedRange->set_sensitive(false);
265
266 ToggleSource();
267}
268
270{
271 mxDestinationListBox->clear();
272
273 // Fill up named ranges
275 OUString aName;
276 ScRange aRange;
277
278 while (aIterator.Next(aName, aRange))
279 {
280 if (!aIterator.WasDBName())
281 {
282 mxDestinationListBox->append_text(aName);
283 }
284 }
285
286 // If entries - select first entry, otherwise disable the radio button.
287 if (mxDestinationListBox->get_count() > 0)
288 mxDestinationListBox->set_active(0);
289 else
290 mxDestinationRadioNamedRange->set_sensitive(false);
291
292 //
293 if (mbNewPivotTable)
294 {
295 mxDestinationRadioNewSheet->set_active(true);
296 }
297 else
298 {
299 if (maPivotParameters.nTab != MAXTAB + 1)
300 {
302 OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, &mrDocument, maAddressDetails);
303 mxDestinationEdit->SetText(aAddressString);
304 mxDestinationRadioSelection->set_active(true);
305 }
306 }
307
309}
310
312{
318}
319
321{
323 {
324 mbDialogLostFocus = false;
325 if(mpActiveEdit != nullptr)
326 {
328 if (mpActiveEdit == mxSourceEdit.get())
330 }
331 }
332 else
333 {
334 m_xDialog->grab_focus();
335 }
336
337 RefInputDone();
338}
339
340void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocument& rDocument)
341{
343 return;
344
345 if (mpActiveEdit == nullptr)
346 return;
347
348 if (rReferenceRange.aStart != rReferenceRange.aEnd)
350
351 OUString aReferenceString = rReferenceRange.Format(rDocument, ScRefFlags::RANGE_ABS_3D, maAddressDetails);
352
353 if (mpActiveEdit == mxSourceEdit.get())
354 {
355 mxSourceEdit->SetRefString(aReferenceString);
356 }
357 else if (mpActiveEdit == mxDestinationEdit.get())
358 {
359 mxDestinationEdit->SetRefString(aReferenceString);
360 }
361}
362
364{
365 return mbDialogLostFocus;
366}
367
369{
370 if (pItemValue == nullptr)
371 return;
372
373 switch (eType)
374 {
378 {
379 mxListBoxRow->RemoveEntryForItem(pItemValue);
380 mxListBoxColumn->RemoveEntryForItem(pItemValue);
381 mxListBoxPage->RemoveEntryForItem(pItemValue);
382 }
383 break;
385 {
386 mxListBoxRow->RemoveEntryForItem(pItemValue);
387 mxListBoxColumn->RemoveEntryForItem(pItemValue);
388 mxListBoxPage->RemoveEntryForItem(pItemValue);
389 mxListBoxData->RemoveEntryForItem(pItemValue);
390 }
391 break;
392 default:
393 break;
394 }
395}
396
398{
400 return;
401
403
404 if (mxSourceRadioNamedRange->get_active())
405 {
406 OUString aEntryString = mxSourceListBox->get_active_text();
407 ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mrDocument);
408 if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange)
409 return;
410 aSourceSheet.SetRangeName(aEntryString);
411 }
412 else if (mxSourceRadioSelection->get_active())
413 {
414 OUString aSourceString = mxSourceEdit->GetText();
415 ScRange aSourceRange;
416 ScRefFlags nResult = aSourceRange.Parse(aSourceString, mrDocument, maAddressDetails);
417
418 bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
419
420 mxSourceEdit->SetRefValid(true);
421
422 if (bIsValid)
423 {
424 ScRefAddress aStart;
425 ScRefAddress aEnd;
426
427 ConvertDoubleRef(mrDocument, aSourceString, 1, aStart, aEnd, maAddressDetails);
428 aSourceRange.aStart = aStart.GetAddress();
429 aSourceRange.aEnd = aEnd.GetAddress();
430 }
431 else
432 {
433 aSourceRange = lclGetRangeForNamedRange(aSourceString, mrDocument);
434 }
435
436 if (!aSourceRange.IsValid())
437 {
438 mxSourceEdit->SetRefValid(false);
439 return;
440 }
441
442 if (aSourceSheet.GetSourceRange() == aSourceRange)
443 return;
444
445 aSourceSheet.SetSourceRange(aSourceRange);
446 if (aSourceSheet.CheckSourceRange())
447 {
448 mxSourceEdit->SetRefValid(false);
449 return;
450 }
451 }
452 else
453 {
454 return;
455 }
456
457 maPivotTableObject.SetSheetDesc(aSourceSheet);
460
462}
463
465{
466 ScDPSaveData aSaveData;
467 ApplySaveData(aSaveData);
468 ApplyLabelData(aSaveData);
469
471 ScRange aDestinationRange;
472 bool bToNewSheet = false;
473
474 if (!GetDestination(aDestinationRange, bToNewSheet))
475 return;
476
477 SetDispatcherLock(false);
479
480 sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
481 ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
482 mpViewData->GetViewShell()->SetDialogDPObject(std::make_unique<ScDPObject>(maPivotTableObject));
483
484
485 SfxDispatcher* pDispatcher = GetBindings().GetDispatcher();
486 SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
487 const SfxPoolItem* pResult = pDispatcher->ExecuteList(SID_PIVOT_TABLE,
488 nCallMode, { &aPivotItem });
489
490 if (pResult != nullptr)
491 {
492 // existing pivot table might have moved to a new range or a new sheet
493 if ( pOldDPObj != nullptr )
494 {
495 const ScRange& rOldRange = pOldDPObj->GetOutRange();
496
497 ScDPObject *pDPObj = nullptr;
498 // FIXME: if the new range overlaps with the old one, the table actually doesn't move
499 // and shouldn't therefore be deleted
500 if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.Contains( aDestinationRange ) )
501 || bToNewSheet )
502 {
504 }
505 if (pDPObj)
506 {
507 ScDBDocFunc aFunc( *(mpViewData->GetDocShell() ));
508 aFunc.RemovePivotTable( *pDPObj, true, false);
510 }
511 }
512 return;
513 }
514
515 SetDispatcherLock(true);
516}
517
519{
520 rSaveData.SetIgnoreEmptyRows(mxCheckIgnoreEmptyRows->get_active());
521 rSaveData.SetRepeatIfEmpty(mxCheckIdentifyCategories->get_active());
522 rSaveData.SetColumnGrand(mxCheckTotalColumns->get_active());
523 rSaveData.SetRowGrand(mxCheckTotalRows->get_active());
524 rSaveData.SetFilterButton(mxCheckAddFilter->get_active());
525 rSaveData.SetDrillDown(mxCheckDrillToDetail->get_active());
526 rSaveData.SetExpandCollapse(mxCheckExpandCollapse->get_active());
527
528 Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource();
529
530 ScPivotFieldVector aPageFieldVector;
531 mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
532 ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE,
534
535 ScPivotFieldVector aColFieldVector;
536 mxListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
537 ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN,
539
540 ScPivotFieldVector aRowFieldVector;
541 mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
542 ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW,
544
545 ScPivotFieldVector aDataFieldVector;
546 mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
547 ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA,
549 &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
550}
551
553{
554 ScDPLabelDataVector& rLabelDataVector = GetLabelDataVector();
555
556 for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelDataVector)
557 {
558 OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData->maName, pLabelData->mnDupCount);
559 ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
560
561 if (pSaveDimensions == nullptr)
562 continue;
563
564 pSaveDimensions->SetUsedHierarchy(pLabelData->mnUsedHier);
565 pSaveDimensions->SetShowEmpty(pLabelData->mbShowAll);
566 pSaveDimensions->SetRepeatItemLabels(pLabelData->mbRepeatItemLabels);
567 pSaveDimensions->SetSortInfo(&pLabelData->maSortInfo);
568 pSaveDimensions->SetLayoutInfo(&pLabelData->maLayoutInfo);
569 pSaveDimensions->SetAutoShowInfo(&pLabelData->maShowInfo);
570
571 bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
572
573 for (ScDPLabelData::Member const & rLabelMember : pLabelData->maMembers)
574 {
575 ScDPSaveMember* pMember = pSaveDimensions->GetMemberByName(rLabelMember.maName);
576
577 if (bManualSort || !rLabelMember.mbVisible || !rLabelMember.mbShowDetails)
578 {
579 pMember->SetIsVisible(rLabelMember.mbVisible);
580 pMember->SetShowDetails(rLabelMember.mbShowDetails);
581 }
582 }
583 }
584}
585
586bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNewSheet)
587{
588 bToNewSheet = false;
589
590 if (mxDestinationRadioNamedRange->get_active())
591 {
592 OUString aName = mxDestinationListBox->get_active_text();
593 aDestinationRange = lclGetRangeForNamedRange(aName, mrDocument);
594 if (!aDestinationRange.IsValid())
595 return false;
596 }
597 else if (mxDestinationRadioSelection->get_active())
598 {
599 ScAddress aAddress;
600 aAddress.Parse(mxDestinationEdit->GetText(), mrDocument, maAddressDetails);
601 aDestinationRange = ScRange(aAddress);
602 }
603 else
604 {
605 bToNewSheet = true;
607 }
608 return true;
609}
610
612{
613 return mxListBoxField->GetItem(nColumn);
614}
615
617{
618 return mxListBoxField->IsDataElement(nColumn);
619}
620
622{
623 return *maPivotParameters.maLabelArray[nColumn];
624}
625
626void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
627{
628 mxListBoxData->PushDataFieldNames(rDataFieldNames);
629}
630
632{
633 DoClose(ScPivotLayoutWrapper::GetChildWindowId());
635}
636
638{
639 /* tdf#137726 hide so it's not a candidate to be parent of any error
640 messages that may appear because this dialog is going to disappear on
641 response(RET_OK) and the error dialog is not run in its own event loop
642 but instead async */
643 m_xDialog->hide();
644
645 ApplyChanges();
646 m_xDialog->response(RET_OK);
647}
648
650{
651 m_xDialog->response(RET_CANCEL);
652}
653
654IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit&, rCtrl, void)
655{
656 mpActiveEdit = &rCtrl;
657 mpActiveEdit->SelectAll();
658}
659
660IMPL_LINK(ScPivotLayoutDialog, GetButtonFocusHandler, formula::RefButton&, rCtrl, void)
661{
662 mpActiveEdit = nullptr;
663
664 if (&rCtrl == mxSourceButton.get())
665 mpActiveEdit = mxSourceEdit.get();
666 else if (&rCtrl == mxDestinationButton.get())
667 mpActiveEdit = mxDestinationEdit.get();
668
669 if (mpActiveEdit)
670 mpActiveEdit->SelectAll();
671}
672
674{
675 mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
676}
677
679{
680 mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
681}
682
684{
685 UpdateSourceRange();
686}
687
689{
690 UpdateSourceRange();
691}
692
694{
695 ToggleSource();
696}
697
699{
700 bool bNamedRange = mxSourceRadioNamedRange->get_active();
701 bool bSelection = mxSourceRadioSelection->get_active();
702 mxSourceListBox->set_sensitive(bNamedRange);
703 mxSourceButton->GetWidget()->set_sensitive(bSelection);
704 mxSourceEdit->GetWidget()->set_sensitive(bSelection);
706}
707
709{
710 ToggleDestination();
711}
712
714{
715 bool bNamedRange = mxDestinationRadioNamedRange->get_active();
716 bool bSelection = mxDestinationRadioSelection->get_active();
717 mxDestinationListBox->set_sensitive(bNamedRange);
718 mxDestinationButton->GetWidget()->set_sensitive(bSelection);
719 mxDestinationEdit->GetWidget()->set_sensitive(bSelection);
720}
721
722/* 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:1006
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:2644
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:997
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
Definition: dpsave.cxx:849
bool GetDrillDown() const
Definition: dpsave.hxx:343
SC_DLLPUBLIC void SetExpandCollapse(bool bSet)
Definition: dpsave.cxx:1017
bool GetFilterButton() const
Definition: dpsave.hxx:339
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
Definition: dpsave.cxx:1002
SC_DLLPUBLIC void SetFilterButton(bool bSet)
Definition: dpsave.cxx:1007
bool GetExpandCollapse() const
Definition: dpsave.hxx:347
SC_DLLPUBLIC void SetRowGrand(bool bSet)
Definition: dpsave.cxx:992
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
Definition: dpsave.cxx:987
SC_DLLPUBLIC void SetDrillDown(bool bSet)
Definition: dpsave.cxx:1012
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:377
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:171
ScItemValue(OUString aName, SCCOL nColumn, PivotFunc nFunctionMask)
void ItemInserted(const ScItemValue *pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType)
std::unique_ptr< formula::RefButton > mxDestinationButton
std::unique_ptr< weld::CheckButton > mxCheckExpandCollapse
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:745
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:775
void SwitchToDocument()
Definition: anyrefdg.cxx:669
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:714
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:720
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:864
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:247
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