chart2/qa/extras/chart2export2.cxx                |    2 
 oox/inc/drawingml/chart/axiscontext.hxx           |   11 ---
 oox/inc/drawingml/chart/titlecontext.hxx          |    4 -
 oox/source/drawingml/chart/axiscontext.cxx        |   69 ----------------------
 oox/source/drawingml/chart/chartcontextbase.cxx   |    6 -
 oox/source/drawingml/chart/chartspacefragment.cxx |    8 --
 oox/source/drawingml/chart/plotareacontext.cxx    |    9 --
 oox/source/drawingml/chart/titlecontext.cxx       |   20 +-----
 oox/source/drawingml/chart/titleconverter.cxx     |   37 -----------
 oox/source/export/chartexport.cxx                 |    7 --
 10 files changed, 13 insertions(+), 160 deletions(-)

New commits:
commit fb782008bb496a8c97c699ce5dec60bc1c851c5a
Author:     Kurt Nordback <[email protected]>
AuthorDate: Wed Jan 21 17:57:38 2026 -0700
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon Jan 26 11:56:57 2026 +0100

    Revert "tdf#165742 Step 4.5: Establish a narrow export path for chartex"
    
    This reverts commit 6de001396a11ff59a8a8b81d158019823ab6a6ee.
    
    Change-Id: I10a5c52e17170072d6db3668d2eed437b5f10329
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197901
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/chart2/qa/extras/chart2export2.cxx 
b/chart2/qa/extras/chart2export2.cxx
index 9f3235f098f1..014e2ba600ec 100644
--- a/chart2/qa/extras/chart2export2.cxx
+++ b/chart2/qa/extras/chart2export2.cxx
@@ -167,8 +167,6 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, 
testChartexTitleXLSX)
         
"/cx:chartSpace/cx:chart/cx:plotArea/cx:plotAreaRegion/cx:series/cx:spPr/"
         "a:solidFill/a:srgbClr",
         "val", u"c55a11");
-    assertXPathContent(pXmlDoc, 
"/cx:chartSpace/cx:chart/cx:title/cx:tx/cx:txData/cx:v",
-                       u"Funnel chart!");
 }
 
 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testAxisTitleRotationXLSX)
diff --git a/oox/inc/drawingml/chart/axiscontext.hxx 
b/oox/inc/drawingml/chart/axiscontext.hxx
index 5cbb2651e5fc..ad240a4a76ab 100644
--- a/oox/inc/drawingml/chart/axiscontext.hxx
+++ b/oox/inc/drawingml/chart/axiscontext.hxx
@@ -101,17 +101,6 @@ public:
     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs ) override;
 };
 
-/** Handler for a chartex axis context (<cx:axis> element).
- */
-class CxAxisContext final : public AxisContextBase
-{
-public:
-    explicit            CxAxisContext( ::oox::core::ContextHandler2Helper& 
rParent, AxisModel& rModel, sal_Int32 nId );
-    virtual             ~CxAxisContext() override;
-
-    virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs ) override;
-};
-
 
 } // namespace oox::drawingml::chart
 
diff --git a/oox/inc/drawingml/chart/titlecontext.hxx 
b/oox/inc/drawingml/chart/titlecontext.hxx
index df33b32b58fc..cb7383a7eb19 100644
--- a/oox/inc/drawingml/chart/titlecontext.hxx
+++ b/oox/inc/drawingml/chart/titlecontext.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
 #define INCLUDED_OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
 
-#include <oox/token/tokens.hxx>
 #include <drawingml/chart/chartcontextbase.hxx>
 
 namespace oox::drawingml::chart {
@@ -74,8 +73,7 @@ struct LegendModel;
 class LegendContext final : public ContextBase< LegendModel >
 {
 public:
-    explicit            LegendContext( ::oox::core::ContextHandler2Helper& 
rParent,
-            LegendModel& rModel, bool bOverlay = false, sal_Int32 nPos = 
XML_r);
+    explicit            LegendContext( ::oox::core::ContextHandler2Helper& 
rParent, LegendModel& rModel );
     virtual             ~LegendContext() override;
 
     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs ) override;
diff --git a/oox/source/drawingml/chart/axiscontext.cxx 
b/oox/source/drawingml/chart/axiscontext.cxx
index cbab186f1ed9..8f1defe40bea 100644
--- a/oox/source/drawingml/chart/axiscontext.cxx
+++ b/oox/source/drawingml/chart/axiscontext.cxx
@@ -293,75 +293,6 @@ ContextHandlerRef ValAxisContext::onCreateContext( 
sal_Int32 nElement, const Att
     return AxisContextBase::onCreateContext( nElement, rAttribs );
 }
 
-CxAxisContext::CxAxisContext( ContextHandler2Helper& rParent, AxisModel& 
rModel,
-        sal_Int32 nId) :
-    AxisContextBase( rParent, rModel )
-{
-    mrModel.mnAxisId = nId;
-}
-
-CxAxisContext::~CxAxisContext()
-{
-}
-
-ContextHandlerRef CxAxisContext::onCreateContext( sal_Int32 nElement, const 
AttributeList& rAttribs )
-{
-    if( isRootElement() ) switch( nElement )
-    {
-        case CX_TOKEN(catScaling) :
-            // TODO: figure out how to get gapWidth attribute to the right 
place
-            return nullptr;
-        case CX_TOKEN(valScaling) :
-            if (rAttribs.hasAttribute(XML_max)) {
-                mrModel.mofMax = rAttribs.getDouble(XML_max);
-            }
-            if (rAttribs.hasAttribute(XML_min)) {
-                mrModel.mofMin = rAttribs.getDouble(XML_min);
-            }
-            /* TODO: need to implement AttributeList method
-            if (rAttribs.hasAttribute(XML_majorUnit)) {
-                mrModel.mofMajorUnit = rAttribs.getValAxisUnit(XML_majorUnit);
-            }
-            if (rAttribs.hasAttribute(XML_minorUnit)) {
-                mrModel.mofMinorUnit = rAttribs.getValAxisUnit(XML_minorUnit);
-            }
-            */
-            return nullptr;
-        case CX_TOKEN(title):
-        {
-            bool bVerticalDefault = mrModel.mnAxisPos == XML_l || 
mrModel.mnAxisPos == XML_r;
-            sal_Int32 nDefaultRotation = bVerticalDefault ? -5400000 : 0;
-            return new TitleContext( *this, 
mrModel.mxTitle.create(nDefaultRotation) );
-        }
-        case CX_TOKEN(units) :
-            // TODO
-            return nullptr;
-        case CX_TOKEN(majorGridlines):
-            return new ShapePrWrapperContext( *this, 
mrModel.mxMajorGridLines.create() );
-        case CX_TOKEN(minorGridlines):
-            return new ShapePrWrapperContext( *this, 
mrModel.mxMinorGridLines.create() );
-        case CX_TOKEN(majorTickMarks):
-            mrModel.mnMajorTickMark = rAttribs.getToken( XML_type, XML_cross );
-            return nullptr;
-        case CX_TOKEN(minorTickMarks):
-            mrModel.mnMinorTickMark = rAttribs.getToken( XML_type, XML_cross );
-            return nullptr;
-        case CX_TOKEN(tickLabels) :
-            // TODO (contents is only an extLst)
-            return nullptr;
-        case CX_TOKEN(numFmt):
-            mrModel.maNumberFormat.setAttributes( rAttribs );
-            return nullptr;
-        case CX_TOKEN(spPr):
-            return new ShapePropertiesContext( *this, 
mrModel.mxShapeProp.create() );
-        case CX_TOKEN(txPr):
-            return new TextBodyContext( *this, mrModel.mxTextProp.create() );
-        default:
-            assert(false);
-    }
-    return nullptr;
-}
-
 } // namespace oox::drawingml::chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx 
b/oox/source/drawingml/chart/chartcontextbase.cxx
index 5582f7600d20..283c8e03ad55 100644
--- a/oox/source/drawingml/chart/chartcontextbase.cxx
+++ b/oox/source/drawingml/chart/chartcontextbase.cxx
@@ -41,11 +41,7 @@ ShapePrWrapperContext::~ShapePrWrapperContext()
 
 ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, 
const AttributeList& )
 {
-    if (isRootElement() && (nElement == C_TOKEN(spPr) || nElement == 
CX_TOKEN(spPr))) {
-        return new ShapePropertiesContext( *this, mrModel );
-    } else {
-        return nullptr;
-    }
+    return (isRootElement() && (nElement == C_TOKEN( spPr ))) ? new 
ShapePropertiesContext( *this, mrModel ) : nullptr;
 }
 
 LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& 
rModel ) :
diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx 
b/oox/source/drawingml/chart/chartspacefragment.cxx
index 88ee3c5bdf41..1361ddf31d7a 100644
--- a/oox/source/drawingml/chart/chartspacefragment.cxx
+++ b/oox/source/drawingml/chart/chartspacefragment.cxx
@@ -174,13 +174,7 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( 
sal_Int32 nElement, const
                 case CX_TOKEN(plotArea):
                     return new PlotAreaContext( *this, 
mrModel.mxPlotArea.create() );
                 case CX_TOKEN(legend):
-                {
-                    const bool bOverlay = rAttribs.getBool(XML_overlay, false);
-                    const sal_Int32 nPos = rAttribs.getToken(XML_pos, XML_t);
-
-                    return new LegendContext( *this, mrModel.mxLegend.create(),
-                            bOverlay, nPos);
-                }
+                    return new LegendContext( *this, mrModel.mxLegend.create() 
);
                 case CX_TOKEN(extLst):
                     // TODO
                     return nullptr;
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx 
b/oox/source/drawingml/chart/plotareacontext.cxx
index 731c23368933..4355f8de7a64 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -172,13 +172,8 @@ ContextHandlerRef PlotAreaContext::onCreateContext( 
sal_Int32 nElement, [[maybe_
                 case CX_TOKEN(plotAreaRegion) :
                     return new ChartexTypeGroupContext(*this, 
mrModel.maTypeGroups.create(nElement, false));
                 case CX_TOKEN(axis) :
-                    if (rAttribs.hasAttribute(XML_id)) {
-                        sal_Int32 nId = rAttribs.getInteger(XML_id, -1);
-                        // TODO: also handle attribute "hidden"
-                        return new CxAxisContext(*this, 
mrModel.maAxes.create(nElement, false), nId);
-                    } else {
-                        return nullptr;
-                    }
+                    // TODO
+                    return nullptr;
                 case CX_TOKEN(spPr) :
                     return new ShapePropertiesContext( *this, 
mrModel.mxShapeProp.getOrCreate() );
                 case CX_TOKEN(extLst) :
diff --git a/oox/source/drawingml/chart/titlecontext.cxx 
b/oox/source/drawingml/chart/titlecontext.cxx
index 1470aa1b44e7..77e56ac36ada 100644
--- a/oox/source/drawingml/chart/titlecontext.cxx
+++ b/oox/source/drawingml/chart/titlecontext.cxx
@@ -25,6 +25,7 @@
 #include <drawingml/chart/titlemodel.hxx>
 #include <oox/helper/attributelist.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/token/tokens.hxx>
 
 #include <osl/diagnose.h>
 
@@ -46,7 +47,7 @@ TextContext::~TextContext()
 ContextHandlerRef TextContext::onCreateContext( sal_Int32 nElement, const 
AttributeList& )
 {
     // this context handler is used for <c:tx> and embedded <c:v> elements
-    if( isCurrentElement( C_TOKEN( tx ) ) || isCurrentElement(CX_TOKEN(tx)) ) 
switch( nElement )
+    if( isCurrentElement( C_TOKEN( tx ) ) ) switch( nElement )
     {
         case C_TOKEN( rich ):
         case CX_TOKEN( rich ):
@@ -93,6 +94,7 @@ TitleContext::~TitleContext()
 
 ContextHandlerRef TitleContext::onCreateContext( sal_Int32 nElement, const 
AttributeList& rAttribs )
 {
+    // this context handler is used for <c:title> only
     switch( nElement )
     {
         case C_TOKEN( layout ):
@@ -103,15 +105,12 @@ ContextHandlerRef TitleContext::onCreateContext( 
sal_Int32 nElement, const Attri
             return nullptr;
 
         case C_TOKEN( spPr ):
-        case CX_TOKEN( spPr ):
             return new ShapePropertiesContext( *this, 
mrModel.mxShapeProp.create() );
 
         case C_TOKEN( tx ):
-        case CX_TOKEN( tx ):
             return new TextContext( *this, mrModel.mxText.create() );
 
         case C_TOKEN( txPr ):
-        case CX_TOKEN( txPr ):
             return new TextBodyContext( *this, mrModel.mxTextProp.create() );
     }
     return nullptr;
@@ -142,16 +141,9 @@ ContextHandlerRef LegendEntryContext::onCreateContext( 
sal_Int32 nElement, const
     return nullptr;
 }
 
-LegendContext::LegendContext( ContextHandler2Helper& rParent,
-        LegendModel& rModel,
-        bool bOverlay /* = false */,
-        sal_Int32 nPos /* = XML_r */) :
+LegendContext::LegendContext( ContextHandler2Helper& rParent, LegendModel& 
rModel ) :
     ContextBase< LegendModel >( rParent, rModel )
 {
-    // These can't be in the initializer list because they're members of
-    // ContextBase<LegendModel>
-    mrModel.mbOverlay = bOverlay;
-    mrModel.mnPosition = nPos;
 }
 
 LegendContext::~LegendContext()
@@ -160,6 +152,7 @@ LegendContext::~LegendContext()
 
 ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const 
AttributeList& rAttribs )
 {
+    // this context handler is used for <c:legend> only
     switch( nElement )
     {
         case C_TOKEN( layout ):
@@ -173,16 +166,13 @@ ContextHandlerRef LegendContext::onCreateContext( 
sal_Int32 nElement, const Attr
             return new LegendEntryContext( *this, 
mrModel.maLegendEntries.create() );
 
         case C_TOKEN( overlay ):
-            // For cx, overlay is an attribute of <cx:legend>
             mrModel.mbOverlay = rAttribs.getBool( XML_val, true );
             return nullptr;
 
         case C_TOKEN( spPr ):
-        case CX_TOKEN( spPr ):
             return new ShapePropertiesContext( *this, 
mrModel.mxShapeProp.create() );
 
         case C_TOKEN( txPr ):
-        case CX_TOKEN( txPr ):
             return new TextBodyContext( *this, mrModel.mxTextProp.create() );
     }
     return nullptr;
diff --git a/oox/source/drawingml/chart/titleconverter.cxx 
b/oox/source/drawingml/chart/titleconverter.cxx
index f26cc75a966e..0ee8affc7984 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -75,7 +75,6 @@ Sequence< Reference< XFormattedString > > 
TextConverter::createStringSequence(
 {
     OSL_ENSURE( !mrModel.mxDataSeq || !mrModel.mxTextBody, 
"TextConverter::createStringSequence - linked string and rich text found" );
     ::std::vector< Reference< XFormattedString > > aStringVec;
-    bool bTextFound = false;
     if( mrModel.mxTextBody.is() )
     {
         // rich-formatted text objects can be created, but currently Chart2 is 
not able to show them
@@ -102,44 +101,10 @@ Sequence< Reference< XFormattedString > > 
TextConverter::createStringSequence(
                     aRunProps = rParaProps;
                 aRunProps.assignUsed( rTextRun.getTextCharacterProperties() );
                 getFormatter().convertTextFormatting( aPropSet, aRunProps, 
eObjType );
-
-                bTextFound = true;
             }
         }
     }
-    else if (rxTextProp.is() && !rxTextProp->getParagraphs().empty()) {
-        // <c:txPr> or <cx:txPr> can contain <a:p>. Which seems odd, but handle
-        // it here.
-        const TextParagraphVector& rTextParas = rxTextProp->getParagraphs();
-        for( TextParagraphVector::const_iterator aPIt = rTextParas.begin(), 
aPEnd = rTextParas.end(); aPIt != aPEnd; ++aPIt )
-        {
-            const TextParagraph& rTextPara = **aPIt;
-            const TextCharacterProperties& rParaProps = 
rTextPara.getProperties().getTextCharacterProperties();
-            for( TextRunVector::const_iterator aRIt = 
rTextPara.getRuns().begin(), aREnd = rTextPara.getRuns().end(); aRIt != aREnd; 
++aRIt )
-            {
-                const TextRun& rTextRun = **aRIt;
-                bool bAddNewLine = ((aRIt + 1 == aREnd) && (aPIt + 1 != 
aPEnd)) || rTextRun.isLineBreak();
-                Reference< XFormattedString > xFmtStr = appendFormattedString( 
aStringVec, rTextRun.getText(), bAddNewLine );
-                PropertySet aPropSet( xFmtStr );
-                TextCharacterProperties aRunProps;
-                if (rParaProps.mbHasEmptyParaProperties && 
rxTextProp->hasParagraphProperties())
-                {
-                    const TextParagraphVector rDefTextParas = 
rxTextProp->getParagraphs();
-                    TextParagraphVector::const_iterator aDefPIt = 
rDefTextParas.begin();
-                    const TextParagraph& rDefTextPara = **aDefPIt;
-                    aRunProps = 
rDefTextPara.getProperties().getTextCharacterProperties();
-                }
-                else
-                    aRunProps = rParaProps;
-                aRunProps.assignUsed( rTextRun.getTextCharacterProperties() );
-                getFormatter().convertTextFormatting( aPropSet, aRunProps, 
eObjType );
-
-                bTextFound = true;
-            }
-        }
-    }
-
-    if (!bTextFound)
+    else
     {
         OUString aString;
         // try to create string from linked data
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 75b1b8b4aada..a5727f919ecb 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1576,9 +1576,8 @@ void ChartExport::exportChart( const Reference< 
css::chart::XChartDocument >& xC
     // plot area
     exportPlotArea( xChartDoc, bIsChartex );
     // legend
-    if( bHasLegend ) {
+    if( bHasLegend )
         exportLegend( xChartDoc, bIsChartex );
-    }
 
     if (!bIsChartex) {
         uno::Reference<beans::XPropertySet> 
xDiagramPropSet(xChartDoc->getDiagram(), uno::UNO_QUERY);
@@ -1818,9 +1817,7 @@ void ChartExport::exportLegend( const Reference< 
css::chart::XChartDocument >& x
         // draw-chart:txPr text properties
         exportTextProps( xProp, bIsChartex );
 
-        if (bIsChartex) {
-            pFS->endElement( FSNS( XML_cx, XML_legend ) );
-        } else {
+        if (!bIsChartex) {
             pFS->endElement( FSNS( XML_c, XML_legend ) );
         }
     }

Reply via email to