include/oox/export/vmlexport.hxx | 3 +++ oox/source/export/vmlexport.cxx | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-)
New commits: commit fe8a0686667c5d4e6bd963aed5d564e9d29d53a1 Author: Noel Grandin <[email protected]> AuthorDate: Mon Nov 24 21:59:22 2025 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Fri Dec 5 12:13:46 2025 +0100 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 <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195059 diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 139001a2369f..9ee734b068c0 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -91,6 +91,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; diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 01c3d578d1eb..905e63c47eac 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -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."); @@ -1474,6 +1473,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_"));
