[Libreoffice-commits] core.git: sc/source
Takeshi Abe
tabe at fixedpoint.jp
Wed Aug 13 10:10:17 PDT 2014
sc/source/filter/excel/xestream.cxx | 2 +-
sc/source/filter/excel/xeview.cxx | 2 +-
sc/source/filter/excel/xihelper.cxx | 2 +-
sc/source/filter/excel/xladdress.cxx | 18 +++++++++---------
sc/source/filter/inc/xladdress.hxx | 16 ++++++++++++++--
5 files changed, 26 insertions(+), 14 deletions(-)
New commits:
commit 03889338f65ece7cac8e881b883db454e95e8fd7
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Thu Aug 14 02:00:31 2014 +0900
fdo#75757: remove inheritance to std::vector
Change-Id: I265d3a51a4eabee734e7ac15841f56bcae0807e4
Reviewed-on: https://gerrit.libreoffice.org/10916
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 7aaf648..6f36440 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -788,7 +788,7 @@ OString XclXmlUtils::ToOString( const XclRange& rRange )
OString XclXmlUtils::ToOString( const XclRangeList& rRanges )
{
ScRangeList aRanges;
- for( XclRangeList::const_iterator i = rRanges.begin(), end = rRanges.end();
+ for( XclRangeVector::const_iterator i = rRanges.begin(), end = rRanges.end();
i != end; ++i )
{
aRanges.Append( lcl_ToRange( *i ) );
diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 82d69ef..5e5ded5 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -208,7 +208,7 @@ XclExpSelection::XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane )
// find the cursor position in the selection list (or add it)
XclRangeList& rXclSel = maSelData.maXclSelection;
bool bFound = false;
- for( XclRangeList::const_iterator aIt = rXclSel.begin(), aEnd = rXclSel.end(); !bFound && (aIt != aEnd); ++aIt )
+ for( XclRangeVector::const_iterator aIt = rXclSel.begin(), aEnd = rXclSel.end(); !bFound && (aIt != aEnd); ++aIt )
if( (bFound = aIt->Contains( maSelData.maXclCursor )) == true )
maSelData.mnCursorIdx = static_cast< sal_uInt16 >( aIt - rXclSel.begin() );
/* Cursor cell not found in list? (e.g. inactive pane, or removed in
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 0af9836..7e95368 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -125,7 +125,7 @@ void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges,
const XclRangeList& rXclRanges, SCTAB nScTab, bool bWarn )
{
rScRanges.RemoveAll();
- for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
+ for( XclRangeVector::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
{
ScRange aScRange( ScAddress::UNINITIALIZED );
if( ConvertRange( aScRange, *aIt, nScTab, nScTab, bWarn ) )
diff --git a/sc/source/filter/excel/xladdress.cxx b/sc/source/filter/excel/xladdress.cxx
index 0fec068..c73618b 100644
--- a/sc/source/filter/excel/xladdress.cxx
+++ b/sc/source/filter/excel/xladdress.cxx
@@ -72,9 +72,9 @@ void XclRange::Write( XclExpStream& rStrm, bool bCol16Bit ) const
XclRange XclRangeList::GetEnclosingRange() const
{
XclRange aXclRange;
- if( !empty() )
+ if( !mRanges.empty() )
{
- const_iterator aIt = begin(), aEnd = end();
+ XclRangeVector::const_iterator aIt = mRanges.begin(), aEnd = mRanges.end();
aXclRange = *aIt;
for( ++aIt; aIt != aEnd; ++aIt )
{
@@ -94,29 +94,29 @@ void XclRangeList::Read( XclImpStream& rStrm, bool bCol16Bit, sal_uInt16 nCountI
nCount = nCountInStream;
else
rStrm >> nCount;
- size_t nOldSize = size();
- resize( nOldSize + nCount );
- for( iterator aIt = begin() + nOldSize; rStrm.IsValid() && (nCount > 0); --nCount, ++aIt )
+ size_t nOldSize = mRanges.size();
+ mRanges.resize( nOldSize + nCount );
+ for( XclRangeVector::iterator aIt = mRanges.begin() + nOldSize; rStrm.IsValid() && (nCount > 0); --nCount, ++aIt )
aIt->Read( rStrm, bCol16Bit );
}
void XclRangeList::Write( XclExpStream& rStrm, bool bCol16Bit, sal_uInt16 nCountInStream ) const
{
- WriteSubList( rStrm, 0, size(), bCol16Bit, nCountInStream );
+ WriteSubList( rStrm, 0, mRanges.size(), bCol16Bit, nCountInStream );
}
void XclRangeList::WriteSubList( XclExpStream& rStrm, size_t nBegin, size_t nCount, bool bCol16Bit,
sal_uInt16 nCountInStream ) const
{
- OSL_ENSURE( nBegin <= size(), "XclRangeList::WriteSubList - invalid start position" );
- size_t nEnd = ::std::min< size_t >( nBegin + nCount, size() );
+ OSL_ENSURE( nBegin <= mRanges.size(), "XclRangeList::WriteSubList - invalid start position" );
+ size_t nEnd = ::std::min< size_t >( nBegin + nCount, mRanges.size() );
if (!nCountInStream)
{
sal_uInt16 nXclCount = ulimit_cast< sal_uInt16 >( nEnd - nBegin );
rStrm << nXclCount;
}
rStrm.SetSliceSize( bCol16Bit ? 8 : 6 );
- for( const_iterator aIt = begin() + nBegin, aEnd = begin() + nEnd; aIt != aEnd; ++aIt )
+ for( XclRangeVector::const_iterator aIt = mRanges.begin() + nBegin, aEnd = mRanges.begin() + nEnd; aIt != aEnd; ++aIt )
aIt->Write( rStrm, bCol16Bit );
}
diff --git a/sc/source/filter/inc/xladdress.hxx b/sc/source/filter/inc/xladdress.hxx
index b6ae8aa..2750a4c 100644
--- a/sc/source/filter/inc/xladdress.hxx
+++ b/sc/source/filter/inc/xladdress.hxx
@@ -112,11 +112,23 @@ inline XclExpStream& operator<<( XclExpStream& rStrm, const XclRange& rXclRange
return rStrm;
}
+typedef ::std::vector< XclRange > XclRangeVector;
+
/** A 2D cell range address list with Excel column and row indexes. */
-class XclRangeList : public ::std::vector< XclRange >
+class XclRangeList
{
+private:
+ XclRangeVector mRanges;
+
public:
- inline explicit XclRangeList() {}
+ inline explicit XclRangeList() : mRanges() {}
+
+ size_t size() const { return mRanges.size(); }
+ bool empty() const { return mRanges.empty(); }
+ XclRangeVector::const_iterator begin() const { return mRanges.begin(); }
+ XclRangeVector::const_iterator end() const { return mRanges.end(); }
+ void clear() { mRanges.clear(); }
+ void push_back(const XclRange &rRange) { mRanges.push_back(rRange); }
XclRange GetEnclosingRange() const;
More information about the Libreoffice-commits
mailing list