include/oox/export/vmlexport.hxx |    3 +++
 oox/source/export/vmlexport.cxx  |   17 ++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 0026a6252e45e6a8288716e7fa89b8edf79e6973
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 24 21:59:22 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Dec 5 12:03:53 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
    (cherry picked from commit b217fa8647fb8f435f481e4f987933ab908710c7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195058
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 97084b827559..ce396687932c 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -92,6 +92,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_"));

Reply via email to