summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-12 20:25:31 +0100
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-15 23:51:07 +0000
commit5c6b81622530e708b2bb7901bcc531212a6ef72e (patch)
treed90a7966573b30e2aedca8ce867586c0b89bd157
parent98f2431d3bba2004174673294e28bf208bf9939e (diff)
tdf#48140 replace ApiCellRangeList in xlsx import (1)
Change-Id: I61c2890db1190f2552e16bc26968bec31c5dc6d3 Reviewed-on: https://gerrit.libreoffice.org/33091 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sc/source/filter/inc/addressconverter.hxx6
-rw-r--r--sc/source/filter/oox/addressconverter.cxx14
-rw-r--r--sc/source/filter/oox/worksheetsettings.cxx16
3 files changed, 24 insertions, 12 deletions
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index e8ed5c5c1215..9884294a3021 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 a36a4e8b3c24..ecb4a6b7f76a 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 1bbc7a82cbd3..12d047dc47cd 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);