LibreOffice Module xmloff (master)  1
SchXMLSeries2Context.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include "SchXMLSeries2Context.hxx"
24 #include "SchXMLTools.hxx"
25 
26 #include <com/sun/star/chart2/XChartDocument.hpp>
27 #include <com/sun/star/chart2/XDataSeries.hpp>
28 #include <com/sun/star/chart2/XRegressionCurve.hpp>
29 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
30 #include <com/sun/star/chart2/data/XDataSink.hpp>
31 #include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
32 #include <com/sun/star/chart2/RelativePosition.hpp>
33 
34 #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
35 #include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
36 #include <com/sun/star/chart2/DataPointCustomLabelField.hpp>
37 
38 #include <com/sun/star/chart/ChartAxisAssign.hpp>
39 #include <com/sun/star/chart/ChartSymbolType.hpp>
40 #include <com/sun/star/chart/ErrorBarStyle.hpp>
41 #include <com/sun/star/chart/XChartDocument.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 #include <com/sun/star/chart/ChartLegendPosition.hpp>
44 #include <com/sun/star/embed/Aspects.hpp>
45 #include <com/sun/star/embed/XVisualObject.hpp>
46 
48 
49 #include <sal/log.hxx>
50 #include <xmloff/xmlnmspe.hxx>
51 #include <xmloff/xmlimp.hxx>
52 #include <xmloff/nmspmap.hxx>
54 #include <SchXMLImport.hxx>
55 #include <xmloff/prstylei.hxx>
56 #include <tools/diagnose_ex.h>
57 
58 using namespace ::com::sun::star;
59 using namespace ::xmloff::token;
60 
61 using ::com::sun::star::uno::Reference;
62 using ::com::sun::star::uno::Sequence;
63 
64 namespace
65 {
66 
67 class SchXMLDomain2Context : public SvXMLImportContext
68 {
69 private:
70  ::std::vector< OUString > & mrAddresses;
71 
72 public:
73  SchXMLDomain2Context( SvXMLImport& rImport,
74  sal_uInt16 nPrefix,
75  const OUString& rLocalName,
76  ::std::vector< OUString > & rAddresses );
77  virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) override;
78 };
79 
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 )
87 {
88 }
89 
90 void SchXMLDomain2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
91 {
92  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
93 
94  for( sal_Int16 i = 0; i < nAttrCount; i++ )
95  {
96  OUString sAttrName = xAttrList->getNameByIndex( i );
97  OUString aLocalName;
98  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
99 
100  if( nPrefix == XML_NAMESPACE_TABLE &&
101  IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) )
102  {
103  mrAddresses.push_back( xAttrList->getValueByIndex( i ));
104  }
105  }
106 }
107 
108 void lcl_setAutomaticSymbolSize( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
109 {
110  awt::Size aSymbolSize(140,140);//old default for standard sized charts 7cm height
111 
112  uno::Reference< chart::XChartDocument > xChartDoc( rImport.GetModel(), uno::UNO_QUERY );
113  if( xChartDoc.is() )
114  {
115  double fScale = 1;
116  uno::Reference< beans::XPropertySet > xLegendProp( xChartDoc->getLegend(), uno::UNO_QUERY );
117  chart::ChartLegendPosition aLegendPosition = chart::ChartLegendPosition_NONE;
118  if( xLegendProp.is() && (xLegendProp->getPropertyValue("Alignment") >>= aLegendPosition)
119  && chart::ChartLegendPosition_NONE != aLegendPosition )
120  {
121 
122  double fFontHeight = 6.0;
123  if( xLegendProp->getPropertyValue("CharHeight") >>= fFontHeight )
124  fScale = 0.75*fFontHeight/6.0;
125  }
126  else
127  {
128  uno::Reference< embed::XVisualObject > xVisualObject( rImport.GetModel(), uno::UNO_QUERY );
129  if( xVisualObject.is() )
130  {
131  awt::Size aPageSize( xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ) );
132  fScale = aPageSize.Height/7000.0;
133  }
134  }
135  if( fScale>0 )
136  {
137  aSymbolSize.Height = static_cast<sal_Int32>( fScale * aSymbolSize.Height );
138  aSymbolSize.Width = aSymbolSize.Height;
139  }
140  }
141  xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( aSymbolSize ));
142 }
143 
144 void lcl_setSymbolSizeIfNeeded( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, const SvXMLImport& rImport )
145 {
146  if( !xSeriesOrPointProp.is() )
147  return;
148 
149  sal_Int32 nSymbolType = chart::ChartSymbolType::NONE;
150  if( xSeriesOrPointProp.is() && ( xSeriesOrPointProp->getPropertyValue("SymbolType") >>= nSymbolType) )
151  {
152  if(chart::ChartSymbolType::NONE!=nSymbolType)
153  {
154  if( chart::ChartSymbolType::BITMAPURL==nSymbolType )
155  {
156  //set special size for graphics to indicate to use the bitmap size itself
157  xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( awt::Size(-1,-1) ));
158  }
159  else
160  {
161  lcl_setAutomaticSymbolSize( xSeriesOrPointProp, rImport );
162  }
163  }
164  }
165 }
166 
167 void lcl_resetSymbolSizeForPointsIfNecessary( const uno::Reference< beans::XPropertySet >& xPointProp, const SvXMLImport& rImport
168  , const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
169 {
170  uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( "SymbolSize", pPropStyleContext, pStylesCtxt ) );
171  if( !aASymbolSize.hasValue() )
172  lcl_setSymbolSizeIfNeeded( xPointProp, rImport );
173 }
174 
175 void lcl_setLinkNumberFormatToSourceIfNeeded( const uno::Reference< beans::XPropertySet >& xPointProp
176  , const XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
177 {
178  uno::Any aAny( SchXMLTools::getPropertyFromContext("LinkNumberFormatToSource", pPropStyleContext, pStylesCtxt) );
179  if( !aAny.hasValue() )
180  {
181  if( !xPointProp.is() )
182  return;
183 
184  bool bLinkToSource = false;
185  if( xPointProp.is() && (xPointProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource) )
186  {
187  if( bLinkToSource )
188  {
189  xPointProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(false));
190  }
191  }
192  }
193 }
194 
195 void lcl_insertErrorBarLSequencesToMap(
196  tSchXMLLSequencesPerIndex & rInOutMap,
197  const uno::Reference< beans::XPropertySet > & xSeriesProp )
198 {
199  Reference< chart2::data::XDataSource > xErrorBarSource;
200  if( ( xSeriesProp->getPropertyValue( "ErrorBarY" ) >>= xErrorBarSource ) &&
201  xErrorBarSource.is() )
202  {
203  const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSequences(
204  xErrorBarSource->getDataSequences());
205  for( const auto& rLSequence : aLSequences )
206  {
207  // use "0" as data index. This is ok, as it is not used for error bars
208  rInOutMap.emplace(
209  tSchXMLIndexWithPart( 0, SCH_XML_PART_ERROR_BARS ), rLSequence );
210  }
211  }
212 }
213 
214 Reference< chart2::data::XLabeledDataSequence2 > lcl_createAndAddSequenceToSeries( const OUString& rRole
215  , const OUString& rRange
216  , const Reference< chart2::XChartDocument >& xChartDoc
217  , const Reference< chart2::XDataSeries >& xSeries )
218 {
219  Reference< chart2::data::XLabeledDataSequence2 > xLabeledSeq;
220 
221  Reference< chart2::data::XDataSource > xSeriesSource( xSeries,uno::UNO_QUERY );
222  Reference< chart2::data::XDataSink > xSeriesSink( xSeries, uno::UNO_QUERY );
223 
224  if( !(!rRange.isEmpty() && xChartDoc.is() && xSeriesSource.is() && xSeriesSink.is()) )
225  return xLabeledSeq;
226 
227  // create a new sequence
229 
230  // set values at the new sequence
231  Reference< chart2::data::XDataSequence > xSeq = SchXMLTools::CreateDataSequence( rRange, xChartDoc );
232  Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
233  if( xSeqProp.is())
234  xSeqProp->setPropertyValue("Role", uno::makeAny( rRole));
235  xLabeledSeq->setValues( xSeq );
236 
237  // add new sequence to data series / push to front to have the correct sequence order if charttype is changed afterwards
238  Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeq( xSeriesSource->getDataSequences());
239  sal_Int32 nOldCount = aOldSeq.getLength();
240  Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 );
241  aNewSeq[0].set(xLabeledSeq, uno::UNO_QUERY_THROW);
242  std::copy(aOldSeq.begin(), aOldSeq.end(), std::next(aNewSeq.begin()));
243  xSeriesSink->setData( aNewSeq );
244 
245  return xLabeledSeq;
246 }
247 
248 XMLPropStyleContext* lcl_GetStylePropContext(
249  const SvXMLStylesContext* pStylesCtxt,
250  const SvXMLStyleContext*& rpStyle,
251  OUString const & rStyleName )
252 {
253  rpStyle = pStylesCtxt->FindStyleChildContext( SchXMLImportHelper::GetChartFamilyID(), rStyleName );
254  XMLPropStyleContext* pPropStyleContext =
255  const_cast< XMLPropStyleContext* >(dynamic_cast< const XMLPropStyleContext* >( rpStyle ));
256  return pPropStyleContext;
257 }
258 
259 } // anonymous namespace
260 
262  SchXMLImportHelper& rImpHelper,
263  SvXMLImport& rImport, const OUString& rLocalName,
264  const Reference< chart2::XChartDocument > & xNewDoc,
265  std::vector< SchXMLAxis >& rAxes,
266  ::std::vector< DataRowPointStyle >& rStyleVector,
267  ::std::vector< RegressionStyle >& rRegressionStyleVector,
268  sal_Int32 nSeriesIndex,
269  bool bStockHasVolume,
270  GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
271  const OUString & aGlobalChartTypeName,
272  tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
273  bool& rGlobalChartTypeUsedBySeries,
274  const awt::Size & rChartSize ) :
275  SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
276  mrImportHelper( rImpHelper ),
277  mxNewDoc( xNewDoc ),
278  mrAxes( rAxes ),
279  mrStyleVector( rStyleVector ),
280  mrRegressionStyleVector( rRegressionStyleVector ),
281  mnSeriesIndex( nSeriesIndex ),
282  mnDataPointIndex( 0 ),
283  m_bStockHasVolume( bStockHasVolume ),
284  m_rGlobalSeriesImportInfo(rGlobalSeriesImportInfo),
285  mpAttachedAxis( nullptr ),
286  mnAttachedAxis( 0 ),
287  maGlobalChartTypeName( aGlobalChartTypeName ),
288  maSeriesChartTypeName( aGlobalChartTypeName ),
289  m_bHasDomainContext(false),
290  mrLSequencesPerIndex( rLSequencesPerIndex ),
291  mrGlobalChartTypeUsedBySeries( rGlobalChartTypeUsedBySeries ),
292  mbSymbolSizeIsMissingInFile(false),
293  maChartSize( rChartSize )
294 {
295  if( aGlobalChartTypeName == "com.sun.star.chart2.DonutChartType" )
296  {
297  maSeriesChartTypeName = "com.sun.star.chart2.PieChartType";
299  }
300 }
301 
303 {
304  SAL_WARN_IF( !maPostponedSequences.empty(), "xmloff.chart", "maPostponedSequences is NULL");
305 }
306 
307 void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
308 {
309  // parse attributes
310  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
311  const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetSeriesAttrTokenMap();
312  mnAttachedAxis = 1;
313 
314  bool bHasRange = false;
315  OUString aSeriesLabelRange;
316  OUString aSeriesLabelString;
317  bool bHideLegend = false;
318 
319  for( sal_Int16 i = 0; i < nAttrCount; i++ )
320  {
321  OUString sAttrName = xAttrList->getNameByIndex( i );
322  OUString aLocalName;
323  OUString aValue = xAttrList->getValueByIndex( i );
324  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
325 
326  switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
327  {
329  m_aSeriesRange = aValue;
330  bHasRange = true;
331  break;
333  aSeriesLabelRange = aValue;
334  break;
336  aSeriesLabelString = aValue;
337  break;
339  {
340  sal_Int32 nNumOfAxes = mrAxes.size();
341  for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ )
342  {
343  if( aValue == mrAxes[ nCurrent ].aName &&
344  mrAxes[ nCurrent ].eDimension == SCH_XML_AXIS_Y )
345  {
346  mpAttachedAxis = &( mrAxes[ nCurrent ] );
347  }
348  }
349  }
350  break;
352  msAutoStyleName = aValue;
353  break;
355  {
356  OUString aClassName;
357  sal_uInt16 nClassPrefix =
359  aValue, &aClassName );
360  if( XML_NAMESPACE_CHART == nClassPrefix )
361  maSeriesChartTypeName = SchXMLTools::GetChartTypeByClassName( aClassName, false /* bUseOldNames */ );
362 
363  if( maSeriesChartTypeName.isEmpty())
364  maSeriesChartTypeName = aClassName;
365  }
366  break;
368  bHideLegend = aValue.toBoolean();
369  break;
370  }
371  }
372 
373  if( mpAttachedAxis )
374  {
375  if( mpAttachedAxis->nAxisIndex > 0 )
376  {
377  // secondary axis => property has to be set (primary is default)
378  mnAttachedAxis = 2;
379  }
380  }
381 
382  try
383  {
384  SAL_WARN_IF( !mxNewDoc.is(), "xmloff.chart", "mxNewDoc is NULL");
387 
388  bool bIsCandleStick = maGlobalChartTypeName == "com.sun.star.chart2.CandleStickChartType";
389  if( !maSeriesChartTypeName.isEmpty() )
390  {
391  bIsCandleStick = maSeriesChartTypeName == "com.sun.star.chart2.CandleStickChartType";
392  }
393  else
394  {
395  if( bIsCandleStick
397  && mnSeriesIndex == 0 )
398  {
399  maSeriesChartTypeName = "com.sun.star.chart2.ColumnChartType";
400  bIsCandleStick = false;
401  }
402  else
403  {
405  }
406  }
409  sal_Int32 const nCoordinateSystemIndex = 0;//so far we can only import one coordinate system
410  m_xSeries.set(
413 
414  Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY );
415  if (xSeriesProp.is())
416  {
417  if (bHideLegend)
418  xSeriesProp->setPropertyValue("ShowLegendEntry", uno::makeAny(false));
419 
420  if( bIsCandleStick )
421  {
422  // set default color for range-line to black (before applying styles)
423  xSeriesProp->setPropertyValue("Color",
424  uno::makeAny( sal_Int32( 0x000000 ))); // black
425  }
426  else if ( maSeriesChartTypeName == "com.sun.star.chart2.PieChartType" )
427  {
428  //@todo: this property should be saved
429  xSeriesProp->setPropertyValue("VaryColorsByPoint",
430  uno::makeAny( true ));
431  }
432 
433  }
434 
435  Reference<chart2::data::XDataProvider> xDataProvider(mxNewDoc->getDataProvider());
436  Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider(xDataProvider, uno::UNO_QUERY);
437 
438  Reference<chart2::data::XDataSequence> xSequenceValues;
439 
440  // values
441  if (xPivotTableDataProvider.is()) // is pivot chart
442  {
443  xSequenceValues.set(xPivotTableDataProvider->createDataSequenceOfValuesByIndex(mnSeriesIndex));
444  }
445  else
446  {
447  if (bHasRange && !m_aSeriesRange.isEmpty())
449  }
450 
451  Reference<beans::XPropertySet> xSeqProp(xSequenceValues, uno::UNO_QUERY);
452  if (xSeqProp.is())
453  {
454  OUString aMainRole("values-y");
455  if (maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType")
456  aMainRole = "values-size";
457  xSeqProp->setPropertyValue("Role", uno::makeAny(aMainRole));
458  }
459  xLabeledSeq->setValues(xSequenceValues);
460 
461  // register for setting local data if external data provider is not present
462  maPostponedSequences.emplace(
464 
465  // label
466  Reference<chart2::data::XDataSequence> xSequenceLabel;
467 
468  if (xPivotTableDataProvider.is())
469  {
470  xSequenceLabel.set(xPivotTableDataProvider->createDataSequenceOfLabelsByIndex(mnSeriesIndex));
471  }
472  else
473  {
474  if (!aSeriesLabelRange.isEmpty())
475  {
476  xSequenceLabel.set(SchXMLTools::CreateDataSequence(aSeriesLabelRange, mxNewDoc));
477  }
478  else if (!aSeriesLabelString.isEmpty())
479  {
480  xSequenceLabel.set(SchXMLTools::CreateDataSequenceWithoutConvert(aSeriesLabelString, mxNewDoc));
481  }
482  }
483  xLabeledSeq->setLabel(xSequenceLabel);
484 
485  // Note: Even if we have no label, we have to register the label
486  // for creation, because internal data always has labels. If
487  // they don't exist in the original, auto-generated labels are
488  // used for the internal data.
489  maPostponedSequences.emplace(
491 
492  Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( &xLabeledSeq, 1 );
493  Reference< chart2::data::XDataSink > xSink( m_xSeries, uno::UNO_QUERY_THROW );
494  xSink->setData( aSeq );
495  }
496  catch( const uno::Exception &)
497  {
498  DBG_UNHANDLED_EXCEPTION("xmloff.chart");
499  }
500 
501  //init mbSymbolSizeIsMissingInFile:
502  try
503  {
504  if( !msAutoStyleName.isEmpty() )
505  {
507  if( pStylesCtxt )
508  {
509  const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
511 
512  const XMLPropStyleContext* pPropStyleContext = dynamic_cast< const XMLPropStyleContext * >( pStyle );
513 
514  uno::Any aASymbolSize( SchXMLTools::getPropertyFromContext( "SymbolSize"
515  , pPropStyleContext, pStylesCtxt ) );
516  mbSymbolSizeIsMissingInFile = !aASymbolSize.hasValue();
517  }
518  }
519  }
520  catch( const uno::Exception & )
521  {
522  }
523 }
524 
525 namespace {
526 
527 struct DomainInfo
528 {
529  DomainInfo( const OUString& rRole, const OUString& rRange, sal_Int32 nIndex )
530  : aRole(rRole), aRange(rRange), nIndexForLocalData(nIndex)
531  {}
532 
533  OUString aRole;
534  OUString aRange;
535  sal_Int32 nIndexForLocalData;
536 };
537 
538 }
539 
541 {
542  // special handling for different chart types. This is necessary as the
543  // roles are not yet saved in the file format
544  sal_Int32 nDomainCount = maDomainAddresses.size();
545  bool bIsScatterChart = maSeriesChartTypeName == "com.sun.star.chart2.ScatterChartType";
546  bool bIsBubbleChart = maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType";
547  bool bDeleteSeries = false;
548  std::vector< DomainInfo > aDomainInfos;
549 
550  //different handling for different chart types necessary
551  if( bIsScatterChart || ( nDomainCount==1 && !bIsBubbleChart ) )
552  {
554  bool bCreateXValues = true;
555  if( !maDomainAddresses.empty() )
556  {
558  {
561  }
562  aDomainInfo.aRange = maDomainAddresses.front();
563  aDomainInfo.nIndexForLocalData = m_rGlobalSeriesImportInfo.nCurrentDataIndex;
565  }
567  {
568  if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) //wrong old chart files:
569  {
570  //for xy charts the first series needs to have a domain
571  //if this by error iss not the case the first series is taken s x values
572  //needed for wrong files created while having an addin (e.g. BoxPlot)
575  bDeleteSeries = true;
576  bCreateXValues = false;//they will be created for the next series
577  }
578  }
579  if( bCreateXValues )
580  aDomainInfos.push_back( aDomainInfo );
581  }
582  else if( bIsBubbleChart )
583  {
584  if( nDomainCount>1 )
585  {
586  DomainInfo aDomainInfo( "values-x", maDomainAddresses[1], m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
588  {
589  //for bubble chart the second domain contains the x values which should become an index smaller than y values for own data table
590  //->so second first
593  }
594  aDomainInfos.push_back( aDomainInfo );
596  }
598  {
600  aDomainInfos.push_back( aDomainInfo );
601  }
602  if( nDomainCount>0)
603  {
604  DomainInfo aDomainInfo( "values-y", maDomainAddresses.front(), m_rGlobalSeriesImportInfo.nCurrentDataIndex ) ;
606  {
609  }
610  aDomainInfos.push_back( aDomainInfo );
612  }
614  {
616  aDomainInfos.push_back( aDomainInfo );
617  }
618  }
619 
620  if( bDeleteSeries )
621  {
622  //delete created series
624  m_xSeries, Reference< chart2::XChartDocument >( GetImport().GetModel(), uno::UNO_QUERY ) );
625  }
626  else
627  {
628  //add style
629  if( !msAutoStyleName.isEmpty() || mnAttachedAxis != 1 )
630  {
631  DataRowPointStyle aStyle(
633  m_xSeries,
634  -1, 1,
637  mrStyleVector.push_back( aStyle );
638  }
639  }
640 
641  for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt )
642  {
643  DomainInfo aDomainInfo( *aIt );
644  Reference< chart2::data::XLabeledDataSequence2 > xLabeledSeq =
645  lcl_createAndAddSequenceToSeries( aDomainInfo.aRole, aDomainInfo.aRange, mxNewDoc, m_xSeries );
646  if( xLabeledSeq.is() )
647  {
648  // register for setting local data if external data provider is not present
649  mrLSequencesPerIndex.emplace(
650  tSchXMLIndexWithPart( aDomainInfo.nIndexForLocalData, SCH_XML_PART_VALUES ),
651  Reference< chart2::data::XLabeledDataSequence >(xLabeledSeq, uno::UNO_QUERY_THROW) );
652  }
653  }
654 
655  if( !bDeleteSeries )
656  {
657  for (auto const& postponedSequence : maPostponedSequences)
658  {
659  sal_Int32 nNewIndex = postponedSequence.first.first + nDomainCount;
660  mrLSequencesPerIndex.emplace( tSchXMLIndexWithPart( nNewIndex, postponedSequence.first.second ), postponedSequence.second );
661  }
663  }
664  maPostponedSequences.clear();
665 }
666 
668  sal_uInt16 nPrefix,
669  const OUString& rLocalName,
670  const uno::Reference< xml::sax::XAttributeList >& )
671 {
672  SvXMLImportContext* pContext = nullptr;
674 
675  switch( rTokenMap.Get( nPrefix, rLocalName ))
676  {
678  if( m_xSeries.is())
679  {
680  m_bHasDomainContext = true;
681  pContext = new SchXMLDomain2Context(
682  GetImport(),
683  nPrefix, rLocalName,
685  }
686  break;
687 
689  pContext = new SchXMLStatisticsObjectContext(
691  nPrefix, rLocalName, msAutoStyleName,
695  break;
697  pContext = new SchXMLRegressionCurveObjectContext(
699  nPrefix, rLocalName, mrRegressionStyleVector,
701  break;
703  pContext = new SchXMLStatisticsObjectContext(
705  nPrefix, rLocalName, msAutoStyleName,
709  break;
710 
712  pContext = new SchXMLDataPointContext( mrImportHelper, GetImport(), rLocalName,
714  break;
717  GetImport(), rLocalName,
719  break;
720  }
721 
722  return pContext;
723 }
724 
725 //static
727  , const uno::Reference< frame::XModel >& xChartModel )
728 {
729  // iterate over series first and remind propertysets in map
730  // new api <-> old api wrapper
731  ::std::map< Reference< chart2::XDataSeries >, Reference< beans::XPropertySet > > aSeriesMap;
732  for (auto & seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
733  {
734  if( seriesStyle.meType != DataRowPointStyle::DATA_SERIES )
735  continue;
736 
737  if( !seriesStyle.m_xOldAPISeries.is() )
738  seriesStyle.m_xOldAPISeries = SchXMLSeriesHelper::createOldAPISeriesPropertySet( seriesStyle.m_xSeries, xChartModel );
739 
740  aSeriesMap[seriesStyle.m_xSeries] = seriesStyle.m_xOldAPISeries;
741 
742  }
743 
744  //initialize m_xOldAPISeries for all other styles also
745  for (auto & seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
746  {
747  if( seriesStyle.meType == DataRowPointStyle::DATA_SERIES )
748  continue;
749  seriesStyle.m_xOldAPISeries = aSeriesMap[seriesStyle.m_xSeries];
750  }
751 }
752 
753 //static
755 {
756  // iterate over series
757  // call initSeriesPropertySets first
758 
759  for (const auto & seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
760  {
761  if( seriesStyle.meType != DataRowPointStyle::DATA_SERIES )
762  continue;
763 
764  try
765  {
766  uno::Reference< beans::XPropertySet > xSeries( seriesStyle.m_xOldAPISeries );
767  if( !xSeries.is() )
768  continue;
769 
770  if( rSeriesDefaultsAndStyles.maSymbolTypeDefault.hasValue() )
771  xSeries->setPropertyValue("SymbolType",rSeriesDefaultsAndStyles.maSymbolTypeDefault);
772  if( rSeriesDefaultsAndStyles.maDataCaptionDefault.hasValue() )
773  xSeries->setPropertyValue("DataCaption",rSeriesDefaultsAndStyles.maDataCaptionDefault);
774 
775  if( rSeriesDefaultsAndStyles.maErrorIndicatorDefault.hasValue() )
776  xSeries->setPropertyValue("ErrorIndicator",rSeriesDefaultsAndStyles.maErrorIndicatorDefault);
777  if( rSeriesDefaultsAndStyles.maErrorCategoryDefault.hasValue() )
778  xSeries->setPropertyValue("ErrorCategory",rSeriesDefaultsAndStyles.maErrorCategoryDefault);
779  if( rSeriesDefaultsAndStyles.maConstantErrorLowDefault.hasValue() )
780  xSeries->setPropertyValue("ConstantErrorLow",rSeriesDefaultsAndStyles.maConstantErrorLowDefault);
781  if( rSeriesDefaultsAndStyles.maConstantErrorHighDefault.hasValue() )
782  xSeries->setPropertyValue("ConstantErrorHigh",rSeriesDefaultsAndStyles.maConstantErrorHighDefault);
783  if( rSeriesDefaultsAndStyles.maPercentageErrorDefault.hasValue() )
784  xSeries->setPropertyValue("PercentageError",rSeriesDefaultsAndStyles.maPercentageErrorDefault);
785  if( rSeriesDefaultsAndStyles.maErrorMarginDefault.hasValue() )
786  xSeries->setPropertyValue("ErrorMargin",rSeriesDefaultsAndStyles.maErrorMarginDefault);
787 
788  if( rSeriesDefaultsAndStyles.maMeanValueDefault.hasValue() )
789  xSeries->setPropertyValue("MeanValue",rSeriesDefaultsAndStyles.maMeanValueDefault);
790  if( rSeriesDefaultsAndStyles.maRegressionCurvesDefault.hasValue() )
791  xSeries->setPropertyValue("RegressionCurves",rSeriesDefaultsAndStyles.maRegressionCurvesDefault);
792  }
793  catch( uno::Exception & )
794  {
795  //end of series reached
796  }
797  }
798 }
799 
800 //static
802  , const SvXMLStylesContext* pStylesCtxt
803  , const SvXMLStyleContext*& rpStyle
804  , OUString& rCurrStyleName
805  , const SchXMLImportHelper& rImportHelper
806  , const SvXMLImport& rImport
807  , bool bIsStockChart
808  , tSchXMLLSequencesPerIndex & rInOutLSequencesPerIndex )
809 {
810  // iterate over series
811  for (const auto & seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
812  {
813  if( seriesStyle.meType == DataRowPointStyle::DATA_SERIES )
814  {
815  try
816  {
817  uno::Reference< beans::XPropertySet > xSeriesProp( seriesStyle.m_xOldAPISeries );
818  if( !xSeriesProp.is() )
819  continue;
820 
821  if( seriesStyle.mnAttachedAxis != 1 )
822  {
823  xSeriesProp->setPropertyValue("Axis"
824  , uno::makeAny(chart::ChartAxisAssign::SECONDARY_Y) );
825  }
826 
827  if( !seriesStyle.msStyleName.isEmpty())
828  {
829  if( rCurrStyleName != seriesStyle.msStyleName )
830  {
831  rCurrStyleName = seriesStyle.msStyleName;
832  rpStyle = pStylesCtxt->FindStyleChildContext(
833  SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
834  }
835 
836  //set style to series
837  // note: SvXMLStyleContext::FillPropertySet is not const
838  XMLPropStyleContext * pPropStyleContext =
839  const_cast< XMLPropStyleContext * >(
840  dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
841  if( pPropStyleContext )
842  {
843  // error bar style must be set before the other error
844  // bar properties (which may be alphabetically before
845  // this property)
846  bool bHasErrorBarRangesFromData = false;
847  {
848  const OUString aErrorBarStylePropName( "ErrorBarStyle");
849  uno::Any aErrorBarStyle(
850  SchXMLTools::getPropertyFromContext( aErrorBarStylePropName, pPropStyleContext, pStylesCtxt ));
851  if( aErrorBarStyle.hasValue())
852  {
853  xSeriesProp->setPropertyValue( aErrorBarStylePropName, aErrorBarStyle );
854  sal_Int32 eEBStyle = chart::ErrorBarStyle::NONE;
855  bHasErrorBarRangesFromData =
856  ( ( aErrorBarStyle >>= eEBStyle ) &&
857  eEBStyle == chart::ErrorBarStyle::FROM_DATA );
858  }
859  }
860 
861  //don't set the style to the min max line series of a stock chart
862  //otherwise the min max line properties gets overwritten and the series becomes invisible typically
863  bool bIsMinMaxSeries = false;
864  if( bIsStockChart )
865  {
866  if( SchXMLSeriesHelper::isCandleStickSeries( seriesStyle.m_xSeries
867  , rImportHelper.GetChartDocument() ) )
868  bIsMinMaxSeries = true;
869  }
870  if( !bIsMinMaxSeries )
871  {
872  pPropStyleContext->FillPropertySet( xSeriesProp );
873  if( seriesStyle.mbSymbolSizeForSeriesIsMissingInFile )
874  lcl_setSymbolSizeIfNeeded( xSeriesProp, rImport );
875  if( bHasErrorBarRangesFromData )
876  lcl_insertErrorBarLSequencesToMap( rInOutLSequencesPerIndex, xSeriesProp );
877  }
878  }
879  }
880  }
881  catch( const uno::Exception & )
882  {
883  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught during setting styles to series" );
884  }
885  }
886  }
887 }
888 
889 // static
891  SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
892  const SvXMLStylesContext* pStylesCtxt,
893  const SvXMLStyleContext*& rpStyle,
894  OUString const & rCurrentStyleName )
895 {
896  // iterate over regression etc
897  for (auto const& regressionStyle : rSeriesDefaultsAndStyles.maRegressionStyleVector)
898  {
899  try
900  {
901  OUString aServiceName;
902  XMLPropStyleContext* pPropStyleContext = nullptr;
903 
904  if (!rCurrentStyleName.isEmpty())
905  {
906  XMLPropStyleContext* pCurrent = lcl_GetStylePropContext(pStylesCtxt, rpStyle, rCurrentStyleName);
907  if( pCurrent )
908  {
909  pPropStyleContext = pCurrent;
910  uno::Any aAny = SchXMLTools::getPropertyFromContext("RegressionType", pPropStyleContext, pStylesCtxt);
911  if ( aAny.hasValue() )
912  {
913  aAny >>= aServiceName;
914  }
915  }
916  }
917 
918  if (!regressionStyle.msStyleName.isEmpty())
919  {
920  XMLPropStyleContext* pCurrent = lcl_GetStylePropContext(pStylesCtxt, rpStyle, regressionStyle.msStyleName);
921  if( pCurrent )
922  {
923  pPropStyleContext = pCurrent;
924  uno::Any aAny = SchXMLTools::getPropertyFromContext("RegressionType", pPropStyleContext, pStylesCtxt);
925  if ( aAny.hasValue() )
926  {
927  aAny >>= aServiceName;
928  }
929  }
930  }
931 
932  if( !aServiceName.isEmpty() )
933  {
934  Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
935  Reference< chart2::XRegressionCurve > xRegCurve( xMSF->createInstance( aServiceName ), uno::UNO_QUERY_THROW );
936  Reference< chart2::XRegressionCurveContainer > xRegCurveCont( regressionStyle.m_xSeries, uno::UNO_QUERY_THROW );
937 
938  Reference< beans::XPropertySet > xCurveProperties( xRegCurve, uno::UNO_QUERY );
939  if( pPropStyleContext != nullptr)
940  pPropStyleContext->FillPropertySet( xCurveProperties );
941 
942  xRegCurve->setEquationProperties( regressionStyle.m_xEquationProperties );
943 
944  xRegCurveCont->addRegressionCurve( xRegCurve );
945  }
946  }
947  catch( const uno::Exception& )
948  {
949  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught during setting styles to series" );
950  }
951 
952  }
953 }
954 
955 // static
957  , const SvXMLStylesContext* pStylesCtxt
958  , const SvXMLStyleContext*& rpStyle
959  , OUString& rCurrStyleName )
960 {
961  // iterate over regression etc
962  for (auto const& seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
963  {
964  if( seriesStyle.meType == DataRowPointStyle::ERROR_INDICATOR ||
965  seriesStyle.meType == DataRowPointStyle::MEAN_VALUE )
966  {
967  if ( seriesStyle.meType == DataRowPointStyle::ERROR_INDICATOR )
968  {
969  uno::Reference< beans::XPropertySet > xNewSeriesProp(seriesStyle.m_xSeries,uno::UNO_QUERY);
970 
971  if (seriesStyle.m_xErrorXProperties.is())
972  xNewSeriesProp->setPropertyValue("ErrorBarX",uno::makeAny(seriesStyle.m_xErrorXProperties));
973 
974  if (seriesStyle.m_xErrorYProperties.is())
975  xNewSeriesProp->setPropertyValue("ErrorBarY",uno::makeAny(seriesStyle.m_xErrorYProperties));
976  }
977 
978  try
979  {
980  uno::Reference< beans::XPropertySet > xSeriesProp( seriesStyle.m_xOldAPISeries );
981  if( !xSeriesProp.is() )
982  continue;
983 
984  if( !seriesStyle.msStyleName.isEmpty())
985  {
986  if( rCurrStyleName != seriesStyle.msStyleName )
987  {
988  rCurrStyleName = seriesStyle.msStyleName;
989  rpStyle = pStylesCtxt->FindStyleChildContext(
990  SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
991  }
992 
993  // note: SvXMLStyleContext::FillPropertySet is not const
994  XMLPropStyleContext * pPropStyleContext =
995  const_cast< XMLPropStyleContext * >(
996  dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
997  if( pPropStyleContext )
998  {
1000  switch( seriesStyle.meType )
1001  {
1003  xSeriesProp->getPropertyValue("DataMeanValueProperties") >>= xStatPropSet;
1004  break;
1006  xSeriesProp->getPropertyValue("DataErrorProperties") >>= xStatPropSet;
1007  break;
1008  default:
1009  break;
1010  }
1011  if( xStatPropSet.is())
1012  pPropStyleContext->FillPropertySet( xStatPropSet );
1013  }
1014  }
1015  }
1016  catch( const uno::Exception & )
1017  {
1018  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught during setting styles to series" );
1019  }
1020  }
1021  }
1022 }
1023 
1024 //static
1026  , const SvXMLStylesContext* pStylesCtxt
1027  , const SvXMLStyleContext*& rpStyle
1028  , OUString& rCurrStyleName
1029  , const SchXMLImportHelper& rImportHelper
1030  , const SvXMLImport& rImport
1031  , bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter )
1032 {
1033  for (auto const& seriesStyle : rSeriesDefaultsAndStyles.maSeriesStyleVector)
1034  {
1035  if( seriesStyle.meType != DataRowPointStyle::DATA_POINT )
1036  continue;
1037 
1038  if( seriesStyle.m_nPointIndex == -1 )
1039  continue;
1040 
1041  uno::Reference< beans::XPropertySet > xSeriesProp( seriesStyle.m_xOldAPISeries );
1042  if(!xSeriesProp.is())
1043  continue;
1044 
1045  //ignore datapoint properties for stock charts
1046  //... todo ...
1047  if( bIsStockChart )
1048  {
1049  if( SchXMLSeriesHelper::isCandleStickSeries( seriesStyle.m_xSeries, rImportHelper.GetChartDocument() ) )
1050  continue;
1051  }
1052 
1053  // data point style
1054  for( sal_Int32 i = 0; i < seriesStyle.m_nPointRepeat; i++ )
1055  {
1056  try
1057  {
1058  uno::Reference< beans::XPropertySet > xPointProp(
1059  SchXMLSeriesHelper::createOldAPIDataPointPropertySet( seriesStyle.m_xSeries, seriesStyle.m_nPointIndex + i
1060  , rImportHelper.GetChartDocument() ) );
1061 
1062  if( !xPointProp.is() )
1063  continue;
1064 
1065  if( bIsDonutChart )
1066  {
1067  //set special series styles for donut charts first
1068  if( rCurrStyleName != seriesStyle.msSeriesStyleNameForDonuts )
1069  {
1070  rCurrStyleName = seriesStyle.msSeriesStyleNameForDonuts;
1071  rpStyle = pStylesCtxt->FindStyleChildContext(
1072  SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
1073  }
1074 
1075  // note: SvXMLStyleContext::FillPropertySet is not const
1076  XMLPropStyleContext * pPropStyleContext =
1077  const_cast< XMLPropStyleContext * >(
1078  dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
1079  if( pPropStyleContext )
1080  pPropStyleContext->FillPropertySet( xPointProp );
1081  }
1082 
1083  try
1084  {
1085  //need to set this explicitly here for old files as the new api does not support this property fully anymore
1086  if( bSwitchOffLinesForScatter )
1087  xPointProp->setPropertyValue("Lines",uno::makeAny(false));
1088  }
1089  catch( const uno::Exception & )
1090  {
1091  }
1092 
1093  if( rCurrStyleName != seriesStyle.msStyleName )
1094  {
1095  rCurrStyleName = seriesStyle.msStyleName;
1096  rpStyle = pStylesCtxt->FindStyleChildContext(
1097  SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
1098  }
1099 
1100  // note: SvXMLStyleContext::FillPropertySet is not const
1101  XMLPropStyleContext * pPropStyleContext =
1102  const_cast< XMLPropStyleContext * >(
1103  dynamic_cast< const XMLPropStyleContext * >( rpStyle ));
1104  if( pPropStyleContext )
1105  {
1106  pPropStyleContext->FillPropertySet( xPointProp );
1107  if( seriesStyle.mbSymbolSizeForSeriesIsMissingInFile )
1108  lcl_resetSymbolSizeForPointsIfNecessary( xPointProp, rImport, pPropStyleContext, pStylesCtxt );
1109  if( !pPropStyleContext->isEmptyDataStyleName() )
1110  lcl_setLinkNumberFormatToSourceIfNeeded( xPointProp, pPropStyleContext, pStylesCtxt );
1111  }
1112 
1113  // Custom labels might be passed as property
1114  if(auto nLabelCount = seriesStyle.mCustomLabels.size(); nLabelCount > 0)
1115  {
1116  Sequence< Reference<chart2::XDataPointCustomLabelField>> xLabels(nLabelCount);
1118  for( auto j = 0; j< xLabels.getLength(); ++j )
1119  {
1120  Reference< chart2::XDataPointCustomLabelField > xCustomLabel = chart2::DataPointCustomLabelField::create(xContext);
1121  xLabels[j] = xCustomLabel;
1122  xCustomLabel->setString(seriesStyle.mCustomLabels[j]);
1123  xCustomLabel->setFieldType(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT);
1124  }
1125  xPointProp->setPropertyValue("CustomLabelFields", uno::Any(xLabels));
1126  }
1127 
1128  if( seriesStyle.mCustomLabelPos[0] != 0.0 || seriesStyle.mCustomLabelPos[1] != 0.0 )
1129  {
1130  chart2::RelativePosition aCustomlabelPosition;
1131  aCustomlabelPosition.Primary = seriesStyle.mCustomLabelPos[0];
1132  aCustomlabelPosition.Secondary = seriesStyle.mCustomLabelPos[1];
1133  xPointProp->setPropertyValue("CustomLabelPosition", uno::Any(aCustomlabelPosition));
1134  }
1135  }
1136  catch( const uno::Exception & )
1137  {
1138  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught during setting styles to data points" );
1139  }
1140  }
1141  } // styles iterator
1142 }
1143 
1144 //static
1145 void SchXMLSeries2Context::switchSeriesLinesOff( ::std::vector< DataRowPointStyle >& rSeriesStyleVector )
1146 {
1147  // iterate over series
1148  for (auto const& seriesStyle : rSeriesStyleVector)
1149  {
1150  if( seriesStyle.meType != DataRowPointStyle::DATA_SERIES )
1151  continue;
1152 
1153  try
1154  {
1155  uno::Reference< beans::XPropertySet > xSeries( seriesStyle.m_xOldAPISeries );
1156  if( !xSeries.is() )
1157  continue;
1158 
1159  xSeries->setPropertyValue("Lines",uno::makeAny(false));
1160  }
1161  catch( uno::Exception & )
1162  {
1163  //end of series reached
1164  }
1165  }
1166 }
1167 
1168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::SvRef< SvBaseLink > xSink
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3422
bool hasValue()
const SvXMLTokenMap & GetSeriesAttrTokenMap()
SchXMLSeries2Context(SchXMLImportHelper &rImpHelper, SvXMLImport &rImport, const OUString &rLocalName, const css::uno::Reference< css::chart2::XChartDocument > &xNewDoc, std::vector< SchXMLAxis > &rAxes,::std::vector< DataRowPointStyle > &rStyleVector,::std::vector< RegressionStyle > &rRegressionStyleVector, sal_Int32 nSeriesIndex, bool bStockHasVolume, GlobalSeriesImportInfo &rGlobalSeriesImportInfo, const OUString &aGlobalChartTypeName, tSchXMLLSequencesPerIndex &rLSequencesPerIndex, bool &rGlobalChartTypeUsedBySeries, const css::awt::Size &rChartSize)
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
static void switchSeriesLinesOff(::std::vector< DataRowPointStyle > &rSeriesStyleVector)
tSchXMLLSequencesPerIndex maPostponedSequences
static css::uno::Reference< css::beans::XPropertySet > createOldAPISeriesPropertySet(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const css::uno::Reference< css::frame::XModel > &xChartModel)
SvXMLStylesContext * GetAutoStylesContext() const
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
constexpr sal_uInt16 XML_NAMESPACE_CHART
Definition: xmlnmspe.hxx:41
sal_Int8 nAxisIndex
css::uno::Reference< css::chart2::XDataSeries > m_xSeries
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:397
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
StartElement is called after a context has been constructed and before an elements context is parsed...
Definition: xmlictxt.cxx:58
static void setDefaultsToSeries(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles)
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
Definition: nmspmap.cxx:437
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex
static void setStylesToStatisticsObjects(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const SvXMLStylesContext *pStylesCtxt, const SvXMLStyleContext *&rpStyle, OUString &rCurrStyleName)
static void DeleteDataSeries(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const css::uno::Reference< css::chart2::XChartDocument > &xDoc)
sal_uInt16 GetKeyByAttrValueQName(const OUString &rAttrName, OUString *pLocalName) const
Definition: nmspmap.cxx:263
::std::pair< tSchXMLIndex, SchXMLLabeledSequencePart > tSchXMLIndexWithPart
static bool isCandleStickSeries(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const css::uno::Reference< css::frame::XModel > &xChartModel)
virtual ~SchXMLSeries2Context() override
#define DBG_UNHANDLED_EXCEPTION(...)
::std::vector< OUString > maDomainAddresses
int i
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:231
static css::uno::Reference< css::chart2::XDataSeries > GetNewDataSeries(const css::uno::Reference< css::chart2::XChartDocument > &xDoc, sal_Int32 nCoordinateSystemIndex, const OUString &rChartTypeName, bool bPushLastChartType)
Reference< chart2::data::XLabeledDataSequence2 > GetNewLabeledDataSequence()
static void initSeriesPropertySets(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const css::uno::Reference< css::frame::XModel > &xChartModel)
static css::uno::Reference< css::beans::XPropertySet > createOldAPIDataPointPropertySet(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, sal_Int32 nPointIndex, const css::uno::Reference< css::frame::XModel > &xChartModel)
css::uno::Any maConstantErrorHighDefault
virtual bool isEmptyDataStyleName()
Definition: prstylei.hxx:104
::std::vector< RegressionStyle > & mrRegressionStyleVector
static void setStylesToSeries(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const SvXMLStylesContext *pStylesCtxt, const SvXMLStyleContext *&rpStyle, OUString &rCurrStyleName, const SchXMLImportHelper &rImportHelper, const SvXMLImport &rImport, bool bIsStockChart, tSchXMLLSequencesPerIndex &rInOutLSequencesPerIndex)
sal_uInt16 Get(sal_uInt16 nPrefix, const OUString &rLName) const
Definition: xmltkmap.cxx:93
static void setStylesToRegressionCurves(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const SvXMLStylesContext *pStylesCtxt, const SvXMLStyleContext *&rpStyle, OUString const &rCurrStyleName)
css::uno::Any maRegressionCurvesDefault
static XmlStyleFamily GetChartFamilyID()
OUString GetChartTypeByClassName(const OUString &rClassName, bool bUseOldNames)
static void setStylesToDataPoints(SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const SvXMLStylesContext *pStylesCtxt, const SvXMLStyleContext *&rpStyle, OUString &rCurrStyleName, const SchXMLImportHelper &rImportHelper, const SvXMLImport &rImport, bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter)
::std::vector< RegressionStyle > maRegressionStyleVector
css::uno::Any maPercentageErrorDefault
With this class you can import a element containing its data as element o...
bool mbSymbolSizeForSeriesIsMissingInFile
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
GlobalSeriesImportInfo & m_rGlobalSeriesImportInfo
#define TOOLS_INFO_EXCEPTION(area, stream)
Reference< chart2::data::XDataSequence > CreateDataSequenceWithoutConvert(const OUString &rRange, const Reference< chart2::XChartDocument > &xChartDoc)
const SvXMLTokenMap & GetSeriesElemTokenMap()
Reference< XMultiServiceFactory > getProcessServiceFactory()
const css::uno::Reference< css::chart::XChartDocument > & GetChartDocument() const
::std::vector< DataRowPointStyle > maSeriesStyleVector
#define SAL_WARN_IF(condition, area, stream)
::std::vector< SchXMLAxis > & mrAxes
Handling of tokens in XML:
constexpr sal_uInt16 XML_NAMESPACE_TABLE
Definition: xmlnmspe.hxx:32
OUString aName
css::uno::Reference< css::chart2::XChartDocument > mxNewDoc
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:403
Reference< XComponentContext > getProcessComponentContext()
Sequence< sal_Int8 > aSeq
css::uno::Any maErrorCategoryDefault
::std::vector< DataRowPointStyle > & mrStyleVector
css::uno::Any maErrorIndicatorDefault
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:870
Reference< chart2::data::XDataSequence > CreateDataSequence(const OUString &rRange, const Reference< chart2::XChartDocument > &xChartDoc)
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3(const uno::Reference< frame::XModel > &xChartModel)
uno::Any getPropertyFromContext(const OUString &rPropertyName, const XMLPropStyleContext *pPropStyleContext, const SvXMLStylesContext *pStylesCtxt)
::std::multimap< tSchXMLIndexWithPart, css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tSchXMLLSequencesPerIndex
SchXMLImportHelper & mrImportHelper
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
StartElement is called after a context has been constructed and before an elements context is parsed...
css::uno::Any maConstantErrorLowDefault