summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2024-11-21 09:37:15 +0100
committerAndras Timar <andras.timar@collabora.com>2024-11-21 11:04:46 +0100
commit134d681f56f9e0c047c8f4fbf136e7accf8a7ef6 (patch)
tree2754c51ef9eac5078609e59d16c8654a1ffa6513
parent61374f478ffbe30c15467d214dd2a64b1f5adf62 (diff)
docx: export empty GrabBag elements as self-closing xml tags - 2cp-24.04.9-3
In 6cb711645b8d8f3cee0d3454e193cc7bf1cad305 the condition was not good, because there is a special element called "attributes" which is not a child element but contains attributes of the current element. In the condition we should check for 0 elements that are not "attributes". Change-Id: I1d6995e13f288902c1cce85ac3b7d4e0da213df8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176907 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit ade846aa29a8dc06a12032702a4dae2158581e89) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176912 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b0026f53a4c0..8373c0c88f38 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3497,6 +3497,7 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c
{
css::uno::Sequence<css::beans::PropertyValue> aAttributes;
rtl::Reference<FastAttributeList> pAttributes = FastSerializerHelper::createAttrList();
+ sal_Int32 nElements = 0;
for (const auto& rElement : rElements)
{
@@ -3504,6 +3505,10 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c
{
rElement.Value >>= aAttributes;
}
+ else
+ {
+ ++nElements;
+ }
}
for (const auto& rAttribute : std::as_const(aAttributes))
@@ -3525,7 +3530,7 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c
pAttributes->add(*aSubElementId, aValue);
}
- if (rElements.size() == 0)
+ if (nElements == 0)
{
pSerializer->singleElement(aElementId, pAttributes);
}