fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / model / template / GL3DBarChartType.cxx
blobb4dbd06cfaf9781199cc30b7c0c7dd26fb875ce2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include "GL3DBarChartType.hxx"
11 #include <servicenames_charttypes.hxx>
12 #include <PropertyHelper.hxx>
13 #include <unonames.hxx>
14 #include <cppuhelper/supportsservice.hxx>
16 #include <com/sun/star/beans/Property.hpp>
17 #include <com/sun/star/beans/PropertyAttribute.hpp>
19 using namespace com::sun::star;
21 namespace chart {
23 namespace {
25 enum
27 PROP_GL3DCHARTTYPE_ROUNDED_EDGE
30 struct DefaultsInitializer
32 tPropertyValueMap* operator()()
34 static tPropertyValueMap aStaticDefaults;
36 if (aStaticDefaults.empty())
37 addDefaults(aStaticDefaults);
39 return &aStaticDefaults;
41 private:
43 static void addDefaults( tPropertyValueMap & rOutMap )
45 PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
49 struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
51 struct InfoHelperInitializer
53 cppu::OPropertyArrayHelper* operator()()
55 static cppu::OPropertyArrayHelper aHelper(getProperties());
56 return &aHelper;
59 static uno::Sequence<beans::Property> getProperties()
61 uno::Sequence<beans::Property> aRet(1);
63 aRet[0] = beans::Property(
64 CHART_UNONAME_ROUNDED_EDGE,
65 PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
66 cppu::UnoType<bool>::get(),
67 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
69 return aRet;
73 struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
75 struct ChartTypeInfoInitializer
77 uno::Reference<beans::XPropertySetInfo>* operator()()
79 static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
81 if (!xPropertySetInfo.is())
82 xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
84 return &xPropertySetInfo;
88 struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
92 GL3DBarChartType::GL3DBarChartType( const uno::Reference<uno::XComponentContext>& xContext ) :
93 ChartType(xContext)
97 GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
98 ChartType(rOther)
102 GL3DBarChartType::~GL3DBarChartType() {}
104 OUString SAL_CALL GL3DBarChartType::getImplementationName()
105 throw( css::uno::RuntimeException, std::exception )
107 return getImplementationName_Static();
110 OUString GL3DBarChartType::getImplementationName_Static()
112 return OUString("com.sun.star.comp.chart.GL3DBarChartType");
115 sal_Bool SAL_CALL GL3DBarChartType::supportsService( const OUString& rServiceName )
116 throw( css::uno::RuntimeException, std::exception )
118 return cppu::supportsService(this, rServiceName);
121 css::uno::Sequence< OUString > SAL_CALL GL3DBarChartType::getSupportedServiceNames()
122 throw( css::uno::RuntimeException, std::exception )
124 return getSupportedServiceNames_Static();
127 uno::Sequence<OUString> GL3DBarChartType::getSupportedServiceNames_Static()
129 uno::Sequence<OUString> aServices(3);
130 aServices[0] = CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR;
131 aServices[1] = "com.sun.star.chart2.ChartType";
132 aServices[2] = "com.sun.star.beans.PropertySet";
133 return aServices;
136 OUString SAL_CALL GL3DBarChartType::getChartType()
137 throw (::com::sun::star::uno::RuntimeException, std::exception)
139 return OUString(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR);
142 uno::Sequence<OUString> GL3DBarChartType::getSupportedPropertyRoles()
143 throw (::com::sun::star::uno::RuntimeException, std::exception)
145 uno::Sequence< OUString > aPropRoles(1);
146 aPropRoles[0] = "FillColor";
148 return aPropRoles;
151 com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
152 GL3DBarChartType::createClone()
153 throw (com::sun::star::uno::RuntimeException, std::exception)
155 return uno::Reference<util::XCloneable>(new GL3DBarChartType(*this));
158 css::uno::Any GL3DBarChartType::GetDefaultValue( sal_Int32 nHandle ) const
159 throw (css::beans::UnknownPropertyException)
161 const tPropertyValueMap& rDefaults = *Defaults::get();
162 tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
163 return it == rDefaults.end() ? uno::Any() : it->second;
166 cppu::IPropertyArrayHelper& GL3DBarChartType::getInfoHelper()
168 return *InfoHelper::get();
171 css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartType::getPropertySetInfo()
172 throw (css::uno::RuntimeException, std::exception)
174 return *ChartTypeInfo::get();
179 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
180 com_sun_star_comp_chart_GL3DBarChartType_get_implementation(css::uno::XComponentContext *context,
181 css::uno::Sequence<css::uno::Any> const &)
183 return cppu::acquire(new ::chart::GL3DBarChartType(context));
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */