LibreOffice Module sc (master) 1
dptabres.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include "global.hxx"
23#include "dpfilteredcache.hxx"
24#include "calcmacros.hxx"
25#include "dpitemdata.hxx"
26#include "subtotal.hxx"
27
28#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29#include <com/sun/star/sheet/DataPilotFieldReference.hpp>
30
31#include <map>
32#include <unordered_map>
33#include <unordered_set>
34#include <memory>
35#include <vector>
36
37namespace com::sun::star::sheet { struct DataResult; }
38namespace com::sun::star::sheet { struct MemberResult; }
39namespace com::sun::star::uno { template <typename > class Sequence; }
40
41class ScDPSource;
42class ScDPDimension;
43class ScDPLevel;
44class ScDPMember;
47
48struct ScDPValue;
50
56{
57public:
58 struct Member
59 {
62
63 Member(tools::Long nSrcIndex, SCROW nNameIndex);
64 };
65
66 void AddMember(tools::Long nSourceIndex, SCROW nMember);
67 void RemoveMember();
68
69 const std::vector<Member>& GetMembers() const { return maMembers; }
70
71private:
72 std::vector<Member> maMembers;
73};
74
75typedef ::std::vector<sal_Int32> ScMemberSortOrder;
76
81{
86
90 nColSubTotalFunc( -1 ),
92 {}
93};
94
105{
106public:
107 typedef std::vector<sal_Int32> IndexArray;
108
110
113
114 const IndexArray& GetColVisible() const { return maColVisible;}
115 const IndexArray& GetColSorted() const { return maColSorted;}
116 const IndexArray& GetRowVisible() const { return maRowVisible;}
117 const IndexArray& GetRowSorted() const { return maRowSorted;}
118
119 void AddColIndex( sal_Int32 nVisible, tools::Long nSorted );
120 void AddRowIndex( sal_Int32 nVisible, tools::Long nSorted );
121 void RemoveColIndex();
122 void RemoveRowIndex();
123
124private:
127
132};
133
135{
136 tools::Long nBasePos; // simple count, without sort order applied
138
140};
141
142// aggregated data
144
145// Possible values for the nCount member:
146// (greater than 0 counts the collected values)
147const sal_Int64 SC_DPAGG_EMPTY = 0; // empty during data collection
148const sal_Int64 SC_DPAGG_DATA_ERROR = -1; // error during data collection
149const sal_Int64 SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated
150const sal_Int64 SC_DPAGG_RESULT_VALID = -3; // valid result calculated
151const sal_Int64 SC_DPAGG_RESULT_ERROR = -4; // error in calculated result
152
154{
155private:
157 double fVal;
158 double fAux;
159 sal_Int64 nCount;
160 std::unique_ptr<ScDPAggData> pChild;
161 std::vector<double> mSortedValues;
162
163public:
165
166 void Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
167 void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
168 bool IsCalculated() const;
169
170 double GetResult() const;
171 bool HasError() const;
172 bool HasData() const;
173
174 void SetResult( double fNew );
175 void SetEmpty( bool bSet );
176 void SetError();
177
178 double GetAuxiliary() const;
179 void SetAuxiliary( double fNew );
180
181 void Reset(); // also deletes children
182
183 const ScDPAggData* GetExistingChild() const { return pChild.get(); }
185
186#if DUMP_PIVOT_TABLE
187 void Dump(int nIndent) const;
188#endif
189};
190
191// Row and grand total state, passed down (column total is at result member)
192
194{
198
199public:
202
205
206 bool IsInColRoot() const { return bIsInColRoot; }
207 void SetInColRoot(bool bSet) { bIsInColRoot = bSet; }
208};
209
210// results for a hierarchy dimension
211
214class ScDPDataMember;
215
216#define SC_DPMEASURE_ALL -1
217#define SC_DPMEASURE_ANY -2
218
220{
225
227 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
228};
229
230class ResultMembers final
231{
232 std::unordered_map<SCROW, ScDPParentDimData> maMemberHash;
234public:
235 const ScDPParentDimData* FindMember( SCROW nIndex ) const;
236 void InsertMember( ScDPParentDimData const & rNew );
241};
242
244{
245private:
246 const ::std::vector<ScDPDimension*>& mppDim;
247 const ::std::vector<ScDPLevel*>& mppLev;
248
249 bool mbRow:1;
252public:
253 LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
254 bool bRow);
255
256 void SetInitChild( bool b ) { mbInitChild = b; }
257 void SetInitAllChildren( bool b ) { mbAllChildren = b; }
258
259 ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
260 ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
261
262 bool GetInitChild() const {return mbInitChild; }
263 bool GetInitAllChild() const { return mbAllChildren; }
264 bool IsRow() const { return mbRow; }
265 bool IsEnd( size_t nPos ) const ;
266};
267
272{
275
276 std::vector<ScSubTotalFunc> maMeasureFuncs;
277 std::vector<css::sheet::DataPilotFieldReference> maMeasureRefs;
278 std::vector<css::sheet::DataPilotFieldOrientation> maMeasureRefOrients;
279 std::vector<OUString> maMeasureNames;
280
281 bool bLateInit:1;
284
286 mutable std::vector<std::unique_ptr<ResultMembers>> maDimMembers;
287public:
288 ScDPResultData( ScDPSource& rSrc );
290
291 void SetMeasureData(
292 std::vector<ScSubTotalFunc>& rFunctions,
293 std::vector<css::sheet::DataPilotFieldReference>& rRefs,
294 std::vector<css::sheet::DataPilotFieldOrientation>& rRefOrient,
295 std::vector<OUString>& rNames );
296
297 void SetDataLayoutOrientation( css::sheet::DataPilotFieldOrientation nOrient );
298 void SetLateInit( bool bSet );
299
300 tools::Long GetMeasureCount() const { return maMeasureFuncs.size(); }
302 OUString GetMeasureString(tools::Long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const;
303 OUString GetMeasureDimensionName(tools::Long nMeasure) const;
304 const css::sheet::DataPilotFieldReference& GetMeasureRefVal(tools::Long nMeasure) const;
305 css::sheet::DataPilotFieldOrientation GetMeasureRefOrient(tools::Long nMeasure) const;
306
307 bool IsLateInit() const { return bLateInit; }
308
311
312 tools::Long GetCountForMeasure( tools::Long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
313
314 bool IsBaseForGroup( tools::Long nDim ) const; // any group
315 tools::Long GetGroupBase( tools::Long nGroupDim ) const;
316 bool IsNumOrDateGroup( tools::Long nDim ) const;
317 bool IsInGroup( SCROW nGroupDataId, tools::Long nGroupIndex,
318 const ScDPItemData& rBaseData, tools::Long nBaseIndex ) const;
319 bool HasCommonElement( SCROW nFirstDataId, tools::Long nFirstIndex,
320 const ScDPItemData& rSecondData, tools::Long nSecondIndex ) const;
321
322 ResultMembers& GetDimResultMembers(tools::Long nDim, const ScDPDimension* pDim, ScDPLevel* pLevel) const;
323
324 const ScDPSource& GetSource() const { return mrSource;}
325};
326
328{
329private:
332 std::unique_ptr<ScDPResultDimension> pChildDimension;
333 std::unique_ptr<ScDPDataMember> pDataRoot;
339 ScDPAggData aColTotal; // to store column totals
340
341 sal_uInt16 nMemberStep; // step to show details
342public:
344 const ScDPResultData* pData, const ScDPParentDimData& rParentDimData );
345 ScDPResultMember( const ScDPResultData* pData, bool bForceSub );
347
348 void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
349 const ::std::vector<ScDPLevel*>& ppLev,
350 size_t nPos,
351 ScDPInitState& rInitState,
352 bool bInitChild = true );
353 void LateInitFrom(
354 LateInitParams& rParams,
355 const ::std::vector< SCROW >& pItemData,
356 size_t nPos,
357 ScDPInitState& rInitState);
358 void CheckShowEmpty( bool bShow = false );
359 OUString GetName() const;
360 OUString GetDisplayName( bool bLocaleIndependent ) const;
361
363 bool IsValid() const;
364 bool IsVisible() const;
365 tools::Long GetSize(tools::Long nMeasure) const;
366 // bHasHiddenDetails is set only if the "show details" flag is off,
367 // and there was a child dimension to skip
368 bool HasHiddenDetails() const { return bHasHiddenDetails; }
369 bool IsSubTotalInTitle(tools::Long nMeasure) const;
370
371 tools::Long GetSubTotalCount( tools::Long* pUserSubStart = nullptr ) const;
372
373 bool IsNamedItem( SCROW nIndex ) const;
374 bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
375
376 void SetHasElements() { bHasElements = true; }
377 void SetAutoHidden() { bAutoHidden = true; }
378
379 void ProcessData( const ::std::vector<SCROW>& aChildMembers,
380 const ScDPResultDimension* pDataDim,
381 const ::std::vector<SCROW>& aDataMembers,
382 const ::std::vector<ScDPValue>& aValues );
384 css::uno::Sequence< css::sheet::MemberResult>* pSequences,
385 tools::Long& rPos, tools::Long nMeasure, bool bRoot, const OUString* pMemberName, const OUString* pMemberCaption );
386
387 void FillDataResults(
388 const ScDPResultMember* pRefMember,
389 ScDPResultFilterContext& rFilterCxt,
390 css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> >& rSequence,
391 tools::Long nMeasure) const;
392
393 void UpdateDataResults( const ScDPResultMember* pRefMember, tools::Long nMeasure ) const;
394 void UpdateRunningTotals( const ScDPResultMember* pRefMember, tools::Long nMeasure,
395 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
396
397 void SortMembers( ScDPResultMember* pRefMember );
398 void DoAutoShow( ScDPResultMember* pRefMember );
399
400 void ResetResults();
401
402#if DUMP_PIVOT_TABLE
403 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
404
405 void Dump(int nIndent) const;
406#endif
407
411
412 ScDPDataMember* GetDataRoot() const { return pDataRoot.get(); }
413
418 bool IsRoot() const { return GetParentLevel() == nullptr; }
419 SCROW GetDataId( ) const ;
420 ScDPAggData* GetColTotal( tools::Long nMeasure ) const;
421
423};
424
426{
427private:
430 std::unique_ptr<ScDPDataDimension>
433
434 void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
435
436public:
437 ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
439
440 void InitFrom( const ScDPResultDimension* pDim );
441
442 OUString GetName() const;
443 bool IsVisible() const;
444 bool HasData( tools::Long nMeasure, const ScDPSubTotalState& rSubState ) const;
445
446 bool IsNamedItem( SCROW nRow ) const;
447 bool HasHiddenDetails() const;
448
449 void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
450 const ScDPSubTotalState& rSubState );
451 bool HasError( tools::Long nMeasure, const ScDPSubTotalState& rSubState ) const;
452 double GetAggregate( tools::Long nMeasure, const ScDPSubTotalState& rSubState ) const;
453 const ScDPAggData* GetConstAggData( tools::Long nMeasure, const ScDPSubTotalState& rSubState ) const;
454 ScDPAggData* GetAggData( tools::Long nMeasure, const ScDPSubTotalState& rSubState );
455
456 void FillDataRow(
457 const ScDPResultMember* pRefMember,
458 ScDPResultFilterContext& rFilterCxt,
459 css::uno::Sequence<css::sheet::DataResult>& rSequence,
460 tools::Long nMeasure, bool bIsSubTotalRow,
461 const ScDPSubTotalState& rSubState) const;
462
463 void UpdateDataRow( const ScDPResultMember* pRefMember, tools::Long nMeasure, bool bIsSubTotalRow,
464 const ScDPSubTotalState& rSubState );
465 void UpdateRunningTotals( const ScDPResultMember* pRefMember, tools::Long nMeasure, bool bIsSubTotalRow,
466 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
467 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent );
468
469 void SortMembers( ScDPResultMember* pRefMember );
470 void DoAutoShow( ScDPResultMember* pRefMember );
471
472 void ResetResults();
473
474#if DUMP_PIVOT_TABLE
475 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
476 void Dump(int nIndent) const;
477#endif
478
480 const ScDPDataDimension* GetChildDimension() const { return pChildDimension.get(); }
482};
483
484// result dimension contains only members
485
487{
488public:
489 typedef std::vector<std::unique_ptr<ScDPResultMember>> MemberArray;
490 typedef std::map<SCROW, ScDPResultMember*> MemberHash;
491private:
495 OUString aDimensionName;
497 ScMemberSortOrder aMemberOrder; // used when sorted by measure
501 bool bAutoShow:1;
506
507 ScDPResultMember* FindMember( SCROW iData ) const;
509 ScDPResultMember* InsertMember( const ScDPParentDimData* pMemberData );
510 void InitWithMembers( LateInitParams& rParams,
511 const ::std::vector< SCROW >& pItemData,
512 size_t nPos,
513 ScDPInitState& rInitState );
514public:
515 ScDPResultDimension( const ScDPResultData* pData );
517
518 // allocates new members
519 void InitFrom(
520 const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
521 size_t nPos, ScDPInitState& rInitState, bool bInitChild = true );
522 void LateInitFrom( LateInitParams& rParams,
523 const ::std::vector< SCROW >& pItemData,
524 size_t nPos,
525 ScDPInitState& rInitState );
526 void CheckShowEmpty( bool bShow = false );
527
528 tools::Long GetSize(tools::Long nMeasure) const;
529
530 bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
531
532 // modifies existing members, allocates data dimensions
533 void ProcessData( const ::std::vector<SCROW>& aMembers,
534 const ScDPResultDimension* pDataDim,
535 const ::std::vector<SCROW>& aDataMembers,
536 const ::std::vector<ScDPValue>& aValues ) const;
537 void FillMemberResults( css::uno::Sequence<
538 css::sheet::MemberResult>* pSequences,
539 tools::Long nStart, tools::Long nMeasure );
540
541 void FillDataResults(
542 const ScDPResultMember* pRefMember,
543 ScDPResultFilterContext& rFilterCxt,
544 css::uno::Sequence<
545 css::uno::Sequence<
546 css::sheet::DataResult> >& rSequence,
547 tools::Long nMeasure) const;
548
549 void UpdateDataResults( const ScDPResultMember* pRefMember, tools::Long nMeasure ) const;
550 void UpdateRunningTotals( const ScDPResultMember* pRefMember, tools::Long nMeasure,
551 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
552
553 void SortMembers( ScDPResultMember* pRefMember );
554 tools::Long GetSortedIndex( tools::Long nUnsorted ) const;
555
556 void DoAutoShow( ScDPResultMember* pRefMember );
557
558 void ResetResults();
559
560 // called for the reference dimension
562 const ScDPRelativePos* pMemberPos, const OUString* pName,
563 const sal_Int32* pRowIndexes, const sal_Int32* pColIndexes ) const;
564
565 // uses row root member from ScDPRunningTotalState
567 const ScDPRelativePos* pMemberPos, const OUString* pName,
568 sal_Int32 nRefDimPos, const ScDPRunningTotalState& rRunning );
569
570#if DUMP_PIVOT_TABLE
571 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
572 void Dump(int nIndent) const;
573#endif
574
575 // for ScDPDataDimension::InitFrom
577 const ScDPResultMember* GetMember(tools::Long n) const;
579
582
583 bool IsDataLayout() const { return bIsDataLayout; }
584 const OUString& GetName() const { return aDimensionName; }
585
586 bool IsSortByData() const { return bSortByData; }
587 bool IsSortAscending() const { return bSortAscending; }
589
590 bool IsAutoShow() const { return bAutoShow; }
591 bool IsAutoTopItems() const { return bAutoTopItems; }
594
596
598};
599
601{
602private:
605 std::vector<std::unique_ptr<ScDPDataMember>> maMembers;
607
608public:
609 ScDPDataDimension( const ScDPResultData* pData );
611
612 void InitFrom( const ScDPResultDimension* pDim ); // recursive
613 void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
614 const ScDPSubTotalState& rSubState );
615 void FillDataRow(
616 const ScDPResultDimension* pRefDim,
617 ScDPResultFilterContext& rFilterCxt,
618 css::uno::Sequence<css::sheet::DataResult>& rSequence,
619 tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState& rSubState) const;
620
621 void UpdateDataRow( const ScDPResultDimension* pRefDim, tools::Long nMeasure, bool bIsSubTotalRow,
622 const ScDPSubTotalState& rSubState ) const;
623 void UpdateRunningTotals( const ScDPResultDimension* pRefDim, tools::Long nMeasure, bool bIsSubTotalRow,
624 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
625 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const;
626
627 void SortMembers( ScDPResultDimension* pRefDim );
628 tools::Long GetSortedIndex( tools::Long nUnsorted ) const;
629
630 void DoAutoShow( ScDPResultDimension* pRefDim );
631
632 void ResetResults();
633
634#if DUMP_PIVOT_TABLE
635 void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
636 void Dump(int nIndent) const;
637#endif
638
640 const ScDPDataMember* GetMember(tools::Long n) const;
642};
643
649{
650public:
653
654 void addVisibleMember(const OUString& rDimName, const ScDPItemData& rMemberItem);
655 void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const;
656
657private:
659 {
660 size_t operator()(const ScDPItemData& r) const;
661 };
662 typedef std::unordered_set<ScDPItemData, MemberHash> VisibleMemberType;
663 typedef std::unordered_map<OUString, VisibleMemberType> DimMemberType;
665
667};
668
669/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsEnd(size_t nPos) const
Definition: dptabres.cxx:4079
void SetInitChild(bool b)
Definition: dptabres.hxx:256
LateInitParams(const ::std::vector< ScDPDimension * > &ppDim, const ::std::vector< ScDPLevel * > &ppLev, bool bRow)
Definition: dptabres.cxx:4069
bool IsRow() const
Definition: dptabres.hxx:264
bool GetInitChild() const
Definition: dptabres.hxx:262
const ::std::vector< ScDPDimension * > & mppDim
Definition: dptabres.hxx:246
const ::std::vector< ScDPLevel * > & mppLev
Definition: dptabres.hxx:247
ScDPDimension * GetDim(size_t nPos) const
Definition: dptabres.hxx:259
void SetInitAllChildren(bool b)
Definition: dptabres.hxx:257
bool mbAllChildren
Definition: dptabres.hxx:251
ScDPLevel * GetLevel(size_t nPos) const
Definition: dptabres.hxx:260
bool GetInitAllChild() const
Definition: dptabres.hxx:263
bool mbHasHideDetailsMember
Definition: dptabres.hxx:233
std::unordered_map< SCROW, ScDPParentDimData > maMemberHash
Definition: dptabres.hxx:232
void SetHasHideDetailsMembers(bool b)
Definition: dptabres.hxx:238
const ScDPParentDimData * FindMember(SCROW nIndex) const
Definition: dptabres.cxx:4045
bool IsHasHideDetailsMembers() const
Definition: dptabres.hxx:237
void InsertMember(ScDPParentDimData const &rNew)
Definition: dptabres.cxx:4054
ScDPAggData * GetChild()
Definition: dptabres.cxx:661
sal_Int64 nCount
Definition: dptabres.hxx:159
bool IsCalculated() const
Definition: dptabres.cxx:595
bool HasData() const
Definition: dptabres.cxx:614
std::vector< double > mSortedValues
Definition: dptabres.hxx:161
void Update(const ScDPValue &rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:374
double fVal
Definition: dptabres.hxx:157
const ScDPAggData * GetExistingChild() const
Definition: dptabres.hxx:183
void Dump(int nIndent) const
bool HasError() const
Definition: dptabres.cxx:607
WelfordRunner maWelford
Definition: dptabres.hxx:156
void SetError()
Definition: dptabres.cxx:628
void SetEmpty(bool bSet)
Definition: dptabres.cxx:635
void Reset()
Definition: dptabres.cxx:668
std::unique_ptr< ScDPAggData > pChild
Definition: dptabres.hxx:160
double fAux
Definition: dptabres.hxx:158
void Calculate(ScSubTotalFunc eFunc, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:449
double GetAuxiliary() const
Definition: dptabres.cxx:645
void SetAuxiliary(double fNew)
Definition: dptabres.cxx:653
void SetResult(double fNew)
Definition: dptabres.cxx:621
double GetResult() const
Definition: dptabres.cxx:600
void UpdateDataRow(const ScDPResultDimension *pRefDim, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:3653
const ScDPResultData * pResultData
Definition: dptabres.hxx:603
void DoAutoShow(ScDPResultDimension *pRefDim)
Definition: dptabres.cxx:3716
tools::Long GetSortedIndex(tools::Long nUnsorted) const
Definition: dptabres.cxx:3797
ScDPDataDimension(const ScDPResultData *pData)
or ptr to IntDimension?
Definition: dptabres.cxx:3540
void UpdateRunningTotals(const ScDPResultDimension *pRefDim, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState, ScDPRunningTotalState &rRunning, ScDPRowTotals &rTotals, const ScDPResultMember &rRowParent) const
Definition: dptabres.cxx:3806
const ScDPResultDimension * pResultDimension
Definition: dptabres.hxx:604
std::vector< std::unique_ptr< ScDPDataMember > > maMembers
Definition: dptabres.hxx:605
void SortMembers(ScDPResultDimension *pRefDim)
Definition: dptabres.cxx:3680
void ProcessData(const ::std::vector< SCROW > &aDataMembers, const ::std::vector< ScDPValue > &aValues, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:3581
void DumpState(const ScDPResultDimension *pRefDim, ScDocument *pDoc, ScAddress &rPos) const
void Dump(int nIndent) const
tools::Long GetMemberCount() const
Definition: dptabres.cxx:3876
const ScDPDataMember * GetMember(tools::Long n) const
Definition: dptabres.cxx:3881
void FillDataRow(const ScDPResultDimension *pRefDim, ScDPResultFilterContext &rFilterCxt, css::uno::Sequence< css::sheet::DataResult > &rSequence, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:3608
void InitFrom(const ScDPResultDimension *pDim)
Definition: dptabres.cxx:3551
void UpdateValues(const ::std::vector< ScDPValue > &aValues, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:1913
void Dump(int nIndent) const
OUString GetName() const
Definition: dptabres.cxx:1854
const ScDPResultMember * pResultMember
Definition: dptabres.hxx:429
ScDPAggData * GetAggData(tools::Long nMeasure, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:2005
void SortMembers(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:2248
bool HasHiddenDetails() const
Definition: dptabres.cxx:1878
void InitFrom(const ScDPResultDimension *pDim)
Definition: dptabres.cxx:1886
void ResetResults()
Definition: dptabres.cxx:2274
ScDPDataMember(const ScDPResultData *pData, const ScDPResultMember *pRes)
Definition: dptabres.cxx:1843
void UpdateRunningTotals(const ScDPResultMember *pRefMember, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState, ScDPRunningTotalState &rRunning, ScDPRowTotals &rTotals, const ScDPResultMember &rRowParent)
Definition: dptabres.cxx:2283
bool HasError(tools::Long nMeasure, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:1987
void UpdateDataRow(const ScDPResultMember *pRefMember, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:2175
void ProcessData(const ::std::vector< SCROW > &aChildMembers, const ::std::vector< ScDPValue > &aValues, const ScDPSubTotalState &rSubState)
Definition: dptabres.cxx:1937
bool IsVisible() const
Definition: dptabres.cxx:1862
void DumpState(const ScDPResultMember *pRefMember, ScDocument *pDoc, ScAddress &rPos) const
void DoAutoShow(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:2261
ScDPDataDimension * GetChildDimension()
Definition: dptabres.hxx:481
double GetAggregate(tools::Long nMeasure, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:1996
const ScDPDataDimension * GetChildDimension() const
this will be removed!
Definition: dptabres.hxx:480
bool IsNamedItem(SCROW nRow) const
Definition: dptabres.cxx:1870
const ScDPResultData * pResultData
Definition: dptabres.hxx:428
bool HasData(tools::Long nMeasure, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:1972
ScDPAggData aAggregate
Definition: dptabres.hxx:432
std::unique_ptr< ScDPDataDimension > pChildDimension
Ref?
Definition: dptabres.hxx:431
const ScDPAggData * GetConstAggData(tools::Long nMeasure, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:2023
void FillDataRow(const ScDPResultMember *pRefMember, ScDPResultFilterContext &rFilterCxt, css::uno::Sequence< css::sheet::DataResult > &rSequence, tools::Long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState &rSubState) const
Definition: dptabres.cxx:2045
Member names that are being processed for InitFrom/LateInitFrom (needed for initialization of grouped...
Definition: dptabres.hxx:56
const std::vector< Member > & GetMembers() const
Definition: dptabres.hxx:69
void RemoveMember()
Definition: dptabres.cxx:261
void AddMember(tools::Long nSourceIndex, SCROW nMember)
Definition: dptabres.cxx:256
std::vector< Member > maMembers
Definition: dptabres.hxx:72
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
Definition: dpitemdata.hxx:29
The term 'measure' here roughly equals "data dimension" ?
Definition: dptabres.hxx:272
void SetDataLayoutOrientation(css::sheet::DataPilotFieldOrientation nOrient)
Definition: dptabres.cxx:795
bool IsNumOrDateGroup(tools::Long nDim) const
Definition: dptabres.cxx:895
tools::Long GetGroupBase(tools::Long nGroupDim) const
Definition: dptabres.cxx:890
css::sheet::DataPilotFieldOrientation GetMeasureRefOrient(tools::Long nMeasure) const
Definition: dptabres.cxx:834
void SetMeasureData(std::vector< ScSubTotalFunc > &rFunctions, std::vector< css::sheet::DataPilotFieldReference > &rRefs, std::vector< css::sheet::DataPilotFieldOrientation > &rRefOrient, std::vector< OUString > &rNames)
Definition: dptabres.cxx:772
ScDPSource & mrSource
Definition: dptabres.hxx:273
bool IsLateInit() const
Definition: dptabres.hxx:307
ScSubTotalFunc GetMeasureFunction(tools::Long nMeasure) const
Definition: dptabres.cxx:822
std::vector< css::sheet::DataPilotFieldReference > maMeasureRefs
Definition: dptabres.hxx:277
ScDPResultData(ScDPSource &rSrc)
Definition: dptabres.cxx:760
const css::sheet::DataPilotFieldReference & GetMeasureRefVal(tools::Long nMeasure) const
Definition: dptabres.cxx:828
tools::Long GetCountForMeasure(tools::Long nMeas) const
Definition: dptabres.hxx:312
void SetLateInit(bool bSet)
Definition: dptabres.cxx:801
OUString GetMeasureString(tools::Long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool &rbTotalResult) const
Definition: dptabres.cxx:840
tools::Long GetRowStartMeasure() const
Definition: dptabres.cxx:814
OUString GetMeasureDimensionName(tools::Long nMeasure) const
Definition: dptabres.cxx:874
std::vector< ScSubTotalFunc > maMeasureFuncs
keep things like measure lists here
Definition: dptabres.hxx:276
tools::Long GetMeasureCount() const
Definition: dptabres.hxx:300
std::vector< std::unique_ptr< ResultMembers > > maDimMembers
add "displayed values" settings
Definition: dptabres.hxx:286
bool HasCommonElement(SCROW nFirstDataId, tools::Long nFirstIndex, const ScDPItemData &rSecondData, tools::Long nSecondIndex) const
Definition: dptabres.cxx:910
std::vector< OUString > maMeasureNames
Definition: dptabres.hxx:279
tools::Long GetColStartMeasure() const
Definition: dptabres.cxx:806
std::vector< css::sheet::DataPilotFieldOrientation > maMeasureRefOrients
Definition: dptabres.hxx:278
bool IsInGroup(SCROW nGroupDataId, tools::Long nGroupIndex, const ScDPItemData &rBaseData, tools::Long nBaseIndex) const
Definition: dptabres.cxx:900
const ScDPSource & GetSource() const
Definition: dptabres.hxx:324
bool IsBaseForGroup(tools::Long nDim) const
Definition: dptabres.cxx:885
ResultMembers & GetDimResultMembers(tools::Long nDim, const ScDPDimension *pDim, ScDPLevel *pLevel) const
Definition: dptabres.cxx:920
tools::Long GetMemberCount() const
Definition: dptabres.cxx:3501
void FillVisibilityData(ScDPResultVisibilityData &rData) const
Definition: dptabres.cxx:3523
void InitWithMembers(LateInitParams &rParams, const ::std::vector< SCROW > &pItemData, size_t nPos, ScDPInitState &rInitState)
Definition: dptabres.cxx:3999
void SortMembers(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:3123
void LateInitFrom(LateInitParams &rParams, const ::std::vector< SCROW > &pItemData, size_t nPos, ScDPInitState &rInitState)
Definition: dptabres.cxx:2867
bool IsValidEntry(const ::std::vector< SCROW > &aMembers) const
Definition: dptabres.cxx:3007
tools::Long GetSortMeasure() const
Definition: dptabres.hxx:588
void DoAutoShow(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:3152
bool IsSortAscending() const
Definition: dptabres.hxx:587
void UpdateRunningTotals(const ScDPResultMember *pRefMember, tools::Long nMeasure, ScDPRunningTotalState &rRunning, ScDPRowTotals &rTotals) const
Definition: dptabres.cxx:3228
void UpdateDataResults(const ScDPResultMember *pRefMember, tools::Long nMeasure) const
Definition: dptabres.cxx:3101
ScDPDataMember * GetRowReferenceMember(const ScDPRelativePos *pMemberPos, const OUString *pName, const sal_Int32 *pRowIndexes, const sal_Int32 *pColIndexes) const
Definition: dptabres.cxx:3260
void Dump(int nIndent) const
std::map< SCROW, ScDPResultMember * > MemberHash
Definition: dptabres.hxx:490
std::vector< std::unique_ptr< ScDPResultMember > > MemberArray
Definition: dptabres.hxx:489
OUString aDimensionName
Definition: dptabres.hxx:495
ScDPResultDimension * GetFirstChildDimension() const
Definition: dptabres.cxx:3515
ScDPResultMember * InsertMember(const ScDPParentDimData *pMemberData)
Definition: dptabres.cxx:3984
const ScMemberSortOrder & GetMemberOrder() const
Definition: dptabres.hxx:580
MemberArray maMemberArray
Definition: dptabres.hxx:493
ScMemberSortOrder & GetMemberOrder()
Definition: dptabres.hxx:581
ScDPResultMember * FindMember(SCROW iData) const
Definition: dptabres.cxx:2773
ScDPResultDimension(const ScDPResultData *pData)
Definition: dptabres.cxx:2755
void CheckShowEmpty(bool bShow=false)
Definition: dptabres.cxx:4084
void DumpState(const ScDPResultMember *pRefMember, ScDocument *pDoc, ScAddress &rPos) const
bool IsDataLayout() const
Definition: dptabres.hxx:583
bool IsAutoTopItems() const
Definition: dptabres.hxx:591
void FillMemberResults(css::uno::Sequence< css::sheet::MemberResult > *pSequences, tools::Long nStart, tools::Long nMeasure)
Test.
Definition: dptabres.cxx:3045
tools::Long GetAutoCount() const
Definition: dptabres.hxx:593
tools::Long nSortMeasure
or ptr to IntDimension?
Definition: dptabres.hxx:496
ScDPResultMember * AddMember(const ScDPParentDimData &aData)
Definition: dptabres.cxx:3974
tools::Long nAutoCount
Definition: dptabres.hxx:505
tools::Long GetAutoMeasure() const
Definition: dptabres.hxx:592
tools::Long nAutoMeasure
Definition: dptabres.hxx:504
bool bSortByData
or ptr to IntDimension?
Definition: dptabres.hxx:499
MemberHash maMemberHash
Definition: dptabres.hxx:494
static ScDPDataMember * GetColReferenceMember(const ScDPRelativePos *pMemberPos, const OUString *pName, sal_Int32 nRefDimPos, const ScDPRunningTotalState &rRunning)
Definition: dptabres.cxx:3350
tools::Long GetSortedIndex(tools::Long nUnsorted) const
Definition: dptabres.cxx:3223
bool IsAutoShow() const
Definition: dptabres.hxx:590
void ProcessData(const ::std::vector< SCROW > &aMembers, const ScDPResultDimension *pDataDim, const ::std::vector< SCROW > &aDataMembers, const ::std::vector< ScDPValue > &aValues) const
Definition: dptabres.cxx:3021
const ScDPResultMember * GetMember(tools::Long n) const
Definition: dptabres.cxx:3506
const ScDPResultData * pResultData
Definition: dptabres.hxx:492
tools::Long GetSize(tools::Long nMeasure) const
Definition: dptabres.cxx:2984
void InitFrom(const ::std::vector< ScDPDimension * > &ppDim, const ::std::vector< ScDPLevel * > &ppLev, size_t nPos, ScDPInitState &rInitState, bool bInitChild=true)
Definition: dptabres.cxx:2799
bool IsSortByData() const
Definition: dptabres.hxx:586
const OUString & GetName() const
Definition: dptabres.hxx:584
void FillDataResults(const ScDPResultMember *pRefMember, ScDPResultFilterContext &rFilterCxt, css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > &rSequence, tools::Long nMeasure) const
Definition: dptabres.cxx:3072
ScMemberSortOrder aMemberOrder
Definition: dptabres.hxx:497
void ProcessData(const ::std::vector< SCROW > &aChildMembers, const ScDPResultDimension *pDataDim, const ::std::vector< SCROW > &aDataMembers, const ::std::vector< ScDPValue > &aValues)
Definition: dptabres.cxx:1257
void LateInitFrom(LateInitParams &rParams, const ::std::vector< SCROW > &pItemData, size_t nPos, ScDPInitState &rInitState)
Definition: dptabres.cxx:1083
const ScDPMember * GetDPMember() const
Ref.
Definition: dptabres.hxx:416
bool IsValid() const
Definition: dptabres.cxx:1212
SCROW GetOrder() const
Ref.
Definition: dptabres.hxx:417
const ScDPLevel * GetParentLevel() const
Ref.
Definition: dptabres.hxx:415
std::unique_ptr< ScDPResultDimension > pChildDimension
Definition: dptabres.hxx:332
void UpdateDataResults(const ScDPResultMember *pRefMember, tools::Long nMeasure) const
Definition: dptabres.cxx:1655
void SetHasElements()
Definition: dptabres.hxx:376
ScDPResultMember(const ScDPResultData *pData, const ScDPParentDimData &rParentDimData)
Definition: dptabres.cxx:949
const ScDPResultData * pResultData
Definition: dptabres.hxx:330
void FillDataResults(const ScDPResultMember *pRefMember, ScDPResultFilterContext &rFilterCxt, css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > &rSequence, tools::Long nMeasure) const
Definition: dptabres.cxx:1543
void InitFrom(const ::std::vector< ScDPDimension * > &ppDim, const ::std::vector< ScDPLevel * > &ppLev, size_t nPos, ScDPInitState &rInitState, bool bInitChild=true)
Definition: dptabres.cxx:1039
bool HasHiddenDetails() const
Definition: dptabres.hxx:368
tools::Long GetSubTotalCount(tools::Long *pUserSubStart=nullptr) const
Definition: dptabres.cxx:1227
bool IsRoot() const
Ref.
Definition: dptabres.hxx:418
void CheckShowEmpty(bool bShow=false)
Definition: dptabres.cxx:4096
const ScDPDimension * GetParentDim() const
Definition: dptabres.hxx:414
void Dump(int nIndent) const
void DoAutoShow(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:1719
bool IsNamedItem(SCROW nIndex) const
Definition: dptabres.cxx:1011
SCROW GetDataId() const
Definition: dptabres.cxx:3966
ScDPResultDimension * GetChildDimension()
Definition: dptabres.hxx:410
const ScDPResultDimension * GetChildDimension() const
this will be removed!
Definition: dptabres.hxx:409
void FillVisibilityData(ScDPResultVisibilityData &rData) const
Definition: dptabres.cxx:1837
bool IsSubTotalInTitle(tools::Long nMeasure) const
Definition: dptabres.cxx:1135
OUString GetDisplayName(bool bLocaleIndependent) const
Definition: dptabres.cxx:987
ScDPItemData FillItemData() const
Definition: dptabres.cxx:1003
void FillMemberResults(css::uno::Sequence< css::sheet::MemberResult > *pSequences, tools::Long &rPos, tools::Long nMeasure, bool bRoot, const OUString *pMemberName, const OUString *pMemberCaption)
Definition: dptabres.cxx:1323
ScDPParentDimData aParentDimData
Definition: dptabres.hxx:331
ScDPDataMember * GetDataRoot() const
Definition: dptabres.hxx:412
void UpdateRunningTotals(const ScDPResultMember *pRefMember, tools::Long nMeasure, ScDPRunningTotalState &rRunning, ScDPRowTotals &rTotals) const
Definition: dptabres.cxx:1743
bool IsVisible() const
Definition: dptabres.cxx:1194
tools::Long GetSize(tools::Long nMeasure) const
Definition: dptabres.cxx:1157
ScDPAggData * GetColTotal(tools::Long nMeasure) const
Definition: dptabres.cxx:1832
void SortMembers(ScDPResultMember *pRefMember)
Definition: dptabres.cxx:1704
std::unique_ptr< ScDPDataMember > pDataRoot
Definition: dptabres.hxx:333
void DumpState(const ScDPResultMember *pRefMember, ScDocument *pDoc, ScAddress &rPos) const
sal_uInt16 nMemberStep
Definition: dptabres.hxx:341
void SetAutoHidden()
Definition: dptabres.hxx:377
bool IsValidEntry(const ::std::vector< SCROW > &aMembers) const
Definition: dptabres.cxx:1020
ScDPAggData aColTotal
Definition: dptabres.hxx:339
OUString GetName() const
Definition: dptabres.cxx:978
bool bHasHiddenDetails
Definition: dptabres.hxx:336
This class collects visible members of each dimension and uses that information to create filtering c...
Definition: dptabres.hxx:649
ScDPResultVisibilityData(ScDPSource *pSource)
Definition: dptabres.cxx:3891
void fillFieldFilters(::std::vector< ScDPFilteredCache::Criterion > &rFilters) const
Definition: dptabres.cxx:3919
void addVisibleMember(const OUString &rDimName, const ScDPItemData &rMemberItem)
Definition: dptabres.cxx:3901
std::unordered_map< OUString, VisibleMemberType > DimMemberType
Definition: dptabres.hxx:663
DimMemberType maDimensions
Definition: dptabres.hxx:664
std::unordered_set< ScDPItemData, MemberHash > VisibleMemberType
Definition: dptabres.hxx:662
ScDPAggData * GetGrandTotal(tools::Long nMeasure)
Definition: dptabres.cxx:727
void SetInColRoot(bool bSet)
Definition: dptabres.hxx:207
ScDPAggData * GetRowTotal(tools::Long nMeasure)
Definition: dptabres.cxx:722
bool IsInColRoot() const
Definition: dptabres.hxx:206
ScDPAggData aGrandTotal
Definition: dptabres.hxx:196
ScDPAggData aRowTotal
Definition: dptabres.hxx:195
bool bIsInColRoot
Definition: dptabres.hxx:197
indexes when calculating running totals
Definition: dptabres.hxx:105
ScDPRunningTotalState(ScDPResultMember *pColRoot, ScDPResultMember *pRowRoot)
array of sal_Int32 terminated by -1.
Definition: dptabres.cxx:308
void AddRowIndex(sal_Int32 nVisible, tools::Long nSorted)
Definition: dptabres.cxx:327
std::vector< sal_Int32 > IndexArray
Definition: dptabres.hxx:107
ScDPResultMember * GetRowResRoot() const
Definition: dptabres.hxx:112
const IndexArray & GetRowVisible() const
Definition: dptabres.hxx:116
IndexArray maRowSorted
Definition: dptabres.hxx:131
ScDPResultMember * pColResRoot
Definition: dptabres.hxx:125
const IndexArray & GetRowSorted() const
Definition: dptabres.hxx:117
IndexArray maColVisible
Definition: dptabres.hxx:128
IndexArray maColSorted
Definition: dptabres.hxx:129
const IndexArray & GetColVisible() const
Definition: dptabres.hxx:114
IndexArray maRowVisible
Definition: dptabres.hxx:130
ScDPResultMember * pRowResRoot
Definition: dptabres.hxx:126
void AddColIndex(sal_Int32 nVisible, tools::Long nSorted)
Definition: dptabres.cxx:318
const IndexArray & GetColSorted() const
Definition: dptabres.hxx:115
ScDPResultMember * GetColResRoot() const
Definition: dptabres.hxx:111
Implements the Welford Online one-pass algorithm.
Definition: subtotal.hxx:39
::std::vector< sal_Int32 > ScMemberSortOrder
Definition: dptabres.hxx:75
const sal_Int64 SC_DPAGG_RESULT_VALID
Definition: dptabres.hxx:150
#define SC_DPMEASURE_ALL
Definition: dptabres.hxx:216
const sal_Int64 SC_DPAGG_RESULT_EMPTY
Definition: dptabres.hxx:149
const sal_Int64 SC_DPAGG_RESULT_ERROR
Definition: dptabres.hxx:151
const sal_Int64 SC_DPAGG_EMPTY
separate header file?
Definition: dptabres.hxx:147
const sal_Int64 SC_DPAGG_DATA_ERROR
Definition: dptabres.hxx:148
ScSubTotalFunc
Definition: global.hxx:859
@ SUBTOTAL_FUNC_NONE
Definition: global.hxx:860
sal_uInt16 nPos
long Long
Member(tools::Long nSrcIndex, SCROW nNameIndex)
Definition: dptabres.cxx:253
tools::Long mnSrcIndex
Definition: dptabres.hxx:60
const ScDPLevel * mpParentLevel
Ref.
Definition: dptabres.hxx:223
const ScDPDimension * mpParentDim
Ref.
Definition: dptabres.hxx:222
const ScDPMember * mpMemberDesc
Ref.
Definition: dptabres.hxx:224
const SCROW mnOrder
Definition: dptabres.hxx:221
tools::Long nBasePos
Definition: dptabres.hxx:136
tools::Long nDirection
Definition: dptabres.hxx:137
ScDPRelativePos(tools::Long nBase, tools::Long nDir)
Definition: dptabres.cxx:368
size_t operator()(const ScDPItemData &r) const
Definition: dptabres.cxx:3959
Select subtotal information, passed down the dimensions.
Definition: dptabres.hxx:81
ScSubTotalFunc eRowForce
Definition: dptabres.hxx:83
ScSubTotalFunc eColForce
Definition: dptabres.hxx:82
tools::Long nColSubTotalFunc
Definition: dptabres.hxx:84
tools::Long nRowSubTotalFunc
Definition: dptabres.hxx:85
sal_Int32 SCROW
Definition: types.hxx:17