diff options
author | Andras Timar <andras.timar@collabora.com> | 2024-11-21 09:37:15 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-11-21 12:45:20 +0100 |
commit | a1a21ca3d4a8c36620fcb2e2af0b6ddd300f6739 (patch) | |
tree | 3df80c4dee24dc44fe3f68791f323ef92ccd048b /sw | |
parent | cb362d3b4a09f612e27036d5f994479c4fa808c3 (diff) |
docx: export empty GrabBag elements as self-closing xml tags - 2
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/+/176900
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f3b5ce705242..8061bdcd9f49 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3490,6 +3490,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) { @@ -3497,6 +3498,10 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c { rElement.Value >>= aAttributes; } + else + { + ++nElements; + } } for (const auto& rAttribute : aAttributes) @@ -3518,7 +3523,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); } |