26OUString lclGetFunctionMaskName(
const PivotFunc nFunctionMask)
29 switch (nFunctionMask)
53OUString lclCreateDataItemName(
const PivotFunc nFunctionMask, std::u16string_view rName,
const sal_uInt8 nDuplicationCount)
55 OUString
aBuffer = lclGetFunctionMaskName(nFunctionMask) +
" - " + rName;
56 if(nDuplicationCount > 0)
58 aBuffer +=
" " + OUString::number(nDuplicationCount);
83 int nEntry = mxControl->get_cursor_index();
87 ScItemValue* pCurrentItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(nEntry));
90 SCCOL nCurrentColumn = rCurrentFunctionData.
mnCol;
97 mpFunctionDlg->StartExecuteAsync([
this, pCurrentItemValue, nEntry](
int nResult)
mutable {
101 rFunctionData.
mnFuncMask = mpFunctionDlg->GetFuncMask();
103 rLabelData.
mnFuncMask = mpFunctionDlg->GetFuncMask();
105 rFunctionData.
maFieldRef = mpFunctionDlg->GetFieldRef();
109 AdjustDuplicateCount(pCurrentItemValue);
111 OUString sDataItemName = lclCreateDataItemName(
116 mxControl->set_text(nEntry, sDataItemName);
119 mpFunctionDlg->disposeOnce();
136 if (rField.mnOriginalDim >= 0)
137 nColumn = rField.mnOriginalDim;
139 nColumn = rField.nCol;
161 std::unique_ptr<weld::TreeIter> xLoopEntry(
mxControl->make_iterator());
162 if (!
mxControl->get_iter_first(*xLoopEntry))
172 if (rLabelData.
maName.isEmpty())
176 if (sLayoutName.isEmpty())
178 sLayoutName = lclCreateDataItemName(
184 rDataFieldNames.emplace_back(rLabelData.
maName, sLayoutName, rLabelData.
mnDupCount);
185 }
while (
mxControl->iter_next(*xLoopEntry));
200 OUString sText =
mxControl->get_selected_text();
203 mxControl->insert(
nullptr, nTarget, &sText, &
sId,
nullptr,
nullptr,
false,
nullptr);
227 OUString sDataName = lclCreateDataItemName(
233 mxControl->insert(
nullptr, nPosition, &sDataName, &
sId,
nullptr,
nullptr,
false,
nullptr);
240 bool bFoundDuplicate =
false;
245 std::unique_ptr<weld::TreeIter> xEachEntry(
mxControl->make_iterator());
246 if (!
mxControl->get_iter_first(*xEachEntry))
251 if (pItemValue == pInputItemValue)
256 if (rFunctionData.
mnCol == rInputFunctionData.
mnCol &&
259 bFoundDuplicate =
true;
260 if(rFunctionData.
mnDupCount > nMaxDuplicateCount)
261 nMaxDuplicateCount = rFunctionData.
mnDupCount;
263 }
while (
mxControl->iter_next(*xEachEntry));
267 rInputFunctionData.
mnDupCount = nMaxDuplicateCount + 1;
274 sal_uInt16 nCode = aCode.
GetCode();
278 int nEntry = mxControl->get_cursor_index();
280 mxControl->remove(nEntry);
IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView &, bool)
IMPL_LINK(ScPivotLayoutTreeListData, KeyInputHdl, const KeyEvent &, rKeyEvent, bool)
virtual VclPtr< AbstractScDPFunctionDlg > CreateScDPFunctionDlg(weld::Widget *pParent, const ScDPLabelDataVector &rLabelVec, const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
ScPivotFuncData maFunctionData
ScItemValue * mpOriginalItemValue
ScDPLabelData & GetLabelData(SCCOL nColumn)
bool IsDataElement(SCCOL nColumn)
ScItemValue * GetItem(SCCOL nColumn)
std::unique_ptr< weld::TreeView > mxControl
ScPivotLayoutDialog * mpParent
virtual void InsertEntryForSourceTarget(weld::TreeView &rSource, int nTarget) override
void FillDataField(ScPivotFieldVector &rDataFields)
void AdjustDuplicateCount(ScItemValue *pInputItemValue)
VclPtr< AbstractScDPFunctionDlg > mpFunctionDlg
ScPivotLayoutTreeListData(std::unique_ptr< weld::TreeView > xControl)
void PushDataFieldNames(std::vector< ScDPName > &rDataFieldNames)
std::vector< std::unique_ptr< ScItemValue > > maDataItemValues
virtual ~ScPivotLayoutTreeListData() override
void InsertEntryForItem(ScItemValue *pItemValue, int nPosition)
sal_uInt16 GetCode() const
virtual int count_selected_rows() const=0
virtual OUString get_selected_id() const=0
RegionData_Impl * mpParent
constexpr sal_uInt16 KEY_DELETE
#define LINK(Instance, Class, Member)
OUString toId(const void *pValue)
std::vector< ScPivotField > ScPivotFieldVector
OUString ScResId(TranslateId aId)
OUString maName
Original name of the dimension.
OUString maLayoutName
Layout name (display name)
PivotFunc mnFuncMask
Page/Column/Row subtotal function.
css::sheet::DataPilotFieldReference maFieldRef
tools::Long mnOriginalDim
std::unique_ptr< char[]> aBuffer