Kaydet (Commit) a1410ef0 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

move some auto_ptr to boost::scoped_ptr

üst 3f78f26a
......@@ -51,7 +51,7 @@
#include <svx/unoshtxt.hxx>
#include <algorithm>
#include <memory>
#include <boost/scoped_ptr.hpp>
//.............................................................................
namespace chart
......@@ -553,17 +553,14 @@ void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo
VAxisBase::createAllTickInfos(rAllTickInfos);
}
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel )
TickIter* VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel )
{
if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) )
return ::std::auto_ptr< TickIter >( new PureTickIter( m_aAllTickInfos[nTextLevel] ) );
return ::std::auto_ptr< TickIter >();
new PureTickIter( m_aAllTickInfos[nTextLevel] );
return NULL;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > VCartesianAxis::createMaximumLabelTickIterator( sal_Int32 nTextLevel )
TickIter* VCartesianAxis::createMaximumLabelTickIterator( sal_Int32 nTextLevel )
{
if( isComplexCategoryAxis() || isDateAxis() )
{
......@@ -576,13 +573,12 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
if( !m_aAllTickInfos.empty() )
{
sal_Int32 nLongestLabelIndex = m_bUseTextLabels ? this->getIndexOfLongestLabel( m_aTextLabels ) : 0;
return ::std::auto_ptr< TickIter >( new MaxLabelTickIter( m_aAllTickInfos[0], nLongestLabelIndex ) );
new MaxLabelTickIter( m_aAllTickInfos[0], nLongestLabelIndex );
}
}
}
return ::std::auto_ptr< TickIter >();
return NULL;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
sal_Int32 VCartesianAxis::getTextLevelCount() const
{
......@@ -1332,16 +1328,14 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
B2DVector aCummulatedLabelsDistance(0,0);
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
SAL_WNODEPRECATED_DECLARATIONS_POP
if(apTickIter.get())
{
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
, pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties )
, fRotationAngleDegree );
}
boost::scoped_ptr< TickIter > apTickIter(createLabelTickIterator( nTextLevel ));
if(apTickIter)
{
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
, pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties )
, fRotationAngleDegree );
}
}
}
else if( rAxisLabelProperties.getIsStaggered() )
......@@ -1367,9 +1361,7 @@ void VCartesianAxis::createLabels()
//create labels
if( m_aAxisProperties.m_bDisplayLabels )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
SAL_WNODEPRECATED_DECLARATIONS_POP
boost::scoped_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
if( !pTickFactory2D )
return;
......@@ -1388,10 +1380,8 @@ void VCartesianAxis::createLabels()
sal_Int32 nScreenDistanceBetweenTicks = -1;
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
SAL_WNODEPRECATED_DECLARATIONS_POP
if(apTickIter.get())
boost::scoped_ptr< TickIter > apTickIter(createLabelTickIterator( nTextLevel ));
if(apTickIter)
{
if(nTextLevel==0)
{
......@@ -1428,9 +1418,7 @@ void VCartesianAxis::createMaximumLabels()
//create labels
if( m_aAxisProperties.m_bDisplayLabels )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
SAL_WNODEPRECATED_DECLARATIONS_POP
boost::scoped_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
if( !pTickFactory2D )
return;
......@@ -1450,10 +1438,8 @@ void VCartesianAxis::createMaximumLabels()
sal_Int32 nTextLevelCount = getTextLevelCount();
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > apTickIter = createMaximumLabelTickIterator( nTextLevel );
SAL_WNODEPRECATED_DECLARATIONS_POP
if(apTickIter.get())
boost::scoped_ptr< TickIter > apTickIter(createMaximumLabelTickIterator( nTextLevel ));
if(apTickIter)
{
while( !createTextShapes( m_xTextTarget, *apTickIter.get(), aAxisLabelProperties, pTickFactory2D, -1 ) )
{
......@@ -1470,9 +1456,7 @@ void VCartesianAxis::updatePositions()
//update positions of labels
if( m_aAxisProperties.m_bDisplayLabels )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
SAL_WNODEPRECATED_DECLARATIONS_POP
boost::scoped_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
if( !pTickFactory2D )
return;
......@@ -1567,9 +1551,7 @@ void VCartesianAxis::createShapes()
if( !prepareShapeCreation() )
return;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
SAL_WNODEPRECATED_DECLARATIONS_POP
boost::scoped_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
if( !pTickFactory2D )
return;
......@@ -1593,10 +1575,8 @@ void VCartesianAxis::createShapes()
sal_Int32 nTextLevelCount = getTextLevelCount();
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
SAL_WNODEPRECATED_DECLARATIONS_POP
if( apTickIter.get() )
boost::scoped_ptr< TickIter > apTickIter(createLabelTickIterator( nTextLevel ));
if( apTickIter )
{
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, false ), fRotationAngleDegree ) );
......
......@@ -66,8 +66,8 @@ public:
virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
void createAllTickInfosFromComplexCategories( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShiftedPosition );
::std::auto_ptr< TickIter > createLabelTickIterator( sal_Int32 nTextLevel );
::std::auto_ptr< TickIter > createMaximumLabelTickIterator( sal_Int32 nTextLevel );
TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
sal_Int32 getTextLevelCount() const;
//-------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment