LCOV - code coverage report
Current view: top level - chart2/source/model/template - BubbleChartTypeTemplate.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 17 59 28.8 %
Date: 2015-06-13 12:38:46 Functions: 9 22 40.9 %
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 "BubbleChartTypeTemplate.hxx"
      21             : #include "macros.hxx"
      22             : #include "BubbleDataInterpreter.hxx"
      23             : #include "CartesianCoordinateSystem.hxx"
      24             : #include "Scaling.hxx"
      25             : #include "DiagramHelper.hxx"
      26             : #include "servicenames_charttypes.hxx"
      27             : #include "ContainerHelper.hxx"
      28             : #include "DataSeriesHelper.hxx"
      29             : #include <com/sun/star/drawing/LineStyle.hpp>
      30             : #include "PropertyHelper.hxx"
      31             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      32             : 
      33             : #include <algorithm>
      34             : 
      35             : using namespace ::com::sun::star;
      36             : 
      37             : using ::com::sun::star::uno::Reference;
      38             : using ::com::sun::star::uno::Sequence;
      39             : using ::com::sun::star::beans::Property;
      40             : using ::com::sun::star::uno::Any;
      41             : using ::osl::MutexGuard;
      42             : 
      43             : namespace
      44             : {
      45             : 
      46             : struct StaticBubbleChartTypeTemplateDefaults_Initializer
      47             : {
      48           0 :     ::chart::tPropertyValueMap* operator()()
      49             :     {
      50           0 :         static ::chart::tPropertyValueMap aStaticDefaults;
      51           0 :         return &aStaticDefaults;
      52             :     }
      53             : };
      54             : 
      55             : struct StaticBubbleChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeTemplateDefaults_Initializer >
      56             : {
      57             : };
      58             : 
      59             : struct StaticBubbleChartTypeTemplateInfoHelper_Initializer
      60             : {
      61           0 :     ::cppu::OPropertyArrayHelper* operator()()
      62             :     {
      63           0 :         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
      64           0 :         return &aPropHelper;
      65             :     }
      66             : 
      67             : private:
      68           0 :     static Sequence< Property > lcl_GetPropertySequence()
      69             :     {
      70           0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
      71             : 
      72             :         ::std::sort( aProperties.begin(), aProperties.end(),
      73           0 :                      ::chart::PropertyNameLess() );
      74             : 
      75           0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
      76             :     }
      77             : 
      78             : };
      79             : 
      80             : struct StaticBubbleChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeTemplateInfoHelper_Initializer >
      81             : {
      82             : };
      83             : 
      84             : struct StaticBubbleChartTypeTemplateInfo_Initializer
      85             : {
      86           0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
      87             :     {
      88             :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
      89           0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeTemplateInfoHelper::get() ) );
      90           0 :         return &xPropertySetInfo;
      91             :     }
      92             : };
      93             : 
      94             : struct StaticBubbleChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeTemplateInfo_Initializer >
      95             : {
      96             : };
      97             : 
      98             : } // anonymous namespace
      99             : 
     100             : namespace chart
     101             : {
     102             : 
     103        2516 : BubbleChartTypeTemplate::BubbleChartTypeTemplate(
     104             :     Reference<
     105             :         uno::XComponentContext > const & xContext,
     106             :     const OUString & rServiceName ) :
     107             :         ChartTypeTemplate( xContext, rServiceName ),
     108        2516 :         ::property::OPropertySet( m_aMutex )
     109             : {
     110        2516 : }
     111             : 
     112        5032 : BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
     113        5032 : {}
     114             : 
     115             : // ____ OPropertySet ____
     116           0 : uno::Any BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
     117             :     throw(beans::UnknownPropertyException)
     118             : {
     119           0 :     const tPropertyValueMap& rStaticDefaults = *StaticBubbleChartTypeTemplateDefaults::get();
     120           0 :     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
     121           0 :     if( aFound == rStaticDefaults.end() )
     122           0 :         return uno::Any();
     123           0 :     return (*aFound).second;
     124             : }
     125             : 
     126           0 : ::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
     127             : {
     128           0 :     return *StaticBubbleChartTypeTemplateInfoHelper::get();
     129             : }
     130             : 
     131             : // ____ XPropertySet ____
     132           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartTypeTemplate::getPropertySetInfo()
     133             :     throw (uno::RuntimeException, std::exception)
     134             : {
     135           0 :     return *StaticBubbleChartTypeTemplateInfo::get();
     136             : }
     137             : 
     138        2516 : sal_Int32 BubbleChartTypeTemplate::getDimension() const
     139             : {
     140        2516 :     return 2;
     141             : }
     142             : 
     143           1 : StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
     144             : {
     145           1 :     return StackMode_NONE;
     146             : }
     147             : 
     148           0 : void SAL_CALL BubbleChartTypeTemplate::applyStyle(
     149             :     const Reference< chart2::XDataSeries >& xSeries,
     150             :     ::sal_Int32 nChartTypeIndex,
     151             :     ::sal_Int32 nSeriesIndex,
     152             :     ::sal_Int32 nSeriesCount )
     153             :     throw (uno::RuntimeException, std::exception)
     154             : {
     155           0 :     ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
     156           0 :     DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::makeAny( drawing::LineStyle_NONE ) );
     157           0 : }
     158             : 
     159             : // ____ XChartTypeTemplate ____
     160           0 : sal_Bool SAL_CALL BubbleChartTypeTemplate::supportsCategories()
     161             :     throw (uno::RuntimeException, std::exception)
     162             : {
     163           0 :     return false;
     164             : }
     165             : 
     166           0 : Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
     167             : {
     168           0 :     Reference< chart2::XChartType > xResult;
     169             : 
     170             :     try
     171             :     {
     172             :         Reference< lang::XMultiServiceFactory > xFact(
     173           0 :             GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
     174           0 :         xResult.set( xFact->createInstance(
     175           0 :                          CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
     176             :     }
     177           0 :     catch( const uno::Exception & ex )
     178             :     {
     179             :         ASSERT_EXCEPTION( ex );
     180             :     }
     181             : 
     182           0 :     return xResult;
     183             : }
     184             : 
     185        2516 : Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeForNewSeries(
     186             :         const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
     187             :     throw (uno::RuntimeException, std::exception)
     188             : {
     189        2516 :     Reference< chart2::XChartType > xResult;
     190             : 
     191             :     try
     192             :     {
     193             :         Reference< lang::XMultiServiceFactory > xFact(
     194        2516 :             GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
     195        2516 :         xResult.set( xFact->createInstance(
     196        2516 :                          CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
     197             : 
     198        2516 :         ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
     199             :     }
     200           0 :     catch( const uno::Exception & ex )
     201             :     {
     202             :         ASSERT_EXCEPTION( ex );
     203             :     }
     204             : 
     205        2516 :     return xResult;
     206             : }
     207             : 
     208           0 : Reference< chart2::XDataInterpreter > SAL_CALL BubbleChartTypeTemplate::getDataInterpreter()
     209             :     throw (uno::RuntimeException, std::exception)
     210             : {
     211           0 :     if( ! m_xDataInterpreter.is())
     212           0 :         m_xDataInterpreter.set( new BubbleDataInterpreter( GetComponentContext()) );
     213             : 
     214           0 :     return m_xDataInterpreter;
     215             : }
     216             : 
     217       20130 : IMPLEMENT_FORWARD_XINTERFACE2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
     218           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
     219             : 
     220             : } //  namespace chart
     221             : 
     222             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11