LibreOffice Module xmloff (master)  1
SchXMLPlotAreaContext.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 
21 #include <SchXMLImport.hxx>
22 #include "SchXMLAxisContext.hxx"
23 #include "SchXMLSeries2Context.hxx"
24 #include "SchXMLTools.hxx"
25 
27 #include <sal/log.hxx>
28 #include <tools/diagnose_ex.h>
29 #include <xmloff/xmlnmspe.hxx>
30 #include <xmloff/nmspmap.hxx>
31 #include <xmloff/xmluconv.hxx>
32 #include <xmloff/prstylei.hxx>
33 #include <xmloff/xmlstyle.hxx>
35 
36 #include <com/sun/star/awt/Point.hpp>
37 #include <com/sun/star/awt/Size.hpp>
38 #include <com/sun/star/chart/ErrorBarStyle.hpp>
39 #include <com/sun/star/chart/X3DDisplay.hpp>
40 #include <com/sun/star/chart/XStatisticDisplay.hpp>
41 #include <com/sun/star/chart/XDiagramPositioning.hpp>
42 #include <com/sun/star/chart/XChartDocument.hpp>
43 #include <com/sun/star/chart2/XChartDocument.hpp>
44 #include <com/sun/star/chart2/data/XDataSink.hpp>
45 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
46 #include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
47 #include <com/sun/star/drawing/CameraGeometry.hpp>
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/xml/sax/XAttributeList.hpp>
51 
52 using namespace com::sun::star;
53 using namespace ::xmloff::token;
54 
56 
57 namespace
58 {
59 
60 struct lcl_AxisHasCategories
61 {
62  bool operator() ( const SchXMLAxis & rAxis )
63  {
64  return rAxis.bHasCategories;
65  }
66 };
67 
68 OUString lcl_ConvertRange( const OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
69 {
70  OUString aResult = rRange;
71  if(!xDoc.is())
72  return aResult;
73  uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
74  xDoc->getDataProvider(), uno::UNO_QUERY );
75  if( xConversion.is())
76  aResult = xConversion->convertRangeFromXML( rRange );
77  return aResult;
78 }
79 
80 } // anonymous namespace
81 
83  : SdXML3DSceneAttributesHelper( rImporter )
84 {
85 }
86 
87 void SchXML3DSceneAttributesHelper::getCameraDefaultFromDiagram( const uno::Reference< chart::XDiagram >& xDiagram )
88 {
89  //different defaults for camera geometry necessary to workaround wrong behaviour in old chart
90  //in future make this version dependent if we have versioning (metastream) for ole objects
91 
92  try
93  {
94  uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
95  if( xProp.is() )
96  {
97  drawing::CameraGeometry aCamGeo;
98  xProp->getPropertyValue("D3DCameraGeometry") >>= aCamGeo;
99  maVRP.setX( aCamGeo.vrp.PositionX );
100  maVRP.setY( aCamGeo.vrp.PositionY );
101  maVRP.setZ( aCamGeo.vrp.PositionZ );
102  maVPN.setX( aCamGeo.vpn.DirectionX );
103  maVPN.setY( aCamGeo.vpn.DirectionY );
104  maVPN.setZ( aCamGeo.vpn.DirectionZ );
105  maVUP.setX( aCamGeo.vup.DirectionX );
106  maVUP.setY( aCamGeo.vup.DirectionY );
107  maVUP.setZ( aCamGeo.vup.DirectionZ );
108  }
109  }
110  catch( const uno::Exception & )
111  {
112  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property NumberOfLines");
113  }
114 }
115 
117 {
118 }
119 
121  SchXMLImportHelper& rImpHelper,
122  SvXMLImport& rImport, const OUString& rLocalName,
123  const OUString& rXLinkHRefAttributeToIndicateDataProvider,
124  OUString& rCategoriesAddress,
125  OUString& rChartAddress,
126  bool & rbHasRangeAtPlotArea,
127  bool & rAllRangeAddressesAvailable,
128  bool & rColHasLabels,
129  bool & rRowHasLabels,
130  chart::ChartDataRowSource & rDataRowSource,
131  SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
132  const OUString& aChartTypeServiceName,
133  tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
134  const awt::Size & rChartSize ) :
135  SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
136  mrImportHelper( rImpHelper ),
137  mrCategoriesAddress( rCategoriesAddress ),
138  mrSeriesDefaultsAndStyles( rSeriesDefaultsAndStyles ),
139  mnNumOfLinesProp( 0 ),
140  mbStockHasVolume( false ),
141  mnSeries( 0 ),
142  m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ),
143  maSceneImportHelper( rImport ),
144  m_aOuterPositioning( rImport ),
145  m_aInnerPositioning( rImport ),
146  mbPercentStacked(false),
147  m_bAxisPositionAttributeImported(false),
148  m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
149  mrChartAddress( rChartAddress ),
150  m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ),
151  mrColHasLabels( rColHasLabels ),
152  mrRowHasLabels( rRowHasLabels ),
153  mrDataRowSource( rDataRowSource ),
154  maChartTypeServiceName( aChartTypeServiceName ),
155  mrLSequencesPerIndex( rLSequencesPerIndex ),
156  mbGlobalChartTypeUsedBySeries( false ),
157  maChartSize( rChartSize )
158 {
159  m_rbHasRangeAtPlotArea = false;
160 
161  // get Diagram
162  uno::Reference< chart::XChartDocument > xDoc = rImpHelper.GetChartDocument();
163  if( xDoc.is())
164  {
165  mxDiagram = xDoc->getDiagram();
166  mxNewDoc.set( xDoc, uno::UNO_QUERY );
167 
169  }
170  SAL_WARN_IF( !mxDiagram.is(),"xmloff.chart", "Couldn't get XDiagram" );
171 
172  // turn off all axes initially
173  uno::Any aFalseBool;
174  aFalseBool <<= false;
175 
176  uno::Reference< lang::XServiceInfo > xInfo( mxDiagram, uno::UNO_QUERY );
177  uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
178  if( !xInfo.is() || !xProp.is() )
179  return;
180 
181  try
182  {
183  xProp->setPropertyValue("HasXAxis", aFalseBool );
184  xProp->setPropertyValue("HasXAxisGrid", aFalseBool );
185  xProp->setPropertyValue("HasXAxisDescription", aFalseBool );
186  xProp->setPropertyValue("HasSecondaryXAxis", aFalseBool );
187  xProp->setPropertyValue("HasSecondaryXAxisDescription", aFalseBool );
188 
189  xProp->setPropertyValue("HasYAxis", aFalseBool );
190  xProp->setPropertyValue("HasYAxisGrid", aFalseBool );
191  xProp->setPropertyValue("HasYAxisDescription", aFalseBool );
192  xProp->setPropertyValue("HasSecondaryYAxis", aFalseBool );
193  xProp->setPropertyValue("HasSecondaryYAxisDescription", aFalseBool );
194 
195  xProp->setPropertyValue("HasZAxis", aFalseBool );
196  xProp->setPropertyValue("HasZAxisDescription", aFalseBool );
197 
198  xProp->setPropertyValue("DataRowSource", uno::Any(chart::ChartDataRowSource_COLUMNS) );
199  }
200  catch( const beans::UnknownPropertyException & )
201  {
202  SAL_WARN("xmloff.chart", "Property required by service not supported" );
203  }
204 }
205 
207 {}
208 
209 void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
210 {
211  // parse attributes
212  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
213  const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPlotAreaAttrTokenMap();
214  uno::Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
215 
216  for( sal_Int16 i = 0; i < nAttrCount; i++ )
217  {
218  OUString sAttrName = xAttrList->getNameByIndex( i );
219  OUString aLocalName;
220  OUString aValue = xAttrList->getValueByIndex( i );
221  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
222 
223  switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
224  {
225  case XML_TOK_PA_X:
226  case XML_TOK_PA_Y:
227  case XML_TOK_PA_WIDTH:
228  case XML_TOK_PA_HEIGHT:
229  m_aOuterPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
230  break;
232  msAutoStyleName = aValue;
233  break;
235  mrChartAddress = lcl_ConvertRange( aValue, xNewDoc );
236  // indicator for getting data from the outside
237  m_rbHasRangeAtPlotArea = true;
238  break;
240  {
243  else if( aValue == ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ROW ))
244  mrRowHasLabels = true;
245  else if( aValue == ::xmloff::token::GetXMLToken( ::xmloff::token::XML_COLUMN ))
246  mrColHasLabels = true;
247  }
248  break;
250  case XML_TOK_PA_VRP:
251  case XML_TOK_PA_VPN:
252  case XML_TOK_PA_VUP:
254  case XML_TOK_PA_DISTANCE:
260  maSceneImportHelper.processSceneAttribute( nPrefix, aLocalName, aValue );
261  break;
262  }
263  }
264 
265  if( ! mxNewDoc.is())
266  {
267  uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
268  if( xDocProp.is())
269  {
270  try
271  {
272  xDocProp->setPropertyValue("DataSourceLabelsInFirstColumn", uno::Any(mrColHasLabels) );
273  xDocProp->setPropertyValue("DataSourceLabelsInFirstRow", uno::Any(mrRowHasLabels) );
274  }
275  catch( const beans::UnknownPropertyException & )
276  {
277  SAL_WARN("xmloff.chart", "Properties missing" );
278  }
279  }
280  }
281 
282  // set properties
283  uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
284  if( !msAutoStyleName.isEmpty())
285  {
286  if( xProp.is())
287  {
289  if( pStylesCtxt )
290  {
291  const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
293 
294  XMLPropStyleContext* pPropStyleContext =
295  const_cast< XMLPropStyleContext * >(
296  dynamic_cast< const XMLPropStyleContext * >( pStyle ) );
297  if( pPropStyleContext )
298  {
299  pPropStyleContext->FillPropertySet( xProp );
300 
301  // get the data row source that was set without having data
302  xProp->getPropertyValue("DataRowSource")
303  >>= mrDataRowSource;
304 
305  //lines on/off
306  //this old property is not supported fully anymore with the new chart, so we need to get the information a little bit different from similar properties
308  "Lines", pPropStyleContext, pStylesCtxt );
309 
310  //handle automatic position and size
311  m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt );
312 
313  //correct default starting angle for old 3D pies
315  {
316  bool bIs3d = false;
317  if( xProp.is() && ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) &&
318  bIs3d )
319  {
320  if( maChartTypeServiceName == "com.sun.star.chart2.PieChartType" || maChartTypeServiceName == "com.sun.star.chart2.DonutChartType" )
321  {
322  OUString aPropName( "StartingAngle" );
323  uno::Any aAStartingAngle( SchXMLTools::getPropertyFromContext( aPropName, pPropStyleContext, pStylesCtxt ) );
324  if( !aAStartingAngle.hasValue() )
325  xProp->setPropertyValue( aPropName, uno::makeAny(sal_Int32(0)) ) ;
326  }
327  }
328  }
329  }
330  }
331  }
332  }
333 
334  //remember default values for dataseries
335  if(xProp.is())
336  {
337  try
338  {
339  mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue("SymbolType");
340  mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue("DataCaption");
341 
342  mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue("MeanValue");
343  mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue("RegressionCurves");
344 
345  bool bStacked = false;
346  mrSeriesDefaultsAndStyles.maStackedDefault = xProp->getPropertyValue("Stacked");
348  mrSeriesDefaultsAndStyles.maPercentDefault = xProp->getPropertyValue("Percent");
350  mrSeriesDefaultsAndStyles.maStackedBarsConnectedDefault = xProp->getPropertyValue("StackedBarsConnected");
351 
352  // deep
353  uno::Any aDeepProperty( xProp->getPropertyValue("Deep"));
354  // #124488# old versions store a 3d area and 3D line deep chart with Deep==false => workaround for this
355  if( ! (bStacked || mbPercentStacked ))
356  {
358  {
359  bool bIs3d = false;
360  if( ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) &&
361  bIs3d )
362  {
363  if( maChartTypeServiceName == "com.sun.star.chart2.AreaChartType" || maChartTypeServiceName == "com.sun.star.chart2.LineChartType" )
364  {
365  aDeepProperty <<= true;
366  }
367  }
368  }
369  }
371 
372  xProp->getPropertyValue("NumberOfLines") >>= mnNumOfLinesProp;
373  xProp->getPropertyValue("Volume") >>= mbStockHasVolume;
374  }
375  catch( const uno::Exception & )
376  {
377  TOOLS_INFO_EXCEPTION("xmloff.chart", "PlotAreaContext:EndElement(): Exception caught");
378  }
379  } // if
380 
381  bool bCreateInternalDataProvider = false;
382  if( m_rXLinkHRefAttributeToIndicateDataProvider == "." ) //data comes from the chart itself
383  bCreateInternalDataProvider = true;
384  else if( m_rXLinkHRefAttributeToIndicateDataProvider == ".." ) //data comes from the parent application
385  bCreateInternalDataProvider = false;
386  else if( !m_rXLinkHRefAttributeToIndicateDataProvider.isEmpty() ) //not supported so far to get the data by sibling objects -> fall back to chart itself
387  bCreateInternalDataProvider = true;
388  else if( !m_rbHasRangeAtPlotArea )
389  bCreateInternalDataProvider = true;
390 
391  if( bCreateInternalDataProvider && mxNewDoc.is() )
392  {
393  // we have no complete range => we have own data, so switch the data
394  // provider to internal. Clone is not necessary, as we don't have any
395  // data yet.
396  mxNewDoc->createInternalDataProvider( false /* bCloneExistingData */ );
397  if( xProp.is() && mrDataRowSource!=chart::ChartDataRowSource_COLUMNS )
398  xProp->setPropertyValue("DataRowSource", uno::makeAny(mrDataRowSource) );
399  }
400 }
401 
403  sal_uInt16 nPrefix,
404  const OUString& rLocalName,
405  const uno::Reference< xml::sax::XAttributeList >& xAttrList )
406 {
407  SvXMLImportContext* pContext = nullptr;
409 
410  switch( rTokenMap.Get( nPrefix, rLocalName ))
411  {
414  {
415  pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning );
416  }
417  break;
418 
419  case XML_TOK_PA_AXIS:
420  {
421  bool bAddMissingXAxisForNetCharts = false;
422  bool bAdaptWrongPercentScaleValues = false;
424  {
425  //correct errors from older versions
426 
427  // for NetCharts there were no xAxis exported to older files
428  // so we need to add the x axis here for those old NetChart files
429  if ( maChartTypeServiceName == "com.sun.star.chart2.NetChartType" )
430  bAddMissingXAxisForNetCharts = true;
431 
432  //Issue 59288
433  if( mbPercentStacked )
434  bAdaptWrongPercentScaleValues = true;
435  }
436 
437  bool bAdaptXAxisOrientationForOld2DBarCharts = false;
439  {
440  //issue74660
441  if ( maChartTypeServiceName == "com.sun.star.chart2.ColumnChartType" )
442  bAdaptXAxisOrientationForOld2DBarCharts = true;
443  }
444 
446  bAddMissingXAxisForNetCharts, bAdaptWrongPercentScaleValues, bAdaptXAxisOrientationForOld2DBarCharts, m_bAxisPositionAttributeImported );
447  }
448  break;
449 
450  case XML_TOK_PA_SERIES:
451  {
452  if( mxNewDoc.is())
453  {
454  pContext = new SchXMLSeries2Context(
455  mrImportHelper, GetImport(), rLocalName,
456  mxNewDoc, maAxes,
459  mnSeries,
465  }
466  mnSeries++;
467  }
468  break;
469 
470  case XML_TOK_PA_WALL:
471  pContext = new SchXMLWallFloorContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
473  break;
474  case XML_TOK_PA_FLOOR:
475  pContext = new SchXMLWallFloorContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
477  break;
478 
480  pContext = maSceneImportHelper.create3DLightContext( nPrefix, rLocalName, xAttrList );
481  break;
482 
483  // elements for stock charts
485  pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
487  break;
489  pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
491  break;
493  pContext = new SchXMLStockContext( mrImportHelper, GetImport(), nPrefix, rLocalName, mxDiagram,
495  break;
496  }
497 
498  return pContext;
499 }
500 
502 {
503  // set categories
504  if( !mrCategoriesAddress.isEmpty() && mxNewDoc.is())
505  {
506  uno::Reference< chart2::data::XDataProvider > xDataProvider(
507  mxNewDoc->getDataProvider() );
508  // @todo: correct coordinate system index
509  sal_Int32 nDimension( 0 );
510  ::std::vector< SchXMLAxis >::const_iterator aIt(
511  ::std::find_if( maAxes.begin(), maAxes.end(), lcl_AxisHasCategories()));
512  if( aIt != maAxes.end())
513  nDimension = static_cast< sal_Int32 >( (*aIt).eDimension );
515  xDataProvider, mxNewDoc, mrCategoriesAddress,
516  0 /* nCooSysIndex */,
517  nDimension, &mrLSequencesPerIndex );
518  }
519 
520  uno::Reference< beans::XPropertySet > xDiaProp( mxDiagram, uno::UNO_QUERY );
521  if( xDiaProp.is())
522  {
523  bool bIsThreeDim = false;
524  uno::Any aAny = xDiaProp->getPropertyValue("Dim3D");
525  aAny >>= bIsThreeDim;
526 
527  // set 3d scene attributes
528  if( bIsThreeDim )
529  {
530  // set scene attributes at diagram
532  }
533 
534  // set correct number of lines at series
535  if( ! m_aGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && mnNumOfLinesProp > 0 && maChartTypeServiceName == "com.sun.star.chart2.ColumnChartType" )
536  {
537  try
538  {
539  xDiaProp->setPropertyValue("NumberOfLines",
540  uno::makeAny( mnNumOfLinesProp ));
541  }
542  catch( const uno::Exception & )
543  {
544  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property NumberOfLines");
545  }
546  }
547 
548  // #i32366# stock has volume
549  if( mxDiagram->getDiagramType() == "com.sun.star.chart.StockDiagram" &&
551  {
552  try
553  {
554  xDiaProp->setPropertyValue("Volume",
555  uno::makeAny( true ));
556  }
557  catch( const uno::Exception & )
558  {
559  TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property Volume");
560  }
561  }
562  }
563 
564  // set changed size and position after properties (esp. 3d)
565 
566  uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY );
567  if( xDiaPos.is())
568  {
570  {
572  xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() );
573  else if( m_aOuterPositioning.hasPosSize() )
574  {
575  if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
576  xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() );
577  else
578  xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() );
579  }
580  }
581  }
582 
584 }
585 
586 SchXMLDataLabelSpanContext::SchXMLDataLabelSpanContext( SvXMLImport& rImport, const OUString& rLocalName, ::std::vector<OUString>& rLabels):
587  SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName),
588  mrLabels(rLabels)
589 {
590 }
591 
592 void SchXMLDataLabelSpanContext::Characters(const OUString& rChars)
593 {
594  maCharBuffer.append(rChars);
595 }
596 
598 {
599  mrLabels.push_back(maCharBuffer.makeStringAndClear());
600 }
601 
602 SchXMLDataLabelParaContext::SchXMLDataLabelParaContext( SvXMLImport& rImport, const OUString& rLocalName, ::std::vector<OUString>& rLabels):
603  SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName),
604  mrLabels(rLabels)
605 {
606 }
607 
609  sal_uInt16 nPrefix,
610  const OUString& rLocalName,
611  const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
612 {
613  SvXMLImportContextRef xContext;
614  if ( IsXMLToken( rLocalName, XML_SPAN ) && nPrefix == XML_NAMESPACE_TEXT )
615  xContext = new SchXMLDataLabelSpanContext(GetImport(), rLocalName, mrLabels);
616  return xContext;
617 }
618 
619 SchXMLDataLabelContext::SchXMLDataLabelContext( SvXMLImport& rImport, const OUString& rLocalName, ::std::vector<OUString>& rLabels):
620  SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName),
621  mrLabels(rLabels)
622 {
623 }
624 
626  sal_uInt16 nPrefix,
627  const OUString& rLocalName,
628  const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
629 {
630  SvXMLImportContextRef xContext;
631  if ( IsXMLToken( rLocalName, XML_P ) && nPrefix == XML_NAMESPACE_TEXT )
632  xContext = new SchXMLDataLabelParaContext(GetImport(), rLocalName, mrLabels);
633 
634  return xContext;
635 }
636 
637 
639  SvXMLImport& rImport, const OUString& rLocalName,
640  ::std::vector< DataRowPointStyle >& rStyleVector,
641  const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
642  sal_Int32& rIndex,
643  bool bSymbolSizeForSeriesIsMissingInFile ) :
644  SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
645  mrImportHelper( rImportHelper ),
646  mrStyleVector( rStyleVector ),
647  mrIndex( rIndex ),
648  mDataPoint(DataRowPointStyle::DATA_POINT, xSeries, rIndex, 1, OUString{})
649 {
650  mDataPoint.mbSymbolSizeForSeriesIsMissingInFile = bSymbolSizeForSeriesIsMissingInFile;
651 }
652 
654  sal_uInt16 nPrefix,
655  const OUString& rLocalName,
656  const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
657 {
658  SvXMLImportContext* pContext = nullptr;
660 
661  switch( rTokenMap.Get( nPrefix, rLocalName ))
662  {
664  mbHasLabelParagraph = true;
665  pContext = new SchXMLDataLabelContext( GetImport(), rLocalName, mDataPoint.mCustomLabels);
666  break;
667  }
668  return pContext;
669 }
670 
672 {
673 }
674 
675 void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
676 {
677  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
678  OUString sAutoStyleName;
679  sal_Int32 nRepeat = 1;
680  OUString sCustomLabelField;
681 
682  for( sal_Int16 i = 0; i < nAttrCount; i++ )
683  {
684  OUString sAttrName = xAttrList->getNameByIndex( i );
685  OUString aLocalName;
686  bool bHideLegend = false;
687  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
688 
689  if( nPrefix == XML_NAMESPACE_CHART )
690  {
691  if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
692  {
693  sAutoStyleName = xAttrList->getValueByIndex( i );
694  mDataPoint.msStyleName = sAutoStyleName;
695  }
696  else if( IsXMLToken( aLocalName, XML_REPEATED ) )
697  {
698  nRepeat = xAttrList->getValueByIndex( i ).toInt32();
699  mDataPoint.m_nPointRepeat = nRepeat;
700  }
701  }
702  else if( nPrefix == XML_NAMESPACE_LO_EXT)
703  {
704  // Deprecated. New documents use the chart:data-label element
705  // instead in order to store custom label text.
707  {
708  sCustomLabelField = xAttrList->getValueByIndex( i );
709  mDataPoint.mCustomLabels.push_back(sCustomLabelField);
710  }
711  else if (IsXMLToken(aLocalName, XML_HIDE_LEGEND))
712  {
713  bHideLegend = xAttrList->getValueByIndex(i).toBoolean();
714  if (bHideLegend)
715  {
716  uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
717  Reference<beans::XPropertySet> xSeriesProp(mDataPoint.m_xSeries, uno::UNO_QUERY);
718  xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
719  std::vector<sal_Int32> deletedLegendEntries;
720  for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
721  {
722  deletedLegendEntries.push_back(deletedLegendEntry);
723  }
724  deletedLegendEntries.push_back(mDataPoint.m_nPointIndex);
725  xSeriesProp->setPropertyValue("DeletedLegendEntries", uno::makeAny(::oox::ContainerHelper::vectorToSequence(deletedLegendEntries)));
726  }
727  }
728  else if( IsXMLToken(aLocalName, XML_CUSTOM_LABEL_POS_X ) )
729  {
730  mDataPoint.mCustomLabelPos[0] = xAttrList->getValueByIndex(i).toDouble();
731  }
732  else if( IsXMLToken(aLocalName, XML_CUSTOM_LABEL_POS_Y) )
733  {
734  mDataPoint.mCustomLabelPos[1] = xAttrList->getValueByIndex(i).toDouble();
735  }
736  }
737  }
738 
739  mrIndex += nRepeat;
740 }
741 
743 {
744  if( !mDataPoint.msStyleName.isEmpty() || mDataPoint.mCustomLabels.size() > 0)
745  {
746  mrStyleVector.push_back( mDataPoint );
747  }
748 }
749 
751  : m_rImport( rImporter )
752  , m_aPosition(0,0)
753  , m_aSize(0,0)
754  , m_bHasSizeWidth( false )
755  , m_bHasSizeHeight( false )
756  , m_bHasPositionX( false )
757  , m_bHasPositionY( false )
758  , m_bAutoSize( false )
759  , m_bAutoPosition( false )
760 {
761 }
762 
764 {
765 }
766 
768 {
770 }
771 
773 {
774  return m_bAutoSize || m_bAutoPosition;
775 }
776 
777 void SchXMLPositionAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
778 {
779  if( XML_NAMESPACE_SVG != nPrefix )
780  return;
781 
782  if( IsXMLToken( rLocalName, XML_X ) )
783  {
785  m_aPosition.X, rValue );
786  m_bHasPositionX = true;
787  }
788  else if( IsXMLToken( rLocalName, XML_Y ) )
789  {
791  m_aPosition.Y, rValue );
792  m_bHasPositionY = true;
793  }
794  else if( IsXMLToken( rLocalName, XML_WIDTH ) )
795  {
797  m_aSize.Width, rValue );
798  m_bHasSizeWidth = true;
799  }
800  else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
801  {
803  m_aSize.Height, rValue );
804  m_bHasSizeHeight = true;
805  }
806 }
807 
809 {
810  if( pPropStyleContext && pStylesCtxt )
811  {
812  //handle automatic position and size
814  "AutomaticSize", pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize;
816  "AutomaticPosition", pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition;
817  }
818 }
819 
821  SvXMLImport& rImport
822  , sal_uInt16 nPrefix
823  , const OUString& rLocalName
824  , SchXMLPositionAttributesHelper& rPositioning )
825  : SvXMLImportContext( rImport, nPrefix, rLocalName )
826  , m_rPositioning( rPositioning )
827 {
828 }
829 
831 {
832 }
833 
834 void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
835 {
836  // parse attributes
837  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
838 
839  for( sal_Int16 i = 0; i < nAttrCount; i++ )
840  {
841  OUString sAttrName = xAttrList->getNameByIndex( i );
842  OUString aLocalName;
843  OUString aValue = xAttrList->getValueByIndex( i );
844  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
845  m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
846  }
847 }
848 
850  SchXMLImportHelper& rImpHelper,
851  SvXMLImport& rImport,
852  sal_uInt16 nPrefix,
853  const OUString& rLocalName,
854  uno::Reference< chart::XDiagram > const & xDiagram,
855  ContextType eContextType ) :
856  SvXMLImportContext( rImport, nPrefix, rLocalName ),
857  mrImportHelper( rImpHelper ),
858  mxWallFloorSupplier( xDiagram, uno::UNO_QUERY ),
859  meContextType( eContextType )
860 {
861 }
862 
864 {
865 }
866 
867 void SchXMLWallFloorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
868 {
869  if( !mxWallFloorSupplier.is())
870  return;
871 
872  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
873  OUString sAutoStyleName;
874 
875  for( sal_Int16 i = 0; i < nAttrCount; i++ )
876  {
877  OUString sAttrName = xAttrList->getNameByIndex( i );
878  OUString aLocalName;
879  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
880 
881  if( nPrefix == XML_NAMESPACE_CHART &&
882  IsXMLToken( aLocalName, XML_STYLE_NAME ) )
883  {
884  sAutoStyleName = xAttrList->getValueByIndex( i );
885  }
886  }
887 
888  // set properties
889  uno::Reference< beans::XPropertySet > xProp = ( meContextType == CONTEXT_TYPE_WALL )
890  ? mxWallFloorSupplier->getWall()
891  : mxWallFloorSupplier->getFloor();
892 
893  if (!sAutoStyleName.isEmpty())
894  mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
895 }
896 
898  SchXMLImportHelper& rImpHelper,
899  SvXMLImport& rImport,
900  sal_uInt16 nPrefix,
901  const OUString& rLocalName,
902  uno::Reference< chart::XDiagram > const & xDiagram,
903  ContextType eContextType ) :
904  SvXMLImportContext( rImport, nPrefix, rLocalName ),
905  mrImportHelper( rImpHelper ),
906  mxStockPropProvider( xDiagram, uno::UNO_QUERY ),
907  meContextType( eContextType )
908 {
909 }
910 
912 {
913 }
914 
915 void SchXMLStockContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
916 {
917  if( !mxStockPropProvider.is())
918  return;
919 
920  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
921  OUString sAutoStyleName;
922 
923  for( sal_Int16 i = 0; i < nAttrCount; i++ )
924  {
925  OUString sAttrName = xAttrList->getNameByIndex( i );
926  OUString aLocalName;
927  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
928 
929  if( nPrefix == XML_NAMESPACE_CHART &&
930  IsXMLToken( aLocalName, XML_STYLE_NAME ) )
931  {
932  sAutoStyleName = xAttrList->getValueByIndex( i );
933  }
934  }
935 
936  if( sAutoStyleName.isEmpty())
937  return;
938 
939  // set properties
940  uno::Reference< beans::XPropertySet > xProp;
941  switch( meContextType )
942  {
943  case CONTEXT_TYPE_GAIN:
944  xProp = mxStockPropProvider->getUpBar();
945  break;
946  case CONTEXT_TYPE_LOSS:
947  xProp = mxStockPropProvider->getDownBar();
948  break;
949  case CONTEXT_TYPE_RANGE:
950  xProp = mxStockPropProvider->getMinMaxLine();
951  break;
952  }
953 
954  mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
955 }
956 
957 static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocument > &xDoc,
958  const uno::Reference< beans::XPropertySet > &xBarProp,
959  const OUString &aXMLRange,
960  bool bPositiveValue, bool bYError,
961  tSchXMLLSequencesPerIndex& rSequences)
962 {
963  uno::Reference< css::chart2::data::XDataProvider > xDataProvider(xDoc->getDataProvider());
964  uno::Reference< css::chart2::data::XDataSource > xDataSource( xBarProp, uno::UNO_QUERY );
965  uno::Reference< css::chart2::data::XDataSink > xDataSink( xDataSource, uno::UNO_QUERY );
966 
967  assert( xDataSink.is() && xDataSource.is() && xDataProvider.is() );
968 
969  OUString aRange(lcl_ConvertRange(aXMLRange,xDoc));
970 
971  uno::Reference< chart2::data::XDataSequence > xNewSequence(
972  xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
973 
974  if( !xNewSequence.is())
975  return;
976 
977  SchXMLTools::setXMLRangePropertyAtDataSequence(xNewSequence,aXMLRange);
978 
979  OUStringBuffer aRoleBuffer("error-bars-");
980  if( bYError )
981  aRoleBuffer.append( 'y' );
982  else
983  aRoleBuffer.append( 'x');
984 
985  aRoleBuffer.append( '-' );
986 
987  if( bPositiveValue )
988  aRoleBuffer = aRoleBuffer.append( "positive" );
989  else
990  aRoleBuffer = aRoleBuffer.append( "negative" );
991 
992  OUString aRole = aRoleBuffer.makeStringAndClear();
993 
994  Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
995 
996  xSeqProp->setPropertyValue("Role", uno::makeAny( aRole ));
997 
999 
1000  Reference< chart2::data::XLabeledDataSequence > xLabelSeq( chart2::data::LabeledDataSequence::create(xContext),
1001  uno::UNO_QUERY_THROW );
1002 
1003  rSequences.emplace( tSchXMLIndexWithPart( -2, SCH_XML_PART_ERROR_BARS ), xLabelSeq );
1004 
1005  xLabelSeq->setValues( xNewSequence );
1006 
1007  uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
1008  xDataSource->getDataSequences());
1009 
1010  aSequences.realloc( aSequences.getLength() + 1 );
1011  aSequences[ aSequences.getLength() - 1 ] = xLabelSeq;
1012  xDataSink->setData( aSequences );
1013 
1014 }
1015 
1017  SchXMLImportHelper& rImpHelper,
1018  SvXMLImport& rImport,
1019  sal_uInt16 nPrefix,
1020  const OUString& rLocalName,
1021  const OUString &rSeriesStyleName,
1022  ::std::vector< DataRowPointStyle >& rStyleVector,
1023  const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
1024  ContextType eContextType,
1025  tSchXMLLSequencesPerIndex & rLSequencesPerIndex) :
1026 
1027  SvXMLImportContext( rImport, nPrefix, rLocalName ),
1028  mrImportHelper( rImpHelper ),
1029  mrStyleVector( rStyleVector ),
1030  m_xSeries( xSeries ),
1031  meContextType( eContextType ),
1032  maSeriesStyleName( rSeriesStyleName),
1033  mrLSequencesPerIndex(rLSequencesPerIndex)
1034 {}
1035 
1037 {
1038 }
1039 
1040 namespace {
1041 
1042 void SetErrorBarStyleProperties( const OUString& rStyleName, const uno::Reference< beans::XPropertySet >& xBarProp,
1043  SchXMLImportHelper const & rImportHelper )
1044 {
1045  const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
1047  rStyleName);
1048 
1049  XMLPropStyleContext &rSeriesStyleContext =
1050  const_cast< XMLPropStyleContext& >( dynamic_cast< const XMLPropStyleContext& >( *pStyle ));
1051 
1052  rSeriesStyleContext.FillPropertySet( xBarProp );
1053 }
1054 
1055 void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, const uno::Reference< beans::XPropertySet>& xBarProp,
1056  SchXMLImportHelper const & rImportHelper, OUString& aPosRange, OUString& aNegRange)
1057 {
1058  const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
1060  aStyleName);
1061 
1062  XMLPropStyleContext * pSeriesStyleContext =
1063  const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
1064 
1065  uno::Any aAny = SchXMLTools::getPropertyFromContext("ErrorBarStyle",
1066  pSeriesStyleContext,pStylesCtxt);
1067 
1068  if ( !aAny.hasValue() )
1069  return;
1070 
1071  sal_Int32 aBarStyle = css::chart::ErrorBarStyle::NONE;
1072  aAny >>= aBarStyle;
1073  xBarProp->setPropertyValue("ErrorBarStyle", aAny);
1074 
1075  aAny = SchXMLTools::getPropertyFromContext("ShowPositiveError",
1076  pSeriesStyleContext,pStylesCtxt);
1077 
1078  if(aAny.hasValue())
1079  xBarProp->setPropertyValue("ShowPositiveError",aAny);
1080 
1081  aAny = SchXMLTools::getPropertyFromContext("ShowNegativeError",
1082  pSeriesStyleContext,pStylesCtxt);
1083 
1084  if(aAny.hasValue())
1085  xBarProp->setPropertyValue("ShowNegativeError",aAny);
1086 
1087  aAny = SchXMLTools::getPropertyFromContext("PositiveError",
1088  pSeriesStyleContext, pStylesCtxt);
1089 
1090  if(aAny.hasValue())
1091  xBarProp->setPropertyValue("PositiveError", aAny);
1092  else
1093  {
1094  aAny = SchXMLTools::getPropertyFromContext("ConstantErrorHigh",
1095  pSeriesStyleContext, pStylesCtxt);
1096 
1097  if(aAny.hasValue())
1098  xBarProp->setPropertyValue("PositiveError", aAny);
1099  }
1100 
1101  aAny = SchXMLTools::getPropertyFromContext("NegativeError",
1102  pSeriesStyleContext, pStylesCtxt);
1103 
1104  if(aAny.hasValue())
1105  xBarProp->setPropertyValue("NegativeError", aAny);
1106  else
1107  {
1108  aAny = SchXMLTools::getPropertyFromContext("ConstantErrorLow",
1109  pSeriesStyleContext, pStylesCtxt);
1110 
1111  if(aAny.hasValue())
1112  xBarProp->setPropertyValue("NegativeError", aAny);
1113  }
1114 
1115  aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangePositive",
1116  pSeriesStyleContext, pStylesCtxt);
1117  if( aAny.hasValue() )
1118  {
1119  aAny >>= aPosRange;
1120  }
1121 
1122  aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangeNegative",
1123  pSeriesStyleContext, pStylesCtxt);
1124  if( aAny.hasValue() )
1125  {
1126  aAny >>= aNegRange;
1127  }
1128 
1129  aAny = SchXMLTools::getPropertyFromContext("Weight",
1130  pSeriesStyleContext, pStylesCtxt);
1131  if( aAny.hasValue() )
1132  {
1133  xBarProp->setPropertyValue("Weight", aAny);
1134  }
1135 
1136  aAny = SchXMLTools::getPropertyFromContext("PercentageError",
1137  pSeriesStyleContext, pStylesCtxt);
1138  if( aAny.hasValue() && aBarStyle == css::chart::ErrorBarStyle::RELATIVE )
1139  {
1140  xBarProp->setPropertyValue("PositiveError", aAny);
1141  xBarProp->setPropertyValue("NegativeError", aAny);
1142  }
1143 
1144  switch(aBarStyle)
1145  {
1146  case css::chart::ErrorBarStyle::ERROR_MARGIN:
1147  {
1148  aAny = SchXMLTools::getPropertyFromContext("NegativeError",
1149  pSeriesStyleContext,pStylesCtxt);
1150 
1151  xBarProp->setPropertyValue("NegativeError",aAny);
1152 
1153  aAny = SchXMLTools::getPropertyFromContext("PositiveError",
1154  pSeriesStyleContext,pStylesCtxt);
1155 
1156  xBarProp->setPropertyValue("PositiveError",aAny);
1157  }
1158  break;
1159  default:
1160  break;
1161  }
1162 
1163 }
1164 
1165 }
1166 
1167 void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
1168 {
1169  sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
1170  OUString sAutoStyleName;
1171  OUString aPosRange;
1172  OUString aNegRange;
1173  bool bYError = true;
1174 
1175  for( sal_Int16 i = 0; i < nAttrCount; i++ )
1176  {
1177  OUString sAttrName = xAttrList->getNameByIndex( i );
1178  OUString aLocalName;
1179 
1180  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
1181 
1182  if( nPrefix == XML_NAMESPACE_CHART )
1183  {
1184  if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
1185  sAutoStyleName = xAttrList->getValueByIndex( i );
1186  else if( IsXMLToken( aLocalName, XML_DIMENSION ) )
1187  bYError = xAttrList->getValueByIndex(i) == "y";
1188  else if( IsXMLToken( aLocalName, XML_ERROR_UPPER_RANGE) )
1189  aPosRange = xAttrList->getValueByIndex(i);
1190  else if( IsXMLToken( aLocalName, XML_ERROR_LOWER_RANGE) )
1191  aNegRange = xAttrList->getValueByIndex(i);
1192  }
1193  }
1194 
1195  if( sAutoStyleName.isEmpty() )
1196  return;
1197 
1198  DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
1199 
1200  switch( meContextType )
1201  {
1204  break;
1206  {
1208 
1209  uno::Reference< lang::XMultiServiceFactory > xFact = comphelper::getProcessServiceFactory();
1210 
1211  uno::Reference< beans::XPropertySet > xBarProp( xFact->createInstance("com.sun.star.chart2.ErrorBar" ),
1212  uno::UNO_QUERY );
1213 
1214  xBarProp->setPropertyValue("ErrorBarStyle",uno::makeAny(css::chart::ErrorBarStyle::NONE));
1215  xBarProp->setPropertyValue("PositiveError",uno::makeAny(0.0));
1216  xBarProp->setPropertyValue("NegativeError",uno::makeAny(0.0));
1217  xBarProp->setPropertyValue("Weight",uno::makeAny(1.0));
1218  xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(true));
1219  xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(true));
1220 
1221  // first import defaults from parent style
1222  SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, mrImportHelper );
1223  SetErrorBarStyleProperties( sAutoStyleName, xBarProp, mrImportHelper );
1224  SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
1225  SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
1226 
1227  uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
1228 
1229  if (!aPosRange.isEmpty())
1230  lcl_setErrorBarSequence(xDoc,xBarProp,aPosRange,true,bYError, mrLSequencesPerIndex);
1231 
1232  if (!aNegRange.isEmpty())
1233  lcl_setErrorBarSequence(xDoc,xBarProp,aNegRange,false,bYError, mrLSequencesPerIndex);
1234 
1235  if ( !bYError )
1236  {
1237  aStyle.m_xErrorXProperties.set( xBarProp );
1238  }
1239  else
1240  {
1241  aStyle.m_xErrorYProperties.set( xBarProp );
1242  }
1243  }
1244  break;
1245  }
1246 
1247  mrStyleVector.push_back( aStyle );
1248 }
1249 
1250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
css::uno::Reference< css::chart::XStatisticDisplay > mxStockPropProvider
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
Definition: xmlnmspe.hxx:80
css::chart::ChartDataRowSource & mrDataRowSource
css::uno::Reference< css::chart2::XDataSeries > m_xSeries
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3428
bool hasValue()
css::uno::Reference< css::chart::X3DDisplay > mxWallFloorSupplier
SchXMLImportHelper & mrImportHelper
css::uno::Reference< css::chart2::XChartDocument > mxNewDoc
void setSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
this sets the scene attributes at this propertyset
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...
SvXMLStylesContext * GetAutoStylesContext() const
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
constexpr sal_uInt16 XML_NAMESPACE_CHART
Definition: xmlnmspe.hxx:41
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:401
SchXMLCoordinateRegionContext(SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName, SchXMLPositionAttributesHelper &rPositioning)
constexpr sal_uInt16 XML_NAMESPACE_TEXT
Definition: xmlnmspe.hxx:31
void FillAutoStyle(const OUString &rAutoStyleName, const css::uno::Reference< css::beans::XPropertySet > &rProp)
Fill in the autostyle.
virtual ~SchXMLDataPointContext() override
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
SchXMLPlotAreaContext(SchXMLImportHelper &rImpHelper, SvXMLImport &rImport, const OUString &rLocalName, const OUString &rXLinkHRefAttributeToIndicateDataProvider, OUString &rCategoriesAddress, OUString &rChartAddress, bool &bHasRangeAtPlotArea, bool &rAllRangeAddressesAvailable, bool &rColHasLabels, bool &rRowHasLabels, css::chart::ChartDataRowSource &rDataRowSource, SeriesDefaultsAndStyles &rSeriesDefaultsAndStyles, const OUString &aChartTypeServiceName, tSchXMLLSequencesPerIndex &rLSequencesPerIndex, const css::awt::Size &rChartSize)
bool isDocumentGeneratedWithOpenOfficeOlderThan3_3(const uno::Reference< frame::XModel > &xChartModel)
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...
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
Definition: nmspmap.cxx:437
SchXMLImportHelper & mrImportHelper
SchXMLPositionAttributesHelper(SvXMLImport &rImporter)
css::uno::Any const & rValue
Definition: ImageStyle.hxx:38
bool convertMeasureToCore(sal_Int32 &rValue, const OUString &rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
convert string to measure with meCoreMeasureUnit, using optional min and max values ...
Definition: xmluconv.cxx:171
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
void setXMLRangePropertyAtDataSequence(const Reference< chart2::data::XDataSequence > &xDataSequence, const OUString &rXMLRange)
virtual ~SchXMLWallFloorContext() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual ~SchXMLStatisticsObjectContext() override
::std::vector< SchXMLAxis > maAxes
const SvXMLTokenMap & GetPlotAreaElemTokenMap()
SchXMLStatisticsObjectContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rSeriesStyleName,::std::vector< DataRowPointStyle > &rStyleVector, const css::uno::Reference< css::chart2::XDataSeries > &xSeries, ContextType eContextType, tSchXMLLSequencesPerIndex &rLSequencesPerIndex)
SchXML3DSceneAttributesHelper(SvXMLImport &rImporter)
SchXMLWallFloorContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName, css::uno::Reference< css::chart::XDiagram > const &xDiagram, ContextType eContextType)
const SvXMLTokenMap & GetPlotAreaAttrTokenMap()
::std::pair< tSchXMLIndex, SchXMLLabeledSequencePart > tSchXMLIndexWithPart
SchXMLImportHelper & mrImportHelper
css::uno::Any maStackedBarsConnectedDefault
::std::vector< OUString > & mrLabels
void getCameraDefaultFromDiagram(const css::uno::Reference< css::chart::XDiagram > &xDiagram)
const OUString & m_rXLinkHRefAttributeToIndicateDataProvider
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex
SchXMLStockContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName, css::uno::Reference< css::chart::XDiagram > const &xDiagram, ContextType eContextType)
::std::vector< OUString > & mrLabels
::basegfx::B3DVector maVUP
void readAutomaticPositioningProperties(XMLPropStyleContext const *pPropStyleContext, const SvXMLStylesContext *pStylesCtxt)
int i
SchXMLPositionAttributesHelper m_aInnerPositioning
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:230
::basegfx::B3DVector maVPN
::std::vector< DataRowPointStyle > & mrStyleVector
::std::vector< DataRowPointStyle > & mrStyleVector
virtual ~SchXMLPlotAreaContext() override
css::uno::Reference< css::beans::XPropertySet > m_xErrorXProperties
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...
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
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...
sal_uInt16 Get(sal_uInt16 nPrefix, const OUString &rLName) const
Definition: xmltkmap.cxx:93
SchXMLDataPointContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, const OUString &rLocalName,::std::vector< DataRowPointStyle > &rStyleVector, const css::uno::Reference< css::chart2::XDataSeries > &xSeries, sal_Int32 &rIndex, bool bSymbolSizeForSeriesIsMissingInFile)
static void CorrectAxisPositions(const css::uno::Reference< css::chart2::XChartDocument > &xNewDoc, const OUString &rChartTypeServiceName, const OUString &rODFVersionOfFile, bool bAxisPositionAttributeImported)
SvXMLImportContext * create3DLightContext(sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
creates a 3d light context and adds it to the internal list for later processing
void processSceneAttribute(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rValue)
this should be called for each scene attribute
css::uno::Any maRegressionCurvesDefault
static XmlStyleFamily GetChartFamilyID()
::std::vector< RegressionStyle > maRegressionStyleVector
With this class you can import a element containing its data as element o...
css::uno::Reference< css::chart2::XDataSeries > m_xSeries
SchXMLPositionAttributesHelper & m_rPositioning
void readPositioningAttribute(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rValue)
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
#define TOOLS_INFO_EXCEPTION(area, stream)
SchXMLDataLabelSpanContext(SvXMLImport &rImport, const OUString &rLocalName,::std::vector< OUString > &rLabels)
SchXMLPositionAttributesHelper m_aOuterPositioning
SchXML3DSceneAttributesHelper maSceneImportHelper
::std::vector< OUString > & mrLabels
const SvXMLTokenMap & GetSeriesElemTokenMap()
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
void CreateCategories(const uno::Reference< chart2::data::XDataProvider > &xDataProvider, const uno::Reference< chart2::XChartDocument > &xNewDoc, const OUString &rRangeAddress, sal_Int32 nCooSysIndex, sal_Int32 nDimensionIndex, tSchXMLLSequencesPerIndex *pLSequencesPerIndex)
Reference< XMultiServiceFactory > getProcessServiceFactory()
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...
const css::uno::Reference< css::chart::XChartDocument > & GetChartDocument() const
::std::vector< DataRowPointStyle > maSeriesStyleVector
SeriesDefaultsAndStyles & mrSeriesDefaultsAndStyles
OUString const & GetODFVersion() const
Definition: xmlimp.cxx:1964
#define SAL_WARN_IF(condition, area, stream)
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3372
css::awt::Rectangle getRectangle() const
Handling of tokens in XML:
SchXMLDataLabelParaContext(SvXMLImport &rImport, const OUString &rLocalName,::std::vector< OUString > &rLabels)
const SvXMLImport & m_rImport
GlobalSeriesImportInfo m_aGlobalSeriesImportInfo
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0(const uno::Reference< frame::XModel > &xChartModel)
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:403
virtual ~SchXMLStockContext() override
Reference< XComponentContext > getProcessComponentContext()
virtual void Characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
awt::Size m_aSize
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex
static css::uno::Sequence< typename VectorType::value_type > vectorToSequence(const VectorType &rVector)
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:881
::std::vector< OUString > mCustomLabels
#define SAL_WARN(area, stream)
SchXMLImportHelper & mrImportHelper
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3(const uno::Reference< frame::XModel > &xChartModel)
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4(const uno::Reference< frame::XModel > &xChartModel)
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
::basegfx::B3DVector maVRP
static void lcl_setErrorBarSequence(const uno::Reference< chart2::XChartDocument > &xDoc, const uno::Reference< beans::XPropertySet > &xBarProp, const OUString &aXMLRange, bool bPositiveValue, bool bYError, tSchXMLLSequencesPerIndex &rSequences)
css::uno::Reference< css::beans::XPropertySet > m_xErrorYProperties
uno::Any getPropertyFromContext(const OUString &rPropertyName, const XMLPropStyleContext *pPropStyleContext, const SvXMLStylesContext *pStylesCtxt)
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...
::std::multimap< tSchXMLIndexWithPart, css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tSchXMLLSequencesPerIndex
constexpr sal_uInt16 XML_NAMESPACE_SVG
Definition: xmlnmspe.hxx:40
virtual ~SchXMLCoordinateRegionContext() override
css::uno::Reference< css::chart::XDiagram > mxDiagram
Reference< chart2::XDataSeries > m_xSeries
SchXMLDataLabelContext(SvXMLImport &rImport, const OUString &rLocalName,::std::vector< OUString > &rLabels)