diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-07 05:10:41 +0800 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-07 05:10:41 +0800 |
commit | d63f1346a6c5767d995c787fe2bb36b023a64788 (patch) | |
tree | 6114c580b4e61e7a406d4354f197a6bbd782515d | |
parent | 53b123e26d3fdf98e5287b2278843b6749c35806 (diff) |
store the first style in ChartStyle
Change-Id: Ib72b2c9aeb3ba2c09e8be6edbbd713cb2512b3e7
-rw-r--r-- | chart2/source/inc/ChartStyle.hxx | 39 | ||||
-rw-r--r-- | chart2/source/inc/Legend.hxx | 134 | ||||
-rw-r--r-- | chart2/source/model/main/Legend.cxx | 116 | ||||
-rw-r--r-- | chart2/source/model/main/Legend.hxx | 107 | ||||
-rw-r--r-- | chart2/source/tools/ChartStyle.cxx | 103 |
5 files changed, 271 insertions, 228 deletions
diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index f01fa6769524..2c1fb3d9e7f8 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -33,13 +33,24 @@ namespace chart2 { +namespace impl +{ +typedef ::cppu::WeakImplHelper<css::style::XStyle> ChartObjectStyle_Base; +} -class ChartObjectStyle : public chart::MutexContainer, public property::OPropertySet, public css::style::XStyle +class ChartObjectStyle : public chart::MutexContainer, + public impl::ChartObjectStyle_Base, + public property::OPropertySet { public: - ChartObjectStyle(::cppu::IPropertyArrayHelper& rArrayHelper, const chart::tPropertyValueMap& rPropertyMap); + ChartObjectStyle(css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo, + ::cppu::IPropertyArrayHelper& rArrayHelper, + const chart::tPropertyValueMap& rPropertyMap); virtual ~ChartObjectStyle(); + /// merge XInterface implementations + DECLARE_XINTERFACE() + virtual sal_Bool SAL_CALL isUserDefined() override; virtual sal_Bool SAL_CALL isInUse() override; @@ -47,32 +58,34 @@ public: virtual void SAL_CALL setParentStyle(const OUString&) override; // ____ OPropertySet ____ - virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override; + virtual css::uno::Any GetDefaultValue(sal_Int32 nHandle) const override; // ____ OPropertySet ____ - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; // ____ XPropertySet ____ - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL - getPropertySetInfo() override; + virtual css::uno::Reference<css::beans::XPropertySetInfo> + SAL_CALL getPropertySetInfo() override; -private: + virtual OUString SAL_CALL getName(); + virtual void SAL_CALL setName(const OUString&); + +private: ::cppu::IPropertyArrayHelper& mrArrayHelper; const chart::tPropertyValueMap& mrPropertyMap; + css::uno::Reference<css::beans::XPropertySetInfo> mxPropSetInfo; }; -class ChartStyle : public cppu::WeakImplHelper< - css::chart2::XChartStyle - , css::lang::XServiceInfo > +class ChartStyle : public cppu::WeakImplHelper<css::chart2::XChartStyle, css::lang::XServiceInfo> { public: explicit ChartStyle(); virtual ~ChartStyle(); /// XServiceInfo declarations virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; // _____ XChartStyle _____ virtual css::uno::Reference<css::beans::XPropertySet> @@ -82,6 +95,8 @@ private: sal_Int16 m_nNumObjects; std::map<sal_Int16, css::uno::Reference<css::beans::XPropertySet>> m_xChartStyle; + + void register_styles(); }; } // namespace chart2 diff --git a/chart2/source/inc/Legend.hxx b/chart2/source/inc/Legend.hxx new file mode 100644 index 000000000000..b3685eb5862a --- /dev/null +++ b/chart2/source/inc/Legend.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX +#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX + +#include <OPropertySet.hxx> +#include <MutexContainer.hxx> +#include <PropertyHelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/chart2/XLegend.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +namespace chart +{ +namespace impl +{ +typedef ::cppu::WeakImplHelper<css::chart2::XLegend, css::lang::XServiceInfo, css::util::XCloneable, + css::util::XModifyBroadcaster, css::util::XModifyListener> + Legend_Base; +} + +namespace legend +{ +struct StaticLegendInfo_Initializer +{ + css::uno::Reference<css::beans::XPropertySetInfo>* operator()(); +}; + +struct StaticLegendInfo + : public rtl::StaticAggregate<css::uno::Reference<css::beans::XPropertySetInfo>, + StaticLegendInfo_Initializer> +{ +}; + +struct StaticLegendDefaults_Initializer +{ + ::chart::tPropertyValueMap* operator()(); +}; + +struct StaticLegendDefaults + : public rtl::StaticAggregate<::chart::tPropertyValueMap, StaticLegendDefaults_Initializer> +{ +}; + +struct StaticLegendInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()(); +}; + +struct StaticLegendInfoHelper + : public rtl::StaticAggregate<::cppu::OPropertyArrayHelper, StaticLegendInfoHelper_Initializer> +{ +}; +} + +class Legend final : public MutexContainer, + public impl::Legend_Base, + public ::property::OPropertySet +{ +public: + explicit Legend(); + virtual ~Legend() override; + + /// XServiceInfo declarations + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +private: + explicit Legend(const Legend& rOther); + + // ____ OPropertySet ____ + virtual css::uno::Any GetDefaultValue(sal_Int32 nHandle) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference<css::beans::XPropertySetInfo> + SAL_CALL getPropertySetInfo() override; + + // ____ XCloneable ____ + virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override; + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL + addModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override; + virtual void SAL_CALL + removeModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override; + + // ____ XModifyListener ____ + virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override; + + // ____ XEventListener (base of XModifyListener) ____ + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + css::uno::Reference<css::util::XModifyListener> m_xModifyEventForwarder; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index 654ccc45cbcd..b1d18c25f89c 100644 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -98,83 +98,67 @@ void lcl_AddPropertiesToVector( } -struct StaticLegendDefaults_Initializer +static Sequence< Property > lcl_GetPropertySequence() { - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); - ::chart::FillProperties::AddDefaultsToMap( rOutMap ); - ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); - - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_EXPANSION, css::chart::ChartLegendExpansion_HIGH ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true ); - - float fDefaultCharHeight = 10.0; - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); - } -}; + std::vector< css::beans::Property > aProperties; + lcl_AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); + ::chart::FillProperties::AddPropertiesToVector( aProperties ); + ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); -struct StaticLegendDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLegendDefaults_Initializer > -{ -}; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); -struct StaticLegendInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); - ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); + return comphelper::containerToSequence( aProperties ); +} - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); +void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) +{ + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); + ::chart::FillProperties::AddDefaultsToMap( rOutMap ); + ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); + + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_EXPANSION, css::chart::ChartLegendExpansion_HIGH ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true ); + + float fDefaultCharHeight = 10.0; + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); +} - return comphelper::containerToSequence( aProperties ); - } -}; +} // anonymous namespace -struct StaticLegendInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLegendInfoHelper_Initializer > +namespace chart { -}; -struct StaticLegendInfo_Initializer +namespace legend { - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLegendInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; -struct StaticLegendInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLegendInfo_Initializer > +::cppu::OPropertyArrayHelper* StaticLegendInfoHelper_Initializer::operator()() { -}; + static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); + return &aPropHelper; +} -} // anonymous namespace -namespace chart +uno::Reference< beans::XPropertySetInfo >* StaticLegendInfo_Initializer::operator()() +{ + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLegendInfoHelper::get() ) ); + return &xPropertySetInfo; +} + +::chart::tPropertyValueMap* StaticLegendDefaults_Initializer::operator()() { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; +} + +} Legend::Legend() : ::property::OPropertySet( m_aMutex ), @@ -247,7 +231,7 @@ void Legend::firePropertyChangeEvent() // ____ OPropertySet ____ Any Legend::GetDefaultValue( sal_Int32 nHandle ) const { - const tPropertyValueMap& rStaticDefaults = *StaticLegendDefaults::get(); + const tPropertyValueMap& rStaticDefaults = *legend::StaticLegendDefaults::get(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) return uno::Any(); @@ -256,13 +240,13 @@ Any Legend::GetDefaultValue( sal_Int32 nHandle ) const ::cppu::IPropertyArrayHelper & SAL_CALL Legend::getInfoHelper() { - return *StaticLegendInfoHelper::get(); + return *legend::StaticLegendInfoHelper::get(); } // ____ XPropertySet ____ Reference< beans::XPropertySetInfo > SAL_CALL Legend::getPropertySetInfo() { - return *StaticLegendInfo::get(); + return *legend::StaticLegendInfo::get(); } // implement XServiceInfo methods basing upon getSupportedServiceNames_Static diff --git a/chart2/source/model/main/Legend.hxx b/chart2/source/model/main/Legend.hxx deleted file mode 100644 index 516324f2e107..000000000000 --- a/chart2/source/model/main/Legend.hxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX -#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX - -#include <OPropertySet.hxx> -#include <MutexContainer.hxx> -#include <cppuhelper/implbase.hxx> -#include <comphelper/uno3.hxx> -#include <com/sun/star/chart2/XLegend.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/util/XModifyBroadcaster.hpp> -#include <com/sun/star/util/XModifyListener.hpp> - -namespace chart -{ - -namespace impl -{ -typedef ::cppu::WeakImplHelper< - css::chart2::XLegend, - css::lang::XServiceInfo, - css::util::XCloneable, - css::util::XModifyBroadcaster, - css::util::XModifyListener > - Legend_Base; -} - -class Legend final : - public MutexContainer, - public impl::Legend_Base, - public ::property::OPropertySet -{ -public: - explicit Legend(); - virtual ~Legend() override; - - /// XServiceInfo declarations - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - /// merge XInterface implementations - DECLARE_XINTERFACE() - /// merge XTypeProvider implementations - DECLARE_XTYPEPROVIDER() - -private: - explicit Legend( const Legend & rOther ); - - // ____ OPropertySet ____ - virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override; - - // ____ OPropertySet ____ - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - // ____ XPropertySet ____ - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL - getPropertySetInfo() override; - - // ____ XCloneable ____ - virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; - - // ____ XModifyBroadcaster ____ - virtual void SAL_CALL addModifyListener( - const css::uno::Reference< css::util::XModifyListener >& aListener ) override; - virtual void SAL_CALL removeModifyListener( - const css::uno::Reference< css::util::XModifyListener >& aListener ) override; - - // ____ XModifyListener ____ - virtual void SAL_CALL modified( - const css::lang::EventObject& aEvent ) override; - - // ____ XEventListener (base of XModifyListener) ____ - virtual void SAL_CALL disposing( - const css::lang::EventObject& Source ) override; - - // ____ OPropertySet ____ - virtual void firePropertyChangeEvent() override; - using OPropertySet::disposing; - - css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; -}; - -} // namespace chart - -// INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx index c3a6569e323f..7ec585b330f3 100644 --- a/chart2/source/tools/ChartStyle.cxx +++ b/chart2/source/tools/ChartStyle.cxx @@ -22,99 +22,116 @@ #include <cppuhelper/supportsservice.hxx> #include <vector> -namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } +#include <Legend.hxx> -namespace chart2 +namespace com { - -ChartObjectStyle::ChartObjectStyle(::cppu::IPropertyArrayHelper& rArrayHelper, const chart::tPropertyValueMap& rPropertyMap): - OPropertySet( m_aMutex ), - mrArrayHelper(rArrayHelper), - mrPropertyMap(rPropertyMap) +namespace sun { -} - -ChartObjectStyle::~ChartObjectStyle() +namespace star { -} - -sal_Bool SAL_CALL ChartObjectStyle::isInUse() +namespace uno { - return true; +class XComponentContext; +} +} } - -sal_Bool SAL_CALL ChartObjectStyle::isUserDefined() -{ - return true; } -OUString SAL_CALL ChartObjectStyle::getParentStyle() +namespace chart2 +{ +ChartObjectStyle::ChartObjectStyle(css::uno::Reference<css::beans::XPropertySetInfo> xPropSetInfo, + ::cppu::IPropertyArrayHelper& rArrayHelper, + const chart::tPropertyValueMap& rPropertyMap) + : OPropertySet(m_aMutex) + , mrArrayHelper(rArrayHelper) + , mrPropertyMap(rPropertyMap) + , mxPropSetInfo(xPropSetInfo) { - return ""; } -void SAL_CALL ChartObjectStyle::setParentStyle(const OUString&) +ChartObjectStyle::~ChartObjectStyle() {} + +sal_Bool SAL_CALL ChartObjectStyle::isInUse() { return true; } + +sal_Bool SAL_CALL ChartObjectStyle::isUserDefined() { return true; } + +OUString SAL_CALL ChartObjectStyle::getParentStyle() { return ""; } + +void SAL_CALL ChartObjectStyle::setParentStyle(const OUString&) {} + +css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL ChartObjectStyle::getPropertySetInfo() { + return mxPropSetInfo; } +OUString SAL_CALL ChartObjectStyle::getName() { return OUString(); } + +void SAL_CALL ChartObjectStyle::setName(const OUString&) {} + // ____ OPropertySet ____ -css::uno::Any ChartObjectStyle::GetDefaultValue( sal_Int32 nHandle ) const +css::uno::Any ChartObjectStyle::GetDefaultValue(sal_Int32 nHandle) const { - chart::tPropertyValueMap::const_iterator aFound( mrPropertyMap.find( nHandle ) ); - if( aFound == mrPropertyMap.end() ) + chart::tPropertyValueMap::const_iterator aFound(mrPropertyMap.find(nHandle)); + if (aFound == mrPropertyMap.end()) return css::uno::Any(); return (*aFound).second; } -::cppu::IPropertyArrayHelper & SAL_CALL ChartObjectStyle::getInfoHelper() -{ - return mrArrayHelper; -} - -// ____ XPropertySet ____ -css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ChartObjectStyle::getPropertySetInfo() -{ - //return *mrArrayHelper; - return css::uno::Reference<css::beans::XPropertySetInfo>(); -} +::cppu::IPropertyArrayHelper& SAL_CALL ChartObjectStyle::getInfoHelper() { return mrArrayHelper; } ChartStyle::ChartStyle() - : m_nNumObjects( css::chart2::ChartObjectType::UNKNOWN ) + : m_nNumObjects(css::chart2::ChartObjectType::UNKNOWN) { + register_styles(); } ChartStyle::~ChartStyle() {} -css::uno::Reference< css::beans::XPropertySet> ChartStyle::getStyleForObject( const sal_Int16 nChartObjectType ) +css::uno::Reference<css::beans::XPropertySet> +ChartStyle::getStyleForObject(const sal_Int16 nChartObjectType) { auto itr = m_xChartStyle.find(nChartObjectType); if (itr == m_xChartStyle.end()) - throw css::lang::IllegalArgumentException( "Unknown Chart Object Style requested", nullptr, 0 ); + throw css::lang::IllegalArgumentException("Unknown Chart Object Style requested", nullptr, + 0); return itr->second; } +void ChartStyle::register_styles() +{ + m_xChartStyle[css::chart2::ChartObjectType::LEGEND] = new ChartObjectStyle( + *chart::legend::StaticLegendInfo::get(), *chart::legend::StaticLegendInfoHelper::get(), + *chart::legend::StaticLegendDefaults::get()); +} + // _____ XServiceInfo _____ OUString SAL_CALL ChartStyle::getImplementationName() { return OUString("com.sun.star.comp.chart2.ChartStyle"); } -sal_Bool SAL_CALL ChartStyle::supportsService( const OUString& rServiceName ) +sal_Bool SAL_CALL ChartStyle::supportsService(const OUString& rServiceName) { return cppu::supportsService(this, rServiceName); } -css::uno::Sequence< OUString > SAL_CALL ChartStyle::getSupportedServiceNames() +css::uno::Sequence<OUString> SAL_CALL ChartStyle::getSupportedServiceNames() { return { "com.sun.star.chart2.ChartStyle" }; } +// +// needed by MSC compiler +using impl::ChartObjectStyle_Base; + +IMPLEMENT_FORWARD_XINTERFACE2(ChartObjectStyle, ChartObjectStyle_Base, ::property::OPropertySet) } // namespace chart2 -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * -com_sun_star_comp_chart2_ChartStyle_get_implementation(css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_chart2_ChartStyle_get_implementation(css::uno::XComponentContext*, + css::uno::Sequence<css::uno::Any> const&) { return cppu::acquire(new chart2::ChartStyle); } |