summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-29 20:25:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-30 07:10:21 +0100
commit2f2e1bb1f7a247923fc2e25bbfb227756a1f7f2a (patch)
treea05a970652ec90987724e60db8d80532cd04b18b /chart2/source/model
parent56c3cc776a7b0a487a794029f68a30244d65857b (diff)
use more concrete types in chart2, Legend
Change-Id: Ib6bff730c50fdda095482f2ebf2c4e7b63b0e26b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129155 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model')
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index a9eb264292c3..b31c510b3e68 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -30,6 +30,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <BaseCoordinateSystem.hxx>
+#include <Legend.hxx>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -413,20 +414,14 @@ void ChartModel::insertDefaultChart()
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
// create and attach legend
- Reference< chart2::XLegend > xLegend(
- m_xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Legend", m_xContext ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xLegendProperties( xLegend, uno::UNO_QUERY );
- if( xLegendProperties.is() )
- {
- xLegendProperties->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
- xLegendProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
- xLegendProperties->setPropertyValue( "LineColor", uno::Any( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30
- xLegendProperties->setPropertyValue( "FillColor", uno::Any( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
+ rtl::Reference< Legend > xLegend = new Legend();
+ xLegend->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
+ xLegend->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
+ xLegend->setPropertyValue( "LineColor", uno::Any( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30
+ xLegend->setPropertyValue( "FillColor", uno::Any( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
- if( bIsRTL )
- xLegendProperties->setPropertyValue( "AnchorPosition", uno::Any( chart2::LegendPosition_LINE_START ));
- }
+ if( bIsRTL )
+ xLegend->setPropertyValue( "AnchorPosition", uno::Any( chart2::LegendPosition_LINE_START ));
if(xDiagram.is())
xDiagram->setLegend( xLegend );