LCOV - code coverage report
Current view: top level - chart2/source/model/template - BubbleChartType.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 70 20.0 %
Date: 2012-08-25 Functions: 6 22 27.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 120 5.8 %

           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 "BubbleChartType.hxx"
      21                 :            : #include "PropertyHelper.hxx"
      22                 :            : #include "macros.hxx"
      23                 :            : #include "servicenames_charttypes.hxx"
      24                 :            : #include "ContainerHelper.hxx"
      25                 :            : #include "CartesianCoordinateSystem.hxx"
      26                 :            : #include "AxisHelper.hxx"
      27                 :            : #include "AxisIndexDefines.hxx"
      28                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      29                 :            : #include <com/sun/star/chart2/AxisType.hpp>
      30                 :            : #include <com/sun/star/chart2/CurveStyle.hpp>
      31                 :            : 
      32                 :            : using namespace ::com::sun::star;
      33                 :            : 
      34                 :            : using ::rtl::OUString;
      35                 :            : using ::com::sun::star::beans::Property;
      36                 :            : using ::com::sun::star::uno::Sequence;
      37                 :            : using ::com::sun::star::uno::Reference;
      38                 :            : using ::com::sun::star::uno::Any;
      39                 :            : using ::osl::MutexGuard;
      40                 :            : 
      41                 :            : namespace
      42                 :            : {
      43                 :            : 
      44                 :          0 : void lcl_AddPropertiesToVector(
      45                 :            :     ::std::vector< Property > & /*rOutProperties*/ )
      46                 :            : {
      47                 :          0 : }
      48                 :            : 
      49                 :            : struct StaticBubbleChartTypeDefaults_Initializer
      50                 :            : {
      51                 :          0 :     ::chart::tPropertyValueMap* operator()()
      52                 :            :     {
      53 [ #  # ][ #  # ]:          0 :         static ::chart::tPropertyValueMap aStaticDefaults;
         [ #  # ][ #  # ]
      54                 :          0 :         return &aStaticDefaults;
      55                 :            :     }
      56                 :            : };
      57                 :            : 
      58                 :            : struct StaticBubbleChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeDefaults_Initializer >
      59                 :            : {
      60                 :            : };
      61                 :            : 
      62                 :            : struct StaticBubbleChartTypeInfoHelper_Initializer
      63                 :            : {
      64                 :          0 :     ::cppu::OPropertyArrayHelper* operator()()
      65                 :            :     {
      66 [ #  # ][ #  # ]:          0 :         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      67                 :          0 :         return &aPropHelper;
      68                 :            :     }
      69                 :            : 
      70                 :            : private:
      71                 :          0 :     Sequence< Property > lcl_GetPropertySequence()
      72                 :            :     {
      73         [ #  # ]:          0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
      74                 :          0 :         lcl_AddPropertiesToVector( aProperties );
      75                 :            : 
      76                 :            :         ::std::sort( aProperties.begin(), aProperties.end(),
      77         [ #  # ]:          0 :                      ::chart::PropertyNameLess() );
      78                 :            : 
      79         [ #  # ]:          0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
      80                 :            :     }
      81                 :            : };
      82                 :            : 
      83                 :            : struct StaticBubbleChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeInfoHelper_Initializer >
      84                 :            : {
      85                 :            : };
      86                 :            : 
      87                 :            : struct StaticBubbleChartTypeInfo_Initializer
      88                 :            : {
      89                 :          0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
      90                 :            :     {
      91                 :            :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
      92 [ #  # ][ #  # ]:          0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeInfoHelper::get() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      93                 :          0 :         return &xPropertySetInfo;
      94                 :            :     }
      95                 :            : };
      96                 :            : 
      97                 :            : struct StaticBubbleChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeInfo_Initializer >
      98                 :            : {
      99                 :            : };
     100                 :            : 
     101                 :            : } // anonymous namespace
     102                 :            : 
     103                 :            : namespace chart
     104                 :            : {
     105                 :            : 
     106                 :        177 : BubbleChartType::BubbleChartType(
     107                 :            :     const uno::Reference< uno::XComponentContext > & xContext )
     108                 :        177 :     : ChartType( xContext )
     109                 :            : {
     110                 :        177 : }
     111                 :            : 
     112                 :          0 : BubbleChartType::BubbleChartType( const BubbleChartType & rOther ) :
     113                 :          0 :         ChartType( rOther )
     114                 :            : {
     115                 :          0 : }
     116                 :            : 
     117                 :        177 : BubbleChartType::~BubbleChartType()
     118         [ -  + ]:        354 : {}
     119                 :            : 
     120                 :            : // ____ XCloneable ____
     121                 :          0 : uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
     122                 :            :     throw (uno::RuntimeException)
     123                 :            : {
     124 [ #  # ][ #  # ]:          0 :     return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
     125                 :            : }
     126                 :            : 
     127                 :            : // ____ XChartType ____
     128                 :            : Reference< chart2::XCoordinateSystem > SAL_CALL
     129                 :          0 :     BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
     130                 :            :     throw (lang::IllegalArgumentException,
     131                 :            :            uno::RuntimeException)
     132                 :            : {
     133                 :            :     Reference< chart2::XCoordinateSystem > xResult(
     134                 :            :         new CartesianCoordinateSystem(
     135 [ #  # ][ #  # ]:          0 :             GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
                 [ #  # ]
     136                 :            : 
     137         [ #  # ]:          0 :     for( sal_Int32 i=0; i<DimensionCount; ++i )
     138                 :            :     {
     139 [ #  # ][ #  # ]:          0 :         Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
     140         [ #  # ]:          0 :         if( !xAxis.is() )
     141                 :            :         {
     142                 :            :             OSL_FAIL("a created coordinate system should have an axis for each dimension");
     143                 :          0 :             continue;
     144                 :            :         }
     145                 :            : 
     146 [ #  # ][ #  # ]:          0 :         chart2::ScaleData aScaleData = xAxis->getScaleData();
     147                 :          0 :         aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
     148 [ #  # ][ #  # ]:          0 :         aScaleData.Scaling = AxisHelper::createLinearScaling();
     149                 :            : 
     150         [ #  # ]:          0 :         if( i == 2  )
     151                 :          0 :             aScaleData.AxisType = chart2::AxisType::SERIES;
     152                 :            :         else
     153                 :          0 :             aScaleData.AxisType = chart2::AxisType::REALNUMBER;
     154                 :            : 
     155 [ #  # ][ #  # ]:          0 :         xAxis->setScaleData( aScaleData );
     156 [ #  # ][ #  # ]:          0 :     }
     157                 :            : 
     158                 :          0 :     return xResult;
     159                 :            : }
     160                 :            : 
     161                 :        354 : ::rtl::OUString SAL_CALL BubbleChartType::getChartType()
     162                 :            :     throw (uno::RuntimeException)
     163                 :            : {
     164                 :        354 :     return CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
     165                 :            : }
     166                 :            : 
     167                 :          0 : uno::Sequence< ::rtl::OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
     168                 :            :     throw (uno::RuntimeException)
     169                 :            : {
     170                 :          0 :     uno::Sequence< ::rtl::OUString > aMandRolesSeq(4);
     171         [ #  # ]:          0 :     aMandRolesSeq.realloc( 4 );
     172 [ #  # ][ #  # ]:          0 :     aMandRolesSeq[0] = C2U( "label" );
     173 [ #  # ][ #  # ]:          0 :     aMandRolesSeq[1] = C2U( "values-x" );
     174 [ #  # ][ #  # ]:          0 :     aMandRolesSeq[2] = C2U( "values-y" );
     175 [ #  # ][ #  # ]:          0 :     aMandRolesSeq[3] = C2U( "values-size" );
     176                 :          0 :     return aMandRolesSeq;
     177                 :            : }
     178                 :            : 
     179                 :          0 : OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
     180                 :            :     throw (uno::RuntimeException)
     181                 :            : {
     182                 :          0 :     return C2U( "values-size" );
     183                 :            : }
     184                 :            : 
     185                 :            : // ____ OPropertySet ____
     186                 :          0 : uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const
     187                 :            :     throw(beans::UnknownPropertyException)
     188                 :            : {
     189         [ #  # ]:          0 :     const tPropertyValueMap& rStaticDefaults = *StaticBubbleChartTypeDefaults::get();
     190         [ #  # ]:          0 :     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
     191         [ #  # ]:          0 :     if( aFound == rStaticDefaults.end() )
     192                 :          0 :         return uno::Any();
     193                 :          0 :     return (*aFound).second;
     194                 :            : }
     195                 :            : 
     196                 :            : // ____ OPropertySet ____
     197                 :          0 : ::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
     198                 :            : {
     199                 :          0 :     return *StaticBubbleChartTypeInfoHelper::get();
     200                 :            : }
     201                 :            : 
     202                 :            : // ____ XPropertySet ____
     203                 :          0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartType::getPropertySetInfo()
     204                 :            :     throw (uno::RuntimeException)
     205                 :            : {
     206                 :          0 :     return *StaticBubbleChartTypeInfo::get();
     207                 :            : }
     208                 :            : 
     209                 :          9 : uno::Sequence< ::rtl::OUString > BubbleChartType::getSupportedServiceNames_Static()
     210                 :            : {
     211                 :          9 :     uno::Sequence< ::rtl::OUString > aServices( 3 );
     212 [ +  - ][ +  - ]:          9 :     aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
     213 [ +  - ][ +  - ]:          9 :     aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
     214 [ +  - ][ +  - ]:          9 :     aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
     215                 :          9 :     return aServices;
     216                 :            : }
     217                 :            : 
     218                 :            : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     219 [ #  # ][ #  # ]:         77 : APPHELPER_XSERVICEINFO_IMPL( BubbleChartType,
         [ #  # ][ #  # ]
                 [ #  # ]
     220                 :            :                              C2U( "com.sun.star.comp.chart.BubbleChartType" ));
     221                 :            : 
     222                 :            : } //  namespace chart
     223                 :            : 
     224                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10