Kaydet (Commit) aa3b3ee8 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

MSForms: Fix handling of drop-down form field after DOC import

In the properties dialog, code expected that the ODF_FORMDROPDOWN_RESULT
is not set in case of an empty list. This caused a crash.
The field popup window code expected that the list is not specified
when it is empty, but DOC import code sets ODF_FORMDROPDOWN_LISTENTRY
even if the list is empty.

Change-Id: If4c86fc5a08cdc578150afaa42ad7e86bdba9150
Reviewed-on: https://gerrit.libreoffice.org/68963Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst e9393e39
...@@ -53,14 +53,15 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l ...@@ -53,14 +53,15 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l
OUString sListKey = ODF_FORMDROPDOWN_LISTENTRY; OUString sListKey = ODF_FORMDROPDOWN_LISTENTRY;
sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries
= pParameters->find(sListKey); = pParameters->find(sListKey);
css::uno::Sequence<OUString> vListEntries;
if (pListEntries != pParameters->end()) if (pListEntries != pParameters->end())
{ {
css::uno::Sequence<OUString> vListEntries;
pListEntries->second >>= vListEntries; pListEntries->second >>= vListEntries;
for (OUString const& i : vListEntries) for (OUString const& i : vListEntries)
aListBox->InsertEntry(i); aListBox->InsertEntry(i);
} }
else
if (vListEntries.getLength() == 0)
{ {
aListBox->InsertEntry(SwResId(STR_DROP_DOWN_EMPTY_LIST)); aListBox->InsertEntry(SwResId(STR_DROP_DOWN_EMPTY_LIST));
} }
......
...@@ -119,7 +119,8 @@ void DropDownFormFieldDialog::InitControls() ...@@ -119,7 +119,8 @@ void DropDownFormFieldDialog::InitControls()
{ {
sal_Int32 nSelection = -1; sal_Int32 nSelection = -1;
pResult->second >>= nSelection; pResult->second >>= nSelection;
m_xListItemsTreeView->select_text(vListEntries[nSelection]); if (vListEntries.getLength() > nSelection)
m_xListItemsTreeView->select_text(vListEntries[nSelection]);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment