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>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 )
|
||||
|
@@ -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 );
|
||||
|
||||
|
Reference in New Issue
Block a user