summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGagandeep Singh <deepgagan231197@gmail.com>2019-06-21 16:58:06 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-08-06 01:55:56 +0800
commit2fd7ed670df9bd4390d26b6a8c6b64c6a4242e50 (patch)
tree9f9ce3fa2629264e3a2bb0badc87b77441a1cf01
parenta1b700a787e2f5bb46f7b39a704aed7c3c81bed9 (diff)
[WIP] Core Structures for Chart Styles Implementation
Change-Id: I2e96606184b895d572eabdfbac1539a2881e3541
-rw-r--r--chart2/Library_chartcore.mk1
-rw-r--r--chart2/source/inc/OPropertySet.hxx20
-rw-r--r--chart2/source/inc/StyleHandler.hxx88
-rw-r--r--chart2/source/model/inc/BaseCoordinateSystem.hxx4
-rw-r--r--chart2/source/model/inc/DataSeries.hxx4
-rw-r--r--chart2/source/model/inc/Diagram.hxx4
-rw-r--r--chart2/source/model/inc/StockBar.hxx4
-rw-r--r--chart2/source/model/main/Axis.cxx31
-rw-r--r--chart2/source/model/main/Axis.hxx4
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx31
-rw-r--r--chart2/source/model/main/DataPoint.cxx31
-rw-r--r--chart2/source/model/main/DataPoint.hxx4
-rw-r--r--chart2/source/model/main/DataSeries.cxx32
-rw-r--r--chart2/source/model/main/Diagram.cxx31
-rw-r--r--chart2/source/model/main/FormattedString.cxx28
-rw-r--r--chart2/source/model/main/FormattedString.hxx4
-rw-r--r--chart2/source/model/main/GridProperties.cxx31
-rw-r--r--chart2/source/model/main/GridProperties.hxx4
-rw-r--r--chart2/source/model/main/Legend.cxx31
-rw-r--r--chart2/source/model/main/Legend.hxx4
-rw-r--r--chart2/source/model/main/PageBackground.cxx31
-rw-r--r--chart2/source/model/main/PageBackground.hxx4
-rw-r--r--chart2/source/model/main/StockBar.cxx31
-rw-r--r--chart2/source/model/main/Title.cxx31
-rw-r--r--chart2/source/model/main/Title.hxx4
-rw-r--r--chart2/source/model/main/Wall.cxx31
-rw-r--r--chart2/source/model/main/Wall.hxx4
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/ChartType.hxx4
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.hxx4
-rw-r--r--chart2/source/tools/ImplOPropertySet.cxx5
-rw-r--r--chart2/source/tools/ImplOPropertySet.hxx1
-rw-r--r--chart2/source/tools/OPropertySet.cxx17
-rw-r--r--chart2/source/tools/RegressionCurveModel.hxx4
-rw-r--r--chart2/source/tools/RegressionEquation.hxx4
-rw-r--r--chart2/source/tools/StyleHandler.cxx113
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/chart2/XChartStyles.idl51
44 files changed, 758 insertions, 1 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index e671110a753f..7fb53e142906 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -225,6 +225,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/tools/Scaling \
chart2/source/tools/SceneProperties \
chart2/source/tools/StatisticsHelper \
+ chart2/source/tools/StyleHandler \
chart2/source/tools/ThreeDHelper \
chart2/source/tools/TitleHelper \
chart2/source/tools/TrueGuard \
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
index 2ee1caa164c8..8f2a7b65cc5e 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -27,9 +27,11 @@
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
#include <com/sun/star/style/XStyleSupplier.hpp>
+#include <com/sun/star/chart2/XChartStyles.hpp>
#include "charttoolsdllapi.hxx"
#include <memory>
+#include <map>
namespace property
{
@@ -37,6 +39,13 @@ namespace property
namespace impl
{ class ImplOPropertySet; }
+namespace impl
+{
+ typedef
+ std::map< sal_Int32, css::uno::Any >
+ tPropertyMap;
+}
+
class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet :
public ::cppu::OBroadcastHelper,
// includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
@@ -46,7 +55,8 @@ class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet :
public css::lang::XTypeProvider,
public css::beans::XPropertyState,
public css::beans::XMultiPropertyStates,
- public css::style::XStyleSupplier
+ public css::style::XStyleSupplier,
+ public css::chart2::XChartStyles
{
public:
OPropertySet( ::osl::Mutex & rMutex );
@@ -191,6 +201,14 @@ protected:
// Note: it is assumed that the base class implements setPropertyValue by
// using setFastPropertyValue
+ // ____ XChartStyles _____
+ virtual void SAL_CALL setDefaultStyle( const sal_Int16 nValue ) override;
+ virtual void SAL_CALL setChartStyle( const sal_Int16 nValue ) = 0;
+ virtual void SAL_CALL createStyle() = 0;
+ virtual void SAL_CALL deleteStyle( const sal_Int16 nValue ) override;
+
+ const impl::tPropertyMap& getAllDirectProperties();
+
private:
/// reference to mutex of class deriving from here
::osl::Mutex & m_rMutex;
diff --git a/chart2/source/inc/StyleHandler.hxx b/chart2/source/inc/StyleHandler.hxx
new file mode 100644
index 000000000000..c5623384bfe6
--- /dev/null
+++ b/chart2/source/inc/StyleHandler.hxx
@@ -0,0 +1,88 @@
+/* -*- 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_STYLEHANDLER_HXX
+#define INCLUDED_CHART2_SOURCE_INC_STYLEHANDLER_HXX
+
+#include <osl/file.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include "charttoolsdllapi.hxx"
+#include <vector>
+#include <memory>
+#include <map>
+
+namespace chart
+{
+typedef
+ std::map< sal_Int32, css::uno::Any >
+ tStylePropertyMap;
+
+enum StyleType
+{
+ STYLETYPE_AXIS,
+ STYLETYPE_BASE_COORD,
+ STYLETYPE_DIAGRAM,
+ STYLETYPE_DATA_POINT,
+ STYLETYPE_DATA_SERIES,
+ STYLETYPE_GRID,
+ STYLETYPE_FORMATTED,
+ STYLETYPE_LEGEND,
+ STYLETYPE_PAGE,
+ STYLETYPE_STOCK,
+ STYLETYPE_TITLE,
+ STYLETYPE_WALL,
+ STYLETYPE_UNKNOWN
+};
+
+class StyleHandler
+{
+public:
+ StyleHandler( const StyleType eType );
+ ~StyleHandler();
+
+ tStylePropertyMap& getStyle();
+
+ static void createStyle( const tStylePropertyMap& rPropMap, StyleType eType );
+
+ static void deleteStyle( const sal_Int16 nValue );
+
+ static void setDefaultStyle( const sal_Int16 nValue );
+
+ void setLocalStyle( const sal_Int16 nValue );
+
+private:
+ static void loadStyleData();
+
+ static std::vector< std::vector< tStylePropertyMap > > m_pStyleMap;
+
+ static sal_Int16 m_nDefaultStyle;
+
+ static std::unique_ptr< osl::File > m_pStyleSheet;
+
+ static bool bIsDataLoaded;
+ StyleType m_eType;
+
+ sal_Int16 m_nLocalStyle;
+};
+
+} // namespace chart
+
+// INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/BaseCoordinateSystem.hxx b/chart2/source/model/inc/BaseCoordinateSystem.hxx
index 1f20e83a02dc..d6dee67159bc 100644
--- a/chart2/source/model/inc/BaseCoordinateSystem.hxx
+++ b/chart2/source/model/inc/BaseCoordinateSystem.hxx
@@ -109,6 +109,10 @@ protected:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
protected:
diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/model/inc/DataSeries.hxx
index aefab3406606..6b261535f2d7 100644
--- a/chart2/source/model/inc/DataSeries.hxx
+++ b/chart2/source/model/inc/DataSeries.hxx
@@ -147,6 +147,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
typedef std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx
index c9690981bfbc..d44ff0339a24 100644
--- a/chart2/source/model/inc/Diagram.hxx
+++ b/chart2/source/model/inc/Diagram.hxx
@@ -150,6 +150,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
css::uno::Reference< css::uno::XComponentContext > m_xContext;
diff --git a/chart2/source/model/inc/StockBar.hxx b/chart2/source/model/inc/StockBar.hxx
index b1247e584a63..b0b6d292e197 100644
--- a/chart2/source/model/inc/StockBar.hxx
+++ b/chart2/source/model/inc/StockBar.hxx
@@ -85,6 +85,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
};
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index b7e19a49e548..4457b30cbb3d 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -28,6 +28,7 @@
#include <EventListenerHelper.hxx>
#include <ModifyListenerHelper.hxx>
#include <unonames.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
@@ -306,6 +307,19 @@ void lcl_CloneSubGrids(
OSL_ASSERT( pDestIt == pDestEnd );
}
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_BASE_COORD );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -570,6 +584,9 @@ void Axis::fireModifyEvent()
// ____ OPropertySet ____
uno::Any Axis::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticAxisDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -588,6 +605,20 @@ Reference< beans::XPropertySetInfo > SAL_CALL Axis::getPropertySetInfo()
return *StaticAxisInfo::get();
}
+// ____ XChartStyles ____
+void Axis::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void Axis::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_AXIS );
+}
+
using impl::Axis_Base;
IMPLEMENT_FORWARD_XINTERFACE2( Axis, Axis_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/Axis.hxx b/chart2/source/model/main/Axis.hxx
index 49f4003bbb4f..36aef190920e 100644
--- a/chart2/source/model/main/Axis.hxx
+++ b/chart2/source/model/main/Axis.hxx
@@ -115,6 +115,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
void AllocateSubGrids();
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 94fa8592c1aa..010fe051ee39 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -23,6 +23,7 @@
#include <CloneHelper.hxx>
#include <ModifyListenerHelper.hxx>
#include "Axis.hxx"
+#include <StyleHandler.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -108,6 +109,19 @@ struct StaticCooSysInfo : public rtl::StaticAggregate< uno::Reference< beans::XP
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_BASE_COORD );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -331,6 +345,9 @@ void BaseCoordinateSystem::fireModifyEvent()
// ____ OPropertySet ____
uno::Any BaseCoordinateSystem::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticCooSysDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -350,6 +367,20 @@ Reference< beans::XPropertySetInfo > SAL_CALL BaseCoordinateSystem::getPropertyS
return *StaticCooSysInfo::get();
}
+// ____ XChartStyles ____
+void BaseCoordinateSystem::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void BaseCoordinateSystem::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_BASE_COORD );
+}
+
using impl::BaseCoordinateSystem_Base;
IMPLEMENT_FORWARD_XINTERFACE2( BaseCoordinateSystem, BaseCoordinateSystem_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx
index 6e9f6d483ccc..066b1419d3f5 100644
--- a/chart2/source/model/main/DataPoint.cxx
+++ b/chart2/source/model/main/DataPoint.cxx
@@ -23,6 +23,7 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -80,6 +81,19 @@ struct StaticDataPointInfo : public rtl::StaticAggregate< uno::Reference< beans:
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_DATA_POINT );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -167,6 +181,9 @@ void SAL_CALL DataPoint::setParent(
// ____ OPropertySet ____
uno::Any DataPoint::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
// the value set at the data series is the default
uno::Reference< beans::XFastPropertySet > xFast( m_xParentProperties.get(), uno::UNO_QUERY );
if( !xFast.is())
@@ -262,6 +279,20 @@ void DataPoint::firePropertyChangeEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void DataPoint::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void DataPoint::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_DATA_POINT );
+}
+
// needed by MSC compiler
using impl::DataPoint_Base;
diff --git a/chart2/source/model/main/DataPoint.hxx b/chart2/source/model/main/DataPoint.hxx
index de3e5020387c..5a7739400044 100644
--- a/chart2/source/model/main/DataPoint.hxx
+++ b/chart2/source/model/main/DataPoint.hxx
@@ -102,6 +102,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
css::uno::WeakReference< css::beans::XPropertySet > m_xParentProperties;
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 26226172bf43..45fc6d3e882a 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -27,6 +27,7 @@
#include <CloneHelper.hxx>
#include <ModifyListenerHelper.hxx>
#include <EventListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <cppuhelper/supportsservice.hxx>
@@ -120,6 +121,20 @@ void lcl_CloneAttributedDataPoints(
}
}
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_DATA_SERIES );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
+
} // anonymous namespace
namespace chart
@@ -233,6 +248,9 @@ uno::Reference< util::XCloneable > SAL_CALL DataSeries::createClone()
// ____ OPropertySet ____
uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = StaticDataSeriesDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -528,6 +546,20 @@ void DataSeries::fireModifyEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void DataSeries::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void DataSeries::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_DATA_SERIES );
+}
+
using impl::DataSeries_Base;
using ::property::OPropertySet;
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 0b9efc80f794..565599030e05 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -28,6 +28,7 @@
#include <CloneHelper.hxx>
#include <SceneProperties.hxx>
#include <unonames.hxx>
+#include <StyleHandler.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <rtl/instance.hxx>
@@ -274,6 +275,19 @@ void lcl_CloneCoordinateSystems(
}
}
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_DIAGRAM );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -595,6 +609,9 @@ void Diagram::fireModifyEvent()
// ____ OPropertySet ____
uno::Any Diagram::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticDiagramDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -668,6 +685,20 @@ void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) co
::property::OPropertySet::getFastPropertyValue( rValue,nHandle );
}
+// ____ XChartStyles ____
+void Diagram::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void Diagram::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_DIAGRAM );
+}
+
using impl::Diagram_Base;
IMPLEMENT_FORWARD_XINTERFACE2( Diagram, Diagram_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index 7ace8d2f4e3c..c74b20bbd201 100644
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -22,6 +22,7 @@
#include <CharacterProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <tools/diagnose_ex.h>
@@ -90,6 +91,19 @@ struct StaticFormattedStringInfo : public rtl::StaticAggregate< uno::Reference<
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_FORMATTED );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -246,6 +260,20 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL FormattedString::getPropertyS
return *StaticFormattedStringInfo::get();
}
+// ____ XChartStyles ____
+void FormattedString::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void FormattedString::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_FORMATTED );
+}
+
using impl::FormattedString_Base;
IMPLEMENT_FORWARD_XINTERFACE2( FormattedString, FormattedString_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/FormattedString.hxx b/chart2/source/model/main/FormattedString.hxx
index 9d17d5f3885a..160f9fb3a7d9 100644
--- a/chart2/source/model/main/FormattedString.hxx
+++ b/chart2/source/model/main/FormattedString.hxx
@@ -120,6 +120,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
// ____ XFormattedString ____
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
index a7fb5be85f6d..3dc7c7b9323d 100644
--- a/chart2/source/model/main/GridProperties.cxx
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -22,6 +22,7 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -121,6 +122,19 @@ struct StaticGridInfo : public rtl::StaticAggregate< uno::Reference< beans::XPro
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_GRID );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -144,6 +158,9 @@ GridProperties::~GridProperties()
// ____ OPropertySet ____
uno::Any GridProperties::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticGridDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -213,6 +230,20 @@ void GridProperties::firePropertyChangeEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void GridProperties::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void GridProperties::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_GRID );
+}
+
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
OUString SAL_CALL GridProperties::getImplementationName()
{
diff --git a/chart2/source/model/main/GridProperties.hxx b/chart2/source/model/main/GridProperties.hxx
index 38d1f9a74ede..bf4df5d7508c 100644
--- a/chart2/source/model/main/GridProperties.hxx
+++ b/chart2/source/model/main/GridProperties.hxx
@@ -94,6 +94,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
};
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index 654ccc45cbcd..c2f593764aca 100644
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -24,6 +24,7 @@
#include <UserDefinedProperties.hxx>
#include <ModifyListenerHelper.hxx>
#include <PropertyHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/chart2/LegendPosition.hpp>
@@ -171,6 +172,19 @@ struct StaticLegendInfo : public rtl::StaticAggregate< uno::Reference< beans::XP
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_LEGEND );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -247,6 +261,9 @@ void Legend::firePropertyChangeEvent()
// ____ OPropertySet ____
Any Legend::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticLegendDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -265,6 +282,20 @@ Reference< beans::XPropertySetInfo > SAL_CALL Legend::getPropertySetInfo()
return *StaticLegendInfo::get();
}
+// ____ XChartStyles ____
+void Legend::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void Legend::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_LEGEND );
+}
+
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
OUString SAL_CALL Legend::getImplementationName()
{
diff --git a/chart2/source/model/main/Legend.hxx b/chart2/source/model/main/Legend.hxx
index 516324f2e107..05134f90f388 100644
--- a/chart2/source/model/main/Legend.hxx
+++ b/chart2/source/model/main/Legend.hxx
@@ -96,6 +96,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
};
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
index 2dec38051d46..82e0f679c3c7 100644
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -23,6 +23,7 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <cppuhelper/supportsservice.hxx>
@@ -106,6 +107,19 @@ struct StaticPageBackgroundInfo : public rtl::StaticAggregate< uno::Reference< b
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_PAGE );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -134,6 +148,9 @@ uno::Reference< util::XCloneable > SAL_CALL PageBackground::createClone()
// ____ OPropertySet ____
uno::Any PageBackground::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticPageBackgroundDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -197,6 +214,20 @@ void PageBackground::firePropertyChangeEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void PageBackground::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void PageBackground::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_PAGE );
+}
+
OUString SAL_CALL PageBackground::getImplementationName()
{
return "com.sun.star.comp.chart2.PageBackground";
diff --git a/chart2/source/model/main/PageBackground.hxx b/chart2/source/model/main/PageBackground.hxx
index 9157eb9d90c9..e7d4a41c2f80 100644
--- a/chart2/source/model/main/PageBackground.hxx
+++ b/chart2/source/model/main/PageBackground.hxx
@@ -93,6 +93,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
};
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx
index e9ac5e4a529f..a492b6fb5024 100644
--- a/chart2/source/model/main/StockBar.cxx
+++ b/chart2/source/model/main/StockBar.cxx
@@ -23,6 +23,7 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <tools/diagnose_ex.h>
@@ -103,6 +104,19 @@ struct StaticStockBarDefaults : public rtl::StaticAggregate< ::chart::tPropertyV
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_STOCK );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -141,6 +155,9 @@ uno::Reference< util::XCloneable > SAL_CALL StockBar::createClone()
// ____ OPropertySet ____
uno::Any StockBar::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticStockBarDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -204,6 +221,20 @@ void StockBar::firePropertyChangeEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void StockBar::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void StockBar::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_STOCK );
+}
+
using impl::StockBar_Base;
IMPLEMENT_FORWARD_XINTERFACE2( StockBar, StockBar_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
index 256199a99b5d..ce0c34408f60 100644
--- a/chart2/source/model/main/Title.cxx
+++ b/chart2/source/model/main/Title.cxx
@@ -23,6 +23,7 @@
#include <CloneHelper.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
@@ -222,6 +223,19 @@ struct StaticTitleInfo : public rtl::StaticAggregate< uno::Reference< beans::XPr
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_TITLE );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -285,6 +299,9 @@ void SAL_CALL Title::setText( const uno::Sequence< uno::Reference< chart2::XForm
// ____ OPropertySet ____
uno::Any Title::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticTitleDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -348,6 +365,20 @@ void Title::firePropertyChangeEvent()
fireModifyEvent();
}
+// ____ XChartStyles ____
+void Title::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void Title::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_TITLE );
+}
+
void Title::fireModifyEvent()
{
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
diff --git a/chart2/source/model/main/Title.hxx b/chart2/source/model/main/Title.hxx
index 9326b54b21ca..f49c77394f56 100644
--- a/chart2/source/model/main/Title.hxx
+++ b/chart2/source/model/main/Title.hxx
@@ -100,6 +100,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
void fireModifyEvent();
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > m_aStrings;
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx
index 5ba8aaf18401..f262b99b3b27 100644
--- a/chart2/source/model/main/Wall.cxx
+++ b/chart2/source/model/main/Wall.cxx
@@ -23,6 +23,7 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <StyleHandler.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <tools/diagnose_ex.h>
@@ -101,6 +102,19 @@ struct StaticWallInfo : public rtl::StaticAggregate< uno::Reference< beans::XPro
{
};
+struct StaticStyles_Initializer
+{
+ ::chart::StyleHandler* operator()()
+ {
+ ::chart::StyleHandler Styles( ::chart::StyleType::STYLETYPE_WALL );
+ return &Styles;
+ }
+};
+
+struct StaticStyles : public rtl::StaticAggregate< ::chart::StyleHandler, StaticStyles_Initializer >
+{
+};
+
} // anonymous namespace
namespace chart
@@ -129,6 +143,9 @@ uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
// ____ OPropertySet ____
uno::Any Wall::GetDefaultValue( sal_Int32 nHandle ) const
{
+
+ StyleHandler& rChartStyles = *StaticStyles::get();
+
const tPropertyValueMap& rStaticDefaults = *StaticWallDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
@@ -192,6 +209,20 @@ void Wall::firePropertyChangeEvent()
m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
}
+// ____ XChartStyles ____
+void Wall::setChartStyle( const sal_Int16 nValue )
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.setLocalStyle( nValue );
+ setAllPropertiesToDefault();
+}
+
+void Wall::createStyle()
+{
+ StyleHandler& rChartStyles = *StaticStyles::get();
+ rChartStyles.createStyle( getAllDirectProperties(), STYLETYPE_WALL );
+}
+
using impl::Wall_Base;
IMPLEMENT_FORWARD_XINTERFACE2( Wall, Wall_Base, ::property::OPropertySet )
diff --git a/chart2/source/model/main/Wall.hxx b/chart2/source/model/main/Wall.hxx
index a3112a614bda..fd8da5d58134 100644
--- a/chart2/source/model/main/Wall.hxx
+++ b/chart2/source/model/main/Wall.hxx
@@ -86,6 +86,10 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override;
+ virtual void createStyle() override;
+
private:
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx
index e56be9833937..cb58e0bd0ba9 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.hxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx
@@ -74,6 +74,10 @@ protected:
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
StackMode m_eStackMode;
};
diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx
index 593a1f7fecdd..e601ff9fb580 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.hxx
@@ -85,6 +85,10 @@ protected:
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
virtual bool isSwapXAndY() const override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
virtual void createCoordinateSystems(
const css::uno::Reference< css::chart2::XCoordinateSystemContainer > & xCooSysCnt ) override;
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
index b771d6f57545..ebcfc4d15f0b 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -68,6 +68,10 @@ protected:
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
+
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
};
} // namespace chart
diff --git a/chart2/source/model/template/ChartType.hxx b/chart2/source/model/template/ChartType.hxx
index 3274d5660c9b..14b5b3a07663 100644
--- a/chart2/source/model/template/ChartType.hxx
+++ b/chart2/source/model/template/ChartType.hxx
@@ -104,6 +104,10 @@ protected:
virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
index 9f04b633d2b3..1516f8acb27d 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
@@ -89,6 +89,10 @@ protected:
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
StackMode m_eStackMode;
};
diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx
index 2663fb11325d..b7ba709b0f15 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.hxx
@@ -75,6 +75,10 @@ protected:
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
StackMode m_eStackMode;
bool m_bHasSymbols;
diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx
index f11099fdd9f5..969ab999319f 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.hxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.hxx
@@ -102,6 +102,10 @@ protected:
virtual css::uno::Reference< css::chart2::XChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
+
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
};
} // namespace chart
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
index ee32e200f551..dad1ee1f8d20 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
@@ -76,6 +76,10 @@ protected:
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
bool m_bHasSymbols;
bool m_bHasLines;
diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx
index 6a05450f8194..07f06966ac1b 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.hxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.hxx
@@ -107,6 +107,10 @@ protected:
virtual css::uno::Reference< css::chart2::XChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
// todo: deprecate this variable
StockVariant m_eStockVariant;
diff --git a/chart2/source/tools/ImplOPropertySet.cxx b/chart2/source/tools/ImplOPropertySet.cxx
index 2eb03d99e52a..843865a36281 100644
--- a/chart2/source/tools/ImplOPropertySet.cxx
+++ b/chart2/source/tools/ImplOPropertySet.cxx
@@ -160,6 +160,11 @@ bool ImplOPropertySet::GetPropertyValueByHandle(
return bResult;
}
+const ImplOPropertySet::tPropertyMap& ImplOPropertySet::exportPropertyMap()
+{
+ return m_aProperties;
+}
+
void ImplOPropertySet::SetPropertyValueByHandle(
sal_Int32 nHandle, const Any & rValue )
{
diff --git a/chart2/source/tools/ImplOPropertySet.hxx b/chart2/source/tools/ImplOPropertySet.hxx
index 8cc1ea8b65d1..e71339b1b538 100644
--- a/chart2/source/tools/ImplOPropertySet.hxx
+++ b/chart2/source/tools/ImplOPropertySet.hxx
@@ -73,6 +73,7 @@ public:
std::map< sal_Int32, css::uno::Any >
tPropertyMap;
+ const tPropertyMap& exportPropertyMap();
private:
tPropertyMap m_aProperties;
css::uno::Reference< css::style::XStyle >
diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx
index 859dbcfdf757..d0e1c52fad35 100644
--- a/chart2/source/tools/OPropertySet.cxx
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -19,6 +19,7 @@
#include <OPropertySet.hxx>
#include "ImplOPropertySet.hxx"
+#include <StyleHandler.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <vector>
@@ -330,6 +331,11 @@ void SAL_CALL OPropertySet::getFastPropertyValue
}
}
+const impl::tPropertyMap& OPropertySet::getAllDirectProperties()
+{
+ return m_pImplProperties->exportPropertyMap();
+}
+
void OPropertySet::firePropertyChangeEvent()
{
// nothing in base class
@@ -367,6 +373,17 @@ void SAL_CALL OPropertySet::setFastPropertyValue( sal_Int32 nHandle, const Any&
firePropertyChangeEvent();
}
+// ____ XChartStyles ____
+void SAL_CALL OPropertySet::setDefaultStyle( const sal_Int16 nValue )
+{
+ chart::StyleHandler::setDefaultStyle( nValue );
+}
+
+void SAL_CALL OPropertySet::deleteStyle( const sal_Int16 nValue )
+{
+ chart::StyleHandler::deleteStyle( nValue );
+}
+
} // namespace property
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/RegressionCurveModel.hxx b/chart2/source/tools/RegressionCurveModel.hxx
index 05257e2dc950..b48428148b09 100644
--- a/chart2/source/tools/RegressionCurveModel.hxx
+++ b/chart2/source/tools/RegressionCurveModel.hxx
@@ -115,6 +115,10 @@ protected:
void fireModifyEvent();
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
private:
const tCurveType m_eRegressionCurveType;
diff --git a/chart2/source/tools/RegressionEquation.hxx b/chart2/source/tools/RegressionEquation.hxx
index 605dd115ade6..4e3656711984 100644
--- a/chart2/source/tools/RegressionEquation.hxx
+++ b/chart2/source/tools/RegressionEquation.hxx
@@ -110,6 +110,10 @@ private:
void fireModifyEvent();
+ // ____ XChartStyles ____
+ virtual void setChartStyle( const sal_Int16 nValue ) override{};
+ virtual void createStyle() override{};
+
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > m_aStrings;
css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
diff --git a/chart2/source/tools/StyleHandler.cxx b/chart2/source/tools/StyleHandler.cxx
new file mode 100644
index 000000000000..c1577c4f0d39
--- /dev/null
+++ b/chart2/source/tools/StyleHandler.cxx
@@ -0,0 +1,113 @@
+/* -*- 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 <StyleHandler.hxx>
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <vector>
+#include <memory>
+#include <map>
+#include <config_folders.h>
+
+using osl::FileBase;
+
+namespace
+{
+// File loading code goes here
+OUString lcl_GetFileUrl()
+{
+ OUString aURL = OUString("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/chart2/styles.xml");
+ rtl::Bootstrap::expandMacros(aURL);
+ return aURL;
+}
+
+void lcl_InitializeStyleMap()
+{}
+
+void lcl_exportStyle()
+{};
+
+} // namespace anonymous
+
+namespace chart
+{
+
+StyleHandler::StyleHandler( const StyleType eType ):
+ m_eType( eType )
+{
+ if ( !bIsDataLoaded )
+ {
+ bIsDataLoaded = true;
+ lcl_InitializeStyleMap(); // think I should hard code the current chart defaults in LibreOffice
+ loadStyleData();
+ }
+}
+
+StyleHandler::~StyleHandler()
+{}
+
+tStylePropertyMap& StyleHandler::getStyle()
+{
+ if ( m_nLocalStyle >= 0 )
+ {
+ // locally applied style will be used to supply default values
+ }
+ else
+ {
+ // global default for charts will be used if no local style is set
+ }
+}
+
+void StyleHandler::createStyle( const tStylePropertyMap& rPropMap, StyleType eType )
+{
+ //chart export code goes here
+}
+
+void StyleHandler::deleteStyle( const sal_Int16 nValue )
+{
+ //remove the style from loaded data and remove the data from the style sheel xml
+}
+
+std::vector< std::vector< tStylePropertyMap > > StyleHandler::m_pStyleMap =
+ std::vector< std::vector< tStylePropertyMap > >();
+
+sal_Int16 StyleHandler::m_nDefaultStyle = 1;
+std::unique_ptr< osl::File > StyleHandler::m_pStyleSheet = std::make_unique< osl::File >( lcl_GetFileUrl() );
+bool StyleHandler::bIsDataLoaded = false;
+
+void StyleHandler::loadStyleData()
+{
+ // chart import code goes here ( to be used only once to cache all the styles )
+}
+
+void StyleHandler::setLocalStyle( const sal_Int16 nValue )
+{
+ if ( nValue >= 0 )
+ m_nLocalStyle = nValue;
+}
+
+void StyleHandler::setDefaultStyle( const sal_Int16 nValue )
+{
+ if ( nValue >= 0 )
+ m_nDefaultStyle = nValue;
+}
+
+} // namespace chart
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 59d7e16772c8..1e6cb6fba7c7 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2021,6 +2021,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\
XChartDocument \
XChartShape \
XChartShapeContainer \
+ XChartStyles \
XChartType \
XChartTypeContainer \
XChartTypeManager \
diff --git a/offapi/com/sun/star/chart2/XChartStyles.idl b/offapi/com/sun/star/chart2/XChartStyles.idl
new file mode 100644
index 000000000000..d466516508a2
--- /dev/null
+++ b/offapi/com/sun/star/chart2/XChartStyles.idl
@@ -0,0 +1,51 @@
+/* -*- 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_XChartStyles_idl
+#define com_sun_star_chart2_XChartStyles_idl
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com
+{
+module sun
+{
+module star
+{
+module chart2
+{
+
+interface XChartStyles : ::com::sun::star::uno::XInterface
+{
+ void setChartStyle( [in] short nValue );
+
+ void setDefaultStyle( [in] short nValue );
+
+ void createStyle();
+
+ void deleteStyle( [in] short nValue );
+};
+
+} ; // chart2
+} ; // com
+} ; // sun
+} ; // star
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */