summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-27 22:04:28 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-29 00:47:20 -0400
commitef15c946998af91a88896d29903cb997a5e78ede (patch)
treebb9c418097901050c8ee16441a376f7bdaab748d /chart2/source/model
parent91e1497abc4fd2817b56eb1e77ddd8fd2691a199 (diff)
Trying to move this RoundedEdge property from Diagram to GL3DBarChartType.
Then things stop working. Go figure. Change-Id: I38893b20104537a64d279063c7b7dd708efb0d2f
Diffstat (limited to 'chart2/source/model')
-rw-r--r--chart2/source/model/main/Diagram.cxx10
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.cxx119
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.hxx20
3 files changed, 134 insertions, 15 deletions
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 6c75a3f8170c..f6beaa4150cf 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -77,8 +77,7 @@ enum
PROP_DIAGRAM_DATATABLEHBORDER,
PROP_DIAGRAM_DATATABLEVBORDER,
PROP_DIAGRAM_DATATABLEOUTLINE,
- PROP_DIAGRAM_EXTERNALDATA,
- PROP_DIAGRAM_ROUNDED_EDGE
+ PROP_DIAGRAM_EXTERNALDATA
};
void lcl_AddPropertiesToVector(
@@ -199,12 +198,6 @@ void lcl_AddPropertiesToVector(
PROP_DIAGRAM_EXTERNALDATA,
::getCppuType( reinterpret_cast< const OUString * >(0)),
beans::PropertyAttribute::MAYBEVOID ));
-
- rOutProperties.push_back(
- Property( CHART_UNONAME_ROUNDED_EDGE,
- PROP_DIAGRAM_ROUNDED_EDGE,
- ::getCppuBooleanType(),
- beans::PropertyAttribute::MAYBEVOID));
}
struct StaticDiagramDefaults_Initializer
@@ -227,7 +220,6 @@ private:
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEHBORDER, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEVBORDER, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEOUTLINE, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_ROUNDED_EDGE, false );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
::chart::SceneProperties::AddDefaultsToMap( rOutMap );
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
index 7f07028dc704..163423a1e562 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -11,14 +11,90 @@
#include "GL3DBarChartType.hxx"
#include <servicenames_charttypes.hxx>
+#include <PropertyHelper.hxx>
+#include <DiagramHelper.hxx>
+#include <unonames.hxx>
#include <macros.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_EDGE
+};
+
+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_EDGE, 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(
+ CHART_UNONAME_ROUNDED_EDGE,
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
+ ::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> {};
+
+}
+
GL3DBarChartTypeTemplate::GL3DBarChartTypeTemplate(
const uno::Reference<uno::XComponentContext>& xContext, const OUString& rServiceName ) :
+ property::OPropertySet(m_aMutex),
ChartTypeTemplate(xContext, rServiceName) {}
GL3DBarChartTypeTemplate::~GL3DBarChartTypeTemplate() {}
@@ -33,6 +109,13 @@ uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForInde
GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
+
+ uno::Reference<beans::XPropertySet> xCTProp(xResult, uno::UNO_QUERY);
+ if (xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ CHART_UNONAME_ROUNDED_EDGE, getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE));
+ }
}
catch (const uno::Exception & ex)
{
@@ -43,24 +126,29 @@ uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForInde
}
uno::Reference<chart2::XChartType>
-GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& xOldChartTypes )
+GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& /*xOldChartTypes*/ )
throw (::css::uno::RuntimeException, ::std::exception)
{
uno::Reference<chart2::XChartType> xResult;
try
{
- uno::Reference<lang::XMultiServiceFactory> xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
-
#if 1
// I gave up trying to use UNO just to instantiate this little thing...
xResult.set(new GL3DBarChartType(GetComponentContext()));
+ uno::Reference<beans::XPropertySet> xCTProp(xResult, uno::UNO_QUERY);
+ if (xCTProp.is())
+ {
+ bool bVal = false;
+ getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE) >>= bVal;
+ xCTProp->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(bVal));
+ }
#else
// This never works for me.
+ uno::Reference<lang::XMultiServiceFactory> xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
#endif
- ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(xOldChartTypes, xResult);
}
catch (const uno::Exception & ex)
{
@@ -76,6 +164,27 @@ sal_Bool GL3DBarChartTypeTemplate::supportsCategories()
return false;
}
+css::uno::Any GL3DBarChartTypeTemplate::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& GL3DBarChartTypeTemplate::getInfoHelper()
+{
+ return *InfoHelper::get();
+}
+
+css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartTypeTemplate::getPropertySetInfo()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return *ChartTypeInfo::get();
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(GL3DBarChartTypeTemplate, ChartTypeTemplate, OPropertySet)
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
index 78e7a7480dca..ba4943a64bf9 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
@@ -13,13 +13,20 @@
#include <MutexContainer.hxx>
#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
+#include <MutexContainer.hxx>
#include <ServiceMacros.hxx>
+#include <comphelper/uno3.hxx>
+
namespace chart {
-class GL3DBarChartTypeTemplate : public ChartTypeTemplate
+class GL3DBarChartTypeTemplate :
+ public MutexContainer, public property::OPropertySet, public ChartTypeTemplate
{
public:
+
+ DECLARE_XINTERFACE()
+
GL3DBarChartTypeTemplate(
const css::uno::Reference<
css::uno::XComponentContext>& xContext,
@@ -37,6 +44,17 @@ public:
virtual sal_Bool SAL_CALL supportsCategories()
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+ // 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);
};
}