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

Change-Id: I6a0b9d539489b7774c3437871f31fd28e737c901
This commit is contained in:
Noel Grandin
2015-11-11 14:08:04 +02:00
parent 10629489d3
commit c8b2f752ce
3 changed files with 10 additions and 10 deletions

View File

@@ -44,7 +44,6 @@
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_map.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <memory> #include <memory>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <cassert> #include <cassert>

View File

@@ -19,14 +19,15 @@
#ifndef INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX #ifndef INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX
#define INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX #define INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
#include <sfx2/mnuitem.hxx> #include <sfx2/mnuitem.hxx>
class SfxBindings; class SfxBindings;
class SfxMenuImageControl_Impl; class SfxMenuImageControl_Impl;
typedef ::boost::ptr_vector<SfxMenuControl> SfxMenuCtrlArr_Impl; typedef std::vector<std::unique_ptr<SfxMenuControl> > SfxMenuCtrlArr_Impl;
class SAL_DLLPUBLIC_EXPORT SfxVirtualMenu class SAL_DLLPUBLIC_EXPORT SfxVirtualMenu
{ {

View File

@@ -366,7 +366,7 @@ void SfxVirtualMenu::CreateFromSVMenu()
pPopup = nullptr; pPopup = nullptr;
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.push_back(pMnuCtrl); rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl));
(pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings);
pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings);
@@ -409,7 +409,7 @@ void SfxVirtualMenu::CreateFromSVMenu()
if ( pMnuCtrl ) if ( pMnuCtrl )
{ {
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.push_back(pMnuCtrl); rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl));
(pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings);
} }
} }
@@ -421,7 +421,7 @@ void SfxVirtualMenu::CreateFromSVMenu()
if ( pMnuCtrl ) if ( pMnuCtrl )
{ {
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.push_back(pMnuCtrl); rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl));
(pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings);
} }
else else
@@ -691,10 +691,10 @@ void SfxVirtualMenu::BindControllers()
for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin();
i != rCtrlArr.end(); ++i) i != rCtrlArr.end(); ++i)
{ {
sal_uInt16 nSlotId = i->GetId(); sal_uInt16 nSlotId = (*i)->GetId();
if (pSVMenu->GetItemCommand(nSlotId).isEmpty()) if (pSVMenu->GetItemCommand(nSlotId).isEmpty())
{ {
i->ReBind(); (*i)->ReBind();
} }
} }
@@ -718,10 +718,10 @@ void SfxVirtualMenu::UnbindControllers()
for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin();
i != rCtrlArr.end(); ++i) i != rCtrlArr.end(); ++i)
{ {
if (i->IsBound()) if ((*i)->IsBound())
{ {
// UnoController is not bound! // UnoController is not bound!
i->UnBind(); (*i)->UnBind();
} }
} }