diff options
author | Gagandeep Singh <deepgagan231197@gmail.com> | 2019-07-29 12:07:31 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-06 02:13:40 +0800 |
commit | 9fdb2d44efac86ad475dc0d53ceaa3582da696e0 (patch) | |
tree | 7c6931b763c7f4ab0607ef0dc4247d6990b327bc | |
parent | 61a49a1f413e05af3f5e9114703d3d97163c268e (diff) |
ChartStyle service prototype and integration into ChartModel
Change-Id: I6462886fba99f16df36a847121adc31ac1924424
-rw-r--r-- | chart2/inc/ChartModel.hxx | 5 | ||||
-rw-r--r-- | chart2/inc/ChartStyle.hxx | 13 | ||||
-rw-r--r-- | chart2/source/chartcore.component | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 11 | ||||
-rw-r--r-- | chart2/source/tools/ChartStyle.cxx | 28 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/chart2/ChartStyle.idl | 45 | ||||
-rw-r--r-- | offapi/com/sun/star/chart2/XChartStyled.idl | 46 |
8 files changed, 151 insertions, 3 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 00d5a6b3c1c2..30fb4082cc60 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -38,6 +38,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> #include <com/sun/star/chart2/XChartStyle.hpp> +#include <com/sun/star/chart2/XChartStyled.hpp> #include <com/sun/star/qa/XDumper.hpp> // public API @@ -85,6 +86,7 @@ typedef cppu::WeakImplHelper< ,css::chart2::XChartDocument // derived from XModel ,css::chart2::data::XDataReceiver // public API ,css::chart2::XTitled + ,css::chart2::XChartStyled ,css::frame::XLoadable ,css::util::XCloneable ,css::embed::XVisualObject @@ -386,6 +388,9 @@ public: virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override; virtual void SAL_CALL setTitleObject( const css::uno::Reference< css::chart2::XTitle >& Title ) override; + // _____ XChartStyled _____ + virtual css::uno::Reference< css::chart2::XChartStyle > SAL_CALL getChartStyle() override; + // ____ XInterface (for old API wrapper) ____ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; diff --git a/chart2/inc/ChartStyle.hxx b/chart2/inc/ChartStyle.hxx index 9062612f912c..e81d83c8c831 100644 --- a/chart2/inc/ChartStyle.hxx +++ b/chart2/inc/ChartStyle.hxx @@ -19,16 +19,25 @@ #ifndef INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX #define INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> #include <com/sun/star/chart2/XChartStyle.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <vector> namespace chart2 { -class ChartStyle : public css::chart2::XChartStyle +class ChartStyle : public cppu::WeakImplHelper< + css::chart2::XChartStyle + , css::lang::XServiceInfo > { public: - ChartStyle(); + 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; // _____ XChartStyle _____ virtual css::uno::Reference<css::beans::XPropertySet> diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component index f58ba98ba3ac..4bb0f689c788 100644 --- a/chart2/source/chartcore.component +++ b/chart2/source/chartcore.component @@ -256,4 +256,8 @@ constructor="com_sun_star_comp_chart2_ChartView_get_implementation"> <service name="com.sun.star.chart2.ChartView"/> </implementation> + <implementation name="com.sun.star.comp.chart2.ChartStyle" + constructor="com_sun_star_comp_chart2_ChartStyle_get_implementation"> + <service name="com.sun.star.chart2.ChartStyle"/> + </implementation> </component> diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 75109a20f79e..262070310591 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -110,6 +110,8 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext) ModifyListenerHelper::addListener( m_xPageBackground, this ); m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.chart2.ChartTypeManager", m_xContext ), uno::UNO_QUERY ); + m_xChartStyle.set( xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.chart2.ChartStyle" , m_xContext ), uno::UNO_QUERY ); } osl_atomic_decrement(&m_refCount); } @@ -152,6 +154,7 @@ ChartModel::ChartModel( const ChartModel & rOther ) Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< beans::XPropertySet >()( rOther.m_xPageBackground ); Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< chart2::XChartTypeManager >()( rOther.m_xChartTypeManager ); Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< container::XNameAccess >()( rOther.m_xXMLNamespaceMap ); + Reference< chart2::XChartStyle > xChartStyle = CreateRefClone< chart2::XChartStyle >()( rOther.m_xChartStyle ); { MutexGuard aGuard( m_aModelMutex ); @@ -161,6 +164,7 @@ ChartModel::ChartModel( const ChartModel & rOther ) m_xPageBackground = xNewPageBackground; m_xChartTypeManager = xChartTypeManager; m_xXMLNamespaceMap = xXMLNamespaceMap; + m_xChartStyle = xChartStyle; } ModifyListenerHelper::addListener( xNewTitle, xListener ); @@ -930,6 +934,13 @@ void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle > setModified( true ); } +// _____ XChartStyled _____ +uno::Reference< chart2::XChartStyle > SAL_CALL ChartModel::getChartStyle() +{ + MutexGuard aGuard( m_aModelMutex ); + return m_xChartStyle; +} + // ____ XInterface (for old API wrapper) ____ uno::Any SAL_CALL ChartModel::queryInterface( const uno::Type& aType ) { diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx index d9fba1520999..2ae50d95c458 100644 --- a/chart2/source/tools/ChartStyle.cxx +++ b/chart2/source/tools/ChartStyle.cxx @@ -19,8 +19,11 @@ #include <ChartStyle.hxx> #include <com/sun/star/chart2/ChartObjectType.hpp> +#include <cppuhelper/supportsservice.hxx> #include <vector> +namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } + namespace chart2 { @@ -40,6 +43,29 @@ css::uno::Reference< css::beans::XPropertySet> ChartStyle::getStyleForObject( co throw css::lang::IllegalArgumentException( "Unknown Chart Object Style requested", nullptr, 0 ); } -} // namespace chart2 +// _____ XServiceInfo _____ +OUString SAL_CALL ChartStyle::getImplementationName() +{ + return OUString("com.sun.star.comp.chart2.ChartStyle"); +} + +sal_Bool SAL_CALL ChartStyle::supportsService( const OUString& rServiceName ) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence< OUString > SAL_CALL ChartStyle::getSupportedServiceNames() +{ + return { "com.sun.star.chart2.ChartStyle" }; +} + +} // 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 &) +{ + return cppu::acquire(new chart2::ChartStyle); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index d38610c258a1..0f382fb4ab05 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -638,6 +638,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/chart2,\ CandleStickChartType \ ChartDocument \ ChartDocumentWrapper \ + ChartStyle \ ChartType \ ChartTypeManager \ ChartTypeTemplate\ @@ -2023,6 +2024,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\ XChartShape \ XChartShapeContainer \ XChartStyle \ + XChartStyled \ XChartType \ XChartTypeContainer \ XChartTypeManager \ diff --git a/offapi/com/sun/star/chart2/ChartStyle.idl b/offapi/com/sun/star/chart2/ChartStyle.idl new file mode 100644 index 000000000000..9c38c1cd4656 --- /dev/null +++ b/offapi/com/sun/star/chart2/ChartStyle.idl @@ -0,0 +1,45 @@ +/* -*- 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 com_sun_star_chart2_ChartStyle_idl +#define com_sun_star_chart2_ChartStyle_idl + +#include <com/sun/star/chart2/XChartStyle.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +service ChartStyle +{ + interface ::com::sun::star::chart2::XChartStyle; +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/chart2/XChartStyled.idl b/offapi/com/sun/star/chart2/XChartStyled.idl new file mode 100644 index 000000000000..4c6a5f9b231a --- /dev/null +++ b/offapi/com/sun/star/chart2/XChartStyled.idl @@ -0,0 +1,46 @@ +/* -*- 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 com_sun_star_chart2_XChartStyled_idl +#define com_sun_star_chart2_XChartStyled_idl + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/chart2/XChartStyle.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +interface XChartStyled : ::com::sun::star::uno::XInterface +{ + XChartStyle getChartStyle(); +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |