officeotron: fix use of path attribute in vml export

which is only valid for v:shape elements

Change-Id: If650f3073ff4687bcb90791bc8b15bf009d9c71b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194483
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-12-05 09:52:48 +01:00
parent 8999e4ef68
commit b217fa8647
4 changed files with 13 additions and 13 deletions
+3
View File
@@ -90,6 +90,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
/// Remember the shape type.
sal_uInt32 m_nShapeType;
/// Remember the value of the path attribute for the shape xml element.
OString m_ShapePath;
/// Remember the shape flags.
ShapeFlag m_nShapeFlags;
+10 -7
View File
@@ -103,6 +103,7 @@ void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
// opening a shape container
SAL_WARN_IF(m_nShapeType != ESCHER_ShpInst_Nil, "oox.vml", "opening shape inside of a shape!");
m_nShapeType = ESCHER_ShpInst_Nil;
m_ShapePath.clear();
m_pShapeAttrList = FastSerializerHelper::createAttrList();
m_ShapeStyle.setLength(0);
@@ -127,6 +128,7 @@ void VMLExport::CloseContainer()
// cleanup
m_nShapeType = ESCHER_ShpInst_Nil;
m_pShapeAttrList = nullptr;
m_ShapePath.clear();
}
EscherEx::CloseContainer();
@@ -650,13 +652,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
break;
}
}
// path attribute not valid for v:rect
if ( m_nShapeType != ESCHER_ShpInst_Rectangle )
{
OString pathString = aPath.makeStringAndClear();
if ( !pathString.isEmpty() && pathString != "xe" )
m_pShapeAttrList->add( XML_path, pathString );
}
// We set the path attribute in StartShape() because only then do we know what shape we are writing.
OString pathString = aPath.makeStringAndClear();
if ( !pathString.isEmpty() && pathString != "xe" )
m_ShapePath = std::move(pathString);
}
else
SAL_WARN("oox.vml", "unhandled shape path, missing either pVertices or pSegmentInfo.");
@@ -1473,6 +1472,10 @@ sal_Int32 VMLExport::StartShape()
"_x0000_t" + OString::number( m_nShapeType ) );
}
// path attribute only valid for v:shape
if ( nShapeElement == XML_shape && !m_ShapePath.isEmpty())
m_pShapeAttrList->add( XML_path, m_ShapePath );
// allow legacy id (which in form controls and textboxes
// by definition seems to have this otherwise illegal name).
m_pSerializer->setAllowXEscape(!m_sShapeIDPrefix.startsWith("_x0000_"));
@@ -168,9 +168,6 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeEffectPreservation)
{
createSwDoc("shape-effect-preservation.docx");
//FIXME: validation error in OOXML export: Errors: 7
skipValidation();
save(TestFilter::DOCX);
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
@@ -730,9 +730,6 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo82492)
{
createSwDoc("fdo82492.docx");
// FIXME: validation error in OOXML export: Errors: 1
skipValidation();
saveAndReload(TestFilter::DOCX);
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);