LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/chart2/source/model/template - NetChartType.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 57 33.3 %
Date: 2013-07-09 Functions: 8 21 38.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "NetChartType.hxx"
      21             : #include "PropertyHelper.hxx"
      22             : #include "macros.hxx"
      23             : #include "PolarCoordinateSystem.hxx"
      24             : #include "servicenames_charttypes.hxx"
      25             : #include "ContainerHelper.hxx"
      26             : #include "AxisIndexDefines.hxx"
      27             : #include "AxisHelper.hxx"
      28             : 
      29             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      30             : #include <com/sun/star/chart2/AxisType.hpp>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::com::sun::star::chart2;
      34             : 
      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 chart
      42             : {
      43             : 
      44         188 : NetChartType_Base::NetChartType_Base(
      45             :     const uno::Reference< uno::XComponentContext > & xContext ) :
      46         188 :         ChartType( xContext )
      47         188 : {}
      48             : 
      49           0 : NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
      50           0 :         ChartType( rOther )
      51             : {
      52           0 : }
      53             : 
      54         188 : NetChartType_Base::~NetChartType_Base()
      55         188 : {}
      56             : 
      57             : Reference< XCoordinateSystem > SAL_CALL
      58           0 :     NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
      59             :     throw (lang::IllegalArgumentException,
      60             :            uno::RuntimeException)
      61             : {
      62           0 :     if( DimensionCount != 2 )
      63             :         throw lang::IllegalArgumentException(
      64             :             "NetChart must be two-dimensional",
      65           0 :             static_cast< ::cppu::OWeakObject* >( this ), 0 );
      66             : 
      67             :     Reference< XCoordinateSystem > xResult(
      68             :         new PolarCoordinateSystem(
      69           0 :             GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
      70             : 
      71           0 :     Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) );
      72           0 :     if( xAxis.is() )
      73             :     {
      74           0 :         ScaleData aScaleData = xAxis->getScaleData();
      75           0 :         aScaleData.Scaling = AxisHelper::createLinearScaling();
      76           0 :         aScaleData.AxisType = AxisType::CATEGORY;
      77           0 :         aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
      78           0 :         xAxis->setScaleData( aScaleData );
      79             :     }
      80             : 
      81           0 :     xAxis = xResult->getAxisByDimension( 1, MAIN_AXIS_INDEX );
      82           0 :     if( xAxis.is() )
      83             :     {
      84           0 :         ScaleData aScaleData = xAxis->getScaleData();
      85           0 :         aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
      86           0 :         aScaleData.AxisType = AxisType::REALNUMBER;
      87           0 :         xAxis->setScaleData( aScaleData );
      88             :     }
      89             : 
      90           0 :     return xResult;
      91             : }
      92             : 
      93             : // ____ OPropertySet ____
      94           0 : uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const
      95             :     throw(beans::UnknownPropertyException)
      96             : {
      97           0 :     return uno::Any();
      98             : }
      99             : 
     100             : namespace
     101             : {
     102             : 
     103             : struct StaticNetChartTypeInfoHelper_Initializer
     104             : {
     105           0 :     ::cppu::OPropertyArrayHelper* operator()()
     106             :     {
     107             :         // using assignment for broken gcc 3.3
     108             :         static ::cppu::OPropertyArrayHelper aPropHelper = ::cppu::OPropertyArrayHelper(
     109           0 :             Sequence< beans::Property >() );
     110           0 :         return &aPropHelper;
     111             :     }
     112             : };
     113             : 
     114             : struct StaticNetChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticNetChartTypeInfoHelper_Initializer >
     115             : {
     116             : };
     117             : 
     118             : struct StaticNetChartTypeInfo_Initializer
     119             : {
     120           0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
     121             :     {
     122             :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
     123           0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticNetChartTypeInfoHelper::get() ) );
     124           0 :         return &xPropertySetInfo;
     125             :     }
     126             : };
     127             : 
     128             : struct StaticNetChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticNetChartTypeInfo_Initializer >
     129             : {
     130             : };
     131             : 
     132             : }
     133             : 
     134             : // ____ OPropertySet ____
     135           0 : ::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
     136             : {
     137           0 :     return *StaticNetChartTypeInfoHelper::get();
     138             : }
     139             : 
     140             : // ____ XPropertySet ____
     141           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL NetChartType_Base::getPropertySetInfo()
     142             :     throw (uno::RuntimeException)
     143             : {
     144           0 :     return *StaticNetChartTypeInfo::get();
     145             : }
     146             : 
     147             : //-----------------------------------------------------------------------------
     148             : 
     149         132 : NetChartType::NetChartType(
     150             :     const uno::Reference< uno::XComponentContext > & xContext ) :
     151         132 :         NetChartType_Base( xContext )
     152         132 : {}
     153             : 
     154           0 : NetChartType::NetChartType( const NetChartType & rOther ) :
     155           0 :         NetChartType_Base( rOther )
     156             : {
     157           0 : }
     158             : 
     159         264 : NetChartType::~NetChartType()
     160         264 : {}
     161             : 
     162             : // ____ XCloneable ____
     163           0 : uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
     164             :     throw (uno::RuntimeException)
     165             : {
     166           0 :     return uno::Reference< util::XCloneable >( new NetChartType( *this ));
     167             : }
     168             : 
     169             : // ____ XChartType ____
     170         264 : OUString SAL_CALL NetChartType::getChartType()
     171             :     throw (uno::RuntimeException)
     172             : {
     173         264 :     return CHART2_SERVICE_NAME_CHARTTYPE_NET;
     174             : }
     175             : 
     176           3 : uno::Sequence< OUString > NetChartType::getSupportedServiceNames_Static()
     177             : {
     178           3 :     uno::Sequence< OUString > aServices( 3 );
     179           3 :     aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_NET;
     180           3 :     aServices[ 1 ] = "com.sun.star.chart2.ChartType";
     181           3 :     aServices[ 2 ] = "com.sun.star.beans.PropertySet";
     182           3 :     return aServices;
     183             : }
     184             : 
     185             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     186          69 : APPHELPER_XSERVICEINFO_IMPL( NetChartType,
     187             :                              OUString("com.sun.star.comp.chart.NetChartType") );
     188             : 
     189             : } //  namespace chart
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10