Bump version to 6.4-15
[LibreOffice.git] / sc / inc / dptabres.hxx
blob13eeb5fc5135d4f3fe6f20be73c81aea9faf23ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_DPTABRES_HXX
21 #define INCLUDED_SC_INC_DPTABRES_HXX
23 #include "global.hxx"
24 #include "dpfilteredcache.hxx"
25 #include "calcmacros.hxx"
26 #include "dpitemdata.hxx"
27 #include "subtotal.hxx"
29 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
30 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
32 #include <map>
33 #include <unordered_map>
34 #include <unordered_set>
35 #include <memory>
36 #include <vector>
38 namespace com { namespace sun { namespace star { namespace sheet { struct DataResult; } } } }
39 namespace com { namespace sun { namespace star { namespace sheet { struct MemberResult; } } } }
40 namespace com { namespace sun { namespace star { namespace uno { template <typename > class Sequence; } } } }
42 class ScDPSource;
43 class ScDPDimension;
44 class ScDPLevel;
45 class ScDPMember;
46 class ScDPResultMember;
47 class ScDPResultVisibilityData;
49 struct ScDPValue;
50 struct ScDPResultFilterContext;
52 /**
53 * Member names that are being processed for InitFrom/LateInitFrom (needed
54 * for initialization of grouped items).
56 class ScDPInitState
58 public:
59 struct Member
61 long const mnSrcIndex;
62 SCROW const mnNameIndex;
64 Member(long nSrcIndex, SCROW nNameIndex);
67 void AddMember(long nSourceIndex, SCROW nMember);
68 void RemoveMember();
70 const std::vector<Member>& GetMembers() const { return maMembers; }
72 private:
73 std::vector<Member> maMembers;
76 typedef ::std::vector<sal_Int32> ScMemberSortOrder;
78 /**
79 * Select subtotal information, passed down the dimensions.
81 struct ScDPSubTotalState
83 ScSubTotalFunc eColForce;
84 ScSubTotalFunc eRowForce;
85 long nColSubTotalFunc;
86 long nRowSubTotalFunc;
88 ScDPSubTotalState() :
89 eColForce( SUBTOTAL_FUNC_NONE ),
90 eRowForce( SUBTOTAL_FUNC_NONE ),
91 nColSubTotalFunc( -1 ),
92 nRowSubTotalFunc( -1 )
96 /**
97 * indexes when calculating running totals
99 * Col/RowVisible: simple counts from 0 - without sort order applied
100 * - visible index (only used for running total / relative index)
102 * Col/RowSorted: with sort order applied - member index (used otherwise -
103 * so other members' children can be accessed).
105 class ScDPRunningTotalState
107 public:
108 typedef std::vector<long> IndexArray; /// array of long integers terminated by -1.
110 ScDPRunningTotalState( ScDPResultMember* pColRoot, ScDPResultMember* pRowRoot );
112 ScDPResultMember* GetColResRoot() const { return pColResRoot; }
113 ScDPResultMember* GetRowResRoot() const { return pRowResRoot; }
115 const IndexArray& GetColVisible() const { return maColVisible;}
116 const IndexArray& GetColSorted() const { return maColSorted;}
117 const IndexArray& GetRowVisible() const { return maRowVisible;}
118 const IndexArray& GetRowSorted() const { return maRowSorted;}
120 void AddColIndex( long nVisible, long nSorted );
121 void AddRowIndex( long nVisible, long nSorted );
122 void RemoveColIndex();
123 void RemoveRowIndex();
125 private:
126 ScDPResultMember* const pColResRoot;
127 ScDPResultMember* const pRowResRoot;
129 mutable IndexArray maColVisible;
130 mutable IndexArray maColSorted;
131 mutable IndexArray maRowVisible;
132 mutable IndexArray maRowSorted;
135 struct ScDPRelativePos
137 long nBasePos; // simple count, without sort order applied
138 long const nDirection;
140 ScDPRelativePos( long nBase, long nDir );
143 // aggregated data
144 //! separate header file?
146 // Possible values for the nCount member:
147 // (greater than 0 counts the collected values)
148 const sal_Int64 SC_DPAGG_EMPTY = 0; // empty during data collection
149 const sal_Int64 SC_DPAGG_DATA_ERROR = -1; // error during data collection
150 const sal_Int64 SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated
151 const sal_Int64 SC_DPAGG_RESULT_VALID = -3; // valid result calculated
152 const sal_Int64 SC_DPAGG_RESULT_ERROR = -4; // error in calculated result
154 class ScDPAggData
156 private:
157 WelfordRunner maWelford;
158 double fVal;
159 double fAux;
160 sal_Int64 nCount;
161 std::unique_ptr<ScDPAggData> pChild;
162 std::vector<double> mSortedValues;
164 public:
165 ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY) {}
167 void Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
168 void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
169 bool IsCalculated() const;
171 double GetResult() const;
172 bool HasError() const;
173 bool HasData() const;
175 void SetResult( double fNew );
176 void SetEmpty( bool bSet );
177 void SetError();
179 double GetAuxiliary() const;
180 void SetAuxiliary( double fNew );
182 void Reset(); // also deletes children
184 const ScDPAggData* GetExistingChild() const { return pChild.get(); }
185 ScDPAggData* GetChild();
187 #if DUMP_PIVOT_TABLE
188 void Dump(int nIndent) const;
189 #endif
192 // Row and grand total state, passed down (column total is at result member)
194 class ScDPRowTotals
196 ScDPAggData aRowTotal;
197 ScDPAggData aGrandTotal;
198 bool bIsInColRoot;
200 public:
201 ScDPRowTotals();
202 ~ScDPRowTotals();
204 ScDPAggData* GetRowTotal( long nMeasure );
205 ScDPAggData* GetGrandTotal( long nMeasure );
207 bool IsInColRoot() const { return bIsInColRoot; }
208 void SetInColRoot(bool bSet) { bIsInColRoot = bSet; }
211 // results for a hierarchy dimension
213 class ScDPResultDimension;
214 class ScDPDataDimension;
215 class ScDPDataMember;
217 #define SC_DPMEASURE_ALL -1
218 #define SC_DPMEASURE_ANY -2
220 struct ScDPParentDimData
222 const SCROW mnOrder; //! Ref
223 const ScDPDimension* mpParentDim; //! Ref
224 const ScDPLevel* mpParentLevel; //! Ref
225 const ScDPMember* mpMemberDesc; //! Ref
227 ScDPParentDimData();
228 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
231 class ResultMembers final
233 std::unordered_map<SCROW, ScDPParentDimData> maMemberHash;
234 bool mbHasHideDetailsMember;
235 public:
236 const ScDPParentDimData* FindMember( SCROW nIndex ) const;
237 void InsertMember( ScDPParentDimData const & rNew );
238 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
239 void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
240 ResultMembers();
241 ~ResultMembers();
244 class LateInitParams
246 private:
247 const ::std::vector<ScDPDimension*>& mppDim;
248 const ::std::vector<ScDPLevel*>& mppLev;
250 bool const mbRow:1;
251 bool mbInitChild:1;
252 bool mbAllChildren:1;
253 public:
254 LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
255 bool bRow);
256 ~LateInitParams();
258 void SetInitChild( bool b ) { mbInitChild = b; }
259 void SetInitAllChildren( bool b ) { mbAllChildren = b; }
261 ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
262 ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
264 bool GetInitChild() const {return mbInitChild; }
265 bool GetInitAllChild() const { return mbAllChildren; }
266 bool IsRow() const { return mbRow; }
267 bool IsEnd( size_t nPos ) const ;
271 * The term 'measure' here roughly equals "data dimension" ?
273 class ScDPResultData
275 ScDPSource& mrSource;
276 //! keep things like measure lists here
278 std::vector<ScSubTotalFunc> maMeasureFuncs;
279 std::vector<css::sheet::DataPilotFieldReference> maMeasureRefs;
280 std::vector<css::sheet::DataPilotFieldOrientation> maMeasureRefOrients;
281 std::vector<OUString> maMeasureNames;
283 bool bLateInit:1;
284 bool bDataAtCol:1;
285 bool bDataAtRow:1;
287 //! add "displayed values" settings
288 mutable std::vector<std::unique_ptr<ResultMembers>> maDimMembers;
289 public:
290 ScDPResultData( ScDPSource& rSrc );
291 ~ScDPResultData();
293 void SetMeasureData(
294 std::vector<ScSubTotalFunc>& rFunctions,
295 std::vector<css::sheet::DataPilotFieldReference>& rRefs,
296 std::vector<css::sheet::DataPilotFieldOrientation>& rRefOrient,
297 std::vector<OUString>& rNames );
299 void SetDataLayoutOrientation( css::sheet::DataPilotFieldOrientation nOrient );
300 void SetLateInit( bool bSet );
302 long GetMeasureCount() const { return maMeasureFuncs.size(); }
303 ScSubTotalFunc GetMeasureFunction(long nMeasure) const;
304 OUString GetMeasureString(long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const;
305 OUString GetMeasureDimensionName(long nMeasure) const;
306 const css::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const;
307 css::sheet::DataPilotFieldOrientation GetMeasureRefOrient(long nMeasure) const;
309 bool IsLateInit() const { return bLateInit; }
311 long GetColStartMeasure() const;
312 long GetRowStartMeasure() const;
314 long GetCountForMeasure( long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
316 bool IsBaseForGroup( long nDim ) const; // any group
317 long GetGroupBase( long nGroupDim ) const;
318 bool IsNumOrDateGroup( long nDim ) const;
319 bool IsInGroup( SCROW nGroupDataId, long nGroupIndex,
320 const ScDPItemData& rBaseData, long nBaseIndex ) const;
321 bool HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
322 const ScDPItemData& rSecondData, long nSecondIndex ) const;
324 ResultMembers& GetDimResultMembers(long nDim, const ScDPDimension* pDim, ScDPLevel* pLevel) const;
326 const ScDPSource& GetSource() const { return mrSource;}
329 class ScDPResultMember
331 private:
332 const ScDPResultData* pResultData;
333 ScDPParentDimData const aParentDimData;
334 std::unique_ptr<ScDPResultDimension> pChildDimension;
335 std::unique_ptr<ScDPDataMember> pDataRoot;
336 bool bHasElements:1;
337 bool const bForceSubTotal:1;
338 bool bHasHiddenDetails:1;
339 bool bInitialized:1;
340 bool bAutoHidden:1;
341 ScDPAggData aColTotal; // to store column totals
343 sal_uInt16 nMemberStep; // step to show details
344 public:
345 ScDPResultMember(
346 const ScDPResultData* pData, const ScDPParentDimData& rParentDimData ); //! Ref
347 ScDPResultMember( const ScDPResultData* pData, bool bForceSub );
348 ~ScDPResultMember();
350 void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
351 const ::std::vector<ScDPLevel*>& ppLev,
352 size_t nPos,
353 ScDPInitState& rInitState,
354 bool bInitChild = true );
355 void LateInitFrom(
356 LateInitParams& rParams,
357 const ::std::vector< SCROW >& pItemData,
358 size_t nPos,
359 ScDPInitState& rInitState);
360 void CheckShowEmpty( bool bShow = false );
361 OUString GetName() const;
362 OUString GetDisplayName( bool bLocaleIndependent ) const;
364 ScDPItemData FillItemData() const;
365 bool IsValid() const;
366 bool IsVisible() const;
367 long GetSize(long nMeasure) const;
368 // bHasHiddenDetails is set only if the "show details" flag is off,
369 // and there was a child dimension to skip
370 bool HasHiddenDetails() const { return bHasHiddenDetails; }
371 bool IsSubTotalInTitle(long nMeasure) const;
373 long GetSubTotalCount( long* pUserSubStart = nullptr ) const;
375 bool IsNamedItem( SCROW nIndex ) const;
376 bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
378 void SetHasElements() { bHasElements = true; }
379 void SetAutoHidden() { bAutoHidden = true; }
381 void ProcessData( const ::std::vector<SCROW>& aChildMembers,
382 const ScDPResultDimension* pDataDim,
383 const ::std::vector<SCROW>& aDataMembers,
384 const ::std::vector<ScDPValue>& aValues );
385 void FillMemberResults(
386 css::uno::Sequence< css::sheet::MemberResult>* pSequences,
387 long& rPos, long nMeasure, bool bRoot, const OUString* pMemberName, const OUString* pMemberCaption );
389 void FillDataResults(
390 const ScDPResultMember* pRefMember,
391 ScDPResultFilterContext& rFilterCxt,
392 css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> >& rSequence,
393 long nMeasure) const;
395 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
396 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
397 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
399 void SortMembers( ScDPResultMember* pRefMember );
400 void DoAutoShow( ScDPResultMember* pRefMember );
402 void ResetResults();
404 #if DUMP_PIVOT_TABLE
405 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
407 void Dump(int nIndent) const;
408 #endif
410 //! this will be removed!
411 const ScDPResultDimension* GetChildDimension() const { return pChildDimension.get(); }
412 ScDPResultDimension* GetChildDimension() { return pChildDimension.get(); }
414 ScDPDataMember* GetDataRoot() const { return pDataRoot.get(); }
416 const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
417 const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
418 const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref
419 SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref
420 bool IsRoot() const { return GetParentLevel() == nullptr; }
421 SCROW GetDataId( ) const ;
422 ScDPAggData* GetColTotal( long nMeasure ) const;
424 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
427 class ScDPDataMember
429 private:
430 const ScDPResultData* pResultData;
431 const ScDPResultMember* pResultMember; //! Ref?
432 std::unique_ptr<ScDPDataDimension>
433 pChildDimension;
434 ScDPAggData aAggregate;
436 void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
438 public:
439 ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
440 ~ScDPDataMember();
442 void InitFrom( const ScDPResultDimension* pDim );
444 OUString GetName() const;
445 bool IsVisible() const;
446 bool HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
448 bool IsNamedItem( SCROW nRow ) const;
449 bool HasHiddenDetails() const;
451 void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
452 const ScDPSubTotalState& rSubState );
453 bool HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
454 double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
455 const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
456 ScDPAggData* GetAggData( long nMeasure, const ScDPSubTotalState& rSubState );
458 void FillDataRow(
459 const ScDPResultMember* pRefMember,
460 ScDPResultFilterContext& rFilterCxt,
461 css::uno::Sequence<css::sheet::DataResult>& rSequence,
462 long nMeasure, bool bIsSubTotalRow,
463 const ScDPSubTotalState& rSubState) const;
465 void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
466 const ScDPSubTotalState& rSubState );
467 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
468 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
469 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent );
471 void SortMembers( ScDPResultMember* pRefMember );
472 void DoAutoShow( ScDPResultMember* pRefMember );
474 void ResetResults();
476 #if DUMP_PIVOT_TABLE
477 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
478 void Dump(int nIndent) const;
479 #endif
481 //! this will be removed!
482 const ScDPDataDimension* GetChildDimension() const { return pChildDimension.get(); }
483 ScDPDataDimension* GetChildDimension() { return pChildDimension.get(); }
486 // result dimension contains only members
488 class ScDPResultDimension
490 public:
491 typedef std::vector<std::unique_ptr<ScDPResultMember>> MemberArray;
492 typedef std::map<SCROW, ScDPResultMember*> MemberHash;
493 private:
494 const ScDPResultData* pResultData;
495 MemberArray maMemberArray;
496 MemberHash maMemberHash;
497 OUString aDimensionName; //! or ptr to IntDimension?
498 long nSortMeasure;
499 ScMemberSortOrder aMemberOrder; // used when sorted by measure
500 bool bIsDataLayout:1; //! or ptr to IntDimension?
501 bool bSortByData:1;
502 bool bSortAscending:1;
503 bool bAutoShow:1;
504 bool bAutoTopItems:1;
505 bool bInitialized:1;
506 long nAutoMeasure;
507 long nAutoCount;
509 ScDPResultMember* FindMember( SCROW iData ) const;
510 ScDPResultMember* AddMember( const ScDPParentDimData& aData );
511 ScDPResultMember* InsertMember( const ScDPParentDimData* pMemberData );
512 void InitWithMembers( LateInitParams& rParams,
513 const ::std::vector< SCROW >& pItemData,
514 size_t nPos,
515 ScDPInitState& rInitState );
516 public:
517 ScDPResultDimension( const ScDPResultData* pData );
518 ~ScDPResultDimension();
520 // allocates new members
521 void InitFrom(
522 const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
523 size_t nPos, ScDPInitState& rInitState, bool bInitChild = true );
524 void LateInitFrom( LateInitParams& rParams,
525 const ::std::vector< SCROW >& pItemData,
526 size_t nPos,
527 ScDPInitState& rInitState );
528 void CheckShowEmpty( bool bShow = false );
530 long GetSize(long nMeasure) const;
532 bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
534 // modifies existing members, allocates data dimensions
535 void ProcessData( const ::std::vector<SCROW>& aMembers,
536 const ScDPResultDimension* pDataDim,
537 const ::std::vector<SCROW>& aDataMembers,
538 const ::std::vector<ScDPValue>& aValues ) const; //! Test
539 void FillMemberResults( css::uno::Sequence<
540 css::sheet::MemberResult>* pSequences,
541 long nStart, long nMeasure );
543 void FillDataResults(
544 const ScDPResultMember* pRefMember,
545 ScDPResultFilterContext& rFilterCxt,
546 css::uno::Sequence<
547 css::uno::Sequence<
548 css::sheet::DataResult> >& rSequence,
549 long nMeasure) const;
551 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
552 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
553 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
555 void SortMembers( ScDPResultMember* pRefMember );
556 long GetSortedIndex( long nUnsorted ) const;
558 void DoAutoShow( ScDPResultMember* pRefMember );
560 void ResetResults();
562 // called for the reference dimension
563 ScDPDataMember* GetRowReferenceMember(
564 const ScDPRelativePos* pMemberPos, const OUString* pName,
565 const long* pRowIndexes, const long* pColIndexes ) const;
567 // uses row root member from ScDPRunningTotalState
568 static ScDPDataMember* GetColReferenceMember(
569 const ScDPRelativePos* pMemberPos, const OUString* pName,
570 long nRefDimPos, const ScDPRunningTotalState& rRunning );
572 #if DUMP_PIVOT_TABLE
573 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
574 void Dump(int nIndent) const;
575 #endif
577 // for ScDPDataDimension::InitFrom
578 long GetMemberCount() const;
579 const ScDPResultMember* GetMember(long n) const;
580 ScDPResultMember* GetMember(long n);
582 const ScMemberSortOrder& GetMemberOrder() const { return aMemberOrder; }
583 ScMemberSortOrder& GetMemberOrder() { return aMemberOrder; }
585 bool IsDataLayout() const { return bIsDataLayout; }
586 const OUString& GetName() const { return aDimensionName; }
588 bool IsSortByData() const { return bSortByData; }
589 bool IsSortAscending() const { return bSortAscending; }
590 long GetSortMeasure() const { return nSortMeasure; }
592 bool IsAutoShow() const { return bAutoShow; }
593 bool IsAutoTopItems() const { return bAutoTopItems; }
594 long GetAutoMeasure() const { return nAutoMeasure; }
595 long GetAutoCount() const { return nAutoCount; }
597 ScDPResultDimension* GetFirstChildDimension() const;
599 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
602 class ScDPDataDimension
604 private:
605 const ScDPResultData* pResultData;
606 const ScDPResultDimension* pResultDimension; // column
607 std::vector<std::unique_ptr<ScDPDataMember>> maMembers;
608 bool bIsDataLayout; //! or ptr to IntDimension?
610 public:
611 ScDPDataDimension( const ScDPResultData* pData );
612 ~ScDPDataDimension();
614 void InitFrom( const ScDPResultDimension* pDim ); // recursive
615 void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
616 const ScDPSubTotalState& rSubState );
617 void FillDataRow(
618 const ScDPResultDimension* pRefDim,
619 ScDPResultFilterContext& rFilterCxt,
620 css::uno::Sequence<css::sheet::DataResult>& rSequence,
621 long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState& rSubState) const;
623 void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
624 const ScDPSubTotalState& rSubState ) const;
625 void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
626 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
627 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const;
629 void SortMembers( ScDPResultDimension* pRefDim );
630 long GetSortedIndex( long nUnsorted ) const;
632 void DoAutoShow( ScDPResultDimension* pRefDim );
634 void ResetResults();
636 #if DUMP_PIVOT_TABLE
637 void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
638 void Dump(int nIndent) const;
639 #endif
641 long GetMemberCount() const;
642 const ScDPDataMember* GetMember(long n) const;
643 ScDPDataMember* GetMember(long n);
647 * This class collects visible members of each dimension and uses that
648 * information to create filtering criteria (e.g. for drill-down data).
650 class ScDPResultVisibilityData
652 public:
653 ScDPResultVisibilityData( ScDPSource* pSource);
654 ~ScDPResultVisibilityData();
656 void addVisibleMember(const OUString& rDimName, const ScDPItemData& rMemberItem);
657 void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const;
659 private:
660 struct MemberHash
662 size_t operator()(const ScDPItemData& r) const;
664 typedef std::unordered_set<ScDPItemData, MemberHash> VisibleMemberType;
665 typedef std::unordered_map<OUString, VisibleMemberType> DimMemberType;
666 DimMemberType maDimensions;
668 ScDPSource* mpSource;
671 #endif
673 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */