Kaydet (Commit) f045b7cb authored tarafından Mario J. Rugiero's avatar Mario J. Rugiero Kaydeden (comit) Noel Grandin

Replace a few for_each and one-liner locals by range-based loops in fpicker.

Change-Id: I07cb510b8c8ab195d5d3addb715cfb0af488ab9b
Reviewed-on: https://gerrit.libreoffice.org/19849Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 357a6f6b
...@@ -20,44 +20,6 @@ ...@@ -20,44 +20,6 @@
#include "customcontrolcontainer.hxx" #include "customcontrolcontainer.hxx"
#include <algorithm> #include <algorithm>
#include <functional>
namespace /* private */
{
void DeleteCustomControl(CCustomControl* aCustomControl)
{
delete aCustomControl;
};
void AlignCustomControl(CCustomControl* aCustomControl)
{
aCustomControl->Align();
};
class CSetFontHelper
{
public:
CSetFontHelper(HFONT hFont) :
m_hFont(hFont)
{
}
void SAL_CALL operator()(CCustomControl* aCustomControl)
{
aCustomControl->SetFont(m_hFont);
}
private:
HFONT m_hFont;
};
}
CCustomControlContainer::~CCustomControlContainer() CCustomControlContainer::~CCustomControlContainer()
...@@ -66,44 +28,26 @@ CCustomControlContainer::~CCustomControlContainer() ...@@ -66,44 +28,26 @@ CCustomControlContainer::~CCustomControlContainer()
} }
void SAL_CALL CCustomControlContainer::Align() void SAL_CALL CCustomControlContainer::Align()
{ {
std::for_each( for (auto aCCustomControl : m_ControlContainer)
m_ControlContainer.begin(), aCCustomControl->Align();
m_ControlContainer.end(),
AlignCustomControl);
} }
void SAL_CALL CCustomControlContainer::SetFont(HFONT hFont) void SAL_CALL CCustomControlContainer::SetFont(HFONT hFont)
{ {
CSetFontHelper aSetFontHelper(hFont); for (auto aCCustomControl : m_ControlContainer)
aCCustomControl->SetFont(hFont);
std::for_each(
m_ControlContainer.begin(),
m_ControlContainer.end(),
aSetFontHelper);
} }
void SAL_CALL CCustomControlContainer::AddControl(CCustomControl* aCustomControl) void SAL_CALL CCustomControlContainer::AddControl(CCustomControl* aCustomControl)
{ {
m_ControlContainer.push_back(aCustomControl); m_ControlContainer.push_back(aCustomControl);
} }
void SAL_CALL CCustomControlContainer::RemoveControl(CCustomControl* aCustomControl) void SAL_CALL CCustomControlContainer::RemoveControl(CCustomControl* aCustomControl)
{ {
ControlContainer_t::iterator iter_end = m_ControlContainer.end(); ControlContainer_t::iterator iter_end = m_ControlContainer.end();
...@@ -119,15 +63,10 @@ void SAL_CALL CCustomControlContainer::RemoveControl(CCustomControl* aCustomCont ...@@ -119,15 +63,10 @@ void SAL_CALL CCustomControlContainer::RemoveControl(CCustomControl* aCustomCont
} }
void SAL_CALL CCustomControlContainer::RemoveAllControls() void SAL_CALL CCustomControlContainer::RemoveAllControls()
{ {
std::for_each( for (auto aCCustomControl : m_ControlContainer)
m_ControlContainer.begin(), delete aCCustomControl;
m_ControlContainer.end(),
DeleteCustomControl);
m_ControlContainer.clear(); m_ControlContainer.clear();
} }
......
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