1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: customcontrolcontainer.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_fpicker.hxx"
33 #include "customcontrolcontainer.hxx"
38 //-----------------------------------
40 //-----------------------------------
42 namespace /* private */
44 void DeleteCustomControl(CCustomControl
* aCustomControl
)
46 delete aCustomControl
;
49 void AlignCustomControl(CCustomControl
* aCustomControl
)
51 aCustomControl
->Align();
57 CSetFontHelper(HFONT hFont
) :
62 void SAL_CALL
operator()(CCustomControl
* aCustomControl
)
64 aCustomControl
->SetFont(m_hFont
);
72 //-----------------------------------
74 //-----------------------------------
76 CCustomControlContainer::~CCustomControlContainer()
81 //-----------------------------------
83 //-----------------------------------
85 void SAL_CALL
CCustomControlContainer::Align()
88 m_ControlContainer
.begin(),
89 m_ControlContainer
.end(),
93 //-----------------------------------
95 //-----------------------------------
97 void SAL_CALL
CCustomControlContainer::SetFont(HFONT hFont
)
99 CSetFontHelper
aSetFontHelper(hFont
);
102 m_ControlContainer
.begin(),
103 m_ControlContainer
.end(),
107 //-----------------------------------
109 //-----------------------------------
111 void SAL_CALL
CCustomControlContainer::AddControl(CCustomControl
* aCustomControl
)
113 m_ControlContainer
.push_back(aCustomControl
);
116 //-----------------------------------
118 //-----------------------------------
120 void SAL_CALL
CCustomControlContainer::RemoveControl(CCustomControl
* aCustomControl
)
122 ControlContainer_t::iterator iter_end
= m_ControlContainer
.end();
124 ControlContainer_t::iterator iter
=
125 std::find(m_ControlContainer
.begin(),iter_end
,aCustomControl
);
127 if (iter
!= iter_end
)
130 m_ControlContainer
.remove(aCustomControl
);
134 //-----------------------------------
136 //-----------------------------------
138 void SAL_CALL
CCustomControlContainer::RemoveAllControls()
141 m_ControlContainer
.begin(),
142 m_ControlContainer
.end(),
143 DeleteCustomControl
);
145 m_ControlContainer
.clear();