LCOV - code coverage report
Current view: top level - chart2/source/model/template - GL3DBarChartType.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 43 61 70.5 %
Date: 2015-06-13 12:38:46 Functions: 15 21 71.4 %
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             : #include <cppuhelper/supportsservice.hxx>
      15             : 
      16             : #include <com/sun/star/beans/Property.hpp>
      17             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      18             : 
      19             : using namespace com::sun::star;
      20             : 
      21             : namespace chart {
      22             : 
      23             : namespace {
      24             : 
      25             : enum
      26             : {
      27             :     PROP_GL3DCHARTTYPE_ROUNDED_EDGE
      28             : };
      29             : 
      30             : struct DefaultsInitializer
      31             : {
      32           7 :     tPropertyValueMap* operator()()
      33             :     {
      34           7 :         static tPropertyValueMap aStaticDefaults;
      35             : 
      36           7 :         if (aStaticDefaults.empty())
      37           7 :             addDefaults(aStaticDefaults);
      38             : 
      39           7 :         return &aStaticDefaults;
      40             :     }
      41             : private:
      42             : 
      43           7 :     static void addDefaults( tPropertyValueMap & rOutMap )
      44             :     {
      45           7 :         PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
      46           7 :     }
      47             : };
      48             : 
      49             : struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
      50             : 
      51             : struct InfoHelperInitializer
      52             : {
      53           7 :     cppu::OPropertyArrayHelper* operator()()
      54             :     {
      55           7 :         static cppu::OPropertyArrayHelper aHelper(getProperties());
      56           7 :         return &aHelper;
      57             :     }
      58             : 
      59           7 :     static uno::Sequence<beans::Property> getProperties()
      60             :     {
      61           7 :         uno::Sequence<beans::Property> aRet(1);
      62             : 
      63          21 :         aRet[0] = beans::Property(
      64             :             CHART_UNONAME_ROUNDED_EDGE,
      65             :             PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
      66           7 :             cppu::UnoType<bool>::get(),
      67           7 :             beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
      68             : 
      69           7 :         return aRet;
      70             :     }
      71             : };
      72             : 
      73             : struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
      74             : 
      75             : struct ChartTypeInfoInitializer
      76             : {
      77           0 :     uno::Reference<beans::XPropertySetInfo>* operator()()
      78             :     {
      79           0 :         static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
      80             : 
      81           0 :         if (!xPropertySetInfo.is())
      82           0 :             xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
      83             : 
      84           0 :         return &xPropertySetInfo;
      85             :     }
      86             : };
      87             : 
      88             : struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
      89             : 
      90             : }
      91             : 
      92        3581 : GL3DBarChartType::GL3DBarChartType( const uno::Reference<uno::XComponentContext>& xContext ) :
      93        3581 :     ChartType(xContext)
      94             : {
      95        3581 : }
      96             : 
      97           0 : GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
      98           0 :     ChartType(rOther)
      99             : {
     100           0 : }
     101             : 
     102        7162 : GL3DBarChartType::~GL3DBarChartType() {}
     103             : 
     104           1 : OUString SAL_CALL GL3DBarChartType::getImplementationName()
     105             :     throw( css::uno::RuntimeException, std::exception )
     106             : {
     107           1 :     return getImplementationName_Static();
     108             : }
     109             : 
     110           1 : OUString GL3DBarChartType::getImplementationName_Static()
     111             : {
     112           1 :     return OUString("com.sun.star.comp.chart.GL3DBarChartType");
     113             : }
     114             : 
     115           0 : sal_Bool SAL_CALL GL3DBarChartType::supportsService( const OUString& rServiceName )
     116             :     throw( css::uno::RuntimeException, std::exception )
     117             : {
     118           0 :     return cppu::supportsService(this, rServiceName);
     119             : }
     120             : 
     121           1 : css::uno::Sequence< OUString > SAL_CALL GL3DBarChartType::getSupportedServiceNames()
     122             :     throw( css::uno::RuntimeException, std::exception )
     123             : {
     124           1 :     return getSupportedServiceNames_Static();
     125             : }
     126             : 
     127           1 : uno::Sequence<OUString> GL3DBarChartType::getSupportedServiceNames_Static()
     128             : {
     129           1 :     uno::Sequence<OUString> aServices(3);
     130           1 :     aServices[0] = CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR;
     131           1 :     aServices[1] = "com.sun.star.chart2.ChartType";
     132           1 :     aServices[2] = "com.sun.star.beans.PropertySet";
     133           1 :     return aServices;
     134             : }
     135             : 
     136        3580 : OUString SAL_CALL GL3DBarChartType::getChartType()
     137             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     138             : {
     139        3580 :     return OUString(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR);
     140             : }
     141             : 
     142           0 : uno::Sequence<OUString> GL3DBarChartType::getSupportedPropertyRoles()
     143             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     144             : {
     145           0 :     uno::Sequence< OUString > aPropRoles(1);
     146           0 :     aPropRoles[0] = "FillColor";
     147             : 
     148           0 :     return aPropRoles;
     149             : }
     150             : 
     151             : com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
     152           0 : GL3DBarChartType::createClone()
     153             :     throw (com::sun::star::uno::RuntimeException, std::exception)
     154             : {
     155           0 :     return uno::Reference<util::XCloneable>(new GL3DBarChartType(*this));
     156             : }
     157             : 
     158        3580 : css::uno::Any GL3DBarChartType::GetDefaultValue( sal_Int32 nHandle ) const
     159             :     throw (css::beans::UnknownPropertyException)
     160             : {
     161        3580 :     const tPropertyValueMap& rDefaults = *Defaults::get();
     162        3580 :     tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
     163        3580 :     return it == rDefaults.end() ? uno::Any() : it->second;
     164             : }
     165             : 
     166        7160 : cppu::IPropertyArrayHelper& GL3DBarChartType::getInfoHelper()
     167             : {
     168        7160 :     return *InfoHelper::get();
     169             : }
     170             : 
     171           0 : css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartType::getPropertySetInfo()
     172             :     throw (css::uno::RuntimeException, std::exception)
     173             : {
     174           0 :     return *ChartTypeInfo::get();
     175             : }
     176             : 
     177             : }
     178             : 
     179             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     180           1 : com_sun_star_comp_chart_GL3DBarChartType_get_implementation(css::uno::XComponentContext *context,
     181             :         css::uno::Sequence<css::uno::Any> const &)
     182             : {
     183           1 :     return cppu::acquire(new ::chart::GL3DBarChartType(context));
     184             : }
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11