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 +- sc/source/filter/inc/sheetdatabuffer.hxx | 9 +++----- sc/source/filter/oox/sheetdatabuffer.cxx | 30 +++++++++++++---------------- sc/source/filter/oox/worksheetfragment.cxx | 5 +--- 11 files changed, 51 insertions(+), 47 deletions(-)
New commits: commit f1dcb8b3e2e01848d44dd1beb82cd4e6e68a2acd Author: Rosemary Sebastian <rosemary.s...@gmail.com> Date: Tue Jan 3 18:31:43 2017 +0530 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 <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index a1a2a75..cd1a466 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -76,6 +76,7 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <oox/token/tokens.hxx> +#include <oox/token/namespaces.hxx> #include <memory> 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 b74eeb1..dae805f 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 4c8e397..7c9d48a 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 <oox/export/utils.hxx> +#include <oox/token/namespaces.hxx> 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 35fe29f..c783ea3 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -74,6 +74,7 @@ #include <oox/export/drawingml.hxx> #include <oox/export/chartexport.hxx> #include <oox/export/utils.hxx> +#include <oox/token/namespaces.hxx> #include <memory> 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 c1b1252..fd6d5a1 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 <oox/token/namespaces.hxx> + 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 dd8025a..d26cc5d 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -21,6 +21,7 @@ #include <algorithm> #include <formula/errorcodes.hxx> +#include <oox/token/namespaces.hxx> #include <unotools/collatorwrapper.hxx> #include <svl/zforlist.hxx> #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 1b34081..c38b818 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -15,6 +15,7 @@ #include <document.hxx> #include <oox/export/utils.hxx> +#include <oox/token/namespaces.hxx> #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp> @@ -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<long>(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 f5944d5..f13aa29 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -51,6 +51,7 @@ #include "conditio.hxx" #include <oox/token/tokens.hxx> +#include <oox/token/namespaces.hxx> #include <o3tl/make_unique.hxx> 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 ); commit 4c53e17d47bea97168bd07630ccf781639dd03d1 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Tue Jan 3 11:30:17 2017 +0100 tdf#48140 replace CellRangeAddress in xlsx import (12) Change-Id: Iec9ea10992ae031c4362a913792f738b2b45f199 Reviewed-on: https://gerrit.libreoffice.org/32662 Reviewed-by: Jochen Nitschke <j.nitschke+loger...@ok.de> Tested-by: Jochen Nitschke <j.nitschke+loger...@ok.de> diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx index 9da32e6..79758dd 100644 --- a/sc/source/filter/inc/sheetdatabuffer.hxx +++ b/sc/source/filter/inc/sheetdatabuffer.hxx @@ -139,7 +139,7 @@ public: /** Sets default cell formatting for the specified range of rows. */ void setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat ); /** Merges the cells in the passed cell range. */ - void setMergedRange( const css::table::CellRangeAddress& rRange ); + void setMergedRange( const ScRange& rRange ); /** Processes the cell formatting data of the passed cell. */ void setCellFormat( const CellModel& rModel ); @@ -167,7 +167,7 @@ private: const css::table::CellRangeAddress& rRange, const DataTableModel& rModel ); /** Writes all cell formatting attributes to the passed cell range list. (depreciates writeXfIdRangeProperties) */ - void applyCellMerging( const css::table::CellRangeAddress& rRange ); + void applyCellMerging( const ScRange& rRange ); void addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const css::table::CellRangeAddress& rAddress, bool bProcessRowRange = false ); private: /** Stores cell range address and formula token array of an array formula. */ @@ -211,11 +211,10 @@ private: /** Stores information about a merged cell range. */ struct MergedRange { - css::table::CellRangeAddress - maRange; /// The formatted cell range. + ScRange maRange; /// The formatted cell range. sal_Int32 mnHorAlign; /// Horizontal alignment in the range. - explicit MergedRange( const css::table::CellRangeAddress& rRange ); + explicit MergedRange( const ScRange& rRange ); explicit MergedRange( const ScAddress& rAddress, sal_Int32 nHorAlign ); bool tryExpand( const ScAddress& rAddress, sal_Int32 nHorAlign ); }; diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 8f0cb32..e0025ec 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -322,7 +322,7 @@ void SheetDataBuffer::setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCusto } } -void SheetDataBuffer::setMergedRange( const CellRangeAddress& rRange ) +void SheetDataBuffer::setMergedRange( const ScRange& rRange ) { maMergedRanges.push_back( MergedRange( rRange ) ); } @@ -526,24 +526,24 @@ bool SheetDataBuffer::XfIdRowRange::tryExpand( sal_Int32 nRow, sal_Int32 nXfId ) return false; } -SheetDataBuffer::MergedRange::MergedRange( const CellRangeAddress& rRange ) : +SheetDataBuffer::MergedRange::MergedRange( const ScRange& rRange ) : maRange( rRange ), mnHorAlign( XML_TOKEN_INVALID ) { } SheetDataBuffer::MergedRange::MergedRange( const ScAddress& rAddress, sal_Int32 nHorAlign ) : - maRange( rAddress.Tab(), rAddress.Col(), rAddress.Row(), rAddress.Col(), rAddress.Row() ), + maRange( rAddress, rAddress ), mnHorAlign( nHorAlign ) { } bool SheetDataBuffer::MergedRange::tryExpand( const ScAddress& rAddress, sal_Int32 nHorAlign ) { - if( (mnHorAlign == nHorAlign) && (maRange.StartRow == rAddress.Row() ) && - (maRange.EndRow == rAddress.Row() ) && (maRange.EndColumn + 1 == rAddress.Col() ) ) + if( (mnHorAlign == nHorAlign) && (maRange.aStart.Row() == rAddress.Row() ) && + (maRange.aEnd.Row() == rAddress.Row() ) && (maRange.aEnd.Col() + 1 == rAddress.Col() ) ) { - ++maRange.EndColumn; + maRange.aEnd.IncCol(); return true; } return false; @@ -714,7 +714,7 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) } } -void lcl_SetBorderLine( ScDocument& rDoc, ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine ) +void lcl_SetBorderLine( ScDocument& rDoc, const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine ) { SCCOL nFromScCol = (nLine == SvxBoxItemLine::RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); @@ -729,22 +729,20 @@ void lcl_SetBorderLine( ScDocument& rDoc, ScRange& rRange, SCTAB nScTab, SvxBoxI rDoc.ApplyAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, aNewItem ); } -void SheetDataBuffer::applyCellMerging( const CellRangeAddress& rRange ) +void SheetDataBuffer::applyCellMerging( const ScRange& rRange ) { - bool bMultiCol = rRange.StartColumn < rRange.EndColumn; - bool bMultiRow = rRange.StartRow < rRange.EndRow; + bool bMultiCol = rRange.aStart.Col() < rRange.aEnd.Col(); + bool bMultiRow = rRange.aStart.Row() < rRange.aEnd.Row(); - ScRange aRange; - ScUnoConversion::FillScRange( aRange, rRange ); - const ScAddress& rStart = aRange.aStart; - const ScAddress& rEnd = aRange.aEnd; + const ScAddress& rStart = rRange.aStart; + const ScAddress& rEnd = rRange.aEnd; ScDocument& rDoc = getScDocument(); // set correct right border if( bMultiCol ) - lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), SvxBoxItemLine::RIGHT ); + lcl_SetBorderLine( rDoc, rRange, getSheetIndex(), SvxBoxItemLine::RIGHT ); // set correct lower border if( bMultiRow ) - lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), SvxBoxItemLine::BOTTOM ); + lcl_SetBorderLine( rDoc, rRange, getSheetIndex(), SvxBoxItemLine::BOTTOM ); // do merge if( bMultiCol || bMultiRow ) rDoc.DoMerge( getSheetIndex(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() ); diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index 4871671..15b8a61 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -47,7 +47,6 @@ namespace oox { namespace xls { -using namespace ::com::sun::star::table; using namespace ::com::sun::star::uno; using namespace ::oox::core; @@ -694,7 +693,7 @@ void WorksheetFragment::importCol( const AttributeList& rAttribs ) void WorksheetFragment::importMergeCell( const AttributeList& rAttribs ) { - CellRangeAddress aRange; + ScRange aRange; if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) ) getSheetData().setMergedRange( aRange ); } @@ -825,7 +824,7 @@ void WorksheetFragment::importMergeCell( SequenceInputStream& rStrm ) { BinRange aBinRange; rStrm >> aBinRange; - CellRangeAddress aRange; + ScRange aRange; if( getAddressConverter().convertToCellRange( aRange, aBinRange, getSheetIndex(), true, true ) ) getSheetData().setMergedRange( aRange ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits