summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-12 13:51:54 +0200
committerNoel Grandin <noel@peralex.com>2015-11-13 10:54:18 +0200
commit16877ccbd2dc227ab25f19914b9d453a082e405b (patch)
tree539e89cd3f1904996d58842aa841a8c7588850ff /sc
parent33bf2449730c796a41a25f9287aa40e51c2bc464 (diff)
sc: boost::ptr_vector->std::vector<std::unique_ptr>
and remove some unnecessary usage of dynamic allocation of OUString Change-Id: I6eb49a0733928ba49ea48accd36fbaaa82b9d211
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/excimp8.cxx3
-rw-r--r--sc/source/filter/excel/exctools.cxx34
-rw-r--r--sc/source/filter/inc/excscen.hxx17
3 files changed, 24 insertions, 30 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 171e07625114..8fcfcd359e68 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -104,6 +104,7 @@
#include <oox/ole/vbaproject.hxx>
#include <oox/ole/olestorage.hxx>
#include <unotools/streamwrap.hxx>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
using namespace ::comphelper;
@@ -279,7 +280,7 @@ void ImportExcel8::Scenman()
void ImportExcel8::Scenario()
{
- maScenList.aEntries.push_back( new ExcScenario( aIn, *pExcRoot ) );
+ maScenList.aEntries.push_back( o3tl::make_unique<ExcScenario>( aIn, *pExcRoot ) );
}
void ImportExcel8::Labelsst()
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index bc9d62b7a169..ed14c51bbc9a 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -188,60 +188,54 @@ ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR )
rIn.Ignore( 1 ); // statt nUser!
if( nName )
- pName = new OUString( rIn.ReadUniString( nName ) );
+ aName = rIn.ReadUniString( nName );
else
{
- pName = new OUString( "Scenery" );
+ aName = "Scenery";
rIn.Ignore( 1 );
}
- pUserName = new OUString( rIn.ReadUniString() );
+ aUserName = rIn.ReadUniString();
if( nComment )
- pComment = new OUString( rIn.ReadUniString() );
+ aComment = rIn.ReadUniString();
else
- pComment = new OUString;
+ aComment;
sal_uInt16 n = nCref;
sal_uInt16 nC, nR;
+ aEntries.reserve(n);
while( n )
{
nR = rIn.ReaduInt16();
nC = rIn.ReaduInt16();
- aEntries.push_back(new ExcScenarioCell( nC, nR ));
+ aEntries.push_back(ExcScenarioCell( nC, nR ));
n--;
}
n = nCref;
- boost::ptr_vector<ExcScenarioCell>::iterator iter;
+ std::vector<ExcScenarioCell>::iterator iter;
for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
iter->SetValue(rIn.ReadUniString());
}
-ExcScenario::~ExcScenario()
-{
- delete pName;
- delete pComment;
- delete pUserName;
-}
-
void ExcScenario::Apply( const XclImpRoot& rRoot, const bool bLast )
{
ScDocument& r = rRoot.GetDoc();
- OUString aSzenName( *pName );
- sal_uInt16 nNewTab = nTab + 1;
+ OUString aSzenName( aName );
+ sal_uInt16 nNewTab = nTab + 1;
if( !r.InsertTab( nNewTab, aSzenName ) )
return;
r.SetScenario( nNewTab, true );
// do not show scenario frames
- r.SetScenarioData( nNewTab, *pComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
+ r.SetScenarioData( nNewTab, aComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
- boost::ptr_vector<ExcScenarioCell>::const_iterator iter;
+ std::vector<ExcScenarioCell>::const_iterator iter;
for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
{
sal_uInt16 nCol = iter->nCol;
@@ -268,11 +262,11 @@ void ExcScenarioList::Apply( const XclImpRoot& rRoot )
{
sal_uInt16 n = static_cast<sal_uInt16>(aEntries.size());
- boost::ptr_vector<ExcScenario>::reverse_iterator iter;
+ std::vector< std::unique_ptr<ExcScenario> >::reverse_iterator iter;
for (iter = aEntries.rbegin(); iter != aEntries.rend(); ++iter)
{
n--;
- iter->Apply(rRoot, n == nLastScenario);
+ (*iter)->Apply(rRoot, n == nLastScenario);
}
}
diff --git a/sc/source/filter/inc/excscen.hxx b/sc/source/filter/inc/excscen.hxx
index 667108b3b13e..6ac3256416b3 100644
--- a/sc/source/filter/inc/excscen.hxx
+++ b/sc/source/filter/inc/excscen.hxx
@@ -20,7 +20,8 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_EXCSCEN_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_EXCSCEN_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include <rtl/ustring.hxx>
struct RootData;
@@ -48,18 +49,16 @@ public:
ExcScenario( XclImpStream& rIn, const RootData& rRoot );
- ~ExcScenario();
-
void Apply( const XclImpRoot& rRoot, const bool bLast = false );
protected:
- OUString* pName;
- OUString* pComment;
- OUString* pUserName;
- sal_uInt8 nProtected;
+ OUString aName;
+ OUString aComment;
+ OUString aUserName;
+ sal_uInt8 nProtected;
const sal_uInt16 nTab;
- boost::ptr_vector<ExcScenarioCell> aEntries;
+ std::vector<ExcScenarioCell> aEntries;
};
struct ExcScenarioList
@@ -69,7 +68,7 @@ struct ExcScenarioList
void Apply( const XclImpRoot& rRoot );
sal_uInt16 nLastScenario;
- boost::ptr_vector<ExcScenario> aEntries;
+ std::vector< std::unique_ptr<ExcScenario> > aEntries;
};
#endif