Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / xmloff / source / chart / SchXMLSeries2Context.cxx
blob5c1c9f18d41ec4d261772abc8c92f54320117636
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "SchXMLSeries2Context.hxx"
21 #include "SchXMLPlotAreaContext.hxx"
22 #include "SchXMLRegressionCurveObjectContext.hxx"
23 #include "SchXMLPropertyMappingContext.hxx"
24 #include "SchXMLTools.hxx"
25 #include "PropertyMap.hxx"
27 #include <com/sun/star/chart2/XChartDocument.hpp>
28 #include <com/sun/star/chart2/XDataSeries.hpp>
29 #include <com/sun/star/chart2/XRegressionCurve.hpp>
30 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
31 #include <com/sun/star/chart2/data/XDataSink.hpp>
32 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
34 #include <com/sun/star/chart/ChartAxisAssign.hpp>
35 #include <com/sun/star/chart/ChartSymbolType.hpp>
36 #include <com/sun/star/container/XChild.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/chart/ChartLegendPosition.hpp>
39 #include <com/sun/star/drawing/LineStyle.hpp>
40 #include <com/sun/star/embed/Aspects.hpp>
41 #include <com/sun/star/embed/XVisualObject.hpp>
42 #include <com/sun/star/uno/XComponentContext.hpp>
44 #include <comphelper/processfactory.hxx>
46 #include <rtl/ustrbuf.hxx>
47 #include <xmloff/xmlnmspe.hxx>
48 #include <xmloff/xmlimp.hxx>
49 #include <xmloff/nmspmap.hxx>
50 #include <xmloff/SchXMLSeriesHelper.hxx>
51 #include "SchXMLImport.hxx"
52 #include <xmloff/prstylei.hxx>
53 #include <xmloff/xmlprmap.hxx>
55 #include <typeinfo>
57 using namespace ::com::sun::star;
58 using namespace ::xmloff::token;
60 using ::com::sun::star::uno::Reference;
61 using ::com::sun::star::uno::Sequence;
63 namespace
66 class SchXMLDomain2Context : public SvXMLImportContext
68 private:
69 ::std::vector< OUString > & mrAddresses;
71 public:
72 SchXMLDomain2Context( SvXMLImport& rImport,
73 sal_uInt16 nPrefix,
74 const OUString& rLocalName,
75 ::std::vector< OUString > & rAddresses );
76 virtual ~SchXMLDomain2Context();
77 virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) override;
80 SchXMLDomain2Context::SchXMLDomain2Context(
81 SvXMLImport& rImport,
82 sal_uInt16 nPrefix,
83 const OUString& rLocalName,
84 ::std::vector< OUString > & rAddresses ) :
85 SvXMLImportContext( rImport, nPrefix, rLocalName ),
86 mrAddresses( rAddresses )
90 SchXMLDomain2Context::~SchXMLDomain2Context()
94 void SchXMLDomain2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
96 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
98 for( sal_Int16 i = 0; i < nAttrCount; i++ )
100 OUString sAttrName = xAttrList->getNameByIndex( i );
101 OUString aLocalName;
102 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
104 if( nPrefix == XML_NAMESPACE_TABLE &&
105 IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) )
107 Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
108 mrAddresses.push_back( xAttrList->getValueByIndex( i ));
113 void lcl_setAutomaticSymbolSize( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
115 awt::Size aSymbolSize(140,140);//old default for standard sized charts 7cm height
117 uno::Reference< chart::XChartDocument > xChartDoc( rImport.GetModel(), uno::UNO_QUERY );
118 if( xChartDoc.is() )
120 double fScale = 1;
121 uno::Reference< beans::XPropertySet > xLegendProp( xChartDoc->getLegend(), uno::UNO_QUERY );
122 chart::ChartLegendPosition aLegendPosition = chart::ChartLegendPosition_NONE;
123 if( xLegendProp.is() && (xLegendProp->getPropertyValue("Alignment") >>= aLegendPosition)
124 && chart::ChartLegendPosition_NONE != aLegendPosition )
127 double fFontHeight = 6.0;
128 if( xLegendProp->getPropertyValue("CharHeight") >>= fFontHeight )
129 fScale = 0.75*fFontHeight/6.0;
131 else
133 uno::Reference< embed::XVisualObject > xVisualObject( rImport.GetModel(), uno::UNO_QUERY );
134 if( xVisualObject.is() )
136 awt::Size aPageSize( xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ) );
137 fScale = aPageSize.Height/7000.0;
140 if( fScale>0 )
142 aSymbolSize.Height = static_cast<sal_Int32>( fScale * aSymbolSize.Height );
143 aSymbolSize.Width = aSymbolSize.Height;
146 xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( aSymbolSize ));
149 void lcl_setSymbolSizeIfNeeded( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
151 if( !xSeriesOrPointProp.is() )
152 return;
154 sal_Int32 nSymbolType = chart::ChartSymbolType::NONE;
155 if( xSeriesOrPointProp.is() && ( xSeriesOrPointProp->getPropertyValue("SymbolType") >>= nSymbolType) )
157 if(chart::ChartSymbolType::NONE!=nSymbolType)
159 if( chart::ChartSymbolType::BITMAPURL==nSymbolType )
161 //set special size for graphics to indicate to use the bitmap size itself
162 xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( awt::Size(-1,-1) ));
164 else
166 lcl_setAutomaticSymbolSize( xSeriesOrPointProp, rImport );
172 void lcl_resetSymbolSizeForPointsIfNecessary( const uno::Reference< beans::XPropertySet >& xPointProp, const SvXMLImport& rImport
173 , const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
175 uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( "SymbolSize", pPropStyleContext, pStylesCtxt ) );
176 if( !aASymbolSize.hasValue() )
177 lcl_setSymbolSizeIfNeeded( xPointProp, rImport );
180 void lcl_insertErrorBarLSequencesToMap(
181 tSchXMLLSequencesPerIndex & rInOutMap,
182 const uno::Reference< beans::XPropertySet > & xSeriesProp )
184 Reference< chart2::data::XDataSource > xErrorBarSource;
185 if( ( xSeriesProp->getPropertyValue( "ErrorBarY" ) >>= xErrorBarSource ) &&
186 xErrorBarSource.is() )
188 Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSequences(
189 xErrorBarSource->getDataSequences());
190 for( sal_Int32 nIndex = 0; nIndex < aLSequences.getLength(); ++nIndex )
192 // use "0" as data index. This is ok, as it is not used for error bars
193 rInOutMap.insert(
194 tSchXMLLSequencesPerIndex::value_type(
195 tSchXMLIndexWithPart( 0, SCH_XML_PART_ERROR_BARS ), aLSequences[ nIndex ] ));
200 Reference< chart2::data::XLabeledDataSequence2 > lcl_createAndAddSequenceToSeries( const OUString& rRole
201 , const OUString& rRange
202 , const Reference< chart2::XChartDocument >& xChartDoc
203 , const Reference< chart2::XDataSeries >& xSeries )
205 Reference< chart2::data::XLabeledDataSequence2 > xLabeledSeq;
207 Reference< chart2::data::XDataSource > xSeriesSource( xSeries,uno::UNO_QUERY );
208 Reference< chart2::data::XDataSink > xSeriesSink( xSeries, uno::UNO_QUERY );
210 if( !(!rRange.isEmpty() && xChartDoc.is() && xSeriesSource.is() && xSeriesSink.is()) )
211 return xLabeledSeq;
213 // create a new sequence
214 xLabeledSeq = SchXMLTools::GetNewLabeledDataSequence();
216 // set values at the new sequence
217 Reference< chart2::data::XDataSequence > xSeq = SchXMLTools::CreateDataSequence( rRange, xChartDoc );
218 Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
219 if( xSeqProp.is())
220 xSeqProp->setPropertyValue("Role", uno::makeAny( rRole));
221 xLabeledSeq->setValues( xSeq );
223 // add new sequence to data series / push to front to have the correct sequence order if charttype is changed afterwards
224 Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeq( xSeriesSource->getDataSequences());
225 sal_Int32 nOldCount = aOldSeq.getLength();
226 Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 );
227 aNewSeq[0].set(xLabeledSeq, uno::UNO_QUERY_THROW);
228 for( sal_Int32 nN=0; nN<nOldCount; nN++ )
229 aNewSeq[nN+1] = aOldSeq[nN];
230 xSeriesSink->setData( aNewSeq );
232 return xLabeledSeq;
235 XMLPropStyleContext* lcl_GetStylePropContext(
236 const SvXMLStylesContext* pStylesCtxt,
237 const SvXMLStyleContext*& rpStyle,
238 OUString& rStyleName )
240 rpStyle = pStylesCtxt->FindStyleChildContext( SchXMLImportHelper::GetChartFamilyID(), rStyleName );
241 XMLPropStyleContext* pPropStyleContext =
242 const_cast< XMLPropStyleContext* >(dynamic_cast< const XMLPropStyleContext* >( rpStyle ));
243 return pPropStyleContext;
246 } // anonymous namespace
248 SchXMLSeries2Context::SchXMLSeries2Context(
249 SchXMLImportHelper& rImpHelper,
250 SvXMLImport& rImport, const OUString& rLocalName,
251 const Reference< chart2::XChartDocument > & xNewDoc,
252 std::vector< SchXMLAxis >& rAxes,
253 ::std::list< DataRowPointStyle >& rStyleList,
254 ::std::list< RegressionStyle >& rRegressionStyleList,
255 sal_Int32 nSeriesIndex,
256 bool bStockHasVolume,
257 GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
258 const OUString & aGlobalChartTypeName,
259 tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
260 bool& rGlobalChartTypeUsedBySeries,
261 const awt::Size & rChartSize ) :
262 SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
263 mrImportHelper( rImpHelper ),
264 mxNewDoc( xNewDoc ),
265 mrAxes( rAxes ),
266 mrStyleList( rStyleList ),
267 mrRegressionStyleList( rRegressionStyleList ),
268 m_xSeries(nullptr),
269 mnSeriesIndex( nSeriesIndex ),
270 mnDataPointIndex( 0 ),
271 m_bStockHasVolume( bStockHasVolume ),
272 m_rGlobalSeriesImportInfo(rGlobalSeriesImportInfo),
273 mpAttachedAxis( nullptr ),
274 mnAttachedAxis( 0 ),
275 maGlobalChartTypeName( aGlobalChartTypeName ),
276 maSeriesChartTypeName( aGlobalChartTypeName ),
277 m_bHasDomainContext(false),
278 mrLSequencesPerIndex( rLSequencesPerIndex ),
279 mrGlobalChartTypeUsedBySeries( rGlobalChartTypeUsedBySeries ),
280 mbSymbolSizeIsMissingInFile(false),
281 maChartSize( rChartSize )
283 if( aGlobalChartTypeName == "com.sun.star.chart2.DonutChartType" )
285 maSeriesChartTypeName = "com.sun.star.chart2.PieChartType";
286 maGlobalChartTypeName = maSeriesChartTypeName;
290 SchXMLSeries2Context::~SchXMLSeries2Context()
292 SAL_WARN_IF( !maPostponedSequences.empty(), "xmloff.chart", "maPostponedSequences is NULL");
295 void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
297 // parse attributes
298 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
299 const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetSeriesAttrTokenMap();
300 mnAttachedAxis = 1;
302 bool bHasRange = false;
303 OUString aSeriesLabelRange;
304 OUString aSeriesLabelString;
306 for( sal_Int16 i = 0; i < nAttrCount; i++ )
308 OUString sAttrName = xAttrList->getNameByIndex( i );
309 OUString aLocalName;
310 OUString aValue = xAttrList->getValueByIndex( i );
311 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
313 switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
315 case XML_TOK_SERIES_CELL_RANGE:
316 m_aSeriesRange = aValue;
317 bHasRange = true;
318 break;
319 case XML_TOK_SERIES_LABEL_ADDRESS:
320 aSeriesLabelRange = aValue;
321 break;
322 case XML_TOK_SERIES_LABEL_STRING:
323 aSeriesLabelString = aValue;
324 break;
325 case XML_TOK_SERIES_ATTACHED_AXIS:
327 sal_Int32 nNumOfAxes = mrAxes.size();
328 for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ )
330 if( aValue.equals( mrAxes[ nCurrent ].aName ) &&
331 mrAxes[ nCurrent ].eDimension == SCH_XML_AXIS_Y )
333 mpAttachedAxis = &( mrAxes[ nCurrent ] );
337 break;
338 case XML_TOK_SERIES_STYLE_NAME:
339 msAutoStyleName = aValue;
340 break;
341 case XML_TOK_SERIES_CHART_CLASS:
343 OUString aClassName;
344 sal_uInt16 nClassPrefix =
345 GetImport().GetNamespaceMap().GetKeyByAttrName(
346 aValue, &aClassName );
347 if( XML_NAMESPACE_CHART == nClassPrefix )
348 maSeriesChartTypeName = SchXMLTools::GetChartTypeByClassName( aClassName, false /* bUseOldNames */ );
350 if( maSeriesChartTypeName.isEmpty())
351 maSeriesChartTypeName = aClassName;
353 break;
357 if( mpAttachedAxis )
359 if( mpAttachedAxis->nAxisIndex > 0 )
361 // secondary axis => property has to be set (primary is default)
362 mnAttachedAxis = 2;
368 SAL_WARN_IF( !mxNewDoc.is(), "xmloff.chart", "mxNewDoc is NULL");
369 if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange )
370 m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = false;
372 bool bIsCandleStick = maGlobalChartTypeName == "com.sun.star.chart2.CandleStickChartType";
373 if( !maSeriesChartTypeName.isEmpty() )
375 bIsCandleStick = maSeriesChartTypeName == "com.sun.star.chart2.CandleStickChartType";
377 else
379 if( bIsCandleStick
380 && m_bStockHasVolume
381 && mnSeriesIndex == 0 )
383 maSeriesChartTypeName = "com.sun.star.chart2.ColumnChartType";
384 bIsCandleStick = false;
386 else
388 maSeriesChartTypeName = maGlobalChartTypeName;
391 if( ! mrGlobalChartTypeUsedBySeries )
392 mrGlobalChartTypeUsedBySeries = (maSeriesChartTypeName.equals( maGlobalChartTypeName ));
393 sal_Int32 nCoordinateSystemIndex = 0;//so far we can only import one coordinate system
394 m_xSeries.set(
395 SchXMLImportHelper::GetNewDataSeries( mxNewDoc, nCoordinateSystemIndex, maSeriesChartTypeName, ! mrGlobalChartTypeUsedBySeries ));
396 Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( SchXMLTools::GetNewLabeledDataSequence(), uno::UNO_QUERY_THROW );
398 if( bIsCandleStick )
400 // set default color for range-line to black (before applying styles)
401 Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY );
402 if( xSeriesProp.is())
403 xSeriesProp->setPropertyValue("Color",
404 uno::makeAny( sal_Int32( 0x000000 ))); // black
406 else if ( maSeriesChartTypeName == "com.sun.star.chart2.PieChartType" )
408 //@todo: this property should be saved
409 Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY );
410 if( xSeriesProp.is())
411 xSeriesProp->setPropertyValue("VaryColorsByPoint",
412 uno::makeAny( true ));
415 // values
416 Reference< chart2::data::XDataSequence > xSeq;
417 if( bHasRange && !m_aSeriesRange.isEmpty() )
418 xSeq = SchXMLTools::CreateDataSequence( m_aSeriesRange, mxNewDoc );
420 Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
421 if( xSeqProp.is())
423 OUString aMainRole("values-y");
424 if ( maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType" )
425 aMainRole = "values-size";
426 xSeqProp->setPropertyValue("Role", uno::makeAny( aMainRole ));
428 xLabeledSeq->setValues( xSeq );
430 // register for setting local data if external data provider is not present
431 maPostponedSequences.insert(
432 tSchXMLLSequencesPerIndex::value_type(
433 tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
435 // label
436 if( !aSeriesLabelRange.isEmpty() )
438 Reference< chart2::data::XDataSequence > xLabelSequence =
439 SchXMLTools::CreateDataSequence( aSeriesLabelRange, mxNewDoc );
440 xLabeledSeq->setLabel( xLabelSequence );
442 else if( !aSeriesLabelString.isEmpty() )
444 Reference< chart2::data::XDataSequence > xLabelSequence =
445 SchXMLTools::CreateDataSequenceWithoutConvert( aSeriesLabelString, mxNewDoc );
446 xLabeledSeq->setLabel( xLabelSequence );
449 // Note: Even if we have no label, we have to register the label
450 // for creation, because internal data always has labels. If
451 // they don't exist in the original, auto-generated labels are
452 // used for the internal data.
453 maPostponedSequences.insert(
454 tSchXMLLSequencesPerIndex::value_type(
455 tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_LABEL ), xLabeledSeq ));
457 Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( &xLabeledSeq, 1 );
458 Reference< chart2::data::XDataSink > xSink( m_xSeries, uno::UNO_QUERY_THROW );
459 xSink->setData( aSeq );
461 catch( const uno::Exception & ex )
463 SAL_WARN("xmloff.chart", "Exception caught. Type: " << OUString::createFromAscii( typeid( ex ).name()) << ", Message: " << ex.Message);
466 //init mbSymbolSizeIsMissingInFile:
469 if( !msAutoStyleName.isEmpty() )
471 const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
472 if( pStylesCtxt )
474 const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
475 SchXMLImportHelper::GetChartFamilyID(), msAutoStyleName );
477 const XMLPropStyleContext* pPropStyleContext = dynamic_cast< const XMLPropStyleContext * >( pStyle );
479 uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( "SymbolSize"
480 , pPropStyleContext, pStylesCtxt ) );
481 mbSymbolSizeIsMissingInFile = !aASymbolSize.hasValue();
485 catch( const uno::Exception & )
490 struct DomainInfo
492 DomainInfo( const OUString& rRole, const OUString& rRange, sal_Int32 nIndex )
493 : aRole(rRole), aRange(rRange), nIndexForLocalData(nIndex)
496 OUString aRole;
497 OUString aRange;
498 sal_Int32 nIndexForLocalData;
501 void SchXMLSeries2Context::EndElement()
503 // special handling for different chart types. This is necessary as the
504 // roles are not yet saved in the file format
505 sal_Int32 nDomainCount = maDomainAddresses.size();
506 bool bIsScatterChart = maSeriesChartTypeName == "com.sun.star.chart2.ScatterChartType";
507 bool bIsBubbleChart = maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType";
508 bool bDeleteSeries = false;
509 std::vector< DomainInfo > aDomainInfos;
511 //different handling for different chart types necessary
512 if( bIsScatterChart || ( nDomainCount==1 && !bIsBubbleChart ) )
514 DomainInfo aDomainInfo( OUString( "values-x" ), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
515 bool bCreateXValues = true;
516 if( !maDomainAddresses.empty() )
518 if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.isEmpty() )
520 m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
521 m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
523 aDomainInfo.aRange = maDomainAddresses.front();
524 aDomainInfo.nIndexForLocalData = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
525 m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
527 else if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.isEmpty() && !m_bHasDomainContext && mnSeriesIndex==0 )
529 if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) //wrong old chart files:
531 //for xy charts the first series needs to have a domain
532 //if this by error iss not the case the first series is taken s x values
533 //needed for wrong files created while having an addin (e.g. BoxPlot)
534 m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = m_aSeriesRange;
535 m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
536 bDeleteSeries = true;
537 bCreateXValues = false;//they will be created for the next series
540 if( bCreateXValues )
541 aDomainInfos.push_back( aDomainInfo );
543 else if( bIsBubbleChart )
545 if( nDomainCount>1 )
547 DomainInfo aDomainInfo( OUString( "values-x" ), maDomainAddresses[1], m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
548 if( m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.isEmpty() )
550 //for bubble chart the second domain contains the x values which should become an index smaller than y values for own data table
551 //->so second first
552 m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress = maDomainAddresses[1];
553 m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
555 aDomainInfos.push_back( aDomainInfo );
556 m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
558 else if( !m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress.isEmpty() )
560 DomainInfo aDomainInfo( OUString( "values-x" ), m_rGlobalSeriesImportInfo.aFirstSecondDomainAddress, m_rGlobalSeriesImportInfo.nFirstSecondDomainIndex ) ;
561 aDomainInfos.push_back( aDomainInfo );
563 if( nDomainCount>0)
565 DomainInfo aDomainInfo( OUString( "values-y" ), maDomainAddresses.front(), m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
566 if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.isEmpty() )
568 m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress = maDomainAddresses.front();
569 m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
571 aDomainInfos.push_back( aDomainInfo );
572 m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
574 else if( !m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.isEmpty() )
576 DomainInfo aDomainInfo( OUString("values-y"), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
577 aDomainInfos.push_back( aDomainInfo );
581 if( bDeleteSeries )
583 //delete created series
584 SchXMLImportHelper::DeleteDataSeries(
585 m_xSeries, Reference< chart2::XChartDocument >( GetImport().GetModel(), uno::UNO_QUERY ) );
587 else
589 //add style
590 if( !msAutoStyleName.isEmpty() || mnAttachedAxis != 1 )
592 DataRowPointStyle aStyle(
593 DataRowPointStyle::DATA_SERIES,
594 m_xSeries,
595 -1, 1,
596 msAutoStyleName, mnAttachedAxis );
597 aStyle.mbSymbolSizeForSeriesIsMissingInFile=mbSymbolSizeIsMissingInFile;
598 mrStyleList.push_back( aStyle );
602 for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt )
604 DomainInfo aDomainInfo( *aIt );
605 Reference< chart2::data::XLabeledDataSequence2 > xLabeledSeq =
606 lcl_createAndAddSequenceToSeries( aDomainInfo.aRole, aDomainInfo.aRange, mxNewDoc, m_xSeries );
607 if( xLabeledSeq.is() )
609 // register for setting local data if external data provider is not present
610 mrLSequencesPerIndex.insert(
611 tSchXMLLSequencesPerIndex::value_type(
612 tSchXMLIndexWithPart( aDomainInfo.nIndexForLocalData, SCH_XML_PART_VALUES ),
613 Reference< chart2::data::XLabeledDataSequence >(xLabeledSeq, uno::UNO_QUERY_THROW) ));
617 if( !bDeleteSeries )
619 for( tSchXMLLSequencesPerIndex::const_iterator aIt( maPostponedSequences.begin());
620 aIt != maPostponedSequences.end(); ++aIt )
622 sal_Int32 nNewIndex = aIt->first.first + nDomainCount;
623 mrLSequencesPerIndex.insert(
624 tSchXMLLSequencesPerIndex::value_type(
625 tSchXMLIndexWithPart( nNewIndex, aIt->first.second ), aIt->second ));
627 m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
629 maPostponedSequences.clear();
632 SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
633 sal_uInt16 nPrefix,
634 const OUString& rLocalName,
635 const uno::Reference< xml::sax::XAttributeList >& )
637 SvXMLImportContext* pContext = nullptr;
638 const SvXMLTokenMap& rTokenMap = mrImportHelper.GetSeriesElemTokenMap();
640 switch( rTokenMap.Get( nPrefix, rLocalName ))
642 case XML_TOK_SERIES_DOMAIN:
643 if( m_xSeries.is())
645 m_bHasDomainContext = true;
646 pContext = new SchXMLDomain2Context(
647 GetImport(),
648 nPrefix, rLocalName,
649 maDomainAddresses );
651 break;
653 case XML_TOK_SERIES_MEAN_VALUE_LINE:
654 pContext = new SchXMLStatisticsObjectContext(
655 mrImportHelper, GetImport(),
656 nPrefix, rLocalName, msAutoStyleName,
657 mrStyleList, m_xSeries,
658 SchXMLStatisticsObjectContext::CONTEXT_TYPE_MEAN_VALUE_LINE,
659 mrLSequencesPerIndex );
660 break;
661 case XML_TOK_SERIES_REGRESSION_CURVE:
662 pContext = new SchXMLRegressionCurveObjectContext(
663 mrImportHelper, GetImport(),
664 nPrefix, rLocalName, mrRegressionStyleList,
665 m_xSeries, maChartSize );
666 break;
667 case XML_TOK_SERIES_ERROR_INDICATOR:
668 pContext = new SchXMLStatisticsObjectContext(
669 mrImportHelper, GetImport(),
670 nPrefix, rLocalName, msAutoStyleName,
671 mrStyleList, m_xSeries,
672 SchXMLStatisticsObjectContext::CONTEXT_TYPE_ERROR_INDICATOR,
673 mrLSequencesPerIndex );
674 break;
676 case XML_TOK_SERIES_DATA_POINT:
677 pContext = new SchXMLDataPointContext( GetImport(), rLocalName,
678 mrStyleList, m_xSeries, mnDataPointIndex, mbSymbolSizeIsMissingInFile );
679 break;
680 case XML_TOK_SERIES_PROPERTY_MAPPING:
681 pContext = new SchXMLPropertyMappingContext( mrImportHelper,
682 GetImport(), rLocalName,
683 mrLSequencesPerIndex, m_xSeries );
684 break;
686 default:
687 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
690 return pContext;
693 //static
694 void SchXMLSeries2Context::initSeriesPropertySets( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
695 , const uno::Reference< frame::XModel >& xChartModel )
697 ::std::list< DataRowPointStyle >::iterator iStyle;
699 // iterate over series first and remind propertysets in map
700 // new api <-> old api wrapper
701 ::std::map< Reference< chart2::XDataSeries >, Reference< beans::XPropertySet > > aSeriesMap;
702 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
704 if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
705 continue;
707 if( !iStyle->m_xOldAPISeries.is() )
708 iStyle->m_xOldAPISeries = SchXMLSeriesHelper::createOldAPISeriesPropertySet( iStyle->m_xSeries, xChartModel );
710 aSeriesMap[iStyle->m_xSeries] = iStyle->m_xOldAPISeries;
714 //initialize m_xOldAPISeries for all other styles also
715 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
717 if( iStyle->meType == DataRowPointStyle::DATA_SERIES )
718 continue;
719 iStyle->m_xOldAPISeries = aSeriesMap[iStyle->m_xSeries];
723 //static
724 void SchXMLSeries2Context::setDefaultsToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles )
726 ::std::list< DataRowPointStyle >::iterator iStyle;
727 // iterate over series
728 // call initSeriesPropertySets first
730 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
732 if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
733 continue;
737 uno::Reference< beans::XPropertySet > xSeries( iStyle->m_xOldAPISeries );
738 if( !xSeries.is() )
739 continue;
741 if( rSeriesDefaultsAndStyles.maSymbolTypeDefault.hasValue() )
742 xSeries->setPropertyValue("SymbolType",rSeriesDefaultsAndStyles.maSymbolTypeDefault);
743 if( rSeriesDefaultsAndStyles.maDataCaptionDefault.hasValue() )
744 xSeries->setPropertyValue("DataCaption",rSeriesDefaultsAndStyles.maDataCaptionDefault);
746 if( rSeriesDefaultsAndStyles.maErrorIndicatorDefault.hasValue() )
747 xSeries->setPropertyValue("ErrorIndicator",rSeriesDefaultsAndStyles.maErrorIndicatorDefault);
748 if( rSeriesDefaultsAndStyles.maErrorCategoryDefault.hasValue() )
749 xSeries->setPropertyValue("ErrorCategory",rSeriesDefaultsAndStyles.maErrorCategoryDefault);
750 if( rSeriesDefaultsAndStyles.maConstantErrorLowDefault.hasValue() )
751 xSeries->setPropertyValue("ConstantErrorLow",rSeriesDefaultsAndStyles.maConstantErrorLowDefault);
752 if( rSeriesDefaultsAndStyles.maConstantErrorHighDefault.hasValue() )
753 xSeries->setPropertyValue("ConstantErrorHigh",rSeriesDefaultsAndStyles.maConstantErrorHighDefault);
754 if( rSeriesDefaultsAndStyles.maPercentageErrorDefault.hasValue() )
755 xSeries->setPropertyValue("PercentageError",rSeriesDefaultsAndStyles.maPercentageErrorDefault);
756 if( rSeriesDefaultsAndStyles.maErrorMarginDefault.hasValue() )
757 xSeries->setPropertyValue("ErrorMargin",rSeriesDefaultsAndStyles.maErrorMarginDefault);
759 if( rSeriesDefaultsAndStyles.maMeanValueDefault.hasValue() )
760 xSeries->setPropertyValue("MeanValue",rSeriesDefaultsAndStyles.maMeanValueDefault);
761 if( rSeriesDefaultsAndStyles.maRegressionCurvesDefault.hasValue() )
762 xSeries->setPropertyValue("RegressionCurves",rSeriesDefaultsAndStyles.maRegressionCurvesDefault);
764 catch( uno::Exception & )
766 //end of series reached
771 //static
772 void SchXMLSeries2Context::setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
773 , const SvXMLStylesContext* pStylesCtxt
774 , const SvXMLStyleContext*& rpStyle
775 , OUString& rCurrStyleName
776 , SchXMLImportHelper& rImportHelper
777 , const SvXMLImport& rImport
778 , bool bIsStockChart
779 , tSchXMLLSequencesPerIndex & rInOutLSequencesPerIndex )
781 ::std::list< DataRowPointStyle >::iterator iStyle;
783 // iterate over series
784 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
786 if( iStyle->meType == DataRowPointStyle::DATA_SERIES )
790 uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
791 if( !xSeriesProp.is() )
792 continue;
794 if( iStyle->mnAttachedAxis != 1 )
796 xSeriesProp->setPropertyValue("Axis"
797 , uno::makeAny(chart::ChartAxisAssign::SECONDARY_Y) );
800 if( !(iStyle->msStyleName).isEmpty())
802 if( ! rCurrStyleName.equals( iStyle->msStyleName ))
804 rCurrStyleName = iStyle->msStyleName;
805 rpStyle = pStylesCtxt->FindStyleChildContext(
806 SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
809 //set style to series
810 // note: SvXMLStyleContext::FillPropertySet is not const
811 XMLPropStyleContext * pPropStyleContext =
812 const_cast< XMLPropStyleContext * >(
813 dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
814 if( pPropStyleContext )
816 // error bar style must be set before the other error
817 // bar properties (which may be alphabetically before
818 // this property)
819 bool bHasErrorBarRangesFromData = false;
821 const OUString aErrorBarStylePropName( "ErrorBarStyle");
822 uno::Any aErrorBarStyle(
823 SchXMLTools::getPropertyFromContext( aErrorBarStylePropName, pPropStyleContext, pStylesCtxt ));
824 if( aErrorBarStyle.hasValue())
826 xSeriesProp->setPropertyValue( aErrorBarStylePropName, aErrorBarStyle );
827 sal_Int32 eEBStyle = chart::ErrorBarStyle::NONE;
828 bHasErrorBarRangesFromData =
829 ( ( aErrorBarStyle >>= eEBStyle ) &&
830 eEBStyle == chart::ErrorBarStyle::FROM_DATA );
834 //don't set the style to the min max line series of a stock chart
835 //otherwise the min max line properties gets overwritten and the series becomes invisible typically
836 bool bIsMinMaxSeries = false;
837 if( bIsStockChart )
839 if( SchXMLSeriesHelper::isCandleStickSeries( iStyle->m_xSeries
840 , uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) )
841 bIsMinMaxSeries = true;
843 if( !bIsMinMaxSeries )
845 pPropStyleContext->FillPropertySet( xSeriesProp );
846 if( iStyle->mbSymbolSizeForSeriesIsMissingInFile )
847 lcl_setSymbolSizeIfNeeded( xSeriesProp, rImport );
848 if( bHasErrorBarRangesFromData )
849 lcl_insertErrorBarLSequencesToMap( rInOutLSequencesPerIndex, xSeriesProp );
854 catch( const uno::Exception & rEx )
856 SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
862 // static
863 void SchXMLSeries2Context::setStylesToRegressionCurves(
864 SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
865 const SvXMLStylesContext* pStylesCtxt,
866 const SvXMLStyleContext*& rpStyle,
867 OUString& rCurrentStyleName )
869 std::list< RegressionStyle >::iterator iStyle;
871 // iterate over regession etc
872 for( iStyle = rSeriesDefaultsAndStyles.maRegressionStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maRegressionStyleList.end(); ++iStyle )
876 OUString aServiceName;
877 XMLPropStyleContext* pPropStyleContext = nullptr;
879 if (!rCurrentStyleName.isEmpty())
881 XMLPropStyleContext* pCurrent = lcl_GetStylePropContext(pStylesCtxt, rpStyle, rCurrentStyleName);
882 if( pCurrent )
884 pPropStyleContext = pCurrent;
885 uno::Any aAny = SchXMLTools::getPropertyFromContext("RegressionType", pPropStyleContext, pStylesCtxt);
886 if ( aAny.hasValue() )
888 aAny >>= aServiceName;
893 if (!iStyle->msStyleName.isEmpty())
895 XMLPropStyleContext* pCurrent = lcl_GetStylePropContext(pStylesCtxt, rpStyle, iStyle->msStyleName);
896 if( pCurrent )
898 pPropStyleContext = pCurrent;
899 uno::Any aAny = SchXMLTools::getPropertyFromContext("RegressionType", pPropStyleContext, pStylesCtxt);
900 if ( aAny.hasValue() )
902 aAny >>= aServiceName;
907 if( !aServiceName.isEmpty() )
909 Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
910 Reference< chart2::XRegressionCurve > xRegCurve( xMSF->createInstance( aServiceName ), uno::UNO_QUERY_THROW );
911 Reference< chart2::XRegressionCurveContainer > xRegCurveCont( iStyle->m_xSeries, uno::UNO_QUERY_THROW );
913 if( xRegCurve.is())
915 Reference< beans::XPropertySet > xCurveProperties( xRegCurve, uno::UNO_QUERY );
916 if( pPropStyleContext != nullptr)
917 pPropStyleContext->FillPropertySet( xCurveProperties );
919 xRegCurve->setEquationProperties( iStyle->m_xEquationProperties );
922 xRegCurveCont->addRegressionCurve( xRegCurve );
925 catch( const uno::Exception& rEx )
927 SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
933 // static
934 void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
935 , const SvXMLStylesContext* pStylesCtxt
936 , const SvXMLStyleContext*& rpStyle
937 , OUString& rCurrStyleName )
939 ::std::list< DataRowPointStyle >::iterator iStyle;
941 // iterate over regession etc
942 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
944 if( iStyle->meType == DataRowPointStyle::ERROR_INDICATOR ||
945 iStyle->meType == DataRowPointStyle::MEAN_VALUE )
947 if ( iStyle->meType == DataRowPointStyle::ERROR_INDICATOR )
949 uno::Reference< beans::XPropertySet > xNewSeriesProp(iStyle->m_xSeries,uno::UNO_QUERY);
951 if (iStyle->m_xErrorXProperties.is())
952 xNewSeriesProp->setPropertyValue("ErrorBarX",uno::makeAny(iStyle->m_xErrorXProperties));
954 if (iStyle->m_xErrorYProperties.is())
955 xNewSeriesProp->setPropertyValue("ErrorBarY",uno::makeAny(iStyle->m_xErrorYProperties));
960 uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
961 if( !xSeriesProp.is() )
962 continue;
964 if( !(iStyle->msStyleName).isEmpty())
966 if( ! rCurrStyleName.equals( iStyle->msStyleName ))
968 rCurrStyleName = iStyle->msStyleName;
969 rpStyle = pStylesCtxt->FindStyleChildContext(
970 SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
973 // note: SvXMLStyleContext::FillPropertySet is not const
974 XMLPropStyleContext * pPropStyleContext =
975 const_cast< XMLPropStyleContext * >(
976 dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
977 if( pPropStyleContext )
979 Reference< beans::XPropertySet > xStatPropSet;
980 switch( iStyle->meType )
982 case DataRowPointStyle::MEAN_VALUE:
983 xSeriesProp->getPropertyValue("DataMeanValueProperties") >>= xStatPropSet;
984 break;
985 case DataRowPointStyle::ERROR_INDICATOR:
986 xSeriesProp->getPropertyValue("DataErrorProperties") >>= xStatPropSet;
987 break;
988 default:
989 break;
991 if( xStatPropSet.is())
992 pPropStyleContext->FillPropertySet( xStatPropSet );
996 catch( const uno::Exception & rEx )
998 SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
1004 //static
1005 void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
1006 , const SvXMLStylesContext* pStylesCtxt
1007 , const SvXMLStyleContext*& rpStyle
1008 , OUString& rCurrStyleName
1009 , SchXMLImportHelper& rImportHelper
1010 , const SvXMLImport& rImport
1011 , bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter )
1013 ::std::list< DataRowPointStyle >::iterator iStyle;
1014 for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
1016 if( iStyle->meType != DataRowPointStyle::DATA_POINT )
1017 continue;
1019 if( iStyle->m_nPointIndex == -1 )
1020 continue;
1022 //ignore datapoint properties for stock charts
1023 //... todo ...
1024 if( bIsStockChart )
1026 if( SchXMLSeriesHelper::isCandleStickSeries( iStyle->m_xSeries, uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) )
1027 continue;
1030 // data point style
1031 for( sal_Int32 i = 0; i < iStyle->m_nPointRepeat; i++ )
1035 uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
1036 if(!xSeriesProp.is())
1037 continue;
1039 uno::Reference< beans::XPropertySet > xPointProp(
1040 SchXMLSeriesHelper::createOldAPIDataPointPropertySet( iStyle->m_xSeries, iStyle->m_nPointIndex + i
1041 , uno::Reference< frame::XModel >( rImportHelper.GetChartDocument(), uno::UNO_QUERY ) ) );
1043 if( !xPointProp.is() )
1044 continue;
1046 if( bIsDonutChart )
1048 //set special series styles for donut charts first
1049 if( !rCurrStyleName.equals( iStyle->msSeriesStyleNameForDonuts ) )
1051 rCurrStyleName = iStyle->msSeriesStyleNameForDonuts;
1052 rpStyle = pStylesCtxt->FindStyleChildContext(
1053 SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
1056 // note: SvXMLStyleContext::FillPropertySet is not const
1057 XMLPropStyleContext * pPropStyleContext =
1058 const_cast< XMLPropStyleContext * >(
1059 dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
1060 if( pPropStyleContext )
1061 pPropStyleContext->FillPropertySet( xPointProp );
1066 //need to set this explicitly here for old files as the new api does not support this property fully anymore
1067 if( bSwitchOffLinesForScatter )
1068 xPointProp->setPropertyValue("Lines",uno::makeAny(false));
1070 catch( const uno::Exception & )
1074 if( !rCurrStyleName.equals( iStyle->msStyleName ) )
1076 rCurrStyleName = iStyle->msStyleName;
1077 rpStyle = pStylesCtxt->FindStyleChildContext(
1078 SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
1081 // note: SvXMLStyleContext::FillPropertySet is not const
1082 XMLPropStyleContext * pPropStyleContext =
1083 const_cast< XMLPropStyleContext * >(
1084 dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
1085 if( pPropStyleContext )
1087 pPropStyleContext->FillPropertySet( xPointProp );
1088 if( iStyle->mbSymbolSizeForSeriesIsMissingInFile )
1089 lcl_resetSymbolSizeForPointsIfNecessary( xPointProp, rImport, pPropStyleContext, pStylesCtxt );
1092 catch( const uno::Exception & rEx )
1094 SAL_INFO("xmloff.chart", "Exception caught during setting styles to data points: " << rEx.Message );
1097 } // styles iterator
1100 //static
1101 void SchXMLSeries2Context::switchSeriesLinesOff( ::std::list< DataRowPointStyle >& rSeriesStyleList )
1103 ::std::list< DataRowPointStyle >::iterator iStyle;
1104 // iterate over series
1106 for( iStyle = rSeriesStyleList.begin(); iStyle != rSeriesStyleList.end(); ++iStyle )
1108 if( iStyle->meType != DataRowPointStyle::DATA_SERIES )
1109 continue;
1113 uno::Reference< beans::XPropertySet > xSeries( iStyle->m_xOldAPISeries );
1114 if( !xSeries.is() )
1115 continue;
1117 xSeries->setPropertyValue("Lines",uno::makeAny(false));
1119 catch( uno::Exception & )
1121 //end of series reached
1126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */