LCOV - code coverage report
Current view: top level - chart2/source/model/template - GL3DBarChartType.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 29 48 60.4 %
Date: 2014-04-11 Functions: 10 19 52.6 %
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             : 
      10             : #include "GL3DBarChartType.hxx"
      11             : #include <servicenames_charttypes.hxx>
      12             : #include <PropertyHelper.hxx>
      13             : #include <unonames.hxx>
      14             : 
      15             : #include <com/sun/star/beans/Property.hpp>
      16             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      17             : 
      18             : using namespace com::sun::star;
      19             : 
      20             : namespace chart {
      21             : 
      22             : namespace {
      23             : 
      24             : enum
      25             : {
      26             :     PROP_GL3DCHARTTYPE_ROUNDED_EDGE
      27             : };
      28             : 
      29             : struct DefaultsInitializer
      30             : {
      31           5 :     tPropertyValueMap* operator()()
      32             :     {
      33           5 :         static tPropertyValueMap aStaticDefaults;
      34             : 
      35           5 :         if (aStaticDefaults.empty())
      36           5 :             addDefaults(aStaticDefaults);
      37             : 
      38           5 :         return &aStaticDefaults;
      39             :     }
      40             : private:
      41             : 
      42           5 :     void addDefaults( tPropertyValueMap & rOutMap )
      43             :     {
      44           5 :         PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
      45           5 :     }
      46             : };
      47             : 
      48             : struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
      49             : 
      50             : struct InfoHelperInitializer
      51             : {
      52           5 :     cppu::OPropertyArrayHelper* operator()()
      53             :     {
      54           5 :         static cppu::OPropertyArrayHelper aHelper(getProperties());
      55           5 :         return &aHelper;
      56             :     }
      57             : 
      58           5 :     uno::Sequence<beans::Property> getProperties()
      59             :     {
      60           5 :         uno::Sequence<beans::Property> aRet(1);
      61             : 
      62          15 :         aRet[0] = beans::Property(
      63             :             CHART_UNONAME_ROUNDED_EDGE,
      64             :             PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
      65           5 :             ::getCppuBooleanType(),
      66           5 :             beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
      67             : 
      68           5 :         return aRet;
      69             :     }
      70             : };
      71             : 
      72             : struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
      73             : 
      74             : struct ChartTypeInfoInitializer
      75             : {
      76           0 :     uno::Reference<beans::XPropertySetInfo>* operator()()
      77             :     {
      78           0 :         static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
      79             : 
      80           0 :         if (!xPropertySetInfo.is())
      81           0 :             xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
      82             : 
      83           0 :         return &xPropertySetInfo;
      84             :     }
      85             : };
      86             : 
      87             : struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
      88             : 
      89             : }
      90             : 
      91        2534 : GL3DBarChartType::GL3DBarChartType( const uno::Reference<uno::XComponentContext>& xContext ) :
      92        2534 :     ChartType(xContext)
      93             : {
      94        2534 : }
      95             : 
      96           0 : GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
      97           0 :     ChartType(rOther)
      98             : {
      99           0 : }
     100             : 
     101        5068 : GL3DBarChartType::~GL3DBarChartType() {}
     102             : 
     103           0 : APPHELPER_XSERVICEINFO_IMPL(
     104             :     GL3DBarChartType, OUString("com.sun.star.comp.chart.GL3DBarChartType") );
     105             : 
     106           0 : uno::Sequence<OUString> GL3DBarChartType::getSupportedServiceNames_Static()
     107             : {
     108           0 :     uno::Sequence<OUString> aServices(3);
     109           0 :     aServices[0] = CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR;
     110           0 :     aServices[1] = "com.sun.star.chart2.ChartType";
     111           0 :     aServices[2] = "com.sun.star.beans.PropertySet";
     112           0 :     return aServices;
     113             : }
     114             : 
     115        2534 : OUString SAL_CALL GL3DBarChartType::getChartType()
     116             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     117             : {
     118        2534 :     return CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR;
     119             : }
     120             : 
     121             : com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
     122           0 : GL3DBarChartType::createClone()
     123             :     throw (com::sun::star::uno::RuntimeException, std::exception)
     124             : {
     125           0 :     return uno::Reference<util::XCloneable>(new GL3DBarChartType(*this));
     126             : }
     127             : 
     128        2534 : css::uno::Any GL3DBarChartType::GetDefaultValue( sal_Int32 nHandle ) const
     129             :     throw (css::beans::UnknownPropertyException)
     130             : {
     131        2534 :     const tPropertyValueMap& rDefaults = *Defaults::get();
     132        2534 :     tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
     133        2534 :     return it == rDefaults.end() ? uno::Any() : it->second;
     134             : }
     135             : 
     136        5068 : cppu::IPropertyArrayHelper& GL3DBarChartType::getInfoHelper()
     137             : {
     138        5068 :     return *InfoHelper::get();
     139             : }
     140             : 
     141           0 : css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartType::getPropertySetInfo()
     142             :     throw (css::uno::RuntimeException, std::exception)
     143             : {
     144           0 :     return *ChartTypeInfo::get();
     145             : }
     146             : 
     147             : }
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10