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
,
257 void SetInitChild( bool b
) { mbInitChild
= b
; }
258 void SetInitAllChildren( bool b
) { mbAllChildren
= b
; }
260 ScDPDimension
* GetDim( size_t nPos
) const { return mppDim
[nPos
];}
261 ScDPLevel
* GetLevel( size_t nPos
) const { return mppLev
[nPos
];}
263 bool GetInitChild() const {return mbInitChild
; }
264 bool GetInitAllChild() const { return mbAllChildren
; }
265 bool IsRow() const { return mbRow
; }
266 bool IsEnd( size_t nPos
) const ;
270 * The term 'measure' here roughly equals "data dimension" ?
274 ScDPSource
& mrSource
;
275 //! keep things like measure lists here
277 std::vector
<ScSubTotalFunc
> maMeasureFuncs
;
278 std::vector
<css::sheet::DataPilotFieldReference
> maMeasureRefs
;
279 std::vector
<css::sheet::DataPilotFieldOrientation
> maMeasureRefOrients
;
280 std::vector
<OUString
> maMeasureNames
;
286 //! add "displayed values" settings
287 mutable std::vector
<std::unique_ptr
<ResultMembers
>> maDimMembers
;
289 ScDPResultData( ScDPSource
& rSrc
);
293 std::vector
<ScSubTotalFunc
>& rFunctions
,
294 std::vector
<css::sheet::DataPilotFieldReference
>& rRefs
,
295 std::vector
<css::sheet::DataPilotFieldOrientation
>& rRefOrient
,
296 std::vector
<OUString
>& rNames
);
298 void SetDataLayoutOrientation( css::sheet::DataPilotFieldOrientation nOrient
);
299 void SetLateInit( bool bSet
);
301 tools::Long
GetMeasureCount() const { return maMeasureFuncs
.size(); }
302 ScSubTotalFunc
GetMeasureFunction(tools::Long nMeasure
) const;
303 OUString
GetMeasureString(tools::Long nMeasure
, bool bForce
, ScSubTotalFunc eForceFunc
, bool& rbTotalResult
) const;
304 OUString
GetMeasureDimensionName(tools::Long nMeasure
) const;
305 const css::sheet::DataPilotFieldReference
& GetMeasureRefVal(tools::Long nMeasure
) const;
306 css::sheet::DataPilotFieldOrientation
GetMeasureRefOrient(tools::Long nMeasure
) const;
308 bool IsLateInit() const { return bLateInit
; }
310 tools::Long
GetColStartMeasure() const;
311 tools::Long
GetRowStartMeasure() const;
313 tools::Long
GetCountForMeasure( tools::Long nMeas
) const { return (nMeas
== SC_DPMEASURE_ALL
) ? maMeasureFuncs
.size() : 1; }
315 bool IsBaseForGroup( tools::Long nDim
) const; // any group
316 tools::Long
GetGroupBase( tools::Long nGroupDim
) const;
317 bool IsNumOrDateGroup( tools::Long nDim
) const;
318 bool IsInGroup( SCROW nGroupDataId
, tools::Long nGroupIndex
,
319 const ScDPItemData
& rBaseData
, tools::Long nBaseIndex
) const;
320 bool HasCommonElement( SCROW nFirstDataId
, tools::Long nFirstIndex
,
321 const ScDPItemData
& rSecondData
, tools::Long nSecondIndex
) const;
323 ResultMembers
& GetDimResultMembers(tools::Long nDim
, const ScDPDimension
* pDim
, ScDPLevel
* pLevel
) const;
325 const ScDPSource
& GetSource() const { return mrSource
;}
328 class ScDPResultMember
331 const ScDPResultData
* pResultData
;
332 ScDPParentDimData aParentDimData
;
333 std::unique_ptr
<ScDPResultDimension
> pChildDimension
;
334 std::unique_ptr
<ScDPDataMember
> pDataRoot
;
336 bool bForceSubTotal
:1;
337 bool bHasHiddenDetails
:1;
340 ScDPAggData aColTotal
; // to store column totals
342 sal_uInt16 nMemberStep
; // step to show details
345 const ScDPResultData
* pData
, const ScDPParentDimData
& rParentDimData
); //! Ref
346 ScDPResultMember( const ScDPResultData
* pData
, bool bForceSub
);
349 void InitFrom( const ::std::vector
<ScDPDimension
*>& ppDim
,
350 const ::std::vector
<ScDPLevel
*>& ppLev
,
352 ScDPInitState
& rInitState
,
353 bool bInitChild
= true );
355 LateInitParams
& rParams
,
356 const ::std::vector
< SCROW
>& pItemData
,
358 ScDPInitState
& rInitState
);
359 void CheckShowEmpty( bool bShow
= false );
360 OUString
GetName() const;
361 OUString
GetDisplayName( bool bLocaleIndependent
) const;
363 ScDPItemData
FillItemData() const;
364 bool IsValid() const;
365 bool IsVisible() const;
366 tools::Long
GetSize(tools::Long nMeasure
) const;
367 // bHasHiddenDetails is set only if the "show details" flag is off,
368 // and there was a child dimension to skip
369 bool HasHiddenDetails() const { return bHasHiddenDetails
; }
370 bool IsSubTotalInTitle(tools::Long nMeasure
) const;
372 tools::Long
GetSubTotalCount( tools::Long
* pUserSubStart
= nullptr ) const;
374 bool IsNamedItem( SCROW nIndex
) const;
375 bool IsValidEntry( const ::std::vector
< SCROW
>& aMembers
) const;
377 void SetHasElements() { bHasElements
= true; }
378 void SetAutoHidden() { bAutoHidden
= true; }
380 void ProcessData( const ::std::vector
<SCROW
>& aChildMembers
,
381 const ScDPResultDimension
* pDataDim
,
382 const ::std::vector
<SCROW
>& aDataMembers
,
383 const ::std::vector
<ScDPValue
>& aValues
);
384 void FillMemberResults(
385 css::uno::Sequence
< css::sheet::MemberResult
>* pSequences
,
386 tools::Long
& rPos
, tools::Long nMeasure
, bool bRoot
, const OUString
* pMemberName
, const OUString
* pMemberCaption
);
388 void FillDataResults(
389 const ScDPResultMember
* pRefMember
,
390 ScDPResultFilterContext
& rFilterCxt
,
391 css::uno::Sequence
< css::uno::Sequence
< css::sheet::DataResult
> >& rSequence
,
392 tools::Long nMeasure
) const;
394 void UpdateDataResults( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
) const;
395 void UpdateRunningTotals( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
,
396 ScDPRunningTotalState
& rRunning
, ScDPRowTotals
& rTotals
) const;
398 void SortMembers( ScDPResultMember
* pRefMember
);
399 void DoAutoShow( ScDPResultMember
* pRefMember
);
404 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
406 void Dump(int nIndent
) const;
409 //! this will be removed!
410 const ScDPResultDimension
* GetChildDimension() const { return pChildDimension
.get(); }
411 ScDPResultDimension
* GetChildDimension() { return pChildDimension
.get(); }
413 ScDPDataMember
* GetDataRoot() const { return pDataRoot
.get(); }
415 const ScDPDimension
* GetParentDim() const { return aParentDimData
.mpParentDim
; } //! Ref
416 const ScDPLevel
* GetParentLevel() const { return aParentDimData
.mpParentLevel
; } //! Ref
417 const ScDPMember
* GetDPMember()const { return aParentDimData
.mpMemberDesc
; } //! Ref
418 SCROW
GetOrder() const { return aParentDimData
.mnOrder
; } //! Ref
419 bool IsRoot() const { return GetParentLevel() == nullptr; }
420 SCROW
GetDataId( ) const ;
421 ScDPAggData
* GetColTotal( tools::Long nMeasure
) const;
423 void FillVisibilityData(ScDPResultVisibilityData
& rData
) const;
429 const ScDPResultData
* pResultData
;
430 const ScDPResultMember
* pResultMember
; //! Ref?
431 std::unique_ptr
<ScDPDataDimension
>
433 ScDPAggData aAggregate
;
435 void UpdateValues( const ::std::vector
<ScDPValue
>& aValues
, const ScDPSubTotalState
& rSubState
);
438 ScDPDataMember( const ScDPResultData
* pData
, const ScDPResultMember
* pRes
);
441 void InitFrom( const ScDPResultDimension
* pDim
);
443 OUString
GetName() const;
444 bool IsVisible() const;
445 bool HasData( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
) const;
447 bool IsNamedItem( SCROW nRow
) const;
448 bool HasHiddenDetails() const;
450 void ProcessData( const ::std::vector
< SCROW
>& aChildMembers
, const ::std::vector
<ScDPValue
>& aValues
,
451 const ScDPSubTotalState
& rSubState
);
452 bool HasError( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
) const;
453 double GetAggregate( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
) const;
454 const ScDPAggData
* GetConstAggData( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
) const;
455 ScDPAggData
* GetAggData( tools::Long nMeasure
, const ScDPSubTotalState
& rSubState
);
458 const ScDPResultMember
* pRefMember
,
459 ScDPResultFilterContext
& rFilterCxt
,
460 css::uno::Sequence
<css::sheet::DataResult
>& rSequence
,
461 tools::Long nMeasure
, bool bIsSubTotalRow
,
462 const ScDPSubTotalState
& rSubState
) const;
464 void UpdateDataRow( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
, bool bIsSubTotalRow
,
465 const ScDPSubTotalState
& rSubState
);
466 void UpdateRunningTotals( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
, bool bIsSubTotalRow
,
467 const ScDPSubTotalState
& rSubState
, ScDPRunningTotalState
& rRunning
,
468 ScDPRowTotals
& rTotals
, const ScDPResultMember
& rRowParent
);
470 void SortMembers( ScDPResultMember
* pRefMember
);
471 void DoAutoShow( ScDPResultMember
* pRefMember
);
476 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
477 void Dump(int nIndent
) const;
480 //! this will be removed!
481 const ScDPDataDimension
* GetChildDimension() const { return pChildDimension
.get(); }
482 ScDPDataDimension
* GetChildDimension() { return pChildDimension
.get(); }
485 // result dimension contains only members
487 class ScDPResultDimension
490 typedef std::vector
<std::unique_ptr
<ScDPResultMember
>> MemberArray
;
491 typedef std::map
<SCROW
, ScDPResultMember
*> MemberHash
;
493 const ScDPResultData
* pResultData
;
494 MemberArray maMemberArray
;
495 MemberHash maMemberHash
;
496 OUString aDimensionName
; //! or ptr to IntDimension?
497 tools::Long nSortMeasure
;
498 ScMemberSortOrder aMemberOrder
; // used when sorted by measure
499 bool bIsDataLayout
:1; //! or ptr to IntDimension?
501 bool bSortAscending
:1;
503 bool bAutoTopItems
:1;
505 tools::Long nAutoMeasure
;
506 tools::Long nAutoCount
;
508 ScDPResultMember
* FindMember( SCROW iData
) const;
509 ScDPResultMember
* AddMember( const ScDPParentDimData
& aData
);
510 ScDPResultMember
* InsertMember( const ScDPParentDimData
* pMemberData
);
511 void InitWithMembers( LateInitParams
& rParams
,
512 const ::std::vector
< SCROW
>& pItemData
,
514 ScDPInitState
& rInitState
);
516 ScDPResultDimension( const ScDPResultData
* pData
);
517 ~ScDPResultDimension();
519 // allocates new members
521 const ::std::vector
<ScDPDimension
*>& ppDim
, const ::std::vector
<ScDPLevel
*>& ppLev
,
522 size_t nPos
, ScDPInitState
& rInitState
, bool bInitChild
= true );
523 void LateInitFrom( LateInitParams
& rParams
,
524 const ::std::vector
< SCROW
>& pItemData
,
526 ScDPInitState
& rInitState
);
527 void CheckShowEmpty( bool bShow
= false );
529 tools::Long
GetSize(tools::Long nMeasure
) const;
531 bool IsValidEntry( const ::std::vector
<SCROW
>& aMembers
) const;
533 // modifies existing members, allocates data dimensions
534 void ProcessData( const ::std::vector
<SCROW
>& aMembers
,
535 const ScDPResultDimension
* pDataDim
,
536 const ::std::vector
<SCROW
>& aDataMembers
,
537 const ::std::vector
<ScDPValue
>& aValues
) const; //! Test
538 void FillMemberResults( css::uno::Sequence
<
539 css::sheet::MemberResult
>* pSequences
,
540 tools::Long nStart
, tools::Long nMeasure
);
542 void FillDataResults(
543 const ScDPResultMember
* pRefMember
,
544 ScDPResultFilterContext
& rFilterCxt
,
547 css::sheet::DataResult
> >& rSequence
,
548 tools::Long nMeasure
) const;
550 void UpdateDataResults( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
) const;
551 void UpdateRunningTotals( const ScDPResultMember
* pRefMember
, tools::Long nMeasure
,
552 ScDPRunningTotalState
& rRunning
, ScDPRowTotals
& rTotals
) const;
554 void SortMembers( ScDPResultMember
* pRefMember
);
555 tools::Long
GetSortedIndex( tools::Long nUnsorted
) const;
557 void DoAutoShow( ScDPResultMember
* pRefMember
);
561 // called for the reference dimension
562 ScDPDataMember
* GetRowReferenceMember(
563 const ScDPRelativePos
* pMemberPos
, const OUString
* pName
,
564 const sal_Int32
* pRowIndexes
, const sal_Int32
* pColIndexes
) const;
566 // uses row root member from ScDPRunningTotalState
567 static ScDPDataMember
* GetColReferenceMember(
568 const ScDPRelativePos
* pMemberPos
, const OUString
* pName
,
569 sal_Int32 nRefDimPos
, const ScDPRunningTotalState
& rRunning
);
572 void DumpState( const ScDPResultMember
* pRefMember
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
573 void Dump(int nIndent
) const;
576 // for ScDPDataDimension::InitFrom
577 tools::Long
GetMemberCount() const;
578 const ScDPResultMember
* GetMember(tools::Long n
) const;
579 ScDPResultMember
* GetMember(tools::Long n
);
581 const ScMemberSortOrder
& GetMemberOrder() const { return aMemberOrder
; }
582 ScMemberSortOrder
& GetMemberOrder() { return aMemberOrder
; }
584 bool IsDataLayout() const { return bIsDataLayout
; }
585 const OUString
& GetName() const { return aDimensionName
; }
587 bool IsSortByData() const { return bSortByData
; }
588 bool IsSortAscending() const { return bSortAscending
; }
589 tools::Long
GetSortMeasure() const { return nSortMeasure
; }
591 bool IsAutoShow() const { return bAutoShow
; }
592 bool IsAutoTopItems() const { return bAutoTopItems
; }
593 tools::Long
GetAutoMeasure() const { return nAutoMeasure
; }
594 tools::Long
GetAutoCount() const { return nAutoCount
; }
596 ScDPResultDimension
* GetFirstChildDimension() const;
598 void FillVisibilityData(ScDPResultVisibilityData
& rData
) const;
601 class ScDPDataDimension
604 const ScDPResultData
* pResultData
;
605 const ScDPResultDimension
* pResultDimension
; // column
606 std::vector
<std::unique_ptr
<ScDPDataMember
>> maMembers
;
607 bool bIsDataLayout
; //! or ptr to IntDimension?
610 ScDPDataDimension( const ScDPResultData
* pData
);
611 ~ScDPDataDimension();
613 void InitFrom( const ScDPResultDimension
* pDim
); // recursive
614 void ProcessData( const ::std::vector
< SCROW
>& aDataMembers
, const ::std::vector
<ScDPValue
>& aValues
,
615 const ScDPSubTotalState
& rSubState
);
617 const ScDPResultDimension
* pRefDim
,
618 ScDPResultFilterContext
& rFilterCxt
,
619 css::uno::Sequence
<css::sheet::DataResult
>& rSequence
,
620 tools::Long nMeasure
, bool bIsSubTotalRow
, const ScDPSubTotalState
& rSubState
) const;
622 void UpdateDataRow( const ScDPResultDimension
* pRefDim
, tools::Long nMeasure
, bool bIsSubTotalRow
,
623 const ScDPSubTotalState
& rSubState
) const;
624 void UpdateRunningTotals( const ScDPResultDimension
* pRefDim
, tools::Long nMeasure
, bool bIsSubTotalRow
,
625 const ScDPSubTotalState
& rSubState
, ScDPRunningTotalState
& rRunning
,
626 ScDPRowTotals
& rTotals
, const ScDPResultMember
& rRowParent
) const;
628 void SortMembers( ScDPResultDimension
* pRefDim
);
629 tools::Long
GetSortedIndex( tools::Long nUnsorted
) const;
631 void DoAutoShow( ScDPResultDimension
* pRefDim
);
636 void DumpState( const ScDPResultDimension
* pRefDim
, ScDocument
* pDoc
, ScAddress
& rPos
) const;
637 void Dump(int nIndent
) const;
640 tools::Long
GetMemberCount() const;
641 const ScDPDataMember
* GetMember(tools::Long n
) const;
642 ScDPDataMember
* GetMember(tools::Long n
);
646 * This class collects visible members of each dimension and uses that
647 * information to create filtering criteria (e.g. for drill-down data).
649 class ScDPResultVisibilityData
652 ScDPResultVisibilityData( ScDPSource
* pSource
);
653 ~ScDPResultVisibilityData();
655 void addVisibleMember(const OUString
& rDimName
, const ScDPItemData
& rMemberItem
);
656 void fillFieldFilters(::std::vector
<ScDPFilteredCache::Criterion
>& rFilters
) const;
661 size_t operator()(const ScDPItemData
& r
) const;
663 typedef std::unordered_set
<ScDPItemData
, MemberHash
> VisibleMemberType
;
664 typedef std::unordered_map
<OUString
, VisibleMemberType
> DimMemberType
;
665 DimMemberType maDimensions
;
667 ScDPSource
* mpSource
;
670 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */