LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - dapiuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1271 1878 67.7 %
Date: 2012-08-25 Functions: 187 255 73.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1478 3999 37.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <algorithm>
      31                 :            : #include <svl/smplhint.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : 
      34                 :            : #include "dapiuno.hxx"
      35                 :            : #include "datauno.hxx"
      36                 :            : #include "miscuno.hxx"
      37                 :            : #include "convuno.hxx"
      38                 :            : #include "docsh.hxx"
      39                 :            : #include "tabvwsh.hxx"
      40                 :            : #include "pivot.hxx"
      41                 :            : #include "rangeutl.hxx"
      42                 :            : #include "dpobject.hxx"
      43                 :            : #include "dpshttab.hxx"
      44                 :            : #include "dpsdbtab.hxx"
      45                 :            : #include "dpsave.hxx"
      46                 :            : #include "dbdocfun.hxx"
      47                 :            : #include "unonames.hxx"
      48                 :            : #include "dpgroup.hxx"
      49                 :            : #include "dpdimsave.hxx"
      50                 :            : #include "hints.hxx"
      51                 :            : 
      52                 :            : #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
      53                 :            : #include <com/sun/star/sheet/XLevelsSupplier.hpp>
      54                 :            : #include <com/sun/star/sheet/XMembersSupplier.hpp>
      55                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      56                 :            : #include <com/sun/star/sheet/DataImportMode.hpp>
      57                 :            : #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
      58                 :            : #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
      59                 :            : #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
      60                 :            : #include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
      61                 :            : 
      62                 :            : #include <comphelper/extract.hxx>
      63                 :            : #include <comphelper/sequence.hxx>
      64                 :            : #include <comphelper/servicehelper.hxx>
      65                 :            : 
      66                 :            : using namespace com::sun::star;
      67                 :            : using namespace com::sun::star::sheet;
      68                 :            : 
      69                 :            : using ::rtl::OUString;
      70                 :            : 
      71                 :            : using ::com::sun::star::uno::Any;
      72                 :            : using ::com::sun::star::uno::Exception;
      73                 :            : using ::com::sun::star::uno::Reference;
      74                 :            : using ::com::sun::star::uno::RuntimeException;
      75                 :            : using ::com::sun::star::uno::Sequence;
      76                 :            : using ::com::sun::star::uno::UNO_QUERY;
      77                 :            : using ::com::sun::star::uno::UNO_QUERY_THROW;
      78                 :            : 
      79                 :            : using ::com::sun::star::container::ElementExistException;
      80                 :            : using ::com::sun::star::container::NoSuchElementException;
      81                 :            : using ::com::sun::star::container::XEnumeration;
      82                 :            : using ::com::sun::star::container::XIndexAccess;
      83                 :            : using ::com::sun::star::container::XNameAccess;
      84                 :            : using ::com::sun::star::container::XNamed;
      85                 :            : 
      86                 :            : using ::com::sun::star::beans::PropertyVetoException;
      87                 :            : using ::com::sun::star::beans::UnknownPropertyException;
      88                 :            : using ::com::sun::star::beans::XPropertyChangeListener;
      89                 :            : using ::com::sun::star::beans::XPropertySet;
      90                 :            : using ::com::sun::star::beans::XPropertySetInfo;
      91                 :            : using ::com::sun::star::beans::XVetoableChangeListener;
      92                 :            : 
      93                 :            : using ::com::sun::star::lang::IllegalArgumentException;
      94                 :            : using ::com::sun::star::lang::IndexOutOfBoundsException;
      95                 :            : using ::com::sun::star::lang::WrappedTargetException;
      96                 :            : 
      97                 :            : using ::com::sun::star::table::CellAddress;
      98                 :            : using ::com::sun::star::table::CellRangeAddress;
      99                 :            : 
     100                 :            : // ============================================================================
     101                 :            : 
     102                 :            : namespace {
     103                 :            : 
     104                 :         80 : const SfxItemPropertyMapEntry* lcl_GetDataPilotDescriptorBaseMap()
     105                 :            : {
     106                 :            :     static SfxItemPropertyMapEntry aDataPilotDescriptorBaseMap_Impl[] =
     107                 :            :     {
     108         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_COLGRAND),     0,  &getBooleanCppuType(),  0, 0 },
     109         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_DRILLDOWN),    0,  &getBooleanCppuType(),  0, 0 },
     110         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_GRANDTOTAL_NAME),0,&getCppuType((rtl::OUString*)0), beans::PropertyAttribute::MAYBEVOID, 0 },
     111         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_IGNORE_EMPTYROWS),   0,  &getBooleanCppuType(),  0, 0 },
     112         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_IMPORTDESC),   0,  &getCppuType((uno::Sequence<beans::PropertyValue>*)0), 0, 0 },
     113         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_REPEATEMPTY),     0,  &getBooleanCppuType(),  0, 0 },
     114         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_ROWGRAND),     0,  &getBooleanCppuType(),  0, 0 },
     115         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_SERVICEARG),   0,  &getCppuType((uno::Sequence<beans::PropertyValue>*)0), 0, 0 },
     116         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_SHOWFILTER),     0,  &getBooleanCppuType(),  0, 0 },
     117         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNO_DP_SOURCESERVICE),   0,  &getCppuType((rtl::OUString*)0), 0, 0 },
     118                 :            :         {0,0,0,0,0,0}
     119 [ +  + ][ +  - ]:         87 :     };
                 [ #  # ]
     120                 :         80 :     return aDataPilotDescriptorBaseMap_Impl;
     121                 :            : }
     122                 :            : 
     123                 :            : // ----------------------------------------------------------------------------
     124                 :            : 
     125                 :        161 : const SfxItemPropertyMapEntry* lcl_GetDataPilotFieldMap()
     126                 :            : {
     127                 :            :     using namespace ::com::sun::star::beans::PropertyAttribute;
     128                 :            :     static SfxItemPropertyMapEntry aDataPilotFieldMap_Impl[] =
     129                 :            :     {
     130         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_AUTOSHOW),     0,  &getCppuType((DataPilotFieldAutoShowInfo*)0),   MAYBEVOID, 0 },
     131         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_FUNCTION),     0,  &getCppuType((GeneralFunction*)0),              0, 0 },
     132         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_GROUPINFO),    0,  &getCppuType((DataPilotFieldGroupInfo*)0),      MAYBEVOID, 0 },
     133         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_HASAUTOSHOW),  0,  &getBooleanCppuType(),                          0, 0 },
     134         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_HASLAYOUTINFO),0,  &getBooleanCppuType(),                          0, 0 },
     135         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_HASREFERENCE), 0,  &getBooleanCppuType(),                          0, 0 },
     136         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_HASSORTINFO),  0,  &getBooleanCppuType(),                          0, 0 },
     137         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_ISGROUP),      0,  &getBooleanCppuType(),                          0, 0 },
     138         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_LAYOUTINFO),   0,  &getCppuType((DataPilotFieldLayoutInfo*)0),     MAYBEVOID, 0 },
     139         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_ORIENT),       0,  &getCppuType((DataPilotFieldOrientation*)0),    MAYBEVOID, 0 },
     140         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_REFERENCE),    0,  &getCppuType((DataPilotFieldReference*)0),      MAYBEVOID, 0 },
     141         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_SELPAGE),      0,  &getCppuType((OUString*)0),                     0, 0 },
     142         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_SHOWEMPTY),    0,  &getBooleanCppuType(),                          0, 0 },
     143         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_SORTINFO),     0,  &getCppuType((DataPilotFieldSortInfo*)0),       MAYBEVOID, 0 },
     144         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_SUBTOTALS),    0,  &getCppuType((Sequence<GeneralFunction>*)0),    0, 0 },
     145         [ +  - ]:          7 :         {MAP_CHAR_LEN(SC_UNONAME_USESELPAGE),   0,  &getBooleanCppuType(),                          0, 0 },
     146                 :            :         {0,0,0,0,0,0}
     147 [ +  + ][ +  - ]:        168 :     };
                 [ #  # ]
     148                 :        161 :     return aDataPilotFieldMap_Impl;
     149                 :            : }
     150                 :            : 
     151                 :            : // ----------------------------------------------------------------------------
     152                 :            : 
     153                 :         15 : const SfxItemPropertyMapEntry* lcl_GetDataPilotItemMap()
     154                 :            : {
     155                 :            :     static SfxItemPropertyMapEntry aDataPilotItemMap_Impl[] =
     156                 :            :     {
     157         [ +  - ]:          1 :         {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN),     0,  &getBooleanCppuType(),          0, 0 },
     158         [ +  - ]:          1 :         {MAP_CHAR_LEN(SC_UNONAME_POS),          0,  &getCppuType((sal_Int32*)0),    0, 0 },
     159         [ +  - ]:          1 :         {MAP_CHAR_LEN(SC_UNONAME_SHOWDETAIL),   0,  &getBooleanCppuType(),          0, 0 },
     160                 :            :         {0,0,0,0,0,0}
     161 [ +  + ][ +  - ]:         16 :     };
                 [ #  # ]
     162                 :         15 :     return aDataPilotItemMap_Impl;
     163                 :            : }
     164                 :            : 
     165                 :            : // ----------------------------------------------------------------------------
     166                 :            : 
     167                 :          0 : inline bool lclCheckValidDouble( double fValue, sal_Bool bAuto )
     168                 :            : {
     169 [ #  # ][ #  # ]:          0 :     return bAuto || ::rtl::math::isFinite( fValue );
     170                 :            : }
     171                 :            : 
     172                 :          0 : bool lclCheckMinMaxStep( const DataPilotFieldGroupInfo& rInfo )
     173                 :            : {
     174                 :            :     return
     175                 :          0 :         lclCheckValidDouble( rInfo.Start, rInfo.HasAutoStart ) &&
     176                 :          0 :         lclCheckValidDouble( rInfo.End, rInfo.HasAutoEnd ) &&
     177                 :            :         (rInfo.HasAutoStart || rInfo.HasAutoEnd || (rInfo.Start <= rInfo.End)) &&
     178                 :          0 :         lclCheckValidDouble( rInfo.Step, false ) &&
     179 [ #  # ][ #  # ]:          0 :         (0.0 <= rInfo.Step);
           [ #  #  #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     180                 :            : }
     181                 :            : 
     182                 :            : } // namespace
     183                 :            : 
     184                 :            : // ============================================================================
     185                 :            : 
     186         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScDataPilotDescriptor, "ScDataPilotDescriptor", "stardiv::one::sheet::DataPilotDescriptor" )
     187         [ #  # ]:          2 : SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldObj, "ScDataPilotFieldObj", "com.sun.star.sheet.DataPilotField" )
     188         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldsObj, "ScDataPilotFieldsObj", "com.sun.star.sheet.DataPilotFields" )
     189         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScDataPilotTableObj, "ScDataPilotTableObj", "com.sun.star.sheet.DataPilotTable" )
     190         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScDataPilotTablesObj, "ScDataPilotTablesObj", "com.sun.star.sheet.DataPilotTables" )
     191         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScDataPilotItemsObj, "ScDataPilotItemsObj", "com.sun.star.sheet.DataPilotItems" )
     192         [ #  # ]:          2 : SC_SIMPLE_SERVICE_INFO( ScDataPilotItemObj, "ScDataPilotItemObj", "com.sun.star.sheet.DataPilotItem" )
     193                 :            : 
     194         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupsObj, "ScDataPilotFieldGroupsObj", "com.sun.star.sheet.DataPilotFieldGroups" )
     195         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupObj, "ScDataPilotFieldGroupObj", "com.sun.star.sheet.DataPilotFieldGroup" )
     196         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupItemObj, "ScDataPilotFieldGroupItemObj", "com.sun.star.sheet.DataPilotFieldGroupItem" )
     197                 :            : 
     198                 :            : //------------------------------------------------------------------------
     199                 :            : 
     200                 :            : // name that is used in the API for the data layout field
     201                 :            : #define SC_DATALAYOUT_NAME  "Data"
     202                 :            : 
     203                 :            : //------------------------------------------------------------------------
     204                 :            : 
     205                 :          0 : GeneralFunction ScDataPilotConversion::FirstFunc( sal_uInt16 nBits )
     206                 :            : {
     207         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_SUM )       return GeneralFunction_SUM;
     208         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_COUNT )     return GeneralFunction_COUNT;
     209         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_AVERAGE )   return GeneralFunction_AVERAGE;
     210         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_MAX )       return GeneralFunction_MAX;
     211         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_MIN )       return GeneralFunction_MIN;
     212         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_PRODUCT )   return GeneralFunction_PRODUCT;
     213         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_COUNT_NUM ) return GeneralFunction_COUNTNUMS;
     214         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_STD_DEV )   return GeneralFunction_STDEV;
     215         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_STD_DEVP )  return GeneralFunction_STDEVP;
     216         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_STD_VAR )   return GeneralFunction_VAR;
     217         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_STD_VARP )  return GeneralFunction_VARP;
     218         [ #  # ]:          0 :     if ( nBits & PIVOT_FUNC_AUTO )      return GeneralFunction_AUTO;
     219                 :          0 :     return GeneralFunction_NONE;
     220                 :            : }
     221                 :            : 
     222                 :          0 : sal_uInt16 ScDataPilotConversion::FunctionBit( GeneralFunction eFunc )
     223                 :            : {
     224                 :          0 :     sal_uInt16 nRet = PIVOT_FUNC_NONE;  // 0
     225   [ #  #  #  #  :          0 :     switch (eFunc)
          #  #  #  #  #  
             #  #  #  # ]
     226                 :            :     {
     227                 :          0 :         case GeneralFunction_SUM:       nRet = PIVOT_FUNC_SUM;       break;
     228                 :          0 :         case GeneralFunction_COUNT:     nRet = PIVOT_FUNC_COUNT;     break;
     229                 :          0 :         case GeneralFunction_AVERAGE:   nRet = PIVOT_FUNC_AVERAGE;   break;
     230                 :          0 :         case GeneralFunction_MAX:       nRet = PIVOT_FUNC_MAX;       break;
     231                 :          0 :         case GeneralFunction_MIN:       nRet = PIVOT_FUNC_MIN;       break;
     232                 :          0 :         case GeneralFunction_PRODUCT:   nRet = PIVOT_FUNC_PRODUCT;   break;
     233                 :          0 :         case GeneralFunction_COUNTNUMS: nRet = PIVOT_FUNC_COUNT_NUM; break;
     234                 :          0 :         case GeneralFunction_STDEV:     nRet = PIVOT_FUNC_STD_DEV;   break;
     235                 :          0 :         case GeneralFunction_STDEVP:    nRet = PIVOT_FUNC_STD_DEVP;  break;
     236                 :          0 :         case GeneralFunction_VAR:       nRet = PIVOT_FUNC_STD_VAR;   break;
     237                 :          0 :         case GeneralFunction_VARP:      nRet = PIVOT_FUNC_STD_VARP;  break;
     238                 :          0 :         case GeneralFunction_AUTO:      nRet = PIVOT_FUNC_AUTO;      break;
     239                 :            :         default:
     240                 :            :         {
     241                 :            :             // added to avoid warnings
     242                 :            :         }
     243                 :            :     }
     244                 :          0 :     return nRet;
     245                 :            : }
     246                 :            : 
     247                 :          3 : void ScDataPilotConversion::FillGroupInfo( DataPilotFieldGroupInfo& rInfo, const ScDPNumGroupInfo& rGroupInfo )
     248                 :            : {
     249                 :          3 :     rInfo.HasDateValues = rGroupInfo.mbDateValues;
     250                 :          3 :     rInfo.HasAutoStart  = rGroupInfo.mbAutoStart;
     251                 :          3 :     rInfo.Start         = rGroupInfo.mfStart;
     252                 :          3 :     rInfo.HasAutoEnd    = rGroupInfo.mbAutoEnd;
     253                 :          3 :     rInfo.End           = rGroupInfo.mfEnd;
     254                 :          3 :     rInfo.Step          = rGroupInfo.mfStep;
     255                 :          3 : }
     256                 :            : 
     257                 :            : //------------------------------------------------------------------------
     258                 :            : 
     259                 :        958 : ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const OUString& rName )
     260                 :            : {
     261         [ +  - ]:        958 :     if (pDocShell)
     262                 :            :     {
     263                 :        958 :         ScDocument* pDoc = pDocShell->GetDocument();
     264                 :        958 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     265         [ +  - ]:        958 :         if ( pColl )
     266                 :            :         {
     267                 :        958 :             size_t nCount = pColl->GetCount();
     268         [ +  + ]:       1572 :             for (size_t i=0; i<nCount; ++i)
     269                 :            :             {
     270                 :       1571 :                 ScDPObject* pDPObj = (*pColl)[i];
     271         [ +  + ]:       3142 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab &&
           [ +  -  +  + ]
     272                 :       1571 :                      pDPObj->GetName() == rName )
     273                 :        957 :                     return pDPObj;
     274                 :            :             }
     275                 :            :         }
     276                 :            :     }
     277                 :        958 :     return NULL;    // nicht gefunden
     278                 :            : }
     279                 :            : 
     280                 :          0 : String lcl_CreatePivotName( ScDocShell* pDocShell )
     281                 :            : {
     282         [ #  # ]:          0 :     if (pDocShell)
     283                 :            :     {
     284                 :          0 :         ScDocument* pDoc = pDocShell->GetDocument();
     285                 :          0 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     286         [ #  # ]:          0 :         if ( pColl )
     287         [ #  # ]:          0 :             return pColl->CreateNewName();
     288                 :            :     }
     289                 :          0 :     return String();                    // sollte nicht vorkommen
     290                 :            : }
     291                 :            : 
     292                 :         63 : sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rFieldId )
     293                 :            : {
     294                 :            :     // used for items - nRepeat in identifier can be ignored
     295         [ +  - ]:         63 :     if ( pDPObj )
     296                 :            :     {
     297                 :         63 :         sal_Int32 nCount = pDPObj->GetDimCount();
     298         [ +  - ]:        126 :         for ( sal_Int32 nDim = 0; nDim < nCount; ++nDim )
     299                 :            :         {
     300                 :         63 :             bool bIsDataLayout = false;
     301         [ +  - ]:         63 :             OUString aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) );
     302 [ -  + ][ +  - ]:         63 :             if ( rFieldId.mbDataLayout ? bIsDataLayout : (aDimName == rFieldId.maFieldName) )
     303                 :         63 :                 return nDim;
     304         [ -  + ]:         63 :         }
     305                 :            :     }
     306                 :         63 :     return -1;  // none
     307                 :            : }
     308                 :            : 
     309                 :            : //------------------------------------------------------------------------
     310                 :            : 
     311                 :         68 : ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) :
     312                 :            :     pDocShell( pDocSh ),
     313         [ +  - ]:         68 :     nTab( nT )
     314                 :            : {
     315         [ +  - ]:         68 :     pDocShell->GetDocument()->AddUnoObject(*this);
     316                 :         68 : }
     317                 :            : 
     318         [ +  - ]:         68 : ScDataPilotTablesObj::~ScDataPilotTablesObj()
     319                 :            : {
     320         [ +  + ]:         68 :     if (pDocShell)
     321         [ +  - ]:         44 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
     322         [ -  + ]:        136 : }
     323                 :            : 
     324                 :        267 : void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     325                 :            : {
     326                 :            :     //! Referenz-Update
     327                 :            : 
     328   [ +  +  +  + ]:        432 :     if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  + ]
     329                 :        165 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
     330                 :            :     {
     331                 :         24 :         pDocShell = NULL;       // ungueltig geworden
     332                 :            :     }
     333                 :        267 : }
     334                 :            : 
     335                 :            : // XDataPilotTables
     336                 :            : 
     337                 :         12 : ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nIndex )
     338                 :            : {
     339         [ +  - ]:         12 :     if (pDocShell)
     340                 :            :     {
     341                 :         12 :         ScDocument* pDoc = pDocShell->GetDocument();
     342                 :         12 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     343         [ +  - ]:         12 :         if ( pColl )
     344                 :            :         {
     345                 :            :             //  count tables on this sheet
     346                 :         12 :             sal_Int32 nFound = 0;
     347                 :         12 :             size_t nCount = pColl->GetCount();
     348         [ +  + ]:         14 :             for (size_t i=0; i<nCount; ++i)
     349                 :            :             {
     350                 :         12 :                 ScDPObject* pDPObj = (*pColl)[i];
     351         [ +  - ]:         12 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
     352                 :            :                 {
     353         [ +  + ]:         12 :                     if ( nFound == nIndex )
     354                 :            :                     {
     355         [ +  - ]:         10 :                         String aName = pDPObj->GetName();
     356 [ +  - ][ +  - ]:         10 :                         return new ScDataPilotTableObj( pDocShell, nTab, aName );
     357                 :            :                     }
     358                 :          2 :                     ++nFound;
     359                 :            :                 }
     360                 :            :             }
     361                 :            :         }
     362                 :            :     }
     363                 :         12 :     return NULL;
     364                 :            : }
     365                 :            : 
     366                 :         52 : ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const OUString& rName)
     367                 :            : {
     368         [ +  + ]:         52 :     if (hasByName(rName))
     369         [ +  - ]:         51 :         return new ScDataPilotTableObj( pDocShell, nTab, rName );
     370                 :         52 :     return 0;
     371                 :            : }
     372                 :            : 
     373                 :         19 : Reference<XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor()
     374                 :            :                                             throw(RuntimeException)
     375                 :            : {
     376         [ +  - ]:         19 :     SolarMutexGuard aGuard;
     377         [ +  - ]:         19 :     if (pDocShell)
     378 [ +  - ][ +  - ]:         19 :         return new ScDataPilotDescriptor(pDocShell);
     379 [ #  # ][ +  - ]:         19 :     return NULL;
     380                 :            : }
     381                 :            : 
     382                 :        478 : bool lcl_IsDuplicated( const Reference<XPropertySet> xDimProps )
     383                 :            : {
     384                 :            :     try
     385                 :            :     {
     386 [ +  - ][ +  - ]:        478 :         Any aAny = xDimProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_ORIGINAL ) ) );
                 [ +  - ]
     387         [ +  - ]:        478 :         Reference< XNamed > xOriginal( aAny, UNO_QUERY );
     388         [ #  # ]:        478 :         return xOriginal.is();
     389                 :            :     }
     390                 :          0 :     catch( Exception& )
     391                 :            :     {
     392                 :            :     }
     393                 :          0 :     return false;
     394                 :            : }
     395                 :            : 
     396                 :        151 : OUString lcl_GetOriginalName( const Reference< XNamed > xDim )
     397                 :            : {
     398                 :        151 :     Reference< XNamed > xOriginal;
     399                 :            : 
     400         [ +  - ]:        151 :     Reference< XPropertySet > xDimProps( xDim, UNO_QUERY );
     401         [ +  - ]:        151 :     if ( xDimProps.is() )
     402                 :            :     {
     403                 :            :         try
     404                 :            :         {
     405 [ +  - ][ +  - ]:        151 :             Any aAny = xDimProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIGINAL)));
                 [ +  - ]
     406 [ #  # ][ +  - ]:        151 :             aAny >>= xOriginal;
     407                 :            :         }
     408         [ #  # ]:          0 :         catch( Exception& )
     409                 :            :         {
     410                 :            :         }
     411                 :            :     }
     412                 :            : 
     413         [ +  - ]:        151 :     if ( !xOriginal.is() )
     414         [ +  - ]:        151 :         xOriginal = xDim;
     415                 :            : 
     416 [ +  - ][ +  - ]:        151 :     return xOriginal->getName();
     417                 :            : }
     418                 :            : 
     419                 :         20 : void SAL_CALL ScDataPilotTablesObj::insertNewByName( const OUString& aNewName,
     420                 :            :                                     const CellAddress& aOutputAddress,
     421                 :            :                                     const Reference<XDataPilotDescriptor>& xDescriptor )
     422                 :            :                                 throw(RuntimeException)
     423                 :            : {
     424         [ +  - ]:         20 :     SolarMutexGuard aGuard;
     425         [ -  + ]:         39 :     if (!xDescriptor.is()) return;
     426                 :            : 
     427                 :            :     // inserting with already existing name?
     428 [ +  - ][ +  - ]:         20 :     if ( !aNewName.isEmpty() && hasByName( aNewName ) )
         [ +  + ][ +  + ]
     429         [ +  - ]:          1 :         throw RuntimeException();       // no other exceptions specified
     430                 :            : 
     431                 :         19 :     sal_Bool bDone = false;
     432         [ +  - ]:         19 :     ScDataPilotDescriptorBase* pImp = ScDataPilotDescriptorBase::getImplementation( xDescriptor );
     433 [ +  - ][ +  - ]:         19 :     if ( pDocShell && pImp )
     434                 :            :     {
     435         [ +  - ]:         19 :         ScDPObject* pNewObj = pImp->GetDPObject();
     436                 :            : 
     437         [ +  - ]:         19 :         if (pNewObj)
     438                 :            :         {
     439                 :            :             ScRange aOutputRange((SCCOL)aOutputAddress.Column, (SCROW)aOutputAddress.Row, (SCTAB)aOutputAddress.Sheet,
     440                 :         19 :                                 (SCCOL)aOutputAddress.Column, (SCROW)aOutputAddress.Row, (SCTAB)aOutputAddress.Sheet);
     441         [ +  - ]:         19 :             pNewObj->SetOutRange(aOutputRange);
     442         [ +  - ]:         19 :             String aName = aNewName;
     443         [ -  + ]:         19 :             if (!aName.Len())
     444 [ #  # ][ #  # ]:          0 :                 aName = lcl_CreatePivotName( pDocShell );
                 [ #  # ]
     445 [ +  - ][ +  - ]:         19 :             pNewObj->SetName(aName);
     446 [ +  - ][ +  - ]:         19 :             String aTag = xDescriptor->getTag();
                 [ +  - ]
     447 [ +  - ][ +  - ]:         19 :             pNewObj->SetTag(aTag);
     448                 :            : 
     449                 :            :     // todo: handle double fields (for more information see ScDPObject
     450                 :            : 
     451                 :         19 :             ScDBDocFunc aFunc(*pDocShell);
     452 [ +  - ][ +  - ]:         19 :             bDone = aFunc.DataPilotUpdate( NULL, pNewObj, sal_True, sal_True );
                 [ +  - ]
     453                 :            :         }
     454                 :            :     }
     455                 :            : 
     456         [ -  + ]:         19 :     if (!bDone)
     457 [ #  # ][ +  - ]:         20 :         throw RuntimeException();       // no other exceptions specified
                 [ +  - ]
     458                 :            : }
     459                 :            : 
     460                 :          2 : void SAL_CALL ScDataPilotTablesObj::removeByName( const OUString& aName )
     461                 :            :                                         throw(RuntimeException)
     462                 :            : {
     463         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     464         [ +  - ]:          2 :     String aNameStr(aName);
     465 [ +  - ][ +  - ]:          2 :     ScDPObject* pDPObj = lcl_GetDPObject( pDocShell, nTab, aNameStr );
     466 [ +  - ][ +  + ]:          2 :     if (pDPObj && pDocShell)
     467                 :            :     {
     468                 :          1 :         ScDBDocFunc aFunc(*pDocShell);
     469         [ +  - ]:          1 :         aFunc.DataPilotUpdate( pDPObj, NULL, sal_True, sal_True );  // remove - incl. undo etc.
     470                 :            :     }
     471                 :            :     else
     472 [ +  - ][ +  - ]:          2 :         throw RuntimeException();       // no other exceptions specified
                 [ +  - ]
     473                 :          1 : }
     474                 :            : 
     475                 :            : // XEnumerationAccess
     476                 :            : 
     477                 :          2 : Reference< XEnumeration > SAL_CALL ScDataPilotTablesObj::createEnumeration() throw(RuntimeException)
     478                 :            : {
     479         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     480 [ +  - ][ +  - ]:          2 :     return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotTablesEnumeration")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     481                 :            : }
     482                 :            : 
     483                 :            : // XIndexAccess
     484                 :            : 
     485                 :          4 : sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException)
     486                 :            : {
     487         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     488         [ +  - ]:          4 :     if ( pDocShell )
     489                 :            :     {
     490                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
     491         [ +  - ]:          4 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     492         [ +  - ]:          4 :         if ( pColl )
     493                 :            :         {
     494                 :            :             //  count tables on this sheet
     495                 :            : 
     496                 :          4 :             sal_uInt16 nFound = 0;
     497         [ +  - ]:          4 :             size_t nCount = pColl->GetCount();
     498         [ +  + ]:          8 :             for (size_t i=0; i<nCount; ++i)
     499                 :            :             {
     500         [ +  - ]:          4 :                 ScDPObject* pDPObj = (*pColl)[i];
     501         [ +  - ]:          4 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
     502                 :          4 :                     ++nFound;
     503                 :            :             }
     504                 :          4 :             return nFound;
     505                 :            :         }
     506                 :            :     }
     507                 :            : 
     508         [ +  - ]:          4 :     return 0;
     509                 :            : }
     510                 :            : 
     511                 :         12 : Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex )
     512                 :            :         throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
     513                 :            : {
     514         [ +  - ]:         12 :     SolarMutexGuard aGuard;
     515 [ +  - ][ +  + ]:         12 :     Reference<XDataPilotTable2> xTable(GetObjectByIndex_Impl(nIndex));
                 [ +  - ]
     516         [ +  + ]:         12 :     if (!xTable.is())
     517         [ +  - ]:          2 :         throw IndexOutOfBoundsException();
     518 [ +  - ][ +  - ]:         12 :     return Any( xTable );
     519                 :            : }
     520                 :            : 
     521                 :          1 : uno::Type SAL_CALL ScDataPilotTablesObj::getElementType() throw(RuntimeException)
     522                 :            : {
     523         [ +  - ]:          1 :     SolarMutexGuard aGuard;
     524 [ +  - ][ +  - ]:          1 :     return getCppuType((Reference<XDataPilotTable2>*)0);
     525                 :            : }
     526                 :            : 
     527                 :          1 : sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(RuntimeException)
     528                 :            : {
     529         [ +  - ]:          1 :     SolarMutexGuard aGuard;
     530 [ +  - ][ +  - ]:          1 :     return ( getCount() != 0 );
     531                 :            : }
     532                 :            : 
     533                 :            : // XNameAccess
     534                 :            : 
     535                 :         52 : Any SAL_CALL ScDataPilotTablesObj::getByName( const OUString& aName )
     536                 :            :         throw(NoSuchElementException, WrappedTargetException, RuntimeException)
     537                 :            : {
     538         [ +  - ]:         52 :     SolarMutexGuard aGuard;
     539 [ +  - ][ +  + ]:         52 :     Reference<XDataPilotTable2> xTable(GetObjectByName_Impl(aName));
                 [ +  - ]
     540         [ +  + ]:         52 :     if (!xTable.is())
     541         [ +  - ]:          1 :         throw NoSuchElementException();
     542 [ +  - ][ +  - ]:         52 :     return Any( xTable );
     543                 :            : }
     544                 :            : 
     545                 :         18 : Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
     546                 :            :                                                 throw(RuntimeException)
     547                 :            : {
     548         [ +  - ]:         18 :     SolarMutexGuard aGuard;
     549         [ +  - ]:         18 :     if (pDocShell)
     550                 :            :     {
     551                 :         18 :         ScDocument* pDoc = pDocShell->GetDocument();
     552         [ +  - ]:         18 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     553         [ +  - ]:         18 :         if ( pColl )
     554                 :            :         {
     555                 :            :             //  count tables on this sheet
     556                 :            : 
     557                 :         18 :             sal_uInt16 nFound = 0;
     558         [ +  - ]:         18 :             size_t nCount = pColl->GetCount();
     559                 :            :             size_t i;
     560         [ +  + ]:         36 :             for (i=0; i<nCount; ++i)
     561                 :            :             {
     562         [ +  - ]:         18 :                 ScDPObject* pDPObj = (*pColl)[i];
     563         [ +  - ]:         18 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
     564                 :         18 :                     ++nFound;
     565                 :            :             }
     566                 :            : 
     567                 :         18 :             sal_uInt16 nPos = 0;
     568         [ +  - ]:         18 :             Sequence<OUString> aSeq(nFound);
     569         [ +  - ]:         18 :             OUString* pAry = aSeq.getArray();
     570         [ +  + ]:         36 :             for (i=0; i<nCount; ++i)
     571                 :            :             {
     572         [ +  - ]:         18 :                 ScDPObject* pDPObj = (*pColl)[i];
     573         [ +  - ]:         18 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
     574                 :         18 :                     pAry[nPos++] = pDPObj->GetName();
     575                 :            :             }
     576                 :            : 
     577 [ +  - ][ +  - ]:         18 :             return aSeq;
     578                 :            :         }
     579                 :            :     }
     580 [ #  # ][ +  - ]:         18 :     return Sequence<OUString>(0);
     581                 :            : }
     582                 :            : 
     583                 :         88 : sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
     584                 :            :                                         throw(RuntimeException)
     585                 :            : {
     586         [ +  - ]:         88 :     SolarMutexGuard aGuard;
     587         [ +  - ]:         88 :     if (pDocShell)
     588                 :            :     {
     589                 :         88 :         ScDocument* pDoc = pDocShell->GetDocument();
     590         [ +  - ]:         88 :         ScDPCollection* pColl = pDoc->GetDPCollection();
     591         [ +  - ]:         88 :         if ( pColl )
     592                 :            :         {
     593         [ +  - ]:         88 :             size_t nCount = pColl->GetCount();
     594         [ +  + ]:        103 :             for (size_t i=0; i<nCount; ++i)
     595                 :            :             {
     596         [ +  - ]:         68 :                 ScDPObject* pDPObj = (*pColl)[i];
     597   [ +  -  +  + ]:        136 :                 if ( pDPObj->GetOutRange().aStart.Tab() == nTab &&
                 [ +  + ]
     598                 :         68 :                      pDPObj->GetName() == aName )
     599                 :         53 :                     return true;
     600                 :            :             }
     601                 :            :         }
     602                 :            :     }
     603         [ +  - ]:         88 :     return false;
     604                 :            : }
     605                 :            : 
     606                 :            : //------------------------------------------------------------------------
     607                 :            : 
     608                 :         80 : ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) :
     609                 :            :     maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
     610 [ +  - ][ +  - ]:         80 :     pDocShell( pDocSh )
                 [ +  - ]
     611                 :            : {
     612         [ +  - ]:         80 :     pDocShell->GetDocument()->AddUnoObject(*this);
     613                 :         80 : }
     614                 :            : 
     615 [ +  - ][ +  - ]:         79 : ScDataPilotDescriptorBase::~ScDataPilotDescriptorBase()
                 [ +  - ]
     616                 :            : {
     617         [ +  + ]:         79 :     if (pDocShell)
     618         [ +  - ]:         44 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
     619         [ -  + ]:         79 : }
     620                 :            : 
     621                 :        109 : Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType )
     622                 :            :                                                 throw(RuntimeException)
     623                 :            : {
     624 [ +  + ][ +  - ]:        109 :     SC_QUERYINTERFACE( XDataPilotDescriptor )
     625 [ -  + ][ #  # ]:         70 :     SC_QUERYINTERFACE( XPropertySet )
     626 [ -  + ][ #  # ]:         70 :     SC_QUERYINTERFACE( XDataPilotDataLayoutFieldSupplier )
     627 [ +  + ][ +  - ]:         70 :     SC_QUERYINTERFACE( XNamed )                 // base of XDataPilotDescriptor
     628 [ +  + ][ +  - ]:         64 :     SC_QUERYINTERFACE( lang::XUnoTunnel )
     629 [ -  + ][ #  # ]:         45 :     SC_QUERYINTERFACE( lang::XTypeProvider )
     630 [ -  + ][ #  # ]:         45 :     SC_QUERYINTERFACE( lang::XServiceInfo )
     631                 :            : 
     632                 :        109 :     return OWeakObject::queryInterface( rType );
     633                 :            : }
     634                 :            : 
     635                 :        910 : void SAL_CALL ScDataPilotDescriptorBase::acquire() throw()
     636                 :            : {
     637                 :        910 :     OWeakObject::acquire();
     638                 :        910 : }
     639                 :            : 
     640                 :        909 : void SAL_CALL ScDataPilotDescriptorBase::release() throw()
     641                 :            : {
     642                 :        909 :     OWeakObject::release();
     643                 :        909 : }
     644                 :            : 
     645                 :          0 : Sequence< uno::Type > SAL_CALL ScDataPilotDescriptorBase::getTypes()
     646                 :            :                                                     throw(RuntimeException)
     647                 :            : {
     648 [ #  # ][ #  # ]:          0 :     static Sequence< uno::Type > aTypes;
         [ #  # ][ #  # ]
     649         [ #  # ]:          0 :     if ( aTypes.getLength() == 0 )
     650                 :            :     {
     651                 :          0 :         aTypes.realloc( 6 );
     652                 :          0 :         uno::Type* pPtr = aTypes.getArray();
     653                 :          0 :         pPtr[ 0 ] = getCppuType( (const Reference< XDataPilotDescriptor >*)0 );
     654                 :          0 :         pPtr[ 1 ] = getCppuType( (const Reference< XPropertySet >*)0 );
     655                 :          0 :         pPtr[ 2 ] = getCppuType( (const Reference< XDataPilotDataLayoutFieldSupplier >*)0 );
     656                 :          0 :         pPtr[ 3 ] = getCppuType( (const Reference< lang::XUnoTunnel >*)0 );
     657                 :          0 :         pPtr[ 4 ] = getCppuType( (const Reference< lang::XTypeProvider >*)0 );
     658                 :          0 :         pPtr[ 5 ] = getCppuType( (const Reference< lang::XServiceInfo >*)0 );
     659                 :            :     }
     660                 :          0 :     return aTypes;
     661                 :            : }
     662                 :            : 
     663                 :            : namespace
     664                 :            : {
     665                 :            :     class theScDataPilotDescriptorBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theScDataPilotDescriptorBaseImplementationId > {};
     666                 :            : }
     667                 :            : 
     668                 :          0 : Sequence<sal_Int8> SAL_CALL ScDataPilotDescriptorBase::getImplementationId()
     669                 :            :                                                     throw(RuntimeException)
     670                 :            : {
     671                 :          0 :     return theScDataPilotDescriptorBaseImplementationId::get().getSeq();
     672                 :            : }
     673                 :            : 
     674                 :        574 : void ScDataPilotDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
     675                 :            : {
     676                 :            :     //! Referenz-Update?
     677                 :            : 
     678   [ +  +  +  + ]:        924 :     if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  + ]
     679                 :        350 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
     680                 :            :     {
     681                 :         36 :         pDocShell = NULL;       // ungueltig geworden
     682                 :            :     }
     683                 :        574 : }
     684                 :            : 
     685                 :            : // XDataPilotDescriptor
     686                 :            : 
     687                 :          8 : CellRangeAddress SAL_CALL ScDataPilotDescriptorBase::getSourceRange()
     688                 :            :                                             throw(RuntimeException)
     689                 :            : {
     690         [ +  - ]:          8 :     SolarMutexGuard aGuard;
     691                 :            : 
     692         [ +  - ]:          8 :     ScDPObject* pDPObject(GetDPObject());
     693         [ -  + ]:          8 :     if (!pDPObject)
     694         [ #  # ]:          0 :         throw RuntimeException();
     695                 :            : 
     696                 :          8 :     CellRangeAddress aRet;
     697 [ +  - ][ +  - ]:          8 :     if (pDPObject->IsSheetData())
     698         [ +  - ]:          8 :         ScUnoConversion::FillApiRange( aRet, pDPObject->GetSheetDesc()->GetSourceRange() );
     699         [ +  - ]:          8 :     return aRet;
     700                 :            : }
     701                 :            : 
     702                 :         24 : void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress& aSourceRange ) throw(RuntimeException)
     703                 :            : {
     704         [ +  - ]:         24 :     SolarMutexGuard aGuard;
     705                 :            : 
     706         [ +  - ]:         24 :     ScDPObject* pDPObject = GetDPObject();
     707         [ -  + ]:         24 :     if (!pDPObject)
     708         [ #  # ]:          0 :         throw RuntimeException();
     709                 :            : 
     710         [ +  - ]:         24 :     ScSheetSourceDesc aSheetDesc(pDocShell->GetDocument());
     711 [ +  - ][ +  - ]:         24 :     if (pDPObject->IsSheetData())
     712         [ +  - ]:         24 :         aSheetDesc = *pDPObject->GetSheetDesc();
     713                 :            : 
     714                 :         24 :     ScRange aRange;
     715                 :         24 :     ScUnoConversion::FillScRange(aRange, aSourceRange);
     716         [ +  - ]:         24 :     aSheetDesc.SetSourceRange(aRange);
     717         [ +  - ]:         24 :     pDPObject->SetSheetDesc( aSheetDesc );
     718 [ +  - ][ +  - ]:         24 :     SetDPObject( pDPObject );
                 [ +  - ]
     719                 :         24 : }
     720                 :            : 
     721                 :          5 : Reference<XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor()
     722                 :            :                                                 throw(RuntimeException)
     723                 :            : {
     724         [ +  - ]:          5 :     SolarMutexGuard aGuard;
     725 [ +  - ][ +  - ]:          5 :     return new ScDataPilotFilterDescriptor( pDocShell, this );
         [ +  - ][ +  - ]
     726                 :            : }
     727                 :            : 
     728                 :         58 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields()
     729                 :            :                                                 throw(RuntimeException)
     730                 :            : {
     731         [ +  - ]:         58 :     SolarMutexGuard aGuard;
     732 [ +  - ][ +  - ]:         58 :     return new ScDataPilotFieldsObj( *this );
         [ +  - ][ +  - ]
     733                 :            : }
     734                 :            : 
     735                 :          4 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields()
     736                 :            :                                                 throw(RuntimeException)
     737                 :            : {
     738         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     739 [ +  - ][ +  - ]:          4 :     return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_COLUMN );
         [ +  - ][ +  - ]
     740                 :            : }
     741                 :            : 
     742                 :         10 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields()
     743                 :            :                                                 throw(RuntimeException)
     744                 :            : {
     745         [ +  - ]:         10 :     SolarMutexGuard aGuard;
     746 [ +  - ][ +  - ]:         10 :     return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_ROW );
         [ +  - ][ +  - ]
     747                 :            : }
     748                 :            : 
     749                 :          4 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields()
     750                 :            :                                                 throw(RuntimeException)
     751                 :            : {
     752         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     753 [ +  - ][ +  - ]:          4 :     return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_PAGE );
         [ +  - ][ +  - ]
     754                 :            : }
     755                 :            : 
     756                 :          4 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields()
     757                 :            :                                                 throw(RuntimeException)
     758                 :            : {
     759         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     760 [ +  - ][ +  - ]:          4 :     return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_DATA );
         [ +  - ][ +  - ]
     761                 :            : }
     762                 :            : 
     763                 :          2 : Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields()
     764                 :            :                                                 throw(RuntimeException)
     765                 :            : {
     766         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     767 [ +  - ][ +  - ]:          2 :     return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_HIDDEN );
         [ +  - ][ +  - ]
     768                 :            : }
     769                 :            : 
     770                 :            : // XPropertySet
     771                 :          0 : Reference< XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo(  )
     772                 :            :                                                 throw(RuntimeException)
     773                 :            : {
     774         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     775                 :            :     static Reference<XPropertySetInfo> aRef =
     776 [ #  # ][ #  # ]:          0 :         new SfxItemPropertySetInfo( maPropSet.getPropertyMap() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     777         [ #  # ]:          0 :     return aRef;
     778                 :            : }
     779                 :            : 
     780                 :          0 : void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
     781                 :            :         throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
     782                 :            :                 WrappedTargetException, RuntimeException)
     783                 :            : {
     784         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     785         [ #  # ]:          0 :     ScDPObject* pDPObject = GetDPObject();
     786         [ #  # ]:          0 :     if (pDPObject)
     787                 :            :     {
     788                 :          0 :         ScDPSaveData* pOldData = pDPObject->GetSaveData();
     789                 :            :         OSL_ENSURE(pOldData, "Here should be a SaveData");
     790         [ #  # ]:          0 :         if ( pOldData )
     791                 :            :         {
     792         [ #  # ]:          0 :             ScDPSaveData aNewData( *pOldData );
     793                 :            : 
     794         [ #  # ]:          0 :             String aNameString = aPropertyName;
     795 [ #  # ][ #  # ]:          0 :             if ( aNameString.EqualsAscii( SC_UNO_DP_COLGRAND ) )
     796                 :            :             {
     797 [ #  # ][ #  # ]:          0 :                 aNewData.SetColumnGrand(::cppu::any2bool( aValue ));
     798                 :            :             }
     799 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_IGNORE_EMPTYROWS ) )
     800                 :            :             {
     801 [ #  # ][ #  # ]:          0 :                 aNewData.SetIgnoreEmptyRows(::cppu::any2bool( aValue ));
     802                 :            :             }
     803 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_REPEATEMPTY ) )
     804                 :            :             {
     805 [ #  # ][ #  # ]:          0 :                 aNewData.SetRepeatIfEmpty(::cppu::any2bool( aValue ));
     806                 :            :             }
     807 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_ROWGRAND ) )
     808                 :            :             {
     809 [ #  # ][ #  # ]:          0 :                 aNewData.SetRowGrand(::cppu::any2bool( aValue ));
     810                 :            :             }
     811 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SHOWFILTER ) )
     812                 :            :             {
     813 [ #  # ][ #  # ]:          0 :                 aNewData.SetFilterButton(::cppu::any2bool( aValue ));
     814                 :            :             }
     815 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_DRILLDOWN ) )
     816                 :            :             {
     817 [ #  # ][ #  # ]:          0 :                 aNewData.SetDrillDown(::cppu::any2bool( aValue ));
     818                 :            :             }
     819 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_GRANDTOTAL_NAME ) )
     820                 :            :             {
     821                 :          0 :                 rtl::OUString aStrVal;
     822         [ #  # ]:          0 :                 if ( aValue >>= aStrVal )
     823         [ #  # ]:          0 :                     aNewData.SetGrandTotalName(aStrVal);
     824                 :            :             }
     825 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_IMPORTDESC ) )
     826                 :            :             {
     827         [ #  # ]:          0 :                 uno::Sequence<beans::PropertyValue> aArgSeq;
     828 [ #  # ][ #  # ]:          0 :                 if ( aValue >>= aArgSeq )
     829                 :            :                 {
     830                 :          0 :                     ScImportSourceDesc aImportDesc(pDocShell->GetDocument());
     831                 :            : 
     832                 :          0 :                     const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc();
     833         [ #  # ]:          0 :                     if (pOldDesc)
     834                 :          0 :                         aImportDesc = *pOldDesc;
     835                 :            : 
     836         [ #  # ]:          0 :                     ScImportParam aParam;
     837         [ #  # ]:          0 :                     ScImportDescriptor::FillImportParam( aParam, aArgSeq );
     838                 :            : 
     839                 :          0 :                     sal_uInt16 nNewType = sheet::DataImportMode_NONE;
     840         [ #  # ]:          0 :                     if ( aParam.bImport )
     841                 :            :                     {
     842         [ #  # ]:          0 :                         if ( aParam.bSql )
     843                 :          0 :                             nNewType = sheet::DataImportMode_SQL;
     844         [ #  # ]:          0 :                         else if ( aParam.nType == ScDbQuery )
     845                 :          0 :                             nNewType = sheet::DataImportMode_QUERY;
     846                 :            :                         else
     847                 :          0 :                             nNewType = sheet::DataImportMode_TABLE;
     848                 :            :                     }
     849                 :          0 :                     aImportDesc.nType   = nNewType;
     850                 :          0 :                     aImportDesc.aDBName = aParam.aDBName;
     851                 :          0 :                     aImportDesc.aObject = aParam.aStatement;
     852                 :          0 :                     aImportDesc.bNative = aParam.bNative;
     853                 :            : 
     854 [ #  # ][ #  # ]:          0 :                     pDPObject->SetImportDesc( aImportDesc );
     855         [ #  # ]:          0 :                 }
     856                 :            :             }
     857 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SOURCESERVICE ) )
     858                 :            :             {
     859                 :          0 :                 rtl::OUString aStrVal;
     860         [ #  # ]:          0 :                 if ( aValue >>= aStrVal )
     861                 :            :                 {
     862         [ #  # ]:          0 :                     String aEmpty;
     863 [ #  # ][ #  # ]:          0 :                     ScDPServiceDesc aServiceDesc(aEmpty, aEmpty, aEmpty, aEmpty, aEmpty);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     864                 :            : 
     865                 :          0 :                     const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
     866         [ #  # ]:          0 :                     if (pOldDesc)
     867                 :          0 :                         aServiceDesc = *pOldDesc;
     868                 :            : 
     869                 :          0 :                     aServiceDesc.aServiceName = aStrVal;
     870                 :            : 
     871 [ #  # ][ #  # ]:          0 :                     pDPObject->SetServiceData( aServiceDesc );
     872                 :          0 :                 }
     873                 :            :             }
     874 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SERVICEARG ) )
     875                 :            :             {
     876         [ #  # ]:          0 :                 uno::Sequence<beans::PropertyValue> aArgSeq;
     877 [ #  # ][ #  # ]:          0 :                 if ( aValue >>= aArgSeq )
     878                 :            :                 {
     879         [ #  # ]:          0 :                     String aEmpty;
     880 [ #  # ][ #  # ]:          0 :                     ScDPServiceDesc aServiceDesc(aEmpty, aEmpty, aEmpty, aEmpty, aEmpty);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     881                 :            : 
     882                 :          0 :                     const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
     883         [ #  # ]:          0 :                     if (pOldDesc)
     884                 :          0 :                         aServiceDesc = *pOldDesc;
     885                 :            : 
     886                 :          0 :                     rtl::OUString aStrVal;
     887                 :          0 :                     sal_Int32 nArgs = aArgSeq.getLength();
     888         [ #  # ]:          0 :                     for (sal_Int32 nArgPos=0; nArgPos<nArgs; ++nArgPos)
     889                 :            :                     {
     890         [ #  # ]:          0 :                         const beans::PropertyValue& rProp = aArgSeq[nArgPos];
     891         [ #  # ]:          0 :                         String aPropName(rProp.Name);
     892                 :            : 
     893 [ #  # ][ #  # ]:          0 :                         if (aPropName.EqualsAscii( SC_UNO_DP_SOURCENAME ))
     894                 :            :                         {
     895         [ #  # ]:          0 :                             if ( rProp.Value >>= aStrVal )
     896                 :          0 :                                 aServiceDesc.aParSource = aStrVal;
     897                 :            :                         }
     898 [ #  # ][ #  # ]:          0 :                         else if (aPropName.EqualsAscii( SC_UNO_DP_OBJECTNAME ))
     899                 :            :                         {
     900         [ #  # ]:          0 :                             if ( rProp.Value >>= aStrVal )
     901                 :          0 :                                 aServiceDesc.aParName = aStrVal;
     902                 :            :                         }
     903 [ #  # ][ #  # ]:          0 :                         else if (aPropName.EqualsAscii( SC_UNO_DP_USERNAME ))
     904                 :            :                         {
     905         [ #  # ]:          0 :                             if ( rProp.Value >>= aStrVal )
     906                 :          0 :                                 aServiceDesc.aParUser = aStrVal;
     907                 :            :                         }
     908 [ #  # ][ #  # ]:          0 :                         else if (aPropName.EqualsAscii( SC_UNO_DP_PASSWORD ))
     909                 :            :                         {
     910         [ #  # ]:          0 :                             if ( rProp.Value >>= aStrVal )
     911                 :          0 :                                 aServiceDesc.aParPass = aStrVal;
     912                 :            :                         }
     913         [ #  # ]:          0 :                     }
     914                 :            : 
     915 [ #  # ][ #  # ]:          0 :                     pDPObject->SetServiceData( aServiceDesc );
     916         [ #  # ]:          0 :                 }
     917                 :            :             }
     918                 :            :             else
     919         [ #  # ]:          0 :                 throw UnknownPropertyException();
     920                 :            : 
     921 [ #  # ][ #  # ]:          0 :             pDPObject->SetSaveData( aNewData );
                 [ #  # ]
     922                 :            :         }
     923                 :            : 
     924         [ #  # ]:          0 :         SetDPObject(pDPObject);
     925         [ #  # ]:          0 :     }
     926                 :          0 : }
     927                 :            : 
     928                 :          0 : Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPropertyName )
     929                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     930                 :            : {
     931         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     932                 :          0 :     Any aRet;
     933                 :            : 
     934         [ #  # ]:          0 :     ScDPObject* pDPObject(GetDPObject());
     935         [ #  # ]:          0 :     if (pDPObject)
     936                 :            :     {
     937                 :          0 :         ScDPSaveData* pOldData = pDPObject->GetSaveData();
     938                 :            :         OSL_ENSURE(pOldData, "Here should be a SaveData");
     939         [ #  # ]:          0 :         if ( pOldData )
     940                 :            :         {
     941         [ #  # ]:          0 :             ScDPSaveData aNewData( *pOldData );
     942                 :            : 
     943         [ #  # ]:          0 :             String aNameString = aPropertyName;
     944 [ #  # ][ #  # ]:          0 :             if ( aNameString.EqualsAscii( SC_UNO_DP_COLGRAND ) )
     945                 :            :             {
     946         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetColumnGrand() );
     947                 :            :             }
     948 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_IGNORE_EMPTYROWS ) )
     949                 :            :             {
     950         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetIgnoreEmptyRows() );
     951                 :            :             }
     952 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_REPEATEMPTY ) )
     953                 :            :             {
     954         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetRepeatIfEmpty() );
     955                 :            :             }
     956 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_ROWGRAND ) )
     957                 :            :             {
     958         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetRowGrand() );
     959                 :            :             }
     960 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SHOWFILTER ) )
     961                 :            :             {
     962         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetFilterButton() );
     963                 :            :             }
     964 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_DRILLDOWN ) )
     965                 :            :             {
     966         [ #  # ]:          0 :                 aRet = ::cppu::bool2any( aNewData.GetDrillDown() );
     967                 :            :             }
     968 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_GRANDTOTAL_NAME ) )
     969                 :            :             {
     970         [ #  # ]:          0 :                 const rtl::OUString* pGrandTotalName = aNewData.GetGrandTotalName();
     971         [ #  # ]:          0 :                 if (pGrandTotalName)
     972         [ #  # ]:          0 :                     aRet <<= *pGrandTotalName;      // same behavior as in ScDPSource
     973                 :            :             }
     974 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_IMPORTDESC ) )
     975                 :            :             {
     976                 :          0 :                 const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc();
     977         [ #  # ]:          0 :                 if ( pImportDesc )
     978                 :            :                 {
     979                 :            :                     // fill ScImportParam so ScImportDescriptor::FillProperties can be used
     980         [ #  # ]:          0 :                     ScImportParam aParam;
     981                 :          0 :                     aParam.bImport    = ( pImportDesc->nType != sheet::DataImportMode_NONE );
     982                 :          0 :                     aParam.aDBName    = pImportDesc->aDBName;
     983                 :          0 :                     aParam.aStatement = pImportDesc->aObject;
     984                 :          0 :                     aParam.bNative    = pImportDesc->bNative;
     985                 :          0 :                     aParam.bSql       = ( pImportDesc->nType == sheet::DataImportMode_SQL );
     986         [ #  # ]:          0 :                     aParam.nType      = static_cast<sal_uInt8>(( pImportDesc->nType == sheet::DataImportMode_QUERY ) ? ScDbQuery : ScDbTable);
     987                 :            : 
     988 [ #  # ][ #  # ]:          0 :                     uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
     989         [ #  # ]:          0 :                     ScImportDescriptor::FillProperties( aSeq, aParam );
     990 [ #  # ][ #  # ]:          0 :                     aRet <<= aSeq;
                 [ #  # ]
     991                 :            :                 }
     992                 :            :                 else
     993                 :            :                 {
     994                 :            :                     // empty sequence
     995         [ #  # ]:          0 :                     uno::Sequence<beans::PropertyValue> aEmpty(0);
     996 [ #  # ][ #  # ]:          0 :                     aRet <<= aEmpty;
     997                 :            :                 }
     998                 :            :             }
     999 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SOURCESERVICE ) )
    1000                 :            :             {
    1001                 :          0 :                 rtl::OUString aServiceName;
    1002                 :          0 :                 const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc();
    1003         [ #  # ]:          0 :                 if (pServiceDesc)
    1004                 :          0 :                     aServiceName = pServiceDesc->aServiceName;
    1005         [ #  # ]:          0 :                 aRet <<= aServiceName;      // empty string if no ServiceDesc set
    1006                 :            :             }
    1007 [ #  # ][ #  # ]:          0 :             else if ( aNameString.EqualsAscii( SC_UNO_DP_SERVICEARG ) )
    1008                 :            :             {
    1009                 :          0 :                 const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc();
    1010         [ #  # ]:          0 :                 if (pServiceDesc)
    1011                 :            :                 {
    1012         [ #  # ]:          0 :                     uno::Sequence<beans::PropertyValue> aSeq( 4 );
    1013         [ #  # ]:          0 :                     beans::PropertyValue* pArray = aSeq.getArray();
    1014         [ #  # ]:          0 :                     pArray[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_SOURCENAME ));
    1015         [ #  # ]:          0 :                     pArray[0].Value <<= pServiceDesc->aParSource;
    1016         [ #  # ]:          0 :                     pArray[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_OBJECTNAME ));
    1017         [ #  # ]:          0 :                     pArray[1].Value <<= pServiceDesc->aParName;
    1018         [ #  # ]:          0 :                     pArray[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_USERNAME ));
    1019         [ #  # ]:          0 :                     pArray[2].Value <<= pServiceDesc->aParUser;
    1020         [ #  # ]:          0 :                     pArray[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_PASSWORD ));
    1021         [ #  # ]:          0 :                     pArray[3].Value <<= pServiceDesc->aParPass;
    1022 [ #  # ][ #  # ]:          0 :                     aRet <<= aSeq;
    1023                 :            :                 }
    1024                 :            :                 else
    1025                 :            :                 {
    1026                 :            :                     // empty sequence
    1027         [ #  # ]:          0 :                     uno::Sequence<beans::PropertyValue> aEmpty(0);
    1028 [ #  # ][ #  # ]:          0 :                     aRet <<= aEmpty;
    1029                 :            :                 }
    1030                 :            :             }
    1031                 :            :             else
    1032 [ #  # ][ #  # ]:          0 :                 throw UnknownPropertyException();
                 [ #  # ]
    1033                 :            :         }
    1034                 :            :     }
    1035                 :            : 
    1036         [ #  # ]:          0 :     return aRet;
    1037                 :            : }
    1038                 :            : 
    1039                 :          0 : void SAL_CALL ScDataPilotDescriptorBase::addPropertyChangeListener(
    1040                 :            :         const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* xListener */ )
    1041                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1042                 :            : {
    1043                 :          0 : }
    1044                 :            : 
    1045                 :          0 : void SAL_CALL ScDataPilotDescriptorBase::removePropertyChangeListener(
    1046                 :            :         const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* aListener */ )
    1047                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1048                 :            : {
    1049                 :          0 : }
    1050                 :            : 
    1051                 :          0 : void SAL_CALL ScDataPilotDescriptorBase::addVetoableChangeListener(
    1052                 :            :         const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
    1053                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1054                 :            : {
    1055                 :          0 : }
    1056                 :            : 
    1057                 :          0 : void SAL_CALL ScDataPilotDescriptorBase::removeVetoableChangeListener(
    1058                 :            :         const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
    1059                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1060                 :            : {
    1061                 :          0 : }
    1062                 :            : 
    1063                 :            : // XDataPilotDataLayoutFieldSupplier
    1064                 :            : 
    1065                 :          0 : Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutField() throw(RuntimeException)
    1066                 :            : {
    1067         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1068 [ #  # ][ #  # ]:          0 :     if( ScDPObject* pDPObject = GetDPObject() )
    1069                 :            :     {
    1070         [ #  # ]:          0 :         if( ScDPSaveData* pSaveData = pDPObject->GetSaveData() )
    1071                 :            :         {
    1072 [ #  # ][ #  # ]:          0 :             if( pSaveData->GetDataLayoutDimension() )
    1073                 :            :             {
    1074         [ #  # ]:          0 :                 ScFieldIdentifier aFieldId( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) ), 0, true );
    1075 [ #  # ][ #  # ]:          0 :                 return new ScDataPilotFieldObj( *this, aFieldId );
                 [ #  # ]
    1076                 :            :             }
    1077                 :            :         }
    1078                 :            :     }
    1079 [ #  # ][ #  # ]:          0 :     return 0;
    1080                 :            : }
    1081                 :            : 
    1082                 :            : // XUnoTunnel
    1083                 :            : 
    1084                 :         19 : sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
    1085                 :            :                 const Sequence<sal_Int8 >& rId ) throw(RuntimeException)
    1086                 :            : {
    1087   [ +  -  +  - ]:         38 :     if ( rId.getLength() == 16 &&
                 [ +  - ]
    1088                 :         19 :           0 == memcmp( getUnoTunnelId().getConstArray(),
    1089                 :         19 :                                     rId.getConstArray(), 16 ) )
    1090                 :            :     {
    1091                 :         19 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
    1092                 :            :     }
    1093                 :         19 :     return 0;
    1094                 :            : }
    1095                 :            : 
    1096                 :            : namespace
    1097                 :            : {
    1098                 :            :     class theScDataPilotDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScDataPilotDescriptorBaseUnoTunnelId> {};
    1099                 :            : }
    1100                 :            : 
    1101                 :         38 : const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
    1102                 :            : {
    1103                 :         38 :     return theScDataPilotDescriptorBaseUnoTunnelId::get().getSeq();
    1104                 :            : }
    1105                 :            : 
    1106                 :         19 : ScDataPilotDescriptorBase* ScDataPilotDescriptorBase::getImplementation(
    1107                 :            :                                 const Reference<XDataPilotDescriptor> xObj )
    1108                 :            : {
    1109                 :         19 :     ScDataPilotDescriptorBase* pRet = NULL;
    1110         [ +  - ]:         19 :     Reference<lang::XUnoTunnel> xUT( xObj, UNO_QUERY );
    1111         [ +  - ]:         19 :     if (xUT.is())
    1112 [ +  - ][ +  - ]:         19 :         pRet = reinterpret_cast<ScDataPilotDescriptorBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
                 [ +  - ]
    1113                 :         19 :     return pRet;
    1114                 :            : }
    1115                 :            : 
    1116                 :            : //------------------------------------------------------------------------
    1117                 :            : 
    1118                 :         61 : ScDataPilotTableObj::ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const String& rN) :
    1119                 :            :     ScDataPilotDescriptorBase( pDocSh ),
    1120                 :            :     nTab( nT ),
    1121                 :            :     aName( rN ),
    1122 [ +  - ][ +  - ]:         61 :     aModifyListeners( 0 )
    1123                 :            : {
    1124                 :         61 : }
    1125                 :            : 
    1126 [ +  - ][ +  - ]:         61 : ScDataPilotTableObj::~ScDataPilotTableObj()
    1127                 :            : {
    1128         [ -  + ]:        122 : }
    1129                 :            : 
    1130                 :        115 : Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType )
    1131                 :            :                                                 throw(RuntimeException)
    1132                 :            : {
    1133                 :            :     // since we manually do resolve the query for XDataPilotTable2
    1134                 :            :     // we also need to do the same for XDataPilotTable
    1135 [ +  + ][ +  - ]:        115 :     SC_QUERYINTERFACE( XDataPilotTable )
    1136 [ +  + ][ +  - ]:         79 :     SC_QUERYINTERFACE( XDataPilotTable2 )
    1137 [ -  + ][ #  # ]:         71 :     SC_QUERYINTERFACE( XModifyBroadcaster )
    1138                 :            : 
    1139                 :        115 :     return ScDataPilotDescriptorBase::queryInterface( rType );
    1140                 :            : }
    1141                 :            : 
    1142                 :        637 : void SAL_CALL ScDataPilotTableObj::acquire() throw()
    1143                 :            : {
    1144                 :        637 :     ScDataPilotDescriptorBase::acquire();
    1145                 :        637 : }
    1146                 :            : 
    1147                 :        637 : void SAL_CALL ScDataPilotTableObj::release() throw()
    1148                 :            : {
    1149                 :        637 :     ScDataPilotDescriptorBase::release();
    1150                 :        637 : }
    1151                 :            : 
    1152                 :          0 : Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes() throw(RuntimeException)
    1153                 :            : {
    1154 [ #  # ][ #  # ]:          0 :     static Sequence< uno::Type > aTypes;
         [ #  # ][ #  # ]
    1155         [ #  # ]:          0 :     if ( aTypes.getLength() == 0 )
    1156                 :            :     {
    1157         [ #  # ]:          0 :         Sequence< uno::Type > aParentTypes = ScDataPilotDescriptorBase::getTypes();
    1158                 :          0 :         sal_Int32 nParentLen = aParentTypes.getLength();
    1159                 :          0 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    1160                 :            : 
    1161         [ #  # ]:          0 :         aTypes.realloc( nParentLen + 2 );
    1162         [ #  # ]:          0 :         uno::Type* pPtr = aTypes.getArray();
    1163         [ #  # ]:          0 :         for (sal_Int32 i = 0; i < nParentLen; ++i)
    1164                 :          0 :             pPtr[ i ] = pParentPtr[ i ];               // parent types first
    1165                 :            : 
    1166         [ #  # ]:          0 :         pPtr[ nParentLen ] = getCppuType( (const Reference< XDataPilotTable2 >*)0 );
    1167 [ #  # ][ #  # ]:          0 :         pPtr[ nParentLen+1 ] = getCppuType( (const Reference< XModifyBroadcaster >*)0 );
    1168                 :            :     }
    1169                 :          0 :     return aTypes;
    1170                 :            : }
    1171                 :            : 
    1172                 :            : namespace
    1173                 :            : {
    1174                 :            :     class theScDataPilotTableObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScDataPilotTableObjImplementationId > {};
    1175                 :            : }
    1176                 :            : 
    1177                 :          0 : Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId()
    1178                 :            :                                                     throw(RuntimeException)
    1179                 :            : {
    1180                 :          0 :     return theScDataPilotTableObjImplementationId::get().getSeq();
    1181                 :            : }
    1182                 :            : 
    1183                 :            : // ---
    1184                 :        851 : ScDPObject* ScDataPilotTableObj::GetDPObject() const
    1185                 :            : {
    1186         [ +  - ]:        851 :     return lcl_GetDPObject(GetDocShell(), nTab, aName);
    1187                 :            : }
    1188                 :            : 
    1189                 :         42 : void ScDataPilotTableObj::SetDPObject( ScDPObject* pDPObject )
    1190                 :            : {
    1191                 :         42 :     ScDocShell* pDocSh = GetDocShell();
    1192         [ +  - ]:         42 :     ScDPObject* pDPObj = lcl_GetDPObject(pDocSh, nTab, aName);
    1193 [ +  - ][ +  - ]:         42 :     if ( pDPObj && pDocSh )
    1194                 :            :     {
    1195                 :         42 :         ScDBDocFunc aFunc(*pDocSh);
    1196         [ +  - ]:         42 :         aFunc.DataPilotUpdate( pDPObj, pDPObject, true, true );
    1197                 :            :     }
    1198                 :         42 : }
    1199                 :            : 
    1200                 :            : // "rest of XDataPilotDescriptor"
    1201                 :            : 
    1202                 :         12 : OUString SAL_CALL ScDataPilotTableObj::getName() throw(RuntimeException)
    1203                 :            : {
    1204         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    1205 [ +  - ][ +  - ]:         12 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1206         [ +  - ]:         12 :     if (pDPObj)
    1207                 :         12 :         return pDPObj->GetName();
    1208         [ +  - ]:         12 :     return OUString();
    1209                 :            : }
    1210                 :            : 
    1211                 :          8 : void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName )
    1212                 :            :                                                 throw(RuntimeException)
    1213                 :            : {
    1214         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1215 [ +  - ][ +  - ]:          8 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1216         [ +  - ]:          8 :     if (pDPObj)
    1217                 :            :     {
    1218                 :            :         //! test for existing names !!!
    1219                 :            : 
    1220         [ +  - ]:          8 :         String aString(aNewName);
    1221 [ +  - ][ +  - ]:          8 :         pDPObj->SetName( aString );     //! Undo - DBDocFunc ???
    1222         [ +  - ]:          8 :         aName = aString;
    1223                 :            : 
    1224                 :            :         //  DataPilotUpdate would do too much (output table is not changed)
    1225 [ +  - ][ +  - ]:          8 :         GetDocShell()->SetDocumentModified();
    1226         [ +  - ]:          8 :     }
    1227                 :          8 : }
    1228                 :            : 
    1229                 :          4 : OUString SAL_CALL ScDataPilotTableObj::getTag() throw(RuntimeException)
    1230                 :            : {
    1231         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1232 [ +  - ][ +  - ]:          4 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1233         [ +  - ]:          4 :     if (pDPObj)
    1234                 :          4 :         return pDPObj->GetTag();
    1235         [ +  - ]:          4 :     return OUString();
    1236                 :            : }
    1237                 :            : 
    1238                 :          4 : void SAL_CALL ScDataPilotTableObj::setTag( const OUString& aNewTag )
    1239                 :            :                                                 throw(RuntimeException)
    1240                 :            : {
    1241         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1242 [ +  - ][ +  - ]:          4 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1243         [ +  - ]:          4 :     if (pDPObj)
    1244                 :            :     {
    1245         [ +  - ]:          4 :         String aString(aNewTag);
    1246 [ +  - ][ +  - ]:          4 :         pDPObj->SetTag( aString );      //! Undo - DBDocFunc ???
    1247                 :            : 
    1248                 :            :         //  DataPilotUpdate would do too much (output table is not changed)
    1249 [ +  - ][ +  - ]:          4 :         GetDocShell()->SetDocumentModified();
    1250         [ +  - ]:          4 :     }
    1251                 :          4 : }
    1252                 :            : 
    1253                 :            : // XDataPilotTable
    1254                 :            : 
    1255                 :          4 : CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() throw(RuntimeException)
    1256                 :            : {
    1257         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1258                 :          4 :     CellRangeAddress aRet;
    1259 [ +  - ][ +  - ]:          4 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1260         [ +  - ]:          4 :     if (pDPObj)
    1261                 :            :     {
    1262                 :          4 :         ScRange aRange(pDPObj->GetOutRange());
    1263                 :          4 :         aRet.Sheet       = aRange.aStart.Tab();
    1264                 :          4 :         aRet.StartColumn = aRange.aStart.Col();
    1265                 :          4 :         aRet.StartRow    = aRange.aStart.Row();
    1266                 :          4 :         aRet.EndColumn   = aRange.aEnd.Col();
    1267                 :          4 :         aRet.EndRow      = aRange.aEnd.Row();
    1268                 :            :     }
    1269         [ +  - ]:          4 :     return aRet;
    1270                 :            : }
    1271                 :            : 
    1272                 :          4 : void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException)
    1273                 :            : {
    1274         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1275 [ +  - ][ +  - ]:          4 :     ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
    1276         [ +  - ]:          4 :     if (pDPObj)
    1277                 :            :     {
    1278                 :          4 :         ScDBDocFunc aFunc(*GetDocShell());
    1279         [ +  - ]:          4 :         aFunc.RefreshPivotTables(pDPObj, true);
    1280         [ +  - ]:          4 :     }
    1281                 :          4 : }
    1282                 :            : 
    1283                 :        122 : Sequence< Sequence<Any> > SAL_CALL ScDataPilotTableObj::getDrillDownData(const CellAddress& aAddr)
    1284                 :            :     throw (RuntimeException)
    1285                 :            : {
    1286         [ +  - ]:        122 :     SolarMutexGuard aGuard;
    1287         [ +  - ]:        122 :     Sequence< Sequence<Any> > aTabData;
    1288                 :        122 :     ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
    1289         [ +  - ]:        122 :     ScDPObject* pObj = GetDPObject();
    1290         [ -  + ]:        122 :     if (!pObj)
    1291         [ #  # ]:          0 :         throw RuntimeException();
    1292                 :            : 
    1293         [ +  - ]:        122 :     pObj->GetDrillDownData(aAddr2, aTabData);
    1294         [ +  - ]:        122 :     return aTabData;
    1295                 :            : }
    1296                 :            : 
    1297                 :        388 : DataPilotTablePositionData SAL_CALL ScDataPilotTableObj::getPositionData(const CellAddress& aAddr)
    1298                 :            :     throw (RuntimeException)
    1299                 :            : {
    1300         [ +  - ]:        388 :     SolarMutexGuard aGuard;
    1301                 :        388 :     DataPilotTablePositionData aPosData;
    1302                 :        388 :     ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
    1303         [ +  - ]:        388 :     ScDPObject* pObj = GetDPObject();
    1304         [ -  + ]:        388 :     if (!pObj)
    1305         [ #  # ]:          0 :         throw RuntimeException();
    1306                 :            : 
    1307         [ +  - ]:        388 :     pObj->GetPositionData(aAddr2, aPosData);
    1308         [ +  - ]:        388 :     return aPosData;
    1309                 :            : }
    1310                 :            : 
    1311                 :         36 : void SAL_CALL ScDataPilotTableObj::insertDrillDownSheet(const CellAddress& aAddr)
    1312                 :            :     throw (RuntimeException)
    1313                 :            : {
    1314         [ +  - ]:         36 :     SolarMutexGuard aGuard;
    1315         [ +  - ]:         36 :     ScDPObject* pDPObj = GetDPObject();
    1316         [ -  + ]:         36 :     if (!pDPObj)
    1317         [ #  # ]:          0 :         throw RuntimeException();
    1318                 :            : 
    1319         [ +  - ]:         36 :     Sequence<DataPilotFieldFilter> aFilters;
    1320                 :            :     pDPObj->GetDataFieldPositionData(
    1321         [ +  - ]:         36 :         ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
    1322 [ +  - ][ +  - ]:         36 :     GetDocShell()->GetBestViewShell()->ShowDataPilotSourceData(*pDPObj, aFilters);
         [ +  - ][ +  - ]
    1323                 :         36 : }
    1324                 :            : 
    1325                 :         33 : CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 nType )
    1326                 :            :     throw (IllegalArgumentException, RuntimeException)
    1327                 :            : {
    1328         [ +  - ]:         33 :     SolarMutexGuard aGuard;
    1329 [ +  + ][ +  + ]:         33 :     if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
    1330         [ +  - ]:          6 :         throw IllegalArgumentException();
    1331                 :            : 
    1332                 :         27 :     CellRangeAddress aRet;
    1333 [ +  - ][ +  - ]:         27 :     if (ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName))
                 [ +  - ]
    1334         [ +  - ]:         27 :         ScUnoConversion::FillApiRange( aRet, pDPObj->GetOutputRangeByType( nType ) );
    1335         [ +  - ]:         33 :     return aRet;
    1336                 :            : }
    1337                 :            : 
    1338                 :          0 : void SAL_CALL ScDataPilotTableObj::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
    1339                 :            :     throw (uno::RuntimeException)
    1340                 :            : {
    1341         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1342                 :            : 
    1343                 :          0 :     uno::Reference<util::XModifyListener> *pObj = new uno::Reference<util::XModifyListener>( aListener );
    1344         [ #  # ]:          0 :     aModifyListeners.push_back( pObj );
    1345                 :            : 
    1346         [ #  # ]:          0 :     if ( aModifyListeners.size() == 1 )
    1347                 :            :     {
    1348                 :          0 :         acquire();  // don't lose this object (one ref for all listeners)
    1349         [ #  # ]:          0 :     }
    1350                 :          0 : }
    1351                 :            : 
    1352                 :          0 : void SAL_CALL ScDataPilotTableObj::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
    1353                 :            :     throw (uno::RuntimeException)
    1354                 :            : {
    1355         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1356                 :            : 
    1357                 :          0 :     acquire();      // in case the listeners have the last ref - released below
    1358                 :            : 
    1359                 :          0 :     sal_uInt16 nCount = aModifyListeners.size();
    1360         [ #  # ]:          0 :     for ( sal_uInt16 n=nCount; n--; )
    1361                 :            :     {
    1362         [ #  # ]:          0 :         uno::Reference<util::XModifyListener>& rObj = aModifyListeners[n];
    1363 [ #  # ][ #  # ]:          0 :         if ( rObj == aListener )
    1364                 :            :         {
    1365 [ #  # ][ #  # ]:          0 :             aModifyListeners.erase( aModifyListeners.begin() + n );
                 [ #  # ]
    1366                 :            : 
    1367         [ #  # ]:          0 :             if ( aModifyListeners.empty() )
    1368                 :            :             {
    1369                 :          0 :                 release();      // release the ref for the listeners
    1370                 :            :             }
    1371                 :            : 
    1372                 :          0 :             break;
    1373                 :            :         }
    1374                 :            :     }
    1375                 :            : 
    1376         [ #  # ]:          0 :     release();      // might delete this object
    1377                 :          0 : }
    1378                 :            : 
    1379                 :        315 : void ScDataPilotTableObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1380                 :            : {
    1381   [ +  +  +  + ]:        375 :     if ( rHint.ISA(ScDataPilotModifiedHint) &&
                 [ +  + ]
    1382                 :         60 :          static_cast<const ScDataPilotModifiedHint&>(rHint).GetName() == aName )
    1383                 :            :     {
    1384                 :         51 :         Refreshed_Impl();
    1385                 :            :     }
    1386         [ +  + ]:        264 :     else if ( rHint.ISA( ScUpdateRefHint ) )
    1387                 :            :     {
    1388                 :         64 :         ScRange aRange( 0, 0, nTab );
    1389         [ +  - ]:         64 :         ScRangeList aRanges;
    1390         [ +  - ]:         64 :         aRanges.Append( aRange );
    1391                 :         64 :         const ScUpdateRefHint& rRef = static_cast< const ScUpdateRefHint& >( rHint );
    1392 [ +  - ][ +  - ]:        192 :         if ( aRanges.UpdateReference( rRef.GetMode(), GetDocShell()->GetDocument(), rRef.GetRange(),
                 [ +  - ]
    1393         [ +  - ]:        128 :                  rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) &&
    1394         [ +  - ]:         64 :              aRanges.size() == 1 )
    1395                 :            :         {
    1396         [ +  - ]:         64 :             const ScRange* pRange = aRanges.front();
    1397         [ +  - ]:         64 :             if ( pRange )
    1398                 :            :             {
    1399                 :         64 :                 nTab = pRange->aStart.Tab();
    1400                 :            :             }
    1401         [ +  - ]:         64 :         }
    1402                 :            :     }
    1403                 :            : 
    1404                 :        315 :     ScDataPilotDescriptorBase::Notify( rBC, rHint );
    1405                 :        315 : }
    1406                 :            : 
    1407                 :         51 : void ScDataPilotTableObj::Refreshed_Impl()
    1408                 :            : {
    1409         [ +  - ]:         51 :     lang::EventObject aEvent;
    1410         [ +  - ]:         51 :     aEvent.Source.set((cppu::OWeakObject*)this);
    1411                 :            : 
    1412                 :            :     // the EventObject holds a Ref to this object until after the listener calls
    1413                 :            : 
    1414                 :         51 :     ScDocument* pDoc = GetDocShell()->GetDocument();
    1415         [ -  + ]:         51 :     for ( sal_uInt16 n=0; n<aModifyListeners.size(); n++ )
    1416 [ #  # ][ #  # ]:         51 :         pDoc->AddUnoListenerCall( aModifyListeners[n], aEvent );
                 [ +  - ]
    1417                 :         51 : }
    1418                 :            : 
    1419                 :            : // ============================================================================
    1420                 :            : 
    1421                 :         19 : ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
    1422                 :            :     ScDataPilotDescriptorBase( pDocSh ),
    1423 [ +  - ][ +  - ]:         19 :     mpDPObject(new ScDPObject(pDocSh ? pDocSh->GetDocument() : NULL) )
                 [ +  - ]
    1424                 :            : {
    1425         [ +  - ]:         19 :     mpDPObject->SetAlive(sal_True);
    1426         [ +  - ]:         19 :     ScDPSaveData aSaveData;
    1427                 :            :     // set defaults like in ScPivotParam constructor
    1428         [ +  - ]:         19 :      aSaveData.SetColumnGrand( sal_True );
    1429         [ +  - ]:         19 :     aSaveData.SetRowGrand( sal_True );
    1430         [ +  - ]:         19 :     aSaveData.SetIgnoreEmptyRows( false );
    1431         [ +  - ]:         19 :     aSaveData.SetRepeatIfEmpty( false );
    1432         [ +  - ]:         19 :     mpDPObject->SetSaveData(aSaveData);
    1433 [ +  - ][ +  - ]:         19 :     ScSheetSourceDesc aSheetDesc(pDocSh ? pDocSh->GetDocument() : NULL);
    1434         [ +  - ]:         19 :     mpDPObject->SetSheetDesc(aSheetDesc);
    1435 [ +  - ][ +  - ]:         19 :     mpDPObject->GetSource();
                 [ +  - ]
    1436                 :         19 : }
    1437                 :            : 
    1438                 :         18 : ScDataPilotDescriptor::~ScDataPilotDescriptor()
    1439                 :            : {
    1440 [ +  - ][ +  - ]:         18 :     delete mpDPObject;
    1441         [ -  + ]:         36 : }
    1442                 :            : 
    1443                 :        410 : ScDPObject* ScDataPilotDescriptor::GetDPObject() const
    1444                 :            : {
    1445                 :        410 :     return mpDPObject;
    1446                 :            : }
    1447                 :            : 
    1448                 :        116 : void ScDataPilotDescriptor::SetDPObject( ScDPObject* pDPObject )
    1449                 :            : {
    1450         [ -  + ]:        116 :     if (mpDPObject != pDPObject)
    1451                 :            :     {
    1452         [ #  # ]:          0 :         delete mpDPObject;
    1453                 :          0 :         mpDPObject = pDPObject;
    1454                 :            :         OSL_FAIL("replace DPObject should not happen");
    1455                 :            :     }
    1456                 :        116 : }
    1457                 :            : 
    1458                 :            : // "rest of XDataPilotDescriptor"
    1459                 :            : 
    1460                 :          0 : OUString SAL_CALL ScDataPilotDescriptor::getName() throw(RuntimeException)
    1461                 :            : {
    1462         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1463         [ #  # ]:          0 :     return mpDPObject->GetName();
    1464                 :            : }
    1465                 :            : 
    1466                 :          0 : void SAL_CALL ScDataPilotDescriptor::setName( const OUString& aNewName )
    1467                 :            :                                                 throw(RuntimeException)
    1468                 :            : {
    1469         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1470 [ #  # ][ #  # ]:          0 :     mpDPObject->SetName( aNewName );
    1471                 :          0 : }
    1472                 :            : 
    1473                 :         19 : OUString SAL_CALL ScDataPilotDescriptor::getTag() throw(RuntimeException)
    1474                 :            : {
    1475         [ +  - ]:         19 :     SolarMutexGuard aGuard;
    1476         [ +  - ]:         19 :     return mpDPObject->GetTag();
    1477                 :            : }
    1478                 :            : 
    1479                 :          0 : void SAL_CALL ScDataPilotDescriptor::setTag( const OUString& aNewTag )
    1480                 :            :                                                 throw(RuntimeException)
    1481                 :            : {
    1482         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1483 [ #  # ][ #  # ]:          0 :     mpDPObject->SetTag( aNewTag );
    1484                 :          0 : }
    1485                 :            : 
    1486                 :            : // ============================================================================
    1487                 :            : 
    1488                 :         82 : ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent ) :
    1489                 :         82 :     mrParent( rParent )
    1490                 :            : {
    1491                 :         82 :     mrParent.acquire();
    1492                 :         82 : }
    1493                 :            : 
    1494                 :        182 : ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
    1495                 :            :     mrParent( rParent ),
    1496                 :        182 :     maFieldId( rFieldId )
    1497                 :            : {
    1498                 :        182 :     mrParent.acquire();
    1499                 :        182 : }
    1500                 :            : 
    1501                 :        263 : ScDataPilotChildObjBase::~ScDataPilotChildObjBase()
    1502                 :            : {
    1503                 :        263 :     mrParent.release();
    1504         [ -  + ]:        263 : }
    1505                 :            : 
    1506                 :        662 : ScDPObject* ScDataPilotChildObjBase::GetDPObject() const
    1507                 :            : {
    1508                 :        662 :     return mrParent.GetDPObject();
    1509                 :            : }
    1510                 :            : 
    1511                 :        133 : void ScDataPilotChildObjBase::SetDPObject( ScDPObject* pDPObject )
    1512                 :            : {
    1513                 :        133 :     mrParent.SetDPObject( pDPObject );
    1514                 :        133 : }
    1515                 :            : 
    1516                 :        367 : ScDPSaveDimension* ScDataPilotChildObjBase::GetDPDimension( ScDPObject** ppDPObject ) const
    1517                 :            : {
    1518         [ +  - ]:        367 :     if( ScDPObject* pDPObj = GetDPObject() )
    1519                 :            :     {
    1520         [ +  + ]:        367 :         if( ppDPObject ) *ppDPObject = pDPObj;
    1521         [ +  - ]:        367 :         if( ScDPSaveData* pSaveData = pDPObj->GetSaveData() )
    1522                 :            :         {
    1523         [ +  + ]:        367 :             if( maFieldId.mbDataLayout )
    1524         [ +  - ]:          3 :                 return pSaveData->GetDataLayoutDimension();
    1525                 :            : 
    1526         [ +  - ]:        364 :             if( maFieldId.mnFieldIdx == 0 )
    1527         [ +  - ]:        364 :                 return pSaveData->GetDimensionByName( maFieldId.maFieldName );
    1528                 :            : 
    1529                 :            :             // find dimension with specified index (search in duplicated dimensions)
    1530         [ #  # ]:          0 :             const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pSaveData->GetDimensions();
    1531                 :            : 
    1532                 :          0 :             sal_Int32 nFoundIdx = 0;
    1533         [ #  # ]:          0 :             boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
    1534 [ #  # ][ #  # ]:        367 :             for(it = rDimensions.begin(); it != rDimensions.end(); ++it)
         [ #  # ][ #  # ]
                 [ #  # ]
    1535                 :            :             {
    1536 [ #  # ][ #  # ]:          0 :                 if( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1537                 :            :                 {
    1538         [ #  # ]:          0 :                     if( nFoundIdx == maFieldId.mnFieldIdx )
    1539         [ #  # ]:          0 :                         return const_cast<ScDPSaveDimension*>(&(*it));
    1540                 :          0 :                     ++nFoundIdx;
    1541                 :            :                 }
    1542                 :            :             }
    1543                 :            :         }
    1544                 :            :     }
    1545                 :        367 :     return 0;
    1546                 :            : }
    1547                 :            : 
    1548                 :         28 : sal_Int32 ScDataPilotChildObjBase::GetMemberCount() const
    1549                 :            : {
    1550                 :         28 :     sal_Int32 nRet = 0;
    1551         [ +  - ]:         28 :     Reference<XNameAccess> xMembersNA = GetMembers();
    1552         [ +  - ]:         28 :     if (xMembersNA.is())
    1553                 :            :     {
    1554 [ +  - ][ +  - ]:         28 :         Reference< XIndexAccess > xMembersIA( new ScNameToIndexAccess( xMembersNA ) );
                 [ +  - ]
    1555 [ +  - ][ +  - ]:         28 :         nRet = xMembersIA->getCount();
    1556                 :            :     }
    1557                 :         28 :     return nRet;
    1558                 :            : }
    1559                 :            : 
    1560                 :         60 : Reference< XNameAccess > ScDataPilotChildObjBase::GetMembers() const
    1561                 :            : {
    1562                 :         60 :     Reference< XNameAccess > xMembersNA;
    1563 [ +  - ][ +  - ]:         60 :     if( ScDPObject* pDPObj = GetDPObject() )
    1564 [ +  - ][ +  - ]:         60 :         pDPObj->GetMembersNA( lcl_GetObjectIndex( pDPObj, maFieldId ), xMembersNA );
    1565                 :         60 :     return xMembersNA;
    1566                 :            : }
    1567                 :            : 
    1568                 :          5 : ScDocShell* ScDataPilotChildObjBase::GetDocShell() const
    1569                 :            : {
    1570                 :          5 :     return mrParent.GetDocShell();
    1571                 :            : }
    1572                 :            : 
    1573                 :            : // ============================================================================
    1574                 :            : 
    1575                 :         58 : ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent ) :
    1576         [ +  - ]:         58 :     ScDataPilotChildObjBase( rParent )
    1577                 :            : {
    1578                 :         58 : }
    1579                 :            : 
    1580                 :         24 : ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent, DataPilotFieldOrientation eOrient ) :
    1581                 :            :     ScDataPilotChildObjBase( rParent ),
    1582 [ +  - ][ +  - ]:         24 :     maOrient( eOrient )
    1583                 :            : {
    1584                 :         24 : }
    1585                 :            : 
    1586         [ +  - ]:         82 : ScDataPilotFieldsObj::~ScDataPilotFieldsObj()
    1587                 :            : {
    1588         [ -  + ]:        164 : }
    1589                 :            : 
    1590                 :         67 : sal_Int32 lcl_GetFieldCount( const Reference<XDimensionsSupplier>& rSource, const Any& rOrient )
    1591                 :            : {
    1592         [ -  + ]:         67 :     if (!rSource.is())
    1593         [ #  # ]:          0 :         throw RuntimeException();
    1594                 :            : 
    1595                 :         67 :     sal_Int32 nRet = 0;
    1596                 :            : 
    1597 [ +  - ][ +  - ]:         67 :     Reference<XNameAccess> xDimsName(rSource->getDimensions());
    1598 [ +  - ][ +  - ]:         67 :     Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
                 [ +  - ]
    1599 [ +  - ][ +  - ]:         67 :     sal_Int32 nIntCount = xIntDims->getCount();
    1600         [ +  + ]:         67 :     if (rOrient.hasValue())
    1601                 :            :     {
    1602                 :            :         // all fields of the specified orientation, including duplicated
    1603                 :         44 :         Reference<XPropertySet> xDim;
    1604         [ +  + ]:        317 :         for (sal_Int32 i = 0; i < nIntCount; ++i)
    1605                 :            :         {
    1606 [ +  - ][ +  - ]:        273 :             xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
                 [ +  - ]
    1607 [ +  - ][ +  - ]:        273 :             if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIENTATION))) == rOrient))
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
           #  # ][ +  - ]
    1608                 :         57 :                 ++nRet;
    1609                 :         44 :         }
    1610                 :            :     }
    1611                 :            :     else
    1612                 :            :     {
    1613                 :            :         // count all non-duplicated fields
    1614                 :            : 
    1615                 :         23 :         Reference<XPropertySet> xDim;
    1616         [ +  + ]:        161 :         for (sal_Int32 i = 0; i < nIntCount; ++i)
    1617                 :            :         {
    1618 [ +  - ][ +  - ]:        138 :             xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
                 [ +  - ]
    1619 [ +  - ][ +  - ]:        138 :             if ( xDim.is() && !lcl_IsDuplicated( xDim ) )
                 [ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
    1620                 :        138 :                 ++nRet;
    1621                 :         23 :         }
    1622                 :            :     }
    1623                 :            : 
    1624                 :         67 :     return nRet;
    1625                 :            : }
    1626                 :            : 
    1627                 :        153 : sal_Bool lcl_GetFieldDataByIndex( const Reference<XDimensionsSupplier>& rSource,
    1628                 :            :                                 const Any& rOrient, SCSIZE nIndex, ScFieldIdentifier& rFieldId )
    1629                 :            : {
    1630         [ -  + ]:        153 :     if (!rSource.is())
    1631         [ #  # ]:          0 :         throw RuntimeException();
    1632                 :            : 
    1633                 :        153 :     sal_Bool bOk = false;
    1634                 :        153 :     SCSIZE nPos = 0;
    1635                 :        153 :     sal_Int32 nDimIndex = 0;
    1636                 :            : 
    1637 [ +  - ][ +  - ]:        153 :     Reference<XNameAccess> xDimsName(rSource->getDimensions());
    1638 [ +  - ][ +  - ]:        153 :     Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
                 [ +  - ]
    1639 [ +  - ][ +  - ]:        153 :     sal_Int32 nIntCount = xIntDims->getCount();
    1640                 :        153 :     Reference<XPropertySet> xDim;
    1641         [ +  + ]:        153 :     if (rOrient.hasValue())
    1642                 :            :     {
    1643                 :         34 :         sal_Int32 i = 0;
    1644 [ +  - ][ +  + ]:        145 :         while (i < nIntCount && !bOk)
                 [ +  + ]
    1645                 :            :         {
    1646 [ +  - ][ +  - ]:        111 :             xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
                 [ +  - ]
    1647 [ +  - ][ +  - ]:        111 :             if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIENTATION))) == rOrient))
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
           #  # ][ +  - ]
    1648                 :            :             {
    1649         [ +  + ]:         43 :                 if (nPos == nIndex)
    1650                 :            :                 {
    1651                 :         34 :                     bOk = sal_True;
    1652                 :         34 :                     nDimIndex = i;
    1653                 :            :                 }
    1654                 :            :                 else
    1655                 :          9 :                     ++nPos;
    1656                 :            :             }
    1657                 :        111 :             ++i;
    1658                 :            :         }
    1659                 :            :     }
    1660                 :            :     else
    1661                 :            :     {
    1662                 :        119 :         sal_Int32 i = 0;
    1663 [ +  + ][ +  + ]:        425 :         while (i < nIntCount && !bOk)
                 [ +  + ]
    1664                 :            :         {
    1665 [ +  - ][ +  - ]:        306 :             xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
                 [ +  - ]
    1666 [ +  - ][ +  - ]:        306 :             if ( xDim.is() && !lcl_IsDuplicated( xDim ) )
                 [ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
    1667                 :            :             {
    1668         [ +  + ]:        306 :                 if (nPos == nIndex)
    1669                 :            :                 {
    1670                 :        117 :                     bOk = sal_True;
    1671                 :        117 :                     nDimIndex = i;
    1672                 :            :                 }
    1673                 :            :                 else
    1674                 :        189 :                     ++nPos;
    1675                 :            :             }
    1676                 :        306 :             ++i;
    1677                 :            :         }
    1678                 :            :     }
    1679                 :            : 
    1680         [ +  + ]:        153 :     if ( bOk )
    1681                 :            :     {
    1682 [ +  - ][ +  - ]:        151 :         xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
                 [ +  - ]
    1683         [ +  - ]:        151 :         Reference<XNamed> xDimName( xDim, UNO_QUERY );
    1684         [ +  - ]:        151 :         if ( xDimName.is() )
    1685                 :            :         {
    1686         [ +  - ]:        151 :             OUString sOriginalName( lcl_GetOriginalName( xDimName ) );
    1687                 :        151 :             rFieldId.maFieldName = sOriginalName;
    1688                 :            :             rFieldId.mbDataLayout = ScUnoHelpFunctions::GetBoolProperty( xDim,
    1689 [ +  - ][ +  - ]:        151 :                         OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ISDATALAYOUT)) );
    1690                 :            : 
    1691                 :        151 :             sal_Int32 nRepeat = 0;
    1692 [ +  - ][ -  + ]:        151 :             if ( rOrient.hasValue() && lcl_IsDuplicated( xDim ) )
                 [ +  + ]
           [ -  +  #  # ]
                 [ +  + ]
    1693                 :            :             {
    1694                 :            :                 // find the repeat count
    1695                 :            :                 // (this relies on the original dimension always being before the duplicates)
    1696                 :            : 
    1697                 :          0 :                 Reference<XNamed> xPrevName;
    1698         [ #  # ]:          0 :                 for (sal_Int32 i = 0; i < nDimIndex; ++i)
    1699                 :            :                 {
    1700 [ #  # ][ #  # ]:          0 :                     xPrevName.set( xIntDims->getByIndex(i), UNO_QUERY );
                 [ #  # ]
    1701 [ #  # ][ #  # ]:          0 :                     if ( xPrevName.is() && lcl_GetOriginalName( xPrevName ) == sOriginalName )
         [ #  # ][ #  # ]
           [ #  #  #  #  
           #  # ][ #  # ]
    1702                 :          0 :                         ++nRepeat;
    1703                 :          0 :                 }
    1704                 :            :             }
    1705                 :        151 :             rFieldId.mnFieldIdx = nRepeat;
    1706                 :            :         }
    1707                 :            :         else
    1708                 :        151 :             bOk = false;
    1709                 :            :     }
    1710                 :            : 
    1711                 :        153 :     return bOk;
    1712                 :            : }
    1713                 :            : 
    1714                 :         12 : sal_Bool lcl_GetFieldDataByName( ScDPObject* pDPObj, const OUString& rFieldName, ScFieldIdentifier& rFieldId )
    1715                 :            : {
    1716                 :            :     // "By name" is always the first match.
    1717                 :            :     // The name "Data" always refers to the data layout field.
    1718                 :         12 :     rFieldId.maFieldName = rFieldName;
    1719                 :         12 :     rFieldId.mnFieldIdx = 0;
    1720                 :         12 :     rFieldId.mbDataLayout = rFieldName == SC_DATALAYOUT_NAME;
    1721                 :            : 
    1722                 :         12 :     pDPObj->GetSource();    // IsDimNameInUse doesn't update source data
    1723                 :            : 
    1724                 :            :     // check if the named field exists (not for data layout)
    1725 [ +  + ][ +  - ]:         12 :     return rFieldId.mbDataLayout || pDPObj->IsDimNameInUse( rFieldName );
    1726                 :            : }
    1727                 :            : 
    1728                 :            : // XDataPilotFields
    1729                 :            : 
    1730                 :        153 : ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
    1731                 :            : {
    1732                 :            : // TODO
    1733         [ +  - ]:        153 :     if (ScDPObject* pObj = GetDPObject())
    1734                 :            :     {
    1735                 :        153 :         ScFieldIdentifier aFieldId;
    1736 [ +  - ][ +  + ]:        153 :         if (lcl_GetFieldDataByIndex( pObj->GetSource(), maOrient, nIndex, aFieldId ))
                 [ +  - ]
    1737 [ +  - ][ +  + ]:        153 :             return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient );
    1738                 :            :     }
    1739                 :        153 :     return 0;
    1740                 :            : }
    1741                 :            : 
    1742                 :         12 : ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const OUString& aName) const
    1743                 :            : {
    1744         [ +  - ]:         12 :     if (ScDPObject* pDPObj = GetDPObject())
    1745                 :            :     {
    1746                 :         12 :         ScFieldIdentifier aFieldId;
    1747 [ +  + ][ +  - ]:         12 :         if (lcl_GetFieldDataByName( pDPObj, aName, aFieldId ))
    1748 [ +  - ][ +  + ]:         12 :             return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient );
    1749                 :            :     }
    1750                 :         12 :     return 0;
    1751                 :            : }
    1752                 :            : 
    1753                 :            : // XEnumerationAccess
    1754                 :            : 
    1755                 :          2 : Reference<XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration()
    1756                 :            :                                                     throw(RuntimeException)
    1757                 :            : {
    1758         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1759 [ +  - ][ +  - ]:          2 :     return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldsEnumeration")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1760                 :            : }
    1761                 :            : 
    1762                 :            : // XIndexAccess
    1763                 :            : 
    1764                 :         66 : sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount() throw(RuntimeException)
    1765                 :            : {
    1766         [ +  - ]:         66 :     SolarMutexGuard aGuard;
    1767                 :            : // TODO
    1768         [ +  - ]:         66 :     ScDPObject* pDPObj = GetDPObject();
    1769 [ +  - ][ +  - ]:         66 :     return pDPObj ? lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) : 0;
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    1770                 :            : }
    1771                 :            : 
    1772                 :        153 : Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
    1773                 :            :         throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
    1774                 :            : {
    1775         [ +  - ]:        153 :     SolarMutexGuard aGuard;
    1776 [ +  - ][ +  + ]:        153 :     Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) );
                 [ +  - ]
    1777         [ +  + ]:        153 :     if (!xField.is())
    1778         [ +  - ]:          2 :         throw IndexOutOfBoundsException();
    1779 [ +  - ][ +  - ]:        153 :     return Any( xField );
    1780                 :            : }
    1781                 :            : 
    1782                 :          1 : uno::Type SAL_CALL ScDataPilotFieldsObj::getElementType() throw(RuntimeException)
    1783                 :            : {
    1784         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    1785 [ +  - ][ +  - ]:          1 :     return getCppuType((Reference<XPropertySet>*)0);
    1786                 :            : }
    1787                 :            : 
    1788                 :          1 : sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements() throw(RuntimeException)
    1789                 :            : {
    1790         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    1791 [ +  - ][ +  - ]:          1 :     return ( getCount() != 0 );
    1792                 :            : }
    1793                 :            : 
    1794                 :         10 : Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName )
    1795                 :            :         throw(NoSuchElementException, WrappedTargetException, RuntimeException)
    1796                 :            : {
    1797         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    1798 [ +  - ][ +  + ]:         10 :     Reference<XPropertySet> xField(GetObjectByName_Impl(aName));
                 [ +  - ]
    1799         [ +  + ]:         10 :     if (!xField.is())
    1800         [ +  - ]:          1 :         throw NoSuchElementException();
    1801 [ +  - ][ +  - ]:         10 :     return Any( xField );
    1802                 :            : }
    1803                 :            : 
    1804                 :          1 : Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
    1805                 :            :                                                 throw(RuntimeException)
    1806                 :            : {
    1807         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    1808                 :            : // TODO
    1809 [ +  - ][ +  - ]:          1 :     if (ScDPObject* pDPObj = GetDPObject())
    1810                 :            :     {
    1811 [ +  - ][ +  - ]:          1 :         Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) );
                 [ +  - ]
    1812         [ +  - ]:          1 :         OUString* pAry = aSeq.getArray();
    1813                 :            : 
    1814         [ +  - ]:          1 :         const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pDPObj->GetSaveData()->GetDimensions();
    1815         [ +  - ]:          1 :         boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
    1816 [ +  - ][ #  # ]:          1 :         for (it = rDimensions.begin(); it != rDimensions.end(); ++it)
         [ +  - ][ +  - ]
                 [ -  + ]
    1817                 :            :         {
    1818 [ #  # ][ #  # ]:          0 :             if(maOrient.hasValue() && (it->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
         [ #  # ][ #  # ]
                 [ #  # ]
    1819                 :            :             {
    1820         [ #  # ]:          0 :                 *pAry = it->GetName();
    1821                 :          0 :                 ++pAry;
    1822                 :            :             }
    1823                 :            :         }
    1824 [ +  - ][ +  - ]:          1 :         return aSeq;
    1825                 :            :     }
    1826 [ #  # ][ +  - ]:          1 :     return Sequence<OUString>();
    1827                 :            : }
    1828                 :            : 
    1829                 :          2 : sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const OUString& aName )
    1830                 :            :                                         throw(RuntimeException)
    1831                 :            : {
    1832         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1833                 :            : 
    1834 [ +  - ][ +  - ]:          2 :     return GetObjectByName_Impl(aName) != NULL;
    1835                 :            : }
    1836                 :            : 
    1837                 :            : //------------------------------------------------------------------------
    1838                 :            : 
    1839                 :          0 : ScDataPilotFieldObj::ScDataPilotFieldObj(
    1840                 :            :         ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
    1841                 :            :     ScDataPilotChildObjBase( rParent, rFieldId ),
    1842 [ #  # ][ #  # ]:          0 :     maPropSet( lcl_GetDataPilotFieldMap() )
                 [ #  # ]
    1843                 :            : {
    1844                 :          0 : }
    1845                 :            : 
    1846                 :        161 : ScDataPilotFieldObj::ScDataPilotFieldObj( ScDataPilotDescriptorBase& rParent,
    1847                 :            :         const ScFieldIdentifier& rFieldId, const Any& rOrient ) :
    1848                 :            :     ScDataPilotChildObjBase( rParent, rFieldId ),
    1849                 :            :     maPropSet( lcl_GetDataPilotFieldMap() ),
    1850 [ +  - ][ +  - ]:        161 :     maOrient( rOrient )
                 [ +  - ]
    1851                 :            : {
    1852                 :        161 : }
    1853                 :            : 
    1854 [ +  - ][ +  - ]:        160 : ScDataPilotFieldObj::~ScDataPilotFieldObj()
    1855                 :            : {
    1856         [ -  + ]:        320 : }
    1857                 :            : 
    1858                 :            : // XNamed
    1859                 :            : 
    1860                 :         79 : OUString SAL_CALL ScDataPilotFieldObj::getName() throw(RuntimeException)
    1861                 :            : {
    1862         [ +  - ]:         79 :     SolarMutexGuard aGuard;
    1863                 :         79 :     OUString aName;
    1864 [ +  - ][ +  - ]:         79 :     if( ScDPSaveDimension* pDim = GetDPDimension() )
    1865                 :            :     {
    1866         [ -  + ]:         79 :         if( pDim->IsDataLayout() )
    1867         [ #  # ]:          0 :             aName = OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) );
    1868                 :            :         else
    1869                 :            :         {
    1870         [ +  - ]:         79 :             const rtl::OUString* pLayoutName = pDim->GetLayoutName();
    1871         [ +  + ]:         79 :             if (pLayoutName)
    1872                 :          3 :                 aName = *pLayoutName;
    1873                 :            :             else
    1874                 :         76 :                 aName = pDim->GetName();
    1875                 :            :         }                                                                }
    1876         [ +  - ]:         79 :     return aName;
    1877                 :            : }
    1878                 :            : 
    1879                 :          6 : void SAL_CALL ScDataPilotFieldObj::setName( const OUString& rName ) throw(RuntimeException)
    1880                 :            : {
    1881         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    1882                 :          6 :     ScDPObject* pDPObj = 0;
    1883         [ +  - ]:          6 :     ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
    1884 [ +  - ][ +  - ]:          6 :     if( pDim && !pDim->IsDataLayout() )
                 [ +  - ]
    1885                 :            :     {
    1886         [ +  - ]:          6 :         String aName( rName );
    1887 [ +  - ][ +  - ]:          6 :         pDim->SetLayoutName(aName);
    1888 [ +  - ][ +  - ]:          6 :         SetDPObject( pDPObj );
    1889         [ +  - ]:          6 :     }
    1890                 :          6 : }
    1891                 :            : 
    1892                 :            : // XPropertySet
    1893                 :            : 
    1894                 :          3 : Reference<XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo()
    1895                 :            :                                                         throw(RuntimeException)
    1896                 :            : {
    1897         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    1898                 :            :     static Reference<XPropertySetInfo> aRef(
    1899 [ +  - ][ +  - ]:          3 :         new SfxItemPropertySetInfo( maPropSet.getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    1900         [ +  - ]:          3 :     return aRef;
    1901                 :            : }
    1902                 :            : 
    1903                 :        138 : void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
    1904                 :            :         throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1905                 :            : {
    1906         [ +  - ]:        138 :     SolarMutexGuard aGuard;
    1907         [ +  - ]:        138 :     String aNameString(aPropertyName);
    1908 [ +  - ][ +  + ]:        138 :     if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) )
    1909                 :            :     {
    1910                 :            :         // #i109350# use GetEnumFromAny because it also allows sal_Int32
    1911                 :            :         GeneralFunction eFunction = (GeneralFunction)
    1912         [ +  - ]:         18 :                             ScUnoHelpFunctions::GetEnumFromAny( aValue );
    1913         [ +  - ]:         18 :         setFunction( eFunction );
    1914                 :            :     }
    1915 [ +  - ][ +  + ]:        120 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) )
    1916                 :            :     {
    1917         [ +  - ]:          4 :         Sequence< GeneralFunction > aSubtotals;
    1918 [ +  - ][ +  - ]:          4 :         if( aValue >>= aSubtotals )
    1919 [ +  - ][ +  - ]:          4 :             setSubtotals( aSubtotals );
    1920                 :            :     }
    1921 [ +  - ][ +  + ]:        116 :     else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) )
    1922                 :            :     {
    1923                 :            :         //! test for correct enum type?
    1924                 :            :         DataPilotFieldOrientation eOrient = (DataPilotFieldOrientation)
    1925         [ +  - ]:         69 :                             ScUnoHelpFunctions::GetEnumFromAny( aValue );
    1926         [ +  - ]:         69 :         setOrientation( eOrient );
    1927                 :            :     }
    1928 [ +  - ][ +  + ]:         47 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) )
    1929                 :            :     {
    1930                 :          4 :         OUString sCurrentPage;
    1931         [ +  - ]:          4 :         if (aValue >>= sCurrentPage)
    1932         [ +  - ]:          4 :             setCurrentPage(sCurrentPage);
    1933                 :            :     }
    1934 [ +  - ][ +  + ]:         43 :     else if ( aNameString.EqualsAscii( SC_UNONAME_USESELPAGE ) )
    1935                 :            :     {
    1936 [ +  - ][ +  - ]:          6 :         setUseCurrentPage(cppu::any2bool(aValue));
    1937                 :            :     }
    1938 [ +  - ][ +  + ]:         37 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASAUTOSHOW ) )
    1939                 :            :     {
    1940 [ +  - ][ +  + ]:          5 :         if (!cppu::any2bool(aValue))
    1941         [ +  - ]:          2 :             setAutoShowInfo(NULL);
    1942                 :            :     }
    1943 [ +  - ][ +  + ]:         32 :     else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) )
    1944                 :            :     {
    1945                 :          2 :         DataPilotFieldAutoShowInfo aInfo;
    1946 [ +  - ][ +  - ]:          2 :         if (aValue >>= aInfo)
    1947         [ +  - ]:          2 :             setAutoShowInfo(&aInfo);
    1948                 :            :     }
    1949 [ +  - ][ +  + ]:         30 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASLAYOUTINFO ) )
    1950                 :            :     {
    1951 [ +  - ][ +  + ]:          5 :         if (!cppu::any2bool(aValue))
    1952         [ +  - ]:          2 :             setLayoutInfo(NULL);
    1953                 :            :     }
    1954 [ +  - ][ +  + ]:         25 :     else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) )
    1955                 :            :     {
    1956                 :          2 :         DataPilotFieldLayoutInfo aInfo;
    1957 [ +  - ][ +  - ]:          2 :         if (aValue >>= aInfo)
    1958         [ +  - ]:          2 :             setLayoutInfo(&aInfo);
    1959                 :            :     }
    1960 [ +  - ][ +  + ]:         23 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASREFERENCE ) )
    1961                 :            :     {
    1962 [ +  - ][ +  + ]:          5 :         if (!cppu::any2bool(aValue))
    1963         [ +  - ]:          2 :             setReference(NULL);
    1964                 :            :     }
    1965 [ +  - ][ +  + ]:         18 :     else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) )
    1966                 :            :     {
    1967                 :          2 :         DataPilotFieldReference aRef;
    1968 [ +  - ][ +  - ]:          2 :         if (aValue >>= aRef)
    1969         [ +  - ]:          2 :             setReference(&aRef);
    1970                 :            :     }
    1971 [ +  - ][ +  + ]:         16 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASSORTINFO ) )
    1972                 :            :     {
    1973 [ +  - ][ +  + ]:          5 :         if (!cppu::any2bool(aValue))
    1974         [ +  - ]:          2 :             setSortInfo(NULL);
    1975                 :            :     }
    1976 [ +  - ][ +  + ]:         11 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) )
    1977                 :            :     {
    1978                 :          2 :         DataPilotFieldSortInfo aInfo;
    1979 [ +  - ][ +  - ]:          2 :         if (aValue >>= aInfo)
    1980         [ +  - ]:          2 :             setSortInfo(&aInfo);
    1981                 :            :     }
    1982 [ +  - ][ +  + ]:          9 :     else if ( aNameString.EqualsAscii( SC_UNONAME_ISGROUP ) )
    1983                 :            :     {
    1984 [ +  - ][ -  + ]:          3 :         if (!cppu::any2bool(aValue))
    1985         [ #  # ]:          0 :             setGroupInfo(NULL);
    1986                 :            :     }
    1987 [ +  - ][ -  + ]:          6 :     else if ( aNameString.EqualsAscii( SC_UNONAME_GROUPINFO ) )
    1988                 :            :     {
    1989         [ #  # ]:          0 :         DataPilotFieldGroupInfo aInfo;
    1990 [ #  # ][ #  # ]:          0 :         if (aValue >>= aInfo)
    1991 [ #  # ][ #  # ]:          0 :             setGroupInfo(&aInfo);
    1992                 :            :     }
    1993 [ +  - ][ +  + ]:          6 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SHOWEMPTY ) )
    1994                 :            :     {
    1995 [ +  - ][ +  - ]:          4 :         setShowEmpty(cppu::any2bool(aValue));
    1996 [ +  - ][ +  - ]:        138 :     }
    1997                 :        138 : }
    1998                 :            : 
    1999                 :        134 : Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName )
    2000                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    2001                 :            : {
    2002         [ +  - ]:        134 :     SolarMutexGuard aGuard;
    2003         [ +  - ]:        134 :     String aNameString(aPropertyName);
    2004                 :        134 :     Any aRet;
    2005                 :            : 
    2006 [ +  + ][ +  - ]:        134 :     if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) )
    2007 [ +  - ][ +  - ]:          9 :         aRet <<= getFunction();
    2008 [ +  - ][ +  + ]:        125 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) )
    2009 [ +  - ][ +  - ]:          9 :         aRet <<= getSubtotals();
                 [ +  - ]
    2010 [ +  - ][ +  + ]:        116 :     else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) )
    2011 [ +  - ][ +  - ]:         18 :         aRet <<= getOrientation();
    2012 [ +  - ][ +  + ]:         98 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) )
    2013 [ +  - ][ +  - ]:          9 :         aRet <<= getCurrentPage();
    2014 [ +  - ][ +  + ]:         89 :     else if ( aNameString.EqualsAscii( SC_UNONAME_USESELPAGE ) )
    2015 [ +  - ][ +  - ]:         15 :         aRet <<= getUseCurrentPage();
    2016 [ +  - ][ +  + ]:         74 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASAUTOSHOW ) )
    2017 [ +  - ][ +  - ]:         10 :         aRet = ::cppu::bool2any(getAutoShowInfo() != NULL);
    2018 [ +  - ][ +  + ]:         64 :     else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) )
    2019                 :            :     {
    2020         [ +  - ]:          2 :         const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo();
    2021         [ +  - ]:          2 :         if (pInfo)
    2022         [ +  - ]:          2 :             aRet <<= DataPilotFieldAutoShowInfo(*pInfo);
    2023                 :            :     }
    2024 [ +  - ][ +  + ]:         62 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASLAYOUTINFO ) )
    2025 [ +  - ][ +  - ]:         10 :         aRet = ::cppu::bool2any(getLayoutInfo() != NULL);
    2026 [ +  - ][ +  + ]:         52 :     else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) )
    2027                 :            :     {
    2028         [ +  - ]:          2 :         const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo();
    2029         [ +  - ]:          2 :         if (pInfo)
    2030         [ +  - ]:          2 :             aRet <<= DataPilotFieldLayoutInfo(*pInfo);
    2031                 :            :     }
    2032 [ +  - ][ +  + ]:         50 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASREFERENCE ) )
    2033 [ +  - ][ +  - ]:         10 :         aRet = ::cppu::bool2any(getReference() != NULL);
    2034 [ +  - ][ +  + ]:         40 :     else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) )
    2035                 :            :     {
    2036         [ +  - ]:          2 :         const DataPilotFieldReference* pRef = getReference();
    2037         [ +  - ]:          2 :         if (pRef)
    2038         [ +  - ]:          2 :             aRet <<= DataPilotFieldReference(*pRef);
    2039                 :            :     }
    2040 [ +  - ][ +  + ]:         38 :     else if ( aNameString.EqualsAscii( SC_UNONAME_HASSORTINFO ) )
    2041 [ +  - ][ +  - ]:         10 :         aRet = ::cppu::bool2any(getSortInfo() != NULL);
    2042 [ +  - ][ +  + ]:         28 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) )
    2043                 :            :     {
    2044         [ +  - ]:          2 :         const DataPilotFieldSortInfo* pInfo = getSortInfo();
    2045         [ +  - ]:          2 :         if (pInfo)
    2046         [ +  - ]:          2 :             aRet <<= DataPilotFieldSortInfo(*pInfo);
    2047                 :            :     }
    2048 [ +  - ][ +  + ]:         26 :     else if ( aNameString.EqualsAscii( SC_UNONAME_ISGROUP ) )
    2049 [ +  - ][ +  - ]:         14 :         aRet = ::cppu::bool2any(hasGroupInfo());
    2050 [ +  - ][ +  + ]:         12 :     else if ( aNameString.EqualsAscii( SC_UNONAME_GROUPINFO ) )
    2051                 :            :     {
    2052 [ +  - ][ +  - ]:          3 :         aRet <<= getGroupInfo();
                 [ +  - ]
    2053                 :            :     }
    2054 [ +  - ][ +  - ]:          9 :     else if ( aNameString.EqualsAscii( SC_UNONAME_SHOWEMPTY ) )
    2055 [ +  - ][ +  - ]:          9 :         aRet <<= getShowEmpty();
    2056                 :            : 
    2057 [ +  - ][ +  - ]:        134 :     return aRet;
    2058                 :            : }
    2059                 :            : 
    2060                 :            : // XDatePilotField
    2061                 :            : 
    2062                 :          6 : Reference<XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems()
    2063                 :            :                 throw (RuntimeException)
    2064                 :            : {
    2065         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2066         [ +  - ]:          6 :     if (!mxItems.is())
    2067 [ +  - ][ +  - ]:          6 :         mxItems.set( new ScDataPilotItemsObj( mrParent, maFieldId ) );
                 [ +  - ]
    2068         [ +  - ]:          6 :     return mxItems;
    2069                 :            : }
    2070                 :            : 
    2071                 :          0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDataPilotFieldObj )
    2072                 :            : 
    2073                 :         18 : DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation() const
    2074                 :            : {
    2075         [ +  - ]:         18 :     SolarMutexGuard aGuard;
    2076         [ +  - ]:         18 :     ScDPSaveDimension* pDim = GetDPDimension();
    2077 [ +  - ][ +  - ]:         18 :     return pDim ? static_cast< DataPilotFieldOrientation >( pDim->GetOrientation() ) : DataPilotFieldOrientation_HIDDEN;
    2078                 :            : }
    2079                 :            : 
    2080                 :         69 : void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
    2081                 :            : {
    2082         [ +  - ]:         69 :     SolarMutexGuard aGuard;
    2083 [ -  + ][ #  # ]:         69 :     if (maOrient.hasValue() && (eNew == maOrient.get< DataPilotFieldOrientation >()))
         [ #  # ][ -  + ]
    2084                 :         69 :         return;
    2085                 :            : 
    2086                 :         69 :     ScDPObject* pDPObj = 0;
    2087 [ +  - ][ +  - ]:         69 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2088                 :            :     {
    2089                 :         69 :         ScDPSaveData* pSaveData = pDPObj->GetSaveData();
    2090                 :            : 
    2091                 :            :         /*  If the field was taken from getDataPilotFields(), don't reset the
    2092                 :            :             orientation for an existing use, but create a duplicated field
    2093                 :            :             instead (for "Data" orientation only). */
    2094   [ +  -  +  + ]:        138 :         if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
         [ -  + ][ -  + ]
                 [ +  - ]
    2095                 :         69 :              (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
    2096                 :            :              (eNew == DataPilotFieldOrientation_DATA) )
    2097                 :            :         {
    2098                 :            : 
    2099                 :          0 :             ScDPSaveDimension* pNewDim = 0;
    2100                 :            : 
    2101                 :            :             // look for existing duplicate with orientation "hidden"
    2102                 :            : 
    2103                 :          0 :             sal_Int32 nFound = 0;
    2104         [ #  # ]:          0 :             const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pSaveData->GetDimensions();
    2105         [ #  # ]:          0 :             boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
    2106 [ #  # ][ #  # ]:          0 :             for ( it = rDimensions.begin(); it != rDimensions.end() && !pNewDim; ++it )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    2107                 :            :             {
    2108 [ #  # ][ #  # ]:          0 :                 if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2109                 :            :                 {
    2110 [ #  # ][ #  # ]:          0 :                     if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
    2111         [ #  # ]:          0 :                         pNewDim = const_cast<ScDPSaveDimension*>(&(*it));      // use this one
    2112                 :            :                     else
    2113                 :          0 :                         ++nFound;               // count existing non-hidden occurrences
    2114                 :            :                 }
    2115                 :            :             }
    2116                 :            : 
    2117         [ #  # ]:          0 :             if ( !pNewDim )     // if none found, create a new duplicated dimension
    2118         [ #  # ]:          0 :                 pNewDim = &pSaveData->DuplicateDimension( *pDim );
    2119                 :            : 
    2120                 :          0 :             maFieldId.mnFieldIdx = nFound;      // keep accessing the new one
    2121                 :          0 :             pDim = pNewDim;
    2122                 :            :         }
    2123                 :            : 
    2124         [ +  - ]:         69 :         pDim->SetOrientation(sal::static_int_cast<sal_uInt16>(eNew));
    2125                 :            : 
    2126                 :            :         // move changed field behind all other fields (make it the last field in dimension)
    2127 [ +  - ][ +  - ]:         69 :         pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
    2128                 :            : 
    2129         [ +  - ]:         69 :         SetDPObject( pDPObj );
    2130                 :            : 
    2131         [ +  - ]:         69 :         maOrient <<= eNew;   // modifying the same object's orientation again doesn't create another duplicate
    2132 [ +  - ][ +  - ]:         69 :     }
    2133                 :            : }
    2134                 :            : 
    2135                 :          9 : GeneralFunction ScDataPilotFieldObj::getFunction() const
    2136                 :            : {
    2137         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    2138                 :          9 :     GeneralFunction eRet = GeneralFunction_NONE;
    2139 [ +  - ][ +  - ]:          9 :     if( ScDPSaveDimension* pDim = GetDPDimension() )
    2140                 :            :     {
    2141         [ +  + ]:          9 :         if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
    2142                 :            :         {
    2143                 :            :             // for non-data fields, property Function is the subtotals
    2144                 :          5 :             long nSubCount = pDim->GetSubTotalsCount();
    2145         [ +  + ]:          5 :             if ( nSubCount > 0 )
    2146                 :          4 :                 eRet = (GeneralFunction)pDim->GetSubTotalFunc(0);    // always use the first one
    2147                 :            :             // else keep NONE
    2148                 :            :         }
    2149                 :            :         else
    2150                 :          4 :             eRet = (GeneralFunction)pDim->GetFunction();
    2151                 :            :     }
    2152         [ +  - ]:          9 :     return eRet;
    2153                 :            : }
    2154                 :            : 
    2155                 :         18 : void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc)
    2156                 :            : {
    2157         [ +  - ]:         18 :     SolarMutexGuard aGuard;
    2158                 :         18 :     ScDPObject* pDPObj = 0;
    2159 [ +  - ][ +  - ]:         18 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2160                 :            :     {
    2161         [ +  + ]:         18 :         if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
    2162                 :            :         {
    2163                 :            :             // for non-data fields, property Function is the subtotals
    2164         [ -  + ]:         16 :             if ( eNewFunc == GeneralFunction_NONE )
    2165         [ #  # ]:          0 :                 pDim->SetSubTotals( 0, NULL );
    2166                 :            :             else
    2167                 :            :             {
    2168                 :         16 :                 sal_uInt16 nFunc = sal::static_int_cast<sal_uInt16>( eNewFunc );
    2169         [ +  - ]:         16 :                 pDim->SetSubTotals( 1, &nFunc );
    2170                 :            :             }
    2171                 :            :         }
    2172                 :            :         else
    2173         [ +  - ]:          2 :             pDim->SetFunction( sal::static_int_cast<sal_uInt16>( eNewFunc ) );
    2174         [ +  - ]:         18 :         SetDPObject( pDPObj );
    2175         [ +  - ]:         18 :     }
    2176                 :         18 : }
    2177                 :            : 
    2178                 :          9 : Sequence< GeneralFunction > ScDataPilotFieldObj::getSubtotals() const
    2179                 :            : {
    2180         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    2181         [ +  - ]:          9 :     Sequence< GeneralFunction > aRet;
    2182 [ +  - ][ +  - ]:          9 :     if( ScDPSaveDimension* pDim = GetDPDimension() )
    2183                 :            :     {
    2184         [ +  + ]:          9 :         if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
    2185                 :            :         {
    2186                 :            :             // for non-data fields, property Functions is the sequence of subtotals
    2187                 :          5 :             sal_Int32 nCount = static_cast< sal_Int32 >( pDim->GetSubTotalsCount() );
    2188         [ +  + ]:          5 :             if ( nCount > 0 )
    2189                 :            :             {
    2190         [ +  - ]:          4 :                 aRet.realloc( nCount );
    2191         [ +  + ]:          8 :                 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
    2192         [ +  - ]:          4 :                     aRet[ nIdx ] = (GeneralFunction)pDim->GetSubTotalFunc( nIdx );
    2193                 :            :             }
    2194                 :            :         }
    2195                 :            :     }
    2196         [ +  - ]:          9 :     return aRet;
    2197                 :            : }
    2198                 :            : 
    2199                 :          4 : void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubtotals )
    2200                 :            : {
    2201         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2202                 :          4 :     ScDPObject* pDPObj = 0;
    2203 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2204                 :            :     {
    2205         [ +  + ]:          4 :         if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
    2206                 :            :         {
    2207                 :          2 :             sal_Int32 nCount = rSubtotals.getLength();
    2208         [ +  - ]:          2 :             if( nCount == 1 )
    2209                 :            :             {
    2210                 :            :                 // count 1: all values are allowed (including NONE and AUTO)
    2211         [ +  + ]:          2 :                 if( rSubtotals[ 0 ] == GeneralFunction_NONE )
    2212         [ +  - ]:          1 :                     pDim->SetSubTotals( 0, NULL );
    2213                 :            :                 else
    2214                 :            :                 {
    2215                 :          1 :                     sal_uInt16 nFunc = sal::static_int_cast<sal_uInt16>( rSubtotals[ 0 ] );
    2216         [ +  - ]:          1 :                     pDim->SetSubTotals( 1, &nFunc );
    2217                 :            :                 }
    2218                 :            :             }
    2219         [ #  # ]:          0 :             else if( nCount > 1 )
    2220                 :            :             {
    2221                 :            :                 // set multiple functions, ignore NONE and AUTO in this case
    2222         [ #  # ]:          0 :                 ::std::vector< sal_uInt16 > aSubt;
    2223         [ #  # ]:          0 :                 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
    2224                 :            :                 {
    2225                 :          0 :                     GeneralFunction eFunc = rSubtotals[ nIdx ];
    2226 [ #  # ][ #  # ]:          0 :                     if( (eFunc != GeneralFunction_NONE) && (eFunc != GeneralFunction_AUTO) )
    2227                 :            :                     {
    2228                 :            :                         // do not insert functions twice
    2229                 :          0 :                         sal_uInt16 nFunc = static_cast< sal_uInt16 >( eFunc );
    2230 [ #  # ][ #  # ]:          0 :                         if( ::std::find( aSubt.begin(), aSubt.end(), nFunc ) == aSubt.end() )
                 [ #  # ]
    2231         [ #  # ]:          0 :                             aSubt.push_back( nFunc );
    2232                 :            :                     }
    2233                 :            :                 }
    2234                 :            :                 // set values from vector to ScDPSaveDimension
    2235         [ #  # ]:          0 :                 if ( aSubt.empty() )
    2236         [ #  # ]:          0 :                     pDim->SetSubTotals( 0, NULL );
    2237                 :            :                 else
    2238 [ #  # ][ #  # ]:          0 :                     pDim->SetSubTotals( static_cast< long >( aSubt.size() ), &aSubt.front() );
    2239                 :            :             }
    2240                 :            :         }
    2241         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2242         [ +  - ]:          4 :     }
    2243                 :          4 : }
    2244                 :            : 
    2245                 :          9 : OUString ScDataPilotFieldObj::getCurrentPage() const
    2246                 :            : {
    2247         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    2248         [ +  - ]:          9 :     ScDPSaveDimension* pDim = GetDPDimension();
    2249 [ +  - ][ +  - ]:          9 :     if( pDim && pDim->HasCurrentPage() )
         [ +  + ][ +  + ]
    2250         [ +  - ]:          8 :         return pDim->GetCurrentPage();
    2251         [ +  - ]:          9 :     return OUString();
    2252                 :            : }
    2253                 :            : 
    2254                 :          4 : void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
    2255                 :            : {
    2256         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2257                 :          4 :     ScDPObject* pDPObj = 0;
    2258 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2259                 :            :     {
    2260         [ +  - ]:          4 :         pDim->SetCurrentPage( &rPage );
    2261         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2262         [ +  - ]:          4 :     }
    2263                 :          4 : }
    2264                 :            : 
    2265                 :         15 : sal_Bool ScDataPilotFieldObj::getUseCurrentPage() const
    2266                 :            : {
    2267         [ +  - ]:         15 :     SolarMutexGuard aGuard;
    2268         [ +  - ]:         15 :     ScDPSaveDimension* pDim = GetDPDimension();
    2269 [ +  - ][ +  - ]:         15 :     return pDim && pDim->HasCurrentPage();
         [ +  + ][ +  - ]
    2270                 :            : }
    2271                 :            : 
    2272                 :          6 : void ScDataPilotFieldObj::setUseCurrentPage( sal_Bool bUse )
    2273                 :            : {
    2274         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2275                 :          6 :     ScDPObject* pDPObj = 0;
    2276 [ +  - ][ +  - ]:          6 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2277                 :            :     {
    2278         [ +  + ]:          6 :         if( bUse )
    2279                 :            :         {
    2280                 :            :             /*  It is somehow useless to set the property "HasSelectedPage" to
    2281                 :            :                 true, because it is still needed to set an explicit page name. */
    2282 [ +  - ][ +  - ]:          3 :             if( !pDim->HasCurrentPage() )
    2283                 :            :             {
    2284                 :          3 :                 const ::rtl::OUString aPage;
    2285         [ +  - ]:          3 :                 pDim->SetCurrentPage( &aPage );
    2286                 :            :             }
    2287                 :            :         }
    2288                 :            :         else
    2289         [ +  - ]:          3 :             pDim->SetCurrentPage( 0 );
    2290         [ +  - ]:          6 :         SetDPObject( pDPObj );
    2291         [ +  - ]:          6 :     }
    2292                 :          6 : }
    2293                 :            : 
    2294                 :         12 : const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo()
    2295                 :            : {
    2296         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    2297         [ +  - ]:         12 :     ScDPSaveDimension* pDim = GetDPDimension();
    2298 [ +  - ][ +  - ]:         12 :     return pDim ? pDim->GetAutoShowInfo() : 0;
    2299                 :            : }
    2300                 :            : 
    2301                 :          4 : void ScDataPilotFieldObj::setAutoShowInfo( const DataPilotFieldAutoShowInfo* pInfo )
    2302                 :            : {
    2303         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2304                 :          4 :     ScDPObject* pDPObj = 0;
    2305 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2306                 :            :     {
    2307         [ +  - ]:          4 :         pDim->SetAutoShowInfo( pInfo );
    2308         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2309         [ +  - ]:          4 :     }
    2310                 :          4 : }
    2311                 :            : 
    2312                 :         12 : const DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo()
    2313                 :            : {
    2314         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    2315         [ +  - ]:         12 :     ScDPSaveDimension* pDim = GetDPDimension();
    2316 [ +  - ][ +  - ]:         12 :     return pDim ? pDim->GetLayoutInfo() : 0;
    2317                 :            : }
    2318                 :            : 
    2319                 :          4 : void ScDataPilotFieldObj::setLayoutInfo( const DataPilotFieldLayoutInfo* pInfo )
    2320                 :            : {
    2321         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2322                 :          4 :     ScDPObject* pDPObj = 0;
    2323 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2324                 :            :     {
    2325         [ +  - ]:          4 :         pDim->SetLayoutInfo( pInfo );
    2326         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2327         [ +  - ]:          4 :     }
    2328                 :          4 : }
    2329                 :            : 
    2330                 :         12 : const DataPilotFieldReference* ScDataPilotFieldObj::getReference()
    2331                 :            : {
    2332         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    2333         [ +  - ]:         12 :     ScDPSaveDimension* pDim = GetDPDimension();
    2334 [ +  - ][ +  - ]:         12 :     return pDim ? pDim->GetReferenceValue() : 0;
    2335                 :            : }
    2336                 :            : 
    2337                 :          4 : void ScDataPilotFieldObj::setReference( const DataPilotFieldReference* pInfo )
    2338                 :            : {
    2339         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2340                 :          4 :     ScDPObject* pDPObj = 0;
    2341 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2342                 :            :     {
    2343         [ +  - ]:          4 :         pDim->SetReferenceValue( pInfo );
    2344         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2345         [ +  - ]:          4 :     }
    2346                 :          4 : }
    2347                 :            : 
    2348                 :         12 : const DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo()
    2349                 :            : {
    2350         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    2351         [ +  - ]:         12 :     ScDPSaveDimension* pDim = GetDPDimension();
    2352 [ +  - ][ +  - ]:         12 :     return pDim ? pDim->GetSortInfo() : 0;
    2353                 :            : }
    2354                 :            : 
    2355                 :          4 : void ScDataPilotFieldObj::setSortInfo( const DataPilotFieldSortInfo* pInfo )
    2356                 :            : {
    2357         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2358                 :          4 :     ScDPObject* pDPObj = 0;
    2359 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2360                 :            :     {
    2361         [ +  - ]:          4 :         pDim->SetSortInfo( pInfo );
    2362         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2363         [ +  - ]:          4 :     }
    2364                 :          4 : }
    2365                 :            : 
    2366                 :          9 : sal_Bool ScDataPilotFieldObj::getShowEmpty() const
    2367                 :            : {
    2368         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    2369         [ +  - ]:          9 :     ScDPSaveDimension* pDim = GetDPDimension();
    2370 [ +  - ][ +  + ]:          9 :     return pDim && pDim->GetShowEmpty();
                 [ +  - ]
    2371                 :            : }
    2372                 :            : 
    2373                 :          4 : void ScDataPilotFieldObj::setShowEmpty( sal_Bool bShow )
    2374                 :            : {
    2375         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2376                 :          4 :     ScDPObject* pDPObj = 0;
    2377 [ +  - ][ +  - ]:          4 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2378                 :            :     {
    2379         [ +  - ]:          4 :         pDim->SetShowEmpty( bShow );
    2380         [ +  - ]:          4 :         SetDPObject( pDPObj );
    2381         [ +  - ]:          4 :     }
    2382                 :          4 : }
    2383                 :            : 
    2384                 :         14 : sal_Bool ScDataPilotFieldObj::hasGroupInfo()
    2385                 :            : {
    2386         [ +  - ]:         14 :     SolarMutexGuard aGuard;
    2387                 :         14 :     ScDPObject* pDPObj = 0;
    2388 [ +  - ][ +  - ]:         14 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2389         [ +  + ]:         14 :         if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
    2390 [ +  - ][ +  + ]:          6 :             return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
         [ +  - ][ -  + ]
    2391         [ +  - ]:         14 :     return false;
    2392                 :            : }
    2393                 :            : 
    2394                 :          3 : DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
    2395                 :            : {
    2396         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    2397         [ +  - ]:          3 :     DataPilotFieldGroupInfo aInfo;
    2398                 :          3 :     ScDPObject* pDPObj = 0;
    2399 [ +  - ][ +  - ]:          3 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2400                 :            :     {
    2401         [ +  - ]:          3 :         if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
    2402                 :            :         {
    2403 [ +  - ][ +  - ]:          3 :             if( const ScDPSaveGroupDimension* pGroupDim = pDimData->GetNamedGroupDim( pDim->GetName() ) )
    2404                 :            :             {
    2405                 :            :                 // grouped by ...
    2406                 :          3 :                 aInfo.GroupBy = pGroupDim->GetDatePart();
    2407                 :            : 
    2408                 :            :                 // find source field
    2409                 :            :                 try
    2410                 :            :                 {
    2411 [ +  - ][ +  - ]:          3 :                     Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW );
    2412 [ +  - ][ +  - ]:          3 :                     aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
         [ #  # ][ +  - ]
    2413                 :            :                 }
    2414         [ #  # ]:          0 :                 catch( Exception& )
    2415                 :            :                 {
    2416                 :            :                 }
    2417                 :            : 
    2418                 :          3 :                 ScDataPilotConversion::FillGroupInfo( aInfo, pGroupDim->GetDateInfo() );
    2419         [ +  - ]:          3 :                 if( pGroupDim->GetDatePart() == 0 )
    2420                 :            :                 {
    2421                 :            :                     // fill vector of group and group member information
    2422         [ +  - ]:          3 :                     ScFieldGroups aGroups;
    2423 [ +  - ][ +  + ]:          6 :                     for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx )
    2424                 :            :                     {
    2425 [ +  - ][ +  - ]:          3 :                         if( const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( nIdx ) )
    2426                 :            :                         {
    2427         [ +  - ]:          3 :                             ScFieldGroup aGroup;
    2428                 :          3 :                             aGroup.maName = pGroup->GetGroupName();
    2429 [ +  + ][ +  - ]:          9 :                             for( sal_Int32 nMemIdx = 0, nMemCount = pGroup->GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
    2430 [ +  - ][ +  - ]:          6 :                                 if (const rtl::OUString* pMem = pGroup->GetElementByIndex(nMemIdx))
    2431         [ +  - ]:          6 :                                     aGroup.maMembers.push_back( *pMem );
    2432         [ +  - ]:          3 :                             aGroups.push_back( aGroup );
    2433                 :            :                         }
    2434                 :            :                     }
    2435 [ +  - ][ +  - ]:          3 :                     aInfo.Groups = new ScDataPilotFieldGroupsObj( aGroups );
                 [ +  - ]
    2436                 :            :                 }
    2437                 :            :             }
    2438 [ #  # ][ #  # ]:          0 :             else if( const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim( pDim->GetName() ) )
    2439                 :            :             {
    2440         [ #  # ]:          0 :                 if (pNumGroupDim->GetDatePart())
    2441                 :            :                 {
    2442                 :          0 :                     ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetDateInfo() );
    2443                 :          0 :                     aInfo.GroupBy = pNumGroupDim->GetDatePart();
    2444                 :            :                 }
    2445                 :            :                 else
    2446                 :            :                 {
    2447                 :          0 :                     ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetInfo() );
    2448                 :            :                 }
    2449                 :            :             }
    2450                 :            :         }
    2451                 :            :     }
    2452         [ +  - ]:          3 :     return aInfo;
    2453                 :            : }
    2454                 :            : 
    2455                 :          0 : void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo )
    2456                 :            : {
    2457         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2458                 :          0 :     ScDPObject* pDPObj = 0;
    2459 [ #  # ][ #  # ]:          0 :     if( /*ScDPSaveDimension* pDim =*/ GetDPDimension( &pDPObj ) )
    2460                 :            :     {
    2461                 :          0 :         ScDPSaveData* pSaveData = pDPObj->GetSaveData();
    2462 [ #  # ][ #  # ]:          0 :         if( pInfo && lclCheckMinMaxStep( *pInfo ) )
                 [ #  # ]
    2463                 :            :         {
    2464         [ #  # ]:          0 :             ScDPNumGroupInfo aInfo;
    2465                 :          0 :             aInfo.mbEnable = sal_True;
    2466                 :          0 :             aInfo.mbDateValues = pInfo->HasDateValues;
    2467                 :          0 :             aInfo.mbAutoStart = pInfo->HasAutoStart;
    2468                 :          0 :             aInfo.mbAutoEnd = pInfo->HasAutoEnd;
    2469                 :          0 :             aInfo.mfStart = pInfo->Start;
    2470                 :          0 :             aInfo.mfEnd = pInfo->End;
    2471                 :          0 :             aInfo.mfStep = pInfo->Step;
    2472         [ #  # ]:          0 :             Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
    2473         [ #  # ]:          0 :             if( xNamed.is() )
    2474                 :            :             {
    2475 [ #  # ][ #  # ]:          0 :                 ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
         [ #  # ][ #  # ]
    2476         [ #  # ]:          0 :                 if( pInfo->GroupBy )
    2477         [ #  # ]:          0 :                     aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
    2478                 :            :                 else
    2479                 :            :                 {
    2480         [ #  # ]:          0 :                     Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
    2481         [ #  # ]:          0 :                     if (xIndex.is())
    2482                 :            :                     {
    2483 [ #  # ][ #  # ]:          0 :                         sal_Int32 nCount(xIndex->getCount());
    2484         [ #  # ]:          0 :                         for(sal_Int32 i = 0; i < nCount; i++)
    2485                 :            :                         {
    2486 [ #  # ][ #  # ]:          0 :                             Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
                 [ #  # ]
    2487         [ #  # ]:          0 :                             if (xGroupNamed.is())
    2488                 :            :                             {
    2489 [ #  # ][ #  # ]:          0 :                                 ScDPSaveGroupItem aItem(xGroupNamed->getName());
                 [ #  # ]
    2490         [ #  # ]:          0 :                                 Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
    2491         [ #  # ]:          0 :                                 if (xGroupIndex.is())
    2492                 :            :                                 {
    2493 [ #  # ][ #  # ]:          0 :                                     sal_Int32 nItemCount(xGroupIndex->getCount());
    2494         [ #  # ]:          0 :                                     for (sal_Int32 j = 0; j < nItemCount; ++j)
    2495                 :            :                                     {
    2496 [ #  # ][ #  # ]:          0 :                                         Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
                 [ #  # ]
    2497         [ #  # ]:          0 :                                         if (xItemNamed.is())
    2498 [ #  # ][ #  # ]:          0 :                                             aItem.AddElement(xItemNamed->getName());
                 [ #  # ]
    2499                 :          0 :                                     }
    2500                 :            :                                 }
    2501 [ #  # ][ #  # ]:          0 :                                 aGroupDim.AddGroupItem(aItem);
    2502                 :            :                             }
    2503                 :          0 :                         }
    2504                 :          0 :                     }
    2505                 :            :                 }
    2506                 :            : 
    2507                 :            :                 // get dimension savedata or create new if none
    2508         [ #  # ]:          0 :                 ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
    2509 [ #  # ][ #  # ]:          0 :                 rDimSaveData.ReplaceGroupDimension( aGroupDim );
    2510                 :            :             }
    2511                 :            :             else    // no source field in group info -> numeric group
    2512                 :            :             {
    2513         [ #  # ]:          0 :                 ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData();     // created if not there
    2514                 :            : 
    2515 [ #  # ][ #  # ]:          0 :                 ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
    2516         [ #  # ]:          0 :                 if ( pExisting )
    2517                 :            :                 {
    2518         [ #  # ]:          0 :                     if (pInfo->GroupBy)
    2519         [ #  # ]:          0 :                         pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
    2520                 :            :                     // modify existing group dimension
    2521         [ #  # ]:          0 :                     pExisting->SetGroupInfo( aInfo );
    2522                 :            :                 }
    2523         [ #  # ]:          0 :                 else if (pInfo->GroupBy)
    2524                 :            :                 {
    2525                 :            :                     // create new group dimension
    2526 [ #  # ][ #  # ]:          0 :                     ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
    2527 [ #  # ][ #  # ]:          0 :                     pDimData->AddNumGroupDimension( aNumGroupDim );
    2528                 :            :                 }
    2529                 :            :                 else
    2530                 :            :                 {
    2531                 :            :                     // create new group dimension
    2532 [ #  # ][ #  # ]:          0 :                     ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
    2533 [ #  # ][ #  # ]:          0 :                     pDimData->AddNumGroupDimension( aNumGroupDim );
    2534                 :            :                 }
    2535                 :          0 :             }
    2536                 :            :         }
    2537                 :            :         else    // null passed as argument
    2538                 :            :         {
    2539         [ #  # ]:          0 :             pSaveData->SetDimensionData( 0 );
    2540                 :            :         }
    2541                 :            : 
    2542         [ #  # ]:          0 :         pDPObj->SetSaveData( *pSaveData );
    2543         [ #  # ]:          0 :         SetDPObject( pDPObj );
    2544         [ #  # ]:          0 :     }
    2545                 :          0 : }
    2546                 :            : 
    2547                 :          0 : sal_Bool ScDataPilotFieldObj::HasString(const Sequence< OUString >& rItems, const OUString& aString)
    2548                 :            : {
    2549                 :          0 :     sal_Bool bRet = false;
    2550                 :            : 
    2551                 :          0 :     sal_Int32 nCount(rItems.getLength());
    2552                 :          0 :     sal_Int32 nItem(0);
    2553 [ #  # ][ #  # ]:          0 :     while (nItem < nCount && !bRet)
                 [ #  # ]
    2554                 :            :     {
    2555                 :          0 :         bRet = rItems[nItem] == aString;
    2556                 :          0 :         ++nItem;
    2557                 :            :     }
    2558                 :            : 
    2559                 :          0 :     return bRet;
    2560                 :            : }
    2561                 :            : 
    2562                 :            : // XDataPilotFieldGrouping
    2563                 :          5 : Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( const Sequence< OUString >& rItems )
    2564                 :            :          throw (RuntimeException, IllegalArgumentException)
    2565                 :            : {
    2566         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    2567                 :            : 
    2568                 :          5 :     Reference< XDataPilotField > xRet;
    2569                 :          5 :     OUString sNewDim;
    2570                 :            : 
    2571         [ -  + ]:          5 :     if( !rItems.hasElements() )
    2572         [ #  # ]:          0 :         throw IllegalArgumentException();
    2573                 :            : 
    2574                 :          5 :     ScDPObject* pDPObj = 0;
    2575 [ +  - ][ +  - ]:          5 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2576                 :            :     {
    2577                 :          5 :         rtl::OUString aDimName = pDim->GetName();
    2578                 :            : 
    2579         [ +  - ]:          5 :         ScDPSaveData aSaveData = *pDPObj->GetSaveData();
    2580         [ +  - ]:          5 :         ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData();     // created if not there
    2581                 :            : 
    2582                 :            :         // find original base
    2583                 :          5 :         rtl::OUString aBaseDimName( aDimName );
    2584         [ +  - ]:          5 :         const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
    2585         [ -  + ]:          5 :         if ( pBaseGroupDim )
    2586                 :            :         {
    2587                 :            :             // any entry's SourceDimName is the original base
    2588                 :          0 :             aBaseDimName = pBaseGroupDim->GetSourceDimName();
    2589                 :            :         }
    2590                 :            : 
    2591                 :            :         // find existing group dimension
    2592                 :            :         // (using the selected dim, can be intermediate group dim)
    2593         [ +  - ]:          5 :         ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName );
    2594                 :            : 
    2595                 :            :         // remove the selected items from their groups
    2596                 :            :         // (empty groups are removed, too)
    2597                 :          5 :         sal_Int32 nEntryCount = rItems.getLength();
    2598                 :            :         sal_Int32 nEntry;
    2599         [ -  + ]:          5 :         if ( pGroupDimension )
    2600                 :            :         {
    2601         [ #  # ]:          0 :             for (nEntry=0; nEntry<nEntryCount; nEntry++)
    2602                 :            :             {
    2603                 :          0 :                 const rtl::OUString& aEntryName = rItems[nEntry];
    2604         [ #  # ]:          0 :                 if ( pBaseGroupDim )
    2605                 :            :                 {
    2606                 :            :                     // for each selected (intermediate) group, remove all its items
    2607                 :            :                     // (same logic as for adding, below)
    2608         [ #  # ]:          0 :                     const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
    2609         [ #  # ]:          0 :                     if ( pBaseGroup )
    2610         [ #  # ]:          0 :                         pBaseGroup->RemoveElementsFromGroups( *pGroupDimension );   // remove all elements
    2611                 :            :                     else
    2612         [ #  # ]:          0 :                         pGroupDimension->RemoveFromGroups( aEntryName );
    2613                 :            :                 }
    2614                 :            :                 else
    2615         [ #  # ]:          0 :                     pGroupDimension->RemoveFromGroups( aEntryName );
    2616                 :            :             }
    2617                 :            :         }
    2618                 :            : 
    2619                 :          5 :         ScDPSaveGroupDimension* pNewGroupDim = 0;
    2620         [ +  - ]:          5 :         if ( !pGroupDimension )
    2621                 :            :         {
    2622                 :            :             // create a new group dimension
    2623         [ +  - ]:          5 :             sNewDim = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL );
    2624 [ +  - ][ +  - ]:          5 :             pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, sNewDim );
    2625                 :            : 
    2626                 :          5 :             pGroupDimension = pNewGroupDim;     // make changes to the new dim if none existed
    2627                 :            : 
    2628         [ -  + ]:          5 :             if ( pBaseGroupDim )
    2629                 :            :             {
    2630                 :            :                 // If it's a higher-order group dimension, pre-allocate groups for all
    2631                 :            :                 // non-selected original groups, so the individual base members aren't
    2632                 :            :                 // used for automatic groups (this would make the original groups hard
    2633                 :            :                 // to find).
    2634                 :            :                 //! Also do this when removing groups?
    2635                 :            :                 //! Handle this case dynamically with automatic groups?
    2636                 :            : 
    2637         [ #  # ]:          0 :                 long nGroupCount = pBaseGroupDim->GetGroupCount();
    2638         [ #  # ]:          0 :                 for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ )
    2639                 :            :                 {
    2640         [ #  # ]:          0 :                     const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
    2641                 :            : 
    2642 [ #  # ][ #  # ]:          0 :                     if (!HasString(rItems, pBaseGroup->GetGroupName()))    //! ignore case?
    2643                 :            :                     {
    2644                 :            :                         // add an additional group for each item that is not in the selection
    2645         [ #  # ]:          0 :                         ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() );
    2646         [ #  # ]:          0 :                         aGroup.AddElementsFromGroup( *pBaseGroup );
    2647 [ #  # ][ #  # ]:          0 :                         pGroupDimension->AddGroupItem( aGroup );
    2648                 :            :                     }
    2649                 :            :                 }
    2650                 :            :             }
    2651                 :            :         }
    2652                 :          5 :         rtl::OUString aGroupDimName = pGroupDimension->GetGroupDimName();
    2653                 :            : 
    2654                 :            :         //! localized prefix string
    2655 [ +  - ][ +  - ]:          5 :         rtl::OUString aGroupName = pGroupDimension->CreateGroupName( String( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) );
         [ +  - ][ +  - ]
    2656         [ +  - ]:          5 :         ScDPSaveGroupItem aGroup( aGroupName );
    2657         [ +  - ]:          5 :         Reference< XNameAccess > xMembers = GetMembers();
    2658         [ -  + ]:          5 :         if (!xMembers.is())
    2659                 :            :         {
    2660 [ #  # ][ #  # ]:          0 :             delete pNewGroupDim;
    2661         [ #  # ]:          0 :             throw RuntimeException();
    2662                 :            :         }
    2663                 :            : 
    2664         [ +  + ]:         21 :         for (nEntry=0; nEntry<nEntryCount; nEntry++)
    2665                 :            :         {
    2666         [ +  - ]:         16 :             String aEntryName(rItems[nEntry]);
    2667                 :            : 
    2668 [ +  - ][ +  - ]:         16 :             if (!xMembers->hasByName(aEntryName))
         [ +  - ][ -  + ]
    2669                 :            :             {
    2670 [ #  # ][ #  # ]:          0 :                 delete pNewGroupDim;
    2671         [ #  # ]:          0 :                 throw IllegalArgumentException();
    2672                 :            :             }
    2673                 :            : 
    2674         [ -  + ]:         16 :             if ( pBaseGroupDim )
    2675                 :            :             {
    2676                 :            :                 // for each selected (intermediate) group, add all its items
    2677 [ #  # ][ #  # ]:          0 :                 const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
    2678         [ #  # ]:          0 :                 if ( pBaseGroup )
    2679         [ #  # ]:          0 :                     aGroup.AddElementsFromGroup( *pBaseGroup );
    2680                 :            :                 else
    2681 [ #  # ][ #  # ]:          0 :                     aGroup.AddElement( aEntryName );    // no group found -> automatic group, add the item itself
    2682                 :            :             }
    2683                 :            :             else
    2684 [ +  - ][ +  - ]:         16 :                 aGroup.AddElement( aEntryName );        // no group dimension, add all items directly
    2685         [ +  - ]:         16 :         }
    2686                 :            : 
    2687         [ +  - ]:          5 :         pGroupDimension->AddGroupItem( aGroup );
    2688                 :            : 
    2689         [ +  - ]:          5 :         if ( pNewGroupDim )
    2690                 :            :         {
    2691         [ +  - ]:          5 :             pDimData->AddGroupDimension( *pNewGroupDim );
    2692 [ +  - ][ +  - ]:          5 :             delete pNewGroupDim;        // AddGroupDimension copies the object
    2693                 :            :             // don't access pGroupDimension after here
    2694                 :            :         }
    2695                 :          5 :         pGroupDimension = pNewGroupDim = NULL;
    2696                 :            : 
    2697                 :            :         // set orientation
    2698         [ +  - ]:          5 :         ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );
    2699         [ +  - ]:          5 :         if ( pSaveDimension->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
    2700                 :            :         {
    2701         [ +  - ]:          5 :             ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName );
    2702         [ +  - ]:          5 :             pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
    2703                 :          5 :             long nPosition = 0;     //! before (immediate) base
    2704         [ +  - ]:          5 :             aSaveData.SetPosition( pSaveDimension, nPosition );
    2705                 :            :         }
    2706                 :            : 
    2707                 :            :         // apply changes
    2708         [ +  - ]:          5 :         pDPObj->SetSaveData( aSaveData );
    2709 [ +  - ][ +  - ]:          5 :         ScDBDocFunc(*GetDocShell()).RefreshPivotTableGroups(pDPObj);
                 [ +  - ]
    2710                 :            :     }
    2711                 :            : 
    2712                 :            :     // if new grouping field has been created (on first group), return it
    2713         [ +  - ]:          5 :     if( !sNewDim.isEmpty() )
    2714                 :            :     {
    2715 [ +  - ][ +  - ]:          5 :         Reference< XNameAccess > xFields(mrParent.getDataPilotFields(), UNO_QUERY);
    2716         [ +  - ]:          5 :         if (xFields.is())
    2717                 :            :         {
    2718 [ +  - ][ +  - ]:          5 :             xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
                 [ +  - ]
    2719                 :            :             OSL_ENSURE(xRet.is(), "there is a name, so there should be also a field");
    2720                 :          5 :         }
    2721                 :            :     }
    2722         [ +  - ]:          5 :     return xRet;
    2723                 :            : }
    2724                 :            : 
    2725                 :          0 : Reference < XDataPilotField > SAL_CALL ScDataPilotFieldObj::createDateGroup( const DataPilotFieldGroupInfo& rInfo )
    2726                 :            :         throw (RuntimeException, IllegalArgumentException)
    2727                 :            : {
    2728         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2729                 :            :     using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
    2730                 :            : 
    2731                 :            :     // check min/max/step, HasDateValues must be set always
    2732 [ #  # ][ #  # ]:          0 :     if( !rInfo.HasDateValues || !lclCheckMinMaxStep( rInfo ) )
                 [ #  # ]
    2733         [ #  # ]:          0 :         throw IllegalArgumentException();
    2734                 :            :     // only a single date flag is allowed
    2735 [ #  # ][ #  # ]:          0 :     if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
                 [ #  # ]
    2736         [ #  # ]:          0 :         throw IllegalArgumentException();
    2737                 :            :     // step must be zero, if something else than DAYS is specified
    2738 [ #  # ][ #  # ]:          0 :     if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
    2739         [ #  # ]:          0 :         throw IllegalArgumentException();
    2740                 :            : 
    2741         [ #  # ]:          0 :     String aGroupDimName;
    2742                 :          0 :     ScDPObject* pDPObj = 0;
    2743 [ #  # ][ #  # ]:          0 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    2744                 :            :     {
    2745         [ #  # ]:          0 :         ScDPNumGroupInfo aInfo;
    2746                 :          0 :         aInfo.mbEnable = true;
    2747 [ #  # ][ #  # ]:          0 :         aInfo.mbDateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
    2748                 :          0 :         aInfo.mbAutoStart = rInfo.HasAutoStart;
    2749                 :          0 :         aInfo.mbAutoEnd = rInfo.HasAutoEnd;
    2750                 :          0 :         aInfo.mfStart = rInfo.Start;
    2751                 :          0 :         aInfo.mfEnd = rInfo.End;
    2752                 :          0 :         aInfo.mfStep = static_cast< sal_Int32 >( rInfo.Step );
    2753                 :            : 
    2754                 :            :         // create a local copy of the entire save data (will be written back below)
    2755         [ #  # ]:          0 :         ScDPSaveData aSaveData = *pDPObj->GetSaveData();
    2756                 :            :         // get or create dimension save data
    2757         [ #  # ]:          0 :         ScDPDimensionSaveData& rDimData = *aSaveData.GetDimensionData();
    2758                 :            : 
    2759                 :            :         // find source dimension name
    2760                 :          0 :         const rtl::OUString& rDimName = pDim->GetName();
    2761         [ #  # ]:          0 :         const ScDPSaveGroupDimension* pGroupDim = rDimData.GetNamedGroupDim( rDimName );
    2762         [ #  # ]:          0 :         rtl::OUString aSrcDimName = pGroupDim ? pGroupDim->GetSourceDimName() : rDimName;
    2763                 :            : 
    2764                 :            :         // find a group dimension for the base field, or get numeric grouping
    2765         [ #  # ]:          0 :         pGroupDim = rDimData.GetFirstNamedGroupDim( aSrcDimName );
    2766         [ #  # ]:          0 :         const ScDPSaveNumGroupDimension* pNumGroupDim = rDimData.GetNumGroupDim( aSrcDimName );
    2767                 :            : 
    2768                 :            :         // do not group by dates, if named groups or numeric grouping is present
    2769 [ #  # ][ #  # ]:          0 :         bool bHasNamedGrouping = pGroupDim && !pGroupDim->GetDateInfo().mbEnable;
    2770 [ #  # ][ #  # ]:          0 :         bool bHasNumGrouping = pNumGroupDim && pNumGroupDim->GetInfo().mbEnable && !pNumGroupDim->GetInfo().mbDateValues && !pNumGroupDim->GetDateInfo().mbEnable;
         [ #  # ][ #  # ]
    2771 [ #  # ][ #  # ]:          0 :         if( bHasNamedGrouping || bHasNumGrouping )
    2772         [ #  # ]:          0 :             throw IllegalArgumentException();
    2773                 :            : 
    2774         [ #  # ]:          0 :         if( aInfo.mbDateValues )  // create day ranges grouping
    2775                 :            :         {
    2776                 :            :             // first remove all named group dimensions
    2777         [ #  # ]:          0 :             while( pGroupDim )
    2778                 :            :             {
    2779         [ #  # ]:          0 :                 String aGroupDimName2 = pGroupDim->GetGroupDimName();
    2780                 :            :                 // find next group dimension before deleting this group
    2781 [ #  # ][ #  # ]:          0 :                 pGroupDim = rDimData.GetNextNamedGroupDim( aGroupDimName2 );
    2782                 :            :                 // remove from dimension save data
    2783 [ #  # ][ #  # ]:          0 :                 rDimData.RemoveGroupDimension( aGroupDimName2 );
    2784                 :            :                 // also remove save data settings for the dimension that no longer exists
    2785 [ #  # ][ #  # ]:          0 :                 aSaveData.RemoveDimensionByName( aGroupDimName2 );
    2786         [ #  # ]:          0 :             }
    2787                 :            :             // create or replace the number grouping dimension
    2788         [ #  # ]:          0 :             ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo );
    2789 [ #  # ][ #  # ]:          0 :             rDimData.ReplaceNumGroupDimension( aNumGroupDim );
    2790                 :            :         }
    2791                 :            :         else    // create date grouping
    2792                 :            :         {
    2793                 :            :             // collect all existing date flags
    2794         [ #  # ]:          0 :             sal_Int32 nDateParts = rDimData.CollectDateParts( aSrcDimName );
    2795         [ #  # ]:          0 :             if( nDateParts == 0 )
    2796                 :            :             {
    2797                 :            :                 // insert numeric group dimension, if no date groups exist yet (or replace day range grouping)
    2798         [ #  # ]:          0 :                 ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo, rInfo.GroupBy );
    2799 [ #  # ][ #  # ]:          0 :                 rDimData.ReplaceNumGroupDimension( aNumGroupDim );
    2800                 :            :             }
    2801         [ #  # ]:          0 :             else if( (nDateParts & rInfo.GroupBy) == 0 )    // do nothing if date field exists already
    2802                 :            :             {
    2803                 :            :                 // create new named group dimension for additional date groups
    2804 [ #  # ][ #  # ]:          0 :                 aGroupDimName = rDimData.CreateDateGroupDimName( rInfo.GroupBy, *pDPObj, true, 0 );
    2805 [ #  # ][ #  # ]:          0 :                 ScDPSaveGroupDimension aGroupDim( aSrcDimName, aGroupDimName, aInfo, rInfo.GroupBy );
    2806         [ #  # ]:          0 :                 rDimData.AddGroupDimension( aGroupDim );
    2807                 :            : 
    2808                 :            :                 // set orientation of new named group dimension
    2809 [ #  # ][ #  # ]:          0 :                 ScDPSaveDimension& rSaveDim = *aSaveData.GetDimensionByName( aGroupDimName );
    2810         [ #  # ]:          0 :                 if( rSaveDim.GetOrientation() == DataPilotFieldOrientation_HIDDEN )
    2811                 :            :                 {
    2812         [ #  # ]:          0 :                     ScDPSaveDimension& rOldDim = *aSaveData.GetDimensionByName( aSrcDimName );
    2813         [ #  # ]:          0 :                     rSaveDim.SetOrientation( rOldDim.GetOrientation() );
    2814         [ #  # ]:          0 :                     aSaveData.SetPosition( &rSaveDim, 0 );  //! before (immediate) base
    2815         [ #  # ]:          0 :                 }
    2816                 :            :             }
    2817                 :            :         }
    2818                 :            : 
    2819                 :            :         // apply changes
    2820         [ #  # ]:          0 :         pDPObj->SetSaveData( aSaveData );
    2821 [ #  # ][ #  # ]:          0 :         SetDPObject( pDPObj );
    2822                 :            :     }
    2823                 :            : 
    2824                 :            :     // return the UNO object of the new dimension, after writing back saved data
    2825                 :          0 :     Reference< XDataPilotField > xRet;
    2826         [ #  # ]:          0 :     if( aGroupDimName.Len() > 0 ) try
    2827                 :            :     {
    2828 [ #  # ][ #  # ]:          0 :         Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW );
    2829 [ #  # ][ #  # ]:          0 :         xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
    2830                 :            :     }
    2831         [ #  # ]:          0 :     catch( Exception& )
    2832                 :            :     {
    2833                 :            :     }
    2834 [ #  # ][ #  # ]:          0 :     return xRet;
    2835                 :            : }
    2836                 :            : 
    2837                 :            : // ============================================================================
    2838                 :            : 
    2839                 :            : namespace {
    2840                 :            : 
    2841                 :          0 : bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement )
    2842                 :            : {
    2843                 :            :     // allow empty value to create a new group
    2844         [ #  # ]:          0 :     if( !rElement.hasValue() )
    2845                 :          0 :         return true;
    2846                 :            : 
    2847                 :            :     // try to extract a simple sequence of strings
    2848         [ #  # ]:          0 :     Sequence< OUString > aSeq;
    2849 [ #  # ][ #  # ]:          0 :     if( rElement >>= aSeq )
    2850                 :            :     {
    2851         [ #  # ]:          0 :         if( aSeq.hasElements() )
    2852         [ #  # ]:          0 :             rMembers.insert( rMembers.end(), aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength() );
    2853                 :          0 :         return true;
    2854                 :            :     }
    2855                 :            : 
    2856                 :            :     // try to use XIndexAccess providing objects that support XNamed
    2857         [ #  # ]:          0 :     Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
    2858         [ #  # ]:          0 :     if( xItemsIA.is() )
    2859                 :            :     {
    2860 [ #  # ][ #  # ]:          0 :         for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx < nCount; ++nIdx )
                 [ #  # ]
    2861                 :            :         {
    2862                 :            :             try // getByIndex() should not throw, but we cannot be sure
    2863                 :            :             {
    2864 [ #  # ][ #  # ]:          0 :                 Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
                 [ #  # ]
    2865 [ #  # ][ #  # ]:          0 :                 rMembers.push_back( xItemName->getName() );
         [ #  # ][ #  # ]
    2866                 :            :             }
    2867         [ #  # ]:          0 :             catch( Exception& )
    2868                 :            :             {
    2869                 :            :                 // ignore exceptions, go ahead with next element in the array
    2870                 :            :             }
    2871                 :            :         }
    2872                 :          0 :         return true;
    2873                 :            :     }
    2874                 :            : 
    2875                 :            :     // nothing valid inside the Any -> return false
    2876         [ #  # ]:          0 :     return false;
    2877                 :            : }
    2878                 :            : 
    2879                 :            : } // namespace
    2880                 :            : 
    2881                 :            : // ----------------------------------------------------------------------------
    2882                 :            : 
    2883                 :          3 : ScDataPilotFieldGroupsObj::ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups ) :
    2884         [ +  - ]:          3 :     maGroups( rGroups )
    2885                 :            : {
    2886                 :          3 : }
    2887                 :            : 
    2888                 :          3 : ScDataPilotFieldGroupsObj::~ScDataPilotFieldGroupsObj()
    2889                 :            : {
    2890         [ -  + ]:          6 : }
    2891                 :            : 
    2892                 :            : // XNameAccess
    2893                 :            : 
    2894                 :          2 : Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const OUString& rName )
    2895                 :            :         throw(NoSuchElementException, WrappedTargetException, RuntimeException)
    2896                 :            : {
    2897         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2898 [ +  - ][ +  - ]:          2 :     if( implFindByName( rName ) == maGroups.end() )
                 [ +  + ]
    2899         [ +  - ]:          1 :         throw NoSuchElementException();
    2900 [ +  - ][ +  - ]:          2 :     return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, rName ) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    2901                 :            : }
    2902                 :            : 
    2903                 :          1 : Sequence< OUString > SAL_CALL ScDataPilotFieldGroupsObj::getElementNames() throw(RuntimeException)
    2904                 :            : {
    2905         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    2906         [ +  - ]:          1 :     Sequence< OUString > aSeq;
    2907         [ +  - ]:          1 :     if( !maGroups.empty() )
    2908                 :            :     {
    2909         [ +  - ]:          1 :         aSeq.realloc( static_cast< sal_Int32 >( maGroups.size() ) );
    2910         [ +  - ]:          1 :         OUString* pName = aSeq.getArray();
    2911 [ +  - ][ +  + ]:          2 :         for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt, ++pName )
    2912                 :          1 :             *pName = aIt->maName;
    2913                 :            :     }
    2914         [ +  - ]:          1 :     return aSeq;
    2915                 :            : }
    2916                 :            : 
    2917                 :          2 : sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const OUString& rName ) throw(RuntimeException)
    2918                 :            : {
    2919         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2920 [ +  - ][ +  - ]:          2 :     return implFindByName( rName ) != maGroups.end();
                 [ +  - ]
    2921                 :            : }
    2922                 :            : 
    2923                 :            : // XNameReplace
    2924                 :            : 
    2925                 :          0 : void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const OUString& rName, const Any& rElement )
    2926                 :            :         throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
    2927                 :            : {
    2928         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2929                 :            : 
    2930         [ #  # ]:          0 :     if( rName.isEmpty() )
    2931         [ #  # ]:          0 :         throw IllegalArgumentException();
    2932                 :            : 
    2933         [ #  # ]:          0 :     ScFieldGroups::iterator aIt = implFindByName( rName );
    2934 [ #  # ][ #  # ]:          0 :     if( aIt == maGroups.end() )
    2935         [ #  # ]:          0 :         throw NoSuchElementException();
    2936                 :            : 
    2937                 :            :     // read all item names provided by the passed object
    2938         [ #  # ]:          0 :     ScFieldGroupMembers aMembers;
    2939 [ #  # ][ #  # ]:          0 :     if( !lclExtractGroupMembers( aMembers, rElement ) )
    2940         [ #  # ]:          0 :         throw IllegalArgumentException();
    2941                 :            : 
    2942                 :            :     // copy and forget, faster than vector assignment
    2943         [ #  # ]:          0 :     aIt->maMembers.swap( aMembers );
    2944                 :          0 : }
    2945                 :            : 
    2946                 :            : // XNameContainer
    2947                 :            : 
    2948                 :          0 : void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const OUString& rName, const Any& rElement )
    2949                 :            :         throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
    2950                 :            : {
    2951         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2952                 :            : 
    2953         [ #  # ]:          0 :     if( rName.isEmpty() )
    2954         [ #  # ]:          0 :         throw IllegalArgumentException();
    2955                 :            : 
    2956         [ #  # ]:          0 :     ScFieldGroups::iterator aIt = implFindByName( rName );
    2957 [ #  # ][ #  # ]:          0 :     if( aIt != maGroups.end() )
    2958         [ #  # ]:          0 :         throw ElementExistException();
    2959                 :            : 
    2960                 :            :     // read all item names provided by the passed object
    2961         [ #  # ]:          0 :     ScFieldGroupMembers aMembers;
    2962 [ #  # ][ #  # ]:          0 :     if( !lclExtractGroupMembers( aMembers, rElement ) )
    2963         [ #  # ]:          0 :         throw IllegalArgumentException();
    2964                 :            : 
    2965                 :            :     // create the new entry if no error has been occurred
    2966         [ #  # ]:          0 :     maGroups.resize( maGroups.size() + 1 );
    2967         [ #  # ]:          0 :     ScFieldGroup& rGroup = maGroups.back();
    2968                 :          0 :     rGroup.maName = rName;
    2969         [ #  # ]:          0 :     rGroup.maMembers.swap( aMembers );
    2970                 :          0 : }
    2971                 :            : 
    2972                 :          0 : void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const OUString& rName )
    2973                 :            :         throw (NoSuchElementException, WrappedTargetException, RuntimeException)
    2974                 :            : {
    2975         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2976                 :            : 
    2977         [ #  # ]:          0 :     if( rName.isEmpty() )
    2978         [ #  # ]:          0 :         throw IllegalArgumentException();
    2979                 :            : 
    2980         [ #  # ]:          0 :     ScFieldGroups::iterator aIt = implFindByName( rName );
    2981 [ #  # ][ #  # ]:          0 :     if( aIt == maGroups.end() )
    2982         [ #  # ]:          0 :         throw NoSuchElementException();
    2983                 :            : 
    2984 [ #  # ][ #  # ]:          0 :     maGroups.erase( aIt );
    2985                 :          0 : }
    2986                 :            : 
    2987                 :            : // XIndexAccess
    2988                 :            : 
    2989                 :          1 : sal_Int32 SAL_CALL ScDataPilotFieldGroupsObj::getCount() throw(RuntimeException)
    2990                 :            : {
    2991         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    2992         [ +  - ]:          1 :     return static_cast< sal_Int32 >( maGroups.size() );
    2993                 :            : }
    2994                 :            : 
    2995                 :          6 : Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex )
    2996                 :            :         throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
    2997                 :            : {
    2998         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2999 [ +  - ][ +  + ]:          6 :     if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( maGroups.size() )))
                 [ +  + ]
    3000         [ +  - ]:          1 :         throw IndexOutOfBoundsException();
    3001 [ +  - ][ +  - ]:          6 :     return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, maGroups[ nIndex ].maName ) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    3002                 :            : }
    3003                 :            : 
    3004                 :            : // XEnumerationAccess
    3005                 :            : 
    3006                 :          1 : Reference<XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration() throw(RuntimeException)
    3007                 :            : {
    3008         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3009 [ +  - ][ +  - ]:          1 :     return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupsEnumeration" ) ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3010                 :            : }
    3011                 :            : 
    3012                 :            : // XElementAccess
    3013                 :            : 
    3014                 :          1 : uno::Type SAL_CALL ScDataPilotFieldGroupsObj::getElementType() throw(RuntimeException)
    3015                 :            : {
    3016         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3017 [ +  - ][ +  - ]:          1 :     return getCppuType( (Reference< XNameAccess >*)0 );
    3018                 :            : }
    3019                 :            : 
    3020                 :          1 : sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasElements() throw(RuntimeException)
    3021                 :            : {
    3022         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3023         [ +  - ]:          1 :     return !maGroups.empty();
    3024                 :            : }
    3025                 :            : 
    3026                 :            : // implementation
    3027                 :            : 
    3028                 :          9 : ScFieldGroup& ScDataPilotFieldGroupsObj::getFieldGroup( const OUString& rName ) throw(RuntimeException)
    3029                 :            : {
    3030         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    3031         [ +  - ]:          9 :     ScFieldGroups::iterator aIt = implFindByName( rName );
    3032 [ +  - ][ -  + ]:          9 :     if( aIt == maGroups.end() )
    3033         [ #  # ]:          0 :         throw RuntimeException();
    3034         [ +  - ]:          9 :      return *aIt;
    3035                 :            : }
    3036                 :            : 
    3037                 :          2 : void ScDataPilotFieldGroupsObj::renameFieldGroup( const OUString& rOldName, const OUString& rNewName ) throw(RuntimeException)
    3038                 :            : {
    3039         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3040         [ +  - ]:          2 :     ScFieldGroups::iterator aOldIt = implFindByName( rOldName );
    3041         [ +  - ]:          2 :     ScFieldGroups::iterator aNewIt = implFindByName( rNewName );
    3042                 :            :     // new name must not exist yet
    3043 [ +  - ][ +  - ]:          2 :     if( (aOldIt == maGroups.end()) || ((aNewIt != maGroups.end()) && (aNewIt != aOldIt)) )
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ +  - ][ +  - ]
           [ -  +  #  #  
                   #  # ]
    3044         [ #  # ]:          0 :         throw RuntimeException();
    3045         [ +  - ]:          2 :     aOldIt->maName = rNewName;
    3046                 :          2 : }
    3047                 :            : 
    3048                 :         17 : ScFieldGroups::iterator ScDataPilotFieldGroupsObj::implFindByName( const OUString& rName )
    3049                 :            : {
    3050 [ +  - ][ +  + ]:         21 :     for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt )
    3051         [ +  + ]:         17 :         if( aIt->maName == rName )
    3052                 :         13 :             return aIt;
    3053                 :         17 :     return maGroups.end();
    3054                 :            : }
    3055                 :            : 
    3056                 :            : // ============================================================================
    3057                 :            : 
    3058                 :            : namespace {
    3059                 :            : 
    3060                 :          2 : OUString lclExtractMember( const Any& rElement )
    3061                 :            : {
    3062 [ +  - ][ +  - ]:          2 :     if( rElement.has< OUString >() )
    3063         [ +  - ]:          2 :         return rElement.get< OUString >();
    3064                 :            : 
    3065         [ #  # ]:          0 :     Reference< XNamed > xNamed( rElement, UNO_QUERY );
    3066         [ #  # ]:          0 :     if( xNamed.is() )
    3067 [ #  # ][ #  # ]:          0 :         return xNamed->getName();
    3068                 :            : 
    3069                 :          2 :     return OUString();
    3070                 :            : }
    3071                 :            : 
    3072                 :            : } // namespace
    3073                 :            : 
    3074                 :            : // ----------------------------------------------------------------------------
    3075                 :            : 
    3076                 :          6 : ScDataPilotFieldGroupObj::ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName ) :
    3077                 :            :     mrParent( rParent ),
    3078                 :          6 :     maGroupName( rGroupName )
    3079                 :            : {
    3080                 :          6 :     mrParent.acquire();
    3081                 :          6 : }
    3082                 :            : 
    3083                 :          6 : ScDataPilotFieldGroupObj::~ScDataPilotFieldGroupObj()
    3084                 :            : {
    3085                 :          6 :     mrParent.release();
    3086         [ -  + ]:         12 : }
    3087                 :            : 
    3088                 :            : // XNameAccess
    3089                 :            : 
    3090                 :          1 : Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const OUString& rName )
    3091                 :            :         throw(NoSuchElementException, WrappedTargetException, RuntimeException)
    3092                 :            : {
    3093         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3094         [ +  - ]:          1 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3095         [ +  - ]:          1 :     ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
    3096 [ +  - ][ -  + ]:          1 :     if( aIt == rMembers.end() )
    3097         [ #  # ]:          0 :         throw NoSuchElementException();
    3098 [ +  - ][ +  - ]:          1 :     return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, *aIt ) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    3099                 :            : }
    3100                 :            : 
    3101                 :          0 : Sequence< OUString > SAL_CALL ScDataPilotFieldGroupObj::getElementNames() throw(RuntimeException)
    3102                 :            : {
    3103         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    3104 [ #  # ][ #  # ]:          0 :     return ::comphelper::containerToSequence( mrParent.getFieldGroup( maGroupName ).maMembers );
                 [ #  # ]
    3105                 :            : }
    3106                 :            : 
    3107                 :          0 : sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const OUString& rName ) throw(RuntimeException)
    3108                 :            : {
    3109         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    3110         [ #  # ]:          0 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3111 [ #  # ][ #  # ]:          0 :     return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
                 [ #  # ]
    3112                 :            : }
    3113                 :            : 
    3114                 :            : // XNameReplace
    3115                 :            : 
    3116                 :          2 : void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const OUString& rName, const Any& rElement )
    3117                 :            :         throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
    3118                 :            : {
    3119         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3120                 :            : 
    3121                 :            :     // it should be possible to quickly rename an item -> accept string or XNamed
    3122         [ +  - ]:          2 :     OUString aNewName = lclExtractMember( rElement );
    3123 [ +  - ][ -  + ]:          2 :     if( rName.isEmpty() || aNewName.isEmpty() )
                 [ -  + ]
    3124         [ #  # ]:          0 :         throw IllegalArgumentException();
    3125         [ -  + ]:          2 :     if( rName == aNewName )
    3126                 :          2 :         return;
    3127                 :            : 
    3128         [ +  - ]:          2 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3129         [ +  - ]:          2 :     ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
    3130         [ +  - ]:          2 :     ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
    3131                 :            :     // throw if passed member name does not exist
    3132 [ +  - ][ -  + ]:          2 :     if( aOldIt == rMembers.end() )
    3133         [ #  # ]:          0 :         throw NoSuchElementException();
    3134                 :            :     // throw if new name already exists
    3135 [ +  - ][ -  + ]:          2 :     if( aNewIt != rMembers.end() )
    3136         [ #  # ]:          0 :         throw IllegalArgumentException();
    3137 [ -  + ][ +  - ]:          2 :     *aOldIt = aNewName;
                 [ +  - ]
    3138                 :            : }
    3139                 :            : 
    3140                 :            : // XNameContainer
    3141                 :            : 
    3142                 :          0 : void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const OUString& rName, const Any& /*rElement*/ )
    3143                 :            :         throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
    3144                 :            : {
    3145         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    3146                 :            : 
    3147                 :            :     // we will ignore the passed element and just try to insert the name
    3148         [ #  # ]:          0 :     if( rName.isEmpty() )
    3149         [ #  # ]:          0 :         throw IllegalArgumentException();
    3150                 :            : 
    3151         [ #  # ]:          0 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3152         [ #  # ]:          0 :     ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
    3153                 :            :     // throw if passed name already exists
    3154 [ #  # ][ #  # ]:          0 :     if( aIt != rMembers.end() )
    3155         [ #  # ]:          0 :         throw IllegalArgumentException();
    3156 [ #  # ][ #  # ]:          0 :     rMembers.push_back( rName );
    3157                 :          0 : }
    3158                 :            : 
    3159                 :          0 : void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const OUString& rName )
    3160                 :            :         throw (NoSuchElementException, WrappedTargetException, RuntimeException)
    3161                 :            : {
    3162         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    3163                 :            : 
    3164         [ #  # ]:          0 :     if( rName.isEmpty() )
    3165         [ #  # ]:          0 :         throw IllegalArgumentException();
    3166         [ #  # ]:          0 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3167         [ #  # ]:          0 :     ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
    3168                 :            :     // throw if passed name does not exist
    3169 [ #  # ][ #  # ]:          0 :     if( aIt == rMembers.end() )
    3170         [ #  # ]:          0 :         throw NoSuchElementException();
    3171 [ #  # ][ #  # ]:          0 :     rMembers.erase( aIt );
    3172                 :          0 : }
    3173                 :            : 
    3174                 :            : // XIndexAccess
    3175                 :            : 
    3176                 :          1 : sal_Int32 SAL_CALL ScDataPilotFieldGroupObj::getCount() throw(RuntimeException)
    3177                 :            : {
    3178         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3179 [ +  - ][ +  - ]:          1 :     return static_cast< sal_Int32 >( mrParent.getFieldGroup( maGroupName ).maMembers.size() );
    3180                 :            : }
    3181                 :            : 
    3182                 :          4 : Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex )
    3183                 :            :         throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
    3184                 :            : {
    3185         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3186         [ +  - ]:          4 :     ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
    3187 [ +  - ][ +  + ]:          4 :     if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( rMembers.size() )))
                 [ +  + ]
    3188         [ +  - ]:          1 :         throw IndexOutOfBoundsException();
    3189 [ +  - ][ +  - ]:          4 :     return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, rMembers[ nIndex ] ) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    3190                 :            : }
    3191                 :            : 
    3192                 :            : // XEnumerationAccess
    3193                 :            : 
    3194                 :          1 : Reference< XEnumeration > SAL_CALL ScDataPilotFieldGroupObj::createEnumeration() throw(RuntimeException)
    3195                 :            : {
    3196         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3197 [ +  - ][ +  - ]:          1 :     return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupEnumeration" ) ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3198                 :            : }
    3199                 :            : 
    3200                 :            : // XElementAccess
    3201                 :            : 
    3202                 :          1 : uno::Type SAL_CALL ScDataPilotFieldGroupObj::getElementType() throw(RuntimeException)
    3203                 :            : {
    3204         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3205 [ +  - ][ +  - ]:          1 :     return getCppuType( (Reference< XNamed >*)0 );
    3206                 :            : }
    3207                 :            : 
    3208                 :          1 : sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasElements() throw(RuntimeException)
    3209                 :            : {
    3210         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3211 [ +  - ][ +  - ]:          1 :     return !mrParent.getFieldGroup( maGroupName ).maMembers.empty();
    3212                 :            : }
    3213                 :            : 
    3214                 :            : // XNamed
    3215                 :            : 
    3216                 :          3 : OUString SAL_CALL ScDataPilotFieldGroupObj::getName() throw(RuntimeException)
    3217                 :            : {
    3218         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3219         [ +  - ]:          3 :     return maGroupName;
    3220                 :            : }
    3221                 :            : 
    3222                 :          2 : void SAL_CALL ScDataPilotFieldGroupObj::setName( const OUString& rName ) throw(RuntimeException)
    3223                 :            : {
    3224         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3225         [ +  - ]:          2 :     mrParent.renameFieldGroup( maGroupName, rName );
    3226                 :            :     // if call to renameFieldGroup() did not throw, remember the new name
    3227         [ +  - ]:          2 :     maGroupName = rName;
    3228                 :          2 : }
    3229                 :            : 
    3230                 :            : // ============================================================================
    3231                 :            : 
    3232                 :          4 : ScDataPilotFieldGroupItemObj::ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName ) :
    3233                 :            :     mrParent( rParent ),
    3234                 :          4 :     maName( rName )
    3235                 :            : {
    3236                 :          4 :     mrParent.acquire();
    3237                 :          4 : }
    3238                 :            : 
    3239                 :          4 : ScDataPilotFieldGroupItemObj::~ScDataPilotFieldGroupItemObj()
    3240                 :            : {
    3241                 :          4 :     mrParent.release();
    3242         [ -  + ]:          8 : }
    3243                 :            : 
    3244                 :            : // XNamed
    3245                 :            : 
    3246                 :          3 : OUString SAL_CALL ScDataPilotFieldGroupItemObj::getName() throw(RuntimeException)
    3247                 :            : {
    3248         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3249         [ +  - ]:          3 :     return maName;
    3250                 :            : }
    3251                 :            : 
    3252                 :          2 : void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const OUString& rName ) throw(RuntimeException)
    3253                 :            : {
    3254         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3255 [ +  - ][ +  - ]:          2 :     mrParent.replaceByName( maName, Any( rName ) );
    3256                 :            :     // if call to replaceByName() did not throw, remember the new name
    3257         [ +  - ]:          2 :     maName = rName;
    3258                 :          2 : }
    3259                 :            : 
    3260                 :            : // ============================================================================
    3261                 :            : 
    3262                 :          6 : ScDataPilotItemsObj::ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
    3263         [ +  - ]:          6 :     ScDataPilotChildObjBase( rParent, rFieldId )
    3264                 :            : {
    3265                 :          6 : }
    3266                 :            : 
    3267         [ +  - ]:          6 : ScDataPilotItemsObj::~ScDataPilotItemsObj()
    3268                 :            : {
    3269         [ -  + ]:         12 : }
    3270                 :            : 
    3271                 :            : // XDataPilotItems
    3272                 :            : 
    3273                 :         17 : ScDataPilotItemObj* ScDataPilotItemsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
    3274                 :            : {
    3275                 :         17 :     return ((0 <= nIndex) && (nIndex < GetMemberCount())) ?
    3276   [ +  -  +  + ]:         34 :         new ScDataPilotItemObj( mrParent, maFieldId, nIndex ) : 0;
                 [ +  - ]
    3277                 :            : }
    3278                 :            : 
    3279                 :            : // XNameAccess
    3280                 :            : 
    3281                 :          2 : Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName )
    3282                 :            :         throw(NoSuchElementException, WrappedTargetException, RuntimeException)
    3283                 :            : {
    3284         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3285         [ +  - ]:          2 :     Reference<XNameAccess> xMembers = GetMembers();
    3286         [ +  - ]:          2 :     if (xMembers.is())
    3287                 :            :     {
    3288 [ +  - ][ +  - ]:          2 :         Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
                 [ +  - ]
    3289 [ +  - ][ +  - ]:          2 :         sal_Int32 nCount = xMembersIndex->getCount();
    3290                 :          2 :         sal_Bool bFound(false);
    3291                 :          2 :         sal_Int32 nItem = 0;
    3292 [ +  + ][ +  - ]:          7 :         while (nItem < nCount && !bFound )
                 [ +  + ]
    3293                 :            :         {
    3294 [ +  - ][ +  - ]:          6 :             Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
                 [ +  - ]
    3295 [ +  - ][ +  - ]:          6 :             if (xMember.is() && (aName == xMember->getName()))
         [ +  + ][ +  - ]
           [ +  +  #  # ]
                 [ +  - ]
    3296 [ +  - ][ +  - ]:          1 :                 return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
         [ +  - ][ +  - ]
    3297         [ +  + ]:         11 :             ++nItem;
    3298                 :          6 :         }
    3299         [ +  - ]:          1 :         if (!bFound)
    3300 [ +  - ][ -  + ]:          2 :             throw NoSuchElementException();
    3301                 :            :     }
    3302         [ +  - ]:          2 :     return Any();
    3303                 :            : }
    3304                 :            : 
    3305                 :          3 : Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
    3306                 :            :                                                 throw(RuntimeException)
    3307                 :            : {
    3308         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3309         [ +  - ]:          3 :     Sequence< OUString > aSeq;
    3310 [ +  - ][ +  - ]:          3 :     if( ScDPObject* pDPObj = GetDPObject() )
    3311 [ +  - ][ +  - ]:          3 :         pDPObj->GetMemberNames( lcl_GetObjectIndex( pDPObj, maFieldId ), aSeq );
    3312         [ +  - ]:          3 :     return aSeq;
    3313                 :            : }
    3314                 :            : 
    3315                 :          2 : sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const OUString& aName )
    3316                 :            :                                         throw(RuntimeException)
    3317                 :            : {
    3318         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3319                 :          2 :     sal_Bool bFound = false;
    3320         [ +  - ]:          2 :     Reference<XNameAccess> xMembers = GetMembers();
    3321         [ +  - ]:          2 :     if (xMembers.is())
    3322                 :            :     {
    3323 [ +  - ][ +  - ]:          2 :         Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
                 [ +  - ]
    3324 [ +  - ][ +  - ]:          2 :         sal_Int32 nCount = xMembersIndex->getCount();
    3325                 :          2 :         sal_Int32 nItem = 0;
    3326 [ +  + ][ +  + ]:          8 :         while (nItem < nCount && !bFound )
                 [ +  + ]
    3327                 :            :         {
    3328 [ +  - ][ +  - ]:          6 :             Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
                 [ +  - ]
    3329 [ +  - ][ +  - ]:          6 :             if (xMember.is() && aName == xMember->getName())
         [ +  + ][ +  - ]
           [ +  +  #  # ]
                 [ +  - ]
    3330                 :          1 :                 bFound = sal_True;
    3331                 :            :             else
    3332                 :          5 :                 nItem++;
    3333                 :          8 :         }
    3334                 :            :     }
    3335         [ +  - ]:          2 :     return bFound;
    3336                 :            : }
    3337                 :            : 
    3338                 :            : // XEnumerationAccess
    3339                 :            : 
    3340                 :          2 : Reference<XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration()
    3341                 :            :                                                     throw(RuntimeException)
    3342                 :            : {
    3343         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3344 [ +  - ][ +  - ]:          2 :     return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotItemsEnumeration")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3345                 :            : }
    3346                 :            : 
    3347                 :            : // XIndexAccess
    3348                 :            : 
    3349                 :         11 : sal_Int32 SAL_CALL ScDataPilotItemsObj::getCount() throw(RuntimeException)
    3350                 :            : {
    3351         [ +  - ]:         11 :     SolarMutexGuard aGuard;
    3352 [ +  - ][ +  - ]:         11 :     return GetMemberCount();
    3353                 :            : }
    3354                 :            : 
    3355                 :         16 : Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex )
    3356                 :            :         throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
    3357                 :            : {
    3358         [ +  - ]:         16 :     SolarMutexGuard aGuard;
    3359 [ +  - ][ +  + ]:         16 :     Reference< XPropertySet > xItem( GetObjectByIndex_Impl( nIndex ) );
                 [ +  - ]
    3360         [ +  + ]:         16 :     if (!xItem.is())
    3361         [ +  - ]:          2 :         throw IndexOutOfBoundsException();
    3362 [ +  - ][ +  - ]:         16 :     return Any( xItem );
    3363                 :            : }
    3364                 :            : 
    3365                 :          1 : uno::Type SAL_CALL ScDataPilotItemsObj::getElementType() throw(RuntimeException)
    3366                 :            : {
    3367         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3368 [ +  - ][ +  - ]:          1 :     return getCppuType((Reference<XPropertySet>*)0);
    3369                 :            : }
    3370                 :            : 
    3371                 :          3 : sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(RuntimeException)
    3372                 :            : {
    3373         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3374 [ +  - ][ +  - ]:          3 :     return ( getCount() != 0 );
    3375                 :            : }
    3376                 :            : 
    3377                 :            : //------------------------------------------------------------------------
    3378                 :            : 
    3379                 :         15 : ScDataPilotItemObj::ScDataPilotItemObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId, sal_Int32 nIndex ) :
    3380                 :            :     ScDataPilotChildObjBase( rParent, rFieldId ),
    3381                 :            :     maPropSet( lcl_GetDataPilotItemMap() ),
    3382 [ +  - ][ +  - ]:         15 :     mnIndex( nIndex )
                 [ +  - ]
    3383                 :            : {
    3384                 :         15 : }
    3385                 :            : 
    3386 [ +  - ][ +  - ]:         15 : ScDataPilotItemObj::~ScDataPilotItemObj()
    3387                 :            : {
    3388         [ -  + ]:         30 : }
    3389                 :            : 
    3390                 :            :                             // XNamed
    3391                 :          1 : OUString SAL_CALL ScDataPilotItemObj::getName() throw(RuntimeException)
    3392                 :            : {
    3393         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3394                 :          1 :     OUString sRet;
    3395         [ +  - ]:          1 :     Reference<XNameAccess> xMembers = GetMembers();
    3396         [ +  - ]:          1 :     if (xMembers.is())
    3397                 :            :     {
    3398 [ +  - ][ +  - ]:          1 :         Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
                 [ +  - ]
    3399 [ +  - ][ +  - ]:          1 :         sal_Int32 nCount = xMembersIndex->getCount();
    3400         [ +  - ]:          1 :         if (mnIndex < nCount)
    3401                 :            :         {
    3402 [ +  - ][ +  - ]:          1 :             Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
                 [ +  - ]
    3403 [ +  - ][ +  - ]:          1 :             sRet = xMember->getName();
    3404                 :          1 :         }
    3405                 :            :     }
    3406         [ +  - ]:          1 :     return sRet;
    3407                 :            : }
    3408                 :            : 
    3409                 :          0 : void SAL_CALL ScDataPilotItemObj::setName( const OUString& /* aName */ )
    3410                 :            :                                 throw(RuntimeException)
    3411                 :            : {
    3412                 :          0 : }
    3413                 :            : 
    3414                 :            :                             // XPropertySet
    3415                 :            : Reference< XPropertySetInfo >
    3416                 :          5 :                             SAL_CALL ScDataPilotItemObj::getPropertySetInfo(  )
    3417                 :            :                                 throw(RuntimeException)
    3418                 :            : {
    3419         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    3420                 :            :     static Reference<XPropertySetInfo> aRef =
    3421 [ +  + ][ +  - ]:          5 :         new SfxItemPropertySetInfo( maPropSet.getPropertyMap() );
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    3422         [ +  - ]:          5 :     return aRef;
    3423                 :            : }
    3424                 :            : 
    3425                 :          7 : void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
    3426                 :            :         throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    3427                 :            : {
    3428         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3429                 :          7 :     ScDPObject* pDPObj = 0;
    3430 [ +  - ][ +  - ]:          7 :     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    3431                 :            :     {
    3432         [ +  - ]:          7 :         Reference<XNameAccess> xMembers = GetMembers();
    3433         [ +  - ]:          7 :         if( xMembers.is() )
    3434                 :            :         {
    3435 [ +  - ][ +  - ]:          7 :             Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
                 [ +  - ]
    3436 [ +  - ][ +  - ]:          7 :             sal_Int32 nCount = xMembersIndex->getCount();
    3437         [ +  - ]:          7 :             if( mnIndex < nCount )
    3438                 :            :             {
    3439 [ +  - ][ +  - ]:          7 :                 Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
                 [ +  - ]
    3440 [ +  - ][ +  - ]:          7 :                 String sName(xMember->getName());
                 [ +  - ]
    3441 [ +  - ][ +  - ]:          7 :                 ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
    3442         [ +  - ]:          7 :                 if (pMember)
    3443                 :            :                 {
    3444                 :          7 :                     bool bGetNewIndex = false;
    3445         [ +  + ]:          7 :                     if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
    3446 [ +  - ][ +  - ]:          3 :                         pMember->SetShowDetails(cppu::any2bool(aValue));
    3447         [ +  + ]:          4 :                     else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
    3448 [ +  - ][ +  - ]:          3 :                         pMember->SetIsVisible(!cppu::any2bool(aValue));
    3449         [ +  - ]:          1 :                     else if ( aPropertyName == SC_UNONAME_POS )
    3450                 :            :                     {
    3451                 :          1 :                         sal_Int32 nNewPos = 0;
    3452 [ +  - ][ +  - ]:          1 :                         if ( ( aValue >>= nNewPos ) && nNewPos >= 0 && nNewPos < nCount )
         [ -  + ][ -  + ]
    3453                 :            :                         {
    3454 [ #  # ][ #  # ]:          0 :                             pDim->SetMemberPosition( sName, nNewPos );
    3455                 :            :                             // get new effective index (depends on sorting mode, which isn't modified)
    3456                 :          0 :                             bGetNewIndex = true;
    3457                 :            :                         }
    3458                 :            :                         else
    3459         [ +  - ]:          1 :                             throw IllegalArgumentException();
    3460                 :            :                     }
    3461         [ +  - ]:          6 :                     SetDPObject( pDPObj );
    3462                 :            : 
    3463         [ -  + ]:          6 :                     if ( bGetNewIndex )     // after SetDPObject, get the new index
    3464                 :            :                     {
    3465         [ #  # ]:          0 :                         OUString aOUName( sName );
    3466 [ #  # ][ #  # ]:          0 :                         Sequence< OUString > aItemNames = xMembers->getElementNames();
    3467                 :          0 :                         sal_Int32 nItemCount = aItemNames.getLength();
    3468         [ #  # ]:          0 :                         for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
    3469 [ #  # ][ #  # ]:          0 :                             if (aItemNames[nItem] == aOUName)
    3470         [ #  # ]:          0 :                                 mnIndex = nItem;
    3471                 :            :                     }
    3472         [ +  - ]:          7 :                 }
    3473                 :          7 :             }
    3474                 :          7 :         }
    3475         [ +  - ]:          7 :     }
    3476                 :          6 : }
    3477                 :            : 
    3478                 :         15 : Any SAL_CALL ScDataPilotItemObj::getPropertyValue( const OUString& aPropertyName )
    3479                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    3480                 :            : {
    3481         [ +  - ]:         15 :     SolarMutexGuard aGuard;
    3482                 :         15 :     Any aRet;
    3483 [ +  - ][ +  - ]:         15 :     if( ScDPSaveDimension* pDim = GetDPDimension() )
    3484                 :            :     {
    3485         [ +  - ]:         15 :         Reference< XNameAccess > xMembers = GetMembers();
    3486         [ +  - ]:         15 :         if( xMembers.is() )
    3487                 :            :         {
    3488 [ +  - ][ +  - ]:         15 :             Reference< XIndexAccess > xMembersIndex( new ScNameToIndexAccess( xMembers ) );
                 [ +  - ]
    3489 [ +  - ][ +  - ]:         15 :             sal_Int32 nCount = xMembersIndex->getCount();
    3490         [ +  - ]:         15 :             if( mnIndex < nCount )
    3491                 :            :             {
    3492 [ +  - ][ +  - ]:         15 :                 Reference< XNamed > xMember( xMembersIndex->getByIndex( mnIndex ), UNO_QUERY );
                 [ +  - ]
    3493 [ +  - ][ +  - ]:         15 :                 String sName( xMember->getName() );
                 [ +  - ]
    3494 [ +  - ][ +  - ]:         15 :                 ScDPSaveMember* pMember = pDim->GetExistingMemberByName( sName );
    3495         [ +  + ]:         15 :                 if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
    3496                 :            :                 {
    3497 [ +  + ][ +  - ]:          7 :                     if (pMember && pMember->HasShowDetails())
         [ +  - ][ +  + ]
    3498                 :            :                     {
    3499         [ +  - ]:          6 :                         aRet <<= (bool)pMember->GetShowDetails();
    3500                 :            :                     }
    3501                 :            :                     else
    3502                 :            :                     {
    3503         [ +  - ]:          1 :                         Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
    3504         [ +  - ]:          1 :                         if( xMemberProps.is() )
    3505 [ +  - ][ +  - ]:          1 :                             aRet = xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_SHOWDETAILS ) ) );
                 [ +  - ]
    3506                 :            :                         else
    3507         [ #  # ]:          1 :                             aRet <<= true;
    3508                 :            :                     }
    3509                 :            :                 }
    3510         [ +  + ]:          8 :                 else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
    3511                 :            :                 {
    3512 [ +  - ][ +  - ]:          7 :                     if (pMember && pMember->HasIsVisible())
         [ +  + ][ +  + ]
    3513                 :            :                     {
    3514         [ +  - ]:          6 :                         aRet <<= !pMember->GetIsVisible();
    3515                 :            :                     }
    3516                 :            :                     else
    3517                 :            :                     {
    3518         [ +  - ]:          1 :                         Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
    3519         [ +  - ]:          1 :                         if( xMemberProps.is() )
    3520 [ +  - ][ +  - ]:          1 :                             aRet <<= !cppu::any2bool( xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_ISVISIBLE ) ) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    3521                 :            :                         else
    3522         [ #  # ]:          1 :                             aRet <<= false;
    3523                 :            :                     }
    3524                 :            :                 }
    3525         [ +  - ]:          1 :                 else if ( aPropertyName == SC_UNONAME_POS )
    3526                 :            :                 {
    3527         [ +  - ]:          1 :                     aRet <<= mnIndex;
    3528         [ +  - ]:         15 :                 }
    3529                 :         15 :             }
    3530                 :         15 :         }
    3531                 :            :     }
    3532         [ +  - ]:         15 :     return aRet;
    3533                 :            : }
    3534                 :            : 
    3535                 :          0 : void SAL_CALL ScDataPilotItemObj::addPropertyChangeListener(
    3536                 :            :         const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
    3537                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    3538                 :            : {
    3539                 :          0 : }
    3540                 :            : 
    3541                 :          0 : void SAL_CALL ScDataPilotItemObj::removePropertyChangeListener(
    3542                 :            :         const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
    3543                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    3544                 :            : {
    3545                 :          0 : }
    3546                 :            : 
    3547                 :          0 : void SAL_CALL ScDataPilotItemObj::addVetoableChangeListener(
    3548                 :            :         const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
    3549                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    3550                 :            : {
    3551                 :          0 : }
    3552                 :            : 
    3553                 :          0 : void SAL_CALL ScDataPilotItemObj::removeVetoableChangeListener(
    3554                 :            :         const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
    3555                 :            :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    3556                 :            : {
    3557 [ +  - ][ +  - ]:        153 : }
    3558                 :            : 
    3559                 :            : //------------------------------------------------------------------------
    3560                 :            : 
    3561                 :            : 
    3562                 :            : 
    3563                 :            : 
    3564                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10