From f1dcb8b3e2e01848d44dd1beb82cd4e6e68a2acd Mon Sep 17 00:00:00 2001 From: Rosemary Sebastian Date: Tue, 3 Jan 2017 18:31:43 +0530 Subject: replace hard-coded namespace URL strings with function calls... Follow-up for https://gerrit.libreoffice.org/#/c/32425/; Change-Id: I59f77f0ccd681fb96bb9f1e7ec4b38d41c4f331a Reviewed-on: https://gerrit.libreoffice.org/32695 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- sc/source/filter/excel/excdoc.cxx | 9 +++++---- sc/source/filter/excel/xecontent.cxx | 2 +- sc/source/filter/excel/xedbdata.cxx | 3 ++- sc/source/filter/excel/xeescher.cxx | 13 +++++++------ sc/source/filter/excel/xeextlst.cxx | 8 +++++--- sc/source/filter/excel/xelink.cxx | 5 +++-- sc/source/filter/excel/xepivotxml.cxx | 11 ++++++----- sc/source/filter/excel/xestyle.cxx | 3 ++- 8 files changed, 31 insertions(+), 23 deletions(-) (limited to 'sc') diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index a1a2a75443d4..cd1a46678181 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -76,6 +76,7 @@ #include #include #include +#include #include using namespace oox; @@ -734,8 +735,8 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm ) rStrm.PushStream( pWorksheet ); pWorksheet->startElement( XML_worksheet, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS( XML_xmlns, XML_r ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(), FSEND ); SetCurrScTab( mnScTab ); @@ -855,8 +856,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream(); rWorkbook->startElement( XML_workbook, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(), FSEND ); rWorkbook->singleElement( XML_fileVersion, XML_appName, "Calc", diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index b74eeb1d2a15..dae805f4222c 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -204,7 +204,7 @@ void XclExpSstImpl::SaveXml( XclExpXmlStream& rStrm ) rStrm.PushStream( pSst ); pSst->startElement( XML_sst, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), XML_count, OString::number( mnTotal ).getStr(), XML_uniqueCount, OString::number( mnSize ).getStr(), FSEND ); diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 4c8e3974fc05..7c9d48ae537d 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -13,6 +13,7 @@ #include "dbdata.hxx" #include "document.hxx" #include +#include using namespace oox; @@ -180,7 +181,7 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry ) rData.GetArea( aRange); sax_fastparser::FSHelperPtr& pTableStrm = rStrm.GetCurrentStream(); pTableStrm->startElement( XML_table, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls14Lst))).getStr(), XML_id, OString::number( rEntry.mnTableId).getStr(), XML_name, XclXmlUtils::ToOString( rData.GetName()).getStr(), XML_displayName, XclXmlUtils::ToOString( rData.GetName()).getStr(), diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 35fe29f2139f..c783ea33ba4e 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -1422,16 +1423,16 @@ void XclExpComments::SaveXml( XclExpXmlStream& rStrm ) if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 ) rComments->startElement( XML_comments, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS( XML_xmlns, XML_mc ), "http://schemas.openxmlformats.org/markup-compatibility/2006", - FSNS( XML_xmlns, XML_xdr ), "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", - FSNS( XML_xmlns, XML_v2 ), "http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS( XML_xmlns, XML_mc ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(mce))).getStr(), + FSNS( XML_xmlns, XML_xdr ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr))).getStr(), + FSNS( XML_xmlns, XML_v2 ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(mceTest))).getStr(), FSNS( XML_mc, XML_Ignorable ), "v2", FSEND ); else rComments->startElement( XML_comments, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS( XML_xmlns, XML_xdr ), "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS( XML_xmlns, XML_xdr ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr))).getStr(), FSEND ); rComments->startElement( XML_authors, FSEND ); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index c1b1252e8901..fd6d5a10e572 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -15,6 +15,8 @@ #include "xecontent.hxx" #include "tokenarray.hxx" +#include + using namespace ::oox; namespace { @@ -350,7 +352,7 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElementNS( XML_x14, XML_conditionalFormatting, - FSNS( XML_xmlns, XML_xm ), "http://schemas.microsoft.com/office/excel/2006/main", + FSNS( XML_xmlns, XML_xm ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xm))).getStr(), FSEND ); maCfRules.SaveXml( rStrm ); @@ -396,7 +398,7 @@ void XclExpExtCalcPr::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_ext, - FSNS( XML_xmlns, XML_loext ), "http://schemas.libreoffice.org/", + FSNS( XML_xmlns, XML_loext ), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(loext))).getStr(), XML_uri, maURI.getStr(), FSEND ); @@ -417,7 +419,7 @@ void XclExpExtCondFormat::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); 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, maURI.getStr(), FSEND ); diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index dd8025a56d30..d26cc5db850e 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include "document.hxx" @@ -1677,11 +1678,11 @@ void XclExpSupbook::SaveXml( XclExpXmlStream& rStrm ) true ); pExternalLink->startElement( XML_externalLink, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), FSEND); pExternalLink->startElement( XML_externalBook, - FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(), FSNS(XML_r, XML_id), XclXmlUtils::ToOString( sId ).getStr(), FSEND); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 1b340812cc3f..c38b818200ff 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -36,8 +37,8 @@ void savePivotCacheRecordsXml( XclExpXmlStream& rStrm, const ScDPCache& rCache ) sax_fastparser::FSHelperPtr& pRecStrm = rStrm.GetCurrentStream(); pRecStrm->startElement(XML_pivotCacheRecords, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(), XML_count, OString::number(static_cast(nCount)).getStr(), FSEND); @@ -192,8 +193,8 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr rStrm.PopStream(); pDefStrm->startElement(XML_pivotCacheDefinition, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), + FSNS(XML_xmlns, XML_r), XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(officeRel))).getStr(), FSNS(XML_r, XML_id), XclXmlUtils::ToOString(aRelId).getStr(), XML_recordCount, OString::number(rEntry.mpCache->GetDataSize()).getStr(), FSEND); @@ -497,7 +498,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP sax_fastparser::FSHelperPtr& pPivotStrm = rStrm.GetCurrentStream(); pPivotStrm->startElement(XML_pivotTableDefinition, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), XML_name, XclXmlUtils::ToOString(rDPObj.GetName()).getStr(), XML_cacheId, OString::number(nCacheId).getStr(), XML_applyNumberFormats, BS(false), diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index f5944d581626..f13aa29b07f5 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -51,6 +51,7 @@ #include "conditio.hxx" #include +#include #include using namespace ::com::sun::star; @@ -3137,7 +3138,7 @@ void XclExpXmlStyleSheet::SaveXml( XclExpXmlStream& rStrm ) rStrm.PushStream( aStyleSheet ); aStyleSheet->startElement( XML_styleSheet, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + XML_xmlns, XclXmlUtils::ToOString(rStrm.getNamespaceURL(OOX_NS(xls))).getStr(), FSEND ); CreateRecord( EXC_ID_FORMATLIST )->SaveXml( rStrm ); -- cgit