summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-11-22 14:30:08 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-11-22 19:36:37 +0100
commit100c914d44ae8f362924fe567d7d41d0033ae8ad (patch)
tree7b598ced8fdcf9c662c6c432c6a954aa383e82b8 /sw/inc
parentb71303fe1b06c1711ad80e5a0269d41ccaaad8e1 (diff)
DOCX filter: fix <w:id> creating both grab-bag and content control for <w:sdt>
Exporting the DOCX bugdoc back to DOCX resulted in a document that can't be opened in Word. Examining the output, the problem is that the document had 2 inline <w:sdt> elements with <w:id>, and we mapped such <w:sdt> elements to both grab-bags and content controls, leading to duplicate <w:sdt> elements on export. This is schema-valid, but it goes against the intention of the spec and Word can't open it. The initial fix was just a writerfilter/ tweak to avoid grab-bagging <w:id> for inline <w:sdt>, but CppunitTest_sw_ooxmlexport4's testSimpleSdts points out that in other cases we already require preserving <w:id>. Fix the problem by storing <w:id> in the content control, which is essentially a subset of <https://gerrit.libreoffice.org/c/core/+/142818>. Thanks to Justin Luth! - he prototyped the DOCX filter for <w:id>. Change-Id: I9f002b770049ce8be30253d0b39410d9a58981dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143117 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/formatcontentcontrol.hxx7
-rw-r--r--sw/inc/unoprnms.hxx1
2 files changed, 8 insertions, 0 deletions
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 2d5676a1e3dd..3ac6848e388f 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -176,6 +176,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify
/// The tag: just remembered.
OUString m_aTag;
+ /// The id: just remembered.
+ sal_Int32 m_nId = 0;
+
/// Stores a list item index, in case the doc model is not yet updated.
std::optional<size_t> m_oSelectedListItem;
@@ -342,6 +345,10 @@ public:
const OUString& GetTag() const { return m_aTag; }
+ void SetId(sal_Int32 nId) { m_nId = nId; }
+
+ sal_Int32 GetId() const { return m_nId; }
+
void SetReadWrite(bool bReadWrite) { m_bReadWrite = bReadWrite; }
bool GetReadWrite() const { return m_bReadWrite; }
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 4249949add6d..69ef10b881f9 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -893,6 +893,7 @@
#define UNO_NAME_COLOR "Color"
#define UNO_NAME_ALIAS "Alias"
#define UNO_NAME_TAG "Tag"
+#define UNO_NAME_ID "Id"
#define UNO_NAME_DATE_STRING "DateString"
#endif