17 #include <uiitems.hxx>
27 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
28 #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
35 maFunctionData(nColumn, nFunctionMask),
36 mpOriginalItemValue(this)
41 maFunctionData(pInputItemValue->maFunctionData),
42 mpOriginalItemValue(this)
51 ScRange lclGetRangeForNamedRange(OUString
const & aName,
const ScDocument& rDocument)
55 if (pRangeName ==
nullptr)
74 :
ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent,
"modules/scalc/ui/pivottablelayoutdialog.ui",
"PivotTableLayout")
75 , maPivotTableObject(*pPivotTableObject)
76 , mpPreviouslyFocusedListBox(nullptr)
77 , mpViewData(pViewData)
78 , mrDocument(pViewData->GetDocument())
79 , mbNewPivotTable(bNewPivotTable)
80 , maAddressDetails(mrDocument.GetAddressConvention(), 0, 0)
81 , mbDialogLostFocus(
false)
82 , mpActiveEdit(nullptr)
88 , mxCheckIgnoreEmptyRows(m_xBuilder->weld_check_button(
"check-ignore-empty-rows"))
89 , mxCheckTotalColumns(m_xBuilder->weld_check_button(
"check-total-columns"))
90 , mxCheckAddFilter(m_xBuilder->weld_check_button(
"check-add-filter"))
91 , mxCheckIdentifyCategories(m_xBuilder->weld_check_button(
"check-identify-categories"))
92 , mxCheckTotalRows(m_xBuilder->weld_check_button(
"check-total-rows"))
93 , mxCheckDrillToDetail(m_xBuilder->weld_check_button(
"check-drill-to-details"))
94 , mxSourceRadioNamedRange(m_xBuilder->weld_radio_button(
"source-radio-named-range"))
95 , mxSourceRadioSelection(m_xBuilder->weld_radio_button(
"source-radio-selection"))
96 , mxSourceListBox(m_xBuilder->weld_combo_box(
"source-list"))
97 , mxSourceEdit(new
formula::RefEdit(m_xBuilder->weld_entry(
"source-edit")))
98 , mxSourceButton(new
formula::RefButton(m_xBuilder->weld_button(
"source-button")))
99 , mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button(
"destination-radio-new-sheet"))
100 , mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button(
"destination-radio-named-range"))
101 , mxDestinationRadioSelection(m_xBuilder->weld_radio_button(
"destination-radio-selection"))
102 , mxDestinationListBox(m_xBuilder->weld_combo_box(
"destination-list"))
103 , mxDestinationEdit(new
formula::RefEdit(m_xBuilder->weld_entry(
"destination-edit")))
104 , mxDestinationButton(new
formula::RefButton(m_xBuilder->weld_button(
"destination-button")))
105 , mxBtnOK(m_xBuilder->weld_button(
"ok"))
106 , mxBtnCancel(m_xBuilder->weld_button(
"cancel"))
107 , mxSourceFrame(m_xBuilder->weld_frame(
"frame2"))
108 , mxSourceLabel(mxSourceFrame->weld_label_widget())
109 , mxDestFrame(m_xBuilder->weld_frame(
"frame1"))
110 , mxDestLabel(mxDestFrame->weld_label_widget())
111 , mxOptions(m_xBuilder->weld_expander(
"options"))
112 , mxMore(m_xBuilder->weld_expander(
"more"))
168 if (pSaveData ==
nullptr)
197 OUString sSourceNamedRangeName;
227 bool bIsNamedRange =
false;
233 while (aIterator.
Next(aEachName, aEachRange))
238 if (aEachRange == aSourceRange)
240 sSourceNamedRangeName = aEachName;
241 bIsNamedRange =
true;
261 if (!bSourceBoxHasEntries)
276 while (aIterator.
Next(aName, aRange))
346 if (rReferenceRange.
aStart != rReferenceRange.
aEnd)
368 if (pItemValue ==
nullptr)
431 aSourceRange = lclGetRangeForNamedRange(aSourceString,
mrDocument);
470 bool bToNewSheet =
false;
478 sal_uInt16 nWhichPivot =
SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
479 ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
484 SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
486 nCallMode, { &aPivotItem });
488 if (pResult !=
nullptr)
491 if ( pOldDPObj !=
nullptr )
498 if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.
Contains( aDestinationRange ) )
528 mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
538 mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
543 mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
546 &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
553 for (std::unique_ptr<ScDPLabelData>
const & pLabelData : rLabelDataVector)
558 if (pSaveDimensions ==
nullptr)
564 pSaveDimensions->
SetSortInfo(&pLabelData->maSortInfo);
568 bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
590 aDestinationRange = lclGetRangeForNamedRange(aName,
mrDocument);
591 if (!aDestinationRange.
IsValid())
598 aDestinationRange =
ScRange(aAddress);
630 DoClose(ScPivotLayoutWrapper::GetChildWindowId());
653 mpActiveEdit = &rCtrl;
654 mpActiveEdit->SelectAll();
659 mpActiveEdit =
nullptr;
661 if (&rCtrl == mxSourceButton.get())
662 mpActiveEdit = mxSourceEdit.get();
663 else if (&rCtrl == mxDestinationButton.get())
664 mpActiveEdit = mxDestinationEdit.get();
667 mpActiveEdit->SelectAll();
672 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
677 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
bool Next(OUString &rName, ScRange &rRange)
#define LINK(Instance, Class, Member)
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
static SC_DLLPUBLIC OUString createDuplicateDimensionName(const OUString &rOriginal, size_t nDupCount)
std::unique_ptr< ScPivotLayoutTreeListData > mxListBoxData
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
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
ScDocShell * GetDocShell() const
std::unique_ptr< weld::CheckButton > mxCheckAddFilter
virtual bool IsRefInputMode() const override
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
void FillOldParam(ScPivotParam &rParam) const
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
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)
ScDPLabelData & GetLabelData(SCCOL nColumn)
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxPage
std::unique_ptr< sal_Int32[]> pData
std::unique_ptr< formula::RefEdit > mxSourceEdit
std::unique_ptr< ScPivotLayoutTreeListLabel > mxListBoxField
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
bool IsDataElement(SCCOL nColumn)
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
std::unique_ptr< weld::ComboBox > mxSourceListBox
void SetDispatcherLock(bool bLock)
std::unique_ptr< formula::RefButton > mxDestinationButton
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
std::unique_ptr< weld::Label > mxSourceLabel
SC_DLLPUBLIC void SetIsVisible(bool bSet)
void ApplyLabelData(const ScDPSaveData &rSaveData)
IMPL_LINK_NOARG(ScPivotLayoutDialog, OKClicked, weld::Button &, void)
std::unique_ptr< weld::RadioButton > mxDestinationRadioNewSheet
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
ScAddress::Details maAddressDetails
const ScRange & GetOutRange() const
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
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.
formula::RefEdit * mpActiveEdit
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
ScItemValue(OUString const &aName, SCCOL nColumn, PivotFunc nFunctionMask)
ScPivotParam maPivotParameters
ScTabViewShell * GetViewShell() const
virtual void Close() override
ScDPLabelDataVector maLabelArray
bool GetDrillDown() const
std::unique_ptr< weld::Button > mxBtnCancel
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
std::unique_ptr< weld::ComboBox > mxDestinationListBox
ScPivotFieldVector maColFields
std::unique_ptr< weld::CheckButton > mxCheckTotalRows
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
std::unique_ptr< weld::CheckButton > mxCheckIdentifyCategories
std::vector< ScPivotField > ScPivotFieldVector
std::unique_ptr< weld::CheckButton > mxCheckTotalColumns
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
virtual ~ScPivotLayoutDialog() override
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxColumn
void SetUsedHierarchy(tools::Long nNew)
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...
virtual void RefInputDone(bool bForced=false) override
ScDPSaveData * GetSaveData() const
void ApplySaveData(ScDPSaveData &rSaveData)
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
std::unique_ptr< weld::Button > mxBtnOK
SC_DLLPUBLIC void SetFilterButton(bool bSet)
SCCOL nCol
Cursor Position /.
std::unique_ptr< ScPivotLayoutTreeList > mxListBoxRow
bool GetFilterButton() const
void FillValuesToListBoxes()
ScDBFunc * GetView() const
SC_DLLPUBLIC void SetShowDetails(bool bSet)
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pNew)
IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::RefEdit &, rCtrl, void)
ScDPObject maPivotTableObject
SC_DLLPUBLIC void SetDrillDown(bool bSet)
ScItemValue * GetItem(SCCOL nColumn)
const ScAddress & GetAddress() const
virtual void SetReference(const ScRange &rReferenceRange, ScDocument &rDocument) override
SfxBindings & GetBindings() const
void SetRepeatItemLabels(bool bSet)
std::unique_ptr< weld::CheckButton > mxCheckIgnoreEmptyRows
std::unique_ptr< weld::Label > mxDestLabel
void ItemInserted(const ScItemValue *pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType)
SCROW nRow
or start of destination area
ScDPLabelDataVector & GetLabelDataVector()
const ScSheetSourceDesc * GetSheetDesc() const
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)
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::RadioButton > mxSourceRadioNamedRange
ScPivotFieldVector maRowFields
bool Contains(const ScAddress &) const
is Address& fully in Range?
void SetShowEmpty(bool bSet)
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
SC_DLLPUBLIC bool IsReference(ScRange &rRef) const
SfxDispatcher * GetDispatcher() const
SC_DLLPUBLIC void SetRowGrand(bool bSet)
std::unique_ptr< formula::RefButton > mxSourceButton
bool ConvertDoubleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
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)
ScPivotFieldVector maPageFields
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
bool DoClose(sal_uInt16 nId)
std::unique_ptr< formula::RefEdit > mxDestinationEdit
std::unique_ptr< weld::RadioButton > mxDestinationRadioSelection
This class contains authoritative information on the internal reference used as the data source for d...
std::unique_ptr< weld::CheckButton > mxCheckDrillToDetail
bool GetDestination(ScRange &aDestinationRange, bool &bToNewSheet)
void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pNew)
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo *pNew)
bool m_bDetectedRangeSegmentation false