20#include <oox/token/namespaces.hxx>
21#include <oox/token/properties.hxx>
22#include <oox/token/tokens.hxx>
32#include <com/sun/star/awt/Gradient.hpp>
33#include <com/sun/star/chart/XChartDocument.hpp>
34#include <com/sun/star/chart/ChartLegendPosition.hpp>
35#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
36#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
37#include <com/sun/star/chart/XAxisZSupplier.hpp>
38#include <com/sun/star/chart/ChartDataRowSource.hpp>
39#include <com/sun/star/chart/X3DDisplay.hpp>
40#include <com/sun/star/chart/XStatisticDisplay.hpp>
41#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
42#include <com/sun/star/chart/ChartSymbolType.hpp>
43#include <com/sun/star/chart/ChartAxisMarks.hpp>
44#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
45#include <com/sun/star/chart/ChartAxisPosition.hpp>
46#include <com/sun/star/chart/ChartSolidType.hpp>
47#include <com/sun/star/chart/DataLabelPlacement.hpp>
48#include <com/sun/star/chart/ErrorBarStyle.hpp>
49#include <com/sun/star/chart/MissingValueTreatment.hpp>
50#include <com/sun/star/chart/XDiagramPositioning.hpp>
51#include <com/sun/star/chart/TimeIncrement.hpp>
52#include <com/sun/star/chart/TimeInterval.hpp>
53#include <com/sun/star/chart/TimeUnit.hpp>
55#include <com/sun/star/chart2/RelativePosition.hpp>
56#include <com/sun/star/chart2/RelativeSize.hpp>
57#include <com/sun/star/chart2/XChartDocument.hpp>
58#include <com/sun/star/chart2/XDiagram.hpp>
59#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
60#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
61#include <com/sun/star/chart2/XChartTypeContainer.hpp>
62#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
63#include <com/sun/star/chart2/DataPointLabel.hpp>
64#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
65#include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
66#include <com/sun/star/chart2/Symbol.hpp>
67#include <com/sun/star/chart2/data/XDataSource.hpp>
68#include <com/sun/star/chart2/data/XDataProvider.hpp>
69#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
70#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
71#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
72#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
73#include <com/sun/star/chart2/AxisType.hpp>
75#include <com/sun/star/beans/XPropertySet.hpp>
76#include <com/sun/star/container/XNameAccess.hpp>
77#include <com/sun/star/drawing/XShape.hpp>
78#include <com/sun/star/drawing/XShapes.hpp>
79#include <com/sun/star/drawing/FillStyle.hpp>
80#include <com/sun/star/drawing/LineStyle.hpp>
81#include <com/sun/star/awt/XBitmap.hpp>
82#include <com/sun/star/lang/XMultiServiceFactory.hpp>
83#include <com/sun/star/lang/XServiceName.hpp>
85#include <com/sun/star/table/CellAddress.hpp>
86#include <com/sun/star/sheet/XFormulaParser.hpp>
87#include <com/sun/star/sheet/FormulaToken.hpp>
88#include <com/sun/star/sheet/AddressConvention.hpp>
90#include <com/sun/star/container/XNamed.hpp>
91#include <com/sun/star/embed/XVisualObject.hpp>
92#include <com/sun/star/embed/Aspects.hpp>
106#include <unordered_set>
112using namespace css::uno;
113using namespace css::drawing;
115using css::beans::PropertyValue;
116using css::beans::XPropertySet;
117using css::container::XNamed;
118using css::table::CellAddress;
119using css::sheet::XFormulaParser;
120using ::oox::core::XmlFilterBase;
121using ::sax_fastparser::FSHelperPtr;
123namespace cssc = css::chart;
129bool isPrimaryAxes(sal_Int32 nIndex)
131 assert(nIndex == 0 || nIndex == 1);
138 explicit lcl_MatchesRole( OUString aRole ) :
142 bool operator () (
const Reference< chart2::data::XLabeledDataSequence > & xSeq )
const
146 Reference< beans::XPropertySet > xProp( xSeq->getValues(), uno::UNO_QUERY );
149 return ( xProp.is() &&
150 (xProp->getPropertyValue(
"Role" ) >>= aRole ) &&
162 bHasDateCategories =
false;
167 xDiagram, uno::UNO_QUERY_THROW );
169 xCooSysCnt->getCoordinateSystems());
170 for(
const auto& xCooSys : aCooSysSeq )
172 OSL_ASSERT( xCooSys.is());
173 for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
175 const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
176 for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
179 OSL_ASSERT( xAxis.is());
182 chart2::ScaleData aScaleData = xAxis->getScaleData();
183 if( aScaleData.Categories.is())
185 bHasDateCategories = aScaleData.AxisType == chart2::AxisType::DATE;
186 xResult.set( aScaleData.Categories );
194 catch(
const uno::Exception & )
202static Reference< chart2::data::XLabeledDataSequence >
205 const OUString & rRole )
212 ::std::find_if( pBegin, pEnd, lcl_MatchesRole( rRole ));
224 bool bDateCategories;
226 return xCategories.is();
231 bool bCategoryPositionShifted =
false;
235 xDiagram, uno::UNO_QUERY_THROW);
237 xCooSysCnt->getCoordinateSystems());
238 for (
const auto& xCooSys : aCooSysSeq)
240 OSL_ASSERT(xCooSys.is());
241 if( 0 < xCooSys->getDimension() && 0 <= xCooSys->getMaximumAxisIndexByDimension(0) )
244 OSL_ASSERT(xAxis.is());
247 chart2::ScaleData aScaleData = xAxis->getScaleData();
248 bCategoryPositionShifted = aScaleData.ShiftedCategoryPosition;
254 catch (
const uno::Exception&)
259 return bCategoryPositionShifted;
264 sal_Int32 nAxisType = -1;
268 xDiagram, uno::UNO_QUERY_THROW);
270 xCooSysCnt->getCoordinateSystems());
271 for(
const auto& xCooSys : aCooSysSeq )
273 OSL_ASSERT(xCooSys.is());
274 if( nDimensionIndex < xCooSys->getDimension() && nAxisIndex <= xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex) )
277 OSL_ASSERT(xAxis.is());
280 chart2::ScaleData aScaleData = xAxis->getScaleData();
281 nAxisType = aScaleData.AxisType;
287 catch (
const uno::Exception&)
299 case cssc::TimeUnit::DAY:
return "days";
300 case cssc::TimeUnit::MONTH:
return "months";
301 case cssc::TimeUnit::YEAR:
return "years";
302 default: OSL_ENSURE(
false,
"lclGetTimeUnitToken - unexpected time unit");
309 cssc::TimeIncrement aTimeIncrement;
313 xDiagram, uno::UNO_QUERY_THROW);
315 xCooSysCnt->getCoordinateSystems());
316 for(
const auto& xCooSys : aCooSysSeq )
318 OSL_ASSERT(xCooSys.is());
319 if( 0 < xCooSys->getDimension() && nAxisIndex <= xCooSys->getMaximumAxisIndexByDimension(0) )
322 OSL_ASSERT(xAxis.is());
325 chart2::ScaleData aScaleData = xAxis->getScaleData();
326 aTimeIncrement = aScaleData.TimeIncrement;
332 catch (
const uno::Exception&)
337 return aTimeIncrement;
347 sal_Int32 nAxisIndex = 0;
349 xProp->getPropertyValue(
"AttachedAxisIndex") >>= nAxisIndex;
350 bResult = (0==nAxisIndex);
352 catch(
const uno::Exception & )
362 OUStringBuffer aResult;
363 bool bPrecedeWithSpace =
false;
364 for(
const auto& rString : rSequence )
366 if( !rString.isEmpty())
368 if( bPrecedeWithSpace )
369 aResult.append(
' ' );
370 aResult.append( rString );
371 bPrecedeWithSpace =
true;
374 return aResult.makeStringAndClear();
381 uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xLabelSeq, uno::UNO_QUERY );
382 if( xTextualDataSequence.is())
384 aLabels = xTextualDataSequence->getTextualData();
386 else if( xLabelSeq.is())
389 aLabels.realloc( aAnies.getLength());
390 auto pLabels = aLabels.getArray();
391 for( sal_Int32
i=0;
i<aAnies.getLength(); ++
i )
400 ::std::vector< OUString > & rOutCategories )
402 OSL_ASSERT( xCategories.is());
403 if( !xCategories.is())
406 if( xTextualDataSequence.is())
408 rOutCategories.clear();
410 rOutCategories.insert( rOutCategories.end(), aTextData.begin(), aTextData.end() );
415 rOutCategories.resize( aAnies.getLength());
416 for( sal_Int32
i=0;
i<aAnies.getLength(); ++
i )
417 aAnies[
i] >>= rOutCategories[
i];
423 ::std::vector< double > aResult;
429 aResult.insert( aResult.end(), aValues.begin(), aValues.end() );
434 aResult.resize( aAnies.getLength(), std::numeric_limits<double>::quiet_NaN() );
435 for( sal_Int32
i=0;
i<aAnies.getLength(); ++
i )
436 aAnies[
i] >>= aResult[
i];
444 if( sChartType ==
u"com.sun.star.chart.BarDiagram"
445 || sChartType ==
u"com.sun.star.chart2.ColumnChartType" )
447 else if( sChartType ==
u"com.sun.star.chart.AreaDiagram"
448 || sChartType ==
u"com.sun.star.chart2.AreaChartType" )
450 else if( sChartType ==
u"com.sun.star.chart.LineDiagram"
451 || sChartType ==
u"com.sun.star.chart2.LineChartType" )
453 else if( sChartType ==
u"com.sun.star.chart.PieDiagram"
454 || sChartType ==
u"com.sun.star.chart2.PieChartType" )
456 else if( sChartType ==
u"com.sun.star.chart.DonutDiagram"
457 || sChartType ==
u"com.sun.star.chart2.DonutChartType" )
459 else if( sChartType ==
u"com.sun.star.chart.XYDiagram"
460 || sChartType ==
u"com.sun.star.chart2.ScatterChartType" )
462 else if( sChartType ==
u"com.sun.star.chart.NetDiagram"
463 || sChartType ==
u"com.sun.star.chart2.NetChartType" )
465 else if( sChartType ==
u"com.sun.star.chart.FilledNetDiagram"
466 || sChartType ==
u"com.sun.star.chart2.FilledNetChartType" )
468 else if( sChartType ==
u"com.sun.star.chart.StockDiagram"
469 || sChartType ==
u"com.sun.star.chart2.CandleStickChartType" )
471 else if( sChartType ==
u"com.sun.star.chart.BubbleDiagram"
472 || sChartType ==
u"com.sun.star.chart2.BubbleChartType" )
533 , mnXmlNamespace( nXmlNamespace )
537 , mbHasCategoryLabels( false )
538 , mbHasZAxis( false )
539 , mbIs3DChart( false )
542 , mbHasDateCategories(false)
553 OUString sChartType =
mxDiagram->getDiagramType();
559uno::Sequence< beans::PropertyValue > createArguments(
560 const OUString & rRangeRepresentation,
bool bUseColumns)
562 css::chart::ChartDataRowSource eRowSource = css::chart::ChartDataRowSource_ROWS;
564 eRowSource = css::chart::ChartDataRowSource_COLUMNS;
566 uno::Sequence<beans::PropertyValue>
aArguments{
567 {
"DataRowSource", -1,
uno::Any(eRowSource), beans::PropertyState_DIRECT_VALUE },
568 {
"FirstCellAsLabel", -1,
uno::Any(
false), beans::PropertyState_DIRECT_VALUE },
569 {
"HasCategories", -1,
uno::Any(
false), beans::PropertyState_DIRECT_VALUE },
570 {
"CellRangeRepresentation", -1,
uno::Any(rRangeRepresentation),
571 beans::PropertyState_DIRECT_VALUE }
577Reference<chart2::XDataSeries> getPrimaryDataSeries(
const Reference<chart2::XChartType>& xChartType)
579 Reference< chart2::XDataSeriesContainer > xDSCnt(xChartType, uno::UNO_QUERY_THROW);
582 const Sequence< Reference< chart2::XDataSeries > > aSeriesSeq(xDSCnt->getDataSeries());
583 for (
const auto& rSeries : aSeriesSeq)
585 Reference<chart2::XDataSeries> xSource(rSeries, uno::UNO_QUERY);
590 return Reference<chart2::XDataSeries>();
598 OSL_ASSERT(xChartDoc.is());
602 OSL_ENSURE(xDataProvider.is(),
"No DataProvider");
603 if (xDataProvider.is())
606 bool bSeriesUsesColumns =
true;
612 for (
const auto& rCooSys : aCooSysSeq)
616 for (
const auto& rChartType : aChartTypeSeq)
619 if (xDataSeries.is())
621 uno::Reference< chart2::data::XDataSource > xSeriesSource(xDataSeries, uno::UNO_QUERY);
622 const uno::Sequence< beans::PropertyValue > rArguments = xDataProvider->detectArguments(xSeriesSource);
623 for (
const beans::PropertyValue& rProperty : rArguments)
625 if (rProperty.Name ==
"DataRowSource")
627 css::chart::ChartDataRowSource eRowSource;
628 if (rProperty.Value >>= eRowSource)
630 bSeriesUsesColumns = (eRowSource == css::chart::ChartDataRowSource_COLUMNS);
639 catch (
const uno::Exception &)
644 if (xChartDoc->hasInternalDataProvider() && rRange ==
"categories")
648 css::uno::Reference< css::chart2::XAnyDescriptionAccess > xDataAccess(xChartDoc->getDataProvider(), uno::UNO_QUERY);
649 const Sequence< Sequence< uno::Any > >aAnyCategories(bSeriesUsesColumns ? xDataAccess->getAnyRowDescriptions() : xDataAccess->getAnyColumnDescriptions());
650 auto pMax = std::max_element(aAnyCategories.begin(), aAnyCategories.end(),
652 return a.getLength() < b.getLength(); });
655 if (pMax != aAnyCategories.end() && pMax->getLength() > 1)
657 sal_Int32 nLevelCount = pMax->getLength();
661 auto pFinalSplitSource = aFinalSplitSource.getArray();
662 for (sal_Int32
i = 0;
i < nLevelCount;
i++)
664 sal_Int32 nElemLabel = 0;
665 pFinalSplitSource[nLevelCount -
i - 1].realloc(aAnyCategories.getLength());
666 auto pSeq = pFinalSplitSource[nLevelCount -
i - 1].getArray();
667 for (
auto const& elemLabel : aAnyCategories)
670 if (elemLabel.getLength() >
i)
672 pSeq[nElemLabel] = elemLabel[
i].get<OUString>();
677 return aFinalSplitSource;
680 catch (
const uno::Exception &)
689 uno::Reference< chart2::data::XDataSource > xCategoriesSource(xDataProvider->createDataSource(
690 createArguments(rRange, bSeriesUsesColumns)));
692 if (xCategoriesSource.is())
695 if (aCategories.getLength() > 1)
700 std::transform(aCategories.begin(), aCategories.end(),
701 std::reverse_iterator(asNonConstRange(aFinalSplitSource).
end()),
704 return aFinalSplitSource;
708 catch (
const uno::Exception &)
728 xParser.set( xSF->createInstance(
"com.sun.star.sheet.FormulaParser"), UNO_QUERY );
735 SAL_WARN_IF(!xParser.is(),
"oox",
"creating formula parser failed");
750 uno::Sequence<sheet::FormulaToken> aTokens = xParser->parseFormula( rRange, CellAddress( 0, 0, 0 ) );
751 if( xParserProps.is() )
753 xParserProps->setPropertyValue(
"FormulaConvention",
uno::Any(css::sheet::AddressConvention::XL_OOX) );
755 xParserProps->setPropertyValue(
"RefConventionChartOOXML",
uno::Any(
true) );
757 aResult = xParser->printFormula( aTokens, CellAddress( 0, 0, 0 ) );
762 OUString aRange( rRange );
763 if( aRange.startsWith(
"$") )
764 aRange = aRange.copy(1);
765 aRange = aRange.replaceAll(
".$",
"!$" );
783 OUString
sName =
"Object 1";
786 sName = xNamed->getName();
789 XML_id, OString::number(nID),
795 if( !sURL.isEmpty() )
802 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
816 pFS->startElement(
FSNS(XML_a, XML_graphic));
817 pFS->startElement(
FSNS( XML_a, XML_graphicData ),
818 XML_uri,
"http://schemas.openxmlformats.org/drawingml/2006/chart" );
820 const char* sFullPath =
nullptr;
821 const char* sRelativePath =
nullptr;
826 sFullPath =
"word/charts/chart";
827 sRelativePath =
"charts/chart";
832 sFullPath =
"ppt/charts/chart";
833 sRelativePath =
"../charts/chart";
838 sFullPath =
"xl/charts/chart";
839 sRelativePath =
"../charts/chart";
844 sFullPath =
"charts/chart";
845 sRelativePath =
"charts/chart";
849 OUString sFullStream = OUStringBuffer()
850 .appendAscii(sFullPath)
851 .append(OUString::number(nChartCount) +
".xml")
852 .makeStringAndClear();
853 OUString sRelativeStream = OUStringBuffer()
854 .appendAscii(sRelativePath)
855 .append(OUString::number(nChartCount) +
".xml" )
856 .makeStringAndClear();
860 pFS->getOutputStream(),
861 "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
866 pFS->singleElement(
FSNS( XML_c, XML_chart ),
871 pFS->endElement(
FSNS( XML_a, XML_graphicData ) );
872 pFS->endElement(
FSNS( XML_a, XML_graphic ) );
878 pChart->endDocument();
889 OSL_ENSURE( xDataProvider.is(),
"No DataProvider" );
890 if( xDataProvider.is())
895 catch(
const uno::Exception & )
904 OSL_ASSERT( xChartDoc.is() );
905 if( !xChartDoc.is() )
918 bool bIncludeTable =
true;
927 if( ! (xDPServiceInfo.is() && xDPServiceInfo->getImplementationName() ==
"com.sun.star.comp.chart.InternalDataProvider" ))
929 bIncludeTable =
false;
936 OSL_FAIL(
"Couldn't export chart due to wrong XModel" );
945 pFS->startElement(
FSNS( XML_c, XML_chartSpace ),
950 pFS->singleElement(
FSNS(XML_c, XML_lang), XML_val,
"en-US");
952 pFS->singleElement(
FSNS(XML_c, XML_roundedCorners), XML_val,
"0");
975 pFS->endElement(
FSNS( XML_c, XML_chartSpace ) );
985 OUString externalDataPath;
987 if( xDocPropSet.is())
991 Any aAny( xDocPropSet->getPropertyValue(
"ExternalData" ));
992 aAny >>= externalDataPath;
994 catch( beans::UnknownPropertyException & )
996 SAL_WARN(
"oox",
"Required property not found in ChartDocument");
999 if(externalDataPath.isEmpty())
1003 OUString relationPath = externalDataPath;
1005 if( externalDataPath[ 0 ] !=
'.' && externalDataPath[ 1 ] !=
'.')
1007 sal_Int32 nSepPos = externalDataPath.indexOf(
'/', 0 );
1010 relationPath = relationPath.copy( nSepPos, ::std::max< sal_Int32 >( externalDataPath.getLength(), 0 ) - nSepPos );
1011 relationPath =
".." + relationPath;
1016 if (relationPath.endsWith(
".bin"))
1022 pFS->singleElementNS(XML_c, XML_externalData,
FSNS(XML_r, XML_id), sRelId);
1028 if (!xDocPropSet.is())
1031 css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
1035 Any aShapesAny = xDocPropSet->getPropertyValue(
"AdditionalShapes");
1036 if( (aShapesAny >>= mxAdditionalShapes) && mxAdditionalShapes.is() )
1039 const char* sFullPath =
nullptr;
1040 const char* sRelativePath =
nullptr;
1047 sFullPath =
"word/drawings/drawing";
1048 sRelativePath =
"../drawings/drawing";
1053 sFullPath =
"ppt/drawings/drawing";
1054 sRelativePath =
"../drawings/drawing";
1059 sFullPath =
"xl/drawings/drawing";
1060 sRelativePath =
"../drawings/drawing";
1065 sFullPath =
"drawings/drawing";
1066 sRelativePath =
"drawings/drawing";
1070 OUString sFullStream = OUStringBuffer()
1071 .appendAscii(sFullPath)
1072 .append(OUString::number(nDrawing) +
".xml")
1073 .makeStringAndClear();
1074 OUString sRelativeStream = OUStringBuffer()
1075 .appendAscii(sRelativePath)
1076 .append(OUString::number(nDrawing) +
".xml")
1077 .makeStringAndClear();
1083 "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml",
1087 GetFS()->singleElementNS(XML_c, XML_userShapes,
FSNS(XML_r, XML_id),
sId);
1090 pDrawing->startElement(
FSNS(XML_c, XML_userShapes),
1096 const sal_Int32 nShapeCount(mxAdditionalShapes->getCount());
1097 for (sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
1100 mxAdditionalShapes->getByIndex(nShapeId) >>= xShape;
1101 SAL_WARN_IF(!xShape.is(),
"xmloff.chart",
"Shape without an XShape?");
1106 pDrawing->startElement(
FSNS(XML_cdr, XML_relSizeAnchor));
1107 uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY);
1108 if( xShapeProperties.is() )
1111 awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT);
1117 pDrawing->endElement(
FSNS(XML_cdr, XML_relSizeAnchor));
1119 pDrawing->endElement(
FSNS(XML_c, XML_userShapes));
1120 pDrawing->endDocument();
1123 catch (
const uno::Exception&)
1132 mxDiagram.set( xChartDoc->getDiagram() );
1137 bool bHasMainTitle =
false;
1139 bool bHasLegend =
false;
1141 if( xDocPropSet.is())
1145 Any aAny( xDocPropSet->getPropertyValue(
"HasMainTitle"));
1146 aAny >>= bHasMainTitle;
1147 aAny = xDocPropSet->getPropertyValue(
"HasLegend");
1148 aAny >>= bHasLegend;
1150 catch( beans::UnknownPropertyException & )
1152 SAL_WARN(
"oox",
"Required property not found in ChartDocument");
1157 if( xPropSubTitle.is())
1161 xPropSubTitle->getPropertyValue(
"String") >>= aSubTitle;
1163 catch( beans::UnknownPropertyException & )
1170 pFS->startElement(
FSNS(XML_c, XML_chart));
1175 exportTitle( xChartDoc->getTitle(), !aSubTitle.isEmpty() ? &aSubTitle :
nullptr );
1176 pFS->singleElement(
FSNS(XML_c, XML_autoTitleDeleted), XML_val,
"0");
1178 else if( !aSubTitle.isEmpty() )
1181 pFS->singleElement(
FSNS(XML_c, XML_autoTitleDeleted), XML_val,
"0");
1185 pFS->singleElement(
FSNS(XML_c, XML_autoTitleDeleted), XML_val,
"1");
1197 pFS->startElement(
FSNS(XML_c, XML_floor));
1199 pFS->endElement(
FSNS( XML_c, XML_floor ) );
1208 pFS->startElement(
FSNS(XML_c, XML_sideWall));
1210 pFS->endElement(
FSNS( XML_c, XML_sideWall ) );
1213 pFS->startElement(
FSNS(XML_c, XML_backWall));
1215 pFS->endElement(
FSNS( XML_c, XML_backWall ) );
1225 uno::Reference<beans::XPropertySet> xDiagramPropSet(xChartDoc->getDiagram(), uno::UNO_QUERY);
1226 uno::Any aPlotVisOnly = xDiagramPropSet->getPropertyValue(
"IncludeHiddenCells");
1227 bool bIncludeHiddenCells =
false;
1228 aPlotVisOnly >>= bIncludeHiddenCells;
1229 pFS->singleElement(
FSNS(XML_c, XML_plotVisOnly), XML_val,
ToPsz10(!bIncludeHiddenCells));
1233 pFS->endElement(
FSNS( XML_c, XML_chart ) );
1242 uno::Any aAny = xPropSet->getPropertyValue(
"MissingValueTreatment");
1243 if (!(aAny >>= nVal))
1246 const char* pVal =
nullptr;
1249 case cssc::MissingValueTreatment::LEAVE_GAP:
1252 case cssc::MissingValueTreatment::USE_ZERO:
1255 case cssc::MissingValueTreatment::CONTINUE:
1259 SAL_WARN(
"oox",
"unknown MissingValueTreatment value");
1264 pFS->singleElement(
FSNS(XML_c, XML_dispBlanksAs), XML_val, pVal);
1270 pFS->startElement(
FSNS(XML_c, XML_legend));
1276 css::chart::ChartLegendPosition aLegendPos = css::chart::ChartLegendPosition_NONE;
1279 Any aAny( xProp->getPropertyValue(
"Alignment" ));
1280 aAny >>= aLegendPos;
1282 catch( beans::UnknownPropertyException & )
1284 SAL_WARN(
"oox",
"Property Align not found in ChartLegend");
1287 const char* strPos =
nullptr;
1288 switch( aLegendPos )
1290 case css::chart::ChartLegendPosition_LEFT:
1293 case css::chart::ChartLegendPosition_RIGHT:
1296 case css::chart::ChartLegendPosition_TOP:
1299 case css::chart::ChartLegendPosition_BOTTOM:
1302 case css::chart::ChartLegendPosition_NONE:
1303 case css::chart::ChartLegendPosition::ChartLegendPosition_MAKE_FIXED_SIZE:
1308 if( strPos !=
nullptr )
1310 pFS->singleElement(
FSNS(XML_c, XML_legendPos), XML_val, strPos);
1318 bool bShowLegendEntry;
1319 for (
const auto& rCooSys : xCooSysSequence)
1326 if (!xChartTypeSequence.hasElements())
1329 for (
const auto& rCT : xChartTypeSequence)
1335 OUString aChartType(rCT->getChartType());
1344 nIndex += aDataSeriesSeq.getLength() - 1;
1345 for (
const auto& rDataSeries : aDataSeriesSeq)
1348 bool bVaryColorsByPoint = aSeriesProp.
getBoolProperty(PROP_VaryColorsByPoint);
1349 if (bVaryColorsByPoint || bIsPie)
1352 aSeriesProp.
getProperty(deletedLegendEntriesSeq, PROP_DeletedLegendEntries);
1353 for (
const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
1355 pFS->startElement(
FSNS(XML_c, XML_legendEntry));
1356 pFS->singleElement(
FSNS(XML_c, XML_idx), XML_val,
1357 OString::number(
nIndex + deletedLegendEntry));
1358 pFS->singleElement(
FSNS(XML_c, XML_delete), XML_val,
"1");
1359 pFS->endElement(
FSNS(XML_c, XML_legendEntry));
1366 for (
const auto& rDataSeq : aDataSeqs)
1372 sal_Int32 nDataSeqSize = xValues->getData().getLength();
1379 if (!bShowLegendEntry)
1381 pFS->startElement(
FSNS(XML_c, XML_legendEntry));
1382 pFS->singleElement(
FSNS(XML_c, XML_idx), XML_val,
1383 OString::number(
nIndex));
1384 pFS->singleElement(
FSNS(XML_c, XML_delete), XML_val,
"1");
1385 pFS->endElement(
FSNS(XML_c, XML_legendEntry));
1391 nIndex += aDataSeriesSeq.getLength() + 1;
1395 uno::Any aRelativePos = xProp->getPropertyValue(
"RelativePosition");
1398 pFS->startElement(
FSNS(XML_c, XML_layout));
1399 pFS->startElement(
FSNS(XML_c, XML_manualLayout));
1401 pFS->singleElement(
FSNS(XML_c, XML_xMode), XML_val,
"edge");
1402 pFS->singleElement(
FSNS(XML_c, XML_yMode), XML_val,
"edge");
1403 chart2::RelativePosition aPos = aRelativePos.get<chart2::RelativePosition>();
1405 const double x = aPos.Primary;
1406 const double y = aPos.Secondary;
1408 pFS->singleElement(
FSNS(XML_c, XML_x), XML_val, OString::number(
x));
1409 pFS->singleElement(
FSNS(XML_c, XML_y), XML_val, OString::number(
y));
1411 uno::Any aRelativeSize = xProp->getPropertyValue(
"RelativeSize");
1414 chart2::RelativeSize aSize = aRelativeSize.get<chart2::RelativeSize>();
1416 const double w = aSize.Primary;
1417 const double h = aSize.Secondary;
1419 pFS->singleElement(
FSNS(XML_c, XML_w), XML_val, OString::number(
w));
1421 pFS->singleElement(
FSNS(XML_c, XML_h), XML_val, OString::number(
h));
1424 SAL_WARN_IF(aPos.Anchor != css::drawing::Alignment_TOP_LEFT,
"oox",
"unsupported anchor position");
1426 pFS->endElement(
FSNS(XML_c, XML_manualLayout));
1427 pFS->endElement(
FSNS(XML_c, XML_layout));
1430 if (strPos !=
nullptr)
1432 uno::Any aOverlay = xProp->getPropertyValue(
"Overlay");
1433 if(aOverlay.get<
bool>())
1434 pFS->singleElement(
FSNS(XML_c, XML_overlay), XML_val,
"1");
1436 pFS->singleElement(
FSNS(XML_c, XML_overlay), XML_val,
"0");
1446 pFS->endElement(
FSNS( XML_c, XML_legend ) );
1455 xPropSet->getPropertyValue(
"String") >>= sText;
1460 sText = sText.isEmpty() ? *pSubText : sText +
"\n" + *pSubText;
1462 if( sText.isEmpty() )
1466 pFS->startElement(
FSNS(XML_c, XML_title));
1468 pFS->startElement(
FSNS(XML_c, XML_tx));
1469 pFS->startElement(
FSNS(XML_c, XML_rich));
1472 const char* sWritingMode =
nullptr;
1473 bool bVertical =
false;
1474 xPropSet->getPropertyValue(
"StackedText") >>= bVertical;
1476 sWritingMode =
"wordArtVert";
1478 sal_Int32 nRotation = 0;
1479 xPropSet->getPropertyValue(
"TextRotation") >>= nRotation;
1481 pFS->singleElement(
FSNS( XML_a, XML_bodyPr ),
1482 XML_vert, sWritingMode,
1485 pFS->singleElement(
FSNS(XML_a, XML_lstStyle));
1487 pFS->startElement(
FSNS(XML_a, XML_p));
1489 pFS->startElement(
FSNS(XML_a, XML_pPr));
1491 bool bDummy =
false;
1495 pFS->endElement(
FSNS( XML_a, XML_pPr ) );
1497 pFS->startElement(
FSNS(XML_a, XML_r));
1500 pFS->startElement(
FSNS(XML_a, XML_t));
1501 pFS->writeEscaped( sText );
1502 pFS->endElement(
FSNS( XML_a, XML_t ) );
1503 pFS->endElement(
FSNS( XML_a, XML_r ) );
1505 pFS->endElement(
FSNS( XML_a, XML_p ) );
1507 pFS->endElement(
FSNS( XML_c, XML_rich ) );
1508 pFS->endElement(
FSNS( XML_c, XML_tx ) );
1510 uno::Any aManualLayout = xPropSet->getPropertyValue(
"RelativePosition");
1513 pFS->startElement(
FSNS(XML_c, XML_layout));
1514 pFS->startElement(
FSNS(XML_c, XML_manualLayout));
1515 pFS->singleElement(
FSNS(XML_c, XML_xMode), XML_val,
"edge");
1516 pFS->singleElement(
FSNS(XML_c, XML_yMode), XML_val,
"edge");
1519 awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT);
1521 awt::Size aSize = xShape->getSize();
1522 awt::Point aPos2 = xShape->getPosition();
1524 double fSin = fabs(sin(basegfx::deg2rad<100>(nRotation)));
1526 if( nRotation*0.01 > 180.0 )
1527 aPos2.X -=
static_cast<sal_Int32
>(fSin * aSize.Height + 0.5);
1529 else if( nRotation*0.01 > 0.0 )
1530 aPos2.Y -=
static_cast<sal_Int32
>(fSin * aSize.Width + 0.5);
1532 double x =
static_cast<double>(aPos2.X) /
static_cast<double>(aPageSize.Width);
1533 double y =
static_cast<double>(aPos2.Y) /
static_cast<double>(aPageSize.Height);
1538 pFS->singleElement(
FSNS(XML_c, XML_x), XML_val, OString::number(
x));
1539 pFS->singleElement(
FSNS(XML_c, XML_y), XML_val, OString::number(
y));
1544 pFS->endElement(
FSNS(XML_c, XML_manualLayout));
1545 pFS->endElement(
FSNS(XML_c, XML_layout));
1548 pFS->singleElement(
FSNS(XML_c, XML_overlay), XML_val,
"0");
1556 pFS->endElement(
FSNS( XML_c, XML_title ) );
1563 std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitSeries;
1564 std::map<sal_Int32, size_t> aMapAxisToIndex;
1569 sal_Int32 nAxisIndexOfFirstSeries = -1;
1571 for (
const uno::Reference<chart2::XDataSeries>& xSeries : aSeriesSeq)
1577 sal_Int32 nAxisIndex = -1;
1578 uno::Any aAny = xPropSet->getPropertyValue(
"AttachedAxisIndex");
1579 aAny >>= nAxisIndex;
1580 size_t nVectorPos = 0;
1581 if (nAxisIndexOfFirstSeries == -1)
1583 nAxisIndexOfFirstSeries = nAxisIndex;
1586 auto it = aMapAxisToIndex.find(nAxisIndex);
1587 if (it == aMapAxisToIndex.end())
1589 aSplitSeries.emplace_back();
1590 nVectorPos = aSplitSeries.size() - 1;
1591 aMapAxisToIndex.insert(std::pair<sal_Int32, size_t>(nAxisIndex, nVectorPos));
1595 nVectorPos = it->second;
1598 uno::Sequence<Reference<chart2::XDataSeries> >& rAxisSeriesSeq = aSplitSeries[nVectorPos];
1599 sal_Int32
nLength = rAxisSeriesSeq.getLength();
1600 rAxisSeriesSeq.realloc(nLength + 1);
1601 rAxisSeriesSeq.getArray()[
nLength] = xSeries;
1605 if (aSplitSeries.size() > 1 && nAxisIndexOfFirstSeries == 1)
1607 std::swap(aSplitSeries[0], aSplitSeries[1]);
1611 return aSplitSeries;
1619 if( ! xBCooSysCnt.is())
1625 pFS->startElement(
FSNS(XML_c, XML_plotArea));
1630 uno::Any aAny = xWall->getPropertyValue(
"RelativePosition");
1633 chart2::RelativePosition aPos = aAny.get<chart2::RelativePosition>();
1634 aAny = xWall->getPropertyValue(
"RelativeSize");
1635 chart2::RelativeSize aSize = aAny.get<chart2::RelativeSize>();
1636 uno::Reference< css::chart::XDiagramPositioning > xDiagramPositioning( xChartDoc->getDiagram(), uno::UNO_QUERY );
1637 exportManualLayout(aPos, aSize, xDiagramPositioning->isExcludingDiagramPositioning() );
1643 aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
1646 if (!aCooSysSeq.hasElements())
1648 pFS->startElement(
FSNS(XML_c, XML_barChart));
1649 pFS->singleElement(
FSNS(XML_c, XML_barDir), XML_val,
"col");
1650 pFS->singleElement(
FSNS(XML_c, XML_grouping), XML_val,
"clustered");
1651 pFS->singleElement(
FSNS(XML_c, XML_varyColors), XML_val,
"0");
1653 pFS->endElement(
FSNS(XML_c, XML_barChart));
1656 for(
const auto& rCS : aCooSysSeq )
1663 for(
const auto& rCT : aCTSeq )
1669 if( ! xChartType.is())
1672 OUString aChartType( xChartType->getChartType());
1674 switch( eChartType )
1729 SAL_WARN(
"oox",
"ChartExport::exportPlotArea -- not support chart type");
1755 if( xWallPropSet.is() )
1757 uno::Any aAny = xWallPropSet->getPropertyValue(
"LineStyle");
1763 if ( noSupportWallProp && (aAny != drawing::LineStyle_NONE) )
1765 xWallPropSet->setPropertyValue(
"LineStyle",
uno::Any(drawing::LineStyle_NONE) );
1771 pFS->endElement(
FSNS( XML_c, XML_plotArea ) );
1776 const css::chart2::RelativeSize& rSize,
1777 const bool bIsExcludingDiagramPositioning)
1780 pFS->startElement(
FSNS(XML_c, XML_layout));
1781 pFS->startElement(
FSNS(XML_c, XML_manualLayout));
1784 if ( bIsExcludingDiagramPositioning )
1786 pFS->singleElement(
FSNS(XML_c, XML_layoutTarget), XML_val,
"inner");
1788 pFS->singleElement(
FSNS(XML_c, XML_xMode), XML_val,
"edge");
1789 pFS->singleElement(
FSNS(XML_c, XML_yMode), XML_val,
"edge");
1791 double x = rPos.Primary;
1792 double y = rPos.Secondary;
1793 const double w = rSize.Primary;
1794 const double h = rSize.Secondary;
1795 switch (rPos.Anchor)
1797 case drawing::Alignment_LEFT:
1800 case drawing::Alignment_TOP_LEFT:
1802 case drawing::Alignment_BOTTOM_LEFT:
1805 case drawing::Alignment_TOP:
1808 case drawing::Alignment_CENTER:
1812 case drawing::Alignment_BOTTOM:
1816 case drawing::Alignment_TOP_RIGHT:
1819 case drawing::Alignment_BOTTOM_RIGHT:
1823 case drawing::Alignment_RIGHT:
1828 SAL_WARN(
"oox",
"unhandled alignment case for manual layout export " <<
static_cast<sal_uInt16
>(rPos.Anchor));
1831 pFS->singleElement(
FSNS(XML_c, XML_x), XML_val, OString::number(
x));
1833 pFS->singleElement(
FSNS(XML_c, XML_y), XML_val, OString::number(
y));
1835 pFS->singleElement(
FSNS(XML_c, XML_w), XML_val, OString::number(
w));
1837 pFS->singleElement(
FSNS(XML_c, XML_h), XML_val, OString::number(
h));
1839 pFS->endElement(
FSNS(XML_c, XML_manualLayout));
1840 pFS->endElement(
FSNS(XML_c, XML_layout));
1849 mAny >>= aFillStyle;
1852 if (aFillStyle == FillStyle_SOLID &&
GetProperty( xPropSet,
"FillTransparence" ))
1857 aFillStyle = FillStyle_NONE;
1859 OUString sFillTransparenceGradientName;
1860 if (aFillStyle == FillStyle_SOLID
1861 &&
GetProperty(xPropSet,
"FillTransparenceGradientName") && (
mAny >>= sFillTransparenceGradientName)
1862 && !sFillTransparenceGradientName.isEmpty())
1864 awt::Gradient aTransparenceGradient;
1865 uno::Reference< lang::XMultiServiceFactory > xFact(
getModel(), uno::UNO_QUERY );
1866 uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance(
"com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
1867 uno::Any rTransparenceValue = xTransparenceGradient->getByName(sFillTransparenceGradientName);
1868 rTransparenceValue >>= aTransparenceGradient;
1869 if (aTransparenceGradient.StartColor == 0xffffff && aTransparenceGradient.EndColor == 0xffffff)
1870 aFillStyle = FillStyle_NONE;
1872 switch( aFillStyle )
1874 case FillStyle_SOLID:
1877 case FillStyle_GRADIENT :
1880 case FillStyle_BITMAP :
1883 case FillStyle_HATCH:
1886 case FillStyle_NONE:
1887 mpFS->singleElementNS(XML_a, XML_noFill);
1901 sal_uInt32 nFillColor =
mAny.get<sal_uInt32>();
1906 sal_Int32 nTransparency = 0;
1907 mAny >>= nTransparency;
1913 awt::Gradient aTransparenceGradient;
1914 bool bNeedGradientFill(
false);
1915 OUString sFillTransparenceGradientName;
1916 if (
GetProperty(xPropSet,
"FillTransparenceGradientName")
1917 && (
mAny >>= sFillTransparenceGradientName)
1918 && !sFillTransparenceGradientName.isEmpty())
1920 uno::Reference< lang::XMultiServiceFactory > xFact(
getModel(), uno::UNO_QUERY );
1921 uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance(
"com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
1922 uno::Any rTransparenceValue = xTransparenceGradient->getByName(sFillTransparenceGradientName);
1923 rTransparenceValue >>= aTransparenceGradient;
1924 if (aTransparenceGradient.StartColor != aTransparenceGradient.EndColor)
1925 bNeedGradientFill =
true;
1926 else if (aTransparenceGradient.StartColor != 0)
1930 if (bNeedGradientFill)
1932 awt::Gradient aPseudoColorGradient;
1933 aPseudoColorGradient.XOffset = aTransparenceGradient.XOffset;
1934 aPseudoColorGradient.YOffset = aTransparenceGradient.YOffset;
1935 aPseudoColorGradient.StartIntensity = 100;
1936 aPseudoColorGradient.EndIntensity = 100;
1937 aPseudoColorGradient.Angle = aTransparenceGradient.Angle;
1938 aPseudoColorGradient.Border = aTransparenceGradient.Border;
1939 aPseudoColorGradient.Style = aTransparenceGradient.Style;
1940 aPseudoColorGradient.StartColor = nFillColor;
1941 aPseudoColorGradient.EndColor = nFillColor;
1942 aPseudoColorGradient.StepCount = aTransparenceGradient.StepCount;
1943 mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape,
"0");
1945 mpFS->endElementNS(XML_a, XML_gradFill);
1958 OUString aHatchName;
1959 mAny >>= aHatchName;
1960 uno::Reference< lang::XMultiServiceFactory > xFact(
getModel(), uno::UNO_QUERY );
1961 uno::Reference< container::XNameAccess > xHatchTable( xFact->createInstance(
"com.sun.star.drawing.HatchTable"), uno::UNO_QUERY );
1962 uno::Any rValue = xHatchTable->getByName(aHatchName);
1963 css::drawing::Hatch aHatch;
1972 if( !xPropSet.is() )
1975 OUString sFillBitmapName;
1976 xPropSet->getPropertyValue(
"FillBitmapName") >>= sFillBitmapName;
1978 uno::Reference< lang::XMultiServiceFactory > xFact(
getModel(), uno::UNO_QUERY );
1981 uno::Reference< container::XNameAccess > xBitmapTable( xFact->createInstance(
"com.sun.star.drawing.BitmapTable"), uno::UNO_QUERY );
1982 uno::Any rValue = xBitmapTable->getByName( sFillBitmapName );
1983 if (rValue.has<uno::Reference<awt::XBitmap>>())
1985 uno::Reference<awt::XBitmap> xBitmap = rValue.get<uno::Reference<awt::XBitmap>>();
1986 uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
1993 catch (
const uno::Exception &)
2001 if( !xPropSet.is() )
2004 OUString sFillGradientName;
2005 xPropSet->getPropertyValue(
"FillGradientName") >>= sFillGradientName;
2007 uno::Reference< lang::XMultiServiceFactory > xFact(
getModel(), uno::UNO_QUERY );
2010 uno::Reference< container::XNameAccess > xGradient( xFact->createInstance(
"com.sun.star.drawing.GradientTable"), uno::UNO_QUERY );
2011 uno::Any rGradientValue = xGradient->getByName( sFillGradientName );
2012 awt::Gradient aGradient;
2013 if( rGradientValue >>= aGradient )
2015 awt::Gradient aTransparenceGradient;
2016 mpFS->startElementNS(XML_a, XML_gradFill);
2017 OUString sFillTransparenceGradientName;
2018 if( (xPropSet->getPropertyValue(
"FillTransparenceGradientName") >>= sFillTransparenceGradientName) && !sFillTransparenceGradientName.isEmpty())
2020 uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance(
"com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
2021 uno::Any rTransparenceValue = xTransparenceGradient->getByName(sFillTransparenceGradientName);
2022 rTransparenceValue >>= aTransparenceGradient;
2029 mpFS->endElementNS(XML_a, XML_gradFill);
2032 catch (
const uno::Exception &)
2041 if (!xDataTable.is())
2045 uno::Reference<beans::XPropertySet> aPropSet(xDataTable, uno::UNO_QUERY);
2047 bool bShowVBorder =
false;
2048 bool bShowHBorder =
false;
2049 bool bShowOutline =
false;
2050 bool bShowKeys =
false;
2053 mAny >>= bShowHBorder;
2055 mAny >>= bShowVBorder;
2057 mAny >>= bShowOutline;
2061 pFS->startElement(
FSNS(XML_c, XML_dTable));
2064 pFS->singleElement(
FSNS(XML_c, XML_showHorzBorder), XML_val,
"1" );
2066 pFS->singleElement(
FSNS(XML_c, XML_showVertBorder), XML_val,
"1");
2068 pFS->singleElement(
FSNS(XML_c, XML_showOutline), XML_val,
"1");
2070 pFS->singleElement(
FSNS(XML_c, XML_showKeys), XML_val,
"1");
2075 pFS->endElement(
FSNS(XML_c, XML_dTable));
2081 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2082 for (
const auto& splitDataSeries : aSplitDataSeries)
2084 if (!splitDataSeries.hasElements())
2087 sal_Int32 nTypeId = XML_areaChart;
2089 nTypeId = XML_area3DChart;
2090 pFS->startElement(
FSNS(XML_c, nTypeId));
2093 bool bPrimaryAxes =
true;
2094 exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
2097 pFS->endElement(
FSNS(XML_c, nTypeId));
2103 sal_Int32 nTypeId = XML_barChart;
2105 nTypeId = XML_bar3DChart;
2108 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2109 for (
const auto& splitDataSeries : aSplitDataSeries)
2111 if (!splitDataSeries.hasElements())
2114 pFS->startElement(
FSNS(XML_c, nTypeId));
2116 bool bVertical =
false;
2121 const char* bardir = bVertical ?
"bar" :
"col";
2122 pFS->singleElement(
FSNS(XML_c, XML_barDir), XML_val, bardir);
2128 bool bPrimaryAxes =
true;
2129 exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
2133 if (xTypeProp.is() &&
GetProperty(xTypeProp,
"GapwidthSequence"))
2135 uno::Sequence< sal_Int32 > aBarPositionSequence;
2136 mAny >>= aBarPositionSequence;
2137 if (aBarPositionSequence.hasElements())
2139 sal_Int32 nGapWidth = aBarPositionSequence[0];
2140 pFS->singleElement(
FSNS(XML_c, XML_gapWidth), XML_val, OString::number(nGapWidth));
2147 namespace cssc = css::chart;
2148 sal_Int32 nGeom3d = cssc::ChartSolidType::RECTANGULAR_SOLID;
2149 if (xPropSet.is() &&
GetProperty(xPropSet,
"SolidType"))
2151 const char* sShapeType =
nullptr;
2154 case cssc::ChartSolidType::RECTANGULAR_SOLID:
2157 case cssc::ChartSolidType::CONE:
2158 sShapeType =
"cone";
2160 case cssc::ChartSolidType::CYLINDER:
2161 sShapeType =
"cylinder";
2163 case cssc::ChartSolidType::PYRAMID:
2164 sShapeType =
"pyramid";
2167 pFS->singleElement(
FSNS(XML_c, XML_shape), XML_val, sShapeType);
2173 uno::Sequence< sal_Int32 > aBarPositionSequence;
2174 mAny >>= aBarPositionSequence;
2175 if (aBarPositionSequence.hasElements())
2177 sal_Int32 nOverlap = aBarPositionSequence[0];
2186 pFS->singleElement(
FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
2190 pFS->singleElement(
FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
2197 pFS->endElement(
FSNS(XML_c, nTypeId));
2204 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2205 for (
const auto& splitDataSeries : aSplitDataSeries)
2207 if (!splitDataSeries.hasElements())
2210 pFS->startElement(
FSNS(XML_c, XML_bubbleChart));
2214 bool bPrimaryAxes =
true;
2215 exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
2219 pFS->endElement(
FSNS(XML_c, XML_bubbleChart));
2226 pFS->startElement(
FSNS(XML_c, XML_doughnutChart));
2230 bool bPrimaryAxes =
true;
2235 pFS->singleElement(
FSNS(XML_c, XML_holeSize), XML_val, OString::number(50));
2237 pFS->endElement(
FSNS( XML_c, XML_doughnutChart ) );
2244 if (rDLblsRange.
empty())
2247 pFS->startElement(
FSNS(XML_c, XML_extLst));
2248 pFS->startElement(
FSNS(XML_c, XML_ext), XML_uri,
"{02D57815-91ED-43cb-92C2-25804820EDAC}",
FSNS(XML_xmlns, XML_c15), pFB->
getNamespaceURL(OOX_NS(c15)));
2249 pFS->startElement(
FSNS(XML_c15, XML_datalabelsRange));
2252 pFS->startElement(
FSNS(XML_c15, XML_f));
2253 pFS->writeEscaped(rDLblsRange.
getRange());
2254 pFS->endElement(
FSNS(XML_c15, XML_f));
2257 pFS->startElement(
FSNS(XML_c15, XML_dlblRangeCache));
2258 pFS->singleElement(
FSNS(XML_c, XML_ptCount), XML_val, OString::number(rDLblsRange.
count()));
2259 for (
const auto& rLabelKV: rDLblsRange)
2261 pFS->startElement(
FSNS(XML_c, XML_pt), XML_idx, OString::number(rLabelKV.first));
2262 pFS->startElement(
FSNS(XML_c, XML_v));
2263 pFS->writeEscaped(rLabelKV.second);
2264 pFS->endElement(
FSNS( XML_c, XML_v ));
2265 pFS->endElement(
FSNS(XML_c, XML_pt));
2268 pFS->endElement(
FSNS(XML_c15, XML_dlblRangeCache));
2270 pFS->endElement(
FSNS(XML_c15, XML_datalabelsRange));
2271 pFS->endElement(
FSNS(XML_c, XML_ext));
2272 pFS->endElement(
FSNS(XML_c, XML_extLst));
2280 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2281 for (
const auto& splitDataSeries : aSplitDataSeries)
2283 if (!splitDataSeries.hasElements())
2286 sal_Int32 nTypeId = XML_lineChart;
2288 nTypeId = XML_line3DChart;
2289 pFS->startElement(
FSNS(XML_c, nTypeId));
2295 bool bPrimaryAxes =
true;
2296 exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
2299 sal_Int32 nSymbolType = css::chart::ChartSymbolType::NONE;
2302 mAny >>= nSymbolType;
2308 const char* marker = nSymbolType == css::chart::ChartSymbolType::NONE?
"0":
"1";
2309 pFS->singleElement(
FSNS(XML_c, XML_marker), XML_val, marker);
2314 pFS->endElement(
FSNS( XML_c, nTypeId ) );
2327 sal_Int32 nTypeId = XML_pieChart;
2329 nTypeId = XML_pie3DChart;
2330 pFS->startElement(
FSNS(XML_c, nTypeId));
2334 bool bPrimaryAxes =
true;
2343 pFS->endElement(
FSNS( XML_c, nTypeId ) );
2349 pFS->startElement(
FSNS(XML_c, XML_radarChart));
2353 const char* radarStyle =
nullptr;
2355 radarStyle =
"filled";
2357 radarStyle =
"marker";
2358 pFS->singleElement(
FSNS(XML_c, XML_radarStyle), XML_val, radarStyle);
2361 bool bPrimaryAxes =
true;
2365 pFS->endElement(
FSNS( XML_c, XML_radarChart ) );
2369 const css::uno::Sequence<css::uno::Reference<chart2::XDataSeries>>* pSeries)
2372 pFS->startElement(
FSNS(XML_c, XML_scatterChart));
2375 sal_Int32 nSymbolType = css::chart::ChartSymbolType::NONE;
2378 mAny >>= nSymbolType;
2380 const char* scatterStyle =
"lineMarker";
2381 if (nSymbolType == css::chart::ChartSymbolType::NONE)
2383 scatterStyle =
"line";
2386 pFS->singleElement(
FSNS(XML_c, XML_scatterStyle), XML_val, scatterStyle);
2390 bool bPrimaryAxes =
true;
2395 pFS->endElement(
FSNS( XML_c, XML_scatterChart ) );
2400 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2401 bool bExported =
false;
2402 for (
const auto& splitDataSeries : aSplitDataSeries)
2404 if (!splitDataSeries.hasElements())
2417 const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
2418 for (
const auto& splitDataSeries : aSplitDataSeries)
2420 if (!splitDataSeries.hasElements())
2423 pFS->startElement(
FSNS(XML_c, XML_stockChart));
2425 bool bPrimaryAxes =
true;
2430 if (xStockPropProvider.is())
2438 pFS->endElement(
FSNS(XML_c, XML_stockChart));
2448 if (!xChartPropProvider.is())
2452 if( !xStockPropSet.is() )
2455 pFS->startElement(
FSNS(XML_c, XML_hiLowLines));
2457 pFS->endElement(
FSNS( XML_c, XML_hiLowLines ) );
2462 if(xChartType->getChartType() !=
"com.sun.star.chart2.CandleStickChartType")
2468 if(!xChartPropProvider.is())
2472 pFS->startElement(
FSNS(XML_c, XML_upDownBars));
2474 pFS->singleElement(
FSNS(XML_c, XML_gapWidth), XML_val, OString::number(150));
2477 if( xChartPropSet.is() )
2479 pFS->startElement(
FSNS(XML_c, XML_upBars));
2482 if(xChartType->getChartType() ==
"com.sun.star.chart2.CandleStickChartType")
2486 pFS->endElement(
FSNS( XML_c, XML_upBars ) );
2488 xChartPropSet = xChartPropProvider->getDownBar();
2489 if( xChartPropSet.is() )
2491 pFS->startElement(
FSNS(XML_c, XML_downBars));
2492 if(xChartType->getChartType() ==
"com.sun.star.chart2.CandleStickChartType")
2496 pFS->endElement(
FSNS( XML_c, XML_downBars ) );
2498 pFS->endElement(
FSNS( XML_c, XML_upDownBars ) );
2504 sal_Int32 nTypeId = XML_surfaceChart;
2506 nTypeId = XML_surface3DChart;
2507 pFS->startElement(
FSNS(XML_c, nTypeId));
2509 bool bPrimaryAxes =
true;
2513 pFS->endElement(
FSNS( XML_c, nTypeId ) );
2534 Any aAnyVaryColors = xDataSeriesProps->getPropertyValue(
"VaryColorsByPoint");
2535 bool bVaryColors =
false;
2536 aAnyVaryColors >>= bVaryColors;
2537 pFS->singleElement(
FSNS(XML_c, XML_varyColors), XML_val,
ToPsz10(bVaryColors));
2541 pFS->singleElement(
FSNS(XML_c, XML_varyColors), XML_val,
"0");
2548 OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel();
2549 OUString aChartType( xChartType->getChartType());
2552 for(
const auto& rSeries : rSeriesSeq )
2560 xSource->getDataSequences());
2563 sal_Int32 nMainSequenceIndex = -1;
2564 sal_Int32 nSeriesLength = 0;
2567 sal_Int32 nSeqIdx=0;
2568 for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
2571 if( nMainSequenceIndex==-1 )
2576 xSeqProp->getPropertyValue(
"Role") >>= aRole;
2578 if( aRole == aLabelRole )
2580 xValuesSeq.set( xTempValueSeq );
2581 xLabelSeq.set( aSeqCnt[nSeqIdx]->getLabel());
2582 nMainSequenceIndex = nSeqIdx;
2585 sal_Int32 nSequenceLength = (xTempValueSeq.is()? xTempValueSeq->getData().getLength() : sal_Int32(0));
2586 if( nSeriesLength < nSequenceLength )
2587 nSeriesLength = nSequenceLength;
2595 pFS->startElement(
FSNS(XML_c, XML_ser));
2598 pFS->singleElement(
FSNS( XML_c, XML_idx ),
2600 pFS->singleElement(
FSNS( XML_c, XML_order ),
2604 if( xLabelSeq.is() )
2610 sal_Int32 nLocalAttachedAxis = 0;
2611 mAny >>= nLocalAttachedAxis;
2612 rPrimaryAxes = isPrimaryAxes(nLocalAttachedAxis);
2618 if( xOldPropSet.is() )
2623 switch( eChartType )
2629 pFS->singleElement(
FSNS(XML_c, XML_invertIfNegative), XML_val,
"0");
2640 if( xOldPropSet.is() &&
GetProperty( xOldPropSet,
"SegmentOffset") )
2642 sal_Int32 nOffset = 0;
2644 pFS->singleElement(
FSNS( XML_c, XML_explosion ),
2645 XML_val, OString::number( nOffset ) );
2662 exportDataPoints( uno::Reference< beans::XPropertySet >( rSeries, uno::UNO_QUERY ), nSeriesLength, eChartType );
2676 xSeriesPropSet->getPropertyValue(
"ErrorBarY") >>= xErrorBarYProps;
2677 if(xErrorBarYProps.is())
2683 xSeriesPropSet->getPropertyValue(
"ErrorBarX") >>= xErrorBarXProps;
2684 if(xErrorBarXProps.is())
2698 if( xSequence.is() )
2712 if( xSequence.is() )
2721 if( xValuesSeq.is() )
2723 sal_Int32 nYValueType = XML_val;
2725 nYValueType = XML_yVal;
2727 nYValueType = XML_bubbleSize;
2737 pFS->singleElement(
FSNS(XML_c, XML_bubble3D), XML_val,
"0");
2739 if (!aDLblsRange.
empty())
2740 writeDataLabelsRange(pFS,
GetFB(), aDLblsRange);
2742 pFS->endElement(
FSNS( XML_c, XML_ser ) );
2764 xSource->getDataSequences());
2766 const char* sSeries[] = {
"values-first",
"values-max",
"values-min",
"values-last",
nullptr};
2768 for( sal_Int32
idx = 0; sSeries[
idx] != nullptr ;
idx++ )
2771 if( xLabeledSeq.is())
2777 pFS->startElement(
FSNS(XML_c, XML_ser));
2781 pFS->singleElement(
FSNS( XML_c, XML_idx ),
2782 XML_val, OString::number(
idx+1) );
2783 pFS->singleElement(
FSNS( XML_c, XML_order ),
2784 XML_val, OString::number(
idx+1) );
2787 if( xLabelSeq.is() )
2797 if( xValueSeq.is() )
2800 pFS->endElement(
FSNS( XML_c, XML_ser ) );
2811 pFS->startElement(
FSNS(XML_c, XML_tx));
2813 OUString aCellRange = xValueSeq->getSourceRangeRepresentation();
2815 pFS->startElement(
FSNS(XML_c, XML_strRef));
2817 pFS->startElement(
FSNS(XML_c, XML_f));
2818 pFS->writeEscaped( aCellRange );
2819 pFS->endElement(
FSNS( XML_c, XML_f ) );
2822 pFS->startElement(
FSNS(XML_c, XML_strCache));
2823 pFS->singleElement(
FSNS(XML_c, XML_ptCount), XML_val,
"1");
2824 pFS->startElement(
FSNS(XML_c, XML_pt), XML_idx,
"0");
2825 pFS->startElement(
FSNS(XML_c, XML_v));
2826 pFS->writeEscaped( aLabelString );
2827 pFS->endElement(
FSNS( XML_c, XML_v ) );
2828 pFS->endElement(
FSNS( XML_c, XML_pt ) );
2829 pFS->endElement(
FSNS( XML_c, XML_strCache ) );
2830 pFS->endElement(
FSNS( XML_c, XML_strRef ) );
2831 pFS->endElement(
FSNS( XML_c, XML_tx ) );
2837 pFS->startElement(
FSNS(XML_c, nValueType));
2839 OUString aCellRange = xValueSeq.is() ? xValueSeq->getSourceRangeRepresentation() : OUString();
2843 if(aFinalSplitSource.getLength() > 1)
2846 pFS->startElement(
FSNS(XML_c, XML_multiLvlStrRef));
2848 pFS->startElement(
FSNS(XML_c, XML_f));
2849 pFS->writeEscaped(aCellRange);
2850 pFS->endElement(
FSNS(XML_c, XML_f));
2852 pFS->startElement(
FSNS(XML_c, XML_multiLvlStrCache));
2853 pFS->singleElement(
FSNS(XML_c, XML_ptCount), XML_val, OString::number(aFinalSplitSource[0].
getLength()));
2854 for(
const auto& rSeq : aFinalSplitSource)
2856 pFS->startElement(
FSNS(XML_c, XML_lvl));
2857 for(sal_Int32 j = 0; j < rSeq.getLength(); j++)
2859 if(!rSeq[j].isEmpty())
2861 pFS->startElement(
FSNS(XML_c, XML_pt), XML_idx, OString::number(j));
2862 pFS->startElement(
FSNS(XML_c, XML_v));
2863 pFS->writeEscaped(rSeq[j]);
2864 pFS->endElement(
FSNS(XML_c, XML_v));
2865 pFS->endElement(
FSNS(XML_c, XML_pt));
2868 pFS->endElement(
FSNS(XML_c, XML_lvl));
2871 pFS->endElement(
FSNS(XML_c, XML_multiLvlStrCache));
2872 pFS->endElement(
FSNS(XML_c, XML_multiLvlStrRef));
2878 OUString aNumberFormatString;
2879 if (bWriteDateCategories)
2882 if( xAxisXSupp.is())
2892 if (aNumberFormatString.isEmpty())
2893 bWriteDateCategories =
false;
2896 pFS->startElement(
FSNS(XML_c, bWriteDateCategories ? XML_numRef : XML_strRef));
2898 pFS->startElement(
FSNS(XML_c, XML_f));
2899 pFS->writeEscaped(aCellRange);
2900 pFS->endElement(
FSNS(XML_c, XML_f));
2902 ::std::vector< OUString > aCategories;
2904 sal_Int32 ptCount = aCategories.size();
2905 pFS->startElement(
FSNS(XML_c, bWriteDateCategories ? XML_numCache : XML_strCache));
2906 if (bWriteDateCategories)
2908 pFS->startElement(
FSNS(XML_c, XML_formatCode));
2909 pFS->writeEscaped(aNumberFormatString);
2910 pFS->endElement(
FSNS(XML_c, XML_formatCode));
2913 pFS->singleElement(
FSNS(XML_c, XML_ptCount), XML_val, OString::number(ptCount));
2914 for (sal_Int32
i = 0;
i < ptCount;
i++)
2916 pFS->startElement(
FSNS(XML_c, XML_pt), XML_idx, OString::number(
i));
2917 pFS->startElement(
FSNS(XML_c, XML_v));
2918 pFS->writeEscaped(aCategories[
i]);
2919 pFS->endElement(
FSNS(XML_c, XML_v));
2920 pFS->endElement(
FSNS(XML_c, XML_pt));
2923 pFS->endElement(
FSNS(XML_c, bWriteDateCategories ? XML_numCache : XML_strCache));
2924 pFS->endElement(
FSNS(XML_c, bWriteDateCategories ? XML_numRef : XML_strRef));
2927 pFS->endElement(
FSNS( XML_c, nValueType ) );
2933 pFS->startElement(
FSNS(XML_c, nValueType));
2935 OUString aCellRange = xValueSeq.is() ? xValueSeq->getSourceRangeRepresentation() : OUString();
2938 pFS->startElement(
FSNS(XML_c, XML_numRef));
2940 pFS->startElement(
FSNS(XML_c, XML_f));
2941 pFS->writeEscaped( aCellRange );
2942 pFS->endElement(
FSNS( XML_c, XML_f ) );
2945 sal_Int32 ptCount = aValues.size();
2946 pFS->startElement(
FSNS(XML_c, XML_numCache));
2947 pFS->startElement(
FSNS(XML_c, XML_formatCode));
2949 pFS->writeEscaped(
"General" );
2950 pFS->endElement(
FSNS( XML_c, XML_formatCode ) );
2951 pFS->singleElement(
FSNS(XML_c, XML_ptCount), XML_val, OString::number(ptCount));
2953 for( sal_Int32
i = 0;
i < ptCount;
i++ )
2955 if (!std::isnan(aValues[
i]))
2957 pFS->startElement(
FSNS(XML_c, XML_pt), XML_idx, OString::number(
i));
2958 pFS->startElement(
FSNS(XML_c, XML_v));
2959 pFS->write(aValues[
i]);
2960 pFS->endElement(
FSNS(XML_c, XML_v));
2961 pFS->endElement(
FSNS(XML_c, XML_pt));
2965 pFS->endElement(
FSNS( XML_c, XML_numCache ) );
2966 pFS->endElement(
FSNS( XML_c, XML_numRef ) );
2967 pFS->endElement(
FSNS( XML_c, nValueType ) );
2973 pFS->startElement(
FSNS(XML_c, XML_spPr));
2978 pFS->endElement(
FSNS( XML_c, XML_spPr ) );
2984 pFS->startElement(
FSNS(XML_c, XML_txPr));
2986 sal_Int32 nRotation = 0;
2987 const char* textWordWrap =
nullptr;
2989 if (
auto xServiceInfo = uno::Reference<lang::XServiceInfo>(xPropSet, uno::UNO_QUERY))
2991 double fMultiplier = 0.0;
2997 if (xServiceInfo->supportsService(
"com.sun.star.chart.ChartAxis"))
2998 fMultiplier = -600.0;
2999 else if (xServiceInfo->supportsService(
"com.sun.star.chart2.DataSeries") || xServiceInfo->supportsService(
"com.sun.star.chart2.DataPointProperties"))
3001 fMultiplier = -60000.0;
3002 bool bTextWordWrap =
false;
3003 if ((xPropSet->getPropertyValue(
"TextWordWrap") >>= bTextWordWrap) && bTextWordWrap)
3004 textWordWrap =
"square";
3006 textWordWrap =
"none";
3011 double fTextRotation = 0.0;
3012 uno::Any aAny = xPropSet->getPropertyValue(
"TextRotation");
3013 if (aAny.
hasValue() && (aAny >>= fTextRotation))
3015 fTextRotation *= fMultiplier;
3017 if (fTextRotation < -5400000.0 && fTextRotation > -16200000.0)
3020 fTextRotation += 10800000.0;
3022 else if (fTextRotation <= -16200000.0)
3024 fTextRotation += 21600000.0;
3026 nRotation = std::round(fTextRotation);
3032 pFS->singleElement(
FSNS(XML_a, XML_bodyPr), XML_rot, OString::number(nRotation), XML_wrap, textWordWrap);
3034 pFS->singleElement(
FSNS(XML_a, XML_bodyPr), XML_wrap, textWordWrap);
3036 pFS->singleElement(
FSNS(XML_a, XML_lstStyle));
3038 pFS->startElement(
FSNS(XML_a, XML_p));
3039 pFS->startElement(
FSNS(XML_a, XML_pPr));
3044 pFS->endElement(
FSNS(XML_a, XML_pPr));
3045 pFS->endElement(
FSNS(XML_a, XML_p));
3046 pFS->endElement(
FSNS(XML_c, XML_txPr));
3055 if (xServiceInfo.is())
3057 if (xServiceInfo->supportsService(
"com.sun.star.chart.ChartAxisZSupplier"))
3059 xDiagramProperties->getPropertyValue(
"HasZAxis") >>=
mbHasZAxis;
3063 xDiagramProperties->getPropertyValue(
"Dim3D") >>=
mbIs3DChart;
3068 if( xCategories.is() )
3077 sal_Int32 nSize =
maAxes.size();
3081 for ( sal_Int32 nIdx = 0; nIdx < nSize; nIdx++ )
3083 if (nSortIdx ==
maAxes[nIdx].nAxisType)
3091sal_Int32 getXAxisTypeByChartType(sal_Int32 eChartType)
3102sal_Int32 getRealXAxisType(sal_Int32 nAxisType)
3104 if( nAxisType == chart2::AxisType::CATEGORY )
3106 else if( nAxisType == chart2::AxisType::DATE )
3108 else if( nAxisType == chart2::AxisType::SERIES )
3119 bool bHasXAxisTitle =
false,
3120 bHasYAxisTitle =
false,
3121 bHasZAxisTitle =
false,
3122 bHasSecondaryXAxisTitle =
false,
3123 bHasSecondaryYAxisTitle =
false;
3124 bool bHasXAxisMajorGrid =
false,
3125 bHasXAxisMinorGrid =
false,
3126 bHasYAxisMajorGrid =
false,
3127 bHasYAxisMinorGrid =
false,
3128 bHasZAxisMajorGrid =
false,
3129 bHasZAxisMinorGrid =
false;
3133 xDiagramProperties->getPropertyValue(
"HasXAxisTitle") >>= bHasXAxisTitle;
3134 xDiagramProperties->getPropertyValue(
"HasYAxisTitle") >>= bHasYAxisTitle;
3135 xDiagramProperties->getPropertyValue(
"HasZAxisTitle") >>= bHasZAxisTitle;
3136 xDiagramProperties->getPropertyValue(
"HasSecondaryXAxisTitle") >>= bHasSecondaryXAxisTitle;
3137 xDiagramProperties->getPropertyValue(
"HasSecondaryYAxisTitle") >>= bHasSecondaryYAxisTitle;
3139 xDiagramProperties->getPropertyValue(
"HasXAxisGrid") >>= bHasXAxisMajorGrid;
3140 xDiagramProperties->getPropertyValue(
"HasYAxisGrid") >>= bHasYAxisMajorGrid;
3141 xDiagramProperties->getPropertyValue(
"HasZAxisGrid") >>= bHasZAxisMajorGrid;
3143 xDiagramProperties->getPropertyValue(
"HasXAxisHelpGrid") >>= bHasXAxisMinorGrid;
3144 xDiagramProperties->getPropertyValue(
"HasYAxisHelpGrid") >>= bHasYAxisMinorGrid;
3145 xDiagramProperties->getPropertyValue(
"HasZAxisHelpGrid") >>= bHasZAxisMinorGrid;
3151 sal_Int32 nAxisType = XML_catAx;
3152 const char* sAxPos =
nullptr;
3159 if( xAxisXSupp.is())
3160 xAxisProp = xAxisXSupp->getXAxis();
3161 if( bHasXAxisTitle )
3162 xAxisTitle = xAxisXSupp->getXAxisTitle();
3163 if( bHasXAxisMajorGrid )
3164 xMajorGrid = xAxisXSupp->getXMainGrid();
3165 if( bHasXAxisMinorGrid )
3166 xMinorGrid = xAxisXSupp->getXHelpGrid();
3169 if( nAxisType != -1 )
3170 nAxisType = getRealXAxisType(nAxisType);
3180 if( xAxisYSupp.is())
3181 xAxisProp = xAxisYSupp->getYAxis();
3182 if( bHasYAxisTitle )
3183 xAxisTitle = xAxisYSupp->getYAxisTitle();
3184 if( bHasYAxisMajorGrid )
3185 xMajorGrid = xAxisYSupp->getYMainGrid();
3186 if( bHasYAxisMinorGrid )
3187 xMinorGrid = xAxisYSupp->getYHelpGrid();
3189 nAxisType = XML_valAx;
3197 if( xAxisZSupp.is())
3198 xAxisProp = xAxisZSupp->getZAxis();
3199 if( bHasZAxisTitle )
3200 xAxisTitle = xAxisZSupp->getZAxisTitle();
3201 if( bHasZAxisMajorGrid )
3202 xMajorGrid = xAxisZSupp->getZMainGrid();
3203 if( bHasZAxisMinorGrid )
3204 xMinorGrid = xAxisZSupp->getZHelpGrid();
3209 nAxisType = XML_valAx;
3211 nAxisType = XML_dateAx;
3213 nAxisType = XML_serAx;
3221 if( xAxisTwoXSupp.is())
3222 xAxisProp = xAxisTwoXSupp->getSecondaryXAxis();
3223 if( bHasSecondaryXAxisTitle )
3226 xAxisTitle = xAxisSupp->getSecondXAxisTitle();
3230 if( nAxisType != -1 )
3231 nAxisType = getRealXAxisType(nAxisType);
3241 if( xAxisTwoYSupp.is())
3242 xAxisProp = xAxisTwoYSupp->getSecondaryYAxis();
3243 if( bHasSecondaryYAxisTitle )
3246 xAxisTitle = xAxisSupp->getSecondYAxisTitle();
3249 nAxisType = XML_valAx;
3256 _exportAxis(xAxisProp, xAxisTitle, xMajorGrid, xMinorGrid, nAxisType, sAxPos, rAxisIdPair);
3264 sal_Int32 nAxisType,
3265 const char* sAxisPos,
3269 pFS->startElement(
FSNS(XML_c, nAxisType));
3270 pFS->singleElement(
FSNS(XML_c, XML_axId), XML_val, OString::number(rAxisIdPair.
nAxisId));
3272 pFS->startElement(
FSNS(XML_c, XML_scaling));
3277 bool bLogarithmic =
false;
3278 mAny >>= bLogarithmic;
3282 pFS->singleElement(
FSNS(XML_c, XML_logBase), XML_val, OString::number(10));
3287 bool bReverseDirection =
false;
3289 mAny >>= bReverseDirection;
3291 const char*
orientation = bReverseDirection ?
"maxMin":
"minMax";
3292 pFS->singleElement(
FSNS(XML_c, XML_orientation), XML_val,
orientation);
3294 bool bAutoMax =
false;
3298 if( !bAutoMax && (
GetProperty( xAxisProp,
"Max" ) ) )
3302 pFS->singleElement(
FSNS(XML_c, XML_max), XML_val, OString::number(dMax));
3305 bool bAutoMin =
false;
3309 if( !bAutoMin && (
GetProperty( xAxisProp,
"Min" ) ) )
3313 pFS->singleElement(
FSNS(XML_c, XML_min), XML_val, OString::number(dMin));
3316 pFS->endElement(
FSNS( XML_c, XML_scaling ) );
3319 if( xAxisProp.is() )
3321 xAxisProp->getPropertyValue(
"Visible") >>=
bVisible;
3330 pFS->singleElement(
FSNS(XML_c, XML_delete), XML_val, !bDeleted &&
bVisible ?
"0" :
"1");
3333 pFS->singleElement(
FSNS(XML_c, XML_axPos), XML_val, sAxisPos);
3335 if( xMajorGrid.is())
3337 pFS->startElement(
FSNS(XML_c, XML_majorGridlines));
3339 pFS->endElement(
FSNS( XML_c, XML_majorGridlines ) );
3343 if( xMinorGrid.is())
3345 pFS->startElement(
FSNS(XML_c, XML_minorGridlines));
3347 pFS->endElement(
FSNS( XML_c, XML_minorGridlines ) );
3351 if( xAxisTitle.is() )
3354 bool bLinkedNumFmt =
true;
3355 if (
GetProperty(xAxisProp,
"LinkNumberFormatToSource"))
3356 mAny >>= bLinkedNumFmt;
3358 OUString aNumberFormatString(
"General");
3366 pFS->singleElement(
FSNS(XML_c, XML_numFmt),
3367 XML_formatCode, aNumberFormatString,
3368 XML_sourceLinked, bLinkedNumFmt ?
"1" :
"0");
3375 bool bInner =
nValue & css::chart::ChartAxisMarks::INNER;
3376 bool bOuter =
nValue & css::chart::ChartAxisMarks::OUTER;
3377 const char* majorTickMark =
nullptr;
3378 if( bInner && bOuter )
3379 majorTickMark =
"cross";
3381 majorTickMark =
"in";
3383 majorTickMark =
"out";
3385 majorTickMark =
"none";
3386 pFS->singleElement(
FSNS(XML_c, XML_majorTickMark), XML_val, majorTickMark);
3392 bool bInner =
nValue & css::chart::ChartAxisMarks::INNER;
3393 bool bOuter =
nValue & css::chart::ChartAxisMarks::OUTER;
3394 const char* minorTickMark =
nullptr;
3395 if( bInner && bOuter )
3396 minorTickMark =
"cross";
3398 minorTickMark =
"in";
3400 minorTickMark =
"out";
3402 minorTickMark =
"none";
3403 pFS->singleElement(
FSNS(XML_c, XML_minorTickMark), XML_val, minorTickMark);
3406 const char* sTickLblPos =
nullptr;
3407 bool bDisplayLabel =
true;
3409 mAny >>= bDisplayLabel;
3410 if( bDisplayLabel && (
GetProperty( xAxisProp,
"LabelPosition" ) ) )
3412 css::chart::ChartAxisLabelPosition eLabelPosition = css::chart::ChartAxisLabelPosition_NEAR_AXIS;
3413 mAny >>= eLabelPosition;
3414 switch( eLabelPosition )
3416 case css::chart::ChartAxisLabelPosition_NEAR_AXIS:
3417 case css::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE:
3418 sTickLblPos =
"nextTo";
3420 case css::chart::ChartAxisLabelPosition_OUTSIDE_START:
3421 sTickLblPos =
"low";
3423 case css::chart::ChartAxisLabelPosition_OUTSIDE_END:
3424 sTickLblPos =
"high";
3427 sTickLblPos =
"nextTo";
3433 sTickLblPos =
"none";
3435 pFS->singleElement(
FSNS(XML_c, XML_tickLblPos), XML_val, sTickLblPos);
3442 pFS->singleElement(
FSNS(XML_c, XML_crossAx), XML_val, OString::number(rAxisIdPair.
nCrossAx));
3445 bool bCrossesValue =
false;
3446 const char* sCrosses =
nullptr;
3450 css::chart::ChartAxisPosition ePosition( css::chart::ChartAxisPosition_ZERO );
3454 case css::chart::ChartAxisPosition_START:
3457 case css::chart::ChartAxisPosition_END:
3460 case css::chart::ChartAxisPosition_ZERO:
3461 sCrosses =
"autoZero";
3464 bCrossesValue =
true;
3469 if( bCrossesValue &&
GetProperty( xAxisProp,
"CrossoverValue" ) )
3473 pFS->singleElement(
FSNS(XML_c, XML_crossesAt), XML_val, OString::number(dValue));
3479 pFS->singleElement(
FSNS(XML_c, XML_crosses), XML_val, sCrosses);
3483 if( ( nAxisType == XML_catAx )
3484 || ( nAxisType == XML_dateAx ) )
3487 const char*
const isAuto =
"1";
3488 pFS->singleElement(
FSNS(XML_c, XML_auto), XML_val, isAuto);
3490 if( nAxisType == XML_catAx )
3493 const char*
const sLblAlgn =
"ctr";
3494 pFS->singleElement(
FSNS(XML_c, XML_lblAlgn), XML_val, sLblAlgn);
3498 pFS->singleElement(
FSNS(XML_c, XML_lblOffset), XML_val, OString::number(100));
3501 if( nAxisType == XML_dateAx )
3503 sal_Int32 nAxisIndex = -1;
3510 sal_Int32 nTimeResolution = css::chart::TimeUnit::DAY;
3511 if( aTimeIncrement.TimeResolution >>= nTimeResolution )
3514 cssc::TimeInterval aInterval;
3515 if( aTimeIncrement.MajorTimeInterval >>= aInterval )
3517 pFS->singleElement(
FSNS(XML_c, XML_majorUnit), XML_val, OString::number(aInterval.Number));
3520 if( aTimeIncrement.MinorTimeInterval >>= aInterval )
3522 pFS->singleElement(
FSNS(XML_c, XML_minorUnit), XML_val, OString::number(aInterval.Number));
3528 pFS->singleElement(
FSNS(XML_c, XML_noMultiLvlLbl), XML_val, OString::number(0));
3532 if( nAxisType == XML_valAx )
3535 pFS->singleElement(
FSNS(XML_c, XML_crossBetween), XML_val,
"between");
3537 pFS->singleElement(
FSNS(XML_c, XML_crossBetween), XML_val,
"midCat");
3541 bool bAutoStepMain =
false;
3543 mAny >>= bAutoStepMain;
3545 if( !bAutoStepMain && (
GetProperty( xAxisProp,
"StepMain" ) ) )
3547 double dMajorUnit = 0;
3548 mAny >>= dMajorUnit;
3549 pFS->singleElement(
FSNS(XML_c, XML_majorUnit), XML_val, OString::number(dMajorUnit));
3552 bool bAutoStepHelp =
false;
3554 mAny >>= bAutoStepHelp;
3556 if( !bAutoStepHelp && (
GetProperty( xAxisProp,
"StepHelp" ) ) )
3558 double dMinorUnit = 0;
3559 mAny >>= dMinorUnit;
3562 sal_Int32 dMinorUnitCount = 0;
3563 mAny >>= dMinorUnitCount;
3567 if( dMinorUnitCount != 5 )
3569 pFS->singleElement(
FSNS( XML_c, XML_minorUnit ),
3570 XML_val, OString::number( dMinorUnit ) );
3575 if( nAxisType == XML_valAx &&
GetProperty( xAxisProp,
"DisplayUnits" ) )
3577 bool bDisplayUnits =
false;
3578 mAny >>= bDisplayUnits;
3587 pFS->startElement(
FSNS(XML_c, XML_dispUnits));
3589 pFS->singleElement(
FSNS(XML_c, XML_builtInUnit), XML_val, aVal);
3591 pFS->singleElement(
FSNS( XML_c, XML_dispUnitsLbl ));
3592 pFS->endElement(
FSNS( XML_c, XML_dispUnits ) );
3598 pFS->endElement(
FSNS( XML_c, nAxisType ) );
3603struct LabelPlacementParam
3610 LabelPlacementParam(
bool bExport, sal_Int32 nDefault) :
3615 css::chart::DataLabelPlacement::OUTSIDE,
3616 css::chart::DataLabelPlacement::INSIDE,
3617 css::chart::DataLabelPlacement::CENTER,
3618 css::chart::DataLabelPlacement::NEAR_ORIGIN,
3619 css::chart::DataLabelPlacement::TOP,
3620 css::chart::DataLabelPlacement::BOTTOM,
3621 css::chart::DataLabelPlacement::LEFT,
3622 css::chart::DataLabelPlacement::RIGHT,
3623 css::chart::DataLabelPlacement::AVOID_OVERLAP
3629const char* toOOXMLPlacement( sal_Int32 nPlacement )
3633 case css::chart::DataLabelPlacement::OUTSIDE:
return "outEnd";
3634 case css::chart::DataLabelPlacement::INSIDE:
return "inEnd";
3635 case css::chart::DataLabelPlacement::CENTER:
return "ctr";
3636 case css::chart::DataLabelPlacement::NEAR_ORIGIN:
return "inBase";
3637 case css::chart::DataLabelPlacement::TOP:
return "t";
3638 case css::chart::DataLabelPlacement::BOTTOM:
return "b";
3639 case css::chart::DataLabelPlacement::LEFT:
return "l";
3640 case css::chart::DataLabelPlacement::RIGHT:
return "r";
3641 case css::chart::DataLabelPlacement::CUSTOM:
3642 case css::chart::DataLabelPlacement::AVOID_OVERLAP:
return "bestFit";
3650OUString getFieldTypeString(
const chart2::DataPointCustomLabelFieldType aType )
3654 case chart2::DataPointCustomLabelFieldType_CATEGORYNAME:
3655 return "CATEGORYNAME";
3657 case chart2::DataPointCustomLabelFieldType_SERIESNAME:
3658 return "SERIESNAME";
3660 case chart2::DataPointCustomLabelFieldType_VALUE:
3663 case chart2::DataPointCustomLabelFieldType_CELLREF:
3666 case chart2::DataPointCustomLabelFieldType_CELLRANGE:
3675void writeRunProperties( ChartExport* pChartExport, Reference<XPropertySet>
const & xPropertySet )
3677 bool bDummy =
false;
3679 pChartExport->WriteRunProperties(xPropertySet,
false, XML_rPr,
true, bDummy, nDummy);
3682void writeCustomLabel(
const FSHelperPtr& pFS, ChartExport* pChartExport,
3683 const Sequence<Reference<chart2::XDataPointCustomLabelField>>& rCustomLabelFields,
3684 sal_Int32 nLabelIndex, DataLabelsRange& rDLblsRange )
3686 pFS->startElement(
FSNS(XML_c, XML_tx));
3687 pFS->startElement(
FSNS(XML_c, XML_rich));
3690 pFS->singleElement(
FSNS(XML_a, XML_bodyPr));
3692 OUString sFieldType;
3694 pFS->startElement(
FSNS(XML_a, XML_p));
3696 for (
auto& rField : rCustomLabelFields)
3698 Reference<XPropertySet> xPropertySet(rField, UNO_QUERY);
3699 chart2::DataPointCustomLabelFieldType aType = rField->getFieldType();
3702 bool bNewParagraph =
false;
3704 if (aType == chart2::DataPointCustomLabelFieldType_CELLRANGE &&
3705 rField->getDataLabelsRange())
3707 if (rDLblsRange.getRange().isEmpty())
3708 rDLblsRange.setRange(rField->getCellRange());
3710 if (!rDLblsRange.hasLabel(nLabelIndex))
3711 rDLblsRange.setLabel(nLabelIndex, rField->getString());
3713 sContent =
"[CELLRANGE]";
3717 sContent = rField->getString();
3720 if (aType == chart2::DataPointCustomLabelFieldType_NEWLINE)
3721 bNewParagraph =
true;
3722 else if (aType != chart2::DataPointCustomLabelFieldType_TEXT)
3723 sFieldType = getFieldTypeString(aType);
3727 pFS->endElement(
FSNS(XML_a, XML_p));
3728 pFS->startElement(
FSNS(XML_a, XML_p));
3732 if (sFieldType.isEmpty())
3735 pFS->startElement(
FSNS(XML_a, XML_r));
3736 writeRunProperties(pChartExport, xPropertySet);
3738 pFS->startElement(
FSNS(XML_a, XML_t));
3739 pFS->writeEscaped(sContent);
3740 pFS->endElement(
FSNS(XML_a, XML_t));
3742 pFS->endElement(
FSNS(XML_a, XML_r));
3747 pFS->startElement(
FSNS(XML_a, XML_fld), XML_id, rField->getGuid(), XML_type,
3749 writeRunProperties(pChartExport, xPropertySet);
3751 pFS->startElement(
FSNS(XML_a, XML_t));
3752 pFS->writeEscaped(sContent);
3753 pFS->endElement(
FSNS(XML_a, XML_t));
3755 pFS->endElement(
FSNS(XML_a, XML_fld));
3759 pFS->endElement(
FSNS(XML_a, XML_p));
3760 pFS->endElement(
FSNS(XML_c, XML_rich));
3761 pFS->endElement(
FSNS(XML_c, XML_tx));
3764void writeLabelProperties(
const FSHelperPtr& pFS, ChartExport* pChartExport,
3765 const uno::Reference<beans::XPropertySet>& xPropSet,
const LabelPlacementParam& rLabelParam,
3766 sal_Int32 nLabelIndex, DataLabelsRange& rDLblsRange )
3771 chart2::DataPointLabel
aLabel;
3772 Sequence<Reference<chart2::XDataPointCustomLabelField>> aCustomLabelFields;
3773 sal_Int32 nLabelBorderWidth = 0;
3774 sal_Int32 nLabelBorderColor = 0x00FFFFFF;
3775 sal_Int32 nLabelFillColor = -1;
3777 xPropSet->getPropertyValue(
"Label") >>=
aLabel;
3778 xPropSet->getPropertyValue(
"CustomLabelFields") >>= aCustomLabelFields;
3779 xPropSet->getPropertyValue(
"LabelBorderWidth") >>= nLabelBorderWidth;
3780 xPropSet->getPropertyValue(
"LabelBorderColor") >>= nLabelBorderColor;
3781 xPropSet->getPropertyValue(
"LabelFillColor") >>= nLabelFillColor;
3783 if (nLabelBorderWidth > 0 || nLabelFillColor != -1)
3785 pFS->startElement(
FSNS(XML_c, XML_spPr));
3787 if (nLabelFillColor != -1)
3789 pFS->startElement(
FSNS(XML_a, XML_solidFill));
3791 OString
aStr = OString::number(nLabelFillColor, 16).toAsciiUpperCase();
3792 pFS->singleElement(
FSNS(XML_a, XML_srgbClr), XML_val, aStr);
3794 pFS->endElement(
FSNS(XML_a, XML_solidFill));
3797 if (nLabelBorderWidth > 0)
3799 pFS->startElement(
FSNS(XML_a, XML_ln), XML_w,
3802 if (nLabelBorderColor != -1)
3804 pFS->startElement(
FSNS(XML_a, XML_solidFill));
3806 OString
aStr = OString::number(nLabelBorderColor, 16).toAsciiUpperCase();
3807 pFS->singleElement(
FSNS(XML_a, XML_srgbClr), XML_val, aStr);
3809 pFS->endElement(
FSNS(XML_a, XML_solidFill));
3812 pFS->endElement(
FSNS(XML_a, XML_ln));
3815 pFS->endElement(
FSNS(XML_c, XML_spPr));
3818 pChartExport->exportTextProps(xPropSet);
3820 if (aCustomLabelFields.hasElements())
3821 writeCustomLabel(pFS, pChartExport, aCustomLabelFields, nLabelIndex, rDLblsRange);
3823 if (rLabelParam.mbExport)
3825 sal_Int32 nLabelPlacement = rLabelParam.meDefault;
3826 if (xPropSet->getPropertyValue(
"LabelPlacement") >>= nLabelPlacement)
3828 if (!rLabelParam.maAllowedValues.count(nLabelPlacement))
3829 nLabelPlacement = rLabelParam.meDefault;
3830 pFS->singleElement(
FSNS(XML_c, XML_dLblPos), XML_val, toOOXMLPlacement(nLabelPlacement));
3834 pFS->singleElement(
FSNS(XML_c, XML_showLegendKey), XML_val,
ToPsz10(
aLabel.ShowLegendSymbol));
3835 pFS->singleElement(
FSNS(XML_c, XML_showVal), XML_val,
ToPsz10(
aLabel.ShowNumber));
3836 pFS->singleElement(
FSNS(XML_c, XML_showCatName), XML_val,
ToPsz10(
aLabel.ShowCategoryName));
3837 pFS->singleElement(
FSNS(XML_c, XML_showSerName), XML_val,
ToPsz10(
aLabel.ShowSeriesName));
3838 pFS->singleElement(
FSNS(XML_c, XML_showPercent), XML_val,
ToPsz10(
aLabel.ShowNumberInPercent));
3841 uno::Any aAny = xPropSet->getPropertyValue(
"LabelSeparator");
3844 OUString nLabelSeparator;
3845 aAny >>= nLabelSeparator;
3846 pFS->startElement(
FSNS(XML_c, XML_separator));
3847 pFS->writeEscaped( nLabelSeparator );
3848 pFS->endElement(
FSNS( XML_c, XML_separator ) );
3851 if (rDLblsRange.hasLabel(nLabelIndex))
3853 pFS->startElement(
FSNS(XML_c, XML_extLst));
3854 pFS->startElement(
FSNS(XML_c, XML_ext), XML_uri,
3855 "{CE6537A1-D6FC-4f65-9D91-7224C49458BB}",
FSNS(XML_xmlns, XML_c15),
3856 pChartExport->GetFB()->getNamespaceURL(OOX_NS(c15)));
3858 pFS->singleElement(
FSNS(XML_c15, XML_showDataLabelsRange), XML_val,
"1");
3860 pFS->endElement(
FSNS(XML_c, XML_ext));
3861 pFS->endElement(
FSNS(XML_c, XML_extLst));
3868 const uno::Reference<chart2::XDataSeries> & xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType,
3871 if (!xSeries.is() || nSeriesLength <= 0)
3874 uno::Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY);
3879 pFS->startElement(
FSNS(XML_c, XML_dLbls));
3881 bool bLinkedNumFmt =
true;
3882 if (
GetProperty(xPropSet,
"LinkNumberFormatToSource"))
3883 mAny >>= bLinkedNumFmt;
3885 chart2::DataPointLabel
aLabel;
3886 bool bLabelIsNumberFormat =
true;
3887 if( xPropSet->getPropertyValue(
"Label") >>=
aLabel )
3888 bLabelIsNumberFormat =
aLabel.ShowNumber;
3890 if (
GetProperty(xPropSet, bLabelIsNumberFormat ? OUString(
"NumberFormat") : OUString(
"PercentageNumberFormat")))
3897 pFS->singleElement(
FSNS(XML_c, XML_numFmt),
3898 XML_formatCode, aNumberFormatString,
3899 XML_sourceLinked,
ToPsz10(bLinkedNumFmt));
3902 uno::Sequence<sal_Int32> aAttrLabelIndices;
3903 xPropSet->getPropertyValue(
"AttributedDataPoints") >>= aAttrLabelIndices;
3915 aParam.mbExport =
false;
3918 aParam.mbExport =
true;
3924 aParam.mbExport =
false;
3929 aParam.maAllowedValues.clear();
3930 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER);
3931 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::INSIDE);
3932 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::NEAR_ORIGIN);
3933 aParam.meDefault = css::chart::DataLabelPlacement::CENTER;
3937 aParam.maAllowedValues.clear();
3938 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER);
3939 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::INSIDE);
3940 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::OUTSIDE);
3941 aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::NEAR_ORIGIN);
3942 aParam.meDefault = css::chart::DataLabelPlacement::OUTSIDE;
3949 for (
const sal_Int32 nIdx : std::as_const(aAttrLabelIndices))
3951 uno::Reference<beans::XPropertySet> xLabelPropSet = xSeries->getDataPointByIndex(nIdx);
3953 if (!xLabelPropSet.is())
3956 pFS->startElement(
FSNS(XML_c, XML_dLbl));
3957 pFS->singleElement(
FSNS(XML_c, XML_idx), XML_val, OString::number(nIdx));
3962 chart2::RelativePosition aCustomLabelPosition;
3963 if( xLabelPropSet->getPropertyValue(
"CustomLabelPosition") >>= aCustomLabelPosition )
3965 pFS->startElement(
FSNS(XML_c, XML_layout));
3966 pFS->startElement(
FSNS(XML_c, XML_manualLayout));
3968 pFS->singleElement(
FSNS(XML_c, XML_x), XML_val, OString::number(aCustomLabelPosition.Primary));
3969 pFS->singleElement(
FSNS(XML_c, XML_y), XML_val, OString::number(aCustomLabelPosition.Secondary));
3971 SAL_WARN_IF(aCustomLabelPosition.Anchor != css::drawing::Alignment_TOP_LEFT,
"oox",
"unsupported anchor position");
3973 pFS->endElement(
FSNS(XML_c, XML_manualLayout));
3974 pFS->endElement(
FSNS(XML_c, XML_layout));
3978 if(
GetProperty(xLabelPropSet,
"LinkNumberFormatToSource") )
3979 mAny >>= bLinkedNumFmt;
3981 if( xLabelPropSet->getPropertyValue(
"Label") >>=
aLabel )
3982 bLabelIsNumberFormat =
aLabel.ShowNumber;
3984 bLabelIsNumberFormat =
true;
3986 if (
GetProperty(xLabelPropSet, bLabelIsNumberFormat ? OUString(
"NumberFormat") : OUString(
"PercentageNumberFormat")))
3993 pFS->singleElement(
FSNS(XML_c, XML_numFmt), XML_formatCode, aNumberFormatString,
3994 XML_sourceLinked,
ToPsz10(bLinkedNumFmt));
3998 writeLabelProperties(pFS,
this, xLabelPropSet, aParam, nIdx, rDLblsRange);
3999 pFS->endElement(
FSNS(XML_c, XML_dLbl));
4003 writeLabelProperties(pFS,
this, xPropSet, aParam, -1, rDLblsRange);
4005 bool bShowLeaderLines =
false;
4006 xPropSet->getPropertyValue(
"ShowCustomLeaderLines") >>= bShowLeaderLines;
4007 pFS->singleElement(
FSNS(XML_c, XML_showLeaderLines), XML_val,
ToPsz10(bShowLeaderLines));
4012 pFS->startElement(
FSNS(XML_c, XML_extLst));
4013 pFS->startElement(
FSNS(XML_c, XML_ext), XML_uri,
"{CE6537A1-D6FC-4f65-9D91-7224C49458BB}",
FSNS(XML_xmlns, XML_c15),
GetFB()->getNamespaceURL(OOX_NS(c15)));
4014 pFS->singleElement(
FSNS(XML_c15, XML_showLeaderLines), XML_val,
ToPsz10(bShowLeaderLines));
4015 pFS->endElement(
FSNS(XML_c, XML_ext));
4016 pFS->endElement(
FSNS(XML_c, XML_extLst));
4018 pFS->endElement(
FSNS(XML_c, XML_dLbls));
4022 const uno::Reference< beans::XPropertySet > & xSeriesProperties,
4023 sal_Int32 nSeriesLength, sal_Int32 eChartType )
4025 uno::Reference< chart2::XDataSeries > xSeries( xSeriesProperties, uno::UNO_QUERY );
4026 bool bVaryColorsByPoint =
false;
4028 if( xSeriesProperties.is())
4030 Any aAny = xSeriesProperties->getPropertyValue(
"AttributedDataPoints" );
4031 aAny >>= aDataPointSeq;
4032 xSeriesProperties->getPropertyValue(
"VaryColorsByPoint" ) >>= bVaryColorsByPoint;
4035 const sal_Int32 * pPoints = aDataPointSeq.getConstArray();
4039 xColorScheme.set(
mxNewDiagram->getDefaultColorScheme());
4041 if( bVaryColorsByPoint && xColorScheme.is() )
4044 aAttrPointSet.
reserve(aDataPointSeq.getLength());
4045 for (
auto p = pPoints;
p < pPoints + aDataPointSeq.getLength(); ++
p)
4047 const auto aEndIt = aAttrPointSet.
end();
4048 for( nElement = 0; nElement < nSeriesLength; ++nElement )
4050 uno::Reference< beans::XPropertySet > xPropSet;
4051 if( aAttrPointSet.
find( nElement ) != aEndIt )
4058 catch(
const uno::Exception & )
4072 pFS->startElement(
FSNS(XML_c, XML_dPt));
4073 pFS->singleElement(
FSNS(XML_c, XML_idx), XML_val, OString::number(nElement));
4080 if( xPropSet.is() &&
GetProperty( xPropSet,
"SegmentOffset") )
4082 sal_Int32 nOffset = 0;
4085 pFS->singleElement(
FSNS( XML_c, XML_explosion ),
4086 XML_val, OString::number( nOffset ) );
4095 pFS->endElement(
FSNS( XML_c, XML_dPt ) );
4101 if( bVaryColorsByPoint )
4105 aAttrPointSet.
reserve(aDataPointSeq.getLength());
4106 for (
auto p = pPoints;
p < pPoints + aDataPointSeq.getLength(); ++
p)
4108 const auto aEndIt = aAttrPointSet.
end();
4109 for( nElement = 0; nElement < nSeriesLength; ++nElement )
4111 uno::Reference< beans::XPropertySet > xPropSet;
4112 if( aAttrPointSet.
find( nElement ) != aEndIt )
4119 catch(
const uno::Exception & )
4128 pFS->startElement(
FSNS(XML_c, XML_dPt));
4129 pFS->singleElement(
FSNS(XML_c, XML_idx), XML_val, OString::number(nElement));
4131 switch( eChartType )
4136 pFS->singleElement(
FSNS(XML_c, XML_invertIfNegative), XML_val,
"0");
4151 pFS->endElement(
FSNS( XML_c, XML_dPt ) );
4158 sal_Int32 nAxisIdx, nAxisIdy;
4159 bool bPrimaryAxisExists =
false;
4160 bool bSecondaryAxisExists =
false;
4168 if ( bCheckCombinedAxes && ( bPrimaryAxisExists || bSecondaryAxisExists ) )
4170 nAxisIdx =
maAxes[0].nAxisId;
4171 nAxisIdy =
maAxes[1].nAxisId;
4179 maAxes.emplace_back( eXAxis, nAxisIdx, nAxisIdy );
4180 maAxes.emplace_back( eYAxis, nAxisIdy, nAxisIdx );
4183 pFS->singleElement(
FSNS(XML_c, XML_axId), XML_val, OString::number(nAxisIdx));
4184 pFS->singleElement(
FSNS(XML_c, XML_axId), XML_val, OString::number(nAxisIdy));
4187 sal_Int32 nAxisIdz = 0;
4193 pFS->singleElement(
FSNS(XML_c, XML_axId), XML_val, OString::number(nAxisIdz));
4207 const char* grouping =
nullptr;
4209 grouping =
"stacked";
4211 grouping =
"percentStacked";
4216 grouping =
"clustered";
4219 grouping =
"standard";
4221 pFS->singleElement(
FSNS(XML_c, XML_grouping), XML_val, grouping);
4228 if( !xRegressionCurveContainer.is() )
4234 if (!xRegCurve.is())
4241 if( !xServiceName.is() )
4244 aService = xServiceName->getServiceName();
4246 if(aService !=
"com.sun.star.chart2.LinearRegressionCurve" &&
4247 aService !=
"com.sun.star.chart2.ExponentialRegressionCurve" &&
4248 aService !=
"com.sun.star.chart2.LogarithmicRegressionCurve" &&
4249 aService !=
"com.sun.star.chart2.PotentialRegressionCurve" &&
4250 aService !=
"com.sun.star.chart2.PolynomialRegressionCurve" &&
4251 aService !=
"com.sun.star.chart2.MovingAverageRegressionCurve")
4254 pFS->startElement(
FSNS(XML_c, XML_trendline));
4257 xProperties->getPropertyValue(
"CurveName") >>=
aName;
4258 if(!
aName.isEmpty())
4260 pFS->startElement(
FSNS(XML_c, XML_name));
4261 pFS->writeEscaped(
aName);
4262 pFS->endElement(
FSNS( XML_c, XML_name) );
4267 if( aService ==
"com.sun.star.chart2.LinearRegressionCurve" )
4269 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"linear");
4271 else if( aService ==
"com.sun.star.chart2.ExponentialRegressionCurve" )
4273 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"exp");
4275 else if( aService ==
"com.sun.star.chart2.LogarithmicRegressionCurve" )
4277 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"log");
4279 else if( aService ==
"com.sun.star.chart2.PotentialRegressionCurve" )
4281 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"power");
4283 else if( aService ==
"com.sun.star.chart2.PolynomialRegressionCurve" )
4285 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"poly");
4287 sal_Int32 aDegree = 2;
4288 xProperties->getPropertyValue(
"PolynomialDegree") >>= aDegree;
4289 pFS->singleElement(
FSNS(XML_c, XML_order), XML_val, OString::number(aDegree));
4291 else if( aService ==
"com.sun.star.chart2.MovingAverageRegressionCurve" )
4293 pFS->singleElement(
FSNS(XML_c, XML_trendlineType), XML_val,
"movingAvg");
4295 sal_Int32 aPeriod = 2;
4296 xProperties->getPropertyValue(
"MovingAveragePeriod") >>= aPeriod;
4298 pFS->singleElement(
FSNS(XML_c, XML_period), XML_val, OString::number(aPeriod));
4307 double fExtrapolateForward = 0.0;
4308 double fExtrapolateBackward = 0.0;
4310 xProperties->getPropertyValue(
"ExtrapolateForward") >>= fExtrapolateForward;
4311 xProperties->getPropertyValue(
"ExtrapolateBackward") >>= fExtrapolateBackward;
4313 pFS->singleElement(
FSNS( XML_c, XML_forward ),
4314 XML_val, OString::number(fExtrapolateForward) );
4316 pFS->singleElement(
FSNS( XML_c, XML_backward ),
4317 XML_val, OString::number(fExtrapolateBackward) );
4319 bool bForceIntercept =
false;
4320 xProperties->getPropertyValue(
"ForceIntercept") >>= bForceIntercept;
4322 if (bForceIntercept)
4324 double fInterceptValue = 0.0;
4325 xProperties->getPropertyValue(
"InterceptValue") >>= fInterceptValue;
4327 pFS->singleElement(
FSNS( XML_c, XML_intercept ),
4328 XML_val, OString::number(fInterceptValue) );
4335 bool bShowEquation =
false;
4336 xEquationProperties->getPropertyValue(
"ShowEquation") >>= bShowEquation;
4339 bool bShowCorrelationCoefficient =
false;
4340 xEquationProperties->getPropertyValue(
"ShowCorrelationCoefficient") >>= bShowCorrelationCoefficient;
4342 pFS->singleElement(
FSNS( XML_c, XML_dispRSqr ),
4343 XML_val,
ToPsz10(bShowCorrelationCoefficient) );
4345 pFS->singleElement(
FSNS(XML_c, XML_dispEq), XML_val,
ToPsz10(bShowEquation));
4347 pFS->endElement(
FSNS( XML_c, XML_trendline ) );
4353 chart2::Symbol aSymbol;
4357 if(aSymbol.Style != chart2::SymbolStyle_STANDARD && aSymbol.Style != chart2::SymbolStyle_NONE)
4361 pFS->startElement(
FSNS(XML_c, XML_marker));
4363 sal_Int32 nSymbol = aSymbol.StandardSymbol;
4365 const char* pSymbolType;
4370 pSymbolType =
"square";
4373 pSymbolType =
"diamond";
4379 pSymbolType =
"triangle";
4382 pSymbolType =
"circle";
4385 pSymbolType =
"star";
4391 pSymbolType =
"plus";
4394 pSymbolType =
"dash";
4397 pSymbolType =
"square";
4401 bool bSkipFormatting =
false;
4402 if (aSymbol.Style == chart2::SymbolStyle_NONE)
4404 bSkipFormatting =
true;
4405 pSymbolType =
"none";
4408 pFS->singleElement(
FSNS(XML_c, XML_symbol), XML_val, pSymbolType);
4410 if (!bSkipFormatting)
4412 awt::Size aSymbolSize = aSymbol.Size;
4413 sal_Int32 nSize = std::max( aSymbolSize.Width, aSymbolSize.Height );
4415 nSize = nSize/250.0*7.0 + 1;
4417 nSize = std::clamp(
int(nSize), 2, 72 );
4418 pFS->singleElement(
FSNS(XML_c, XML_size), XML_val, OString::number(nSize));
4420 pFS->startElement(
FSNS(XML_c, XML_spPr));
4422 util::Color aColor = aSymbol.FillColor;
4428 pFS->singleElement(
FSNS(XML_a, XML_noFill));
4433 pFS->endElement(
FSNS( XML_c, XML_spPr ) );
4436 pFS->endElement(
FSNS( XML_c, XML_marker ) );
4443 sal_Int32 nSplineType = 0;
4445 mAny >>= nSplineType;
4446 const char* pVal = nSplineType != 0 ?
"1" :
"0";
4447 pFS->singleElement(
FSNS(XML_c, XML_smooth), XML_val, pVal);
4453 sal_Int32 nStartingAngle = 0;
4456 mAny >>= nStartingAngle;
4459 nStartingAngle = (450 - nStartingAngle ) % 360;
4460 pFS->singleElement(
FSNS(XML_c, XML_firstSliceAng), XML_val, OString::number(nStartingAngle));
4465const char* getErrorBarStyle(sal_Int32 nErrorBarStyle)
4467 switch(nErrorBarStyle)
4469 case cssc::ErrorBarStyle::NONE:
4471 case cssc::ErrorBarStyle::VARIANCE:
4473 case cssc::ErrorBarStyle::STANDARD_DEVIATION:
4475 case cssc::ErrorBarStyle::ABSOLUTE:
4477 case cssc::ErrorBarStyle::RELATIVE:
4478 return "percentage";
4479 case cssc::ErrorBarStyle::ERROR_MARGIN:
4481 case cssc::ErrorBarStyle::STANDARD_ERROR:
4483 case cssc::ErrorBarStyle::FROM_DATA:
4486 assert(
false &&
"can't happen");
4491Reference< chart2::data::XDataSequence> getLabeledSequence(
4492 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > >& aSequences,
4501 for(
const auto& rSequence : aSequences )
4505 uno::Reference< chart2::data::XDataSequence > xSequence( rSequence->getValues());
4506 uno::Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW );
4508 if( ( xSeqProp->getPropertyValue(
"Role" ) >>= aRole ) &&
4509 aRole.match(
"error-bars" ) && aRole.indexOf(aDirection) >= 0 )
4516 return Reference< chart2::data::XDataSequence > ();
4523 sal_Int32 nErrorBarStyle = cssc::ErrorBarStyle::NONE;
4524 xErrorBarProps->getPropertyValue(
"ErrorBarStyle") >>= nErrorBarStyle;
4525 const char* pErrorBarStyle = getErrorBarStyle(nErrorBarStyle);
4530 pFS->startElement(
FSNS(XML_c, XML_errBars));
4531 pFS->singleElement(
FSNS(XML_c, XML_errDir), XML_val, bYError ?
"y" :
"x");
4532 bool bPositive =
false, bNegative =
false;
4533 xErrorBarProps->getPropertyValue(
"ShowPositiveError") >>= bPositive;
4534 xErrorBarProps->getPropertyValue(
"ShowNegativeError") >>= bNegative;
4535 const char* pErrBarType;
4536 if(bPositive && bNegative)
4537 pErrBarType =
"both";
4539 pErrBarType =
"plus";
4541 pErrBarType =
"minus";
4546 pErrBarType =
"both";
4548 pFS->singleElement(
FSNS(XML_c, XML_errBarType), XML_val, pErrBarType);
4549 pFS->singleElement(
FSNS(XML_c, XML_errValType), XML_val, pErrorBarStyle);
4550 pFS->singleElement(
FSNS(XML_c, XML_noEndCap), XML_val,
"0");
4551 if(nErrorBarStyle == cssc::ErrorBarStyle::FROM_DATA)
4553 uno::Reference< chart2::data::XDataSource > xDataSource(xErrorBarProps, uno::UNO_QUERY);
4555 xDataSource->getDataSequences();
4570 if(nErrorBarStyle == cssc::ErrorBarStyle::STANDARD_DEVIATION)
4572 xErrorBarProps->getPropertyValue(
"Weight") >>= nVal;
4577 xErrorBarProps->getPropertyValue(
"PositiveError") >>= nVal;
4579 xErrorBarProps->getPropertyValue(
"NegativeError") >>= nVal;
4582 pFS->singleElement(
FSNS(XML_c, XML_val), XML_val, OString::number(nVal));
4587 pFS->endElement(
FSNS( XML_c, XML_errBars) );
4593 if( !xPropSet.is() )
4596 pFS->startElement(
FSNS(XML_c, XML_view3D));
4599 if(
GetProperty( xPropSet,
"RotationHorizontal" ) )
4601 sal_Int32 nRotationX = 0;
4602 mAny >>= nRotationX;
4603 if( nRotationX < 0 )
4615 pFS->singleElement(
FSNS(XML_c, XML_rotX), XML_val, OString::number(nRotationX));
4624 sal_Int32 nStartingAngle=0;
4625 mAny >>= nStartingAngle;
4627 nStartingAngle = (450 - nStartingAngle ) % 360;
4628 pFS->singleElement(
FSNS(XML_c, XML_rotY), XML_val, OString::number(nStartingAngle));
4632 sal_Int32 nRotationY = 0;
4633 mAny >>= nRotationY;
4635 if( nRotationY < 0 )
4637 pFS->singleElement(
FSNS(XML_c, XML_rotY), XML_val, OString::number(nRotationY));
4643 bool bRightAngled =
false;
4644 mAny >>= bRightAngled;
4645 const char* sRightAngled = bRightAngled ?
"1":
"0";
4646 pFS->singleElement(
FSNS(XML_c, XML_rAngAx), XML_val, sRightAngled);
4651 sal_Int32 nPerspective = 0;
4652 mAny >>= nPerspective;
4655 pFS->singleElement(
FSNS(XML_c, XML_perspective), XML_val, OString::number(nPerspective));
4657 pFS->endElement(
FSNS( XML_c, XML_view3D ) );
4662 bool isDeep =
false;
4678 OUString aCode(
"General");
4679 uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(
mxChartModel, uno::UNO_QUERY_THROW);
4680 SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xNumberFormatsSupplier);
4685 if (!pNumberFormatter)
std::unordered_set< sal_Int32 > maAllowedValues
static css::uno::Reference< css::beans::XPropertySet > createOldAPIDataPointPropertySet(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, sal_Int32 nPointIndex, const css::uno::Reference< css::frame::XModel > &xChartModel)
static css::uno::Reference< css::beans::XPropertySet > createOldAPISeriesPropertySet(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const css::uno::Reference< css::frame::XModel > &xChartModel)
void reserve(size_type amount)
const_iterator find(const Value &x) const
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
A wrapper for a UNO property set.
bool getBoolProperty(sal_Int32 nPropId) const
Gets the specified boolean property from the property set.
bool getProperty(Type &orValue, sal_Int32 nPropId) const
Gets the specified property from the property set.
const css::uno::Reference< css::lang::XMultiServiceFactory > & getModelFactory() const
Returns the service factory provided by the document model (always existing).
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
Adds new relation.
OUString getNamespaceURL(sal_Int32 nNSID) const
const css::uno::Reference< css::frame::XModel > & getModel() const
void _exportAxis(const css::uno::Reference< css::beans::XPropertySet > &xAxisProp, const css::uno::Reference< css::drawing::XShape > &xAxisTitle, const css::uno::Reference< css::beans::XPropertySet > &xMajorGrid, const css::uno::Reference< css::beans::XPropertySet > &xMinorGrid, sal_Int32 nAxisType, const char *sAxisPos, const AxisIdPair &rAxisIdPair)
void exportAdditionalShapes(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc)
void exportVaryColors(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportAllSeries(const css::uno::Reference< css::chart2::XChartType > &xChartType, bool &rPrimaryAxes)
void exportScatterChartSeries(const css::uno::Reference< css::chart2::XChartType > &xChartType, const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > *pSeries)
void exportPlotArea(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc)
void exportShapeProps(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
css::uno::Reference< css::chart2::XDiagram > mxNewDiagram
void exportExternalData(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc)
void exportBitmapFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportSeries(const css::uno::Reference< css::chart2::XChartType > &xChartType, const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > &rSeriesSeq, bool &rPrimaryAxes)
void exportRadarChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportAxesId(bool bPrimaryAxes, bool bCheckCombinedAxes=false)
void exportMissingValueTreatment(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportLegend(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc)
void InitRangeSegmentationProperties(const css::uno::Reference< css::chart2::XChartDocument > &xChartDoc)
void exportMarker(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues
void exportHatch(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportDoughnutChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
css::uno::Reference< css::chart::XDiagram > mxDiagram
void exportAreaChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportTrendlines(const css::uno::Reference< css::chart2::XDataSeries > &xSeries)
void exportSolidFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportBubbleChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportManualLayout(const css::chart2::RelativePosition &rPos, const css::chart2::RelativeSize &rSize, const bool bIsExcludingDiagramPositioning)
void exportDataLabels(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType, DataLabelsRange &rDLblsRange)
void exportFirstSliceAng()
std::set< sal_Int32 > maExportedAxis
void exportTitle(const css::uno::Reference< css::drawing::XShape > &xShape, const OUString *pSubText=nullptr)
void exportScatterChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportSurfaceChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportChart(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc)
OUString parseFormula(const OUString &rRange)
void SetURLTranslator(const std::shared_ptr< URLTransformer > &pTransformer)
void exportChartSpace(const css::uno::Reference< css::chart::XChartDocument > &rChartDoc, bool bIncludeTable)
css::uno::Sequence< css::uno::Sequence< rtl::OUString > > getSplitCategoriesList(const OUString &rRange)
void exportSeriesCategory(const css::uno::Reference< css::chart2::data::XDataSequence > &xValueSeq, sal_Int32 nValueType=XML_cat)
void exportPieChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportSeriesText(const css::uno::Reference< css::chart2::data::XDataSequence > &xValueSeq)
void exportDataPoints(const css::uno::Reference< css::beans::XPropertySet > &xSeriesProperties, sal_Int32 nSeriesLength, sal_Int32 eChartType)
void exportCandleStickSeries(const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > &aSeriesSeq, bool &rPrimaryAxes)
void exportFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportGrouping(bool isBar=false)
css::uno::Reference< css::frame::XModel > mxChartModel
ChartExport(sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel > const &xModel, ::oox::core::XmlFilterBase *pFB, DocumentType eDocumentType)
OUString getNumberFormatCode(sal_Int32 nKey) const
void exportErrorBar(const css::uno::Reference< css::beans::XPropertySet > &xErrorBarProps, bool bYError)
void exportTextProps(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportGradientFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportLineChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportUpDownBars(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportStockChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
std::shared_ptr< URLTransformer > mpURLTransformer
void exportSeriesValues(const css::uno::Reference< css::chart2::data::XDataSequence > &xValueSeq, sal_Int32 nValueType=XML_val)
void WriteChartObj(const css::uno::Reference< css::drawing::XShape > &xShape, sal_Int32 nID, sal_Int32 nChartCount)
void exportBarChart(const css::uno::Reference< css::chart2::XChartType > &xChartType)
void exportAxis(const AxisIdPair &rAxisIdPair)
A helper container class to collect the chart data point labels and the address of the cell[range] fr...
const OUString & getRange() const
Returns the address of the cell[range] from which label contents are sourced.
void setRange(const OUString &rRange)
Sets the address of the cell[range] from which label contents are sourced.
bool empty() const
Returns whether the container is empty or not.
void setLabel(sal_Int32 nIndex, const OUString &rText)
Adds a new indexed label text.
LabelsRangeMap::const_iterator begin() const
size_t count() const
Returns the count of labels stored.
bool hasLabel(sal_Int32 nIndex) const
Indicates whether the container has a label with index specified by nIndex.
LabelsRangeMap::const_iterator end() const
static sal_Int32 getNewDrawingUniqueId()
::oox::core::XmlFilterBase * mpFB
void WriteGradientFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
static void WriteFromTo(const css::uno::Reference< css::drawing::XShape > &rXShape, const css::awt::Size &aPageSize, const sax_fastparser::FSHelperPtr &pDrawing)
::sax_fastparser::FSHelperPtr mpFS
bool GetProperty(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &aName)
void SetFS(::sax_fastparser::FSHelperPtr pFS)
const ::sax_fastparser::FSHelperPtr & GetFS() const
::oox::core::XmlFilterBase * GetFB()
DocumentType GetDocumentType() const
void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape > &rXShape, sal_Int32 nXmlNamespace, bool bFlipH=false, bool bFlipV=false, bool bSuppressRotation=false, bool bSuppressFlipping=false, bool bFlippedBeforeRotation=false)
void WriteSolidFill(::Color nColor, sal_Int32 nAlpha=MAX_PERCENT)
void WritePattFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, const char *sRelationshipType, OUString *pRelationshipId)
void WriteOutline(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, css::uno::Reference< css::frame::XModel > const &xModel=nullptr)
void WriteXGraphicBlipFill(css::uno::Reference< css::beans::XPropertySet > const &rXPropSet, css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia=false)
void WriteRunProperties(const css::uno::Reference< css::beans::XPropertySet > &rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect, bool &rbOverridingCharHeight, sal_Int32 &rnCharHeight, sal_Int16 nScriptType=css::i18n::ScriptType::LATIN, const css::uno::Reference< css::beans::XPropertySet > &rXShapePropSet={})
ShapeExport & WriteShape(const css::uno::Reference< css::drawing::XShape > &xShape)
Write the DrawingML for a particular shape.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define TOOLS_INFO_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
Sequence< PropertyValue > aArguments
#define LANGUAGE_ENGLISH_US
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
double getLength(const B2DPolygon &rCandidate)
enum SAL_DLLPUBLIC_RTTI FillStyle
int uniform_int_distribution(int a, int b)
Reference< XComponentContext > getProcessComponentContext()
std::shared_ptr< T > make_shared(Args &&... args)
constexpr T & temporary(T &&x)
const TypeGroupInfo & GetTypeGroupInfo(TypeId eType)
TypeId
Enumerates different chart types.
@ TYPEID_RADARLINE
Stock chart.
@ TYPEID_SURFACE
Bubble chart.
@ TYPEID_OFPIE
Doughnut (ring) chart.
@ TYPEID_LINE
Horizontal bar chart.
@ TYPEID_HORBAR
Vertical bar chart.
@ TYPEID_PIE
Filled radar chart.
@ TYPEID_UNKNOWN
Surface chart.
@ TYPEID_DOUGHNUT
Pie chart.
@ TYPEID_BUBBLE
Scatter (XY) chart.
@ TYPEID_RADARAREA
Linear radar chart.
@ TYPEID_SCATTER
Pie-to-pie or pie-to-bar chart.
@ TYPEID_STOCK
Area chart.
static bool lcl_isSeriesAttachedToFirstAxis(const Reference< chart2::XDataSeries > &xDataSeries)
static OUString lcl_flattenStringSequence(const Sequence< OUString > &rSequence)
static sal_Int32 lcl_getAlphaFromTransparenceGradient(const awt::Gradient &rGradient, bool bStart)
OString calcRotationValue(sal_Int32 nRotation)
nRotation is a 100th of a degree and the return value is in a 60,000th of a degree
static ::std::vector< double > lcl_getAllValuesFromSequence(const Reference< chart2::data::XDataSequence > &xSeq)
static Sequence< OUString > lcl_getLabelSequence(const Reference< chart2::data::XDataSequence > &xLabelSeq)
static sal_Int32 lcl_getCategoryAxisType(const Reference< chart2::XDiagram > &xDiagram, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex)
static sal_Int32 lcl_getChartType(std::u16string_view sChartType)
static bool lcl_isCategoryAxisShifted(const Reference< chart2::XDiagram > &xDiagram)
static void lcl_fillCategoriesIntoStringVector(const Reference< chart2::data::XDataSequence > &xCategories, ::std::vector< OUString > &rOutCategories)
static Reference< chart2::data::XLabeledDataSequence > lcl_getCategories(const Reference< chart2::XDiagram > &xDiagram, bool &bHasDateCategories)
static cssc::TimeIncrement lcl_getDateTimeIncrement(const Reference< chart2::XDiagram > &xDiagram, sal_Int32 nAxisIndex)
static bool lcl_hasCategoryLabels(const Reference< chart2::XChartDocument > &xChartDoc)
static OUString lclGetTimeUnitToken(sal_Int32 nTimeUnit)
const sal_Int32 MAX_PERCENT
static Reference< chart2::data::XLabeledDataSequence > lcl_getDataSequenceByRole(const Sequence< Reference< chart2::data::XLabeledDataSequence > > &aLabeledSeq, const OUString &rRole)
const sal_Int32 PER_PERCENT
static sal_Int32 lcl_generateRandomValue()
sal_Int64 convertHmmToEmu(sal_Int32 nValue)
Converts the passed 32-bit integer value from 1/100 mm to EMUs.
OUString getRelationship(Relationship eRelationship)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
bool getOutputStream(ProgramOptions const &options, OString const &extension, std::ostream **ppOutputStream, OString &targetSourceFileName, OString &tmpSourceFileName)
::std::array< OUString, NF_KEYWORD_ENTRIES_COUNT > NfKeywordTable
std::unique_ptr< uint8_t[]> pLabels
Contains info for a chart type related to the OpenOffice.org chart module.
sal_Int32 mnDefLabelPos
Mode for varying point colors.
Reference< XModel > xModel
css::drawing::Direction3D aDirection
static constexpr const char * ToPsz10(bool b)