Replace a few for_each and one-liner locals by range-based loops in fpicker.
Change-Id: I07cb510b8c8ab195d5d3addb715cfb0af488ab9b Reviewed-on: https://gerrit.libreoffice.org/19849 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
357a6f6ba2
commit
f045b7cb45
@@ -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()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user