diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-25 23:23:11 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-26 02:04:39 +0000 |
commit | c61981c19335d6a75bf16e1653a2e8bbae81b14d (patch) | |
tree | ca326b333232734a303bebc9de96557575bb9ad9 /oox | |
parent | 0ba8da916429ca768989cb1046df9b28ff52ec37 (diff) |
use the existing namespace map for the oox namespace export
Change-Id: I7909b08db556c6c65c1547303f2b899c30feaba4
Reviewed-on: https://gerrit.libreoffice.org/32425
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 17 | ||||
-rw-r--r-- | oox/source/token/namespaces.hxx.tail | 1 |
2 files changed, 17 insertions, 1 deletions
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 <tools/datetime.hxx> #include <com/sun/star/util/Duration.hpp> #include <sax/tools/converter.hxx> +#include <oox/token/namespacemap.hxx> 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 ) |