LCOV - code coverage report
Current view: top level - chart2/source/view/main - VDataSeries.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 373 517 72.1 %
Date: 2012-08-25 Functions: 64 74 86.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 312 792 39.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "VDataSeries.hxx"
      21                 :            : #include "ObjectIdentifier.hxx"
      22                 :            : #include "macros.hxx"
      23                 :            : #include "CommonConverters.hxx"
      24                 :            : #include "LabelPositionHelper.hxx"
      25                 :            : #include "ChartTypeHelper.hxx"
      26                 :            : #include "ContainerHelper.hxx"
      27                 :            : #include "DataSeriesHelper.hxx"
      28                 :            : #include "RegressionCurveHelper.hxx"
      29                 :            : 
      30                 :            : #include <com/sun/star/chart/MissingValueTreatment.hpp>
      31                 :            : #include <com/sun/star/chart2/Symbol.hpp>
      32                 :            : 
      33                 :            : #include <rtl/math.hxx>
      34                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertyState.hpp>
      36                 :            : #include <com/sun/star/drawing/LineStyle.hpp>
      37                 :            : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      38                 :            : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
      39                 :            : #include <com/sun/star/text/WritingMode.hpp>
      40                 :            : #include <com/sun/star/chart2/data/XDataSource.hpp>
      41                 :            : 
      42                 :            : //.............................................................................
      43                 :            : namespace chart
      44                 :            : {
      45                 :            : //.............................................................................
      46                 :            : using namespace ::com::sun::star;
      47                 :            : using namespace ::com::sun::star::chart2;
      48                 :            : using ::com::sun::star::uno::Reference;
      49                 :            : 
      50                 :       3238 : void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
      51                 :            : {
      52                 :       3238 :     Model = xModel;
      53         [ +  - ]:       3238 :     Doubles = DataSequenceToDoubleSequence( xModel );
      54                 :       3238 : }
      55                 :            : 
      56                 :     141627 : bool VDataSequence::is() const
      57                 :            : {
      58                 :     141627 :     return Model.is();
      59                 :            : }
      60                 :       3206 : void VDataSequence::clear()
      61                 :            : {
      62                 :       3206 :     Model = NULL;
      63                 :       3206 :     Doubles.realloc(0);
      64                 :       3206 : }
      65                 :            : 
      66                 :        720 : double VDataSequence::getValue( sal_Int32 index ) const
      67                 :            : {
      68 [ +  - ][ +  + ]:        720 :     if( 0<=index && index<Doubles.getLength() )
                 [ +  + ]
      69                 :        468 :         return Doubles[index];
      70                 :            :     else
      71                 :            :     {
      72                 :            :         double fNan;
      73                 :        252 :         ::rtl::math::setNan( & fNan );
      74                 :        720 :         return fNan;
      75                 :            :     }
      76                 :            : }
      77                 :            : 
      78                 :       2191 : sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const
      79                 :            : {
      80                 :       2191 :     sal_Int32 nNumberFormatKey = -1;
      81                 :            : 
      82                 :            :     // -1 is allowed and means a key for the whole sequence
      83         [ +  - ]:       4382 :     if( -1<=index && index<Doubles.getLength() &&
           [ +  -  +  - ]
                 [ +  - ]
      84                 :       2191 :         Model.is())
      85                 :            :     {
      86                 :       2191 :         nNumberFormatKey = Model->getNumberFormatKeyByIndex( index );
      87                 :            :     }
      88                 :            : 
      89                 :       2191 :     return nNumberFormatKey;
      90                 :            : }
      91                 :            : 
      92                 :      63211 : sal_Int32 VDataSequence::getLength() const
      93                 :            : {
      94                 :      63211 :     return Doubles.getLength();
      95                 :            : }
      96                 :            : 
      97                 :            : namespace
      98                 :            : {
      99                 :            : struct lcl_LessXOfPoint
     100                 :            : {
     101                 :          0 :     inline bool operator() ( const std::vector< double >& first,
     102                 :            :                              const std::vector< double >& second )
     103                 :            :     {
     104 [ #  # ][ #  # ]:          0 :         if( !first.empty() && !second.empty() )
                 [ #  # ]
     105                 :            :         {
     106                 :          0 :             return first[0]<second[0];
     107                 :            :         }
     108                 :          0 :         return false;
     109                 :            :     }
     110                 :            : };
     111                 :            : 
     112                 :          0 : void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence )
     113                 :            : {
     114                 :            :     //#i71686#, #i101968#, #i102428#
     115                 :          0 :     sal_Int32 nCount = rData.Doubles.getLength();
     116         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < nCount; ++i )
     117                 :            :     {
     118 [ #  # ][ #  # ]:          0 :         if( !::rtl::math::isNan( rData.Doubles[i] ) )
     119                 :            :             return;
     120                 :            :     }
     121                 :            :     //no double value is countained
     122                 :            :     //is there any text?
     123         [ #  # ]:          0 :     uno::Sequence< rtl::OUString > aStrings( DataSequenceToStringSequence( xDataSequence ) );
     124                 :          0 :     sal_Int32 nTextCount = aStrings.getLength();
     125         [ #  # ]:          0 :     for( sal_Int32 j = 0; j < nTextCount; ++j )
     126                 :            :     {
     127 [ #  # ][ #  # ]:          0 :         if( !aStrings[j].isEmpty() )
     128                 :            :         {
     129         [ #  # ]:          0 :             rData.clear();
     130                 :            :             return;
     131                 :            :         }
     132 [ #  # ][ #  # ]:          0 :     }
     133                 :            :     //no content at all
     134                 :            : }
     135                 :            : 
     136                 :     113378 : void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment )
     137                 :            : {
     138   [ -  +  #  #  :     113378 :     if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
           #  # ][ -  + ]
     139                 :          0 :         && (::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue)) )
     140                 :          0 :             rfValue = 0.0;
     141                 :     113378 : }
     142                 :            : 
     143                 :            : }
     144                 :            : 
     145                 :       3206 : VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
     146                 :            :     : m_nPolygonIndex(0)
     147                 :            :     , m_fLogicMinX(0.0)
     148                 :            :     , m_fLogicMaxX(0.0)
     149                 :            :     , m_fLogicZPos(0.0)
     150                 :            :     , m_xGroupShape(NULL)
     151                 :            :     , m_xLabelsGroupShape(NULL)
     152                 :            :     , m_xErrorXBarsGroupShape(NULL)
     153                 :            :     , m_xErrorYBarsGroupShape(NULL)
     154                 :            :     , m_xFrontSubGroupShape(NULL)
     155                 :            :     , m_xBackSubGroupShape(NULL)
     156                 :            :     , m_xDataSeries(xDataSeries)
     157                 :            :     , m_aDataSequences()
     158                 :            :     , m_nPointCount(0)
     159                 :            : 
     160                 :            :     , m_aValues_X()
     161                 :            :     , m_aValues_Y()
     162                 :            :     , m_aValues_Z()
     163                 :            :     , m_aValues_Y_Min()
     164                 :            :     , m_aValues_Y_Max()
     165                 :            :     , m_aValues_Y_First()
     166                 :            :     , m_aValues_Y_Last()
     167                 :            :     , m_aValues_Bubble_Size()
     168                 :            :     , m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
     169                 :            : 
     170                 :            :     , m_fXMeanValue(1.0)
     171                 :            :     , m_fYMeanValue(1.0)
     172                 :            : 
     173                 :            :     , m_aAttributedDataPointIndexList()
     174                 :            : 
     175                 :            :     , m_eStackingDirection(StackingDirection_NO_STACKING)
     176                 :            :     , m_nAxisIndex(0)
     177                 :            :     , m_bConnectBars(sal_False)
     178                 :            :     , m_bGroupBarsPerAxis(sal_True)
     179                 :            :     , m_nStartingAngle(90)
     180                 :            : 
     181                 :            :     , m_aSeriesParticle()
     182                 :            :     , m_aCID()
     183                 :            :     , m_aPointCID_Stub()
     184                 :            :     , m_aLabelCID_Stub()
     185                 :            : 
     186                 :            :     , m_nGlobalSeriesIndex(0)
     187                 :            : 
     188                 :            :     , m_apLabel_Series(NULL)
     189                 :            :     , m_apLabelPropNames_Series(NULL)
     190                 :            :     , m_apLabelPropValues_Series(NULL)
     191                 :            :     , m_apSymbolProperties_Series(NULL)
     192                 :            : 
     193                 :            :     , m_apLabel_AttributedPoint(NULL)
     194                 :            :     , m_apLabelPropNames_AttributedPoint(NULL)
     195                 :            :     , m_apLabelPropValues_AttributedPoint(NULL)
     196                 :            :     , m_apSymbolProperties_AttributedPoint(NULL)
     197                 :            :     , m_apSymbolProperties_InvisibleSymbolForSelection(NULL)
     198                 :            :     , m_nCurrentAttributedPoint(-1)
     199                 :            :     , m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
     200 [ +  - ][ +  - ]:       3206 :     , m_bAllowPercentValueInDataLabel(false)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     201                 :            : {
     202                 :       3206 :     ::rtl::math::setNan( & m_fXMeanValue );
     203                 :       3206 :     ::rtl::math::setNan( & m_fYMeanValue );
     204                 :            : 
     205                 :            :     uno::Reference<data::XDataSource> xDataSource =
     206         [ +  - ]:       3206 :             uno::Reference<data::XDataSource>( xDataSeries, uno::UNO_QUERY );
     207                 :            : 
     208 [ +  - ][ +  - ]:       3206 :     m_aDataSequences = xDataSource->getDataSequences();
         [ +  - ][ +  - ]
     209                 :            : 
     210         [ +  + ]:       6444 :     for(sal_Int32 nN = m_aDataSequences.getLength();nN--;)
     211                 :            :     {
     212 [ +  - ][ -  + ]:       3238 :         if(!m_aDataSequences[nN].is())
     213                 :          0 :             continue;
     214 [ +  - ][ +  - ]:       3238 :         uno::Reference<data::XDataSequence>  xDataSequence( m_aDataSequences[nN]->getValues());
                 [ +  - ]
     215         [ +  - ]:       3238 :         uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
     216         [ +  - ]:       3238 :         if( xProp.is())
     217                 :            :         {
     218                 :            :             try
     219                 :            :             {
     220 [ +  - ][ +  - ]:       3238 :                 uno::Any aARole = xProp->getPropertyValue( C2U( "Role" ) );
                 [ +  - ]
     221                 :       3238 :                 rtl::OUString aRole;
     222                 :       3238 :                 aARole >>= aRole;
     223                 :            : 
     224 [ -  + ][ +  - ]:       3238 :                 if( aRole.equals(C2U("values-x")) )
     225                 :            :                 {
     226         [ #  # ]:          0 :                     m_aValues_X.init( xDataSequence );
     227         [ #  # ]:          0 :                     lcl_clearIfNoValuesButTextIsContained( m_aValues_X, xDataSequence );
     228                 :            :                 }
     229 [ +  - ][ +  + ]:       3238 :                 else if( aRole.equals(C2U("values-y")) )
     230         [ +  - ]:       3186 :                     m_aValues_Y.init( xDataSequence );
     231 [ +  - ][ +  + ]:         52 :                 else if( aRole.equals(C2U("values-min")) )
     232         [ +  - ]:         20 :                     m_aValues_Y_Min.init( xDataSequence );
     233 [ +  - ][ +  + ]:         32 :                 else if( aRole.equals(C2U("values-max")) )
     234         [ +  - ]:         16 :                     m_aValues_Y_Max.init( xDataSequence );
     235 [ +  - ][ -  + ]:         16 :                 else if( aRole.equals(C2U("values-first")) )
     236         [ #  # ]:          0 :                     m_aValues_Y_First.init( xDataSequence );
     237 [ +  - ][ +  - ]:         16 :                 else if( aRole.equals(C2U("values-last")) )
     238         [ +  - ]:         16 :                     m_aValues_Y_Last.init( xDataSequence );
     239 [ #  # ][ #  # ]:          0 :                 else if( aRole.equals(C2U("values-size")) )
     240 [ #  # ][ #  # ]:       3238 :                     m_aValues_Bubble_Size.init( xDataSequence );
     241                 :            :             }
     242         [ #  # ]:          0 :             catch( const uno::Exception& e )
     243                 :            :             {
     244                 :            :                 ASSERT_EXCEPTION( e );
     245                 :            :             }
     246                 :            :         }
     247                 :       3238 :     }
     248                 :            : 
     249                 :            :     //determine the point count
     250         [ +  - ]:       3206 :     m_nPointCount = m_aValues_Y.getLength();
     251                 :            :     {
     252 [ +  - ][ -  + ]:       3206 :         if( m_nPointCount < m_aValues_Bubble_Size.getLength() )
     253         [ #  # ]:          0 :             m_nPointCount = m_aValues_Bubble_Size.getLength();
     254 [ +  - ][ +  + ]:       3206 :         if( m_nPointCount < m_aValues_Y_Min.getLength() )
     255         [ +  - ]:         20 :             m_nPointCount = m_aValues_Y_Min.getLength();
     256 [ +  - ][ -  + ]:       3206 :         if( m_nPointCount < m_aValues_Y_Max.getLength() )
     257         [ #  # ]:          0 :             m_nPointCount = m_aValues_Y_Max.getLength();
     258 [ +  - ][ -  + ]:       3206 :         if( m_nPointCount < m_aValues_Y_First.getLength() )
     259         [ #  # ]:          0 :             m_nPointCount = m_aValues_Y_First.getLength();
     260 [ +  - ][ -  + ]:       3206 :         if( m_nPointCount < m_aValues_Y_Last.getLength() )
     261         [ #  # ]:          0 :             m_nPointCount = m_aValues_Y_Last.getLength();
     262                 :            :     }
     263                 :            : 
     264         [ +  - ]:       3206 :     uno::Reference<beans::XPropertySet> xProp(xDataSeries, uno::UNO_QUERY );
     265         [ +  - ]:       3206 :     if( xProp.is())
     266                 :            :     {
     267                 :            :         try
     268                 :            :         {
     269                 :            :             //get AttributedDataPoints
     270 [ +  - ][ +  - ]:       3206 :             xProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= m_aAttributedDataPointIndexList;
         [ +  - ][ +  - ]
     271                 :            : 
     272 [ +  - ][ +  - ]:       3206 :             xProp->getPropertyValue( C2U( "StackingDirection" ) ) >>= m_eStackingDirection;
         [ +  - ][ +  - ]
     273                 :            : 
     274 [ +  - ][ +  - ]:       3206 :             xProp->getPropertyValue( C2U( "AttachedAxisIndex" ) ) >>= m_nAxisIndex;
         [ #  # ][ +  - ]
     275         [ -  + ]:       3206 :             if(m_nAxisIndex<0)
     276                 :          0 :                 m_nAxisIndex=0;
     277                 :            :         }
     278         [ #  # ]:          0 :         catch( const uno::Exception& e )
     279                 :            :         {
     280                 :            :             ASSERT_EXCEPTION( e );
     281                 :            :         }
     282                 :       3206 :     }
     283                 :       3206 : }
     284                 :            : 
     285 [ +  - ][ +  - ]:       3206 : VDataSeries::~VDataSeries()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     286                 :            : {
     287         [ -  + ]:       6412 : }
     288                 :            : 
     289                 :          0 : void VDataSeries::doSortByXValues()
     290                 :            : {
     291 [ #  # ][ #  # ]:          0 :     if( m_aValues_X.is() && m_aValues_X.Doubles.getLength() )
                 [ #  # ]
     292                 :            :     {
     293                 :            :         //prepare a vector for sorting
     294         [ #  # ]:          0 :         std::vector< ::std::vector< double > > aTmp;//outer vector are points, inner vector are the different values of athe point
     295                 :            :         double fNan;
     296                 :          0 :         ::rtl::math::setNan( & fNan );
     297                 :          0 :         sal_Int32 nPointIndex = 0;
     298         [ #  # ]:          0 :         for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
     299                 :            :         {
     300         [ #  # ]:          0 :             std::vector< double > aSinglePoint;
     301 [ #  # ][ #  # ]:          0 :             aSinglePoint.push_back( (nPointIndex < m_aValues_X.Doubles.getLength()) ? m_aValues_X.Doubles[nPointIndex] : fNan );
                 [ #  # ]
     302 [ #  # ][ #  # ]:          0 :             aSinglePoint.push_back( (nPointIndex < m_aValues_Y.Doubles.getLength()) ? m_aValues_Y.Doubles[nPointIndex] : fNan );
                 [ #  # ]
     303         [ #  # ]:          0 :             aTmp.push_back( aSinglePoint );
     304                 :          0 :         }
     305                 :            : 
     306                 :            :         //do sort
     307         [ #  # ]:          0 :         std::sort( aTmp.begin(), aTmp.end(), lcl_LessXOfPoint() );
     308                 :            : 
     309                 :            :         //fill the sorted points back to the members
     310         [ #  # ]:          0 :         m_aValues_X.Doubles.realloc( m_nPointCount );
     311         [ #  # ]:          0 :         m_aValues_Y.Doubles.realloc( m_nPointCount );
     312                 :            : 
     313         [ #  # ]:          0 :         for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
     314                 :            :         {
     315 [ #  # ][ #  # ]:          0 :             m_aValues_X.Doubles[nPointIndex]=aTmp[nPointIndex][0];
                 [ #  # ]
     316 [ #  # ][ #  # ]:          0 :             m_aValues_Y.Doubles[nPointIndex]=aTmp[nPointIndex][1];
                 [ #  # ]
     317                 :          0 :         }
     318                 :            :     }
     319                 :          0 : }
     320                 :            : 
     321                 :      12234 : uno::Reference< XDataSeries > VDataSeries::getModel() const
     322                 :            : {
     323                 :      12234 :     return m_xDataSeries;
     324                 :            : }
     325                 :            : 
     326                 :         57 : void VDataSeries::releaseShapes()
     327                 :            : {
     328                 :         57 :     m_xGroupShape.set(0);
     329                 :         57 :     m_xLabelsGroupShape.set(0);
     330                 :         57 :     m_xErrorXBarsGroupShape.set(0);
     331                 :         57 :     m_xErrorYBarsGroupShape.set(0);
     332                 :         57 :     m_xFrontSubGroupShape.set(0);
     333                 :         57 :     m_xBackSubGroupShape.set(0);
     334                 :            : 
     335                 :         57 :     m_aPolyPolygonShape3D.SequenceX.realloc(0);
     336                 :         57 :     m_aPolyPolygonShape3D.SequenceY.realloc(0);
     337                 :         57 :     m_aPolyPolygonShape3D.SequenceZ.realloc(0);
     338                 :         57 :     m_nPolygonIndex = 0;
     339                 :         57 : }
     340                 :            : 
     341                 :       3206 : void VDataSeries::setCategoryXAxis()
     342                 :            : {
     343                 :       3206 :     m_aValues_X.clear();
     344                 :       3206 :     m_bAllowPercentValueInDataLabel = true;
     345                 :       3206 : }
     346                 :            : 
     347                 :          0 : void VDataSeries::setXValues( const Reference< chart2::data::XDataSequence >& xValues )
     348                 :            : {
     349                 :          0 :     m_aValues_X.clear();
     350                 :          0 :     m_aValues_X.init( xValues );
     351                 :          0 :     m_bAllowPercentValueInDataLabel = true;
     352                 :          0 : }
     353                 :            : 
     354                 :          0 : void VDataSeries::setXValuesIfNone( const Reference< chart2::data::XDataSequence >& xValues )
     355                 :            : {
     356         [ #  # ]:          0 :     if( m_aValues_X.is() )
     357                 :          0 :         return;
     358                 :            : 
     359                 :          0 :     m_aValues_X.init( xValues );
     360                 :          0 :     lcl_clearIfNoValuesButTextIsContained( m_aValues_X, xValues );
     361                 :            : }
     362                 :            : 
     363                 :       3206 : void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
     364                 :            : {
     365                 :       3206 :     m_nGlobalSeriesIndex = nGlobalSeriesIndex;
     366                 :       3206 : }
     367                 :            : 
     368                 :       3206 : void VDataSeries::setParticle( const rtl::OUString& rSeriesParticle )
     369                 :            : {
     370                 :       3206 :     m_aSeriesParticle = rSeriesParticle;
     371                 :            : 
     372                 :            :     //get CID
     373                 :       3206 :     m_aCID = ObjectIdentifier::createClassifiedIdentifierForParticle( m_aSeriesParticle );
     374         [ +  - ]:       3206 :     m_aPointCID_Stub = ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT, m_aSeriesParticle );
     375                 :            : 
     376                 :            :     m_aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
     377 [ +  - ][ +  - ]:       3206 :                         OBJECTTYPE_DATA_LABEL, ::rtl::OUString(), getLabelsCID() );
     378                 :       3206 : }
     379                 :       3357 : rtl::OUString VDataSeries::getSeriesParticle() const
     380                 :            : {
     381                 :       3357 :     return m_aSeriesParticle;
     382                 :            : }
     383                 :       3187 : rtl::OUString VDataSeries::getCID() const
     384                 :            : {
     385                 :       3187 :     return m_aCID;
     386                 :            : }
     387                 :      13039 : rtl::OUString VDataSeries::getPointCID_Stub() const
     388                 :            : {
     389                 :      13039 :     return m_aPointCID_Stub;
     390                 :            : }
     391                 :       1080 : rtl::OUString VDataSeries::getErrorBarsCID(bool bYError) const
     392                 :            : {
     393                 :            :     rtl::OUString aChildParticle( ObjectIdentifier::getStringForType(
     394 [ +  - ][ +  - ]:       1080 :                                       bYError ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X ) );
     395         [ +  - ]:       1080 :     aChildParticle+=(C2U("="));
     396                 :            : 
     397                 :            :     return ObjectIdentifier::createClassifiedIdentifierForParticles(
     398         [ +  - ]:       1080 :             m_aSeriesParticle, aChildParticle );
     399                 :            : }
     400                 :       3606 : rtl::OUString VDataSeries::getLabelsCID() const
     401                 :            : {
     402         [ +  - ]:       3606 :     rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
     403         [ +  - ]:       3606 :     aChildParticle+=(C2U("="));
     404                 :            : 
     405                 :            :     return ObjectIdentifier::createClassifiedIdentifierForParticles(
     406         [ +  - ]:       3606 :             m_aSeriesParticle, aChildParticle );
     407                 :            : }
     408                 :       2272 : rtl::OUString VDataSeries::getLabelCID_Stub() const
     409                 :            : {
     410                 :       2272 :     return m_aLabelCID_Stub;
     411                 :            : }
     412                 :         84 : rtl::OUString VDataSeries::getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const
     413                 :            : {
     414                 :         84 :     rtl::OUString aRet;
     415         [ +  - ]:         84 :     aRet = ObjectIdentifier::createDataCurveCID( m_aSeriesParticle, nCurveIndex, bAverageLine );
     416                 :         84 :     return aRet;
     417                 :            : }
     418                 :            : 
     419                 :        108 : rtl::OUString VDataSeries::getDataCurveEquationCID( sal_Int32 nCurveIndex ) const
     420                 :            : {
     421                 :        108 :     rtl::OUString aRet;
     422         [ +  - ]:        108 :     aRet = ObjectIdentifier::createDataCurveEquationCID( m_aSeriesParticle, nCurveIndex );
     423                 :        108 :     return aRet;
     424                 :            : }
     425                 :       3206 : void VDataSeries::setPageReferenceSize( const awt::Size & rPageRefSize )
     426                 :            : {
     427                 :       3206 :     m_aReferenceSize = rPageRefSize;
     428                 :       3206 : }
     429                 :            : 
     430                 :       6279 : StackingDirection VDataSeries::getStackingDirection() const
     431                 :            : {
     432                 :       6279 :     return m_eStackingDirection;
     433                 :            : }
     434                 :      49791 : sal_Int32 VDataSeries::getAttachedAxisIndex() const
     435                 :            : {
     436                 :      49791 :     return m_nAxisIndex;
     437                 :            : }
     438                 :       3206 : void VDataSeries::setConnectBars( sal_Bool bConnectBars )
     439                 :            : {
     440                 :       3206 :     m_bConnectBars = bConnectBars;
     441                 :       3206 : }
     442                 :        886 : sal_Bool VDataSeries::getConnectBars() const
     443                 :            : {
     444                 :        886 :     return m_bConnectBars;
     445                 :            : }
     446                 :       3206 : void VDataSeries::setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis )
     447                 :            : {
     448                 :       3206 :     m_bGroupBarsPerAxis = bGroupBarsPerAxis;
     449                 :       3206 : }
     450                 :       3710 : sal_Bool VDataSeries::getGroupBarsPerAxis() const
     451                 :            : {
     452                 :       3710 :     return m_bGroupBarsPerAxis;
     453                 :            : }
     454                 :            : 
     455                 :       3206 : void VDataSeries::setStartingAngle( sal_Int32 nStartingAngle )
     456                 :            : {
     457                 :       3206 :     m_nStartingAngle = nStartingAngle;
     458                 :       3206 : }
     459                 :         38 : sal_Int32 VDataSeries::getStartingAngle() const
     460                 :            : {
     461                 :         38 :     return m_nStartingAngle;
     462                 :            : }
     463                 :            : 
     464                 :          0 : void VDataSeries::setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex )
     465                 :            : {
     466         [ #  # ]:          0 :     if( nAttachedAxisIndex < 0 )
     467                 :          0 :         nAttachedAxisIndex = 0;
     468                 :          0 :     m_nAxisIndex = nAttachedAxisIndex;
     469                 :          0 : }
     470                 :            : 
     471                 :      15867 : sal_Int32 VDataSeries::getTotalPointCount() const
     472                 :            : {
     473                 :      15867 :     return m_nPointCount;
     474                 :            : }
     475                 :            : 
     476                 :      69607 : double VDataSeries::getXValue( sal_Int32 index ) const
     477                 :            : {
     478                 :      69607 :     double fRet = 0.0;
     479         [ -  + ]:      69607 :     if(m_aValues_X.is())
     480                 :            :     {
     481 [ #  # ][ #  # ]:          0 :         if( 0<=index && index<m_aValues_X.getLength() )
         [ #  # ][ #  # ]
     482         [ #  # ]:          0 :             fRet = m_aValues_X.Doubles[index];
     483                 :            :         else
     484                 :          0 :             ::rtl::math::setNan( &fRet );
     485                 :            :     }
     486                 :            :     else
     487                 :            :     {
     488                 :            :         // #i70133# always return correct X position - needed for short data series
     489         [ +  - ]:      69607 :         if( 0<=index /*&& index < m_nPointCount*/ )
     490                 :      69607 :             fRet = index+1;//first category (index 0) matches with real number 1.0
     491                 :            :         else
     492                 :          0 :             ::rtl::math::setNan( &fRet );
     493                 :            :     }
     494                 :      69607 :     lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
     495                 :      69607 :     return fRet;
     496                 :            : }
     497                 :            : 
     498                 :      43771 : double VDataSeries::getYValue( sal_Int32 index ) const
     499                 :            : {
     500                 :      43771 :     double fRet = 0.0;
     501         [ +  - ]:      43771 :     if(m_aValues_Y.is())
     502                 :            :     {
     503 [ +  - ][ +  - ]:      43771 :         if( 0<=index && index<m_aValues_Y.getLength() )
         [ +  - ][ +  - ]
     504         [ +  - ]:      43771 :             fRet = m_aValues_Y.Doubles[index];
     505                 :            :         else
     506                 :          0 :             ::rtl::math::setNan( &fRet );
     507                 :            :     }
     508                 :            :     else
     509                 :            :     {
     510                 :            :         // #i70133# always return correct X position - needed for short data series
     511         [ #  # ]:          0 :         if( 0<=index /*&& index < m_nPointCount*/ )
     512                 :          0 :             fRet = index+1;//first category (index 0) matches with real number 1.0
     513                 :            :         else
     514                 :          0 :             ::rtl::math::setNan( &fRet );
     515                 :            :     }
     516                 :      43771 :     lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
     517                 :      43771 :     return fRet;
     518                 :            : }
     519                 :            : 
     520                 :        180 : double VDataSeries::getY_Min( sal_Int32 index ) const
     521                 :            : {
     522                 :        180 :     return m_aValues_Y_Min.getValue( index );
     523                 :            : }
     524                 :        180 : double VDataSeries::getY_Max( sal_Int32 index ) const
     525                 :            : {
     526                 :        180 :     return m_aValues_Y_Max.getValue( index );
     527                 :            : }
     528                 :        180 : double VDataSeries::getY_First( sal_Int32 index ) const
     529                 :            : {
     530                 :        180 :     return m_aValues_Y_First.getValue( index );
     531                 :            : }
     532                 :        180 : double VDataSeries::getY_Last( sal_Int32 index ) const
     533                 :            : {
     534                 :        180 :     return m_aValues_Y_Last.getValue( index );
     535                 :            : }
     536                 :          0 : double VDataSeries::getBubble_Size( sal_Int32 index ) const
     537                 :            : {
     538                 :          0 :     return m_aValues_Bubble_Size.getValue( index );
     539                 :            : }
     540                 :            : 
     541                 :       2282 : bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
     542                 :            : {
     543 [ +  + ][ +  - ]:       2282 :     rtl::OUString aPropName( bForPercentage ? C2U( "PercentageNumberFormat" ) : C2U( "NumberFormat" ) );
                 [ +  - ]
     544                 :       2282 :     bool bHasNumberFormat = false;
     545         [ +  - ]:       2282 :     uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( nPointIndex ));
     546                 :       2282 :     sal_Int32 nNumberFormat = -1;
     547 [ +  - ][ +  - ]:       2282 :     if( xPointProp.is() && (xPointProp->getPropertyValue(aPropName) >>= nNumberFormat) )
         [ +  - ][ -  + ]
                 [ +  - ]
           [ -  +  #  # ]
     548                 :          0 :         bHasNumberFormat = true;
     549                 :       2282 :     return bHasNumberFormat;
     550                 :            : }
     551                 :          0 : sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
     552                 :            : {
     553 [ #  # ][ #  # ]:          0 :     rtl::OUString aPropName( bForPercentage ? C2U( "PercentageNumberFormat" ) : C2U( "NumberFormat" ) );
                 [ #  # ]
     554                 :          0 :     sal_Int32 nNumberFormat = -1;
     555         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( nPointIndex ));
     556         [ #  # ]:          0 :     if( xPointProp.is() )
     557 [ #  # ][ #  # ]:          0 :         xPointProp->getPropertyValue(aPropName) >>= nNumberFormat;
     558                 :          0 :     return nNumberFormat;
     559                 :            : }
     560                 :       3206 : void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole )
     561                 :            : {
     562         [ +  + ]:       3206 :     if( rRole.equals(C2U("values-y")) )
     563                 :       3186 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y;
     564         [ -  + ]:         20 :     else if( rRole.equals(C2U("values-size")) )
     565                 :          0 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Bubble_Size;
     566         [ -  + ]:         20 :     else if( rRole.equals(C2U("values-min")) )
     567                 :          0 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Min;
     568         [ -  + ]:         20 :     else if( rRole.equals(C2U("values-max")) )
     569                 :          0 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Max;
     570         [ -  + ]:         20 :     else if( rRole.equals(C2U("values-first")) )
     571                 :          0 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_First;
     572         [ +  - ]:         20 :     else if( rRole.equals(C2U("values-last")) )
     573                 :         20 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Last;
     574         [ #  # ]:          0 :     else if( rRole.equals(C2U("values-x")) )
     575                 :          0 :         m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X;
     576                 :       3206 : }
     577                 :       2191 : bool VDataSeries::shouldLabelNumberFormatKeyBeDetectedFromYAxis() const
     578                 :            : {
     579         [ -  + ]:       2191 :     if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_Bubble_Size )
     580                 :          0 :         return false;
     581         [ -  + ]:       2191 :     else if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_X )
     582                 :          0 :         return false;
     583                 :       2191 :     return true;
     584                 :            : }
     585                 :       2191 : sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
     586                 :            : {
     587                 :       2191 :     sal_Int32 nRet = 0;
     588         [ +  - ]:       2191 :     if( m_pValueSequenceForDataLabelNumberFormatDetection )
     589                 :       2191 :         nRet = m_pValueSequenceForDataLabelNumberFormatDetection->detectNumberFormatKey( index );
     590                 :       2191 :     return nRet;
     591                 :            : }
     592                 :            : 
     593                 :       2272 : sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const
     594                 :            : {
     595                 :       2272 :     sal_Int32 nLabelPlacement=0;
     596                 :            :     try
     597                 :            :     {
     598         [ +  - ]:       2272 :         uno::Reference< beans::XPropertySet > xPointProps( this->getPropertiesOfPoint( nPointIndex ) );
     599         [ +  - ]:       2272 :         if( xPointProps.is() )
     600 [ +  - ][ +  - ]:       2272 :             xPointProps->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement;
                 [ +  - ]
     601                 :            : 
     602                 :            :         //ensure that the set label placement is supported by this charttype
     603                 :            : 
     604                 :            :         uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
     605         [ +  - ]:       2272 :                 xChartType, nDimensionCount, bSwapXAndY, m_xDataSeries ) );
     606                 :            : 
     607         [ +  + ]:      13876 :         for( sal_Int32 nN = 0; nN < aAvailablePlacements.getLength(); nN++ )
     608 [ +  - ][ -  + ]:      11604 :             if( aAvailablePlacements[nN] == nLabelPlacement )
     609                 :          0 :                 return nLabelPlacement; //ok
     610                 :            : 
     611                 :            :         //otherwise use the first supported one
     612         [ +  - ]:       2272 :         if( aAvailablePlacements.getLength() )
     613                 :            :         {
     614         [ +  - ]:       2272 :             nLabelPlacement = aAvailablePlacements[0];
     615                 :       2272 :             return nLabelPlacement;
     616                 :            :         }
     617                 :            : 
     618 [ +  - ][ +  - ]:       2272 :         OSL_FAIL("no label placement supported");
         [ -  + ][ #  # ]
     619                 :            :     }
     620         [ #  # ]:          0 :     catch( const uno::Exception& e )
     621                 :            :     {
     622                 :            :         ASSERT_EXCEPTION( e );
     623                 :            :     }
     624                 :       2272 :     return nLabelPlacement;
     625                 :            : }
     626                 :            : 
     627                 :      13703 : double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
     628                 :            : {
     629                 :      13703 :     double fMin=0.0;
     630                 :      13703 :     ::rtl::math::setInf(&fMin, false);
     631                 :            : 
     632 [ +  + ][ +  +  :      13763 :     if( !m_aValues_Y.is() &&
          -  +  #  #  #  
                #  #  # ]
     633                 :         60 :         (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
     634                 :          0 :         || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
     635                 :            :     {
     636         [ +  - ]:         60 :         double fY_Min = getY_Min( index );
     637         [ +  - ]:         60 :         double fY_Max = getY_Max( index );
     638         [ +  - ]:         60 :         double fY_First = getY_First( index );
     639         [ +  - ]:         60 :         double fY_Last = getY_Last( index );
     640                 :            : 
     641         [ -  + ]:         60 :         if(fMin>fY_First)
     642                 :          0 :             fMin=fY_First;
     643         [ +  + ]:         60 :         if(fMin>fY_Last)
     644                 :         48 :             fMin=fY_Last;
     645         [ +  + ]:         60 :         if(fMin>fY_Min)
     646                 :         40 :             fMin=fY_Min;
     647         [ +  + ]:         60 :         if(fMin>fY_Max)
     648                 :         16 :             fMin=fY_Max;
     649                 :            :     }
     650                 :            :     else
     651                 :            :     {
     652         [ +  - ]:      13643 :         double fY = getYValue( index );
     653         [ +  + ]:      13643 :         if(fMin>fY)
     654                 :      13627 :             fMin=fY;
     655                 :            :     }
     656                 :            : 
     657         [ +  + ]:      13703 :     if( ::rtl::math::isInf(fMin) )
     658                 :         16 :         ::rtl::math::setNan(&fMin);
     659                 :            : 
     660                 :      13703 :     return fMin;
     661                 :            : }
     662                 :            : 
     663                 :      13703 : double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
     664                 :            : {
     665                 :      13703 :     double fMax=0.0;
     666                 :      13703 :     ::rtl::math::setInf(&fMax, true);
     667                 :            : 
     668 [ +  + ][ +  +  :      13763 :     if( !m_aValues_Y.is() &&
          -  +  #  #  #  
                #  #  # ]
     669                 :         60 :         (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
     670                 :          0 :         || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
     671                 :            :     {
     672         [ +  - ]:         60 :         double fY_Min = getY_Min( index );
     673         [ +  - ]:         60 :         double fY_Max = getY_Max( index );
     674         [ +  - ]:         60 :         double fY_First = getY_First( index );
     675         [ +  - ]:         60 :         double fY_Last = getY_Last( index );
     676                 :            : 
     677         [ -  + ]:         60 :         if(fMax<fY_First)
     678                 :          0 :             fMax=fY_First;
     679         [ +  + ]:         60 :         if(fMax<fY_Last)
     680                 :         48 :             fMax=fY_Last;
     681         [ +  + ]:         60 :         if(fMax<fY_Min)
     682                 :         32 :             fMax=fY_Min;
     683         [ +  + ]:         60 :         if(fMax<fY_Max)
     684                 :         16 :             fMax=fY_Max;
     685                 :            :     }
     686                 :            :     else
     687                 :            :     {
     688         [ +  - ]:      13643 :         double fY = getYValue( index );
     689         [ +  + ]:      13643 :         if(fMax<fY)
     690                 :      13627 :             fMax=fY;
     691                 :            :     }
     692                 :            : 
     693         [ +  + ]:      13703 :     if( ::rtl::math::isInf(fMax) )
     694                 :         16 :         ::rtl::math::setNan(&fMax);
     695                 :            : 
     696                 :      13703 :     return fMax;
     697                 :            : }
     698                 :            : 
     699                 :        108 : uno::Sequence< double > VDataSeries::getAllX() const
     700                 :            : {
     701 [ +  - ][ +  + ]:        108 :     if(!m_aValues_X.is() && !m_aValues_X.getLength() && m_nPointCount)
         [ +  - ][ +  + ]
     702                 :            :     {
     703                 :            :         //init x values from category indexes
     704                 :            :         //first category (index 0) matches with real number 1.0
     705                 :         76 :         m_aValues_X.Doubles.realloc( m_nPointCount );
     706         [ +  + ]:        974 :         for(sal_Int32 nN=m_aValues_X.getLength();nN--;)
     707                 :        898 :             m_aValues_X.Doubles[nN] = nN+1;
     708                 :            :     }
     709                 :        108 :     return m_aValues_X.Doubles;
     710                 :            : }
     711                 :            : 
     712                 :        615 : uno::Sequence< double > VDataSeries::getAllY() const
     713                 :            : {
     714 [ -  + ][ #  # ]:        615 :     if(!m_aValues_Y.is() && !m_aValues_Y.getLength() && m_nPointCount)
         [ #  # ][ -  + ]
     715                 :            :     {
     716                 :            :         //init y values from indexes
     717                 :            :         //first y-value (index 0) matches with real number 1.0
     718                 :          0 :         m_aValues_Y.Doubles.realloc( m_nPointCount );
     719         [ #  # ]:          0 :         for(sal_Int32 nN=m_aValues_Y.getLength();nN--;)
     720                 :          0 :             m_aValues_Y.Doubles[nN] = nN+1;
     721                 :            :     }
     722                 :        615 :     return m_aValues_Y.Doubles;
     723                 :            : }
     724                 :            : 
     725                 :          0 : double VDataSeries::getXMeanValue() const
     726                 :            : {
     727         [ #  # ]:          0 :     if( ::rtl::math::isNan( m_fXMeanValue ) )
     728                 :            :     {
     729         [ #  # ]:          0 :         uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( "com.sun.star.chart2.MeanValueRegressionCurve" ) );
     730         [ #  # ]:          0 :         uno::Sequence< double > aXValuesDummy;
     731 [ #  # ][ #  # ]:          0 :         xCalculator->recalculateRegression( aXValuesDummy, getAllX() );
         [ #  # ][ #  # ]
     732                 :          0 :         double fXDummy = 1.0;
     733 [ #  # ][ #  # ]:          0 :         m_fXMeanValue = xCalculator->getCurveValue( fXDummy );
                 [ #  # ]
     734                 :            :     }
     735                 :          0 :     return m_fXMeanValue;
     736                 :            : }
     737                 :            : 
     738                 :          0 : double VDataSeries::getYMeanValue() const
     739                 :            : {
     740         [ #  # ]:          0 :     if( ::rtl::math::isNan( m_fYMeanValue ) )
     741                 :            :     {
     742 [ #  # ][ #  # ]:          0 :         uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( C2U("com.sun.star.chart2.MeanValueRegressionCurve") ) );
     743         [ #  # ]:          0 :         uno::Sequence< double > aXValuesDummy;
     744 [ #  # ][ #  # ]:          0 :         xCalculator->recalculateRegression( aXValuesDummy, getAllY() );
         [ #  # ][ #  # ]
     745                 :          0 :         double fXDummy = 1.0;
     746 [ #  # ][ #  # ]:          0 :         m_fYMeanValue = xCalculator->getCurveValue( fXDummy );
                 [ #  # ]
     747                 :            :     }
     748                 :          0 :     return m_fYMeanValue;
     749                 :            : }
     750                 :            : 
     751                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     752                 :        296 : ::std::auto_ptr< Symbol > getSymbolPropertiesFromPropertySet(
     753                 :            :         const uno::Reference< beans::XPropertySet >& xProp )
     754                 :            : {
     755         [ +  - ]:        296 :     ::std::auto_ptr< Symbol > apSymbolProps( new Symbol() );
     756                 :            :     try
     757                 :            :     {
     758 [ +  - ][ +  - ]:        296 :         if( xProp->getPropertyValue( C2U( "Symbol" ) ) >>= *apSymbolProps )
         [ +  - ][ +  - ]
                 [ +  - ]
     759                 :            :         {
     760                 :            :             //use main color to fill symbols
     761 [ +  - ][ +  - ]:        296 :             xProp->getPropertyValue( C2U( "Color" ) ) >>= apSymbolProps->FillColor;
         [ +  - ][ #  # ]
     762                 :            :             // border of symbols always same as fill color
     763                 :        296 :             apSymbolProps->BorderColor = apSymbolProps->FillColor;
     764                 :            :         }
     765                 :            :         else
     766                 :          0 :             apSymbolProps.reset();
     767                 :            :     }
     768         [ #  # ]:          0 :     catch(const uno::Exception &e)
     769                 :            :     {
     770                 :            :         ASSERT_EXCEPTION( e );
     771                 :            :     }
     772                 :        296 :     return apSymbolProps;
     773                 :            : }
     774                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     775                 :            : 
     776                 :       2405 : Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const
     777                 :            : {
     778                 :       2405 :     Symbol* pRet=NULL;
     779         [ -  + ]:       2405 :     if( isAttributedDataPoint( index ) )
     780                 :            :     {
     781                 :          0 :         adaptPointCache( index );
     782         [ #  # ]:          0 :         if(!m_apSymbolProperties_AttributedPoint.get())
     783 [ #  # ][ #  # ]:          0 :             m_apSymbolProperties_AttributedPoint = getSymbolPropertiesFromPropertySet( this->getPropertiesOfPoint( index ) );
     784                 :          0 :         pRet = m_apSymbolProperties_AttributedPoint.get();
     785                 :            :         //if a single data point does not have symbols but the dataseries itself has symbols
     786                 :            :         //we create an invisible symbol shape to enable selection of that point
     787 [ #  # ][ #  # ]:          0 :         if( !pRet || pRet->Style == SymbolStyle_NONE )
     788                 :            :         {
     789         [ #  # ]:          0 :             if(!m_apSymbolProperties_Series.get())
     790 [ #  # ][ #  # ]:          0 :                 m_apSymbolProperties_Series = getSymbolPropertiesFromPropertySet( this->getPropertiesOfSeries() );
     791 [ #  # ][ #  # ]:          0 :             if( m_apSymbolProperties_Series.get() && m_apSymbolProperties_Series->Style != SymbolStyle_NONE )
                 [ #  # ]
     792                 :            :             {
     793         [ #  # ]:          0 :                 if(!m_apSymbolProperties_InvisibleSymbolForSelection.get())
     794                 :            :                 {
     795                 :            :                     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     796         [ #  # ]:          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection = ::std::auto_ptr< Symbol >( new Symbol() );
     797                 :            :                     SAL_WNODEPRECATED_DECLARATIONS_POP
     798                 :          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD;
     799                 :          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square
     800                 :          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection->Size = m_apSymbolProperties_Series->Size;
     801                 :          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible
     802                 :          0 :                     m_apSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible
     803                 :            :                 }
     804                 :          0 :                 pRet = m_apSymbolProperties_InvisibleSymbolForSelection.get();
     805                 :            :             }
     806                 :            :         }
     807                 :            :     }
     808                 :            :     else
     809                 :            :     {
     810         [ +  + ]:       2405 :         if(!m_apSymbolProperties_Series.get())
     811 [ +  - ][ +  - ]:        296 :             m_apSymbolProperties_Series = getSymbolPropertiesFromPropertySet( this->getPropertiesOfSeries() );
     812                 :       2405 :         pRet = m_apSymbolProperties_Series.get();
     813                 :            :     }
     814                 :            : 
     815 [ +  - ][ -  + ]:       2405 :     if( pRet && pRet->Style == SymbolStyle_AUTO )
     816                 :            :     {
     817                 :          0 :         pRet->Style = SymbolStyle_STANDARD;
     818                 :            : 
     819                 :          0 :         sal_Int32 nIndex = m_nGlobalSeriesIndex;
     820         [ #  # ]:          0 :         if(m_aValues_X.is())
     821                 :          0 :             nIndex++;
     822                 :          0 :         pRet->StandardSymbol = nIndex;
     823                 :            :     }
     824                 :            : 
     825                 :       2405 :     return pRet;
     826                 :            : }
     827                 :            : 
     828                 :       2538 : uno::Reference< beans::XPropertySet > VDataSeries::getXErrorBarProperties( sal_Int32 index ) const
     829                 :            : {
     830                 :       2538 :     uno::Reference< beans::XPropertySet > xErrorBarProp;
     831                 :            : 
     832         [ +  - ]:       2538 :     uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( index ));
     833         [ +  - ]:       2538 :     if( xPointProp.is() )
     834 [ +  - ][ +  - ]:       2538 :         xPointProp->getPropertyValue( C2U( "ErrorBarX" )) >>= xErrorBarProp;
         [ +  - ][ +  - ]
     835                 :       2538 :     return xErrorBarProp;
     836                 :            : }
     837                 :            : 
     838                 :      13978 : uno::Reference< beans::XPropertySet > VDataSeries::getYErrorBarProperties( sal_Int32 index ) const
     839                 :            : {
     840                 :      13978 :     uno::Reference< beans::XPropertySet > xErrorBarProp;
     841                 :            : 
     842         [ +  - ]:      13978 :     uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( index ));
     843         [ +  - ]:      13978 :     if( xPointProp.is() )
     844 [ +  - ][ +  - ]:      13978 :         xPointProp->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProp;
         [ +  - ][ +  - ]
     845                 :      13978 :     return xErrorBarProp;
     846                 :            : }
     847                 :            : 
     848                 :        187 : bool VDataSeries::hasPointOwnColor( sal_Int32 index ) const
     849                 :            : {
     850         [ +  - ]:        187 :     if( !isAttributedDataPoint(index) )
     851                 :        187 :         return false;
     852                 :            : 
     853                 :            :     try
     854                 :            :     {
     855 [ #  # ][ #  # ]:          0 :         uno::Reference< beans::XPropertyState > xPointState( this->getPropertiesOfPoint(index), uno::UNO_QUERY_THROW );
     856 [ #  # ][ #  # ]:        187 :         return (xPointState->getPropertyState( C2U("Color")) != beans::PropertyState_DEFAULT_VALUE );
         [ #  # ][ #  # ]
     857                 :            :     }
     858                 :          0 :     catch(const uno::Exception& e)
     859                 :            :     {
     860                 :            :         ASSERT_EXCEPTION( e );
     861                 :            :     }
     862                 :          0 :     return false;
     863                 :            : }
     864                 :            : 
     865                 :      76614 : bool VDataSeries::isAttributedDataPoint( sal_Int32 index ) const
     866                 :            : {
     867                 :            :     //returns true if the data point assigned by the given index has set it's own properties
     868 [ +  - ][ -  + ]:      76614 :     if( index>=m_nPointCount || m_nPointCount==0)
     869                 :          0 :         return false;
     870         [ +  + ]:      79786 :     for(sal_Int32 nN=m_aAttributedDataPointIndexList.getLength();nN--;)
     871                 :            :     {
     872         [ +  + ]:       6110 :         if(index==m_aAttributedDataPointIndexList[nN])
     873                 :       2938 :             return true;
     874                 :            :     }
     875                 :      76614 :     return false;
     876                 :            : }
     877                 :            : 
     878                 :       4017 : bool VDataSeries::isVaryColorsByPoint() const
     879                 :            : {
     880                 :       4017 :     bool bVaryColorsByPoint = false;
     881         [ +  - ]:       4017 :     Reference< beans::XPropertySet > xSeriesProp( this->getPropertiesOfSeries() );
     882         [ +  - ]:       4017 :     if( xSeriesProp.is() )
     883 [ +  - ][ +  - ]:       4017 :         xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint;
                 [ +  - ]
     884                 :       4017 :     return bVaryColorsByPoint;
     885                 :            : }
     886                 :            : 
     887                 :      40696 : uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfPoint( sal_Int32 index ) const
     888                 :            : {
     889         [ +  + ]:      40696 :     if( isAttributedDataPoint( index ) )
     890                 :       1962 :         return m_xDataSeries->getDataPointByIndex(index);
     891                 :      40696 :     return this->getPropertiesOfSeries();
     892                 :            : }
     893                 :            : 
     894                 :      47143 : uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfSeries() const
     895                 :            : {
     896                 :      47143 :     return  uno::Reference<beans::XPropertySet>(m_xDataSeries, uno::UNO_QUERY );
     897                 :            : }
     898                 :            : 
     899                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     900                 :       3381 : ::std::auto_ptr< DataPointLabel > getDataPointLabelFromPropertySet(
     901                 :            :         const uno::Reference< beans::XPropertySet >& xProp )
     902                 :            : {
     903                 :       3381 :     ::std::auto_ptr< DataPointLabel > apLabel( new DataPointLabel() );
     904                 :            :     try
     905                 :            :     {
     906 [ +  - ][ +  - ]:       3381 :         if( !(xProp->getPropertyValue( C2U( "Label" ) ) >>= *apLabel) )
                 [ +  - ]
           [ -  +  #  # ]
                 [ +  - ]
     907                 :          0 :             apLabel.reset();
     908                 :            :     }
     909         [ #  # ]:          0 :     catch(const uno::Exception &e)
     910                 :            :     {
     911                 :            :         ASSERT_EXCEPTION( e );
     912                 :            :     }
     913                 :       3381 :     return apLabel;
     914                 :            : }
     915                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     916                 :            : 
     917                 :        732 : void VDataSeries::adaptPointCache( sal_Int32 nNewPointIndex ) const
     918                 :            : {
     919         [ +  + ]:        732 :     if( m_nCurrentAttributedPoint != nNewPointIndex )
     920                 :            :     {
     921                 :        244 :         m_apLabel_AttributedPoint.reset();
     922                 :        244 :         m_apLabelPropNames_AttributedPoint.reset();
     923                 :        244 :         m_apLabelPropValues_AttributedPoint.reset();
     924                 :        244 :         m_apSymbolProperties_AttributedPoint.reset();
     925                 :        244 :         m_nCurrentAttributedPoint = nNewPointIndex;
     926                 :            :     }
     927                 :        732 : }
     928                 :            : 
     929                 :      17512 : DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const
     930                 :            : {
     931                 :      17512 :     DataPointLabel* pRet = NULL;
     932         [ +  + ]:      17512 :     if( isAttributedDataPoint( index ) )
     933                 :            :     {
     934                 :        488 :         adaptPointCache( index );
     935         [ +  + ]:        488 :         if( !m_apLabel_AttributedPoint.get() )
     936         [ +  - ]:        244 :             m_apLabel_AttributedPoint = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
     937                 :        488 :         pRet = m_apLabel_AttributedPoint.get();
     938                 :            :     }
     939                 :            :     else
     940                 :            :     {
     941         [ +  + ]:      17024 :         if(!m_apLabel_Series.get())
     942         [ +  - ]:       3137 :             m_apLabel_Series = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
     943                 :      17024 :         pRet = m_apLabel_Series.get();
     944                 :            :     }
     945         [ -  + ]:      17512 :     if( !m_bAllowPercentValueInDataLabel )
     946                 :            :     {
     947         [ #  # ]:          0 :         if( pRet )
     948                 :          0 :             pRet->ShowNumberInPercent = false;
     949                 :            :     }
     950                 :      17512 :     return pRet;
     951                 :            : }
     952                 :            : 
     953                 :      17512 : DataPointLabel* VDataSeries::getDataPointLabelIfLabel( sal_Int32 index ) const
     954                 :            : {
     955                 :      17512 :     DataPointLabel* pLabel = this->getDataPointLabel( index );
     956 [ +  + ][ +  + ]:      17512 :     if( !pLabel || (!pLabel->ShowNumber && !pLabel->ShowNumberInPercent
         [ +  + ][ +  - ]
     957                 :      11529 :         && !pLabel->ShowCategoryName ) )
     958                 :      11447 :         return 0;
     959                 :      17512 :     return pLabel;
     960                 :            : }
     961                 :            : 
     962                 :       2272 : bool VDataSeries::getTextLabelMultiPropertyLists( sal_Int32 index
     963                 :            :     , tNameSequence*& pPropNames
     964                 :            :     , tAnySequence*& pPropValues ) const
     965                 :            : {
     966                 :       2272 :     pPropNames = NULL; pPropValues = NULL;
     967                 :       2272 :     uno::Reference< beans::XPropertySet > xTextProp;
     968                 :       2272 :     bool bDoDynamicFontResize = false;
     969 [ +  + ][ +  - ]:       2272 :     if( isAttributedDataPoint( index ) )
     970                 :            :     {
     971                 :        244 :         adaptPointCache( index );
     972         [ +  - ]:        244 :         if(!m_apLabelPropValues_AttributedPoint.get())
     973                 :            :         {
     974         [ +  - ]:        244 :             pPropNames = new tNameSequence();
     975         [ +  - ]:        244 :             pPropValues = new tAnySequence();
     976 [ +  - ][ +  - ]:        244 :             xTextProp.set( this->getPropertiesOfPoint( index ));
     977         [ +  - ]:        244 :             PropertyMapper::getTextLabelMultiPropertyLists( xTextProp, *pPropNames, *pPropValues );
     978                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     979         [ +  - ]:        244 :             m_apLabelPropNames_AttributedPoint = ::std::auto_ptr< tNameSequence >(pPropNames);
     980         [ +  - ]:        244 :             m_apLabelPropValues_AttributedPoint = ::std::auto_ptr< tAnySequence >(pPropValues);
     981                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
     982                 :        244 :             bDoDynamicFontResize = true;
     983                 :            :         }
     984                 :        244 :         pPropNames = m_apLabelPropNames_AttributedPoint.get();
     985                 :        244 :         pPropValues = m_apLabelPropValues_AttributedPoint.get();
     986                 :            :     }
     987                 :            :     else
     988                 :            :     {
     989         [ +  + ]:       2028 :         if(!m_apLabelPropValues_Series.get())
     990                 :            :         {
     991         [ +  - ]:        156 :             pPropNames = new tNameSequence();
     992         [ +  - ]:        156 :             pPropValues = new tAnySequence();
     993 [ +  - ][ +  - ]:        156 :             xTextProp.set( this->getPropertiesOfPoint( index ));
     994         [ +  - ]:        156 :             PropertyMapper::getTextLabelMultiPropertyLists( xTextProp, *pPropNames, *pPropValues );
     995                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     996         [ +  - ]:        156 :             m_apLabelPropNames_Series = ::std::auto_ptr< tNameSequence >(pPropNames);
     997         [ +  - ]:        156 :             m_apLabelPropValues_Series = ::std::auto_ptr< tAnySequence >(pPropValues);
     998                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
     999                 :        156 :             bDoDynamicFontResize = true;
    1000                 :            :         }
    1001                 :       2028 :         pPropNames = m_apLabelPropNames_Series.get();
    1002                 :       2028 :         pPropValues = m_apLabelPropValues_Series.get();
    1003                 :            :     }
    1004                 :            : 
    1005 [ +  + ][ +  - ]:       2672 :     if( bDoDynamicFontResize &&
           [ +  -  +  - ]
                 [ +  + ]
    1006                 :            :         pPropNames && pPropValues &&
    1007                 :        400 :         xTextProp.is())
    1008                 :            :     {
    1009         [ +  - ]:        400 :         LabelPositionHelper::doDynamicFontResize( *pPropValues, *pPropNames, xTextProp, m_aReferenceSize );
    1010                 :            :     }
    1011 [ +  - ][ +  - ]:       2272 :     if(pPropNames&&pPropValues)
    1012                 :       2272 :         return true;
    1013                 :       2272 :     return false;
    1014                 :            : }
    1015                 :            : 
    1016                 :       3206 : void VDataSeries::setMissingValueTreatment( sal_Int32 nMissingValueTreatment )
    1017                 :            : {
    1018                 :       3206 :     m_nMissingValueTreatment = nMissingValueTreatment;
    1019                 :       3206 : }
    1020                 :            : 
    1021                 :     113378 : sal_Int32 VDataSeries::getMissingValueTreatment() const
    1022                 :            : {
    1023                 :     113378 :     return m_nMissingValueTreatment;
    1024                 :            : }
    1025                 :            : 
    1026                 :            : //.............................................................................
    1027                 :            : } //namespace chart
    1028                 :            : //.............................................................................
    1029                 :            : 
    1030                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10