1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include "dpfilteredcache.hxx"
24 #include "calcmacros.hxx"
25 #include "dpitemdata.hxx"
26 #include "subtotal.hxx"
28 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
32 #include <unordered_map>
33 #include <unordered_set>
37 namespace com::sun::star::sheet
{ struct DataResult
; }
38 namespace com::sun::star::sheet
{ struct MemberResult
; }
39 namespace com::sun::star::uno
{ template <typename
> class Sequence
; }
45 class ScDPResultMember
;
46 class ScDPResultVisibilityData
;
49 struct ScDPResultFilterContext
;
52 * Member names that are being processed for InitFrom/LateInitFrom (needed
53 * for initialization of grouped items).
60 tools::Long mnSrcIndex
;
63 Member(tools::Long nSrcIndex
, SCROW nNameIndex
);
66 void AddMember(tools::Long nSourceIndex
, SCROW nMember
);
69 const std::vector
<Member
>& GetMembers() const { return maMembers
; }
72 std::vector
<Member
> maMembers
;
75 typedef ::std::vector
<sal_Int32
> ScMemberSortOrder
;
78 * Select subtotal information, passed down the dimensions.
80 struct ScDPSubTotalState
82 ScSubTotalFunc eColForce
;
83 ScSubTotalFunc eRowForce
;
84 tools::Long nColSubTotalFunc
;
85 tools::Long nRowSubTotalFunc
;
88 eColForce( SUBTOTAL_FUNC_NONE
),
89 eRowForce( SUBTOTAL_FUNC_NONE
),
90 nColSubTotalFunc( -1 ),
91 nRowSubTotalFunc( -1 )
96 * indexes when calculating running totals
98 * Col/RowVisible: simple counts from 0 - without sort order applied
99 * - visible index (only used for running total / relative index)
101 * Col/RowSorted: with sort order applied - member index (used otherwise -
102 * so other members' children can be accessed).
104 class ScDPRunningTotalState
107 typedef std::vector
<sal_Int32
> IndexArray
; /// array of sal_Int32 terminated by -1.
109 ScDPRunningTotalState( ScDPResultMember
* pColRoot
, ScDPResultMember
* pRowRoot
);
111 ScDPResultMember
* GetColResRoot() const { return pColResRoot
; }
112 ScDPResultMember
* GetRowResRoot() const { return pRowResRoot
; }
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
;}
119 void AddColIndex( sal_Int32 nVisible
, tools::Long nSorted
);
120 void AddRowIndex( sal_Int32 nVisible
, tools::Long nSorted
);
121 void RemoveColIndex();
122 void RemoveRowIndex();
125 ScDPResultMember
* pColResRoot
;
126 ScDPResultMember
* pRowResRoot
;
128 mutable IndexArray maColVisible
;
129 mutable IndexArray maColSorted
;
130 mutable IndexArray maRowVisible
;
131 mutable IndexArray maRowSorted
;
134 struct ScDPRelativePos
136 tools::Long nBasePos
; // simple count, without sort order applied
137 tools::Long nDirection
;
139 ScDPRelativePos( tools::Long nBase
, tools::Long nDir
);
143 //! separate header file?
145 // Possible values for the nCount member:
146 // (greater than 0 counts the collected values)
147 const sal_Int64 SC_DPAGG_EMPTY
= 0; // empty during data collection
148 const sal_Int64 SC_DPAGG_DATA_ERROR
= -1; // error during data collection
149 const sal_Int64 SC_DPAGG_RESULT_EMPTY
= -2; // empty result calculated
150 const sal_Int64 SC_DPAGG_RESULT_VALID
= -3; // valid result calculated
151 const sal_Int64 SC_DPAGG_RESULT_ERROR
= -4; // error in calculated result
156 WelfordRunner maWelford
;
160 std::unique_ptr
<ScDPAggData
> pChild
;
161 std::vector
<double> mSortedValues
;
164 ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY
) {}
166 void Update( const ScDPValue
& rNext
, ScSubTotalFunc eFunc
, const ScDPSubTotalState
& rSubState
);
167 void Calculate( ScSubTotalFunc eFunc
, const ScDPSubTotalState
& rSubState
);
168 bool IsCalculated() const;
170 double GetResult() const;
171 bool HasError() const;
172 bool HasData() const;
174 void SetResult( double fNew
);
175 void SetEmpty( bool bSet
);
178 double GetAuxiliary() const;
179 void SetAuxiliary( double fNew
);
181 void Reset(); // also deletes children
183 const ScDPAggData
* GetExistingChild() const { return pChild
.get(); }
184 ScDPAggData
* GetChild();
187 void Dump(int nIndent
) const;
191 // Row and grand total state, passed down (column total is at result member)
195 ScDPAggData aRowTotal
;
196 ScDPAggData aGrandTotal
;
203 ScDPAggData
* GetRowTotal( tools::Long nMeasure
);
204 ScDPAggData
* GetGrandTotal( tools::Long nMeasure
);
206 bool IsInColRoot() const { return bIsInColRoot
; }
207 void SetInColRoot(bool bSet
) { bIsInColRoot
= bSet
; }
210 // results for a hierarchy dimension
212 class ScDPResultDimension
;
213 class ScDPDataDimension
;
214 class ScDPDataMember
;
216 #define SC_DPMEASURE_ALL -1
217 #define SC_DPMEASURE_ANY -2
219 struct ScDPParentDimData
221 const SCROW mnOrder
; //! Ref
222 const ScDPDimension
* mpParentDim
; //! Ref
223 const ScDPLevel
* mpParentLevel
; //! Ref
224 const ScDPMember
* mpMemberDesc
; //! Ref
227 ScDPParentDimData(SCROW nIndex
, const ScDPDimension
* pDim
, const ScDPLevel
* pLev
, const ScDPMember
* pMember
);
230 class ResultMembers final
232 std::unordered_map
<SCROW
, ScDPParentDimData
> maMemberHash
;
233 bool mbHasHideDetailsMember
;
235 const ScDPParentDimData
* FindMember( SCROW nIndex
) const;
236 void InsertMember( ScDPParentDimData
const & rNew
);
237 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember
; }
238 void SetHasHideDetailsMembers( bool b
) { mbHasHideDetailsMember
= b
; }
246 const ::std::vector
<ScDPDimension
*>& mppDim
;
247 const ::std::vector
<ScDPLevel
*>& mppLev
;
251 bool mbAllChildren
:1;
253 LateInitParams( const ::std::vector
<ScDPDimension
*>& ppDim
, const ::std::vector
<ScDPLevel
*>& ppLev
,
256 void SetInitChild( bool b
) { mbInitChild
= b
; }
257 void SetInitAllChildren( bool b
) { mbAllChildren
= b
; }
259 ScDPDimension
* GetDim( size_t nPos
) const { return mppDim
[nPos
];}
260 ScDPLevel
* GetLevel( size_t nPos
) const { return mppLev
[nPos
];}
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 ;
269 * The term 'measure' here roughly equals "data dimension" ?
273 ScDPSource
& mrSource
;
274 //! keep things like measure lists here
276 std::vector
<ScSubTotalFunc
> maMeasureFuncs
;
277 std::vector
<css::sheet::DataPilotFieldReference
> maMeasureRefs
;
278 std::vector
<css::sheet::DataPilotFieldOrientation
> maMeasureRefOrients
;
279 std::vector
<OUString
> maMeasureNames
;
285 //! add "displayed values" settings
286 mutable std::vector
<std::unique_ptr
<ResultMembers
>> maDimMembers
;
288 ScDPResultData( ScDPSource
& rSrc
);
292 std::vector
<ScSubTotalFunc
>& rFunctions
,
293 std::vector
<css::sheet::DataPilotFieldReference
>& rRefs
,
294 std::vector
<css::sheet::DataPilotFieldOrientation
>& rRefOrient
,
295 std::vector
<OUString
>& rNames
);
297 void SetDataLayoutOrientation( css::sheet::DataPilotFieldOrientation nOrient
);
298 void SetLateInit( bool bSet
);
300 tools::Long
GetMeasureCount() const { return maMeasureFuncs
.size(); }
301 ScSubTotalFunc
GetMeasureFunction(tools::Long nMeasure
) const;
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;
307 bool IsLateInit() const { return bLateInit
; }
309 tools::Long
GetColStartMeasure() const;
310 tools::Long
GetRowStartMeasure() const;
312 tools::Long
GetCountForMeasure( tools::Long nMeas
) const { return (nMeas
== SC_DPMEASURE_ALL
) ? maMeasureFuncs
.size() : 1; }
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;
322 ResultMembers
& GetDimResultMembers(tools::Long nDim
, const ScDPDimension
* pDim
, ScDPLevel
* pLevel
) const;
324 const ScDPSource
& GetSource() const { return mrSource
;}
327 class ScDPResultMember
330 const ScDPResultData
* pResultData
;
331 ScDPParentDimData aParentDimData
;
332 std::unique_ptr
<ScDPResultDimension
> pChildDimension
;
333 std::unique_ptr
<ScDPDataMember
> pDataRoot
;
335 bool bForceSubTotal
:1;
336 bool bHasHiddenDetails
:1;
339 ScDPAggData aColTotal
; // to store column totals
341 sal_uInt16 nMemberStep
; // step to show details
344 const ScDPResultData
* pData
, const ScDPParentDimData
& rParentDimData
); //! Ref
345 ScDPResultMember( const ScDPResultData
* pData
, bool bForceSub
);
348 void InitFrom( const ::std::vector
<ScDPDimension
*>& ppDim
,
349 const ::std::vector
<ScDPLevel
*>& ppLev
,
351 ScDPInitState
& rInitState
,
352 bool bInitChild
= true );
354 LateInitParams
& rParams
,
355 const ::std::vector
< SCROW
>& pItemData
,
357 ScDPInitState
& rInitState
);
358 void CheckShowEmpty( bool bShow
= false );
359 OUString
GetName() const;
360 OUString
GetDisplayName( bool bLocaleIndependent
) const;
362 ScDPItemData
FillItemData() const;
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;
371 tools::Long
GetSubTotalCount( tools::Long
* pUserSubStart
= nullptr ) const;
373 bool IsNamedItem( SCROW nIndex
) const;
374 bool IsValidEntry( const ::std::vector
< SCROW
>& aMembers
) const;
376 void SetHasElements() { bHasElements
= true; }
377 void SetAutoHidden() { bAutoHidden
= true; }
379 void ProcessData( const ::std::vector
<SCROW
>& aChildMembers
,
380 const ScDPResultDimension
* pDataDim
,
381 const ::std::vector
<SCROW
>& aDataMembers
,
382 const ::std::vector
<ScDPValue
>& aValues
);
383 void FillMemberResults(
384 css::uno::Sequence
< css::sheet::MemberResult
>* pSequences
,
385 tools::Long
& rPos
, tools::Long nMeasure
, bool bRoot
, const OUString
* pMemberName
, const OUString
* pMemberCaption
);
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;
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;
397 void SortMembers( ScDPResultMember
* pRefMember
);
398 void DoAutoShow( ScDPResultMember
* pRefMember
);
403 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
405 void Dump(int nIndent
) const;
408 //! this will be removed!
409 const ScDPResultDimension
* GetChildDimension() const { return pChildDimension
.get(); }
410 ScDPResultDimension
* GetChildDimension() { return pChildDimension
.get(); }
412 ScDPDataMember
* GetDataRoot() const { return pDataRoot
.get(); }
414 const ScDPDimension
* GetParentDim() const { return aParentDimData
.mpParentDim
; } //! Ref
415 const ScDPLevel
* GetParentLevel() const { return aParentDimData
.mpParentLevel
; } //! Ref
416 const ScDPMember
* GetDPMember()const { return aParentDimData
.mpMemberDesc
; } //! Ref
417 SCROW
GetOrder() const { return aParentDimData
.mnOrder
; } //! Ref
418 bool IsRoot() const { return GetParentLevel() == nullptr; }
419 SCROW
GetDataId( ) const ;
420 ScDPAggData
* GetColTotal( tools::Long nMeasure
) const;
422 void FillVisibilityData(ScDPResultVisibilityData
& rData
) const;
428 const ScDPResultData
* pResultData
;
429 const ScDPResultMember
* pResultMember
; //! Ref?
430 std::unique_ptr
<ScDPDataDimension
>
432 ScDPAggData aAggregate
;
434 void UpdateValues( const ::std::vector
<ScDPValue
>& aValues
, const ScDPSubTotalState
& rSubState
);
437 ScDPDataMember( const ScDPResultData
* pData
, const ScDPResultMember
* pRes
);
440 void InitFrom( const ScDPResultDimension
* pDim
);
442 OUString
GetName() const;
443 bool IsVisible() const;
444 bool HasData( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
) const;
446 bool IsNamedItem( SCROW nRow
) const;
447 bool HasHiddenDetails() const;
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
);
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;
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
);
469 void SortMembers( ScDPResultMember
* pRefMember
);
470 void DoAutoShow( ScDPResultMember
* pRefMember
);
475 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
476 void Dump(int nIndent
) const;
479 //! this will be removed!
480 const ScDPDataDimension
* GetChildDimension() const { return pChildDimension
.get(); }
481 ScDPDataDimension
* GetChildDimension() { return pChildDimension
.get(); }
484 // result dimension contains only members
486 class ScDPResultDimension
489 typedef std::vector
<std::unique_ptr
<ScDPResultMember
>> MemberArray
;
490 typedef std::map
<SCROW
, ScDPResultMember
*> MemberHash
;
492 const ScDPResultData
* pResultData
;
493 MemberArray maMemberArray
;
494 MemberHash maMemberHash
;
495 OUString aDimensionName
; //! or ptr to IntDimension?
496 tools::Long nSortMeasure
;
497 ScMemberSortOrder aMemberOrder
; // used when sorted by measure
498 bool bIsDataLayout
:1; //! or ptr to IntDimension?
500 bool bSortAscending
:1;
502 bool bAutoTopItems
:1;
504 tools::Long nAutoMeasure
;
505 tools::Long nAutoCount
;
507 ScDPResultMember
* FindMember( SCROW iData
) const;
508 ScDPResultMember
* AddMember( const ScDPParentDimData
& aData
);
509 ScDPResultMember
* InsertMember( const ScDPParentDimData
* pMemberData
);
510 void InitWithMembers( LateInitParams
& rParams
,
511 const ::std::vector
< SCROW
>& pItemData
,
513 ScDPInitState
& rInitState
);
515 ScDPResultDimension( const ScDPResultData
* pData
);
516 ~ScDPResultDimension();
518 // allocates new members
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
,
525 ScDPInitState
& rInitState
);
526 void CheckShowEmpty( bool bShow
= false );
528 tools::Long
GetSize(tools::Long nMeasure
) const;
530 bool IsValidEntry( const ::std::vector
<SCROW
>& aMembers
) const;
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; //! Test
537 void FillMemberResults( css::uno::Sequence
<
538 css::sheet::MemberResult
>* pSequences
,
539 tools::Long nStart
, tools::Long nMeasure
);
541 void FillDataResults(
542 const ScDPResultMember
* pRefMember
,
543 ScDPResultFilterContext
& rFilterCxt
,
546 css::sheet::DataResult
> >& rSequence
,
547 tools::Long nMeasure
) const;
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;
553 void SortMembers( ScDPResultMember
* pRefMember
);
554 tools::Long
GetSortedIndex( tools::Long nUnsorted
) const;
556 void DoAutoShow( ScDPResultMember
* pRefMember
);
560 // called for the reference dimension
561 ScDPDataMember
* GetRowReferenceMember(
562 const ScDPRelativePos
* pMemberPos
, const OUString
* pName
,
563 const sal_Int32
* pRowIndexes
, const sal_Int32
* pColIndexes
) const;
565 // uses row root member from ScDPRunningTotalState
566 static ScDPDataMember
* GetColReferenceMember(
567 const ScDPRelativePos
* pMemberPos
, const OUString
* pName
,
568 sal_Int32 nRefDimPos
, const ScDPRunningTotalState
& rRunning
);
571 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
572 void Dump(int nIndent
) const;
575 // for ScDPDataDimension::InitFrom
576 tools::Long
GetMemberCount() const;
577 const ScDPResultMember
* GetMember(tools::Long n
) const;
578 ScDPResultMember
* GetMember(tools::Long n
);
580 const ScMemberSortOrder
& GetMemberOrder() const { return aMemberOrder
; }
581 ScMemberSortOrder
& GetMemberOrder() { return aMemberOrder
; }
583 bool IsDataLayout() const { return bIsDataLayout
; }
584 const OUString
& GetName() const { return aDimensionName
; }
586 bool IsSortByData() const { return bSortByData
; }
587 bool IsSortAscending() const { return bSortAscending
; }
588 tools::Long
GetSortMeasure() const { return nSortMeasure
; }
590 bool IsAutoShow() const { return bAutoShow
; }
591 bool IsAutoTopItems() const { return bAutoTopItems
; }
592 tools::Long
GetAutoMeasure() const { return nAutoMeasure
; }
593 tools::Long
GetAutoCount() const { return nAutoCount
; }
595 ScDPResultDimension
* GetFirstChildDimension() const;
597 void FillVisibilityData(ScDPResultVisibilityData
& rData
) const;
600 class ScDPDataDimension
603 const ScDPResultData
* pResultData
;
604 const ScDPResultDimension
* pResultDimension
; // column
605 std::vector
<std::unique_ptr
<ScDPDataMember
>> maMembers
;
606 bool bIsDataLayout
; //! or ptr to IntDimension?
609 ScDPDataDimension( const ScDPResultData
* pData
);
610 ~ScDPDataDimension();
612 void InitFrom( const ScDPResultDimension
* pDim
); // recursive
613 void ProcessData( const ::std::vector
< SCROW
>& aDataMembers
, const ::std::vector
<ScDPValue
>& aValues
,
614 const ScDPSubTotalState
& rSubState
);
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;
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;
627 void SortMembers( ScDPResultDimension
* pRefDim
);
628 tools::Long
GetSortedIndex( tools::Long nUnsorted
) const;
630 void DoAutoShow( ScDPResultDimension
* pRefDim
);
635 void DumpState( const ScDPResultDimension
* pRefDim
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
636 void Dump(int nIndent
) const;
639 tools::Long
GetMemberCount() const;
640 const ScDPDataMember
* GetMember(tools::Long n
) const;
641 ScDPDataMember
* GetMember(tools::Long n
);
645 * This class collects visible members of each dimension and uses that
646 * information to create filtering criteria (e.g. for drill-down data).
648 class ScDPResultVisibilityData
651 ScDPResultVisibilityData( ScDPSource
* pSource
);
652 ~ScDPResultVisibilityData();
654 void addVisibleMember(const OUString
& rDimName
, const ScDPItemData
& rMemberItem
);
655 void fillFieldFilters(::std::vector
<ScDPFilteredCache::Criterion
>& rFilters
) const;
660 size_t operator()(const ScDPItemData
& r
) const;
662 typedef std::unordered_set
<ScDPItemData
, MemberHash
> VisibleMemberType
;
663 typedef std::unordered_map
<OUString
, VisibleMemberType
> DimMemberType
;
664 DimMemberType maDimensions
;
666 ScDPSource
* mpSource
;
669 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */