summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-11-09 15:50:01 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-11-09 17:00:00 +0100
commit56db6406b0b63a2d2d99024e7c311ebd874f3893 (patch)
treeb7096b526b5bfd5f5a474f467761f7065f8e81c2 /sw/inc
parentcb8a05bfccf77d5217f4f2e20b5898d6a24f990d (diff)
sw content controls: allow no list items in a dropdown
- Replace SwContentControl::HasListItems(), which assumed that the type is dropdown if we have list items. This is not valid, it's OK to have a dropdown with no list items. Add a GetDropDown() instead to check for the type, explicitly. - UNO API sets the dropdown bit when list items are set and the type is not expilcitly combo box or drop down, to keep backwards compatibility with existing documents. - No change to the edit shell, SwDropDownContentControlButton already checked if items are empty and used STR_DROP_DOWN_EMPTY_LIST in that case, but that was dead code previously. - ODT & DOCX filters are now updated, ODF has a new <loext:content-control loext:dropdown="..."> attribute to specify that the type is a dropdown, explicitly. Change-Id: Id577ba9639151549a8f953aab31685a73a898504 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142491 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/formatcontentcontrol.hxx9
-rw-r--r--sw/inc/unoprnms.hxx1
2 files changed, 8 insertions, 2 deletions
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index adbc4c10a3e6..2d5676a1e3dd 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -152,6 +152,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify
/// Same as drop-down, but free-form input is also accepted.
bool m_bComboBox = false;
+ /// Same as combo box, but free-form input is not accepted.
+ bool m_bDropDown = false;
+
/// The placeholder's doc part: just remembered.
OUString m_aPlaceholderDocPart;
@@ -234,8 +237,6 @@ public:
const std::vector<SwContentControlListItem>& GetListItems() const { return m_aListItems; }
- bool HasListItems() const { return !m_aListItems.empty(); }
-
void SetListItems(const std::vector<SwContentControlListItem>& rListItems)
{
m_aListItems = rListItems;
@@ -278,6 +279,10 @@ public:
bool GetComboBox() const { return m_bComboBox; }
+ void SetDropDown(bool bDropDown) { m_bDropDown = bDropDown; }
+
+ bool GetDropDown() const { return m_bDropDown; }
+
void SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
{
m_aPlaceholderDocPart = rPlaceholderDocPart;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 61cdcbb05938..4249949add6d 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -885,6 +885,7 @@
#define UNO_NAME_CURRENT_DATE "CurrentDate"
#define UNO_NAME_PLAIN_TEXT "PlainText"
#define UNO_NAME_COMBO_BOX "ComboBox"
+#define UNO_NAME_DROP_DOWN "DropDown"
#define UNO_NAME_PLACEHOLDER_DOC_PART "PlaceholderDocPart"
#define UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS "DataBindingPrefixMappings"
#define UNO_NAME_DATA_BINDING_XPATH "DataBindingXpath"