diff options
author | Gagandeep Singh <deepgagan231197@gmail.com> | 2019-07-09 13:35:35 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-06 01:56:18 +0800 |
commit | 9df5887e017bbb2b1e97b156e3daf0c80a82bffe (patch) | |
tree | c3a311b7ca69145084e07de1e599c1eb80a5e9e9 | |
parent | 0d2083cf893db3690708de2511a11e435dfdbca1 (diff) |
ChartStyle class for XChartStyle interface
Change-Id: I8b2cf62e9791f70739d6973aab96c344cb3c3ffb
Reviewed-on: https://gerrit.libreoffice.org/75308
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | chart2/Library_chartcore.mk | 1 | ||||
-rw-r--r-- | chart2/inc/ChartModel.hxx | 3 | ||||
-rw-r--r-- | chart2/inc/ChartStyle.hxx | 48 | ||||
-rw-r--r-- | chart2/source/tools/ChartStyle.cxx | 45 |
4 files changed, 97 insertions, 0 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index 7fb53e142906..03af73cdbd02 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -177,6 +177,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\ chart2/source/tools/CachedDataSequence \ chart2/source/tools/CharacterProperties \ chart2/source/tools/ChartModelHelper \ + chart2/source/tools/ChartStyle \ chart2/source/tools/ChartTypeHelper \ chart2/source/tools/ChartViewHelper \ chart2/source/tools/ColorPerPointHelper \ diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 3693d66fe16d..00d5a6b3c1c2 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #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/qa/XDumper.hpp> // public API @@ -169,6 +170,8 @@ private: css::uno::Reference< css::container::XNameAccess> m_xXMLNamespaceMap; + css::uno::Reference< css::chart2::XChartStyle > m_xChartStyle; + private: //private methods diff --git a/chart2/inc/ChartStyle.hxx b/chart2/inc/ChartStyle.hxx new file mode 100644 index 000000000000..9062612f912c --- /dev/null +++ b/chart2/inc/ChartStyle.hxx @@ -0,0 +1,48 @@ +/* -*- 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_INC_CHARTSTYLE_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX + +#include <com/sun/star/chart2/XChartStyle.hpp> +#include <vector> + +namespace chart2 +{ +class ChartStyle : public css::chart2::XChartStyle +{ +public: + ChartStyle(); + virtual ~ChartStyle(); + + // _____ XChartStyle _____ + virtual css::uno::Reference<css::beans::XPropertySet> + SAL_CALL getStyleForObject(const sal_Int16 nChartObjectType) override; + +private: + sal_Int16 m_nNumObjects; + + std::vector<css::uno::Reference<css::beans::XPropertySet>> m_xChartStyle; +}; + +} // namespace chart2 + +// INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx new file mode 100644 index 000000000000..d9fba1520999 --- /dev/null +++ b/chart2/source/tools/ChartStyle.cxx @@ -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 . + */ + +#include <ChartStyle.hxx> +#include <com/sun/star/chart2/ChartObjectType.hpp> +#include <vector> + +namespace chart2 +{ + +ChartStyle::ChartStyle() + : m_nNumObjects( css::chart2::ChartObjectType::UNKNOWN ) + , m_xChartStyle( std::vector< css::uno::Reference < css::beans::XPropertySet > >( m_nNumObjects, css::uno::Reference < css::beans::XPropertySet > ())) +{ +} + +ChartStyle::~ChartStyle() {} + +css::uno::Reference< css::beans::XPropertySet> ChartStyle::getStyleForObject( const sal_Int16 nChartObjectType ) +{ + if ( nChartObjectType >= 0 && nChartObjectType < m_nNumObjects ) + return m_xChartStyle[nChartObjectType]; + else + throw css::lang::IllegalArgumentException( "Unknown Chart Object Style requested", nullptr, 0 ); +} + +} // namespace chart2 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |