include/oox/export/vmlexport.hxx              |    3 +++
 oox/source/export/vmlexport.cxx               |   17 ++++++++++-------
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx     |    3 ---
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx     |    6 ------
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    3 ---
 5 files changed, 13 insertions(+), 19 deletions(-)

New commits:
commit b217fa8647fb8f435f481e4f987933ab908710c7
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 24 21:59:22 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Dec 5 09:52:48 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

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 92ccaaa133cc..3df20ea2dee9 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -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;
 
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 3fe320726136..5800219fa47a 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.");
@@ -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_"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 564b0a5fe2c9..936c07ef350f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -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);
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 6c1ea023a780..7ed052daf2c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -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);
 
commit 8999e4ef68de1a4a462cf75861deea464446f79f
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Dec 4 18:44:30 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Dec 5 09:52:37 2025 +0100

    these appear to validate now
    
    Change-Id: I8296a3d7efefd42bd03920977d6e0e59f7ffb76b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195027
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index bae3c9b10ec1..3cac5f867bd7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -725,9 +725,6 @@ CPPUNIT_TEST_FIXTURE(Test, testN779642)
     createSwDoc("n779642.docx");
     verify();
 
-    //FIXME: validation error in OOXML export: Errors: 2
-    skipValidation();
-
     saveAndReload(TestFilter::DOCX);
     verify();
 }
@@ -872,9 +869,6 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, 
"conditionalstyles-tbllook.docx")
 {
-    //FIXME: validation error in OOXML export: Errors: 6
-    skipValidation();
-
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);

Reply via email to