From c61981c19335d6a75bf16e1653a2e8bbae81b14d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 25 Dec 2016 23:23:11 +0100 Subject: use the existing namespace map for the oox namespace export Change-Id: I7909b08db556c6c65c1547303f2b899c30feaba4 Reviewed-on: https://gerrit.libreoffice.org/32425 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- oox/source/core/xmlfilterbase.cxx | 17 ++++++++++++++++- oox/source/token/namespaces.hxx.tail | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'oox') diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 952bf5ead0e2..85cfc9f67828 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -63,6 +63,7 @@ #include #include #include +#include using ::com::sun::star::xml::dom::DocumentBuilder; using ::com::sun::star::xml::dom::XDocument; @@ -178,6 +179,7 @@ struct XmlFilterBaseImpl const OUString maBinSuffix; RelationsMap maRelationsMap; TextFieldStack maTextFieldStack; + const NamespaceMap& mrNamespaceMap; explicit XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ); ~XmlFilterBaseImpl(); @@ -186,7 +188,8 @@ struct XmlFilterBaseImpl XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) : mxContext(rxContext), maFastParser( rxContext ), - maBinSuffix( ".bin" ) + maBinSuffix( ".bin" ), + mrNamespaceMap(StaticNamespaceMap::get()) { // register XML namespaces registerNamespaces(maFastParser); @@ -910,6 +913,18 @@ bool XmlFilterBase::isMSO2007Document() const return mbMSO2007; } +OUString XmlFilterBase::getNamespaceURL(sal_Int32 nNSID) const +{ + auto itr = mxImpl->mrNamespaceMap.maTransitionalNamespaceMap.find(nNSID); + if (itr == mxImpl->mrNamespaceMap.maTransitionalNamespaceMap.end()) + { + SAL_WARN("oox", "missing namespace in the namespace map for : " << nNSID); + return OUString(); + } + + return itr->second; +} + } // namespace core } // namespace oox diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index 17770dcbbdae..a52eddf8502f 100644 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -30,6 +30,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } // defines for tokens with specific namespaces #define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token) +#define OOX_NS( namespace ) (::oox::NMSP_##namespace) #define A_TOKEN( token ) OOX_TOKEN( dml, token ) #define AX_TOKEN( token ) OOX_TOKEN( ax, token ) -- cgit v1.2.3