21 mark::IFieldmark* pDropDownField)
22 : GenericDialogController(pParent,
"modules/swriter/ui/dropdownformfielddialog.ui",
23 "DropDownFormFieldDialog")
24 , m_pDropDownField(pDropDownField)
25 , m_bListHasChanged(false)
26 , m_xListItemEntry(m_xBuilder->weld_entry(
"item_entry"))
27 , m_xListAddButton(m_xBuilder->weld_button(
"add_button"))
28 , m_xListItemsTreeView(m_xBuilder->weld_tree_view(
"items_treeview"))
29 , m_xListRemoveButton(m_xBuilder->weld_button(
"remove_button"))
30 , m_xListUpButton(m_xBuilder->weld_button(
"up_button"))
31 , m_xListDownButton(m_xBuilder->weld_button(
"down_button"))
55 if (rEvent.GetKeyCode().GetCode() ==
KEY_RETURN && !m_xListItemEntry->get_text().isEmpty())
67 if (&rButton == m_xListAddButton.get())
71 else if (m_xListItemsTreeView->get_selected_index() != -1)
73 int nSelPos = m_xListItemsTreeView->get_selected_index();
74 if (&rButton == m_xListRemoveButton.get())
76 m_xListItemsTreeView->remove(nSelPos);
77 if (m_xListItemsTreeView->n_children() > 0)
78 m_xListItemsTreeView->select(nSelPos ? nSelPos - 1 : 0);
80 else if (&rButton == m_xListUpButton.get())
82 const OUString sEntry = m_xListItemsTreeView->get_selected_text();
83 m_xListItemsTreeView->remove(nSelPos);
85 m_xListItemsTreeView->insert_text(nSelPos, sEntry);
86 m_xListItemsTreeView->select(nSelPos);
88 else if (&rButton == m_xListDownButton.get())
90 const OUString sEntry = m_xListItemsTreeView->get_selected_text();
91 m_xListItemsTreeView->remove(nSelPos);
93 m_xListItemsTreeView->insert_text(nSelPos, sEntry);
94 m_xListItemsTreeView->select(nSelPos);
96 m_bListHasChanged =
true;
105 const mark::IFieldmark::parameter_map_t*
const pParameters
109 if (pListEntries != pParameters->end())
111 css::uno::Sequence<OUString> vListEntries;
112 pListEntries->second >>= vListEntries;
113 for (
const OUString& rItem : std::as_const(vListEntries))
118 if (pResult != pParameters->end())
120 sal_Int32 nSelection = -1;
121 pResult->second >>= nSelection;
122 if (nSelection >= 0 && nSelection < vListEntries.getLength())
138 m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok,
139 SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT)));
145 if (!sEntry.isEmpty())
168 && nSelPos < m_xListItemsTreeView->n_children() - 1);
176 mark::IFieldmark::parameter_map_t* pParameters =
m_pDropDownField->GetParameters();
179 auto vListEntriesRange = asNonConstRange(vListEntries);
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::shared_ptr< weld::Dialog > m_xDialog
constexpr sal_uInt16 KEY_RETURN
#define LINK(Instance, Class, Member)
Dialog to specify the properties of date form field.
IMPL_LINK_NOARG(DocumentTimerManager, DoIdleJobs, Timer *, void)
IMPL_LINK(DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pIdle, void)
constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT
#define ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT
constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY
OUString SwResId(TranslateId aId)