[Libreoffice-commits] core.git: sc/source
Noel Grandin
noel at peralex.com
Fri Nov 13 06:03:36 PST 2015
sc/source/filter/excel/xistyle.cxx | 25 +++++++++++++------------
sc/source/filter/inc/xistyle.hxx | 3 +--
2 files changed, 14 insertions(+), 14 deletions(-)
New commits:
commit ea6857f86b444fe7f87e74c41dbfe9ba8c02f942
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 13:51:23 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I81b3d69c0bcd7444325ed2037ac00108f9c43474
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 4ff74b5..00b1342 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -58,14 +58,15 @@
#include "root.hxx"
#include "colrowst.hxx"
#include <svl/poolcach.hxx>
+#include <o3tl/make_unique.hxx>
#include <list>
-using ::std::list;
-
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+
+using ::std::list;
using namespace ::com::sun::star;
typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE;
@@ -1722,7 +1723,7 @@ void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex )
OSL_ENSURE( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
// insert a complete row range with one insert.
- maIndexList.push_back( new XclImpXFRange( 0, MAXROW, rXFIndex ) );
+ maIndexList.push_back( o3tl::make_unique<XclImpXFRange>( 0, MAXROW, rXFIndex ) );
}
void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
@@ -1746,7 +1747,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
SCROW nLastScRow = pPrevRange->mnScRow2;
sal_uLong nIndex = nNextIndex - 1;
XclImpXFRange* pThisRange = pPrevRange;
- pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? &(maIndexList[ nIndex - 1 ]) : nullptr;
+ pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? maIndexList[ nIndex - 1 ].get() : nullptr;
if( nFirstScRow == nLastScRow ) // replace solely XF
{
@@ -1793,7 +1794,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, sal_uLong nIndex)
{
- maIndexList.insert( maIndexList.begin() + nIndex, pXFRange );
+ maIndexList.insert( maIndexList.begin() + nIndex, std::unique_ptr<XclImpXFRange>(pXFRange) );
}
void XclImpXFRangeColumn::Find(
@@ -1809,8 +1810,8 @@ void XclImpXFRangeColumn::Find(
return;
}
- rpPrevRange = &maIndexList.front();
- rpNextRange = &maIndexList.back();
+ rpPrevRange = maIndexList.front().get();
+ rpNextRange = maIndexList.back().get();
// test whether row is at end of list (contained in or behind last range)
// rpPrevRange will contain a possible existing row
@@ -1841,7 +1842,7 @@ void XclImpXFRangeColumn::Find(
while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) )
{
nMidIndex = (nPrevIndex + rnNextIndex) / 2;
- pMidRange = &maIndexList[nMidIndex];
+ pMidRange = maIndexList[nMidIndex].get();
OSL_ENSURE( pMidRange, "XclImpXFRangeColumn::Find - missing XF index range" );
if( nScRow < pMidRange->mnScRow1 ) // row is really before pMidRange
{
@@ -1859,7 +1860,7 @@ void XclImpXFRangeColumn::Find(
if( nScRow <= rpPrevRange->mnScRow2 )
{
rnNextIndex = nPrevIndex + 1;
- rpNextRange = &maIndexList[rnNextIndex];
+ rpNextRange = maIndexList[rnNextIndex].get();
}
}
@@ -1868,8 +1869,8 @@ void XclImpXFRangeColumn::TryConcatPrev( sal_uLong nIndex )
if( !nIndex || nIndex >= maIndexList.size() )
return;
- XclImpXFRange& prevRange = maIndexList[ nIndex - 1 ];
- XclImpXFRange& nextRange = maIndexList[ nIndex ];
+ XclImpXFRange& prevRange = *maIndexList[ nIndex - 1 ];
+ XclImpXFRange& nextRange = *maIndexList[ nIndex ];
if( prevRange.Expand( nextRange ) )
maIndexList.erase( maIndexList.begin() + nIndex );
@@ -2005,7 +2006,7 @@ void XclImpXFRangeBuffer::Finalize()
for (XclImpXFRangeColumn::IndexList::iterator itr = rColumn.begin(), itrEnd = rColumn.end();
itr != itrEnd; ++itr)
{
- XclImpXFRange& rStyle = *itr;
+ XclImpXFRange& rStyle = **itr;
const XclImpXFIndex& rXFIndex = rStyle.maXFIndex;
XclImpXF* pXF = rXFBuffer.GetXF( rXFIndex.GetXFIndex() );
if (!pXF)
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index 1fd2978..8921843 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -25,7 +25,6 @@
#include <vector>
#include <tools/mempool.hxx>
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
#include "rangelst.hxx"
#include "patattr.hxx"
#include "xladdress.hxx"
@@ -562,7 +561,7 @@ inline bool XclImpXFRange::Contains( SCROW nScRow ) const
class XclImpXFRangeColumn : private boost::noncopyable
{
public:
- typedef ::boost::ptr_vector<XclImpXFRange> IndexList;
+ typedef std::vector< std::unique_ptr<XclImpXFRange> > IndexList;
inline explicit XclImpXFRangeColumn() {}
More information about the Libreoffice-commits
mailing list