[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - 2 commits - chart2/source offapi/com
Markus Mohrhard (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 16 15:14:53 UTC 2019
chart2/source/inc/ChartStyle.hxx | 14 ++++-
chart2/source/model/main/ChartModel.cxx | 2
chart2/source/tools/ChartStyle.cxx | 77 +++++++++++++++++++++++++++++
offapi/com/sun/star/chart2/XChartStyle.idl | 7 ++
4 files changed, 99 insertions(+), 1 deletion(-)
New commits:
commit 77792f9c9c0b92182a0855fae9dcf9274efa0730
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Fri Aug 16 23:13:30 2019 +0800
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Aug 16 23:13:30 2019 +0800
format file
Change-Id: I42c0069b63ced24eee99d43a7319cc50fd629e30
diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx
index fc1f06270f90..54cbc5fe243b 100644
--- a/chart2/source/inc/ChartStyle.hxx
+++ b/chart2/source/inc/ChartStyle.hxx
@@ -101,8 +101,8 @@ public:
virtual void SAL_CALL
applyStyleToTitle(const css::uno::Reference<css::chart2::XTitle>& xTitle) override;
- virtual void SAL_CALL
- applyStyleToBackground(const css::uno::Reference<css::beans::XPropertySet>& xBackground) override;
+ virtual void SAL_CALL applyStyleToBackground(
+ const css::uno::Reference<css::beans::XPropertySet>& xBackground) override;
// XStyle
virtual sal_Bool SAL_CALL isUserDefined() override;
@@ -124,7 +124,8 @@ private:
void applyStyleToAxis(const css::uno::Reference<css::chart2::XAxis>& xAxis);
- void applyStyleToCoordinates(const css::uno::Reference<css::chart2::XCoordinateSystemContainer>& xCooSysCont);
+ void applyStyleToCoordinates(
+ const css::uno::Reference<css::chart2::XCoordinateSystemContainer>& xCooSysCont);
};
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::container::XNameContainer> getChartStyles();
commit 2e31f4ab53b77ebbb0932ced6cafe8e2c8af49a2
Author: Gagandeep Singh <deepgagan231197 at gmail.com>
AuthorDate: Tue Aug 13 15:28:38 2019 +0530
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Aug 16 19:40:46 2019 +0800
Add more methods to XChartStyle.idl for applying styles to title, axis,..
Change-Id: I6ce9b3da584671636830122ef9ac9f6b9f54d132
diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx
index c82611ee163c..fc1f06270f90 100644
--- a/chart2/source/inc/ChartStyle.hxx
+++ b/chart2/source/inc/ChartStyle.hxx
@@ -24,6 +24,7 @@
#include <comphelper/uno3.hxx>
#include <cppuhelper/propshlp.hxx>
#include <com/sun/star/chart2/XChartStyle.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -95,7 +96,13 @@ public:
SAL_CALL getStyleForObject(const sal_Int16 nChartObjectType) override;
virtual void SAL_CALL
- applyStyleToDiagram(const css::uno::Reference<css::chart2::XDiagram>& xDiagram);
+ applyStyleToDiagram(const css::uno::Reference<css::chart2::XDiagram>& xDiagram) override;
+
+ virtual void SAL_CALL
+ applyStyleToTitle(const css::uno::Reference<css::chart2::XTitle>& xTitle) override;
+
+ virtual void SAL_CALL
+ applyStyleToBackground(const css::uno::Reference<css::beans::XPropertySet>& xBackground) override;
// XStyle
virtual sal_Bool SAL_CALL isUserDefined() override;
@@ -114,6 +121,10 @@ private:
std::map<sal_Int16, css::uno::Reference<css::beans::XPropertySet>> m_xChartStyle;
void register_styles();
+
+ void applyStyleToAxis(const css::uno::Reference<css::chart2::XAxis>& xAxis);
+
+ void applyStyleToCoordinates(const css::uno::Reference<css::chart2::XCoordinateSystemContainer>& xCooSysCont);
};
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::container::XNameContainer> getChartStyles();
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 7c500abd4a07..4cda0d5882fc 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -935,6 +935,8 @@ void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >
ModifyListenerHelper::addListener( m_xTitle, this );
}
setModified( true );
+
+ m_xChartStyle->applyStyleToTitle( xTitle );
}
// _____ XChartStyled _____
diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx
index cb172fa30be7..2847b3db7f7d 100644
--- a/chart2/source/tools/ChartStyle.cxx
+++ b/chart2/source/tools/ChartStyle.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/chart2/ChartObjectType.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <rtl/instance.hxx>
#include <vector>
@@ -187,6 +188,56 @@ css::uno::Sequence<OUString> SAL_CALL ChartStyle::getSupportedServiceNames()
return { "com.sun.star.chart2.ChartStyle" };
}
+void SAL_CALL ChartStyle::applyStyleToTitle(const css::uno::Reference<css::chart2::XTitle>& xTitle)
+{
+ css::uno::Reference<css::style::XStyleSupplier> xTitleStyle(xTitle, css::uno::UNO_QUERY);
+ if (xTitleStyle.is())
+ {
+ xTitleStyle->setStyle(css::uno::Reference<css::style::XStyle>(
+ m_xChartStyle.find(css::chart2::ChartObjectType::TITLE)->second,
+ css::uno::UNO_QUERY_THROW));
+ }
+}
+
+void ChartStyle::applyStyleToAxis(const css::uno::Reference<css::chart2::XAxis>& xAxis)
+{
+ css::uno::Reference<css::style::XStyleSupplier> xAxisStyle(xAxis, css::uno::UNO_QUERY);
+ if (xAxisStyle.is())
+ {
+ xAxisStyle->setStyle(css::uno::Reference<css::style::XStyle>(
+ m_xChartStyle.find(css::chart2::ChartObjectType::AXIS)->second,
+ css::uno::UNO_QUERY_THROW));
+ }
+
+ css::uno::Reference<css::chart2::XTitled> xTitled(xAxis, css::uno::UNO_QUERY);
+ if (xTitled.is())
+ {
+ css::uno::Reference<css::chart2::XTitle> xTitle = xTitled->getTitleObject();
+ if (xTitle.is())
+ applyStyleToTitle(xTitle);
+ }
+}
+
+void ChartStyle::applyStyleToCoordinates(
+ const css::uno::Reference<css::chart2::XCoordinateSystemContainer>& xCooSysCont)
+{
+ css::uno::Sequence<css::uno::Reference<css::chart2::XCoordinateSystem>> aCooSysSeq(
+ xCooSysCont->getCoordinateSystems());
+
+ for (sal_Int32 nCooSysIdx = 0; nCooSysIdx < aCooSysSeq.getLength(); ++nCooSysIdx)
+ {
+ css::uno::Reference<css::chart2::XCoordinateSystem> xCooSys(aCooSysSeq[nCooSysIdx],
+ css::uno::UNO_QUERY);
+ sal_Int16 nDimCount = xCooSys->getDimension();
+ for (sal_Int16 nDimIdx = 0; nDimIdx <= nDimCount; nDimIdx++)
+ {
+ applyStyleToAxis(xCooSys->getAxisByDimension(nDimIdx, 0));
+ if (xCooSys->getMaximumAxisIndexByDimension(nDimIdx))
+ applyStyleToAxis(xCooSys->getAxisByDimension(nDimIdx, 1));
+ }
+ }
+}
+
void SAL_CALL
ChartStyle::applyStyleToDiagram(const css::uno::Reference<css::chart2::XDiagram>& xDiagram)
{
@@ -207,6 +258,32 @@ ChartStyle::applyStyleToDiagram(const css::uno::Reference<css::chart2::XDiagram>
m_xChartStyle.find(css::chart2::ChartObjectType::WALL)->second,
css::uno::UNO_QUERY_THROW));
}
+
+ css::uno::Reference<css::chart2::XTitled> xTitled(xDiagram, css::uno::UNO_QUERY);
+ if (xTitled.is())
+ {
+ css::uno::Reference<css::chart2::XTitle> xTitle = xTitled->getTitleObject();
+ if (xTitle.is())
+ applyStyleToTitle(xTitle);
+ }
+
+ css::uno::Reference<css::chart2::XCoordinateSystemContainer> xCooSysCont(xDiagram,
+ css::uno::UNO_QUERY);
+ if (xCooSysCont.is())
+ applyStyleToCoordinates(xCooSysCont);
+}
+
+void SAL_CALL
+ChartStyle::applyStyleToBackground(const css::uno::Reference<css::beans::XPropertySet>& xBackground)
+{
+ css::uno::Reference<css::style::XStyleSupplier> xBackgroundStyle(xBackground,
+ css::uno::UNO_QUERY);
+ if (xBackgroundStyle.is())
+ {
+ xBackgroundStyle->setStyle(css::uno::Reference<css::style::XStyle>(
+ m_xChartStyle.find(css::chart2::ChartObjectType::PAGE)->second,
+ css::uno::UNO_QUERY_THROW));
+ }
}
sal_Bool ChartStyle::isUserDefined() { return false; }
diff --git a/offapi/com/sun/star/chart2/XChartStyle.idl b/offapi/com/sun/star/chart2/XChartStyle.idl
index 3293f94f130a..754a368206df 100644
--- a/offapi/com/sun/star/chart2/XChartStyle.idl
+++ b/offapi/com/sun/star/chart2/XChartStyle.idl
@@ -14,6 +14,9 @@
#include <com/sun/star/beans/XPropertySet.idl>
#include <com/sun/star/chart2/ChartObjectType.idl>
#include <com/sun/star/chart2/XDiagram.idl>
+#include <com/sun/star/chart2/XTitle.idl>
+#include <com/sun/star/chart2/XAxis.idl>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
module com { module sun { module star { module chart2 {
@@ -22,6 +25,10 @@ interface XChartStyle : ::com::sun::star::uno::XInterface
com::sun::star::beans::XPropertySet getStyleForObject([in] short chartObjectType);
void applyStyleToDiagram([in] XDiagram chartDiagram);
+
+ void applyStyleToTitle([in] XTitle chartTitle);
+
+ void applyStyleToBackground([in] com::sun::star::beans::XPropertySet chartBackground);
};
}; }; }; };
More information about the Libreoffice-commits
mailing list