Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / dptabres.hxx
blobbdd64a14043203b3c14f15bee1e369a5dfe5d431
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"
27 #include <com/sun/star/sheet/MemberResult.hpp>
28 #include <com/sun/star/sheet/DataResult.hpp>
29 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
30 #include <com/sun/star/uno/Sequence.hxx>
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 {
39 struct DataPilotFieldReference;
40 } } } }
42 class ScDPSource;
43 class ScDPDimension;
44 class ScDPLevel;
45 class ScDPMember;
46 class ScDPResultMember;
47 class ScDPResultVisibilityData;
49 struct ScDPValue;
50 class ScDPItemData;
51 struct ScDPResultFilterContext;
53 /**
54 * Member names that are being processed for InitFrom/LateInitFrom (needed
55 * for initialization of grouped items).
57 class ScDPInitState
59 public:
60 struct Member
62 long mnSrcIndex;
63 SCROW mnNameIndex;
65 Member(long nSrcIndex, SCROW nNameIndex);
68 void AddMember(long nSourceIndex, SCROW nMember);
69 void RemoveMember();
71 const std::vector<Member>& GetMembers() const { return maMembers; }
73 private:
74 std::vector<Member> maMembers;
77 typedef ::std::vector<sal_Int32> ScMemberSortOrder;
79 /**
80 * Select subtotal information, passed down the dimensions.
82 struct ScDPSubTotalState
84 ScSubTotalFunc eColForce;
85 ScSubTotalFunc eRowForce;
86 long nColSubTotalFunc;
87 long nRowSubTotalFunc;
89 ScDPSubTotalState() :
90 eColForce( SUBTOTAL_FUNC_NONE ),
91 eRowForce( SUBTOTAL_FUNC_NONE ),
92 nColSubTotalFunc( -1 ),
93 nRowSubTotalFunc( -1 )
97 /**
98 * indexes when calculating running totals
100 * Col/RowVisible: simple counts from 0 - without sort order applied
101 * - visible index (only used for running total / relative index)
103 * Col/RowSorted: with sort order applied - member index (used otherwise -
104 * so other members' children can be accessed).
106 class ScDPRunningTotalState
108 public:
109 typedef std::vector<long> IndexArray; /// array of long integers terminated by -1.
111 ScDPRunningTotalState( ScDPResultMember* pColRoot, ScDPResultMember* pRowRoot );
113 ScDPResultMember* GetColResRoot() const { return pColResRoot; }
114 ScDPResultMember* GetRowResRoot() const { return pRowResRoot; }
116 const IndexArray& GetColVisible() const { return maColVisible;}
117 const IndexArray& GetColSorted() const { return maColSorted;}
118 const IndexArray& GetRowVisible() const { return maRowVisible;}
119 const IndexArray& GetRowSorted() const { return maRowSorted;}
121 void AddColIndex( long nVisible, long nSorted );
122 void AddRowIndex( long nVisible, long nSorted );
123 void RemoveColIndex();
124 void RemoveRowIndex();
126 private:
127 ScDPResultMember* pColResRoot;
128 ScDPResultMember* pRowResRoot;
130 mutable IndexArray maColVisible;
131 mutable IndexArray maColSorted;
132 mutable IndexArray maRowVisible;
133 mutable IndexArray maRowSorted;
136 struct ScDPRelativePos
138 long nBasePos; // simple count, without sort order applied
139 long nDirection;
141 ScDPRelativePos( long nBase, long nDir );
144 // aggregated data
145 //! separate header file?
147 // Possible values for the nCount member:
148 // (greater than 0 counts the collected values)
149 const long SC_DPAGG_EMPTY = 0; // empty during data collection
150 const long SC_DPAGG_DATA_ERROR = -1; // error during data collection
151 const long SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated
152 const long SC_DPAGG_RESULT_VALID = -3; // valid result calculated
153 const long SC_DPAGG_RESULT_ERROR = -4; // error in calculated result
155 class ScDPAggData
157 private:
158 double fVal;
159 double fAux;
160 long 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), pChild(nullptr) {}
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 MemberHashIndexFunc
222 size_t operator() (SCROW rDataIndex) const { return rDataIndex; }
225 struct ScDPParentDimData
227 const SCROW mnOrder; //! Ref
228 const ScDPDimension* mpParentDim; //! Ref
229 const ScDPLevel* mpParentLevel; //! Ref
230 const ScDPMember* mpMemberDesc; //! Ref
232 ScDPParentDimData();
233 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
236 typedef std::unordered_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash;
238 class ResultMembers final
240 DimMemberHash maMemberHash;
241 bool mbHasHideDetailsMember;
242 public:
243 ScDPParentDimData* FindMember( SCROW nIndex ) const;
244 void InsertMember( ScDPParentDimData* pNew );
245 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
246 void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
247 ResultMembers();
248 ~ResultMembers();
251 class LateInitParams
253 private:
254 const ::std::vector<ScDPDimension*>& mppDim;
255 const ::std::vector<ScDPLevel*>& mppLev;
257 bool mbRow:1;
258 bool mbInitChild:1;
259 bool mbAllChildren:1;
260 public:
261 LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
262 bool bRow);
263 ~LateInitParams();
265 void SetInitChild( bool b ) { mbInitChild = b; }
266 void SetInitAllChildren( bool b ) { mbAllChildren = b; }
268 ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
269 ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
271 bool GetInitChild() const {return mbInitChild; }
272 bool GetInitAllChild() const { return mbAllChildren; }
273 bool IsRow() const { return mbRow; }
274 bool IsEnd( size_t nPos ) const ;
278 * The term 'measure' here roughly equals "data dimension" ?
280 class ScDPResultData
282 ScDPSource& mrSource;
283 //! keep things like measure lists here
285 std::vector<ScSubTotalFunc> maMeasureFuncs;
286 std::vector<css::sheet::DataPilotFieldReference> maMeasureRefs;
287 std::vector<css::sheet::DataPilotFieldOrientation> maMeasureRefOrients;
288 std::vector<OUString> maMeasureNames;
290 bool bLateInit:1;
291 bool bDataAtCol:1;
292 bool bDataAtRow:1;
294 //! add "displayed values" settings
295 mutable std::vector<ResultMembers*> maDimMembers;
296 public:
297 ScDPResultData( ScDPSource& rSrc );
298 ~ScDPResultData();
300 void SetMeasureData(
301 std::vector<ScSubTotalFunc>& rFunctions,
302 std::vector<css::sheet::DataPilotFieldReference>& rRefs,
303 std::vector<css::sheet::DataPilotFieldOrientation>& rRefOrient,
304 std::vector<OUString>& rNames );
306 void SetDataLayoutOrientation( css::sheet::DataPilotFieldOrientation nOrient );
307 void SetLateInit( bool bSet );
309 long GetMeasureCount() const { return maMeasureFuncs.size(); }
310 ScSubTotalFunc GetMeasureFunction(long nMeasure) const;
311 OUString GetMeasureString(long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const;
312 OUString GetMeasureDimensionName(long nMeasure) const;
313 const css::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const;
314 css::sheet::DataPilotFieldOrientation GetMeasureRefOrient(long nMeasure) const;
316 bool IsLateInit() const { return bLateInit; }
318 long GetColStartMeasure() const;
319 long GetRowStartMeasure() const;
321 long GetCountForMeasure( long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
323 bool IsBaseForGroup( long nDim ) const; // any group
324 long GetGroupBase( long nGroupDim ) const;
325 bool IsNumOrDateGroup( long nDim ) const;
326 bool IsInGroup( SCROW nGroupDataId, long nGroupIndex,
327 const ScDPItemData& rBaseData, long nBaseIndex ) const;
328 bool HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
329 const ScDPItemData& rSecondData, long nSecondIndex ) const;
331 ResultMembers* GetDimResultMembers(long nDim, const ScDPDimension* pDim, ScDPLevel* pLevel) const;
333 const ScDPSource& GetSource() const { return mrSource;}
336 class ScDPResultMember
338 private:
339 const ScDPResultData* pResultData;
340 ScDPParentDimData aParentDimData;
341 std::unique_ptr<ScDPResultDimension> pChildDimension;
342 std::unique_ptr<ScDPDataMember> pDataRoot;
343 bool bHasElements:1;
344 bool bForceSubTotal:1;
345 bool bHasHiddenDetails:1;
346 bool bInitialized:1;
347 bool bAutoHidden:1;
348 ScDPAggData aColTotal; // to store column totals
350 sal_uInt16 nMemberStep; // step to show details
351 public:
352 ScDPResultMember(
353 const ScDPResultData* pData, const ScDPParentDimData& rParentDimData ); //! Ref
354 ScDPResultMember( const ScDPResultData* pData, bool bForceSub );
355 ~ScDPResultMember();
357 void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
358 const ::std::vector<ScDPLevel*>& ppLev,
359 size_t nPos,
360 ScDPInitState& rInitState,
361 bool bInitChild = true );
362 void LateInitFrom(
363 LateInitParams& rParams,
364 const ::std::vector< SCROW >& pItemData,
365 size_t nPos,
366 ScDPInitState& rInitState);
367 void CheckShowEmpty( bool bShow = false );
368 OUString GetName() const;
369 OUString GetDisplayName( bool bLocaleIndependent ) const;
371 ScDPItemData FillItemData() const;
372 bool IsValid() const;
373 bool IsVisible() const;
374 long GetSize(long nMeasure) const;
375 // bHasHiddenDetails is set only if the "show details" flag is off,
376 // and there was a child dimension to skip
377 bool HasHiddenDetails() const { return bHasHiddenDetails; }
378 bool IsSubTotalInTitle(long nMeasure) const;
380 long GetSubTotalCount( long* pUserSubStart = nullptr ) const;
382 bool IsNamedItem( SCROW nIndex ) const;
383 bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
385 void SetHasElements() { bHasElements = true; }
386 void SetAutoHidden() { bAutoHidden = true; }
388 void ProcessData( const ::std::vector<SCROW>& aChildMembers,
389 const ScDPResultDimension* pDataDim,
390 const ::std::vector<SCROW>& aDataMembers,
391 const ::std::vector<ScDPValue>& aValues );
392 void FillMemberResults(
393 css::uno::Sequence< css::sheet::MemberResult>* pSequences,
394 long& rPos, long nMeasure, bool bRoot, const OUString* pMemberName, const OUString* pMemberCaption );
396 void FillDataResults(
397 const ScDPResultMember* pRefMember,
398 ScDPResultFilterContext& rFilterCxt,
399 css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> >& rSequence,
400 long nMeasure) const;
402 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
403 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
404 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
406 void SortMembers( ScDPResultMember* pRefMember );
407 void DoAutoShow( ScDPResultMember* pRefMember );
409 void ResetResults();
411 #if DUMP_PIVOT_TABLE
412 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
414 void Dump(int nIndent) const;
415 #endif
417 //! this will be removed!
418 const ScDPResultDimension* GetChildDimension() const { return pChildDimension.get(); }
419 ScDPResultDimension* GetChildDimension() { return pChildDimension.get(); }
421 ScDPDataMember* GetDataRoot() const { return pDataRoot.get(); }
423 const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
424 const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
425 const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref
426 SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref
427 bool IsRoot() const { return GetParentLevel() == nullptr; }
428 SCROW GetDataId( ) const ;
429 ScDPAggData* GetColTotal( long nMeasure ) const;
431 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
434 class ScDPDataMember
436 private:
437 const ScDPResultData* pResultData;
438 const ScDPResultMember* pResultMember; //! Ref?
439 std::unique_ptr<ScDPDataDimension>
440 pChildDimension;
441 ScDPAggData aAggregate;
443 void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
445 public:
446 ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
447 ~ScDPDataMember();
449 void InitFrom( const ScDPResultDimension* pDim );
451 OUString GetName() const;
452 bool IsVisible() const;
453 bool HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
455 bool IsNamedItem( SCROW nRow ) const;
456 bool HasHiddenDetails() const;
458 void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
459 const ScDPSubTotalState& rSubState );
460 bool HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
461 double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
462 const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
463 ScDPAggData* GetAggData( long nMeasure, const ScDPSubTotalState& rSubState );
465 void FillDataRow(
466 const ScDPResultMember* pRefMember,
467 ScDPResultFilterContext& rFilterCxt,
468 css::uno::Sequence<css::sheet::DataResult>& rSequence,
469 long nMeasure, bool bIsSubTotalRow,
470 const ScDPSubTotalState& rSubState) const;
472 void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
473 const ScDPSubTotalState& rSubState );
474 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
475 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
476 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent );
478 void SortMembers( ScDPResultMember* pRefMember );
479 void DoAutoShow( ScDPResultMember* pRefMember );
481 void ResetResults();
483 #if DUMP_PIVOT_TABLE
484 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
485 void Dump(int nIndent) const;
486 #endif
488 //! this will be removed!
489 const ScDPDataDimension* GetChildDimension() const { return pChildDimension.get(); }
490 ScDPDataDimension* GetChildDimension() { return pChildDimension.get(); }
493 typedef std::vector<ScDPDataMember*> ScDPDataMembers;
495 // result dimension contains only members
497 class ScDPResultDimension
499 public:
500 typedef std::vector<std::unique_ptr<ScDPResultMember>> MemberArray;
501 typedef std::map<SCROW, ScDPResultMember*> MemberHash;
502 private:
503 const ScDPResultData* pResultData;
504 MemberArray maMemberArray;
505 MemberHash maMemberHash;
506 OUString aDimensionName; //! or ptr to IntDimension?
507 long nSortMeasure;
508 ScMemberSortOrder aMemberOrder; // used when sorted by measure
509 bool bIsDataLayout:1; //! or ptr to IntDimension?
510 bool bSortByData:1;
511 bool bSortAscending:1;
512 bool bAutoShow:1;
513 bool bAutoTopItems:1;
514 bool bInitialized:1;
515 long nAutoMeasure;
516 long nAutoCount;
518 ScDPResultMember* FindMember( SCROW iData ) const;
519 ScDPResultMember* AddMember( const ScDPParentDimData& aData );
520 ScDPResultMember* InsertMember( const ScDPParentDimData* pMemberData );
521 void InitWithMembers( LateInitParams& rParams,
522 const ::std::vector< SCROW >& pItemData,
523 size_t nPos,
524 ScDPInitState& rInitState );
525 public:
526 ScDPResultDimension( const ScDPResultData* pData );
527 ~ScDPResultDimension();
529 // allocates new members
530 void InitFrom(
531 const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
532 size_t nPos, ScDPInitState& rInitState, bool bInitChild = true );
533 void LateInitFrom( LateInitParams& rParams,
534 const ::std::vector< SCROW >& pItemData,
535 size_t nPos,
536 ScDPInitState& rInitState );
537 void CheckShowEmpty( bool bShow = false );
539 long GetSize(long nMeasure) const;
541 bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
543 // modifies existing members, allocates data dimensions
544 void ProcessData( const ::std::vector<SCROW>& aMembers,
545 const ScDPResultDimension* pDataDim,
546 const ::std::vector<SCROW>& aDataMembers,
547 const ::std::vector<ScDPValue>& aValues ) const; //! Test
548 void FillMemberResults( css::uno::Sequence<
549 css::sheet::MemberResult>* pSequences,
550 long nStart, long nMeasure );
552 void FillDataResults(
553 const ScDPResultMember* pRefMember,
554 ScDPResultFilterContext& rFilterCxt,
555 css::uno::Sequence<
556 css::uno::Sequence<
557 css::sheet::DataResult> >& rSequence,
558 long nMeasure) const;
560 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
561 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
562 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
564 void SortMembers( ScDPResultMember* pRefMember );
565 long GetSortedIndex( long nUnsorted ) const;
567 void DoAutoShow( ScDPResultMember* pRefMember );
569 void ResetResults();
571 // called for the reference dimension
572 ScDPDataMember* GetRowReferenceMember(
573 const ScDPRelativePos* pMemberPos, const OUString* pName,
574 const long* pRowIndexes, const long* pColIndexes ) const;
576 // uses row root member from ScDPRunningTotalState
577 static ScDPDataMember* GetColReferenceMember(
578 const ScDPRelativePos* pMemberPos, const OUString* pName,
579 long nRefDimPos, const ScDPRunningTotalState& rRunning );
581 #if DUMP_PIVOT_TABLE
582 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
583 void Dump(int nIndent) const;
584 #endif
586 // for ScDPDataDimension::InitFrom
587 long GetMemberCount() const;
588 const ScDPResultMember* GetMember(long n) const;
589 ScDPResultMember* GetMember(long n);
591 const ScMemberSortOrder& GetMemberOrder() const { return aMemberOrder; }
592 ScMemberSortOrder& GetMemberOrder() { return aMemberOrder; }
594 bool IsDataLayout() const { return bIsDataLayout; }
595 const OUString& GetName() const { return aDimensionName; }
597 bool IsSortByData() const { return bSortByData; }
598 bool IsSortAscending() const { return bSortAscending; }
599 long GetSortMeasure() const { return nSortMeasure; }
601 bool IsAutoShow() const { return bAutoShow; }
602 bool IsAutoTopItems() const { return bAutoTopItems; }
603 long GetAutoMeasure() const { return nAutoMeasure; }
604 long GetAutoCount() const { return nAutoCount; }
606 ScDPResultDimension* GetFirstChildDimension() const;
608 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
611 class ScDPDataDimension
613 private:
614 const ScDPResultData* pResultData;
615 const ScDPResultDimension* pResultDimension; // column
616 ScDPDataMembers maMembers;
617 bool bIsDataLayout; //! or ptr to IntDimension?
619 public:
620 ScDPDataDimension( const ScDPResultData* pData );
621 ~ScDPDataDimension();
623 void InitFrom( const ScDPResultDimension* pDim ); // recursive
624 void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
625 const ScDPSubTotalState& rSubState );
626 void FillDataRow(
627 const ScDPResultDimension* pRefDim,
628 ScDPResultFilterContext& rFilterCxt,
629 css::uno::Sequence<css::sheet::DataResult>& rSequence,
630 long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState& rSubState) const;
632 void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
633 const ScDPSubTotalState& rSubState ) const;
634 void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
635 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
636 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const;
638 void SortMembers( ScDPResultDimension* pRefDim );
639 long GetSortedIndex( long nUnsorted ) const;
641 void DoAutoShow( ScDPResultDimension* pRefDim );
643 void ResetResults();
645 #if DUMP_PIVOT_TABLE
646 void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
647 void Dump(int nIndent) const;
648 #endif
650 long GetMemberCount() const;
651 const ScDPDataMember* GetMember(long n) const;
652 ScDPDataMember* GetMember(long n);
656 * This class collects visible members of each dimension and uses that
657 * information to create filtering criteria (e.g. for drill-down data).
659 class ScDPResultVisibilityData
661 public:
662 ScDPResultVisibilityData( ScDPSource* pSource);
663 ~ScDPResultVisibilityData();
665 void addVisibleMember(const OUString& rDimName, const ScDPItemData& rMemberItem);
666 void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const;
668 private:
669 struct MemberHash
671 size_t operator()(const ScDPItemData& r) const;
673 typedef std::unordered_set<ScDPItemData, MemberHash> VisibleMemberType;
674 typedef std::unordered_map<OUString, VisibleMemberType> DimMemberType;
675 DimMemberType maDimensions;
677 ScDPSource* mpSource;
680 #endif
682 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */