Bump version to 4.3-4
[LibreOffice.git] / sc / inc / dptabres.hxx
blob207e256eb25e10c5ed08db7d4315ab18b7802d20
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 <boost/unordered_map.hpp>
32 #include <boost/unordered_set.hpp>
33 #include <vector>
34 #include <map>
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;
118 const IndexArray& GetColSorted() const;
119 const IndexArray& GetRowVisible() const;
120 const IndexArray& GetRowSorted() const;
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 );
146 // aggregated data
147 //! separate header file?
150 // Possible values for the nCount member:
151 // (greater than 0 counts the collected values)
152 const long SC_DPAGG_EMPTY = 0; // empty during data collection
153 const long SC_DPAGG_DATA_ERROR = -1; // error during data collection
154 const long SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated
155 const long SC_DPAGG_RESULT_VALID = -3; // valid result calculated
156 const long SC_DPAGG_RESULT_ERROR = -4; // error in calculated result
158 class ScDPAggData
160 private:
161 double fVal;
162 double fAux;
163 long nCount;
164 ScDPAggData* pChild;
166 public:
167 ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(NULL) {}
168 ~ScDPAggData() { delete pChild; }
170 void Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
171 void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
172 bool IsCalculated() const;
174 double GetResult() const;
175 bool HasError() const;
176 bool HasData() const;
178 void SetResult( double fNew );
179 void SetEmpty( bool bSet );
180 void SetError();
182 double GetAuxiliary() const;
183 void SetAuxiliary( double fNew );
185 void Reset(); // also deletes children
187 const ScDPAggData* GetExistingChild() const { return pChild; }
188 ScDPAggData* GetChild();
190 #if DEBUG_PIVOT_TABLE
191 void Dump(int nIndent) const;
192 #endif
196 // Row and grand total state, passed down (column total is at result member)
199 class ScDPRowTotals
201 ScDPAggData aRowTotal;
202 ScDPAggData aGrandTotal;
203 bool bIsInColRoot;
205 public:
206 ScDPRowTotals();
207 ~ScDPRowTotals();
209 ScDPAggData* GetRowTotal( long nMeasure );
210 ScDPAggData* GetGrandTotal( long nMeasure );
212 bool IsInColRoot() const { return bIsInColRoot; }
213 void SetInColRoot(bool bSet) { bIsInColRoot = bSet; }
217 // results for a hierarchy dimension
220 class ScDPResultDimension;
221 class ScDPDataDimension;
222 class ScDPDataMember;
224 #define SC_DPMEASURE_ALL -1
225 #define SC_DPMEASURE_ANY -2
227 struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t >
229 size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; }
232 struct ScDPParentDimData
234 const SCROW mnOrder; //! Ref
235 const ScDPDimension* mpParentDim; //! Ref
236 const ScDPLevel* mpParentLevel; //! Ref
237 const ScDPMember* mpMemberDesc; //! Ref
239 ScDPParentDimData();
240 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
243 typedef std::vector <ScDPParentDimData *> DimMemberArray;
244 typedef boost::unordered_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash;
246 class ResultMembers
248 DimMemberHash maMemberHash;
249 bool mbHasHideDetailsMember;
250 public:
251 ScDPParentDimData* FindMember( SCROW nIndex ) const;
252 void InsertMember( ScDPParentDimData* pNew );
253 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
254 void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
255 ResultMembers();
256 virtual ~ResultMembers();
259 class LateInitParams
261 private:
262 const ::std::vector<ScDPDimension*>& mppDim;
263 const ::std::vector<ScDPLevel*>& mppLev;
265 bool mbRow:1;
266 bool mbInitChild:1;
267 bool mbAllChildren:1;
268 public:
269 LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
270 bool bRow, bool bInitChild = true, bool bAllChildren = false);
271 ~LateInitParams();
273 void SetInitChild( bool b ) { mbInitChild = b; }
274 void SetInitAllChildren( bool b ) { mbAllChildren = b; }
276 inline ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
277 inline ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
279 bool GetInitChild() const {return mbInitChild; }
280 bool GetInitAllChild() const { return mbAllChildren; }
281 bool IsRow() const { return mbRow; }
282 bool IsEnd( size_t nPos ) const ;
286 * The term 'measure' here roughly equals "data dimension" ?
288 class ScDPResultData
290 ScDPSource& mrSource;
291 //! keep things like measure lists here
293 std::vector<ScSubTotalFunc> maMeasureFuncs;
294 std::vector<com::sun::star::sheet::DataPilotFieldReference> maMeasureRefs;
295 std::vector<sal_uInt16> maMeasureRefOrients;
296 std::vector<OUString> maMeasureNames;
298 bool bLateInit:1;
299 bool bDataAtCol:1;
300 bool bDataAtRow:1;
302 //! add "displayed values" settings
303 mutable std::vector<ResultMembers*> maDimMembers;
304 public:
305 ScDPResultData( ScDPSource& rSrc );
306 ~ScDPResultData();
308 void SetMeasureData(
309 std::vector<ScSubTotalFunc>& rFunctions,
310 std::vector<com::sun::star::sheet::DataPilotFieldReference>& rRefs,
311 std::vector<sal_uInt16>& rRefOrient, std::vector<OUString>& rNames );
313 void SetDataLayoutOrientation( sal_uInt16 nOrient );
314 void SetLateInit( bool bSet );
316 long GetMeasureCount() const { return maMeasureFuncs.size(); }
317 ScSubTotalFunc GetMeasureFunction(long nMeasure) const;
318 OUString GetMeasureString(long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const;
319 OUString GetMeasureDimensionName(long nMeasure) const;
320 const ::com::sun::star::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const;
321 sal_uInt16 GetMeasureRefOrient(long nMeasure) const;
323 bool IsDataAtCol() const { return bDataAtCol; }
324 bool IsDataAtRow() const { return bDataAtRow; }
325 bool IsLateInit() const { return bLateInit; }
327 long GetColStartMeasure() const;
328 long GetRowStartMeasure() const;
330 long GetCountForMeasure( long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
332 bool IsBaseForGroup( long nDim ) const; // any group
333 long GetGroupBase( long nGroupDim ) const;
334 bool IsNumOrDateGroup( long nDim ) const;
335 bool IsInGroup( SCROW nGroupDataId, long nGroupIndex,
336 const ScDPItemData& rBaseData, long nBaseIndex ) const;
337 bool HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
338 const ScDPItemData& rSecondData, long nSecondIndex ) const;
340 ResultMembers* GetDimResultMembers(long nDim, ScDPDimension* pDim, ScDPLevel* pLevel) const;
342 const ScDPSource& GetSource() const;
345 class ScDPResultMember
347 private:
348 const ScDPResultData* pResultData;
349 ScDPParentDimData aParentDimData;
350 ScDPResultDimension* pChildDimension;
351 ScDPDataMember* pDataRoot;
352 bool bHasElements:1;
353 bool bForceSubTotal:1;
354 bool bHasHiddenDetails:1;
355 bool bInitialized:1;
356 bool bAutoHidden:1;
357 ScDPAggData aColTotal; // to store column totals
359 sal_uInt16 nMemberStep; // step to show details
360 public:
361 ScDPResultMember(
362 const ScDPResultData* pData, const ScDPParentDimData& rParentDimData, bool bForceSub ); //! Ref
363 ScDPResultMember( const ScDPResultData* pData, bool bForceSub );
364 ~ScDPResultMember();
366 void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
367 const ::std::vector<ScDPLevel*>& ppLev,
368 size_t nPos,
369 ScDPInitState& rInitState,
370 bool bInitChild = true );
371 void LateInitFrom(
372 LateInitParams& rParams,
373 const ::std::vector< SCROW >& pItemData,
374 size_t nPos,
375 ScDPInitState& rInitState);
376 void CheckShowEmpty( bool bShow = false );
377 OUString GetName() const;
378 OUString GetDisplayName() const;
380 void FillItemData( ScDPItemData& rData ) const;
381 bool IsValid() const;
382 bool IsVisible() const;
383 long GetSize(long nMeasure) const;
384 bool HasHiddenDetails() const;
385 bool IsSubTotalInTitle(long nMeasure) const;
387 long GetSubTotalCount( long* pUserSubStart = NULL ) const;
389 bool IsNamedItem( SCROW nIndex ) const;
390 bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
392 void SetHasElements() { bHasElements = true; }
393 void SetAutoHidden() { bAutoHidden = true; }
395 void ProcessData( const ::std::vector<SCROW>& aChildMembers,
396 const ScDPResultDimension* pDataDim,
397 const ::std::vector<SCROW>& aDataMembers,
398 const ::std::vector<ScDPValue>& aValues );
399 void FillMemberResults(
400 com::sun::star::uno::Sequence<
401 com::sun::star::sheet::MemberResult>* pSequences,
402 long& rPos, long nMeasure, bool bRoot, const OUString* pMemberName, const OUString* pMemberCaption );
404 void FillDataResults(
405 const ScDPResultMember* pRefMember, ScDPResultFilterContext& rFilterCxt,
406 com::sun::star::uno::Sequence<
407 com::sun::star::uno::Sequence<
408 com::sun::star::sheet::DataResult> >& rSequence,
409 long nMeasure) const;
411 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
412 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
413 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
415 void SortMembers( ScDPResultMember* pRefMember );
416 void DoAutoShow( ScDPResultMember* pRefMember );
418 void ResetResults();
420 #if DEBUG_PIVOT_TABLE
421 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
423 void Dump(int nIndent) const;
424 #endif
426 //! this will be removed!
427 const ScDPResultDimension* GetChildDimension() const { return pChildDimension; }
428 ScDPResultDimension* GetChildDimension() { return pChildDimension; }
430 ScDPDataMember* GetDataRoot() const { return pDataRoot; }
432 const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
433 const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
434 const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref
435 SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref
436 bool IsRoot() const { return GetParentLevel() == NULL; }
437 SCROW GetDataId( ) const ;
438 ScDPAggData* GetColTotal( long nMeasure ) const;
440 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
443 class ScDPDataMember
445 private:
446 const ScDPResultData* pResultData;
447 const ScDPResultMember* pResultMember; //! Ref?
448 ScDPDataDimension* pChildDimension;
449 ScDPAggData aAggregate;
451 void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
453 public:
454 ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
455 ~ScDPDataMember();
457 void InitFrom( const ScDPResultDimension* pDim );
459 OUString GetName() const;
460 bool IsVisible() const;
461 bool HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
463 bool IsNamedItem( SCROW nRow ) const;
464 bool HasHiddenDetails() const;
466 void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
467 const ScDPSubTotalState& rSubState );
468 bool HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
469 double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
470 const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
471 ScDPAggData* GetAggData( long nMeasure, const ScDPSubTotalState& rSubState );
473 void FillDataRow(
474 const ScDPResultMember* pRefMember,
475 ScDPResultFilterContext& rFilterCxt,
476 com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
477 long nMeasure, bool bIsSubTotalRow,
478 const ScDPSubTotalState& rSubState) const;
480 void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
481 const ScDPSubTotalState& rSubState );
482 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, bool bIsSubTotalRow,
483 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
484 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent );
486 void SortMembers( ScDPResultMember* pRefMember );
487 void DoAutoShow( ScDPResultMember* pRefMember );
489 void ResetResults();
491 #if DEBUG_PIVOT_TABLE
492 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
493 void Dump(int nIndent) const;
494 #endif
496 //! this will be removed!
497 const ScDPDataDimension* GetChildDimension() const { return pChildDimension; }
498 ScDPDataDimension* GetChildDimension() { return pChildDimension; }
501 typedef std::vector<ScDPDataMember*> ScDPDataMembers;
503 // result dimension contains only members
505 class ScDPResultDimension
507 public:
508 typedef std::vector<ScDPResultMember*> MemberArray;
509 typedef std::map<SCROW, ScDPResultMember*> MemberHash;
510 private:
511 const ScDPResultData* pResultData;
512 MemberArray maMemberArray;
513 MemberHash maMemberHash;
514 OUString aDimensionName; //! or ptr to IntDimension?
515 long nSortMeasure;
516 ScMemberSortOrder aMemberOrder; // used when sorted by measure
517 bool bIsDataLayout:1; //! or ptr to IntDimension?
518 bool bSortByData:1;
519 bool bSortAscending:1;
520 bool bAutoShow:1;
521 bool bAutoTopItems:1;
522 bool bInitialized:1;
523 long nAutoMeasure;
524 long nAutoCount;
526 ScDPResultMember* FindMember( SCROW iData ) const;
527 ScDPResultMember* AddMember( const ScDPParentDimData& aData );
528 ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData );
529 void InitWithMembers( LateInitParams& rParams,
530 const ::std::vector< SCROW >& pItemData,
531 size_t nPos,
532 ScDPInitState& rInitState );
533 public:
534 ScDPResultDimension( const ScDPResultData* pData );
535 ~ScDPResultDimension();
537 // allocates new members
538 void InitFrom(
539 const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
540 size_t nPos, ScDPInitState& rInitState, bool bInitChild = true );
541 void LateInitFrom( LateInitParams& rParams,
542 const ::std::vector< SCROW >& pItemData,
543 size_t nPos,
544 ScDPInitState& rInitState );
545 void CheckShowEmpty( bool bShow = false );
547 long GetSize(long nMeasure) const;
549 bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
551 // modifies existing members, allocates data dimensions
552 void ProcessData( const ::std::vector<SCROW>& aMembers,
553 const ScDPResultDimension* pDataDim,
554 const ::std::vector<SCROW>& aDataMembers,
555 const ::std::vector<ScDPValue>& aValues ) const; //! Test
556 void FillMemberResults( com::sun::star::uno::Sequence<
557 com::sun::star::sheet::MemberResult>* pSequences,
558 long nStart, long nMeasure );
560 void FillDataResults(
561 const ScDPResultMember* pRefMember,
562 ScDPResultFilterContext& rFilterCxt,
563 com::sun::star::uno::Sequence<
564 com::sun::star::uno::Sequence<
565 com::sun::star::sheet::DataResult> >& rSequence,
566 long nMeasure) const;
568 void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const;
569 void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure,
570 ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const;
572 void SortMembers( ScDPResultMember* pRefMember );
573 long GetSortedIndex( long nUnsorted ) const;
575 void DoAutoShow( ScDPResultMember* pRefMember );
577 void ResetResults();
579 // called for the reference dimension
580 ScDPDataMember* GetRowReferenceMember(
581 const ScDPRelativePos* pMemberPos, const OUString* pName,
582 const long* pRowIndexes, const long* pColIndexes ) const;
584 // uses row root member from ScDPRunningTotalState
585 static ScDPDataMember* GetColReferenceMember(
586 const ScDPRelativePos* pMemberPos, const OUString* pName,
587 long nRefDimPos, const ScDPRunningTotalState& rRunning );
589 #if DEBUG_PIVOT_TABLE
590 void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
591 void Dump(int nIndent) const;
592 #endif
594 // for ScDPDataDimension::InitFrom
595 long GetMemberCount() const;
596 const ScDPResultMember* GetMember(long n) const;
597 ScDPResultMember* GetMember(long n);
599 const ScMemberSortOrder& GetMemberOrder() const { return aMemberOrder; }
600 ScMemberSortOrder& GetMemberOrder() { return aMemberOrder; }
602 bool IsDataLayout() const { return bIsDataLayout; }
603 const OUString& GetName() const { return aDimensionName; }
605 bool IsSortByData() const { return bSortByData; }
606 bool IsSortAscending() const { return bSortAscending; }
607 long GetSortMeasure() const { return nSortMeasure; }
609 bool IsAutoShow() const { return bAutoShow; }
610 bool IsAutoTopItems() const { return bAutoTopItems; }
611 long GetAutoMeasure() const { return nAutoMeasure; }
612 long GetAutoCount() const { return nAutoCount; }
614 ScDPResultDimension* GetFirstChildDimension() const;
616 void FillVisibilityData(ScDPResultVisibilityData& rData) const;
619 class ScDPDataDimension
621 private:
622 const ScDPResultData* pResultData;
623 const ScDPResultDimension* pResultDimension; // column
624 ScDPDataMembers maMembers;
625 bool bIsDataLayout; //! or ptr to IntDimension?
627 public:
628 ScDPDataDimension( const ScDPResultData* pData );
629 ~ScDPDataDimension();
631 void InitFrom( const ScDPResultDimension* pDim ); // recursive
632 void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
633 const ScDPSubTotalState& rSubState );
634 void FillDataRow(
635 const ScDPResultDimension* pRefDim,
636 ScDPResultFilterContext& rFilterCxt,
637 com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
638 long nMeasure, bool bIsSubTotalRow, const ScDPSubTotalState& rSubState) const;
640 void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
641 const ScDPSubTotalState& rSubState ) const;
642 void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, bool bIsSubTotalRow,
643 const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning,
644 ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const;
646 void SortMembers( ScDPResultDimension* pRefDim );
647 long GetSortedIndex( long nUnsorted ) const;
649 void DoAutoShow( ScDPResultDimension* pRefDim );
651 void ResetResults();
653 #if DEBUG_PIVOT_TABLE
654 void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
655 void Dump(int nIndent) const;
656 #endif
658 long GetMemberCount() const;
659 const ScDPDataMember* GetMember(long n) const;
660 ScDPDataMember* GetMember(long n);
664 * This class collects visible members of each dimension and uses that
665 * information to create filtering criteria (e.g. for drill-down data).
667 class ScDPResultVisibilityData
669 public:
670 ScDPResultVisibilityData( ScDPSource* pSource);
671 ~ScDPResultVisibilityData();
673 void addVisibleMember(const OUString& rDimName, const ScDPItemData& rMemberItem);
674 void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const;
676 private:
677 struct MemberHash
679 size_t operator()(const ScDPItemData& r) const;
681 typedef ::boost::unordered_set<ScDPItemData, MemberHash> VisibleMemberType;
682 typedef ::boost::unordered_map<OUString, VisibleMemberType, OUStringHash> DimMemberType;
683 DimMemberType maDimensions;
685 ScDPSource* mpSource;
688 #endif
690 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */