diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-09-09 15:20:31 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-09-09 15:21:59 +0000 |
commit | a685de59fce89ab77e1e03b0044621c3f43a00c3 (patch) | |
tree | 57a2f317a0d294b0029d79783c914168128d6f05 /sc | |
parent | 62c0ff126a97df0601054fa15498ccccf96077f7 (diff) |
fdo#75757: remove inheritance to std::vector
from ApiCellRangeList.
Change-Id: I29913e0e437c112640b08187f8bea6b1f0f1c17c
Reviewed-on: https://gerrit.libreoffice.org/11349
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/addressconverter.hxx | 45 | ||||
-rw-r--r-- | sc/source/filter/oox/addressconverter.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/defnamesbuffer.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatabuffer.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetsettings.cxx | 2 |
7 files changed, 61 insertions, 15 deletions
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index 5afec562dc09..69d031a093e6 100644 --- a/sc/source/filter/inc/addressconverter.hxx +++ b/sc/source/filter/inc/addressconverter.hxx @@ -32,14 +32,55 @@ class BiffInputStream; /** A vector of com.sun.star.table.CellRangeAddress elements and additional functionality. */ -class ApiCellRangeList : public ::std::vector< ::com::sun::star::table::CellRangeAddress > +class ApiCellRangeList { public: - inline explicit ApiCellRangeList() {} + inline explicit ApiCellRangeList() : mvAddresses() {} + + size_t size() const { return mvAddresses.size(); } + + bool empty() const { return mvAddresses.empty(); } + + const ::com::sun::star::table::CellRangeAddress& front() const + { return mvAddresses.front(); } + + ::com::sun::star::table::CellRangeAddress& operator[]( size_t i ) + { return mvAddresses[ i ]; } + + ::std::vector< ::com::sun::star::table::CellRangeAddress >::const_iterator begin() const + { return mvAddresses.begin(); } + ::std::vector< ::com::sun::star::table::CellRangeAddress >::iterator begin() + { return mvAddresses.begin(); } + + ::std::vector< ::com::sun::star::table::CellRangeAddress >::const_iterator end() const + { return mvAddresses.end(); } + + ::std::vector< ::com::sun::star::table::CellRangeAddress >::reverse_iterator rbegin() + { return mvAddresses.rbegin(); } + + ::std::vector< ::com::sun::star::table::CellRangeAddress >::reverse_iterator rend() + { return mvAddresses.rend(); } + + void clear() { mvAddresses.clear(); } + + void erase( ::std::vector< ::com::sun::star::table::CellRangeAddress >::iterator it ) + { mvAddresses.erase( it ); } + + void pop_back() { mvAddresses.pop_back(); } + + void push_back( const ::com::sun::star::table::CellRangeAddress& rAddress ) + { mvAddresses.push_back( rAddress ); } /** Returns the base address of this range list (top-left cell of first range). */ ::com::sun::star::table::CellAddress getBaseAddress() const; + + /** Converts to a sequence. */ + com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > + toSequence() const; + +private: + ::std::vector< ::com::sun::star::table::CellRangeAddress > mvAddresses; }; /** A 2D cell address struct for binary filters. */ diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 22e163250f95..75d5d33b7507 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -26,6 +26,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <oox/core/filterbase.hxx> +#include <oox/helper/containerhelper.hxx> #include "biffinputstream.hxx" namespace oox { @@ -69,9 +70,14 @@ const sal_Int16 BIFF8_MAXTAB = BIFF5_MAXTAB; CellAddress ApiCellRangeList::getBaseAddress() const { - if( empty() ) + if( mvAddresses.empty() ) return CellAddress(); - return CellAddress( front().Sheet, front().StartColumn, front().StartRow ); + return CellAddress( mvAddresses.front().Sheet, mvAddresses.front().StartColumn, mvAddresses.front().StartRow ); +} + +com::sun::star::uno::Sequence< CellRangeAddress > ApiCellRangeList::toSequence() const +{ + return ContainerHelper::vectorToSequence( mvAddresses ); } void BinAddress::read( SequenceInputStream& rStrm ) diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 5cd73600141d..dd8aac429d25 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -987,7 +987,7 @@ void CondFormat::finalizeImport() sal_Int32 nIndex = getScDocument().AddCondFormat(mpFormat, nTab); ScRangeList aList; - for( ApiCellRangeList::const_iterator itr = maModel.maRanges.begin(); itr != maModel.maRanges.end(); ++itr) + for( ::std::vector< CellRangeAddress >::const_iterator itr = maModel.maRanges.begin(); itr != maModel.maRanges.end(); ++itr) { ScRange aRange; ScUnoConversion::FillScRange(aRange, *itr); diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 73addbe5d6f7..53f0d56350b1 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -28,7 +28,6 @@ #include <com/sun/star/sheet/XPrintAreas.hpp> #include <rtl/ustrbuf.hxx> #include <oox/helper/attributelist.hxx> -#include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> #include "addressconverter.hxx" #include "biffinputstream.hxx" @@ -406,7 +405,7 @@ void DefinedName::convertFormula() ApiCellRangeList aPrintRanges; getFormulaParser().extractCellRangeList( aPrintRanges, aFTokenSeq, false, mnCalcSheet ); if( xPrintAreas.is() && !aPrintRanges.empty() ) - xPrintAreas->setPrintAreas( ContainerHelper::vectorToSequence( aPrintRanges ) ); + xPrintAreas->setPrintAreas( aPrintRanges.toSequence() ); } break; case BIFF_DEFNAME_PRINTTITLES: @@ -419,7 +418,7 @@ void DefinedName::convertFormula() bool bHasRowTitles = false; bool bHasColTitles = false; const CellAddress& rMaxPos = getAddressConverter().getMaxAddress(); - for( ApiCellRangeList::const_iterator aIt = aTitleRanges.begin(), aEnd = aTitleRanges.end(); (aIt != aEnd) && (!bHasRowTitles || !bHasColTitles); ++aIt ) + for( ::std::vector< CellRangeAddress >::const_iterator aIt = aTitleRanges.begin(), aEnd = aTitleRanges.end(); (aIt != aEnd) && (!bHasRowTitles || !bHasColTitles); ++aIt ) { bool bFullRow = (aIt->StartColumn == 0) && (aIt->EndColumn >= rMaxPos.Column); bool bFullCol = (aIt->StartRow == 0) && (aIt->EndRow >= rMaxPos.Row); diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 446b9f80f66c..a9fa35ded01e 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -342,7 +342,7 @@ void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal { // add ranges from the rangelist to the existing rangelist for the // matching style ( should we check if they overlap ? ) - for ( ApiCellRangeList::const_iterator iter = rRangeList.begin(), iter_end = rRangeList.end(); iter != iter_end; ++iter ) + for ( ::std::vector< CellRangeAddress >::const_iterator iter = rRangeList.begin(), iter_end = rRangeList.end(); iter != iter_end; ++iter ) it->second.push_back( *iter ); return; } @@ -437,7 +437,7 @@ void SheetDataBuffer::finalizeImport() for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it ) { const ApiCellRangeList& rRanges( it->second ); - for ( ApiCellRangeList::const_iterator it_range = rRanges.begin(), it_rangeend = rRanges.end(); it_range!=it_rangeend; ++it_range ) + for ( ::std::vector< CellRangeAddress >::const_iterator it_range = rRanges.begin(), it_rangeend = rRanges.end(); it_range!=it_rangeend; ++it_range ) addColXfStyle( it->first.first, it->first.second, *it_range ); } @@ -652,8 +652,8 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtI { if( (rModel.mnXfId >= 0) || (nNumFmtId >= 0) ) { - ApiCellRangeList::reverse_iterator aIt = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rbegin(); - ApiCellRangeList::reverse_iterator aItEnd = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rend(); + ::std::vector< CellRangeAddress >::reverse_iterator aIt = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rbegin(); + ::std::vector< CellRangeAddress >::reverse_iterator aItEnd = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rend(); /* The xlsx sheet data contains row wise information. * It is sufficient to check if the row range size is one */ @@ -674,7 +674,7 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtI aIt = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rbegin(); aItEnd = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, nNumFmtId ) ].rend(); - ApiCellRangeList::reverse_iterator aItM = aIt+1; + ::std::vector< CellRangeAddress >::reverse_iterator aItM = aIt+1; while( aItM != aItEnd ) { if( aIt->Sheet == aItM->Sheet ) diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 4417bbe6cb34..ddc4ba556a69 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -500,7 +500,7 @@ Reference< XSheetCellRanges > WorksheetGlobals::getCellRangeList( const ApiCellR { xRanges.set( getBaseFilter().getModelFactory()->createInstance( maSheetCellRanges ), UNO_QUERY_THROW ); Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW ); - xRangeCont->addRangeAddresses( ContainerHelper::vectorToSequence( rRanges ), sal_False ); + xRangeCont->addRangeAddresses( rRanges.toSequence(), sal_False ); } catch( Exception& ) { diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index b92958da5d5e..09483b46fa12 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -160,7 +160,7 @@ void WorksheetSettings::importProtectedRange( const AttributeList& rAttribs ) if (!aRangeList.empty()) { ScRangeList* pRangeList = aProt.maRangeList = new ScRangeList; - for (ApiCellRangeList::const_iterator itr( aRangeList.begin()), end( aRangeList.end()); itr != end; ++itr) + for (::std::vector< ::com::sun::star::table::CellRangeAddress >::const_iterator itr( aRangeList.begin()), end( aRangeList.end()); itr != end; ++itr) { ScRange aRange; ScUnoConversion::FillScRange( aRange, *itr); |