diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-14 02:00:31 +0900 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-08-13 12:09:56 -0500 |
commit | 03889338f65ece7cac8e881b883db454e95e8fd7 (patch) | |
tree | 2822497741cbf3b7686526f2dd0f34ebaeabc6ef | |
parent | 142d527a6be9d21631253477cf06c03f54657ef9 (diff) |
fdo#75757: remove inheritance to std::vector
Change-Id: I265d3a51a4eabee734e7ac15841f56bcae0807e4
Reviewed-on: https://gerrit.libreoffice.org/10916
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xeview.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xihelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xladdress.cxx | 18 | ||||
-rw-r--r-- | sc/source/filter/inc/xladdress.hxx | 16 |
5 files changed, 26 insertions, 14 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 7aaf64885b9a..6f364409b7e8 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 82d69efee523..5e5ded5cb3f7 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 0af9836bc931..7e95368e7874 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 0fec06888933..c73618bfcdbf 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 b6ae8aa91502..2750a4cd8709 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; |