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 , 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())
167 if (pSaveData ==
nullptr)
196 OUString sSourceNamedRangeName;
226 bool bIsNamedRange =
false;
232 while (aIterator.
Next(aEachName, aEachRange))
237 if (aEachRange == aSourceRange)
239 sSourceNamedRangeName = aEachName;
240 bIsNamedRange =
true;
260 if (!bSourceBoxHasEntries)
345 if (rReferenceRange.
aStart != rReferenceRange.
aEnd)
367 if (pItemValue ==
nullptr)
430 aSourceRange = lclGetRangeForNamedRange(aSourceString,
mrDocument);
469 bool bToNewSheet =
false;
477 sal_uInt16 nWhichPivot =
SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE);
478 ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet);
483 SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD;
485 nCallMode, { &aPivotItem });
487 if (pResult !=
nullptr)
490 if ( pOldDPObj !=
nullptr )
497 if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.
Contains( aDestinationRange ) )
527 mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
537 mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
542 mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
545 &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
552 for (std::unique_ptr<ScDPLabelData>
const & pLabelData : rLabelDataVector)
557 if (pSaveDimensions ==
nullptr)
563 pSaveDimensions->
SetSortInfo(&pLabelData->maSortInfo);
567 bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
590 if (!aDestinationRange.
IsValid())
597 aDestinationRange =
ScRange(aAddress);
629 DoClose(ScPivotLayoutWrapper::GetChildWindowId());
652 mpActiveEdit = &rCtrl;
653 mpActiveEdit->SelectAll();
658 mpActiveEdit =
nullptr;
660 if (&rCtrl == mxSourceButton.get())
661 mpActiveEdit = mxSourceEdit.get();
662 else if (&rCtrl == mxDestinationButton.get())
663 mpActiveEdit = mxDestinationEdit.get();
666 mpActiveEdit->SelectAll();
671 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
676 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
bool GetFilterButton() const
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
SC_DLLPUBLIC void SetFilterButton(bool bSet)
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< 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