LibreOffice Module sc (master)  1
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
ScDPResultTree Class Reference

This class maintains pivot table calculation result in a tree structure which represents the logical structure of pivot table result layout as presented in the sheet. More...

#include <dpresfilter.hxx>


struct  DimensionNode
struct  MemberNode
struct  NamePairHash

Public Types

typedef std::vector< double > ValuesType

Public Member Functions

 ScDPResultTree ()
 ScDPResultTree (const ScDPResultTree &)=delete
const ScDPResultTreeoperator= (const ScDPResultTree &)=delete
 ~ScDPResultTree ()
void add (const std::vector< ScDPResultFilter > &rFilter, double fVal)
 Add a single value filter path. More...
void swap (ScDPResultTree &rOther)
bool empty () const
void clear ()
const ValuesTypegetResults (const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters) const
double getLeafResult (const css::sheet::DataPilotFieldFilter &rFilter) const

Private Types

typedef std::map< OUString, std::shared_ptr< MemberNode > > MembersType
typedef std::pair< OUString, OUString > NamePairType
typedef std::unordered_map< NamePairType, double, NamePairHashLeafValuesType

Private Attributes

LeafValuesType maLeafValues
OUString maPrimaryDimName
std::unique_ptr< MemberNodempRoot

Detailed Description

This class maintains pivot table calculation result in a tree structure which represents the logical structure of pivot table result layout as presented in the sheet.

The root node has two child nodes if the pivot table consists of both column and row dimensions. The first child stores the result tree that is first filtered by row dimensions then by column dimensions. The second child stores the result tree that is filtered by column dimensions only (for column grand totals).

If the pivot table layout only consists of either column or row dimensions, the root node only has one child node.

Definition at line 50 of file dpresfilter.hxx.

Member Typedef Documentation

typedef std::unordered_map<NamePairType, double, NamePairHash> ScDPResultTree::LeafValuesType

Definition at line 96 of file dpresfilter.hxx.

typedef std::map<OUString, std::shared_ptr<MemberNode> > ScDPResultTree::MembersType

Definition at line 57 of file dpresfilter.hxx.

typedef std::pair<OUString, OUString> ScDPResultTree::NamePairType

Definition at line 90 of file dpresfilter.hxx.

typedef std::vector<double> ScDPResultTree::ValuesType

Definition at line 53 of file dpresfilter.hxx.

Constructor & Destructor Documentation

ScDPResultTree::ScDPResultTree ( )

Definition at line 83 of file dpresfilter.cxx.

ScDPResultTree::ScDPResultTree ( const ScDPResultTree )
ScDPResultTree::~ScDPResultTree ( )

Definition at line 84 of file dpresfilter.cxx.

Member Function Documentation

void ScDPResultTree::add ( const std::vector< ScDPResultFilter > &  rFilter,
double  fVal 

Add a single value filter path.

The filters are expected to be sorted by row dimension order then by column dimension order.

rFilterset of filters.
fValresult value, as displayed in the table output.

Definition at line 88 of file dpresfilter.cxx.

References assert(), ScGlobal::getCharClassPtr(), ScDPResultTree::MemberNode::maChildDimensions, ScDPResultTree::DimensionNode::maChildMembersValueNames, ScDPResultTree::DimensionNode::maChildMembersValues, maLeafValues, maPrimaryDimName, ScDPResultTree::MemberNode::maValues, mpRoot, SAL_WARN_IF, and CharClass::uppercase().

Referenced by ScDPDataMember::FillDataRow().

void ScDPResultTree::clear ( )

Definition at line 193 of file dpresfilter.cxx.

References EMPTY_OUSTRING, maPrimaryDimName, and mpRoot.

Referenced by ScDPSource::disposeData().

bool ScDPResultTree::empty ( ) const

Definition at line 188 of file dpresfilter.cxx.

References mpRoot.

Referenced by ScDPSource::getFilteredResults().

double ScDPResultTree::getLeafResult ( const css::sheet::DataPilotFieldFilter &  rFilter) const
const ScDPResultTree::ValuesType * ScDPResultTree::getResults ( const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &  rFilters) const
const ScDPResultTree& ScDPResultTree::operator= ( const ScDPResultTree )
void ScDPResultTree::swap ( ScDPResultTree rOther)

Definition at line 181 of file dpresfilter.cxx.

References maLeafValues, maPrimaryDimName, and mpRoot.

Referenced by ScDPSource::getResults().

Member Data Documentation

LeafValuesType ScDPResultTree::maLeafValues

Definition at line 97 of file dpresfilter.hxx.

Referenced by add(), getLeafResult(), and swap().

OUString ScDPResultTree::maPrimaryDimName

Definition at line 99 of file dpresfilter.hxx.

Referenced by add(), clear(), and swap().

std::unique_ptr<MemberNode> ScDPResultTree::mpRoot

Definition at line 100 of file dpresfilter.hxx.

Referenced by add(), clear(), empty(), getResults(), and swap().

The documentation for this class was generated from the following files: