update credits
[LibreOffice.git] / sc / inc / dptabres.hxx
blobe0085da3072bdda930308e8d0f4307c623a3f12d
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/uno/Sequence.hxx>
31 #include <map>
32 #include <unordered_map>
33 #include <unordered_set>
34 #include <vector>
36 namespace com { namespace sun { namespace star { namespace sheet {
37 struct DataPilotFieldReference;
38 } } } }
40 class ScAddress;
41 class ScDocument;
42 class ScDPSource;
43 class ScDPDimension;
44 class ScDPLevel;
45 class ScDPMember;
46 class ScDPAggData;
47 class ScDPResultMember;
48 class ScDPResultVisibilityData;
50 struct ScDPValue;
51 class ScDPItemData;
52 struct ScDPResultFilterContext;
54 /**
55 * Member names that are being processed for InitFrom/LateInitFrom (needed
56 * for initialization of grouped items).
58 class ScDPInitState
60 public:
61 struct Member
63 long mnSrcIndex;
64 SCROW mnNameIndex;
66 Member(long nSrcIndex, SCROW nNameIndex);
69 void AddMember(long nSourceIndex, SCROW nMember);
70 void RemoveMember();
72 const std::vector<Member>& GetMembers() const { return maMembers; }
74 private:
75 std::vector<Member> maMembers;
78 typedef ::std::vector<sal_Int32> ScMemberSortOrder;
80 /**
81 * Select subtotal information, passed down the dimensions.
83 struct ScDPSubTotalState
85 ScSubTotalFunc eColForce;
86 ScSubTotalFunc eRowForce;
87 long nColSubTotalFunc;
88 long nRowSubTotalFunc;
90 ScDPSubTotalState() :
91 eColForce( SUBTOTAL_FUNC_NONE ),
92 eRowForce( SUBTOTAL_FUNC_NONE ),
93 nColSubTotalFunc( -1 ),
94 nRowSubTotalFunc( -1 )
98 /**
99 * indexes when calculating running totals
101 * Col/RowVisible: simple counts from 0 - without sort order applied
102 * - visible index (only used for running total / relative index)
104 * Col/RowSorted: with sort order applied - member index (used otherwise -
105 * so other members' children can be accessed).
107 class ScDPRunningTotalState
109 public:
110 typedef std::vector<long> IndexArray; /// array of long integers terminated by -1.
112 ScDPRunningTotalState( ScDPResultMember* pColRoot, ScDPResultMember* pRowRoot );
114 ScDPResultMember* GetColResRoot() const { return pColResRoot; }
115 ScDPResultMember* GetRowResRoot() const { return pRowResRoot; }
117 const IndexArray& GetColVisible() const { return maColVisible;}
118 const IndexArray& GetColSorted() const { return maColSorted;}
119 const IndexArray& GetRowVisible() const { return maRowVisible;}
120 const IndexArray& GetRowSorted() const { return maRowSorted;}
122 void AddColIndex( long nVisible, long nSorted );
123 void AddRowIndex( long nVisible, long nSorted );
124 void RemoveColIndex();
125 void RemoveRowIndex();
127 private:
128 ScDPResultMember* pColResRoot;
129 ScDPResultMember* pRowResRoot;
131 mutable IndexArray maColVisible;
132 mutable IndexArray maColSorted;
133 mutable IndexArray maRowVisible;
134 mutable IndexArray maRowSorted;
137 struct ScDPRelativePos
139 long nBasePos; // simple count, without sort order applied
140 long nDirection;
142 ScDPRelativePos( long nBase, long nDir );
145 // aggregated data
146 //! separate header file?
148 // Possible values for the nCount member:
149 // (greater than 0 counts the collected values)
150 const long SC_DPAGG_EMPTY = 0; // empty during data collection
151 const long SC_DPAGG_DATA_ERROR = -1; // error during data collection
152 const long SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated
153 const long SC_DPAGG_RESULT_VALID = -3; // valid result calculated
154 const long SC_DPAGG_RESULT_ERROR = -4; // error in calculated result
156 class ScDPAggData
158 private:
159 double fVal;
160 double fAux;
161 long nCount;
162 ScDPAggData* pChild;
164 public:
165 ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(NULL) {}
166 ~ScDPAggData() { delete pChild; }
168 void Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
169 void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
170 bool IsCalculated() const;
172 double GetResult() const;
173 bool HasError() const;
174 bool HasData() const;
176 void SetResult( double fNew );
177 void SetEmpty( bool bSet );
178 void SetError();
180 double GetAuxiliary() const;
181 void SetAuxiliary( double fNew );
183 void Reset(); // also deletes children
185 const ScDPAggData* GetExistingChild() const { return pChild; }
186 ScDPAggData* GetChild();
188 #if DEBUG_PIVOT_TABLE
189 void Dump(int nIndent) const;
190 #endif
193 // Row and grand total state, passed down (column total is at result member)
195 class ScDPRowTotals
197 ScDPAggData aRowTotal;
198 ScDPAggData aGrandTotal;
199 bool bIsInColRoot;
201 public:
202 ScDPRowTotals();
203 ~ScDPRowTotals();
205 ScDPAggData* GetRowTotal( long nMeasure );
206 ScDPAggData* GetGrandTotal( long nMeasure );
208 bool IsInColRoot() const { return bIsInColRoot; }
209 void SetInColRoot(bool bSet) { bIsInColRoot = bSet; }
212 // results for a hierarchy dimension
214 class ScDPResultDimension;
215 class ScDPDataDimension;
216 class ScDPDataMember;
218 #define SC_DPMEASURE_ALL -1
219 #define SC_DPMEASURE_ANY -2
221 struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t >
223 size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; }
226 struct ScDPParentDimData
228 const SCROW mnOrder; //! Ref
229 const ScDPDimension* mpParentDim; //! Ref
230 const ScDPLevel* mpParentLevel; //! Ref
231 const ScDPMember* mpMemberDesc; //! Ref
233 ScDPParentDimData();
234 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
237 typedef std::unordered_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash;
239 class ResultMembers
241 DimMemberHash maMemberHash;
242 bool mbHasHideDetailsMember;
243 public:
244 ScDPParentDimData* FindMember( SCROW nIndex ) const;
245 void InsertMember( ScDPParentDimData* pNew );
246 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
247 void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
248 ResultMembers();
249 virtual ~ResultMembers();
252 class LateInitParams
254 private:
255 const ::std::vector<ScDPDimension*>& mppDim;
256 const ::std::vector<ScDPLevel*>& mppLev;
258 bool mbRow:1;
259 bool mbInitChild:1;
260 bool mbAllChildren:1;
261 public:
262 LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
263 bool bRow, bool bInitChild = true, bool bAllChildren = false);
264 ~LateInitParams();
266 void SetInitChild( bool b ) { mbInitChild = b; }
267 void SetInitAllChildren( bool b ) { mbAllChildren = b; }
269 inline ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
270 inline ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
272 bool GetInitChild() const {return mbInitChild; }
273 bool GetInitAllChild() const { return mbAllChildren; }
274 bool IsRow() const { return mbRow; }
275 bool IsEnd( size_t nPos ) const ;
279 * The term 'measure' here roughly equals "data dimension" ?
281 class ScDPResultData
283 ScDPSource& mrSource;
284 //! keep things like measure lists here
286 std::vector<ScSubTotalFunc> maMeasureFuncs;
287 std::vector<com::sun::star::sheet::DataPilotFieldReference> maMeasureRefs;
288 std::vector<sal_uInt16> maMeasureRefOrients;
289 std::vector<OUString> maMeasureNames;
291 bool bLateInit:1;
292 bool bDataAtCol:1;
293 bool bDataAtRow:1;
295 //! add "displayed values" settings
296 mutable std::vector<ResultMembers*> maDimMembers;
297 public:
298 ScDPResultData( ScDPSource& rSrc );
299 ~ScDPResultData();
301 void SetMeasureData(
302 std::vector<ScSubTotalFunc>& rFunctions,
303 std::vector<com::sun::star::sheet::DataPilotFieldReference>& rRefs,
304 std::vector<sal_uInt16>& rRefOrient, std::vector<OUString>& rNames );
306 void SetDataLayoutOrientation( sal_uInt16 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 ::com::sun::star::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const;
314 sal_uInt16 GetMeasureRefOrient(long nMeasure) const;
316 bool IsDataAtCol() const { return bDataAtCol; }
317 bool IsDataAtRow() const { return bDataAtRow; }
318 bool IsLateInit() const { return bLateInit; }
320 long GetColStartMeasure() const;
321 long GetRowStartMeasure() const;
323 long GetCountForMeasure( long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
325 bool IsBaseForGroup( long nDim ) const; // any group
326 long GetGroupBase( long nGroupDim ) const;
327 bool IsNumOrDateGroup( long nDim ) const;
328 bool IsInGroup( SCROW nGroupDataId, long nGroupIndex,
329 const ScDPItemData& rBaseData, long nBaseIndex ) const;
330 bool HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
331 const ScDPItemData& rSecondData, long nSecondIndex ) const;
333 ResultMembers* GetDimResultMembers(long nDim, ScDPDimension* pDim, ScDPLevel* pLevel) const;
335 const ScDPSource& GetSource() const { return mrSource;}
338 class ScDPResultMember
340 private:
341 const ScDPResultData* pResultData;
342 ScDPParentDimData aParentDimData;
343 ScDPResultDimension* pChildDimension;
344 ScDPDataMember* pDataRoot;
345 bool bHasElements:1;
346 bool bForceSubTotal:1;
347 bool bHasHiddenDetails:1;
348 bool bInitialized:1;
349 bool bAutoHidden:1;
350 ScDPAggData aColTotal; // to store column totals
352 sal_uInt16 nMemberStep; // step to show details
353 public:
354 ScDPResultMember(
355 const ScDPResultData* pData, const ScDPParentDimData& rParentDimData, bool bForceSub ); //! Ref
356 ScDPResultMember( const ScDPResultData* pData, bool bForceSub );
357 ~ScDPResultMember();
359 void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
360 const ::std::vector<ScDPLevel*>& ppLev,
361 size_t nPos,
362 ScDPInitState& rInitState,
363 bool bInitChild = true );
364 void LateInitFrom(
365 LateInitParams& rParams,
366 const ::std::vector< SCROW >& pItemData,
367 size_t nPos,
368 ScDPInitState& rInitState);
369 void CheckShowEmpty( bool bShow = false );
370 OUString GetName() const;
371 OUString GetDisplayName() const;
373 void FillItemData( ScDPItemData& rData ) const;
374 bool IsValid() const;
375 bool IsVisible() const;
376 long GetSize(long nMeasure) const;
377 // bHasHiddenDetails is set only if the "show details" flag is off,
378 // and there was a child dimension to skip
379 bool HasHiddenDetails() const { return bHasHiddenDetails; }
380 bool IsSubTotalInTitle(long nMeasure) const;
382 long GetSubTotalCount( long* pUserSubStart = NULL ) const;
384 bool IsNamedItem( SCROW nIndex ) const;
385 bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
387 void SetHasElements() { bHasElements = true; }
388 void SetAutoHidden() { bAutoHidden = true; }
390 void ProcessData( const ::std::vector<SCROW>& aChildMembers,
391 const ScDPResultDimension* pDataDim,
392 const ::std::vector<SCROW>& aDataMembers,
393 const ::std::vector<ScDPValue>& aValues );
394 void FillMemberResults(
395 com::sun::star::uno::Sequence<
396 com::sun::star::sheet::MemberResult>* pSequences,
397 long& rPos, long nMeasure, bool bRoot, const OUString* pMemberName, const OUString* pMemberCaption );
399 void FillDataResults(
400 const ScDPResultMember* pRefMember, ScDPResultFilterContext& rFilterCxt,
401 com::sun::star::uno::Sequence<
402 com::sun::star::uno::Sequence<
403 com::sun::star::sheet::DataResult> >& rSequence,
404 long nMeasure) const;
406 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
407 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
408 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
410 void SortMembers( ScDPResultMember* pRefMember );
411 void DoAutoShow( ScDPResultMember* pRefMember );
413 void ResetResults();
415 #if DEBUG_PIVOT_TABLE
416 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
418 void Dump(int nIndent) const;
419 #endif
421 //! this will be removed!
422 const ScDPResultDimension* GetChildDimension() const { return pChildDimension; }
423 ScDPResultDimension* GetChildDimension() { return pChildDimension; }
425 ScDPDataMember* GetDataRoot() const { return pDataRoot; }
427 const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
428 const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
429 const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref
430 SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref
431 bool IsRoot() const { return GetParentLevel() == NULL; }
432 SCROW GetDataId( ) const ;
433 ScDPAggData* GetColTotal( long nMeasure ) const;
435 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
438 class ScDPDataMember
440 private:
441 const ScDPResultData* pResultData;
442 const ScDPResultMember* pResultMember; //! Ref?
443 ScDPDataDimension* pChildDimension;
444 ScDPAggData aAggregate;
446 void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
448 public:
449 ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
450 ~ScDPDataMember();
452 void InitFrom( const ScDPResultDimension* pDim );
454 OUString GetName() const;
455 bool IsVisible() const;
456 bool HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
458 bool IsNamedItem( SCROW nRow ) const;
459 bool HasHiddenDetails() const;
461 void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
462 const ScDPSubTotalState& rSubState );
463 bool HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
464 double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
465 const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
466 ScDPAggData* GetAggData( long nMeasure, const ScDPSubTotalState& rSubState );
468 void FillDataRow(
469 const ScDPResultMember* pRefMember,
470 ScDPResultFilterContext& rFilterCxt,
471 com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
472 long nMeasure, bool bIsSubTotalRow,
473 const ScDPSubTotalState& rSubState) const;
475 void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
476 const ScDPSubTotalState& rSubState );
477 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
478 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
479 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent );
481 void SortMembers( ScDPResultMember* pRefMember );
482 void DoAutoShow( ScDPResultMember* pRefMember );
484 void ResetResults();
486 #if DEBUG_PIVOT_TABLE
487 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
488 void Dump(int nIndent) const;
489 #endif
491 //! this will be removed!
492 const ScDPDataDimension* GetChildDimension() const { return pChildDimension; }
493 ScDPDataDimension* GetChildDimension() { return pChildDimension; }
496 typedef std::vector<ScDPDataMember*> ScDPDataMembers;
498 // result dimension contains only members
500 class ScDPResultDimension
502 public:
503 typedef std::vector<ScDPResultMember*> MemberArray;
504 typedef std::map<SCROW, ScDPResultMember*> MemberHash;
505 private:
506 const ScDPResultData* pResultData;
507 MemberArray maMemberArray;
508 MemberHash maMemberHash;
509 OUString aDimensionName; //! or ptr to IntDimension?
510 long nSortMeasure;
511 ScMemberSortOrder aMemberOrder; // used when sorted by measure
512 bool bIsDataLayout:1; //! or ptr to IntDimension?
513 bool bSortByData:1;
514 bool bSortAscending:1;
515 bool bAutoShow:1;
516 bool bAutoTopItems:1;
517 bool bInitialized:1;
518 long nAutoMeasure;
519 long nAutoCount;
521 ScDPResultMember* FindMember( SCROW iData ) const;
522 ScDPResultMember* AddMember( const ScDPParentDimData& aData );
523 ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData );
524 void InitWithMembers( LateInitParams& rParams,
525 const ::std::vector< SCROW >& pItemData,
526 size_t nPos,
527 ScDPInitState& rInitState );
528 public:
529 ScDPResultDimension( const ScDPResultData* pData );
530 ~ScDPResultDimension();
532 // allocates new members
533 void InitFrom(
534 const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
535 size_t nPos, ScDPInitState& rInitState, bool bInitChild = true );
536 void LateInitFrom( LateInitParams& rParams,
537 const ::std::vector< SCROW >& pItemData,
538 size_t nPos,
539 ScDPInitState& rInitState );
540 void CheckShowEmpty( bool bShow = false );
542 long GetSize(long nMeasure) const;
544 bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
546 // modifies existing members, allocates data dimensions
547 void ProcessData( const ::std::vector<SCROW>& aMembers,
548 const ScDPResultDimension* pDataDim,
549 const ::std::vector<SCROW>& aDataMembers,
550 const ::std::vector<ScDPValue>& aValues ) const; //! Test
551 void FillMemberResults( com::sun::star::uno::Sequence<
552 com::sun::star::sheet::MemberResult>* pSequences,
553 long nStart, long nMeasure );
555 void FillDataResults(
556 const ScDPResultMember* pRefMember,
557 ScDPResultFilterContext& rFilterCxt,
558 com::sun::star::uno::Sequence<
559 com::sun::star::uno::Sequence<
560 com::sun::star::sheet::DataResult> >& rSequence,
561 long nMeasure) const;
563 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
564 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
565 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
567 void SortMembers( ScDPResultMember* pRefMember );
568 long GetSortedIndex( long nUnsorted ) const;
570 void DoAutoShow( ScDPResultMember* pRefMember );
572 void ResetResults();
574 // called for the reference dimension
575 ScDPDataMember* GetRowReferenceMember(
576 const ScDPRelativePos* pMemberPos, const OUString* pName,
577 const long* pRowIndexes, const long* pColIndexes ) const;
579 // uses row root member from ScDPRunningTotalState
580 static ScDPDataMember* GetColReferenceMember(
581 const ScDPRelativePos* pMemberPos, const OUString* pName,
582 long nRefDimPos, const ScDPRunningTotalState& rRunning );
584 #if DEBUG_PIVOT_TABLE
585 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
586 void Dump(int nIndent) const;
587 #endif
589 // for ScDPDataDimension::InitFrom
590 long GetMemberCount() const;
591 const ScDPResultMember* GetMember(long n) const;
592 ScDPResultMember* GetMember(long n);
594 const ScMemberSortOrder& GetMemberOrder() const { return aMemberOrder; }
595 ScMemberSortOrder& GetMemberOrder() { return aMemberOrder; }
597 bool IsDataLayout() const { return bIsDataLayout; }
598 const OUString& GetName() const { return aDimensionName; }
600 bool IsSortByData() const { return bSortByData; }
601 bool IsSortAscending() const { return bSortAscending; }
602 long GetSortMeasure() const { return nSortMeasure; }
604 bool IsAutoShow() const { return bAutoShow; }
605 bool IsAutoTopItems() const { return bAutoTopItems; }
606 long GetAutoMeasure() const { return nAutoMeasure; }
607 long GetAutoCount() const { return nAutoCount; }
609 ScDPResultDimension* GetFirstChildDimension() const;
611 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
614 class ScDPDataDimension
616 private:
617 const ScDPResultData* pResultData;
618 const ScDPResultDimension* pResultDimension; // column
619 ScDPDataMembers maMembers;
620 bool bIsDataLayout; //! or ptr to IntDimension?
622 public:
623 ScDPDataDimension( const ScDPResultData* pData );
624 ~ScDPDataDimension();
626 void InitFrom( const ScDPResultDimension* pDim ); // recursive
627 void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
628 const ScDPSubTotalState& rSubState );
629 void FillDataRow(
630 const ScDPResultDimension* pRefDim,
631 ScDPResultFilterContext& rFilterCxt,
632 com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
633 long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState& rSubState) const;
635 void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
636 const ScDPSubTotalState& rSubState ) const;
637 void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
638 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
639 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const;
641 void SortMembers( ScDPResultDimension* pRefDim );
642 long GetSortedIndex( long nUnsorted ) const;
644 void DoAutoShow( ScDPResultDimension* pRefDim );
646 void ResetResults();
648 #if DEBUG_PIVOT_TABLE
649 void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
650 void Dump(int nIndent) const;
651 #endif
653 long GetMemberCount() const;
654 const ScDPDataMember* GetMember(long n) const;
655 ScDPDataMember* GetMember(long n);
659 * This class collects visible members of each dimension and uses that
660 * information to create filtering criteria (e.g. for drill-down data).
662 class ScDPResultVisibilityData
664 public:
665 ScDPResultVisibilityData( ScDPSource* pSource);
666 ~ScDPResultVisibilityData();
668 void addVisibleMember(const OUString& rDimName, const ScDPItemData& rMemberItem);
669 void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const;
671 private:
672 struct MemberHash
674 size_t operator()(const ScDPItemData& r) const;
676 typedef std::unordered_set<ScDPItemData, MemberHash> VisibleMemberType;
677 typedef std::unordered_map<OUString, VisibleMemberType, OUStringHash> DimMemberType;
678 DimMemberType maDimensions;
680 ScDPSource* mpSource;
683 #endif
685 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */