diff options
-rw-r--r-- | include/oox/core/xmlfilterbase.hxx | 2 | ||||
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 17 | ||||
-rw-r--r-- | oox/source/token/namespaces.hxx.tail | 1 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 3 |
4 files changed, 21 insertions, 2 deletions
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index 1a9be6a15ff9..59043ba6f7ea 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -236,6 +236,8 @@ public: void checkDocumentProperties( const css::uno::Reference<css::document::XDocumentProperties>& xDocProps); + OUString getNamespaceURL(sal_Int32 nNSID) const; + protected: virtual css::uno::Reference< css::io::XInputStream > implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const override; 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 ) diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index ee7ec4b8fa3d..b74eeb1d2a15 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -44,6 +44,7 @@ #include "xestyle.hxx" #include "xename.hxx" #include <rtl/uuid.h> +#include <oox/token/namespaces.hxx> using namespace ::oox; @@ -1396,7 +1397,7 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm ) // extLst entries for Excel 2010 and 2013 rWorksheet->startElement( XML_extLst, FSEND ); rWorksheet->startElement( XML_ext, - FSNS( XML_xmlns, XML_x14 ), "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main", + FSNS( XML_xmlns, XML_x14 ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls14Lst))).getStr(), XML_uri, "{B025F937-C7B1-47D3-B67F-A62EFF666E3E}", FSEND ); |