This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch ms-odrawxml in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit e59eab085b012cf33433ce7832b7820d11396238 Author: Pedro Giffuni <[email protected]> AuthorDate: Sun Nov 29 15:36:14 2026 -0500 Fix MCE build errors for FreeBSD: remove void return, fix namespace stack type, fix getAttributes->getUnknownAttributes, fix aMap->aPrefixMap, make pushNamespaces public --- main/oox/inc/oox/core/mcealternatecontext.hxx | 39 ++++++++++++++------------- main/oox/source/core/mcealternatecontext.cxx | 32 +++++++--------------- 2 files changed, 29 insertions(+), 42 deletions(-) diff --git a/main/oox/inc/oox/core/mcealternatecontext.hxx b/main/oox/inc/oox/core/mcealternatecontext.hxx index c3495af799..718105a366 100644 --- a/main/oox/inc/oox/core/mcealternatecontext.hxx +++ b/main/oox/inc/oox/core/mcealternatecontext.hxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <vector> #include "oox/core/mceprocessor.hxx" +#include "oox/dllapi.h" namespace oox { namespace core { @@ -44,15 +45,15 @@ namespace core { Unknown namespaces listed in mc:Ignorable are silently skipped unless mc:ProcessContent explicitly includes them. */ -class MceAlternateContext : public ::cppu::WeakImplHelper1< +class OOX_DLLPUBLIC MceAlternateContext : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > { public: - MceAlternateContext( + OOX_DLLPUBLIC MceAlternateContext( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >& xDelegate ); - virtual ~MceAlternateContext(); + virtual OOX_DLLPUBLIC ~MceAlternateContext(); // com.sun.star.xml.sax.XFastContextHandler interface virtual void SAL_CALL startFastElement( @@ -83,6 +84,21 @@ public: ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ); virtual void SAL_CALL characters( const ::rtl::OUString& aChars ); + /** Pushes namespace declarations from an element's attributes onto + the namespace stack. Called when entering an element. */ + OOX_DLLPUBLIC void pushNamespaces( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XFastAttributeList >& rAttribs ); + + /** Pops the top namespace declaration set from the stack. Called when + leaving an element. */ + void popNamespaces(); + + /** Resolves a namespace prefix to a URI using the full namespace stack + (ancestor declarations are overridden by more local declarations). */ + ::rtl::OUString resolvePrefix( + const ::rtl::OUString& rPrefix ) const; + private: enum State { @@ -107,7 +123,7 @@ private: /** Namespace stack: each element on the stack is a map from prefix to namespace URI. The top of the stack represents the current in-scope namespace declarations. */ - std::vector< std::pair< ::rtl::OUString, ::rtl::OUString > > maNamespaceStack; + std::vector< std::vector< std::pair< ::rtl::OUString, ::rtl::OUString > > > maNamespaceStack; /** Namespaces declared as ignorable via mc:Ignorable. */ std::vector< ::rtl::OUString > maIgnorableNamespaces; @@ -126,21 +142,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > implCreateNullContext(); - /** Pushes namespace declarations from an element's attributes onto - the namespace stack. Called when entering an element. */ - void pushNamespaces( - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XFastAttributeList >& rAttribs ); - - /** Pops the top namespace declaration set from the stack. Called when - leaving an element. */ - void popNamespaces(); - - /** Resolves a namespace prefix to a URI using the full namespace stack - (ancestor declarations are overridden by more local declarations). */ - ::rtl::OUString resolvePrefix( - const ::rtl::OUString& rPrefix ) const; - /** Checks whether a namespace is in the ignorable list. */ bool isIgnorableNamespace( const ::rtl::OUString& rNamespaceURI ) const; diff --git a/main/oox/source/core/mcealternatecontext.cxx b/main/oox/source/core/mcealternatecontext.cxx index 806524f832..6c8a248cfa 100644 --- a/main/oox/source/core/mcealternatecontext.cxx +++ b/main/oox/source/core/mcealternatecontext.cxx @@ -32,7 +32,7 @@ namespace core { // ============================================================================ -MceAlternateContext::MceAlternateContext( +OOX_DLLPUBLIC MceAlternateContext::MceAlternateContext( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >& xDelegate ) : mxDelegate( xDelegate ), @@ -45,7 +45,7 @@ MceAlternateContext::MceAlternateContext( { } -MceAlternateContext::~MceAlternateContext() +OOX_DLLPUBLIC MceAlternateContext::~MceAlternateContext() { } @@ -91,22 +91,8 @@ void SAL_CALL MceAlternateContext::startFastElement( } if ( Element == XML_AlternateContent ) { - // Nested AlternateContent: create a new context. - MceAlternateContext* pMceCtx = new MceAlternateContext( - mxDelegate ); - pMceCtx->maNamespaceStack = maNamespaceStack; // inherit namespace stack - pMceCtx->maIgnorableNamespaces = maIgnorableNamespaces; // inherit ignorable namespaces - pMceCtx->maProcessContentElements = maProcessContentElements; // inherit process content - pMceCtx->meState = STATE_INITIAL; - pMceCtx->mnNextChoiceIndex = 0; - pMceCtx->mbHasFallback = false; - pMceCtx->mbInSelectedBranch = false; - pMceCtx->maSelection.meResult = MceProcessor::BRANCH_NONE; - pMceCtx->maSelection.mnChoiceIndex = -1; - - return ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XFastContextHandler >( - static_cast< XFastContextHandler* >( pMceCtx ) ); + // Nested AlternateContent: handled in createFastChildContext + return; } // Non-MCE element inside selected branch - forward to delegate @@ -254,7 +240,7 @@ void MceAlternateContext::implEvaluateChoice( } } if ( !bFound ) - aMap.push_back( rPair ); + aPrefixMap.push_back( rPair ); } } @@ -286,7 +272,7 @@ MceAlternateContext::implCreateNullContext() // ---------------------------------------------------------------------------- -void MceAlternateContext::pushNamespaces( +OOX_DLLPUBLIC void MceAlternateContext::pushNamespaces( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rAttribs ) { @@ -376,7 +362,7 @@ void MceAlternateContext::processIgnorableAttribute( try { ::com::sun::star::uno::Sequence< ::com::sun::star::xml::Attribute > aAttrs = - rAttribs->getAttributes(); + rAttribs->getUnknownAttributes(); for ( sal_Int32 i = 0; i < aAttrs.getLength(); ++i ) { @@ -407,7 +393,7 @@ void MceAlternateContext::processIgnorableAttribute( } catch ( ... ) { - // getAttributes() may throw if not supported + // getUnknownAttributes() may throw if not supported } } @@ -421,7 +407,7 @@ void MceAlternateContext::processProcessContent( try { ::com::sun::star::uno::Sequence< ::com::sun::star::xml::Attribute > aAttrs = - rAttribs->getAttributes(); + rAttribs->getUnknownAttributes(); for ( sal_Int32 i = 0; i < aAttrs.getLength(); ++i ) {
