Kaydet (Commit) 2ebfe6fd authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR_DEL(SwEntryLst) to boost::ptr_vector

üst 362b4e9b
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
using namespace nsSwComboBoxStyle; using namespace nsSwComboBoxStyle;
SV_IMPL_PTRARR(SwEntryLst, SwBoxEntry*)
// Description: ListboxElement // Description: ListboxElement
SwBoxEntry::SwBoxEntry() : SwBoxEntry::SwBoxEntry() :
bModified(sal_False), bModified(sal_False),
...@@ -70,8 +68,8 @@ SwComboBox::SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits ...@@ -70,8 +68,8 @@ SwComboBox::SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits
sal_uInt16 nSize = GetEntryCount(); sal_uInt16 nSize = GetEntryCount();
for( sal_uInt16 i=0; i < nSize; ++i ) for( sal_uInt16 i=0; i < nSize; ++i )
{ {
const SwBoxEntry* pTmp = new SwBoxEntry(ComboBox::GetEntry(i), i); SwBoxEntry* pTmp = new SwBoxEntry(ComboBox::GetEntry(i), i);
aEntryLst.Insert(pTmp, aEntryLst.Count() ); aEntryLst.push_back(pTmp);
} }
} }
...@@ -87,12 +85,12 @@ void SwComboBox::InsertEntry(const SwBoxEntry& rEntry) ...@@ -87,12 +85,12 @@ void SwComboBox::InsertEntry(const SwBoxEntry& rEntry)
void SwComboBox::RemoveEntry(sal_uInt16 nPos) void SwComboBox::RemoveEntry(sal_uInt16 nPos)
{ {
if(nPos >= aEntryLst.Count()) if(nPos >= aEntryLst.size())
return; return;
// Remove old element // Remove old element
SwBoxEntry* pEntry = aEntryLst[nPos]; SwBoxEntry* pEntry = &aEntryLst[nPos];
aEntryLst.Remove(nPos, 1); aEntryLst.erase(aEntryLst.begin() + nPos);
ComboBox::RemoveEntry(nPos); ComboBox::RemoveEntry(nPos);
// Don't add new entries to the list // Don't add new entries to the list
...@@ -100,7 +98,7 @@ void SwComboBox::RemoveEntry(sal_uInt16 nPos) ...@@ -100,7 +98,7 @@ void SwComboBox::RemoveEntry(sal_uInt16 nPos)
return; return;
// add to DelEntryLst // add to DelEntryLst
aDelEntryLst.C40_INSERT(SwBoxEntry, pEntry, aDelEntryLst.Count()); aDelEntryLst.push_back(pEntry);
} }
sal_uInt16 SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const sal_uInt16 SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const
...@@ -110,21 +108,21 @@ sal_uInt16 SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const ...@@ -110,21 +108,21 @@ sal_uInt16 SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const
const SwBoxEntry& SwComboBox::GetEntry(sal_uInt16 nPos) const const SwBoxEntry& SwComboBox::GetEntry(sal_uInt16 nPos) const
{ {
if(nPos < aEntryLst.Count()) if(nPos < aEntryLst.size())
return *aEntryLst[nPos]; return aEntryLst[nPos];
return aDefault; return aDefault;
} }
sal_uInt16 SwComboBox::GetRemovedCount() const sal_uInt16 SwComboBox::GetRemovedCount() const
{ {
return aDelEntryLst.Count(); return aDelEntryLst.size();
} }
const SwBoxEntry& SwComboBox::GetRemovedEntry(sal_uInt16 nPos) const const SwBoxEntry& SwComboBox::GetRemovedEntry(sal_uInt16 nPos) const
{ {
if(nPos < aDelEntryLst.Count()) if(nPos < aDelEntryLst.size())
return *aDelEntryLst[nPos]; return aDelEntryLst[nPos];
return aDefault; return aDefault;
} }
...@@ -133,7 +131,7 @@ void SwComboBox::InsertSorted(SwBoxEntry* pEntry) ...@@ -133,7 +131,7 @@ void SwComboBox::InsertSorted(SwBoxEntry* pEntry)
{ {
ComboBox::InsertEntry(pEntry->aName); ComboBox::InsertEntry(pEntry->aName);
sal_uInt16 nPos = ComboBox::GetEntryPos(pEntry->aName); sal_uInt16 nPos = ComboBox::GetEntryPos(pEntry->aName);
aEntryLst.C40_INSERT(SwBoxEntry, pEntry, nPos); aEntryLst.insert( aEntryLst.begin() + nPos, pEntry );
} }
void SwComboBox::KeyInput( const KeyEvent& rKEvt ) void SwComboBox::KeyInput( const KeyEvent& rKEvt )
......
...@@ -34,11 +34,12 @@ ...@@ -34,11 +34,12 @@
#include <vcl/combobox.hxx> #include <vcl/combobox.hxx>
#include "swdllapi.h" #include "swdllapi.h"
#include <boost/ptr_container/ptr_vector.hpp>
class SwBoxEntry; class SwBoxEntry;
class Window; class Window;
SV_DECL_PTRARR_DEL(SwEntryLst, SwBoxEntry*, 10) typedef boost::ptr_vector<SwBoxEntry> SwEntryLst;
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
Description: SwBoxEntry Description: SwBoxEntry
......
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