22#include <com/sun/star/beans/PropertyValue.hpp>
31using namespace css::awt;
32using namespace css::uno;
33using namespace css::beans;
34using namespace css::lang;
35using namespace css::frame;
36using namespace css::util;
50 virtual void dispose()
override;
73 ,
m_xWidget(m_xBuilder->weld_combo_box(
"listbox"))
74 , m_pListBoxListener( pListBoxListener )
89 return ChildKeyInput(rKEvt);
106 if (m_pListBoxListener)
107 m_pListBoxListener->Select();
112 if (m_pListBoxListener)
113 m_pListBoxListener->GetFocus();
118 if (m_pListBoxListener)
119 m_pListBoxListener->LoseFocus();
123 const Reference< XComponentContext >& rxContext,
124 const Reference< XFrame >& rFrame,
130 , m_pListBoxControl( nullptr )
185 if ( rControlCommand.Command ==
"SetList" )
187 for (
const NamedValue& rArg : rControlCommand.Arguments )
189 if ( rArg.Name ==
"List" )
191 Sequence< OUString > aList;
194 rArg.Value >>= aList;
195 for (OUString
const & rName : std::as_const(aList))
201 uno::Sequence< beans::NamedValue > aInfo { {
"List", css::uno::Any(aList) } };
210 else if ( rControlCommand.Command ==
"AddEntry" )
213 for (
const NamedValue& rArg : rControlCommand.Arguments )
215 if ( rArg.Name ==
"Text" )
217 if ( rArg.Value >>= aText )
223 else if ( rControlCommand.Command ==
"InsertEntry" )
227 for (
const NamedValue& rArg : rControlCommand.Arguments )
229 if ( rArg.Name ==
"Pos" )
231 sal_Int32 nTmpPos = 0;
232 if ( rArg.Value >>= nTmpPos )
234 if (( nTmpPos >= 0 ) &&
235 ( nTmpPos < m_pListBoxControl->get_count() ))
239 else if ( rArg.Name ==
"Text" )
240 rArg.Value >>= aText;
245 else if ( rControlCommand.Command ==
"RemoveEntryPos" )
247 for (
const NamedValue& rArg : rControlCommand.Arguments )
249 if ( rArg.Name ==
"Pos" )
251 sal_Int32
nPos( -1 );
252 if ( rArg.Value >>=
nPos )
254 if ( 0 <=
nPos && nPos < m_pListBoxControl->get_count() )
261 else if ( rControlCommand.Command ==
"RemoveEntryText" )
263 for (
const NamedValue& rArg : rControlCommand.Arguments )
265 if ( rArg.Name ==
"Text" )
268 if ( rArg.Value >>= aText )
virtual void dispose() override
void InitControlBase(weld::Widget *pWidget)
static VclPtr< reference_type > Create(Arg &&... arg)
DECL_LINK(FocusInHdl, weld::Widget &, void)
virtual ~ListBoxControl() override
DECL_LINK(ModifyHdl, weld::ComboBox &, void)
virtual void dispose() override
int find_text(const OUString &rStr) const
DECL_LINK(KeyInputHdl, const ::KeyEvent &, bool)
ListBoxControl(vcl::Window *pParent, DropdownToolbarController *pListBoxListener)
std::unique_ptr< weld::ComboBox > m_xWidget
DECL_LINK(FocusOutHdl, weld::Widget &, void)
OUString get_active_text() const
void set_active(int nPos)
void insert_text(int nPos, const OUString &rStr)
void append_text(const OUString &rStr)
DropdownToolbarController * m_pListBoxListener
virtual void SetSizePixel(const Size &rNewSize)
Size get_preferred_size() const
#define LINK(Instance, Class, Member)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent &, rEvent, void)
IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone *, void)
asynchronous callback @descr We start all actions inside this object asynchronous (see comments there...