summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-26 14:28:19 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-26 23:14:57 -0400
commite1823a9f8abc8907f155215bc5f5280d06c41d82 (patch)
treefe64af99c79140d4f751dac9a7d66c40055818ae /chart2
parent1f5659fcd1928cd82c6f57331f1147049b40bce8 (diff)
Add a boolean "RoundedRectangle" property to the GL 3D chart.
Change-Id: I3cb23461718c5713c1e76d0b37d92b3e7849d13b
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/model/template/GL3DBarChartType.cxx92
-rw-r--r--chart2/source/model/template/GL3DBarChartType.hxx19
2 files changed, 107 insertions, 4 deletions
diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
index 033c38c4a2b4..7b94095f7fb3 100644
--- a/chart2/source/model/template/GL3DBarChartType.cxx
+++ b/chart2/source/model/template/GL3DBarChartType.cxx
@@ -9,11 +9,84 @@
#include "GL3DBarChartType.hxx"
#include <servicenames_charttypes.hxx>
+#include <PropertyHelper.hxx>
+
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace com::sun::star;
namespace chart {
+namespace {
+
+enum
+{
+ PROP_GL3DCHARTTYPE_ROUNDED_RECTANGLE
+};
+
+struct DefaultsInitializer
+{
+ tPropertyValueMap* operator()()
+ {
+ static tPropertyValueMap aStaticDefaults;
+
+ if (aStaticDefaults.empty())
+ addDefaults(aStaticDefaults);
+
+ return &aStaticDefaults;
+ }
+private:
+
+ void addDefaults( tPropertyValueMap & rOutMap )
+ {
+ PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_RECTANGLE, false);
+ }
+};
+
+struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
+
+struct InfoHelperInitializer
+{
+ cppu::OPropertyArrayHelper* operator()()
+ {
+ static cppu::OPropertyArrayHelper aHelper(getProperties());
+ return &aHelper;
+ }
+
+ uno::Sequence<beans::Property> getProperties()
+ {
+ uno::Sequence<beans::Property> aRet(1);
+
+ aRet[0] = beans::Property(
+ "RoundedRectangle",
+ PROP_GL3DCHARTTYPE_ROUNDED_RECTANGLE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
+
+ return aRet;
+ }
+};
+
+struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
+
+struct ChartTypeInfoInitializer
+{
+ uno::Reference<beans::XPropertySetInfo>* operator()()
+ {
+ static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
+
+ if (!xPropertySetInfo.is())
+ xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
+
+ return &xPropertySetInfo;
+ }
+};
+
+struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
+
+}
+
GL3DBarChartType::GL3DBarChartType( const uno::Reference<uno::XComponentContext>& xContext ) :
ChartType(xContext)
{
@@ -50,6 +123,25 @@ GL3DBarChartType::createClone()
return uno::Reference<util::XCloneable>(new GL3DBarChartType(*this));
}
+css::uno::Any GL3DBarChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw (css::beans::UnknownPropertyException)
+{
+ const tPropertyValueMap& rDefaults = *Defaults::get();
+ tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
+ return it == rDefaults.end() ? uno::Any() : it->second;
+}
+
+cppu::IPropertyArrayHelper& GL3DBarChartType::getInfoHelper()
+{
+ return *InfoHelper::get();
+}
+
+css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartType::getPropertySetInfo()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return *ChartTypeInfo::get();
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartType.hxx b/chart2/source/model/template/GL3DBarChartType.hxx
index ee9d0ab69b50..c5da45c70072 100644
--- a/chart2/source/model/template/GL3DBarChartType.hxx
+++ b/chart2/source/model/template/GL3DBarChartType.hxx
@@ -33,11 +33,22 @@ protected:
GL3DBarChartType( const GL3DBarChartType& rOther );
virtual OUString SAL_CALL getChartType()
- throw (com::sun::star::uno::RuntimeException, std::exception);
+ throw (css::uno::RuntimeException, std::exception);
- virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
- SAL_CALL createClone()
- throw (com::sun::star::uno::RuntimeException, std::exception);
+ virtual css::uno::Reference<css::util::XCloneable> SAL_CALL
+ createClone()
+ throw (css::uno::RuntimeException, std::exception);
+
+ // OPropertySet
+ virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw (css::beans::UnknownPropertyException);
+
+ virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
+ getPropertySetInfo()
+ throw (css::uno::RuntimeException, std::exception);
};
}