LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/model/template - NetChartType.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 57 1.8 %
Date: 2012-12-17 Functions: 1 21 4.8 %
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 ::rtl::OUString;
      36             : using ::com::sun::star::beans::Property;
      37             : using ::com::sun::star::uno::Sequence;
      38             : using ::com::sun::star::uno::Reference;
      39             : using ::com::sun::star::uno::Any;
      40             : using ::osl::MutexGuard;
      41             : 
      42             : namespace chart
      43             : {
      44             : 
      45           0 : NetChartType_Base::NetChartType_Base(
      46             :     const uno::Reference< uno::XComponentContext > & xContext ) :
      47           0 :         ChartType( xContext )
      48           0 : {}
      49             : 
      50           0 : NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
      51           0 :         ChartType( rOther )
      52             : {
      53           0 : }
      54             : 
      55           0 : NetChartType_Base::~NetChartType_Base()
      56           0 : {}
      57             : 
      58             : Reference< XCoordinateSystem > SAL_CALL
      59           0 :     NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
      60             :     throw (lang::IllegalArgumentException,
      61             :            uno::RuntimeException)
      62             : {
      63           0 :     if( DimensionCount != 2 )
      64             :         throw lang::IllegalArgumentException(
      65             :             C2U( "NetChart must be two-dimensional" ),
      66           0 :             static_cast< ::cppu::OWeakObject* >( this ), 0 );
      67             : 
      68             :     Reference< XCoordinateSystem > xResult(
      69             :         new PolarCoordinateSystem(
      70           0 :             GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
      71             : 
      72           0 :     Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) );
      73           0 :     if( xAxis.is() )
      74             :     {
      75           0 :         ScaleData aScaleData = xAxis->getScaleData();
      76           0 :         aScaleData.Scaling = AxisHelper::createLinearScaling();
      77           0 :         aScaleData.AxisType = AxisType::CATEGORY;
      78           0 :         aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
      79           0 :         xAxis->setScaleData( aScaleData );
      80             :     }
      81             : 
      82           0 :     xAxis = xResult->getAxisByDimension( 1, MAIN_AXIS_INDEX );
      83           0 :     if( xAxis.is() )
      84             :     {
      85           0 :         ScaleData aScaleData = xAxis->getScaleData();
      86           0 :         aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
      87           0 :         aScaleData.AxisType = AxisType::REALNUMBER;
      88           0 :         xAxis->setScaleData( aScaleData );
      89             :     }
      90             : 
      91           0 :     return xResult;
      92             : }
      93             : 
      94             : // ____ OPropertySet ____
      95           0 : uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const
      96             :     throw(beans::UnknownPropertyException)
      97             : {
      98           0 :     return uno::Any();
      99             : }
     100             : 
     101             : namespace
     102             : {
     103             : 
     104             : struct StaticNetChartTypeInfoHelper_Initializer
     105             : {
     106           0 :     ::cppu::OPropertyArrayHelper* operator()()
     107             :     {
     108             :         // using assignment for broken gcc 3.3
     109             :         static ::cppu::OPropertyArrayHelper aPropHelper = ::cppu::OPropertyArrayHelper(
     110           0 :             Sequence< beans::Property >() );
     111           0 :         return &aPropHelper;
     112             :     }
     113             : };
     114             : 
     115             : struct StaticNetChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticNetChartTypeInfoHelper_Initializer >
     116             : {
     117             : };
     118             : 
     119             : struct StaticNetChartTypeInfo_Initializer
     120             : {
     121           0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
     122             :     {
     123             :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
     124           0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticNetChartTypeInfoHelper::get() ) );
     125           0 :         return &xPropertySetInfo;
     126             :     }
     127             : };
     128             : 
     129             : struct StaticNetChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticNetChartTypeInfo_Initializer >
     130             : {
     131             : };
     132             : 
     133             : }
     134             : 
     135             : // ____ OPropertySet ____
     136           0 : ::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
     137             : {
     138           0 :     return *StaticNetChartTypeInfoHelper::get();
     139             : }
     140             : 
     141             : // ____ XPropertySet ____
     142           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL NetChartType_Base::getPropertySetInfo()
     143             :     throw (uno::RuntimeException)
     144             : {
     145           0 :     return *StaticNetChartTypeInfo::get();
     146             : }
     147             : 
     148             : //-----------------------------------------------------------------------------
     149             : 
     150           0 : NetChartType::NetChartType(
     151             :     const uno::Reference< uno::XComponentContext > & xContext ) :
     152           0 :         NetChartType_Base( xContext )
     153           0 : {}
     154             : 
     155           0 : NetChartType::NetChartType( const NetChartType & rOther ) :
     156           0 :         NetChartType_Base( rOther )
     157             : {
     158           0 : }
     159             : 
     160           0 : NetChartType::~NetChartType()
     161           0 : {}
     162             : 
     163             : // ____ XCloneable ____
     164           0 : uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
     165             :     throw (uno::RuntimeException)
     166             : {
     167           0 :     return uno::Reference< util::XCloneable >( new NetChartType( *this ));
     168             : }
     169             : 
     170             : // ____ XChartType ____
     171           0 : ::rtl::OUString SAL_CALL NetChartType::getChartType()
     172             :     throw (uno::RuntimeException)
     173             : {
     174           0 :     return CHART2_SERVICE_NAME_CHARTTYPE_NET;
     175             : }
     176             : 
     177           0 : uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static()
     178             : {
     179           0 :     uno::Sequence< ::rtl::OUString > aServices( 3 );
     180           0 :     aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_NET;
     181           0 :     aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
     182           0 :     aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
     183           0 :     return aServices;
     184             : }
     185             : 
     186             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     187          12 : APPHELPER_XSERVICEINFO_IMPL( NetChartType,
     188             :                              C2U( "com.sun.star.comp.chart.NetChartType" ));
     189             : 
     190             : } //  namespace chart
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10