Kaydet (Commit) 6e1c20b9 authored tarafından Noel Grandin's avatar Noel Grandin

vcl: boost::ptr_vector->std::vector<std::unique_ptr>

Change-Id: I91d833a541f1d21be66789bba6c983aa741731d8
üst c8b2f752
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#ifndef INCLUDED_VCL_INC_ILSTBOX_HXX #ifndef INCLUDED_VCL_INC_ILSTBOX_HXX
#define INCLUDED_VCL_INC_ILSTBOX_HXX #define INCLUDED_VCL_INC_ILSTBOX_HXX
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
#include <boost/signals2/signal.hpp> #include <boost/signals2/signal.hpp>
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include <vcl/ctrl.hxx> #include <vcl/ctrl.hxx>
...@@ -51,7 +52,7 @@ struct ImplEntryType ...@@ -51,7 +52,7 @@ struct ImplEntryType
OUString maStr; OUString maStr;
Image maImage; Image maImage;
void* mpUserData; void* mpUserData;
bool mbIsSelected; bool mbIsSelected;
ListBoxEntryFlags mnFlags; ListBoxEntryFlags mnFlags;
long mnHeight; long mnHeight;
...@@ -97,13 +98,13 @@ private: ...@@ -97,13 +98,13 @@ private:
Link<sal_Int32,void> maSelectionChangedHdl; Link<sal_Int32,void> maSelectionChangedHdl;
bool mbCallSelectionChangedHdl; bool mbCallSelectionChangedHdl;
boost::ptr_vector<ImplEntryType> maEntries; std::vector<std::unique_ptr<ImplEntryType> > maEntries;
ImplEntryType* GetEntry( sal_Int32 nPos ) const ImplEntryType* GetEntry( sal_Int32 nPos ) const
{ {
if (nPos < 0 || static_cast<size_t>(nPos) >= maEntries.size()) if (nPos < 0 || static_cast<size_t>(nPos) >= maEntries.size())
return nullptr; return nullptr;
return const_cast<ImplEntryType*>(&maEntries[nPos]); return const_cast<ImplEntryType*>(maEntries[nPos].get());
} }
public: public:
......
...@@ -87,12 +87,12 @@ void ImplEntryList::SelectEntry( sal_Int32 nPos, bool bSelect ) ...@@ -87,12 +87,12 @@ void ImplEntryList::SelectEntry( sal_Int32 nPos, bool bSelect )
{ {
if (0 <= nPos && static_cast<size_t>(nPos) < maEntries.size()) if (0 <= nPos && static_cast<size_t>(nPos) < maEntries.size())
{ {
boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+nPos; std::vector<std::unique_ptr<ImplEntryType> >::iterator iter = maEntries.begin()+nPos;
if ( ( iter->mbIsSelected != bSelect ) && if ( ( (*iter)->mbIsSelected != bSelect ) &&
( (iter->mnFlags & ListBoxEntryFlags::DisableSelection) == ListBoxEntryFlags::NONE ) ) ( ( (*iter)->mnFlags & ListBoxEntryFlags::DisableSelection) == ListBoxEntryFlags::NONE ) )
{ {
iter->mbIsSelected = bSelect; (*iter)->mbIsSelected = bSelect;
if ( mbCallSelectionChangedHdl ) if ( mbCallSelectionChangedHdl )
maSelectionChangedHdl.Call( nPos ); maSelectionChangedHdl.Call( nPos );
} }
...@@ -135,12 +135,12 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, ...@@ -135,12 +135,12 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry,
if (0 <= nPos && nPos < nEntriesSize) if (0 <= nPos && nPos < nEntriesSize)
{ {
insPos = nPos; insPos = nPos;
maEntries.insert( maEntries.begin() + nPos, pNewEntry ); maEntries.insert( maEntries.begin() + nPos, std::unique_ptr<ImplEntryType>(pNewEntry) );
} }
else else
{ {
insPos = nEntriesSize; insPos = nEntriesSize;
maEntries.push_back(pNewEntry); maEntries.push_back(std::unique_ptr<ImplEntryType>(pNewEntry));
} }
} }
else else
...@@ -159,7 +159,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, ...@@ -159,7 +159,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry,
if ( nComp >= 0 ) if ( nComp >= 0 )
{ {
insPos = nEntriesSize; insPos = nEntriesSize;
maEntries.push_back(pNewEntry); maEntries.push_back(std::unique_ptr<ImplEntryType>(pNewEntry));
} }
else else
{ {
...@@ -169,7 +169,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, ...@@ -169,7 +169,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry,
if ( nComp <= 0 ) if ( nComp <= 0 )
{ {
insPos = 0; insPos = 0;
maEntries.insert(maEntries.begin(),pNewEntry); maEntries.insert(maEntries.begin(), std::unique_ptr<ImplEntryType>(pNewEntry));
} }
else else
{ {
...@@ -201,7 +201,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, ...@@ -201,7 +201,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry,
nMid++; nMid++;
insPos = nMid; insPos = nMid;
maEntries.insert(maEntries.begin()+nMid,pNewEntry); maEntries.insert(maEntries.begin()+nMid, std::unique_ptr<ImplEntryType>(pNewEntry));
} }
} }
} }
...@@ -212,7 +212,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, ...@@ -212,7 +212,7 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry,
// Collator implementation is garbage then give the user a chance to see // Collator implementation is garbage then give the user a chance to see
// his stuff // his stuff
insPos = 0; insPos = 0;
maEntries.insert(maEntries.begin(),pNewEntry); maEntries.insert(maEntries.begin(), std::unique_ptr<ImplEntryType>(pNewEntry));
} }
} }
...@@ -224,9 +224,9 @@ void ImplEntryList::RemoveEntry( sal_Int32 nPos ) ...@@ -224,9 +224,9 @@ void ImplEntryList::RemoveEntry( sal_Int32 nPos )
{ {
if (0 <= nPos && static_cast<size_t>(nPos) < maEntries.size()) if (0 <= nPos && static_cast<size_t>(nPos) < maEntries.size())
{ {
boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+ nPos; std::vector<std::unique_ptr<ImplEntryType> >::iterator iter = maEntries.begin()+ nPos;
if ( !!iter->maImage ) if ( !!(*iter)->maImage )
mnImages--; mnImages--;
maEntries.erase(iter); maEntries.erase(iter);
...@@ -238,7 +238,7 @@ sal_Int32 ImplEntryList::FindEntry( const OUString& rString, bool bSearchMRUArea ...@@ -238,7 +238,7 @@ sal_Int32 ImplEntryList::FindEntry( const OUString& rString, bool bSearchMRUArea
const sal_Int32 nEntries = static_cast<sal_Int32>(maEntries.size()); const sal_Int32 nEntries = static_cast<sal_Int32>(maEntries.size());
for ( sal_Int32 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) for ( sal_Int32 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ )
{ {
OUString aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n].maStr ) ); OUString aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n]->maStr ) );
if ( aComp == rString ) if ( aComp == rString )
return n; return n;
} }
......
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