LibreOffice Module sc (master) 1
dpresfilter.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#pragma once
11
12#include <rtl/ustring.hxx>
13#include "calcmacros.hxx"
14
15#include <memory>
16#include <map>
17#include <vector>
18#include <unordered_map>
19
20namespace com::sun::star::uno
21{
22template <typename> class Sequence;
23}
25{
26struct DataPilotFieldFilter;
27}
28
30{
31 OUString maDimName;
32 OUString maValueName;
33 OUString maValue;
34
35 bool mbHasValue : 1;
36 bool mbDataLayout : 1;
37
38 ScDPResultFilter(const OUString& rDimName, bool bDataLayout);
39};
40
56{
57public:
58 typedef std::vector<double> ValuesType;
59
60private:
61 struct MemberNode;
62 typedef std::map<OUString, std::shared_ptr<MemberNode>> MembersType;
63
65 {
68
69#if DEBUG_PIVOT_TABLE
70 void dump(int nLevel) const;
71#endif
72 };
73
75 {
77 std::map<OUString, DimensionNode> maChildDimensions;
78
79 MemberNode();
80 MemberNode(const MemberNode&) = delete;
81 const MemberNode& operator=(const MemberNode&) = delete;
83
84#if DEBUG_PIVOT_TABLE
85 void dump(int nLevel) const;
86#endif
87 };
88
89 typedef std::pair<OUString, OUString> NamePairType;
90
92 {
93 size_t operator()(const NamePairType& rPair) const;
94 };
95 typedef std::unordered_map<NamePairType, double, NamePairHash> LeafValuesType;
97
99 std::unique_ptr<MemberNode> mpRoot;
100
101public:
104 const ScDPResultTree& operator=(const ScDPResultTree&) = delete;
113 void add(const std::vector<ScDPResultFilter>& rFilter, double fVal);
114
115 void swap(ScDPResultTree& rOther);
116
117 bool empty() const;
118 void clear();
119
120 const ValuesType*
121 getResults(const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& rFilters) const;
122
123 double getLeafResult(const css::sheet::DataPilotFieldFilter& rFilter) const;
124
125#if DEBUG_PIVOT_TABLE
126 void dump() const;
127#endif
128};
129
131{
133 std::vector<ScDPResultFilter> maFilters;
134 sal_Int32 mnCol;
135 sal_Int32 mnRow;
136
138};
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class maintains pivot table calculation result in a tree structure which represents the logical ...
Definition: dpresfilter.hxx:56
std::map< OUString, std::shared_ptr< MemberNode > > MembersType
Definition: dpresfilter.hxx:61
void add(const std::vector< ScDPResultFilter > &rFilter, double fVal)
Add a single value filter path.
Definition: dpresfilter.cxx:82
const ScDPResultTree & operator=(const ScDPResultTree &)=delete
OUString maPrimaryDimName
Definition: dpresfilter.hxx:98
std::unique_ptr< MemberNode > mpRoot
Definition: dpresfilter.hxx:99
ScDPResultTree(const ScDPResultTree &)=delete
double getLeafResult(const css::sheet::DataPilotFieldFilter &rFilter) const
std::vector< double > ValuesType
Definition: dpresfilter.hxx:58
std::unordered_map< NamePairType, double, NamePairHash > LeafValuesType
Definition: dpresfilter.hxx:95
bool empty() const
LeafValuesType maLeafValues
Definition: dpresfilter.hxx:96
const ValuesType * getResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters) const
void swap(ScDPResultTree &rOther)
std::pair< OUString, OUString > NamePairType
Definition: dpresfilter.hxx:89
VCL_DLLPUBLIC void dump(const SkBitmap &bitmap, const char *file)
std::vector< ScDPResultFilter > maFilters
ScDPResultTree maFilterSet
ScDPResultFilter(const OUString &rDimName, bool bDataLayout)
Definition: dpresfilter.cxx:24
OUString maDimName
Definition: dpresfilter.hxx:31
OUString maValueName
Definition: dpresfilter.hxx:32
std::map< OUString, DimensionNode > maChildDimensions
Definition: dpresfilter.hxx:77
MemberNode(const MemberNode &)=delete
const MemberNode & operator=(const MemberNode &)=delete
size_t operator()(const NamePairType &rPair) const
Definition: dpresfilter.cxx:30