sw: fix order of attributes in wp:anchor on export

To match original DOCX in eg. tdf#169802 bugdoc.

Change-Id: Ife68c293508bfed4f2a2b1d130e310390513981e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197312
Tested-by: Jenkins
Reviewed-by: Aron Budea <aron.budea@collabora.com>
This commit is contained in:
Aron Budea
2026-01-16 02:36:56 +01:00
parent eb0f75e314
commit b2dd08c6af
+6 -12
View File
@@ -847,7 +847,6 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
&& pObj->GetLayer() != iDocumentDrawModelAccess.GetHeaderFooterHellId()
&& pObj->GetLayer() != iDocumentDrawModelAccess.GetInvisibleHellId();
}
attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
attrList->add(XML_distT, OString::number(TwipsToEMU(nDistT)));
attrList->add(XML_distB, OString::number(TwipsToEMU(nDistB)));
@@ -855,6 +854,11 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
attrList->add(XML_distR, OString::number(TwipsToEMU(nDistR)));
attrList->add(XML_simplePos, "0");
// It seems 0 and 1 have special meaning: just start counting from 2 to avoid issues with that.
// Mandatory attribute, write 0 if pObj is null.
attrList->add(XML_relativeHeight, pObj ? OString::number(pObj->GetOrdNum() + 2) : "0"_ostr);
attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
attrList->add(XML_locked, "0");
bool bLclInTabCell = true;
@@ -876,21 +880,11 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
bLclInTabCell = true;
}
if (bLclInTabCell)
attrList->add(XML_layoutInCell, "1");
else
attrList->add(XML_layoutInCell, "0");
attrList->add(XML_layoutInCell, bLclInTabCell ? "1" : "0");
bool bAllowOverlap = pFrameFormat->GetWrapInfluenceOnObjPos().GetAllowOverlap();
attrList->add(XML_allowOverlap, bAllowOverlap ? "1" : "0");
if (pObj)
// It seems 0 and 1 have special meaning: just start counting from 2 to avoid issues with that.
attrList->add(XML_relativeHeight, OString::number(pObj->GetOrdNum() + 2));
else
// relativeHeight is mandatory attribute, if value is not present, we must write default value
attrList->add(XML_relativeHeight, "0");
if (pObj)
{
OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);