[Libreoffice-commits] core.git: Branch 'private/kohei/new-chart-type-skeleton' - 2 commits - chart2/source udkapi/com

Kohei Yoshida kohei.yoshida at collabora.com
Wed Mar 26 11:29:47 PDT 2014


 chart2/source/model/template/GL3DBarChartType.cxx |   92 ++++++++++++++++++++++
 chart2/source/model/template/GL3DBarChartType.hxx |   19 +++-
 udkapi/com/sun/star/beans/PropertyAttribute.idl   |    4 
 3 files changed, 109 insertions(+), 6 deletions(-)

New commits:
commit 70a7d8f880d6f161df17f0c0eedc8be0c051c80b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Mar 26 14:28:19 2014 -0400

    Add a boolean "RoundedRectangle" property to the GL 3D chart.
    
    Change-Id: I3cb23461718c5713c1e76d0b37d92b3e7849d13b

diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
index 033c38c..7b94095 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 ee9d0ab..c5da45c 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);
 };
 
 }
commit d8dd155b141d6aefd878dbf9b256f401b9e5a40d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Mar 26 13:15:08 2014 -0400

    Close those <p> tags.
    
    Change-Id: I72ba74164e660bfbe496cc63b98e397ee1e2425c

diff --git a/udkapi/com/sun/star/beans/PropertyAttribute.idl b/udkapi/com/sun/star/beans/PropertyAttribute.idl
index 5ab1de9..a75f4af 100644
--- a/udkapi/com/sun/star/beans/PropertyAttribute.idl
+++ b/udkapi/com/sun/star/beans/PropertyAttribute.idl
@@ -30,7 +30,7 @@ published constants PropertyAttribute
 
     /** indicates that a property value can be void.
 
-        <p>It does not mean that the type of the property is void!
+        <p>It does not mean that the type of the property is void!</p>
      */
     const short MAYBEVOID = 1;
 
@@ -85,7 +85,7 @@ published constants PropertyAttribute
 
         <p>This attribute is not of interest for concrete property
         implementations. It's needed for property specifications inside
-        service specifications in UNOIDL.
+        service specifications in UNOIDL.</p>
 
         @see com::sun::star::reflection::XPropertyTypeDescription
         @see com::sun::star::reflection::XServiceTypeDescription


More information about the Libreoffice-commits mailing list