summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-12 16:03:01 +0200
committerNoel Grandin <noel@peralex.com>2015-11-13 10:54:18 +0200
commit2aacf6c2cd82322b953988ff30d3bc997ae76d7b (patch)
treebcf76344d14bdb30698d346406fd02c6ab74805c /sc
parentab3d557b48cacb30598c6b5ebb1cadece493fde8 (diff)
sc: boost::ptr_vector->std::vector
Change-Id: Ic4af0579f31c2076fcbc4ac76266e0ae49cb2be8
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/userlist.hxx7
-rw-r--r--sc/source/core/tool/appoptio.cxx4
-rw-r--r--sc/source/core/tool/userlist.cxx17
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx2
-rw-r--r--sc/source/ui/unoobj/appluno.cxx4
5 files changed, 12 insertions, 22 deletions
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 72e8e206cfe6..0ac95e190153 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -22,7 +22,6 @@
#include "scdllapi.h"
-#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
/**
@@ -47,7 +46,6 @@ private:
public:
ScUserListData(const OUString& rStr);
ScUserListData(const ScUserListData& rData);
- ~ScUserListData();
const OUString& GetString() const { return aStr; }
void SetString(const OUString& rStr);
@@ -63,7 +61,7 @@ public:
*/
class SC_DLLPUBLIC ScUserList
{
- typedef ::boost::ptr_vector<ScUserListData> DataType;
+ typedef std::vector<ScUserListData> DataType;
DataType maData;
public:
typedef DataType::iterator iterator;
@@ -85,8 +83,9 @@ public:
iterator begin();
const_iterator begin() const;
void clear();
+ void reserve(size_t size) { maData.reserve(size); }
size_t size() const;
- void push_back(ScUserListData* p);
+ void push_back(const ScUserListData& r) { maData.push_back(r); }
void erase(iterator itr);
};
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 3bdf429dfa67..5328f67a353f 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -180,11 +180,11 @@ static void lcl_SetSortList( const Any& rValue )
if (!bDefault)
{
aList.clear();
+ aList.reserve(nCount);
for (long i=0; i<nCount; i++)
{
- ScUserListData* pNew = new ScUserListData( pArray[i] );
- aList.push_back(pNew);
+ aList.push_back( ScUserListData( pArray[i] ) );
}
}
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index dc80dd8d62be..0299bfe7937f 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -96,10 +96,6 @@ ScUserListData::ScUserListData(const ScUserListData& rData) :
InitTokens();
}
-ScUserListData::~ScUserListData()
-{
-}
-
void ScUserListData::SetString( const OUString& rStr )
{
aStr = rStr;
@@ -237,9 +233,9 @@ ScUserList::ScUserList()
OUString aDayLong = aDayLongBuf.makeStringAndClear();
if ( !HasEntry( aDayShort ) )
- maData.push_back( new ScUserListData( aDayShort ));
+ maData.push_back( ScUserListData( aDayShort ));
if ( !HasEntry( aDayLong ) )
- maData.push_back( new ScUserListData( aDayLong ));
+ maData.push_back( ScUserListData( aDayLong ));
}
xCal = xCalendars[j].Months;
@@ -262,9 +258,9 @@ ScUserList::ScUserList()
OUString aMonthLong = aMonthLongBuf.makeStringAndClear();
if ( !HasEntry( aMonthShort ) )
- maData.push_back( new ScUserListData( aMonthShort ));
+ maData.push_back( ScUserListData( aMonthShort ));
if ( !HasEntry( aMonthLong ) )
- maData.push_back( new ScUserListData( aMonthLong ));
+ maData.push_back( ScUserListData( aMonthLong ));
}
}
}
@@ -350,11 +346,6 @@ size_t ScUserList::size() const
return maData.size();
}
-void ScUserList::push_back(ScUserListData* p)
-{
- maData.push_back(p);
-}
-
void ScUserList::erase(iterator itr)
{
maData.erase(itr);
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 9a4ff48aeea8..2511027ec78e 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -344,7 +344,7 @@ void ScTpUserLists::AddNewList( const OUString& rEntriesStr )
MakeListStr( theEntriesStr );
- pUserLists->push_back(new ScUserListData(theEntriesStr));
+ pUserLists->push_back(ScUserListData(rEntriesStr));
}
void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index f5036f1b8f6d..c0e61a78db8d 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -358,12 +358,12 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
pUserList->clear(); // alle Eintraege raus
sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
+ pUserList->reserve(nCount);
const OUString* pAry = aSeq.getConstArray();
for (sal_uInt16 i=0; i<nCount; i++)
{
OUString aEntry = pAry[i];
- ScUserListData* pData = new ScUserListData(aEntry);
- pUserList->push_back(pData);
+ pUserList->push_back( ScUserListData(aEntry) );
}
bSaveApp = true; // Liste wird mit den App-Optionen gespeichert
}