22#include <com/sun/star/beans/PropertyValue.hpp>
31using namespace css::uno;
32using namespace css::beans;
33using namespace css::lang;
34using namespace css::frame;
35using namespace css::util;
49 virtual void dispose()
override;
74 ,
m_xWidget(m_xBuilder->weld_combo_box(
"combobox"))
75 , m_pComboboxToolbarController(pComboboxToolbarController)
91 return ChildKeyInput(rKEvt);
96 const int nFound =
m_xWidget->find_text(rText);
117 if (m_pComboboxToolbarController)
120 m_pComboboxToolbarController->Select();
122 m_pComboboxToolbarController->Modify();
128 if (m_pComboboxToolbarController)
129 m_pComboboxToolbarController->GetFocus();
134 if (m_pComboboxToolbarController)
135 m_pComboboxToolbarController->LoseFocus();
140 if (m_pComboboxToolbarController)
141 m_pComboboxToolbarController->Activate();
146 const Reference< XComponentContext >& rxContext,
147 const Reference< XFrame >& rFrame,
153 , m_pComboBox( nullptr )
160 auto nHeight =
m_pComboBox->GetSizePixel().Height();
182 OUString aSelectedText =
m_pComboBox->get_active_text();
222 if ( rControlCommand.Command ==
"SetText" )
224 for (
const NamedValue& rArg : rControlCommand.Arguments )
226 if ( rArg.Name ==
"Text" )
229 rArg.Value >>= aText;
238 else if ( rControlCommand.Command ==
"SetList" )
240 for (
const NamedValue& rArg : rControlCommand.Arguments )
242 if ( rArg.Name ==
"List" )
244 Sequence< OUString > aList;
247 rArg.Value >>= aList;
248 for (OUString
const & rName : std::as_const(aList))
252 uno::Sequence< beans::NamedValue > aInfo { {
"List", css::uno::Any(aList) } };
261 else if ( rControlCommand.Command ==
"AddEntry" )
264 for (
const NamedValue& rArg : rControlCommand.Arguments )
266 if ( rArg.Name ==
"Text" )
268 if ( rArg.Value >>= aText )
274 else if ( rControlCommand.Command ==
"InsertEntry" )
278 for (
const NamedValue& rArg : rControlCommand.Arguments )
280 if ( rArg.Name ==
"Pos" )
282 sal_Int32 nTmpPos = 0;
283 if ( rArg.Value >>= nTmpPos )
285 if (( nTmpPos >= 0 ) &&
286 ( nTmpPos < m_pComboBox->get_count() ))
290 else if ( rArg.Name ==
"Text" )
291 rArg.Value >>= aText;
296 else if ( rControlCommand.Command ==
"RemoveEntryPos" )
298 for (
const NamedValue& rArg : rControlCommand.Arguments )
300 if ( rArg.Name ==
"Pos" )
302 sal_Int32
nPos( -1 );
303 if ( rArg.Value >>=
nPos )
305 if (0 <=
nPos && nPos < m_pComboBox->get_count())
312 else if ( rControlCommand.Command ==
"RemoveEntryText" )
314 for (
const NamedValue& rArg : rControlCommand.Arguments )
316 if ( rArg.Name ==
"Text")
319 if ( rArg.Value >>= aText )
virtual void dispose() override
void InitControlBase(weld::Widget *pWidget)
static VclPtr< reference_type > Create(Arg &&... arg)
int find_text(const OUString &rStr) const
DECL_LINK(ActivateHdl, weld::ComboBox &, bool)
OUString get_active_text() const
ComboBoxControl(vcl::Window *pParent, ComboboxToolbarController *pComboboxToolbarController)
void set_active_or_entry_text(const OUString &rText)
std::unique_ptr< weld::ComboBox > m_xWidget
ComboboxToolbarController * m_pComboboxToolbarController
DECL_LINK(FocusInHdl, weld::Widget &, void)
void append_text(const OUString &rStr)
DECL_LINK(ModifyHdl, weld::ComboBox &, void)
void insert_text(int pos, const OUString &rStr)
virtual void dispose() override
DECL_LINK(FocusOutHdl, weld::Widget &, void)
virtual ~ComboBoxControl() override
DECL_LINK(KeyInputHdl, const ::KeyEvent &, bool)
virtual void SetSizePixel(const Size &rNewSize)
Size get_preferred_size() const
constexpr sal_uInt16 KEY_MODIFIERS_MASK
#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...