summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-16 12:43:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-16 12:44:15 +0200
commitca52e5ff2c98268ad1965d43746d3c0f9a53fa79 (patch)
treed971c75c72dcb83edf0b78bb704c99715b50d457
parent2c7a4e8aff00f88dcc333f607a1c4334b197a4a1 (diff)
support property mapping in new 3D charts
Change-Id: I3da71e354ed2595c1f5b2eaeb5fb565205d24de0
-rw-r--r--chart2/source/model/template/GL3DBarChartType.cxx9
-rw-r--r--chart2/source/model/template/GL3DBarChartType.hxx3
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx9
3 files changed, 20 insertions, 1 deletions
diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
index 4e8868ccbae1..e99fe390c871 100644
--- a/chart2/source/model/template/GL3DBarChartType.cxx
+++ b/chart2/source/model/template/GL3DBarChartType.cxx
@@ -118,6 +118,15 @@ OUString SAL_CALL GL3DBarChartType::getChartType()
return CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR;
}
+uno::Sequence<OUString> GL3DBarChartType::getSupportedPropertyRoles()
+ throw (::com::sun::star::uno::RuntimeException, std::exception)
+{
+ uno::Sequence< OUString > aPropRoles(1);
+ aPropRoles[0] = "FillColor";
+
+ return aPropRoles;
+}
+
com::sun::star::uno::Reference<com::sun::star::util::XCloneable>
GL3DBarChartType::createClone()
throw (com::sun::star::uno::RuntimeException, std::exception)
diff --git a/chart2/source/model/template/GL3DBarChartType.hxx b/chart2/source/model/template/GL3DBarChartType.hxx
index f60ba4ac9bbb..c758d467bf6d 100644
--- a/chart2/source/model/template/GL3DBarChartType.hxx
+++ b/chart2/source/model/template/GL3DBarChartType.hxx
@@ -25,6 +25,9 @@ public:
GL3DBarChartType( const css::uno::Reference<css::uno::XComponentContext>& xContext );
virtual ~GL3DBarChartType();
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedPropertyRoles()
+ throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual OUString SAL_CALL
getImplementationName()
throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 3697903231bd..9921d9607026 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -77,6 +77,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
const VDataSeries& rDataSeries = *itr;
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
+ bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
+
// Create series name text object.
OUString aSeriesName =
DataSeriesHelper::getDataSeriesLabel(
@@ -96,12 +98,17 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
{
+ if(bMappedFillProperty)
+ {
+ nColor = static_cast<sal_uInt32>(rDataSeries.getValueByProperty(nIndex, "FillColor"));
+ }
+
float nVal = rDataSeries.getYValue(nIndex);
float nXPos = nIndex * (nBarSizeX + nBarDistanceX);
glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal);
- glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, static_cast<float>(0));
+ glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, 0.0f);
glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
maShapes.push_back(new opengl3D::Bar(mpRenderer.get(), aBarPosition, nColor, nId++));