LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/inc - dptabsrc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 22 77.3 %
Date: 2013-07-09 Functions: 13 15 86.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef SC_DPTABSRC_HXX
      21             : #define SC_DPTABSRC_HXX
      22             : 
      23             : #include <tools/string.hxx>
      24             : #include "global.hxx"       // enum ScSubTotalFunc
      25             : #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
      26             : #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
      27             : #include <com/sun/star/sheet/XLevelsSupplier.hpp>
      28             : #include <com/sun/star/sheet/XMembersSupplier.hpp>
      29             : #include <com/sun/star/sheet/XDataPilotResults.hpp>
      30             : #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
      31             : #include <com/sun/star/sheet/MemberResult.hpp>
      32             : #include <com/sun/star/sheet/GeneralFunction.hpp>
      33             : #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
      34             : #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
      35             : #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
      36             : #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
      37             : #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
      38             : #include <com/sun/star/util/XRefreshable.hpp>
      39             : #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
      40             : #include <com/sun/star/util/XCloneable.hpp>
      41             : #include <com/sun/star/beans/XPropertySet.hpp>
      42             : #include <com/sun/star/lang/XServiceInfo.hpp>
      43             : #include <com/sun/star/container/XNamed.hpp>
      44             : #include <cppuhelper/implbase2.hxx>
      45             : #include <cppuhelper/implbase3.hxx>
      46             : #include <cppuhelper/implbase5.hxx>
      47             : #include <cppuhelper/implbase6.hxx>
      48             : #include "rtl/ref.hxx"
      49             : 
      50             : #include "dptabdat.hxx"
      51             : #include "dpglobal.hxx"
      52             : #include "dpresfilter.hxx"
      53             : 
      54             : #include <boost/unordered_map.hpp>
      55             : #include <boost/unordered_set.hpp>
      56             : #include <boost/noncopyable.hpp>
      57             : #include <boost/scoped_ptr.hpp>
      58             : #include <vector>
      59             : #include <list>
      60             : 
      61             : namespace com { namespace sun { namespace star {
      62             :     namespace sheet {
      63             :         struct DataPilotFieldFilter;
      64             :     }
      65             :     namespace table {
      66             :         struct CellAddress;
      67             :     }
      68             : }}}
      69             : 
      70             : class ScDPResultMember;
      71             : class ScDPResultData;
      72             : class ScDPItemData;
      73             : class ScDPTableData;
      74             : 
      75             : //
      76             : //  implementation of DataPilotSource using ScDPTableData
      77             : //
      78             : 
      79             : 
      80             : class ScDPDimensions;
      81             : class ScDPDimension;
      82             : class ScDPHierarchies;
      83             : class ScDPHierarchy;
      84             : class ScDPLevels;
      85             : class ScDPLevel;
      86             : class ScDPMembers;
      87             : class ScDPMember;
      88             : 
      89             : 
      90             : class ScDPSource : public cppu::WeakImplHelper6<
      91             :                             com::sun::star::sheet::XDimensionsSupplier,
      92             :                             com::sun::star::sheet::XDataPilotResults,
      93             :                             com::sun::star::util::XRefreshable,
      94             :                             com::sun::star::sheet::XDrillDownDataSupplier,
      95             :                             com::sun::star::beans::XPropertySet,
      96             :                             com::sun::star::lang::XServiceInfo >
      97             : {
      98             : private:
      99             :     ScDPTableData*          pData;              // data source (ScDPObject manages its life time)
     100             :     ScDPDimensions*         pDimensions;        // api objects
     101             :                                                 // settings:
     102             : 
     103             :     std::vector<long> maColDims;
     104             :     std::vector<long> maRowDims;
     105             :     std::vector<long> maDataDims;
     106             :     std::vector<long> maPageDims;
     107             :     ScDPResultTree maResFilterSet;
     108             : 
     109             :     bool                    bColumnGrand;
     110             :     bool                    bRowGrand;
     111             :     bool                    bIgnoreEmptyRows;
     112             :     bool                    bRepeatIfEmpty;
     113             : 
     114             :     long                    nDupCount;
     115             : 
     116             :                                                 // results:
     117             :     ScDPResultData*         pResData;           // keep the rest in this!
     118             :     ScDPResultMember*       pColResRoot;
     119             :     ScDPResultMember*       pRowResRoot;
     120             :     com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pColResults;
     121             :     com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pRowResults;
     122             :     std::vector<ScDPLevel*> aColLevelList;
     123             :     std::vector<ScDPLevel*> aRowLevelList;
     124             :     bool                    bResultOverflow;
     125             :     bool                    bPageFiltered;      // set if page field filters have been applied to cache table
     126             : 
     127             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     128             :     ::std::auto_ptr<OUString> mpGrandTotalName;
     129             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     130             : 
     131             :     void                    CreateRes_Impl();
     132             :     void                    FillMemberResults();
     133             :     void                    FillLevelList( sal_uInt16 nOrientation, std::vector<ScDPLevel*> &rList );
     134             :     void                    FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
     135             : 
     136             :     /**
     137             :      * Compile a list of dimension indices that are either, column, row or
     138             :      * page dimensions (i.e. all but data dimensions).
     139             :      */
     140             :     void                    GetCategoryDimensionIndices(::boost::unordered_set<sal_Int32>& rCatDims);
     141             : 
     142             :     /**
     143             :      * Set visibilities of individual rows in the cache table based on the
     144             :      * page field data.
     145             :      */
     146             :     void FilterCacheByPageDimensions();
     147             : 
     148             :     void                    SetDupCount( long nNew );
     149             : 
     150             :     OUString getDataDescription();       //! ???
     151             : 
     152             :     void setIgnoreEmptyRows(bool bSet);
     153             :     void setRepeatIfEmpty(bool bSet);
     154             : 
     155             :     void disposeData();
     156             : 
     157             : public:
     158             :                                 ScDPSource( ScDPTableData* pD );
     159             :     virtual                     ~ScDPSource();
     160             : 
     161       40917 :     ScDPTableData*          GetData()       { return pData; }
     162         621 :     const ScDPTableData*    GetData() const { return pData; }
     163             : 
     164             :     const OUString*  GetGrandTotalName() const;
     165             : 
     166             :     sal_uInt16                  GetOrientation(long nColumn);
     167             :     void                    SetOrientation(long nColumn, sal_uInt16 nNew);
     168             :     long                    GetPosition(long nColumn);
     169             : 
     170             :     long                    GetDataDimensionCount();
     171             :     ScDPDimension*          GetDataDimension(long nIndex);
     172             :     OUString GetDataDimName(long nIndex);
     173             :     const ScDPCache* GetCache();
     174             :     const ScDPItemData*            GetItemDataById( long nDim, long nId );
     175             :     long                                       GetDataLayoutDim(){ return pData->GetColumnCount(); }
     176             :     SCROW                                GetMemberId(  long  nDim, const ScDPItemData& rData );
     177             :     sal_Bool                    IsDataLayoutDimension(long nDim);
     178             :     sal_uInt16                  GetDataLayoutOrientation();
     179             : 
     180             :     sal_Bool                    IsDateDimension(long nDim);
     181             : 
     182             :     sal_Bool                    SubTotalAllowed(long nColumn);      //! move to ScDPResultData
     183             : 
     184             :     ScDPDimension* AddDuplicated(long nSource, const OUString& rNewName);
     185         112 :     long                    GetDupCount() const { return nDupCount; }
     186             : 
     187             :     long                    GetSourceDim(long nDim);
     188             : 
     189             :     const com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>*
     190             :                             GetMemberResults( ScDPLevel* pLevel );
     191             : 
     192             :     ScDPDimensions*         GetDimensionsObject();
     193             : 
     194             :                             // XDimensionsSupplier
     195             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     196             :                             SAL_CALL getDimensions(  )
     197             :                                 throw(::com::sun::star::uno::RuntimeException);
     198             : 
     199             :                             // XDataPilotResults
     200             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence<
     201             :                             ::com::sun::star::sheet::DataResult > > SAL_CALL getResults(  )
     202             :                                 throw(::com::sun::star::uno::RuntimeException);
     203             : 
     204             :     virtual com::sun::star::uno::Sequence<double> SAL_CALL
     205             :         getFilteredResults(
     206             :             const com::sun::star::uno::Sequence<com::sun::star::sheet::DataPilotFieldFilter>& aFilters )
     207             :                 throw (com::sun::star::uno::RuntimeException);
     208             : 
     209             :                             // XRefreshable
     210             :     virtual void SAL_CALL   refresh() throw(::com::sun::star::uno::RuntimeException);
     211             :     virtual void SAL_CALL   addRefreshListener( const ::com::sun::star::uno::Reference<
     212             :                                     ::com::sun::star::util::XRefreshListener >& l )
     213             :                                 throw(::com::sun::star::uno::RuntimeException);
     214             :     virtual void SAL_CALL   removeRefreshListener( const ::com::sun::star::uno::Reference<
     215             :                                     ::com::sun::star::util::XRefreshListener >& l )
     216             :                                 throw(::com::sun::star::uno::RuntimeException);
     217             : 
     218             :                             // XDrillDownDataSupplier
     219             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
     220             :         SAL_CALL getDrillDownData(const ::com::sun::star::uno::Sequence<
     221             :                                       ::com::sun::star::sheet::DataPilotFieldFilter >& aFilters )
     222             :                                 throw(::com::sun::star::uno::RuntimeException);
     223             : 
     224             :                             // XPropertySet
     225             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     226             :                             SAL_CALL getPropertySetInfo(  )
     227             :                                 throw(::com::sun::star::uno::RuntimeException);
     228             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     229             :                                     const ::com::sun::star::uno::Any& aValue )
     230             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     231             :                                     ::com::sun::star::beans::PropertyVetoException,
     232             :                                     ::com::sun::star::lang::IllegalArgumentException,
     233             :                                     ::com::sun::star::lang::WrappedTargetException,
     234             :                                     ::com::sun::star::uno::RuntimeException);
     235             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     236             :                                     const OUString& PropertyName )
     237             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     238             :                                     ::com::sun::star::lang::WrappedTargetException,
     239             :                                     ::com::sun::star::uno::RuntimeException);
     240             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     241             :                                     const ::com::sun::star::uno::Reference<
     242             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     243             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     244             :                                     ::com::sun::star::lang::WrappedTargetException,
     245             :                                     ::com::sun::star::uno::RuntimeException);
     246             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     247             :                                     const ::com::sun::star::uno::Reference<
     248             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     249             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     250             :                                     ::com::sun::star::lang::WrappedTargetException,
     251             :                                     ::com::sun::star::uno::RuntimeException);
     252             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     253             :                                     const ::com::sun::star::uno::Reference<
     254             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     255             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     256             :                                     ::com::sun::star::lang::WrappedTargetException,
     257             :                                     ::com::sun::star::uno::RuntimeException);
     258             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     259             :                                     const ::com::sun::star::uno::Reference<
     260             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     261             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     262             :                                     ::com::sun::star::lang::WrappedTargetException,
     263             :                                     ::com::sun::star::uno::RuntimeException);
     264             : 
     265             :                             // XServiceInfo
     266             :     virtual OUString SAL_CALL getImplementationName(  )
     267             :                                 throw(::com::sun::star::uno::RuntimeException);
     268             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     269             :                                 throw(::com::sun::star::uno::RuntimeException);
     270             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     271             :                                 throw(::com::sun::star::uno::RuntimeException);
     272             : 
     273             : #if DEBUG_PIVOT_TABLE
     274             :     void DumpResults() const;
     275             : #endif
     276             : };
     277             : 
     278             : class ScDPDimensions : public cppu::WeakImplHelper2<
     279             :                             com::sun::star::container::XNameAccess,
     280             :                             com::sun::star::lang::XServiceInfo >
     281             : {
     282             : private:
     283             :     ScDPSource*         pSource;
     284             :     long                nDimCount;
     285             :     ScDPDimension**     ppDims;
     286             : 
     287             : public:
     288             :                             ScDPDimensions( ScDPSource* pSrc );
     289             :     virtual                 ~ScDPDimensions();
     290             : 
     291             :     void                    CountChanged();
     292             : 
     293             :                             // XNameAccess
     294             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     295             :                                 throw(::com::sun::star::container::NoSuchElementException,
     296             :                                     ::com::sun::star::lang::WrappedTargetException,
     297             :                                     ::com::sun::star::uno::RuntimeException);
     298             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
     299             :                                 throw(::com::sun::star::uno::RuntimeException);
     300             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     301             :                                 throw(::com::sun::star::uno::RuntimeException);
     302             : 
     303             :                             // XElementAccess
     304             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     305             :                                 throw(::com::sun::star::uno::RuntimeException);
     306             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
     307             : 
     308             :                             // XServiceInfo
     309             :     virtual OUString SAL_CALL getImplementationName(  )
     310             :                                 throw(::com::sun::star::uno::RuntimeException);
     311             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     312             :                                 throw(::com::sun::star::uno::RuntimeException);
     313             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     314             :                                 throw(::com::sun::star::uno::RuntimeException);
     315             : 
     316             :     virtual long            getCount() const;
     317             :     virtual ScDPDimension*  getByIndex(long nIndex) const;
     318             : };
     319             : 
     320             : class ScDPDimension : boost::noncopyable, public cppu::WeakImplHelper5<
     321             :                             com::sun::star::sheet::XHierarchiesSupplier,
     322             :                             com::sun::star::container::XNamed,
     323             :                             com::sun::star::util::XCloneable,
     324             :                             com::sun::star::beans::XPropertySet,
     325             :                             com::sun::star::lang::XServiceInfo >
     326             : {
     327             :     ScDPSource*         pSource;
     328             :     long                nDim;               // dimension index (== column ID)
     329             :     ScDPHierarchies*    pHierarchies;
     330             :     long                nUsedHier;
     331             :     sal_uInt16              nFunction;          // enum GeneralFunction
     332             :     OUString       aName;              // if empty, take from source
     333             :     boost::scoped_ptr<OUString> mpLayoutName;
     334             :     boost::scoped_ptr<OUString> mpSubtotalName;
     335             :     long                nSourceDim;         // >=0 if dup'ed
     336             :     ::com::sun::star::sheet::DataPilotFieldReference
     337             :                         aReferenceValue;    // settings for "show data as" / "displayed value"
     338             :     bool                bHasSelectedPage;
     339             :     OUString       aSelectedPage;
     340             :     ScDPItemData*       pSelectedData;      // internal, temporary, created from aSelectedPage
     341             :     bool                mbHasHiddenMember;
     342             : 
     343             : public:
     344             :                             ScDPDimension( ScDPSource* pSrc, long nD );
     345             :     virtual                 ~ScDPDimension();
     346             : 
     347        1604 :     long                    GetDimension() const    { return nDim; }        // dimension index in source
     348          90 :     long                    GetSourceDim() const    { return nSourceDim; }  // >=0 if dup'ed
     349             : 
     350             :     ScDPDimension*          CreateCloneObject();
     351             :     ScDPHierarchies*        GetHierarchiesObject();
     352             : 
     353             :     SC_DLLPUBLIC const OUString*  GetLayoutName() const;
     354             :     const OUString*  GetSubtotalName() const;
     355             : 
     356             :                             // XNamed
     357             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     358             :     virtual void SAL_CALL   setName( const OUString& aName )
     359             :                                 throw(::com::sun::star::uno::RuntimeException);
     360             : 
     361             :                             // XHierarchiesSupplier
     362             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
     363             :                             getHierarchies() throw(::com::sun::star::uno::RuntimeException);
     364             : 
     365             :                             // XCloneable
     366             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL
     367             :                             createClone() throw(::com::sun::star::uno::RuntimeException);
     368             : 
     369             :                             // XPropertySet
     370             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     371             :                             SAL_CALL getPropertySetInfo(  )
     372             :                                 throw(::com::sun::star::uno::RuntimeException);
     373             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     374             :                                     const ::com::sun::star::uno::Any& aValue )
     375             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     376             :                                     ::com::sun::star::beans::PropertyVetoException,
     377             :                                     ::com::sun::star::lang::IllegalArgumentException,
     378             :                                     ::com::sun::star::lang::WrappedTargetException,
     379             :                                     ::com::sun::star::uno::RuntimeException);
     380             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     381             :                                     const OUString& PropertyName )
     382             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     383             :                                     ::com::sun::star::lang::WrappedTargetException,
     384             :                                     ::com::sun::star::uno::RuntimeException);
     385             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     386             :                                     const ::com::sun::star::uno::Reference<
     387             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     388             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     389             :                                     ::com::sun::star::lang::WrappedTargetException,
     390             :                                     ::com::sun::star::uno::RuntimeException);
     391             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     392             :                                     const ::com::sun::star::uno::Reference<
     393             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     394             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     395             :                                     ::com::sun::star::lang::WrappedTargetException,
     396             :                                     ::com::sun::star::uno::RuntimeException);
     397             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     398             :                                     const ::com::sun::star::uno::Reference<
     399             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     400             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     401             :                                     ::com::sun::star::lang::WrappedTargetException,
     402             :                                     ::com::sun::star::uno::RuntimeException);
     403             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     404             :                                     const ::com::sun::star::uno::Reference<
     405             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     406             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     407             :                                     ::com::sun::star::lang::WrappedTargetException,
     408             :                                     ::com::sun::star::uno::RuntimeException);
     409             : 
     410             :                             // XServiceInfo
     411             :     virtual OUString SAL_CALL getImplementationName(  )
     412             :                                 throw(::com::sun::star::uno::RuntimeException);
     413             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     414             :                                 throw(::com::sun::star::uno::RuntimeException);
     415             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     416             :                                 throw(::com::sun::star::uno::RuntimeException);
     417             : 
     418             :     sal_uInt16 getOrientation() const;
     419             :     void setOrientation(sal_uInt16 nNew);
     420             :     long getPosition() const;
     421             :     bool getIsDataLayoutDimension() const;
     422             :     sal_uInt16 getFunction() const;
     423             :     void setFunction(sal_uInt16 nNew);       // for data dimension
     424             :     long getUsedHierarchy() const;
     425             :     void setUsedHierarchy(long nNew);
     426             : 
     427          42 :     bool                        HasSelectedPage() const     { return bHasSelectedPage; }
     428             :     const ScDPItemData&         GetSelectedData();
     429             : 
     430             :     const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const;
     431             : };
     432             : 
     433             : class ScDPHierarchies : public cppu::WeakImplHelper2<
     434             :                             com::sun::star::container::XNameAccess,
     435             :                             com::sun::star::lang::XServiceInfo >
     436             : {
     437             : private:
     438             :     ScDPSource*         pSource;
     439             :     long                nDim;
     440             :     long                nHierCount;
     441             :     ScDPHierarchy**     ppHiers;
     442             : 
     443             : public:
     444             :                             ScDPHierarchies( ScDPSource* pSrc, long nD );
     445             :     virtual                 ~ScDPHierarchies();
     446             : 
     447             :                             // XNameAccess
     448             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     449             :                                 throw(::com::sun::star::container::NoSuchElementException,
     450             :                                     ::com::sun::star::lang::WrappedTargetException,
     451             :                                     ::com::sun::star::uno::RuntimeException);
     452             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
     453             :                                 throw(::com::sun::star::uno::RuntimeException);
     454             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     455             :                                 throw(::com::sun::star::uno::RuntimeException);
     456             : 
     457             :                             // XElementAccess
     458             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     459             :                                 throw(::com::sun::star::uno::RuntimeException);
     460             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
     461             : 
     462             :                             // XServiceInfo
     463             :     virtual OUString SAL_CALL getImplementationName(  )
     464             :                                 throw(::com::sun::star::uno::RuntimeException);
     465             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     466             :                                 throw(::com::sun::star::uno::RuntimeException);
     467             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     468             :                                 throw(::com::sun::star::uno::RuntimeException);
     469             : 
     470             :     virtual long            getCount() const;
     471             :     virtual ScDPHierarchy*  getByIndex(long nIndex) const;
     472             : };
     473             : 
     474             : class ScDPHierarchy : public cppu::WeakImplHelper3<
     475             :                             com::sun::star::sheet::XLevelsSupplier,
     476             :                             com::sun::star::container::XNamed,
     477             :                             com::sun::star::lang::XServiceInfo >
     478             : {
     479             : private:
     480             :     ScDPSource*     pSource;
     481             :     long            nDim;
     482             :     long            nHier;
     483             :     ScDPLevels*     pLevels;
     484             : 
     485             : public:
     486             :                             ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
     487             :     virtual                 ~ScDPHierarchy();
     488             : 
     489             :     ScDPLevels*             GetLevelsObject();
     490             : 
     491             :                             // XNamed
     492             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     493             :     virtual void SAL_CALL   setName( const OUString& aName )
     494             :                                 throw(::com::sun::star::uno::RuntimeException);
     495             : 
     496             :                             // XLevelsSupplier
     497             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
     498             :                             getLevels() throw(::com::sun::star::uno::RuntimeException);
     499             : 
     500             :                             // XServiceInfo
     501             :     virtual OUString SAL_CALL getImplementationName(  )
     502             :                                 throw(::com::sun::star::uno::RuntimeException);
     503             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     504             :                                 throw(::com::sun::star::uno::RuntimeException);
     505             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     506             :                                 throw(::com::sun::star::uno::RuntimeException);
     507             : };
     508             : 
     509             : class ScDPLevels : public cppu::WeakImplHelper2<
     510             :                             com::sun::star::container::XNameAccess,
     511             :                             com::sun::star::lang::XServiceInfo >
     512             : {
     513             : private:
     514             :     ScDPSource*     pSource;
     515             :     long            nDim;
     516             :     long            nHier;
     517             :     long            nLevCount;
     518             :     ScDPLevel**     ppLevs;
     519             : 
     520             : public:
     521             :                             ScDPLevels( ScDPSource* pSrc, long nD, long nH );
     522             :     virtual                 ~ScDPLevels();
     523             : 
     524             :                             // XNameAccess
     525             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     526             :                                 throw(::com::sun::star::container::NoSuchElementException,
     527             :                                     ::com::sun::star::lang::WrappedTargetException,
     528             :                                     ::com::sun::star::uno::RuntimeException);
     529             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
     530             :                                 throw(::com::sun::star::uno::RuntimeException);
     531             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     532             :                                 throw(::com::sun::star::uno::RuntimeException);
     533             : 
     534             :                             // XElementAccess
     535             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     536             :                                 throw(::com::sun::star::uno::RuntimeException);
     537             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
     538             : 
     539             :                             // XServiceInfo
     540             :     virtual OUString SAL_CALL getImplementationName(  )
     541             :                                 throw(::com::sun::star::uno::RuntimeException);
     542             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     543             :                                 throw(::com::sun::star::uno::RuntimeException);
     544             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     545             :                                 throw(::com::sun::star::uno::RuntimeException);
     546             : 
     547             :     virtual long            getCount() const;
     548             :     virtual ScDPLevel*      getByIndex(long nIndex) const;
     549             : };
     550             : 
     551             : class ScDPLevel : public cppu::WeakImplHelper5<
     552             :                             com::sun::star::sheet::XMembersSupplier,
     553             :                             com::sun::star::container::XNamed,
     554             :                             com::sun::star::sheet::XDataPilotMemberResults,
     555             :                             com::sun::star::beans::XPropertySet,
     556             :                             com::sun::star::lang::XServiceInfo >
     557             : {
     558             : private:
     559             :     ScDPSource*                 pSource;
     560             :     long                        nDim;
     561             :     long                        nHier;
     562             :     long                        nLev;
     563             :     ScDPMembers*                pMembers;
     564             :     com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> aSubTotals;
     565             :     ::com::sun::star::sheet::DataPilotFieldSortInfo     aSortInfo;      // stored user settings
     566             :     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo;  // stored user settings
     567             :     ::com::sun::star::sheet::DataPilotFieldLayoutInfo   aLayoutInfo;    // stored user settings
     568             :                                                     // valid only from result calculation:
     569             :     ::std::vector<sal_Int32>    aGlobalOrder;       // result of sorting by name or position
     570             :     long                        nSortMeasure;       // measure (index of data dimension) to sort by
     571             :     long                        nAutoMeasure;       // measure (index of data dimension) for AutoShow
     572             :     bool                        bShowEmpty:1;
     573             :     bool                        bEnableLayout:1;      // enabled only for row fields, not for the innermost one
     574             : 
     575             : public:
     576             :                             ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL );
     577             :     virtual                 ~ScDPLevel();
     578             : 
     579             :     ScDPMembers*            GetMembersObject();
     580             : 
     581             :                             // XNamed
     582             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     583             :     virtual void SAL_CALL   setName( const OUString& aName )
     584             :                                 throw(::com::sun::star::uno::RuntimeException);
     585             : 
     586             :                             // XMembersSupplier
     587             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
     588             :                             getMembers() throw(::com::sun::star::uno::RuntimeException);
     589             : 
     590             :                             // XDataPilotMemberResults
     591             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::MemberResult > SAL_CALL
     592             :                             getResults() throw(::com::sun::star::uno::RuntimeException);
     593             : 
     594             :                             // XPropertySet
     595             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     596             :                             SAL_CALL getPropertySetInfo(  )
     597             :                                 throw(::com::sun::star::uno::RuntimeException);
     598             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     599             :                                     const ::com::sun::star::uno::Any& aValue )
     600             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     601             :                                     ::com::sun::star::beans::PropertyVetoException,
     602             :                                     ::com::sun::star::lang::IllegalArgumentException,
     603             :                                     ::com::sun::star::lang::WrappedTargetException,
     604             :                                     ::com::sun::star::uno::RuntimeException);
     605             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     606             :                                     const OUString& PropertyName )
     607             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     608             :                                     ::com::sun::star::lang::WrappedTargetException,
     609             :                                     ::com::sun::star::uno::RuntimeException);
     610             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     611             :                                     const ::com::sun::star::uno::Reference<
     612             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     613             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     614             :                                     ::com::sun::star::lang::WrappedTargetException,
     615             :                                     ::com::sun::star::uno::RuntimeException);
     616             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     617             :                                     const ::com::sun::star::uno::Reference<
     618             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     619             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     620             :                                     ::com::sun::star::lang::WrappedTargetException,
     621             :                                     ::com::sun::star::uno::RuntimeException);
     622             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     623             :                                     const ::com::sun::star::uno::Reference<
     624             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     625             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     626             :                                     ::com::sun::star::lang::WrappedTargetException,
     627             :                                     ::com::sun::star::uno::RuntimeException);
     628             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     629             :                                     const ::com::sun::star::uno::Reference<
     630             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     631             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     632             :                                     ::com::sun::star::lang::WrappedTargetException,
     633             :                                     ::com::sun::star::uno::RuntimeException);
     634             : 
     635             :                             // XServiceInfo
     636             :     virtual OUString SAL_CALL getImplementationName(  )
     637             :                                 throw(::com::sun::star::uno::RuntimeException);
     638             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     639             :                                 throw(::com::sun::star::uno::RuntimeException);
     640             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     641             :                                 throw(::com::sun::star::uno::RuntimeException);
     642             : 
     643             :     com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> getSubTotals() const;
     644             :     bool getShowEmpty() const;
     645             : 
     646         167 :     const ::com::sun::star::sheet::DataPilotFieldSortInfo& GetSortInfo() const      { return aSortInfo; }
     647         289 :     const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const  { return aAutoShowInfo; }
     648             : 
     649             :     void EvaluateSortOrder();
     650             :     void SetEnableLayout(bool bSet);
     651             : 
     652             :     const ::std::vector<sal_Int32>& GetGlobalOrder() const      { return aGlobalOrder; }
     653         345 :     ::std::vector<sal_Int32>&  GetGlobalOrder()                 { return aGlobalOrder; }
     654           0 :     long                    GetSortMeasure() const              { return nSortMeasure; }
     655           1 :     long                    GetAutoMeasure() const              { return nAutoMeasure; }
     656             : 
     657        2626 :     bool IsOutlineLayout() const
     658             :     {
     659        3068 :         return bEnableLayout &&
     660         442 :             aLayoutInfo.LayoutMode !=
     661        2626 :             ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
     662             :     }
     663             : 
     664           0 :     bool IsSubtotalsAtTop() const
     665             :     {
     666           0 :         return bEnableLayout &&
     667           0 :             aLayoutInfo.LayoutMode ==
     668           0 :             ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP;
     669             :     }
     670             : 
     671        5841 :     bool IsAddEmpty() const
     672             :     {
     673        5841 :         return bEnableLayout && aLayoutInfo.AddEmptyLines;
     674             :     }
     675             : 
     676             :     //! number format (for data fields and date fields)
     677             : };
     678             : 
     679             : // hash map from name to index in the member array, for fast name access
     680             : typedef ::boost::unordered_map< OUString, sal_Int32, OUStringHash > ScDPMembersHashMap;
     681             : 
     682             : class ScDPMembers : public cppu::WeakImplHelper2<
     683             :                             com::sun::star::container::XNameAccess,
     684             :                             com::sun::star::lang::XServiceInfo >
     685             : {
     686             : private:
     687             :     typedef std::vector<rtl::Reference<ScDPMember> > MembersType;
     688             :     ScDPSource*     pSource;
     689             :     long            nDim;
     690             :     long            nHier;
     691             :     long            nLev;
     692             :     long            nMbrCount;
     693             :     mutable MembersType maMembers;
     694             :     mutable ScDPMembersHashMap aHashMap;
     695             : 
     696             : public:
     697             :                             ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL );
     698             :     virtual                 ~ScDPMembers();
     699             : 
     700             :                             // XNameAccess
     701             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     702             :                                 throw(::com::sun::star::container::NoSuchElementException,
     703             :                                     ::com::sun::star::lang::WrappedTargetException,
     704             :                                     ::com::sun::star::uno::RuntimeException);
     705             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
     706             :                                 throw(::com::sun::star::uno::RuntimeException);
     707             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     708             :                                 throw(::com::sun::star::uno::RuntimeException);
     709             : 
     710             :                             // XElementAccess
     711             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     712             :                                 throw(::com::sun::star::uno::RuntimeException);
     713             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
     714             : 
     715             :                             // XServiceInfo
     716             :     virtual OUString SAL_CALL getImplementationName(  )
     717             :                                 throw(::com::sun::star::uno::RuntimeException);
     718             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     719             :                                 throw(::com::sun::star::uno::RuntimeException);
     720             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     721             :                                 throw(::com::sun::star::uno::RuntimeException);
     722             : 
     723             :     long getCount() const;
     724             :     ScDPMember* getByIndex(long nIndex) const;
     725             : 
     726             :     long                    getMinMembers() const;
     727             : 
     728             :     sal_Int32               GetIndexFromName( const OUString& rName ) const;     // <0 if not found
     729             :     const std::vector<sal_Int32>&    GetGlobalOrder();
     730             :     const ScDPItemData*               GetSrcItemDataByIndex(  SCROW nIndex);
     731             :     SCROW                                   GetSrcItemsCount();
     732             : };
     733             : 
     734             : class ScDPMember : boost::noncopyable, public cppu::WeakImplHelper3<
     735             :                             com::sun::star::container::XNamed,
     736             :                             com::sun::star::beans::XPropertySet,
     737             :                             com::sun::star::lang::XServiceInfo >
     738             : {
     739             : private:
     740             :     ScDPSource*     pSource;
     741             :     long            nDim;
     742             :     long            nHier;
     743             :     long            nLev;
     744             : 
     745             :     SCROW       mnDataId;
     746             :     boost::scoped_ptr<OUString> mpLayoutName;
     747             : 
     748             :     sal_Int32       nPosition;          // manual sorting
     749             :     bool            bVisible;
     750             :     bool            bShowDet;
     751             : 
     752             : public:
     753             :     ScDPMember(ScDPSource* pSrc, long nD, long nH, long nL, SCROW nIndex);
     754             :     virtual                 ~ScDPMember();
     755             : 
     756             :     OUString GetNameStr() const;
     757             :     void                    FillItemData( ScDPItemData& rData ) const;
     758             :     const ScDPItemData*  GetItemData() const;
     759        4080 :     SCROW GetItemDataId() const { return mnDataId; }
     760             :     bool IsNamedItem(SCROW nIndex) const;
     761             : 
     762             :     SC_DLLPUBLIC const OUString* GetLayoutName() const;
     763             :     long GetDim() const;
     764             : 
     765             :     sal_Int32               Compare( const ScDPMember& rOther ) const;      // visible order
     766             : 
     767             :                             // XNamed
     768             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     769             :     virtual void SAL_CALL   setName( const OUString& aName )
     770             :                                 throw(::com::sun::star::uno::RuntimeException);
     771             : 
     772             :                             // XPropertySet
     773             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     774             :                             SAL_CALL getPropertySetInfo(  )
     775             :                                 throw(::com::sun::star::uno::RuntimeException);
     776             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     777             :                                     const ::com::sun::star::uno::Any& aValue )
     778             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     779             :                                     ::com::sun::star::beans::PropertyVetoException,
     780             :                                     ::com::sun::star::lang::IllegalArgumentException,
     781             :                                     ::com::sun::star::lang::WrappedTargetException,
     782             :                                     ::com::sun::star::uno::RuntimeException);
     783             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     784             :                                     const OUString& PropertyName )
     785             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     786             :                                     ::com::sun::star::lang::WrappedTargetException,
     787             :                                     ::com::sun::star::uno::RuntimeException);
     788             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     789             :                                     const ::com::sun::star::uno::Reference<
     790             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     791             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     792             :                                     ::com::sun::star::lang::WrappedTargetException,
     793             :                                     ::com::sun::star::uno::RuntimeException);
     794             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     795             :                                     const ::com::sun::star::uno::Reference<
     796             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     797             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     798             :                                     ::com::sun::star::lang::WrappedTargetException,
     799             :                                     ::com::sun::star::uno::RuntimeException);
     800             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     801             :                                     const ::com::sun::star::uno::Reference<
     802             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     803             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     804             :                                     ::com::sun::star::lang::WrappedTargetException,
     805             :                                     ::com::sun::star::uno::RuntimeException);
     806             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     807             :                                     const ::com::sun::star::uno::Reference<
     808             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     809             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     810             :                                     ::com::sun::star::lang::WrappedTargetException,
     811             :                                     ::com::sun::star::uno::RuntimeException);
     812             : 
     813             :                             // XServiceInfo
     814             :     virtual OUString SAL_CALL getImplementationName(  )
     815             :                                 throw(::com::sun::star::uno::RuntimeException);
     816             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     817             :                                 throw(::com::sun::star::uno::RuntimeException);
     818             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     819             :                                 throw(::com::sun::star::uno::RuntimeException);
     820             : 
     821             :     bool isVisible() const;
     822             :     bool getShowDetails() const;
     823             : };
     824             : 
     825             : 
     826             : #endif
     827             : 
     828             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10