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