28#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
31using namespace css::uno;
32using namespace css::sheet;
36 maFunctionData(nColumn, nFunctionMask),
37 mpOriginalItemValue(this)
42 maFunctionData(pInputItemValue->maFunctionData),
43 mpOriginalItemValue(this)
52ScRange lclGetRangeForNamedRange(OUString
const & aName,
const ScDocument& rDocument)
56 if (pRangeName ==
nullptr)
64 if (
pData->IsReference(aRange))
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)
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())
168 if (pSaveData ==
nullptr)
199 OUString sSourceNamedRangeName;
229 bool bIsNamedRange =
false;
235 while (aIterator.
Next(aEachName, aEachRange))
240 if (aEachRange == aSourceRange)
242 sSourceNamedRangeName = aEachName;
243 bIsNamedRange =
true;
263 if (!bSourceBoxHasEntries)
348 if (rReferenceRange.
aStart != rReferenceRange.
aEnd)
370 if (pItemValue ==
nullptr)
433 aSourceRange = lclGetRangeForNamedRange(aSourceString,
mrDocument);
472 bool bToNewSheet =
false;
480 sal_uInt16 nWhichPivot =
SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
481 ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
486 SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
488 nCallMode, { &aPivotItem });
490 if (pResult !=
nullptr)
493 if ( pOldDPObj !=
nullptr )
500 if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.
Contains( aDestinationRange ) )
531 mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
541 mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
546 mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
549 &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
556 for (std::unique_ptr<ScDPLabelData>
const & pLabelData : rLabelDataVector)
561 if (pSaveDimensions ==
nullptr)
567 pSaveDimensions->
SetSortInfo(&pLabelData->maSortInfo);
571 bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
594 if (!aDestinationRange.
IsValid())
601 aDestinationRange =
ScRange(aAddress);
633 DoClose(ScPivotLayoutWrapper::GetChildWindowId());
656 mpActiveEdit = &rCtrl;
657 mpActiveEdit->SelectAll();
662 mpActiveEdit =
nullptr;
664 if (&rCtrl == mxSourceButton.get())
665 mpActiveEdit = mxSourceEdit.get();
666 else if (&rCtrl == mxDestinationButton.get())
667 mpActiveEdit = mxDestinationEdit.get();
670 mpActiveEdit->SelectAll();
675 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
680 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
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)
Reference< XExecutableDialog > m_xDialog
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
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)
bool Next(OUString &rName, ScRange &rRange)
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
const ScRange & GetOutRange() const
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
const ScSheetSourceDesc * GetSheetDesc() const
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)
void FillOldParam(ScPivotParam &rParam) const
ScDPSaveData * GetSaveData() const
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
bool GetDrillDown() const
SC_DLLPUBLIC void SetExpandCollapse(bool bSet)
bool GetFilterButton() const
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
SC_DLLPUBLIC void SetFilterButton(bool bSet)
bool GetExpandCollapse() const
SC_DLLPUBLIC void SetRowGrand(bool bSet)
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
SC_DLLPUBLIC void SetDrillDown(bool bSet)
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pNew)
void SetRepeatItemLabels(bool bSet)
void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pNew)
void SetUsedHierarchy(tools::Long nNew)
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo *pNew)
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
void SetShowEmpty(bool bSet)
SC_DLLPUBLIC void SetIsVisible(bool bSet)
SC_DLLPUBLIC void SetShowDetails(bool bSet)
static SC_DLLPUBLIC OUString createDuplicateDimensionName(const OUString &rOriginal, size_t nDupCount)
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
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
void FillValuesToListBoxes()
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
ScDPObject maPivotTableObject
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)
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...
bool Contains(const ScAddress &) const
is Address& fully in Range?
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)
const ScAddress & GetAddress() const
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
virtual void RefInputDone(bool bForced=false) override
bool DoClose(sal_uInt16 nId)
void SetDispatcherLock(bool bLock)
This class contains authoritative information on the internal reference used as the data source for d...
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
ScDocShell * GetDocShell() const
ScTabViewShell * GetViewShell() const
ScDBFunc * GetView() const
SfxDispatcher * GetDispatcher() 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 * >())
SfxBindings & GetBindings() const
#define LINK(Instance, Class, Member)
std::unique_ptr< sal_Int32[]> pData
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
std::vector< ScPivotField > ScPivotFieldVector
ScDPLabelDataVector maLabelArray
ScPivotFieldVector maDataFields
ScPivotFieldVector maRowFields
SCCOL nCol
Cursor Position /.
SCROW nRow
or start of destination area
ScPivotFieldVector maColFields
ScPivotFieldVector maPageFields