LCOV - code coverage report
Current view: top level - chart2/source/model/template - ColumnLineChartTypeTemplate.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 46 169 27.2 %
Date: 2012-08-25 Functions: 12 31 38.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 49 376 13.0 %

           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 "ColumnLineChartTypeTemplate.hxx"
      21                 :            : #include "macros.hxx"
      22                 :            : #include "CommonConverters.hxx"
      23                 :            : #include "DiagramHelper.hxx"
      24                 :            : #include "DataSeriesHelper.hxx"
      25                 :            : #include "servicenames_charttypes.hxx"
      26                 :            : #include "ColumnLineDataInterpreter.hxx"
      27                 :            : #include "ContainerHelper.hxx"
      28                 :            : #include "PropertyHelper.hxx"
      29                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      30                 :            : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      31                 :            : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
      32                 :            : #include <com/sun/star/drawing/LineStyle.hpp>
      33                 :            : 
      34                 :            : #include <algorithm>
      35                 :            : 
      36                 :            : using namespace ::com::sun::star::chart2;
      37                 :            : using namespace ::com::sun::star;
      38                 :            : 
      39                 :            : using ::com::sun::star::uno::Reference;
      40                 :            : using ::com::sun::star::uno::Sequence;
      41                 :            : using ::rtl::OUString;
      42                 :            : using ::com::sun::star::beans::Property;
      43                 :            : using ::com::sun::star::uno::Reference;
      44                 :            : using ::com::sun::star::uno::Any;
      45                 :            : using ::osl::MutexGuard;
      46                 :            : 
      47                 :            : namespace
      48                 :            : {
      49                 :            : 
      50                 :         16 : static const ::rtl::OUString lcl_aServiceName(
      51                 :            :     RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ColumnLineChartTypeTemplate" ));
      52                 :            : 
      53                 :            : enum
      54                 :            : {
      55                 :            :     PROP_COL_LINE_NUMBER_OF_LINES
      56                 :            : };
      57                 :            : 
      58                 :          0 : void lcl_AddPropertiesToVector(
      59                 :            :     ::std::vector< Property > & rOutProperties )
      60                 :            : {
      61                 :            :     rOutProperties.push_back(
      62                 :            :         Property( C2U( "NumberOfLines" ),
      63                 :            :                   PROP_COL_LINE_NUMBER_OF_LINES,
      64         [ #  # ]:          0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
      65                 :            :                   beans::PropertyAttribute::BOUND
      66 [ #  # ][ #  # ]:          0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      67                 :          0 : }
      68                 :            : 
      69                 :            : struct StaticColumnLineChartTypeTemplateDefaults_Initializer
      70                 :            : {
      71                 :          2 :     ::chart::tPropertyValueMap* operator()()
      72                 :            :     {
      73 [ +  - ][ +  - ]:          2 :         static ::chart::tPropertyValueMap aStaticDefaults;
         [ +  - ][ #  # ]
      74                 :          2 :         lcl_AddDefaultsToMap( aStaticDefaults );
      75                 :          2 :         return &aStaticDefaults;
      76                 :            :     }
      77                 :            : private:
      78                 :          2 :     void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
      79                 :            :     {
      80         [ +  - ]:          2 :         ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
      81                 :          2 :     }
      82                 :            : };
      83                 :            : 
      84                 :            : struct StaticColumnLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnLineChartTypeTemplateDefaults_Initializer >
      85                 :            : {
      86                 :            : };
      87                 :            : 
      88                 :            : struct StaticColumnLineChartTypeTemplateInfoHelper_Initializer
      89                 :            : {
      90                 :          0 :     ::cppu::OPropertyArrayHelper* operator()()
      91                 :            :     {
      92 [ #  # ][ #  # ]:          0 :         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      93                 :          0 :         return &aPropHelper;
      94                 :            :     }
      95                 :            : 
      96                 :            : private:
      97                 :          0 :     uno::Sequence< Property > lcl_GetPropertySequence()
      98                 :            :     {
      99         [ #  # ]:          0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
     100         [ #  # ]:          0 :         lcl_AddPropertiesToVector( aProperties );
     101                 :            : 
     102                 :            :         ::std::sort( aProperties.begin(), aProperties.end(),
     103         [ #  # ]:          0 :                      ::chart::PropertyNameLess() );
     104                 :            : 
     105         [ #  # ]:          0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
     106                 :            :     }
     107                 :            : 
     108                 :            : };
     109                 :            : 
     110                 :            : struct StaticColumnLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnLineChartTypeTemplateInfoHelper_Initializer >
     111                 :            : {
     112                 :            : };
     113                 :            : 
     114                 :            : struct StaticColumnLineChartTypeTemplateInfo_Initializer
     115                 :            : {
     116                 :          0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
     117                 :            :     {
     118                 :            :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
     119 [ #  # ][ #  # ]:          0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnLineChartTypeTemplateInfoHelper::get() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     120                 :          0 :         return &xPropertySetInfo;
     121                 :            :     }
     122                 :            : };
     123                 :            : 
     124                 :            : struct StaticColumnLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnLineChartTypeTemplateInfo_Initializer >
     125                 :            : {
     126                 :            : };
     127                 :            : 
     128                 :            : } // anonymous namespace
     129                 :            : 
     130                 :            : namespace chart
     131                 :            : {
     132                 :            : 
     133                 :         30 : ColumnLineChartTypeTemplate::ColumnLineChartTypeTemplate(
     134                 :            :     Reference<
     135                 :            :         uno::XComponentContext > const & xContext,
     136                 :            :     const ::rtl::OUString & rServiceName,
     137                 :            :     StackMode eStackMode,
     138                 :            :     sal_Int32 nNumberOfLines ) :
     139                 :            :         ChartTypeTemplate( xContext, rServiceName ),
     140                 :            :         ::property::OPropertySet( m_aMutex ),
     141 [ +  - ][ +  - ]:         30 :         m_eStackMode( eStackMode )
     142                 :            : {
     143 [ +  - ][ +  - ]:         30 :     setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::makeAny( nNumberOfLines ));
     144                 :         30 : }
     145                 :            : 
     146 [ +  - ][ +  - ]:         30 : ColumnLineChartTypeTemplate::~ColumnLineChartTypeTemplate()
     147         [ -  + ]:         60 : {}
     148                 :            : 
     149                 :            : // ____ OPropertySet ____
     150                 :         30 : uno::Any ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
     151                 :            :     throw(beans::UnknownPropertyException)
     152                 :            : {
     153         [ +  - ]:         30 :     const tPropertyValueMap& rStaticDefaults = *StaticColumnLineChartTypeTemplateDefaults::get();
     154         [ +  - ]:         30 :     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
     155         [ -  + ]:         30 :     if( aFound == rStaticDefaults.end() )
     156                 :          0 :         return uno::Any();
     157                 :         30 :     return (*aFound).second;
     158                 :            : }
     159                 :            : 
     160                 :          0 : ::cppu::IPropertyArrayHelper & SAL_CALL ColumnLineChartTypeTemplate::getInfoHelper()
     161                 :            : {
     162                 :          0 :     return *StaticColumnLineChartTypeTemplateInfoHelper::get();
     163                 :            : }
     164                 :            : 
     165                 :            : // ____ XPropertySet ____
     166                 :          0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnLineChartTypeTemplate::getPropertySetInfo()
     167                 :            :     throw (uno::RuntimeException)
     168                 :            : {
     169                 :          0 :     return *StaticColumnLineChartTypeTemplateInfo::get();
     170                 :            : }
     171                 :            : 
     172                 :          0 : void ColumnLineChartTypeTemplate::createChartTypes(
     173                 :            :     const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
     174                 :            :     const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
     175                 :            :     const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
     176                 :            : {
     177   [ #  #  #  # ]:          0 :     if( rCoordSys.getLength() == 0 ||
                 [ #  # ]
     178                 :          0 :         ! rCoordSys[0].is() )
     179                 :          0 :         return;
     180                 :            : 
     181                 :            :     try
     182                 :            :     {
     183                 :            :         Reference< lang::XMultiServiceFactory > xFact(
     184 [ #  # ][ #  # ]:          0 :             GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     185         [ #  # ]:          0 :         Sequence< Reference< XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
     186                 :          0 :         sal_Int32 nNumberOfSeries = aFlatSeriesSeq.getLength();
     187                 :          0 :         sal_Int32 nNumberOfLines = 0;
     188                 :          0 :         sal_Int32 nNumberOfColumns = 0;
     189                 :            : 
     190         [ #  # ]:          0 :         getFastPropertyValue( PROP_COL_LINE_NUMBER_OF_LINES ) >>= nNumberOfLines;
     191                 :            :         OSL_ENSURE( nNumberOfLines>=0, "number of lines should be not negative" );
     192         [ #  # ]:          0 :         if( nNumberOfLines < 0 )
     193                 :          0 :             nNumberOfLines = 0;
     194                 :            : 
     195         [ #  # ]:          0 :         if( nNumberOfLines >= nNumberOfSeries )
     196                 :            :         {
     197         [ #  # ]:          0 :             if( nNumberOfSeries > 0 )
     198                 :            :             {
     199                 :          0 :                 nNumberOfLines = nNumberOfSeries - 1;
     200                 :          0 :                 nNumberOfColumns = 1;
     201                 :            :             }
     202                 :            :             else
     203                 :          0 :                 nNumberOfLines = 0;
     204                 :            :         }
     205                 :            :         else
     206                 :          0 :             nNumberOfColumns = nNumberOfSeries - nNumberOfLines;
     207                 :            : 
     208                 :            :         // Columns
     209                 :            :         // -------
     210                 :            :         Reference< XChartType > xCT(
     211 [ #  # ][ #  # ]:          0 :             xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     212                 :            : 
     213         [ #  # ]:          0 :         ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aOldChartTypesSeq, xCT );
     214                 :            : 
     215         [ #  # ]:          0 :         Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
     216 [ #  # ][ #  # ]:          0 :         xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
         [ #  # ][ #  # ]
     217                 :            : 
     218         [ #  # ]:          0 :         if( nNumberOfColumns > 0 )
     219                 :            :         {
     220         [ #  # ]:          0 :             Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
     221         [ #  # ]:          0 :             Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns );
     222                 :            :             ::std::copy( aFlatSeriesSeq.getConstArray(),
     223                 :          0 :                          aFlatSeriesSeq.getConstArray() + nNumberOfColumns,
     224   [ #  #  #  # ]:          0 :                          aColumnSeq.getArray());
     225 [ #  # ][ #  # ]:          0 :             xDSCnt->setDataSeries( aColumnSeq );
                 [ #  # ]
     226                 :            :         }
     227                 :            : 
     228                 :            :         // Lines
     229                 :            :         // -----
     230 [ #  # ][ #  # ]:          0 :         xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     231         [ #  # ]:          0 :         xCTCnt.set( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
     232 [ #  # ][ #  # ]:          0 :         xCTCnt->addChartType( xCT );
     233                 :            : 
     234         [ #  # ]:          0 :         if( nNumberOfLines > 0 )
     235                 :            :         {
     236         [ #  # ]:          0 :             Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
     237         [ #  # ]:          0 :             Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
     238                 :          0 :             ::std::copy( aFlatSeriesSeq.getConstArray() + nNumberOfColumns,
     239                 :          0 :                          aFlatSeriesSeq.getConstArray() + aFlatSeriesSeq.getLength(),
     240   [ #  #  #  # ]:          0 :                          aLineSeq.getArray());
     241 [ #  # ][ #  # ]:          0 :             xDSCnt->setDataSeries( aLineSeq );
                 [ #  # ]
     242 [ #  # ][ #  # ]:          0 :         }
     243                 :            :     }
     244                 :          0 :     catch( const uno::Exception & ex )
     245                 :            :     {
     246                 :            :         ASSERT_EXCEPTION( ex );
     247                 :            :     }
     248                 :            : }
     249                 :            : 
     250                 :          0 : void SAL_CALL ColumnLineChartTypeTemplate::applyStyle(
     251                 :            :     const Reference< chart2::XDataSeries >& xSeries,
     252                 :            :     ::sal_Int32 nChartTypeIndex,
     253                 :            :     ::sal_Int32 nSeriesIndex,
     254                 :            :     ::sal_Int32 nSeriesCount )
     255                 :            :     throw (uno::RuntimeException)
     256                 :            : {
     257                 :          0 :     ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
     258                 :            : 
     259         [ #  # ]:          0 :     if( nChartTypeIndex==0 ) // columns
     260                 :            :     {
     261 [ #  # ][ #  # ]:          0 :         DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
                 [ #  # ]
     262                 :            :     }
     263         [ #  # ]:          0 :     else if( nChartTypeIndex==1 ) // lines
     264                 :            :     {
     265         [ #  # ]:          0 :         Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
     266         [ #  # ]:          0 :         if( xProp.is() )
     267                 :            :         {
     268         [ #  # ]:          0 :             DataSeriesHelper::switchLinesOnOrOff( xProp, true );
     269         [ #  # ]:          0 :             DataSeriesHelper::switchSymbolsOnOrOff( xProp, false, nSeriesIndex );
     270         [ #  # ]:          0 :             DataSeriesHelper::makeLinesThickOrThin( xProp, true );
     271                 :          0 :         }
     272                 :            :     }
     273                 :          0 : }
     274                 :            : 
     275                 :          0 : StackMode ColumnLineChartTypeTemplate::getStackMode( sal_Int32 nChartTypeIndex ) const
     276                 :            : {
     277         [ #  # ]:          0 :     if( nChartTypeIndex == 0 )
     278                 :          0 :         return m_eStackMode;
     279                 :          0 :     return StackMode_NONE;
     280                 :            : }
     281                 :            : 
     282                 :            : // ____ XChartTypeTemplate ____
     283                 :         30 : sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
     284                 :            :     const uno::Reference< XDiagram >& xDiagram,
     285                 :            :     sal_Bool bAdaptProperties )
     286                 :            :     throw (uno::RuntimeException)
     287                 :            : {
     288                 :         30 :     sal_Bool bResult = sal_False;
     289                 :            : 
     290         [ -  + ]:         30 :     if( ! xDiagram.is())
     291                 :          0 :         return bResult;
     292                 :            : 
     293                 :            :     try
     294                 :            :     {
     295                 :         30 :         Reference< chart2::XChartType > xColumnChartType;
     296                 :         30 :         Reference< XCoordinateSystem > xColumnChartCooSys;
     297                 :         30 :         Reference< chart2::XChartType > xLineChartType;
     298                 :         30 :         sal_Int32 nNumberOfChartTypes = 0;
     299                 :            : 
     300                 :            :         Reference< XCoordinateSystemContainer > xCooSysCnt(
     301         [ +  - ]:         30 :             xDiagram, uno::UNO_QUERY_THROW );
     302                 :            :         Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
     303 [ +  - ][ +  - ]:         30 :             xCooSysCnt->getCoordinateSystems());
     304         [ +  + ]:         60 :         for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
     305                 :            :         {
     306 [ +  - ][ +  - ]:         30 :             Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
     307 [ +  - ][ +  - ]:         30 :             Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
     308         [ +  + ]:         60 :             for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
     309                 :            :             {
     310 [ +  - ][ +  - ]:         30 :                 if( aChartTypeSeq[j].is())
     311                 :            :                 {
     312                 :         30 :                     ++nNumberOfChartTypes;
     313         [ +  - ]:         30 :                     if( nNumberOfChartTypes > 2 )
     314                 :            :                         break;
     315 [ +  - ][ +  - ]:         30 :                     OUString aCTService = aChartTypeSeq[j]->getChartType();
                 [ +  - ]
     316 [ +  - ][ -  + ]:         30 :                     if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
     317                 :            :                     {
     318 [ #  # ][ #  # ]:          0 :                         xColumnChartType.set( aChartTypeSeq[j] );
     319 [ #  # ][ #  # ]:          0 :                         xColumnChartCooSys.set( aCooSysSeq[i] );
     320                 :            :                     }
     321 [ +  - ][ +  + ]:         30 :                     else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
     322 [ +  - ][ +  - ]:         30 :                         xLineChartType.set( aChartTypeSeq[j] );
     323                 :            :                 }
     324                 :            :             }
     325         [ -  + ]:         30 :             if( nNumberOfChartTypes > 2 )
     326                 :            :                 break;
     327 [ +  - ][ -  + ]:         30 :         }
                 [ +  - ]
     328                 :            : 
     329   [ -  +  #  #  :         30 :         if( nNumberOfChartTypes == 2 &&
           #  # ][ -  + ]
     330                 :          0 :             xColumnChartType.is() &&
     331                 :          0 :             xLineChartType.is())
     332                 :            :         {
     333                 :            :             OSL_ASSERT( xColumnChartCooSys.is());
     334                 :            : 
     335                 :            :             // check stackmode of bars
     336 [ #  # ][ #  # ]:          0 :             bResult = (xColumnChartCooSys->getDimension() == getDimension());
                 [ #  # ]
     337         [ #  # ]:          0 :             if( bResult )
     338                 :            :             {
     339                 :          0 :                 bool bFound=false;
     340                 :          0 :                 bool bAmbiguous=false;
     341                 :            :                 bResult = ( DiagramHelper::getStackModeFromChartType(
     342                 :            :                                 xColumnChartType, bFound, bAmbiguous,
     343         [ #  # ]:          0 :                                 xColumnChartCooSys )
     344         [ #  # ]:          0 :                             == getStackMode( 0 ) );
     345                 :            : 
     346 [ #  # ][ #  # ]:          0 :                 if( bResult && bAdaptProperties )
     347                 :            :                 {
     348         [ #  # ]:          0 :                     Reference< XDataSeriesContainer > xSeriesContainer( xLineChartType, uno::UNO_QUERY );
     349         [ #  # ]:          0 :                     if( xSeriesContainer.is() )
     350                 :            :                     {
     351 [ #  # ][ #  # ]:          0 :                         sal_Int32 nNumberOfLines = xSeriesContainer->getDataSeries().getLength();
                 [ #  # ]
     352 [ #  # ][ #  # ]:          0 :                         setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::makeAny( nNumberOfLines ));
     353                 :          0 :                     }
     354                 :            :                 }
     355                 :            :             }
     356 [ +  - ][ #  # ]:         30 :         }
     357                 :            :     }
     358                 :          0 :     catch( const uno::Exception & ex )
     359                 :            :     {
     360                 :            :         ASSERT_EXCEPTION( ex );
     361                 :            :     }
     362                 :            : 
     363                 :         30 :     return bResult;
     364                 :            : }
     365                 :            : 
     366                 :          0 : Reference< chart2::XChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
     367                 :            : {
     368                 :          0 :     Reference< chart2::XChartType > xCT;
     369                 :            :     Reference< lang::XMultiServiceFactory > xFact(
     370 [ #  # ][ #  # ]:          0 :             GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     371         [ #  # ]:          0 :     if(xFact.is())
     372                 :            :     {
     373         [ #  # ]:          0 :         if( nChartTypeIndex == 0 )
     374 [ #  # ][ #  # ]:          0 :             xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     375                 :            :         else
     376 [ #  # ][ #  # ]:          0 :             xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     377                 :            :     }
     378                 :          0 :     return xCT;
     379                 :            : }
     380                 :            : 
     381                 :          0 : Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNewSeries(
     382                 :            :         const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
     383                 :            :     throw (uno::RuntimeException)
     384                 :            : {
     385                 :          0 :     Reference< chart2::XChartType > xResult;
     386                 :            : 
     387                 :            :     try
     388                 :            :     {
     389                 :            :         Reference< lang::XMultiServiceFactory > xFact(
     390 [ #  # ][ #  # ]:          0 :             GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     391         [ #  # ]:          0 :         xResult.set( xFact->createInstance(
     392 [ #  # ][ #  # ]:          0 :                          CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     393 [ #  # ][ #  # ]:          0 :         ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
     394                 :            :     }
     395         [ #  # ]:          0 :     catch( const uno::Exception & ex )
     396                 :            :     {
     397                 :            :         ASSERT_EXCEPTION( ex );
     398                 :            :     }
     399                 :            : 
     400                 :          0 :     return xResult;
     401                 :            : }
     402                 :            : 
     403                 :          0 : Reference< XDataInterpreter > SAL_CALL ColumnLineChartTypeTemplate::getDataInterpreter()
     404                 :            :     throw (uno::RuntimeException)
     405                 :            : {
     406         [ #  # ]:          0 :     if( ! m_xDataInterpreter.is())
     407                 :            :     {
     408                 :          0 :         sal_Int32 nNumberOfLines = 1;
     409         [ #  # ]:          0 :         getFastPropertyValue( PROP_COL_LINE_NUMBER_OF_LINES ) >>= nNumberOfLines;
     410 [ #  # ][ #  # ]:          0 :         m_xDataInterpreter.set( new ColumnLineDataInterpreter( nNumberOfLines, GetComponentContext() ) );
         [ #  # ][ #  # ]
     411                 :            :     }
     412                 :            :     else
     413                 :            :     {
     414                 :            :         //todo...
     415                 :            :         OSL_FAIL( "number of lines may not be valid anymore in the datainterpreter" );
     416                 :            : 
     417                 :            :     }
     418                 :            : 
     419                 :          0 :     return m_xDataInterpreter;
     420                 :            : }
     421                 :            : 
     422                 :            : // ----------------------------------------
     423                 :            : 
     424                 :          0 : uno::Sequence< ::rtl::OUString > ColumnLineChartTypeTemplate::getSupportedServiceNames_Static()
     425                 :            : {
     426                 :          0 :     uno::Sequence< ::rtl::OUString > aServices( 2 );
     427         [ #  # ]:          0 :     aServices[ 0 ] = lcl_aServiceName;
     428 [ #  # ][ #  # ]:          0 :     aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
     429                 :          0 :     return aServices;
     430                 :            : }
     431                 :            : 
     432                 :            : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     433 [ #  # ][ #  # ]:          0 : APPHELPER_XSERVICEINFO_IMPL( ColumnLineChartTypeTemplate, lcl_aServiceName );
         [ #  # ][ #  # ]
                 [ #  # ]
     434                 :            : 
     435 [ -  + ][ #  # ]:        240 : IMPLEMENT_FORWARD_XINTERFACE2( ColumnLineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
     436 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ColumnLineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
                 [ #  # ]
     437                 :            : 
     438 [ +  - ][ +  - ]:         48 : } //  namespace chart
     439                 :            : 
     440                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10