diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-08-21 12:05:03 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-08-21 14:31:13 +0200 |
commit | 7d948a25e961e4c26ff98a96255f96477e536571 (patch) | |
tree | da41b40c97346a0ca7109502cf2bd52e4327e4bd | |
parent | tdf#126964: Set background colours to white in IosSalFrame::UpdateSettings() (diff) | |
download | core-7d948a25e961e4c26ff98a96255f96477e536571.tar.gz core-7d948a25e961e4c26ff98a96255f96477e536571.zip |
tdf#126792: DOCX legacy drop-downs are only supposed to hold 25 items, GUI
Implement GUI part. Do not allow to add more items to the drop-down
field if the count of items reached the 25 limit.
Reviewed-on: https://gerrit.libreoffice.org/77843
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit d3c8973f54037f915e12cd038a6a76501d237ea4)
Change-Id: I126edc500bc18e2f0f4b6864775f89be6801f887
Reviewed-on: https://gerrit.libreoffice.org/77874
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r-- | include/xmloff/odffields.hxx | 1 | ||||
-rw-r--r-- | sw/inc/strings.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/fldui/DropDownFormFieldDialog.cxx | 12 |
3 files changed, 14 insertions, 0 deletions
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx index 8b5fc6dc7bcb..c37631f07d46 100644 --- a/include/xmloff/odffields.hxx +++ b/include/xmloff/odffields.hxx @@ -32,6 +32,7 @@ #define ODF_FORMDROPDOWN "vnd.oasis.opendocument.field.FORMDROPDOWN" #define ODF_FORMDROPDOWN_LISTENTRY "Dropdown_ListEntry" #define ODF_FORMDROPDOWN_RESULT "Dropdown_Selected" +#define ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT 25 #define ODF_FORMDATE "vnd.oasis.opendocument.field.FORMDATE" #define ODF_FORMDATE_DATEFORMAT "DateField_DateFormat" // e.g. "MM.DD.YY" diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 8c1cc47a85e8..23e38d90450b 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -523,6 +523,7 @@ #define STR_UNDO_TBLSTYLE_UPDATE NC_("STR_UNDO_TBLSTYLE_UPDATE", "Update table style: $1") #define STR_UNDO_TABLE_DELETE NC_("STR_UNDO_TABLE_DELETE", "Delete table") #define STR_UNDO_INSERT_FORM_FIELD NC_("STR_UNDO_INSERT_FORM_FIELD", "Insert form field") +#define STR_DROP_DOWN_FIELD_ITEM_LIMIT NC_("STR_DROP_DOWN_FIELD_ITEM_LIMIT", "You can specify maximum of 25 items for a drop-down form field.") #define STR_ACCESS_DOC_NAME NC_("STR_ACCESS_DOC_NAME", "Document view") #define STR_ACCESS_DOC_DESC NC_("STR_ACCESS_DOC_DESC", "Document view") diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx index 079aeaad4739..1b9845c983ad 100644 --- a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx @@ -11,6 +11,10 @@ #include <vcl/event.hxx> #include <IMark.hxx> #include <xmloff/odffields.hxx> +#include <vcl/svapp.hxx> +#include <strings.hrc> +#include <swtypes.hxx> +#include <vcl/layout.hxx> namespace sw { @@ -125,6 +129,14 @@ void DropDownFormFieldDialog::AppendItemToList() { if (m_xListAddButton->IsEnabled()) { + if (m_xListItemsTreeView->GetEntryCount() >= ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT) + { + ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT), + VclMessageType::Info) + ->Execute(); + return; + } + const OUString sEntry(m_xListItemEntry->GetText()); if (!sEntry.isEmpty()) { |