Kaydet (Commit) e1823a9f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Add a boolean "RoundedRectangle" property to the GL 3D chart.

Change-Id: I3cb23461718c5713c1e76d0b37d92b3e7849d13b
üst 1f5659fc
......@@ -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: */
......@@ -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);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment