This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch odf-devel
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 4bcf1564ac9c50e36cdc3b875c0f3510a03dbee0
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Oct 29 16:26:47 2026 -0400

    xmloff: read the text of text:span in chart paragraphs
---
 .../xmloff/source/chart/SchXMLParagraphContext.cxx | 55 +++++++++++++++++++---
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/main/xmloff/source/chart/SchXMLParagraphContext.cxx 
b/main/xmloff/source/chart/SchXMLParagraphContext.cxx
index c6c001730f..582f0dc605 100644
--- a/main/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/main/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -88,25 +88,66 @@ void SchXMLParagraphContext::EndElement()
     mrText = maBuffer.makeStringAndClear();
 }
 
-SvXMLImportContext* SchXMLParagraphContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList >& )
+namespace
+{
+SvXMLImportContext* lcl_CreateTextChild( SvXMLImport& rImport, sal_uInt16 
nPrefix,
+                                         const OUString& rLocalName, 
::rtl::OUStringBuffer& rBuffer );
+
+// text:span: its text belongs to the surrounding paragraph
+class SchXMLSpanContext : public SvXMLImportContext
+{
+    ::rtl::OUStringBuffer& mrBuffer;
+
+public:
+    SchXMLSpanContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const 
OUString& rLocalName,
+                       ::rtl::OUStringBuffer& rBuffer ) :
+        SvXMLImportContext( rImport, nPrefix, rLocalName ),
+        mrBuffer( rBuffer )
+    {
+    }
+
+    virtual SvXMLImportContext* CreateChildContext( sal_uInt16 nPrefix, const 
OUString& rLocalName,
+                                                    const uno::Reference< 
xml::sax::XAttributeList >& )
+    {
+        return lcl_CreateTextChild( GetImport(), nPrefix, rLocalName, mrBuffer 
);
+    }
+
+    virtual void Characters( const OUString& rChars )
+    {
+        mrBuffer.append( rChars );
+    }
+};
+
+SvXMLImportContext* lcl_CreateTextChild( SvXMLImport& rImport, sal_uInt16 
nPrefix,
+                                         const OUString& rLocalName, 
::rtl::OUStringBuffer& rBuffer )
 {
        if( nPrefix == XML_NAMESPACE_TEXT )
        {
                if( rLocalName.equals( ::xmloff::token::GetXMLToken( 
::xmloff::token::XML_TAB_STOP )) ||
                        rLocalName.equals( ::xmloff::token::GetXMLToken( 
::xmloff::token::XML_TAB )))
         {
-            maBuffer.append( sal_Unicode( 0x0009 ));  // tabulator
+            rBuffer.append( sal_Unicode( 0x0009 ));  // tabulator
         }
         else if( rLocalName.equals( ::xmloff::token::GetXMLToken( 
::xmloff::token::XML_LINE_BREAK )))
         {
-            maBuffer.append( sal_Unicode( 0x000A ));  // linefeed
+            rBuffer.append( sal_Unicode( 0x000A ));  // linefeed
+        }
+        else if( rLocalName.equals( ::xmloff::token::GetXMLToken( 
::xmloff::token::XML_SPAN )))
+        {
+            return new SchXMLSpanContext( rImport, nPrefix, rLocalName, 
rBuffer );
         }
     }
 
-       return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+       return new SvXMLImportContext( rImport, nPrefix, rLocalName );
+}
+}
+
+SvXMLImportContext* SchXMLParagraphContext::CreateChildContext(
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const uno::Reference< xml::sax::XAttributeList >& )
+{
+    return lcl_CreateTextChild( GetImport(), nPrefix, rLocalName, maBuffer );
 }
 
 void SchXMLParagraphContext::Characters( const OUString& rChars )

Reply via email to