17#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
18#include <com/sun/star/uno/Sequence.hxx>
26 maDimName(
std::move(aDimName)), mbHasValue(false), mbDataLayout(bDataLayout) {}
40void ScDPResultTree::DimensionNode::dump(
int nLevel)
const
42 string aIndent(nLevel*2,
' ');
43 MembersType::const_iterator it = maChildMembersValueNames.begin(), itEnd = maChildMembersValueNames.end();
44 for (; it != itEnd; ++it)
46 cout << aIndent <<
"member: ";
54 it->second->dump(nLevel+1);
64void ScDPResultTree::MemberNode::dump(
int nLevel)
const
66 string aIndent(nLevel*2,
' ');
67 for (
const auto& rValue : maValues)
68 cout << aIndent <<
"value: " << rValue <<
endl;
70 for (
const auto& [rName, rxDim] : maChildDimensions)
72 cout << aIndent <<
"dimension: " << rName <<
endl;
73 rxDim->dump(nLevel+1);
84 const std::vector<ScDPResultFilter>& rFilters,
double fVal)
88 const OUString* pDimName =
nullptr;
89 const OUString* pMemName =
nullptr;
103 auto itDim = rDims.find(aUpperName);
104 if (itDim == rDims.end())
112 pDimName = &itDim->first;
118 MembersType::iterator itMem = rMembersValueNames.find(aUpperName);
119 if (itMem == rMembersValueNames.end())
122 auto pNode = std::make_shared<MemberNode>();
123 std::pair<MembersType::iterator, bool> r =
124 rMembersValueNames.emplace(aUpperName, pNode);
138 MembersType::iterator itMemVal = rMembersValues.find(aUpperName);
139 if (itMemVal == rMembersValues.end())
142 std::pair<MembersType::iterator, bool> it =
143 rMembersValues.emplace(aUpperName, pNode);
145 SAL_WARN_IF( !it.second,
"sc.core",
"ScDPResultTree::add - rMembersValues.insert failed");
150 pMemName = &itMem->first;
151 pMemNode = itMem->second.get();
154 if (pDimName && pMemName)
160 LeafValuesType::iterator it =
maLeafValues.find(aNames);
169 it->second = std::numeric_limits<double>::quiet_NaN();
185 return mpRoot->maChildDimensions.empty();
195 const uno::Sequence<sheet::DataPilotFieldFilter>& rFilters)
const
198 for (
const sheet::DataPilotFieldFilter& rFilter : rFilters)
221 pMember = itMem->second.get();
237 if (!pFieldMember->
maValues.empty())
251 LeafValuesType::const_iterator it =
maLeafValues.find(aPair);
257 return std::numeric_limits<double>::quiet_NaN();
261void ScDPResultTree::dump()
const
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
OUString GetString() const
This class maintains pivot table calculation result in a tree structure which represents the logical ...
std::map< OUString, std::shared_ptr< MemberNode > > MembersType
void add(const std::vector< ScDPResultFilter > &rFilter, double fVal)
Add a single value filter path.
OUString maPrimaryDimName
std::unique_ptr< MemberNode > mpRoot
double getLeafResult(const css::sheet::DataPilotFieldFilter &rFilter) const
std::vector< double > ValuesType
LeafValuesType maLeafValues
const ValuesType * getResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters) const
void swap(ScDPResultTree &rOther)
std::pair< OUString, OUString > NamePairType
static SC_DLLPUBLIC const CharClass & getCharClass()
#define SAL_WARN_IF(condition, area, stream)
std::enable_if_t<(sizeof(N)==4)> hash_combine(N &nSeed, T const *pValue, size_t nCount)
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
ScDPResultFilterContext()
ScDPResultFilter(OUString aDimName, bool bDataLayout)
MembersType maChildMembersValueNames
MembersType maChildMembersValues
std::map< OUString, DimensionNode > maChildDimensions
size_t operator()(const NamePairType &rPair) const