include/oox/export/chartexport.hxx | 3 - include/oox/token/relationship.hxx | 1 oox/source/export/chartexport.cxx | 91 ++++++++----------------------------- oox/source/token/namespaces.txt | 1 oox/source/token/relationship.inc | 1 oox/source/token/tokens.txt | 1 6 files changed, 22 insertions(+), 76 deletions(-)
New commits: commit c2222e8fba458e50abede06fc8b98daefbb52b30 Author: Kurt Nordback <[email protected]> AuthorDate: Thu Jan 22 11:25:12 2026 -0700 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Jan 26 11:58:07 2026 +0100 Revert "tdf#165742 Step 4.2: Establish a narrow export path for chartex" This reverts commit af5e0a5470f55835edeefa051a88a79979ffb1df. Change-Id: If905e3a45aee4936f0a110a4bdf0d512726a9a39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197904 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx index 9d76e78ab84f..1da778fe4808 100644 --- a/include/oox/export/chartexport.hxx +++ b/include/oox/export/chartexport.hxx @@ -177,9 +177,6 @@ private: void exportChart( const css::uno::Reference< css::chart::XChartDocument >& rChartDoc, bool bIsChartex); - void exportData( const css::uno::Reference< - css::chart::XChartDocument >& rChartDoc, - bool bIsChartex); void exportExternalData( const css::uno::Reference< css::chart::XChartDocument >& rChartDoc, bool bIsChartex); diff --git a/include/oox/token/relationship.hxx b/include/oox/token/relationship.hxx index 2879895c3b92..b3a8ffe58bc8 100644 --- a/include/oox/token/relationship.hxx +++ b/include/oox/token/relationship.hxx @@ -20,7 +20,6 @@ enum class Relationship { ACTIVEXCONTROLBINARY, CHART, - CHARTEX, CHARTUSERSHAPES, COMMENTS, COMMENTAUTHORS, diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index fecd8431f770..e1cac13f5af3 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -787,8 +787,7 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nI if (bIsChartex) { // Do the AlternateContent header - mpFS->startElementNS(XML_mc, XML_AlternateContent, FSNS(XML_xmlns, XML_mc), - "http://schemas.openxmlformats.org/markup-compatibility/2006"); + mpFS->startElementNS(XML_mc, XML_AlternateContent); mpFS->startElementNS(XML_mc, XML_Choice, FSNS(XML_xmlns, XML_cx2), "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex", XML_Requires, "cx2"); @@ -894,29 +893,21 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nI .appendAscii(sChartFnamePrefix) .append(OUString::number(nChartCount) + ".xml" ) .makeStringAndClear(); - - const OUString sAppURL = bIsChartex? - u"application/vnd.ms-office.chartex+xml"_ustr : - u"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"_ustr; - - const Relationship eChartRel = bIsChartex ? - Relationship::CHARTEX : - Relationship::CHART; - FSHelperPtr pChart = CreateOutputStream( sFullStream, sRelativeStream, pFS->getOutputStream(), - sAppURL, - oox::getRelationship(eChartRel), + u"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"_ustr, + oox::getRelationship(Relationship::CHART), &sId ); XmlFilterBase* pFB = GetFB(); if (bIsChartex) { - // Use chartex namespace + // There's no dmlChartex namespace, but using that to avoid hard-coding + // the URL here pFS->singleElement( FSNS( XML_cx, XML_chart ), - FSNS(XML_xmlns, XML_cx), pFB->getNamespaceURL(OOX_NS(cx)), + FSNS(XML_xmlns, XML_cx), pFB->getNamespaceURL(OOX_NS(dmlChartex)), FSNS(XML_xmlns, XML_r), pFB->getNamespaceURL(OOX_NS(officeRel)), FSNS(XML_r, XML_id), sId ); } else { @@ -934,6 +925,8 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nI // Do the AlternateContent fallback path pFS->endElementNS(XML_mc, XML_Choice); pFS->startElementNS(XML_mc, XML_Fallback); + // TODO: export bitmap shape as fallback + pFS->startElementNS(XML_xdr, XML_sp, XML_macro, "", XML_textlink, ""); pFS->startElementNS(XML_xdr, XML_nvSpPr); pFS->singleElementNS(XML_xdr, XML_cNvPr, XML_id, "0", XML_name, ""); @@ -1055,17 +1048,10 @@ void ChartExport::exportChartSpace( const Reference< css::chart::XChartDocument const sal_Int32 nChartNS = bIsChartex ? XML_cx : XML_c; - if (bIsChartex) { - pFS->startElement( FSNS( nChartNS, XML_chartSpace ), - FSNS( XML_xmlns, XML_a ), pFB->getNamespaceURL(OOX_NS(dml)), - FSNS( XML_xmlns, XML_r ), pFB->getNamespaceURL(OOX_NS(officeRel)), - FSNS( XML_xmlns, XML_cx ), pFB->getNamespaceURL(OOX_NS(cx))); - } else { - pFS->startElement( FSNS( nChartNS, XML_chartSpace ), - FSNS( XML_xmlns, XML_c ), pFB->getNamespaceURL(OOX_NS(dmlChart)), - FSNS( XML_xmlns, XML_a ), pFB->getNamespaceURL(OOX_NS(dml)), - FSNS( XML_xmlns, XML_r ), pFB->getNamespaceURL(OOX_NS(officeRel))); - } + pFS->startElement( FSNS( nChartNS, XML_chartSpace ), + FSNS( XML_xmlns, nChartNS ), pFB->getNamespaceURL(OOX_NS(dmlChart)), + FSNS( XML_xmlns, XML_a ), pFB->getNamespaceURL(OOX_NS(dml)), + FSNS( XML_xmlns, XML_r ), pFB->getNamespaceURL(OOX_NS(officeRel))); if( !bIncludeTable ) { @@ -1080,10 +1066,7 @@ void ChartExport::exportChartSpace( const Reference< css::chart::XChartDocument if (bIsChartex) { // chartData pFS->startElement(FSNS(XML_cx, XML_chartData)); - exportExternalData(xChartDoc, true); - exportData(xChartDoc, true); - pFS->endElement(FSNS(XML_cx, XML_chartData)); } else { pFS->singleElement(FSNS(XML_c, XML_lang), XML_val, "en-US"); @@ -1116,25 +1099,6 @@ void ChartExport::exportChartSpace( const Reference< css::chart::XChartDocument pFS->endElement( FSNS( nChartNS, XML_chartSpace ) ); } -void ChartExport::exportData( [[maybe_unused]] const Reference< css::chart::XChartDocument >& xChartDoc, - bool bIsChartex) -{ - if (bIsChartex) { - FSHelperPtr pFS = GetFS(); - - pFS->startElement(FSNS(XML_cx, XML_data), XML_id, "0"); - // Just hard-coding this for now - pFS->startElement(FSNS(XML_cx, XML_numDim), XML_type, "val"); - pFS->startElement(FSNS(XML_cx, XML_f)); - pFS->writeEscaped("_xlchart.v2.0"); // I have no idea what this - // means or what it should be in - // general - pFS->endElement(FSNS(XML_cx, XML_f)); - pFS->endElement(FSNS(XML_cx, XML_numDim)); - pFS->endElement(FSNS(XML_cx, XML_data)); - } -} - void ChartExport::exportExternalData( const Reference< css::chart::XChartDocument >& xChartDoc, bool bIsChartex) { @@ -1334,6 +1298,7 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC pFS->startElement(FSNS(nChartNS, XML_chart)); // titles + const char * const sTitleDelVal = "1"; if( bHasMainTitle ) { exportTitle( xChartDoc->getTitle(), bIsChartex, xFormattedSubTitle); @@ -1349,7 +1314,7 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC } } else if (!bIsChartex) { - pFS->singleElement(FSNS(XML_c, XML_autoTitleDeleted), XML_val, "1"); + pFS->singleElement(FSNS(XML_c, XML_autoTitleDeleted), XML_val, sTitleDelVal); } InitPlotArea( ); @@ -1686,22 +1651,14 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape, bool bIsCharte pFS->endElement(FSNS(XML_cx, XML_v)); pFS->endElement(FSNS(XML_cx, XML_txData)); pFS->endElement(FSNS(XML_cx, XML_tx)); + + pFS->startElement(FSNS(XML_cx, XML_txPr)); } else { pFS->startElement(FSNS(XML_c, XML_title)); pFS->startElement(FSNS(XML_c, XML_tx)); pFS->startElement(FSNS(XML_c, XML_rich)); } - if (bIsChartex) { - // shape properties - if( xPropSet.is() ) - { - exportShapeProps( xPropSet, bIsChartex ); - } - - pFS->startElement(FSNS(XML_cx, XML_txPr)); - } - // TODO: bodyPr const char* sWritingMode = nullptr; bool bVertical = false; @@ -1825,12 +1782,10 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape, bool bIsCharte pFS->singleElement(FSNS(XML_c, XML_overlay), XML_val, "0"); } - if (!bIsChartex) { - // shape properties - if( xPropSet.is() ) - { - exportShapeProps( xPropSet, bIsChartex ); - } + // shape properties + if( xPropSet.is() ) + { + exportShapeProps( xPropSet, bIsChartex ); } if (bIsChartex) { @@ -2065,11 +2020,6 @@ void ChartExport::exportPlotArea(const Reference< css::chart::XChartDocument >& } } - - if (bIsChartex) { - pFS->endElement( FSNS( XML_cx, XML_plotAreaRegion ) ); - } - //Axis Data exportAxes( bIsChartex ); @@ -2108,6 +2058,7 @@ void ChartExport::exportPlotArea(const Reference< css::chart::XChartDocument >& } if (bIsChartex) { + pFS->endElement( FSNS( XML_cx, XML_plotAreaRegion ) ); pFS->endElement( FSNS( XML_cx, XML_plotArea ) ); } else { pFS->endElement( FSNS( XML_c, XML_plotArea ) ); diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index d24fa7685e5f..ce51091c1252 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -48,6 +48,7 @@ ppt http://schemas.openxmlformats.org/presentationml/2006/ma dml http://schemas.openxmlformats.org/drawingml/2006/main dsp http://schemas.microsoft.com/office/drawing/2008/diagram dmlChart http://schemas.openxmlformats.org/drawingml/2006/chart +dmlChartex http://schemas.microsoft.com/office/drawing/2014/chartex dmlChartDr http://schemas.openxmlformats.org/drawingml/2006/chartDrawing dmlDiagram http://schemas.openxmlformats.org/drawingml/2006/diagram dmlLockedCanvas http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas diff --git a/oox/source/token/relationship.inc b/oox/source/token/relationship.inc index a63e1c6e71d2..0860d518a874 100644 --- a/oox/source/token/relationship.inc +++ b/oox/source/token/relationship.inc @@ -1,6 +1,5 @@ {Relationship::ACTIVEXCONTROLBINARY, u"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"}, {Relationship::CHART, u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"}, -{Relationship::CHARTEX, u"http://schemas.microsoft.com/office/2014/relationships/chartEx"}, {Relationship::CHARTUSERSHAPES, u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes"}, {Relationship::COMMENTS, u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"}, {Relationship::COMMENTAUTHORS, u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"}, diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt index 883e68f12def..c561f1170f32 100644 --- a/oox/source/token/tokens.txt +++ b/oox/source/token/tokens.txt @@ -3668,7 +3668,6 @@ null num numCache numCol -numDim numFmt numFmtId numFmts
