sc/source/filter/inc/addressconverter.hxx | 6 ++++++ sc/source/filter/oox/addressconverter.cxx | 14 ++++++++++++++ sc/source/filter/oox/worksheetsettings.cxx | 16 ++++------------ 3 files changed, 24 insertions(+), 12 deletions(-)
New commits: commit 5c6b81622530e708b2bb7901bcc531212a6ef72e Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Thu Jan 12 20:25:31 2017 +0100 tdf#48140 replace ApiCellRangeList in xlsx import (1) Change-Id: I61c2890db1190f2552e16bc26968bec31c5dc6d3 Reviewed-on: https://gerrit.libreoffice.org/33091 Reviewed-by: Jochen Nitschke <j.nitschke+loger...@ok.de> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index e8ed5c5..9884294 100644 --- a/sc/source/filter/inc/addressconverter.hxx +++ b/sc/source/filter/inc/addressconverter.hxx @@ -22,6 +22,7 @@ #include <vector> #include <com/sun/star/table/CellRangeAddress.hpp> +#include <rangelst.hxx> #include "workbookhelper.hxx" namespace oox { @@ -528,6 +529,11 @@ public: const OUString& rString, sal_Int16 nSheet, bool bTrackOverflow ); + void convertToCellRangeList( + ScRangeList& orRanges, + const OUString& rString, + sal_Int16 nSheet, + bool bTrackOverflow ); /** Tries to convert the passed range list to a cell range list. diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index a36a4e8..ecb4a6b 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -509,6 +509,20 @@ void AddressConverter::convertToCellRangeList( ApiCellRangeList& orRanges, } } +void AddressConverter::convertToCellRangeList( ScRangeList& orRanges, + const OUString& rString, sal_Int16 nSheet, bool bTrackOverflow ) +{ + sal_Int32 nPos = 0; + sal_Int32 nLen = rString.getLength(); + ScRange aRange; + while( (0 <= nPos) && (nPos < nLen) ) + { + OUString aToken = rString.getToken( 0, ' ', nPos ); + if( !aToken.isEmpty() && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) ) + orRanges.Append(aRange); + } +} + void AddressConverter::convertToCellRangeList( ApiCellRangeList& orRanges, const BinRangeList& rBinRanges, sal_Int16 nSheet, bool bTrackOverflow ) { diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index 1bbc7a8..12d047d 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -30,7 +30,6 @@ #include "workbooksettings.hxx" #include "tabprotection.hxx" #include "document.hxx" -#include "convuno.hxx" namespace oox { namespace xls { @@ -155,18 +154,11 @@ void WorksheetSettings::importProtectedRange( const AttributeList& rAttribs ) OUString aRefs( rAttribs.getString( XML_sqref, OUString())); if (!aRefs.isEmpty()) { - ApiCellRangeList aRangeList; - getAddressConverter().convertToCellRangeList( aRangeList, aRefs, getSheetIndex(), true ); - if (!aRangeList.empty()) + std::unique_ptr<ScRangeList> xRangeList(new ScRangeList()); + getAddressConverter().convertToCellRangeList( *xRangeList, aRefs, getSheetIndex(), true ); + if (!xRangeList->empty()) { - aProt.maRangeList = new ScRangeList; - ScRangeList* pRangeList = aProt.maRangeList.get(); - for (::std::vector< css::table::CellRangeAddress >::const_iterator itr( aRangeList.begin()), end( aRangeList.end()); itr != end; ++itr) - { - ScRange aRange; - ScUnoConversion::FillScRange( aRange, *itr); - pRangeList->Append( aRange); - } + aProt.maRangeList = xRangeList.release(); } } maSheetProt.maEnhancedProtections.push_back( aProt); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits