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"
24#include "SchXMLTools.hxx"
25
28#include <sal/log.hxx>
29#include <tools/diagnose_ex.h>
32#include <xmloff/xmluconv.hxx>
33#include <xmloff/prstylei.hxx>
34#include <xmloff/xmlstyle.hxx>
36
37#include <com/sun/star/awt/Point.hpp>
38#include <com/sun/star/awt/Size.hpp>
39#include <com/sun/star/chart/ErrorBarStyle.hpp>
40#include <com/sun/star/chart/X3DDisplay.hpp>
41#include <com/sun/star/chart/XStatisticDisplay.hpp>
42#include <com/sun/star/chart/XDiagramPositioning.hpp>
43#include <com/sun/star/chart/XChartDocument.hpp>
44#include <com/sun/star/chart2/XChartDocument.hpp>
45#include <com/sun/star/chart2/data/XDataSink.hpp>
46#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
47#include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
48#include <com/sun/star/drawing/CameraGeometry.hpp>
49#include <com/sun/star/lang/XMultiServiceFactory.hpp>
50#include <com/sun/star/lang/XServiceInfo.hpp>
51#include <com/sun/star/xml/sax/XAttributeList.hpp>
52
53using namespace com::sun::star;
54using namespace ::xmloff::token;
55
57
58namespace
59{
60
61struct lcl_AxisHasCategories
62{
63 bool operator() ( const SchXMLAxis & rAxis )
64 {
65 return rAxis.bHasCategories;
66 }
67};
68
69OUString lcl_ConvertRange( const OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
70{
71 OUString aResult = rRange;
72 if(!xDoc.is())
73 return aResult;
74 uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
75 xDoc->getDataProvider(), uno::UNO_QUERY );
76 if( xConversion.is())
77 aResult = xConversion->convertRangeFromXML( rRange );
78 return aResult;
79}
80
81} // anonymous namespace
82
84 : SdXML3DSceneAttributesHelper( rImporter )
85{
86}
87
88void SchXML3DSceneAttributesHelper::getCameraDefaultFromDiagram( const uno::Reference< chart::XDiagram >& xDiagram )
89{
90 //different defaults for camera geometry necessary to workaround wrong behaviour in old chart
91 //in future make this version dependent if we have versioning (metastream) for ole objects
92
93 try
94 {
95 uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
96 if( xProp.is() )
97 {
98 drawing::CameraGeometry aCamGeo;
99 xProp->getPropertyValue("D3DCameraGeometry") >>= aCamGeo;
100 maVRP.setX( aCamGeo.vrp.PositionX );
101 maVRP.setY( aCamGeo.vrp.PositionY );
102 maVRP.setZ( aCamGeo.vrp.PositionZ );
103 maVPN.setX( aCamGeo.vpn.DirectionX );
104 maVPN.setY( aCamGeo.vpn.DirectionY );
105 maVPN.setZ( aCamGeo.vpn.DirectionZ );
106 maVUP.setX( aCamGeo.vup.DirectionX );
107 maVUP.setY( aCamGeo.vup.DirectionY );
108 maVUP.setZ( aCamGeo.vup.DirectionZ );
109 }
110 }
111 catch( const uno::Exception & )
112 {
113 TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property NumberOfLines");
114 }
115}
116
118{
119}
120
122 SchXMLImportHelper& rImpHelper,
123 SvXMLImport& rImport,
124 const OUString& rXLinkHRefAttributeToIndicateDataProvider,
125 OUString& rCategoriesAddress,
126 OUString& rChartAddress,
127 bool & rbHasRangeAtPlotArea,
128 bool & rAllRangeAddressesAvailable,
129 bool & rColHasLabels,
130 bool & rRowHasLabels,
131 chart::ChartDataRowSource & rDataRowSource,
132 SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
133 const OUString& aChartTypeServiceName,
134 tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
135 const awt::Size & rChartSize ) :
136 SvXMLImportContext( rImport ),
137 mrImportHelper( rImpHelper ),
138 mrCategoriesAddress( rCategoriesAddress ),
139 mrSeriesDefaultsAndStyles( rSeriesDefaultsAndStyles ),
140 mnNumOfLinesProp( 0 ),
141 mbStockHasVolume( false ),
142 mnSeries( 0 ),
143 m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ),
144 maSceneImportHelper( rImport ),
145 m_aOuterPositioning( rImport ),
146 m_aInnerPositioning( rImport ),
147 mbPercentStacked(false),
148 m_bAxisPositionAttributeImported(false),
149 m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
150 mrChartAddress( rChartAddress ),
151 m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ),
152 mrColHasLabels( rColHasLabels ),
153 mrRowHasLabels( rRowHasLabels ),
154 mrDataRowSource( rDataRowSource ),
155 maChartTypeServiceName( aChartTypeServiceName ),
156 mrLSequencesPerIndex( rLSequencesPerIndex ),
157 mbGlobalChartTypeUsedBySeries( false ),
158 maChartSize( rChartSize )
159{
161
162 // get Diagram
163 uno::Reference< chart::XChartDocument > xDoc = rImpHelper.GetChartDocument();
164 if( xDoc.is())
165 {
166 mxDiagram = xDoc->getDiagram();
167 mxNewDoc.set( xDoc, uno::UNO_QUERY );
168
170 }
171 SAL_WARN_IF( !mxDiagram.is(),"xmloff.chart", "Couldn't get XDiagram" );
172
173 // turn off all axes initially
174 uno::Any aFalseBool;
175 aFalseBool <<= false;
176
177 uno::Reference< lang::XServiceInfo > xInfo( mxDiagram, uno::UNO_QUERY );
178 uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
179 if( !xInfo.is() || !xProp.is() )
180 return;
181
182 try
183 {
184 xProp->setPropertyValue("HasXAxis", aFalseBool );
185 xProp->setPropertyValue("HasXAxisGrid", aFalseBool );
186 xProp->setPropertyValue("HasXAxisDescription", aFalseBool );
187 xProp->setPropertyValue("HasSecondaryXAxis", aFalseBool );
188 xProp->setPropertyValue("HasSecondaryXAxisDescription", aFalseBool );
189
190 xProp->setPropertyValue("HasYAxis", aFalseBool );
191 xProp->setPropertyValue("HasYAxisGrid", aFalseBool );
192 xProp->setPropertyValue("HasYAxisDescription", aFalseBool );
193 xProp->setPropertyValue("HasSecondaryYAxis", aFalseBool );
194 xProp->setPropertyValue("HasSecondaryYAxisDescription", aFalseBool );
195
196 xProp->setPropertyValue("HasZAxis", aFalseBool );
197 xProp->setPropertyValue("HasZAxisDescription", aFalseBool );
198
199 xProp->setPropertyValue("DataRowSource", uno::Any(chart::ChartDataRowSource_COLUMNS) );
200 }
201 catch( const beans::UnknownPropertyException & )
202 {
203 SAL_WARN("xmloff.chart", "Property required by service not supported" );
204 }
205}
206
208{}
209
210void SchXMLPlotAreaContext::startFastElement (sal_Int32 /*nElement*/,
211 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
212{
213 // parse attributes
214 uno::Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
215
216 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
217 {
218 switch( aIter.getToken() )
219 {
220 case XML_ELEMENT(SVG, XML_X):
221 case XML_ELEMENT(SVG_COMPAT, XML_X):
222 case XML_ELEMENT(SVG, XML_Y):
223 case XML_ELEMENT(SVG_COMPAT, XML_Y):
225 case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
227 case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
228 m_aOuterPositioning.readPositioningAttribute( aIter.getToken(), aIter.toView() );
229 break;
231 msAutoStyleName = aIter.toString();
232 break;
234 mrChartAddress = lcl_ConvertRange( aIter.toString(), xNewDoc );
235 // indicator for getting data from the outside
237 break;
239 {
240 if( IsXMLToken(aIter, XML_BOTH) )
242 else if( IsXMLToken(aIter, XML_ROW) )
243 mrRowHasLabels = true;
244 else if( IsXMLToken(aIter, XML_COLUMN) )
245 mrColHasLabels = true;
246 }
247 break;
248 case XML_ELEMENT(DR3D, XML_TRANSFORM):
249 case XML_ELEMENT(DR3D, XML_VRP):
250 case XML_ELEMENT(DR3D, XML_VPN):
251 case XML_ELEMENT(DR3D, XML_VUP):
252 case XML_ELEMENT(DR3D, XML_PROJECTION):
253 case XML_ELEMENT(DR3D, XML_DISTANCE):
254 case XML_ELEMENT(DR3D, XML_FOCAL_LENGTH):
255 case XML_ELEMENT(DR3D, XML_SHADOW_SLANT):
256 case XML_ELEMENT(DR3D, XML_SHADE_MODE):
257 case XML_ELEMENT(DR3D, XML_AMBIENT_COLOR):
258 case XML_ELEMENT(DR3D, XML_LIGHTING_MODE):
260 break;
261 default:
262 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
263 }
264 }
265
266 if( ! mxNewDoc.is())
267 {
268 uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
269 if( xDocProp.is())
270 {
271 try
272 {
273 xDocProp->setPropertyValue("DataSourceLabelsInFirstColumn", uno::Any(mrColHasLabels) );
274 xDocProp->setPropertyValue("DataSourceLabelsInFirstRow", uno::Any(mrRowHasLabels) );
275 }
276 catch( const beans::UnknownPropertyException & )
277 {
278 SAL_WARN("xmloff.chart", "Properties missing" );
279 }
280 }
281 }
282
283 // set properties
284 uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
285 if( !msAutoStyleName.isEmpty())
286 {
287 if( xProp.is())
288 {
290 if( pStylesCtxt )
291 {
292 const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
294
295 XMLPropStyleContext* pPropStyleContext =
296 const_cast< XMLPropStyleContext * >(
297 dynamic_cast< const XMLPropStyleContext * >( pStyle ) );
298 if( pPropStyleContext )
299 {
300 pPropStyleContext->FillPropertySet( xProp );
301
302 // get the data row source that was set without having data
303 xProp->getPropertyValue("DataRowSource")
304 >>= mrDataRowSource;
305
306 //lines on/off
307 //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
309 u"Lines", pPropStyleContext, pStylesCtxt );
310
311 //handle automatic position and size
312 m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt );
313
314 //correct default starting angle for old 3D pies
316 {
317 bool bIs3d = false;
318 if( xProp.is() && ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) &&
319 bIs3d )
320 {
321 if( maChartTypeServiceName == "com.sun.star.chart2.PieChartType" || maChartTypeServiceName == "com.sun.star.chart2.DonutChartType" )
322 {
323 OUString aPropName( "StartingAngle" );
324 uno::Any aAStartingAngle( SchXMLTools::getPropertyFromContext( aPropName, pPropStyleContext, pStylesCtxt ) );
325 if( !aAStartingAngle.hasValue() )
326 xProp->setPropertyValue( aPropName, uno::Any(sal_Int32(0)) ) ;
327 }
328 }
329 }
330 }
331 }
332 }
333 }
334
335 //remember default values for dataseries
336 if(xProp.is())
337 {
338 try
339 {
340 mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue("SymbolType");
341 mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue("DataCaption");
342
343 mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue("MeanValue");
344 mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue("RegressionCurves");
345
346 bool bStacked = false;
347 mrSeriesDefaultsAndStyles.maStackedDefault = xProp->getPropertyValue("Stacked");
349 mrSeriesDefaultsAndStyles.maPercentDefault = xProp->getPropertyValue("Percent");
351 mrSeriesDefaultsAndStyles.maStackedBarsConnectedDefault = xProp->getPropertyValue("StackedBarsConnected");
352
353 // deep
354 uno::Any aDeepProperty( xProp->getPropertyValue("Deep"));
355 // #124488# old versions store a 3d area and 3D line deep chart with Deep==false => workaround for this
356 if( ! (bStacked || mbPercentStacked ))
357 {
359 {
360 bool bIs3d = false;
361 if( ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) &&
362 bIs3d )
363 {
364 if( maChartTypeServiceName == "com.sun.star.chart2.AreaChartType" || maChartTypeServiceName == "com.sun.star.chart2.LineChartType" )
365 {
366 aDeepProperty <<= true;
367 }
368 }
369 }
370 }
372
373 xProp->getPropertyValue("NumberOfLines") >>= mnNumOfLinesProp;
374 xProp->getPropertyValue("Volume") >>= mbStockHasVolume;
375 }
376 catch( const uno::Exception & )
377 {
378 TOOLS_INFO_EXCEPTION("xmloff.chart", "PlotAreaContext:EndElement(): Exception caught");
379 }
380 } // if
381
382 bool bCreateInternalDataProvider = false;
383 if( m_rXLinkHRefAttributeToIndicateDataProvider == "." ) //data comes from the chart itself
384 bCreateInternalDataProvider = true;
385 else if( m_rXLinkHRefAttributeToIndicateDataProvider == ".." ) //data comes from the parent application
386 bCreateInternalDataProvider = false;
387 else if( !m_rXLinkHRefAttributeToIndicateDataProvider.isEmpty() ) //not supported so far to get the data by sibling objects -> fall back to chart itself
388 bCreateInternalDataProvider = true;
389 else if( !m_rbHasRangeAtPlotArea )
390 bCreateInternalDataProvider = true;
391
392 if( bCreateInternalDataProvider && mxNewDoc.is() )
393 {
394 // we have no complete range => we have own data, so switch the data
395 // provider to internal. Clone is not necessary, as we don't have any
396 // data yet.
397 mxNewDoc->createInternalDataProvider( false /* bCloneExistingData */ );
398 if( xProp.is() && mrDataRowSource!=chart::ChartDataRowSource_COLUMNS )
399 xProp->setPropertyValue("DataRowSource", uno::Any(mrDataRowSource) );
400 }
401}
402
403css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLPlotAreaContext::createFastChildContext(
404 sal_Int32 nElement,
405 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
406{
407 SvXMLImportContext* pContext = nullptr;
408
409 switch(nElement)
410 {
411 case XML_ELEMENT(CHART_EXT, XML_COORDINATE_REGION):
413 {
415 }
416 break;
417
419 {
420 bool bAddMissingXAxisForNetCharts = false;
421 bool bAdaptWrongPercentScaleValues = false;
423 {
424 //correct errors from older versions
425
426 // for NetCharts there were no xAxis exported to older files
427 // so we need to add the x axis here for those old NetChart files
428 if ( maChartTypeServiceName == "com.sun.star.chart2.NetChartType" )
429 bAddMissingXAxisForNetCharts = true;
430
431 //Issue 59288
432 if( mbPercentStacked )
433 bAdaptWrongPercentScaleValues = true;
434 }
435
436 bool bAdaptXAxisOrientationForOld2DBarCharts = false;
438 {
439 //issue74660
440 if ( maChartTypeServiceName == "com.sun.star.chart2.ColumnChartType" )
441 bAdaptXAxisOrientationForOld2DBarCharts = true;
442 }
443
445 bAddMissingXAxisForNetCharts, bAdaptWrongPercentScaleValues, bAdaptXAxisOrientationForOld2DBarCharts, m_bAxisPositionAttributeImported );
446 }
447 break;
448
450 {
451 if( mxNewDoc.is())
452 {
453 pContext = new SchXMLSeries2Context(
458 mnSeries,
464 }
465 mnSeries++;
466 }
467 break;
468
472 break;
476 break;
477
478 case XML_ELEMENT(DR3D, XML_LIGHT):
479 pContext = maSceneImportHelper.create3DLightContext( xAttrList );
480 break;
481
482 // elements for stock charts
486 break;
490 break;
494 break;
495 default:
496 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
497 }
498
499 return pContext;
500}
501
503{
504 // set categories
505 if( !mrCategoriesAddress.isEmpty() && mxNewDoc.is())
506 {
507 uno::Reference< chart2::data::XDataProvider > xDataProvider(
508 mxNewDoc->getDataProvider() );
509 // @todo: correct coordinate system index
510 sal_Int32 nDimension( 0 );
511 ::std::vector< SchXMLAxis >::const_iterator aIt(
512 ::std::find_if( maAxes.begin(), maAxes.end(), lcl_AxisHasCategories()));
513 if( aIt != maAxes.end())
514 nDimension = static_cast< sal_Int32 >( (*aIt).eDimension );
516 xDataProvider, mxNewDoc, mrCategoriesAddress,
517 0 /* nCooSysIndex */,
518 nDimension, &mrLSequencesPerIndex );
519 }
520
521 uno::Reference< beans::XPropertySet > xDiaProp( mxDiagram, uno::UNO_QUERY );
522 if( xDiaProp.is())
523 {
524 bool bIsThreeDim = false;
525 uno::Any aAny = xDiaProp->getPropertyValue("Dim3D");
526 aAny >>= bIsThreeDim;
527
528 // set 3d scene attributes
529 if( bIsThreeDim )
530 {
531 // set scene attributes at diagram
533 }
534
535 // set correct number of lines at series
536 if( ! m_aGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && mnNumOfLinesProp > 0 && maChartTypeServiceName == "com.sun.star.chart2.ColumnChartType" )
537 {
538 try
539 {
540 xDiaProp->setPropertyValue("NumberOfLines",
542 }
543 catch( const uno::Exception & )
544 {
545 TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property NumberOfLines");
546 }
547 }
548
549 // #i32366# stock has volume
550 if( mxDiagram->getDiagramType() == "com.sun.star.chart.StockDiagram" &&
552 {
553 try
554 {
555 xDiaProp->setPropertyValue("Volume",
556 uno::Any( true ));
557 }
558 catch( const uno::Exception & )
559 {
560 TOOLS_INFO_EXCEPTION("xmloff.chart", "Exception caught for property Volume");
561 }
562 }
563 }
564
565 // set changed size and position after properties (esp. 3d)
566
567 uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY );
568 if( xDiaPos.is())
569 {
571 {
573 xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() );
575 {
576 if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
577 xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() );
578 else
579 xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() );
580 }
581 }
582 }
583
584 SchXMLAxisContext::CorrectAxisPositions( uno::Reference< chart2::XChartDocument >( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ), maChartTypeServiceName, GetImport().GetODFVersion(), m_bAxisPositionAttributeImported );
585}
586
587SchXMLDataLabelSpanContext::SchXMLDataLabelSpanContext( SvXMLImport& rImport, ::std::vector<OUString>& rLabels):
588 SvXMLImportContext( rImport ),
589 mrLabels(rLabels)
590{
591}
592
593void SchXMLDataLabelSpanContext::characters(const OUString& rChars)
594{
595 maCharBuffer.append(rChars);
596}
597
599{
600 mrLabels.push_back(maCharBuffer.makeStringAndClear());
601}
602
603SchXMLDataLabelParaContext::SchXMLDataLabelParaContext( SvXMLImport& rImport, ::std::vector<OUString>& rLabels):
604 SvXMLImportContext( rImport ),
605 mrLabels(rLabels)
606{
607}
608
609css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLDataLabelParaContext::createFastChildContext(
610 sal_Int32 nElement,
611 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
612{
613 if ( nElement == XML_ELEMENT(TEXT, XML_SPAN) )
615 else
616 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
617 return nullptr;
618}
619
621 CustomLabelsInfo& rLabels,
622 DataRowPointStyle& rDataLabelStyle)
623 : SvXMLImportContext(rImport)
624 , mrLabels(rLabels)
625 , mrDataLabelStyle(rDataLabelStyle)
626{
627}
628
629css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLDataLabelContext::createFastChildContext(
630 sal_Int32 nElement,
631 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
632{
633 if ( nElement == XML_ELEMENT(TEXT, XML_P) )
635 else
636 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
637 return nullptr;
638}
639
641 sal_Int32 /*nElement*/,
642 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
643{
644 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
645 {
646 switch(aIter.getToken())
647 {
648 case XML_ELEMENT(SVG, XML_X):
649 case XML_ELEMENT(SVG_COMPAT, XML_X):
650 {
651 sal_Int32 nResultValue;
652 GetImport().GetMM100UnitConverter().convertMeasureToCore(nResultValue, aIter.toView());
654 break;
655 }
656 case XML_ELEMENT(SVG, XML_Y):
657 case XML_ELEMENT(SVG_COMPAT, XML_Y):
658 {
659 sal_Int32 nResultValue;
660 GetImport().GetMM100UnitConverter().convertMeasureToCore(nResultValue, aIter.toView());
662 break;
663 }
665 mrDataLabelStyle.msStyleName = aIter.toString();
666 break;
667 case XML_ELEMENT(LO_EXT, XML_DATA_LABEL_GUID):
668 mrLabels.msLabelGuid = aIter.toString();
670 break;
672 mrLabels.msLabelsCellRange = aIter.toString();
674 break;
675 default:
676 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
677 }
678 }
679}
680
681
683 ::std::vector< DataRowPointStyle >& rStyleVector,
684 const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
685 sal_Int32& rIndex,
686 bool bSymbolSizeForSeriesIsMissingInFile ) :
687 SvXMLImportContext( rImport ),
688 mrStyleVector( rStyleVector ),
689 mrIndex( rIndex ),
690 mDataPoint(DataRowPointStyle::DATA_POINT, xSeries, rIndex, 1, OUString{}),
691 mDataLabel(DataRowPointStyle::DATA_LABEL_POINT, xSeries, rIndex, 1, OUString{})
692{
693 mDataPoint.mbSymbolSizeForSeriesIsMissingInFile = bSymbolSizeForSeriesIsMissingInFile;
694}
695
696css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLDataPointContext::createFastChildContext(
697 sal_Int32 nElement,
698 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
699{
700 SvXMLImportContext* pContext = nullptr;
701 switch(nElement)
702 {
704 mbHasLabelParagraph = true;
706 mDataLabel);
707 break;
708 default:
709 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
710 }
711 return pContext;
712}
713
715{
716}
717
719 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
720{
721 OUString sAutoStyleName;
722 sal_Int32 nRepeat = 1;
723 OUString sCustomLabelField;
724
725 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
726 {
727 switch (aIter.getToken())
728 {
730 {
731 sAutoStyleName = aIter.toString();
732 mDataPoint.msStyleName = sAutoStyleName;
733 mDataLabel.msStyleNameOfParent = sAutoStyleName;
734 break;
735 }
737 {
738 nRepeat = aIter.toInt32();
739 mDataPoint.m_nPointRepeat = nRepeat;
740 mDataLabel.m_nPointRepeat = nRepeat;
741 break;
742 }
743 // Deprecated. New documents use the chart:data-label element
744 // instead in order to store custom label text.
747 {
748 sCustomLabelField = aIter.toString();
749 mDataPoint.mCustomLabels.mLabels.push_back(sCustomLabelField);
750 }
751 break;
752 case XML_ELEMENT(LO_EXT, XML_HIDE_LEGEND):
753 {
754 bool bHideLegend = aIter.toBoolean();
755 if (bHideLegend)
756 {
757 uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
758 Reference<beans::XPropertySet> xSeriesProp(mDataPoint.m_xSeries, uno::UNO_QUERY);
759 xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
760 std::vector<sal_Int32> deletedLegendEntries;
761 for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
762 {
763 deletedLegendEntries.push_back(deletedLegendEntry);
764 }
765 deletedLegendEntries.push_back(mDataPoint.m_nPointIndex);
766 xSeriesProp->setPropertyValue("DeletedLegendEntries", uno::Any(comphelper::containerToSequence(deletedLegendEntries)));
767 }
768 break;
769 }
771 {
772 mDataPoint.mCustomLabelPos[0] = aIter.toDouble();
773 break;
774 }
776 {
777 mDataPoint.mCustomLabelPos[1] = aIter.toDouble();
778 break;
779 }
780 default:
781 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
782 }
783 }
784
785 mrIndex += nRepeat;
786}
787
789{
790 if(!mDataPoint.msStyleName.isEmpty() || mDataPoint.mCustomLabels.mLabels.size() > 0)
791 {
792 mrStyleVector.push_back(mDataPoint);
793 }
794 if (!mDataLabel.msStyleName.isEmpty() || mDataLabel.mo_nLabelAbsolutePosX.has_value()
795 || mDataLabel.mo_nLabelAbsolutePosY.has_value())
796 {
797 mrStyleVector.push_back(mDataLabel);
798 }
799}
800
802 : m_rImport( rImporter )
803 , m_aPosition(0,0)
804 , m_aSize(0,0)
805 , m_bHasSizeWidth( false )
806 , m_bHasSizeHeight( false )
807 , m_bHasPositionX( false )
808 , m_bHasPositionY( false )
809 , m_bAutoSize( false )
810 , m_bAutoPosition( false )
811{
812}
813
815{
817}
818
820{
822}
823
824void SchXMLPositionAttributesHelper::readPositioningAttribute( sal_Int32 nAttributeToken, std::string_view rValue )
825{
826 if( !IsTokenInNamespace(nAttributeToken, XML_NAMESPACE_SVG) && !IsTokenInNamespace(nAttributeToken, XML_NAMESPACE_SVG_COMPAT) )
827 return;
828
829 switch (nAttributeToken & TOKEN_MASK)
830 {
831 case XML_X:
832 {
834 m_aPosition.X, rValue );
835 m_bHasPositionX = true;
836 break;
837 }
838 case XML_Y:
839 {
841 m_aPosition.Y, rValue );
842 m_bHasPositionY = true;
843 break;
844 }
845 case XML_WIDTH:
846 {
848 m_aSize.Width, rValue );
849 m_bHasSizeWidth = true;
850 break;
851 }
852 case XML_HEIGHT:
853 {
855 m_aSize.Height, rValue );
856 m_bHasSizeHeight = true;
857 break;
858 }
859 default:
860 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttributeToken, OUString::fromUtf8(rValue));
861 }
862}
863
865{
866 if( pPropStyleContext && pStylesCtxt )
867 {
868 //handle automatic position and size
870 u"AutomaticSize", pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize;
872 u"AutomaticPosition", pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition;
873 }
874}
875
877 SvXMLImport& rImport
878 , SchXMLPositionAttributesHelper& rPositioning )
879 : SvXMLImportContext( rImport )
880 , m_rPositioning( rPositioning )
881{
882}
883
885{
886}
887
889 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
890{
891 // parse attributes
892 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
893 m_rPositioning.readPositioningAttribute( aIter.getToken(), aIter.toView() );
894}
895
897 SchXMLImportHelper& rImpHelper,
898 SvXMLImport& rImport,
899 uno::Reference< chart::XDiagram > const & xDiagram,
900 ContextType eContextType ) :
901 SvXMLImportContext( rImport ),
902 mrImportHelper( rImpHelper ),
903 mxWallFloorSupplier( xDiagram, uno::UNO_QUERY ),
904 meContextType( eContextType )
905{
906}
907
909{
910}
911
913 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
914{
915 if( !mxWallFloorSupplier.is())
916 return;
917
918 OUString sAutoStyleName;
919
920 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
921 {
922 if( aIter.getToken() == XML_ELEMENT(CHART, XML_STYLE_NAME) )
923 sAutoStyleName = aIter.toString();
924 else
925 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
926 }
927
928 // set properties
929 uno::Reference< beans::XPropertySet > xProp = ( meContextType == CONTEXT_TYPE_WALL )
930 ? mxWallFloorSupplier->getWall()
931 : mxWallFloorSupplier->getFloor();
932
933 if (!sAutoStyleName.isEmpty())
934 mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
935}
936
938 SchXMLImportHelper& rImpHelper,
939 SvXMLImport& rImport,
940 uno::Reference< chart::XDiagram > const & xDiagram,
941 ContextType eContextType ) :
942 SvXMLImportContext( rImport ),
943 mrImportHelper( rImpHelper ),
944 mxStockPropProvider( xDiagram, uno::UNO_QUERY ),
945 meContextType( eContextType )
946{
947}
948
950{
951}
952
953void SchXMLStockContext::startFastElement (sal_Int32 /*Element*/,
954 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
955{
956 if( !mxStockPropProvider.is())
957 return;
958
959 OUString sAutoStyleName;
960
961 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
962 {
963 if( aIter.getToken() == XML_ELEMENT(CHART, XML_STYLE_NAME) )
964 sAutoStyleName = aIter.toString();
965 else
966 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
967 }
968
969 if( sAutoStyleName.isEmpty())
970 return;
971
972 // set properties
973 uno::Reference< beans::XPropertySet > xProp;
974 switch( meContextType )
975 {
977 xProp = mxStockPropProvider->getUpBar();
978 break;
980 xProp = mxStockPropProvider->getDownBar();
981 break;
983 xProp = mxStockPropProvider->getMinMaxLine();
984 break;
985 }
986
987 mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
988}
989
990static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocument > &xDoc,
991 const uno::Reference< beans::XPropertySet > &xBarProp,
992 const OUString &aXMLRange,
993 bool bPositiveValue, bool bYError,
994 tSchXMLLSequencesPerIndex& rSequences)
995{
996 uno::Reference< css::chart2::data::XDataProvider > xDataProvider(xDoc->getDataProvider());
997 uno::Reference< css::chart2::data::XDataSource > xDataSource( xBarProp, uno::UNO_QUERY );
998 uno::Reference< css::chart2::data::XDataSink > xDataSink( xDataSource, uno::UNO_QUERY );
999
1000 assert( xDataSink.is() && xDataSource.is() && xDataProvider.is() );
1001
1002 OUString aRange(lcl_ConvertRange(aXMLRange,xDoc));
1003
1004 uno::Reference< chart2::data::XDataSequence > xNewSequence(
1005 xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
1006
1007 if( !xNewSequence.is())
1008 return;
1009
1010 SchXMLTools::setXMLRangePropertyAtDataSequence(xNewSequence,aXMLRange);
1011
1012 OUStringBuffer aRoleBuffer("error-bars-");
1013 if( bYError )
1014 aRoleBuffer.append( 'y' );
1015 else
1016 aRoleBuffer.append( 'x');
1017
1018 aRoleBuffer.append( '-' );
1019
1020 if( bPositiveValue )
1021 aRoleBuffer = aRoleBuffer.append( "positive" );
1022 else
1023 aRoleBuffer = aRoleBuffer.append( "negative" );
1024
1025 OUString aRole = aRoleBuffer.makeStringAndClear();
1026
1027 Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
1028
1029 xSeqProp->setPropertyValue("Role", uno::Any( aRole ));
1030
1032
1033 Reference< chart2::data::XLabeledDataSequence > xLabelSeq( chart2::data::LabeledDataSequence::create(xContext),
1034 uno::UNO_QUERY_THROW );
1035
1036 rSequences.emplace( tSchXMLIndexWithPart( -2, SCH_XML_PART_ERROR_BARS ), xLabelSeq );
1037
1038 xLabelSeq->setValues( xNewSequence );
1039
1040 uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
1041 xDataSource->getDataSequences());
1042
1043 aSequences.realloc( aSequences.getLength() + 1 );
1044 aSequences.getArray()[ aSequences.getLength() - 1 ] = xLabelSeq;
1045 xDataSink->setData( aSequences );
1046
1047}
1048
1050 SchXMLImportHelper& rImpHelper,
1051 SvXMLImport& rImport,
1052 const OUString &rSeriesStyleName,
1053 ::std::vector< DataRowPointStyle >& rStyleVector,
1054 const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
1055 ContextType eContextType,
1056 tSchXMLLSequencesPerIndex & rLSequencesPerIndex) :
1057
1058 SvXMLImportContext( rImport ),
1059 mrImportHelper( rImpHelper ),
1060 mrStyleVector( rStyleVector ),
1061 m_xSeries( xSeries ),
1062 meContextType( eContextType ),
1063 maSeriesStyleName( rSeriesStyleName),
1064 mrLSequencesPerIndex(rLSequencesPerIndex)
1065{}
1066
1068{
1069}
1070
1071namespace {
1072
1073void SetErrorBarStyleProperties( const OUString& rStyleName, const uno::Reference< beans::XPropertySet >& xBarProp,
1074 SchXMLImportHelper const & rImportHelper )
1075{
1076 const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
1078 rStyleName);
1079
1080 XMLPropStyleContext &rSeriesStyleContext =
1081 const_cast< XMLPropStyleContext& >( dynamic_cast< const XMLPropStyleContext& >( *pStyle ));
1082
1083 rSeriesStyleContext.FillPropertySet( xBarProp );
1084}
1085
1086void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, const uno::Reference< beans::XPropertySet>& xBarProp,
1087 SchXMLImportHelper const & rImportHelper, OUString& aPosRange, OUString& aNegRange)
1088{
1089 const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
1091 aStyleName);
1092
1093 XMLPropStyleContext * pSeriesStyleContext =
1094 const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
1095
1096 uno::Any aAny = SchXMLTools::getPropertyFromContext(u"ErrorBarStyle",
1097 pSeriesStyleContext,pStylesCtxt);
1098
1099 if ( !aAny.hasValue() )
1100 return;
1101
1102 sal_Int32 aBarStyle = css::chart::ErrorBarStyle::NONE;
1103 aAny >>= aBarStyle;
1104 xBarProp->setPropertyValue("ErrorBarStyle", aAny);
1105
1106 aAny = SchXMLTools::getPropertyFromContext(u"ShowPositiveError",
1107 pSeriesStyleContext,pStylesCtxt);
1108
1109 if(aAny.hasValue())
1110 xBarProp->setPropertyValue("ShowPositiveError",aAny);
1111
1112 aAny = SchXMLTools::getPropertyFromContext(u"ShowNegativeError",
1113 pSeriesStyleContext,pStylesCtxt);
1114
1115 if(aAny.hasValue())
1116 xBarProp->setPropertyValue("ShowNegativeError",aAny);
1117
1118 aAny = SchXMLTools::getPropertyFromContext(u"PositiveError",
1119 pSeriesStyleContext, pStylesCtxt);
1120
1121 if(aAny.hasValue())
1122 xBarProp->setPropertyValue("PositiveError", aAny);
1123 else
1124 {
1125 aAny = SchXMLTools::getPropertyFromContext(u"ConstantErrorHigh",
1126 pSeriesStyleContext, pStylesCtxt);
1127
1128 if(aAny.hasValue())
1129 xBarProp->setPropertyValue("PositiveError", aAny);
1130 }
1131
1132 aAny = SchXMLTools::getPropertyFromContext(u"NegativeError",
1133 pSeriesStyleContext, pStylesCtxt);
1134
1135 if(aAny.hasValue())
1136 xBarProp->setPropertyValue("NegativeError", aAny);
1137 else
1138 {
1139 aAny = SchXMLTools::getPropertyFromContext(u"ConstantErrorLow",
1140 pSeriesStyleContext, pStylesCtxt);
1141
1142 if(aAny.hasValue())
1143 xBarProp->setPropertyValue("NegativeError", aAny);
1144 }
1145
1146 aAny = SchXMLTools::getPropertyFromContext(u"ErrorBarRangePositive",
1147 pSeriesStyleContext, pStylesCtxt);
1148 if( aAny.hasValue() )
1149 {
1150 aAny >>= aPosRange;
1151 }
1152
1153 aAny = SchXMLTools::getPropertyFromContext(u"ErrorBarRangeNegative",
1154 pSeriesStyleContext, pStylesCtxt);
1155 if( aAny.hasValue() )
1156 {
1157 aAny >>= aNegRange;
1158 }
1159
1160 aAny = SchXMLTools::getPropertyFromContext(u"Weight",
1161 pSeriesStyleContext, pStylesCtxt);
1162 if( aAny.hasValue() )
1163 {
1164 xBarProp->setPropertyValue("Weight", aAny);
1165 }
1166
1167 aAny = SchXMLTools::getPropertyFromContext(u"PercentageError",
1168 pSeriesStyleContext, pStylesCtxt);
1169 if( aAny.hasValue() && aBarStyle == css::chart::ErrorBarStyle::RELATIVE )
1170 {
1171 xBarProp->setPropertyValue("PositiveError", aAny);
1172 xBarProp->setPropertyValue("NegativeError", aAny);
1173 }
1174
1175 switch(aBarStyle)
1176 {
1177 case css::chart::ErrorBarStyle::ERROR_MARGIN:
1178 {
1179 aAny = SchXMLTools::getPropertyFromContext(u"NegativeError",
1180 pSeriesStyleContext,pStylesCtxt);
1181
1182 xBarProp->setPropertyValue("NegativeError",aAny);
1183
1184 aAny = SchXMLTools::getPropertyFromContext(u"PositiveError",
1185 pSeriesStyleContext,pStylesCtxt);
1186
1187 xBarProp->setPropertyValue("PositiveError",aAny);
1188 }
1189 break;
1190 default:
1191 break;
1192 }
1193
1194}
1195
1196}
1197
1199 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1200{
1201 OUString sAutoStyleName;
1202 OUString aPosRange;
1203 OUString aNegRange;
1204 bool bYError = true;
1205
1206 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
1207 {
1208 switch (aIter.getToken())
1209 {
1211 sAutoStyleName = aIter.toString();
1212 break;
1214 bYError = aIter.toView() == "y";
1215 break;
1217 aPosRange = aIter.toString();
1218 break;
1220 aNegRange = aIter.toString();
1221 break;
1222 }
1223 }
1224
1225 if( sAutoStyleName.isEmpty() )
1226 return;
1227
1228 DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
1229
1230 switch( meContextType )
1231 {
1234 break;
1236 {
1238
1239 uno::Reference< lang::XMultiServiceFactory > xFact = comphelper::getProcessServiceFactory();
1240
1241 uno::Reference< beans::XPropertySet > xBarProp( xFact->createInstance("com.sun.star.chart2.ErrorBar" ),
1242 uno::UNO_QUERY );
1243
1244 xBarProp->setPropertyValue("ErrorBarStyle",uno::Any(css::chart::ErrorBarStyle::NONE));
1245 xBarProp->setPropertyValue("PositiveError",uno::Any(0.0));
1246 xBarProp->setPropertyValue("NegativeError",uno::Any(0.0));
1247 xBarProp->setPropertyValue("Weight",uno::Any(1.0));
1248 xBarProp->setPropertyValue("ShowPositiveError",uno::Any(true));
1249 xBarProp->setPropertyValue("ShowNegativeError",uno::Any(true));
1250
1251 // first import defaults from parent style
1252 SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, mrImportHelper );
1253 SetErrorBarStyleProperties( sAutoStyleName, xBarProp, mrImportHelper );
1254 SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
1255 SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
1256
1257 uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
1258
1259 if (!aPosRange.isEmpty())
1260 lcl_setErrorBarSequence(xDoc,xBarProp,aPosRange,true,bYError, mrLSequencesPerIndex);
1261
1262 if (!aNegRange.isEmpty())
1263 lcl_setErrorBarSequence(xDoc,xBarProp,aNegRange,false,bYError, mrLSequencesPerIndex);
1264
1265 if ( !bYError )
1266 {
1267 aStyle.m_xErrorXProperties.set( xBarProp );
1268 }
1269 else
1270 {
1271 aStyle.m_xErrorYProperties.set( xBarProp );
1272 }
1273 }
1274 break;
1275 }
1276
1277 mrStyleVector.push_back( aStyle );
1278}
1279
1280/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl::Reference< ::chart::DataSeries > m_xSeries
const SvXMLImport & m_rImport
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)
void getCameraDefaultFromDiagram(const css::uno::Reference< css::chart::XDiagram > &xDiagram)
SchXML3DSceneAttributesHelper(SvXMLImport &rImporter)
static void CorrectAxisPositions(const css::uno::Reference< css::chart2::XChartDocument > &xNewDoc, std::u16string_view rChartTypeServiceName, std::u16string_view rODFVersionOfFile, bool bAxisPositionAttributeImported)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual ~SchXMLCoordinateRegionContext() override
SchXMLCoordinateRegionContext(SvXMLImport &rImport, SchXMLPositionAttributesHelper &rPositioning)
SchXMLPositionAttributesHelper & m_rPositioning
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
DataRowPointStyle & mrDataLabelStyle
SchXMLDataLabelContext(SvXMLImport &rImport, CustomLabelsInfo &rLabels, DataRowPointStyle &rDataLabel)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
SchXMLDataLabelParaContext(SvXMLImport &rImport, ::std::vector< OUString > &rLabels)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
::std::vector< OUString > & mrLabels
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
SchXMLDataLabelSpanContext(SvXMLImport &rImport, ::std::vector< OUString > &rLabels)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
::std::vector< OUString > & mrLabels
virtual ~SchXMLDataPointContext() override
::std::vector< DataRowPointStyle > & mrStyleVector
SchXMLDataPointContext(SvXMLImport &rImport, ::std::vector< DataRowPointStyle > &rStyleVector, const css::uno::Reference< css::chart2::XDataSeries > &xSeries, sal_Int32 &rIndex, bool bSymbolSizeForSeriesIsMissingInFile)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
With this class you can import a <chart:chart> element containing its data as <table:table> element o...
const css::uno::Reference< css::chart::XChartDocument > & GetChartDocument() const
SvXMLStylesContext * GetAutoStylesContext() const
void FillAutoStyle(const OUString &rAutoStyleName, const css::uno::Reference< css::beans::XPropertySet > &rProp)
Fill in the autostyle.
static XmlStyleFamily GetChartFamilyID()
css::chart::ChartDataRowSource & mrDataRowSource
::std::vector< SchXMLAxis > maAxes
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
SchXML3DSceneAttributesHelper maSceneImportHelper
css::uno::Reference< css::chart::XDiagram > mxDiagram
SchXMLPositionAttributesHelper m_aOuterPositioning
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
SchXMLImportHelper & mrImportHelper
GlobalSeriesImportInfo m_aGlobalSeriesImportInfo
css::uno::Reference< css::chart2::XChartDocument > mxNewDoc
SchXMLPlotAreaContext(SchXMLImportHelper &rImpHelper, SvXMLImport &rImport, 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)
SchXMLPositionAttributesHelper m_aInnerPositioning
virtual ~SchXMLPlotAreaContext() override
const OUString & m_rXLinkHRefAttributeToIndicateDataProvider
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
SeriesDefaultsAndStyles & mrSeriesDefaultsAndStyles
void readPositioningAttribute(sal_Int32 nAttributeToken, std::string_view rValue)
void readAutomaticPositioningProperties(XMLPropStyleContext const *pPropStyleContext, const SvXMLStylesContext *pStylesCtxt)
SchXMLPositionAttributesHelper(SvXMLImport &rImporter)
css::awt::Rectangle getRectangle() const
css::uno::Reference< css::chart2::XDataSeries > m_xSeries
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
tSchXMLLSequencesPerIndex & mrLSequencesPerIndex
SchXMLStatisticsObjectContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, const OUString &rSeriesStyleName, ::std::vector< DataRowPointStyle > &rStyleVector, const css::uno::Reference< css::chart2::XDataSeries > &xSeries, ContextType eContextType, tSchXMLLSequencesPerIndex &rLSequencesPerIndex)
::std::vector< DataRowPointStyle > & mrStyleVector
virtual ~SchXMLStatisticsObjectContext() override
SchXMLStockContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, css::uno::Reference< css::chart::XDiagram > const &xDiagram, ContextType eContextType)
SchXMLImportHelper & mrImportHelper
virtual ~SchXMLStockContext() override
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
css::uno::Reference< css::chart::XStatisticDisplay > mxStockPropProvider
SchXMLImportHelper & mrImportHelper
css::uno::Reference< css::chart::X3DDisplay > mxWallFloorSupplier
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
SchXMLWallFloorContext(SchXMLImportHelper &rImportHelper, SvXMLImport &rImport, css::uno::Reference< css::chart::XDiagram > const &xDiagram, ContextType eContextType)
virtual ~SchXMLWallFloorContext() override
void processSceneAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter)
this should be called for each scene attribute
void setSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
this sets the scene attributes at this propertyset
::basegfx::B3DVector maVRP
Definition: shapeimport.hxx:92
SvXMLImportContext * create3DLightContext(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
creates a 3d light context and adds it to the internal list for later processing
::basegfx::B3DVector maVUP
Definition: shapeimport.hxx:94
::basegfx::B3DVector maVPN
Definition: shapeimport.hxx:93
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:400
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:798
bool convertMeasureToCore(sal_Int32 &rValue, std::u16string_view 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:186
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:222
void setX(TYPE fX)
void setY(TYPE fY)
void setZ(TYPE fZ)
#define TOOLS_INFO_EXCEPTION(area, stream)
float u
awt::Size m_aSize
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
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)
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3(const uno::Reference< frame::XModel > &xChartModel)
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0(const uno::Reference< frame::XModel > &xChartModel)
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4(const uno::Reference< frame::XModel > &xChartModel)
uno::Any getPropertyFromContext(std::u16string_view rPropertyName, const XMLPropStyleContext *pPropStyleContext, const SvXMLStylesContext *pStylesCtxt)
void setXMLRangePropertyAtDataSequence(const Reference< chart2::data::XDataSequence > &xDataSequence, const OUString &rXMLRange)
bool isDocumentGeneratedWithOpenOfficeOlderThan3_3(const uno::Reference< frame::XModel > &xChartModel)
Reference< XMultiServiceFactory > getProcessServiceFactory()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
OUString aPropName
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
@ XML_CELL_RANGE_ADDRESS
Definition: xmltoken.hxx:410
@ XML_CUSTOM_LABEL_POS_X
Definition: xmltoken.hxx:567
@ XML_DATA_SOURCE_HAS_LABELS
Definition: xmltoken.hxx:2177
@ XML_CUSTOM_LABEL_POS_Y
Definition: xmltoken.hxx:568
@ XML_CUSTOM_LABEL_FIELD
Definition: xmltoken.hxx:566
@ XML_DATA_LABELS_CELL_RANGE
Definition: xmltoken.hxx:592
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3573
Used to store text content of a data point custom-label's fields and also the helper members that ind...
bool mbDataLabelsRange
Are label's contents sourced from a cell[range] ?
OUString msLabelsCellRange
cell[range] from which label's contents are sourced.
::std::vector< OUString > mLabels
Text content of each field.
OUString msLabelGuid
GUID of the CELLRANGE field.
bool mbSymbolSizeForSeriesIsMissingInFile
CustomLabelsInfo mCustomLabels
css::uno::Reference< css::chart2::XDataSeries > m_xSeries
std::optional< sal_Int32 > mo_nLabelAbsolutePosX
std::optional< sal_Int32 > mo_nLabelAbsolutePosY
css::uno::Reference< css::beans::XPropertySet > m_xErrorYProperties
OUString msStyleNameOfParent
css::uno::Reference< css::beans::XPropertySet > m_xErrorXProperties
::std::vector< RegressionStyle > maRegressionStyleVector
css::uno::Any maRegressionCurvesDefault
::std::vector< DataRowPointStyle > maSeriesStyleVector
css::uno::Any maStackedBarsConnectedDefault
bool hasValue()
TEXT
@ SCH_XML_PART_ERROR_BARS
::std::multimap< tSchXMLIndexWithPart, css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tSchXMLLSequencesPerIndex
::std::pair< tSchXMLIndex, SchXMLLabeledSequencePart > tSchXMLIndexWithPart
TABLE
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:120
#define XMLOFF_WARN_UNKNOWN_ATTR(area, token, value)
Definition: xmlictxt.hxx:117
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:114
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:104
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:94
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_SVG_COMPAT