include/oox/export/shapes.hxx          |    1 +
 oox/source/export/shapes.cxx           |   10 ++++++++++
 sc/qa/unit/data/xlsx/tdf165655.xlsx    |binary
 sc/qa/unit/subsequent_export_test4.cxx |   16 ++++++++++++++++
 sc/source/filter/xcl97/xcl97rec.cxx    |    7 +++++++
 sc/source/ui/docshell/docsh6.cxx       |    5 ++++-
 sd/qa/unit/export-tests.cxx            |    3 +--
 xmloff/source/draw/ximpshap.cxx        |   16 ++++++++++++++--
 8 files changed, 53 insertions(+), 5 deletions(-)

New commits:
commit bcb7ef3bc7e070e14aded311a23d8f963ea7122b
Author:     Jaume Pujantell <[email protected]>
AuthorDate: Tue Apr 1 16:02:55 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Fri Apr 4 15:48:03 2025 +0200

    cool#11497 lok: calc: update separators per locale
    
    On LOK, multiple locales might be in use at the same time, so skipping
    the update of native symbols and separators on load is not viable.
    
    I've also tested the original bug for which this code is skipped and it
    seem to not affect online in the same way.
    
    Change-Id: Ic2e6e329c9bdfb55f6a5fdd540d102c05ac168cb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183594
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183667
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Jaume Pujantell <[email protected]>

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index d9ab7e78354b..8b802a8b6dea 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -434,7 +434,10 @@ void ScDocShell::SetFormulaOptions( const 
ScFormulaOptions& rOpt, bool bForLoadi
      * once, for the very first document, empty or loaded. */
     static bool bInitOnce = true;
 
-    if (!bForLoading || bInitOnce)
+    // LOKit may need to jugle different symbols lists for differents users so 
a
+    // single load is not enough, otherwise the wrong separators may be 
expected
+    // for the users locale
+    if (!bForLoading || bInitOnce || comphelper::LibreOfficeKit::isActive())
     {
         bool bForceInit = bInitOnce;
         bInitOnce = false;
commit e8901a21c25535b5bf83af89c6560b7fe505fa93
Author:     Aron Budea <[email protected]>
AuthorDate: Tue Feb 11 11:57:22 2025 +1030
Commit:     Andras Timar <[email protected]>
CommitDate: Fri Apr 4 15:48:03 2025 +0200

    tdf#165181 Don't overwrite guessed media MIME type with default on load
    
    MIME types for media can be the default one,
    'application/vnd.sun.star.media'.
    In ODFs coming from old versions, for media unsupported
    at the time, this default MIME type was used, and is read
    when opening them in new versions.
    
    MIME type is also guessed more accurately from the URI
    (file name and extension), but was overwritten by the saved
    MIME type. When using the UI, it is again overwritten by
    the guessed MIME type, but not when using '--convert-to'.
    
    This can cause a problem when saving ODPs to PPTX, PP will
    consider these files corrupted.
    
    Started happening after bc72514f90d90e1ab3fed8167663e835edf03508.
    
    Change-Id: Icd95b06d54154f3b533840f8a5f381400f2e6108
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181399
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit cde91f936d8b569278f63205e942ea3ded5907b3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181478
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>
    (cherry picked from commit 9d55511024024d72616a197b74775c6a83c37323)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182412
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 428b09e983a1..ad94a985cafb 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -310,8 +310,7 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testMediaEmbedding)
     CPPUNIT_ASSERT_MESSAGE("missing media object", pMediaObj != nullptr);
     CPPUNIT_ASSERT_EQUAL(OUString("vnd.sun.star.Package:Media/button-1.wav"),
                          pMediaObj->getMediaProperties().getURL());
-    CPPUNIT_ASSERT_EQUAL(OUString("application/vnd.sun.star.media"),
-                         pMediaObj->getMediaProperties().getMimeType());
+    CPPUNIT_ASSERT_EQUAL(OUString("audio/x-wav"), 
pMediaObj->getMediaProperties().getMimeType());
 }
 
 CPPUNIT_TEST_FIXTURE(SdExportTest, testFillBitmapUnused)
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 45929e2fb6f4..c1a152d177f0 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3093,8 +3093,20 @@ void SdXMLPluginShapeContext::endFastElement(sal_Int32 
nElement)
         {
             // in case we have a media object
             xProps->setPropertyValue( "MediaURL", uno::Any(maHref));
-
-            xProps->setPropertyValue("MediaMimeType", uno::Any(maMimeType) );
+            // could be from old times when a format was unsupported
+            // likely already guessed a possibly more accurate MIME type from 
MediaURL, don't override
+            bool bUpdateMimeType = false;
+            if (maMimeType != AVMEDIA_MIMETYPE_COMMON)
+                bUpdateMimeType = true;
+            else
+            {
+                OUString aExistingMimeType;
+                xProps->getPropertyValue("MediaMimeType") >>= 
aExistingMimeType;
+                if (aExistingMimeType.isEmpty())
+                    bUpdateMimeType = true;
+            }
+            if (bUpdateMimeType)
+                xProps->setPropertyValue("MediaMimeType", uno::Any(maMimeType) 
);
 
             for( const auto& rParam : std::as_const(maParams) )
             {
commit db15ec574894e9703b8a97151c9f93f71b688d3c
Author:     Aron Budea <[email protected]>
AuthorDate: Mon Mar 10 04:08:31 2025 +1030
Commit:     Andras Timar <[email protected]>
CommitDate: Fri Apr 4 15:48:03 2025 +0200

    tdf#165655 oox: don't export incomplete shape data coming from VML
    
    Some export was added in fd238380ae7820f12ac1f7c52d0f7180a93f3ba3.
    This can result in only anchor pointers and no other data
    saved for certain shapes having no export code, making it an
    invalid file.
    
    Change-Id: I81bf513b6ebaa9f6456a26ccbc3276e019551eca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182699
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit ab45b8d9959f8f392a10d0874c50f26b816a4da8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183597
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 646d462e827b..bf37a0f8f857 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -116,6 +116,7 @@ public:
     void SetURLTranslator(const std::shared_ptr<URLTransformer>& pTransformer);
 
     static bool         NonEmptyText( const css::uno::Reference< 
css::uno::XInterface >& xIface );
+    static bool         IsShapeTypeKnown( const css::uno::Reference< 
css::drawing::XShape >& xShape );
 
     ShapeExport&
                         WritePolyPolygonShape( const css::uno::Reference< 
css::drawing::XShape >& xShape, bool bClosed );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 8a9589b8e7f5..31a29ccec8c9 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2103,6 +2103,16 @@ constexpr auto constMap = 
frozen::make_unordered_map<std::u16string_view, ShapeC
 
 } // end anonymous namespace
 
+
+bool ShapeExport::IsShapeTypeKnown(const Reference<XShape>& xShape)
+{
+    if (!xShape)
+        return false;
+
+    const OUString sShapeType = xShape->getShapeType();
+    return constMap.find(sShapeType) != constMap.end();
+}
+
 ShapeExport& ShapeExport::WriteShape( const Reference< XShape >& xShape )
 {
     if (!xShape)
diff --git a/sc/qa/unit/data/xlsx/tdf165655.xlsx 
b/sc/qa/unit/data/xlsx/tdf165655.xlsx
new file mode 100644
index 000000000000..620b68a4b956
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf165655.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index e8ca463e8441..0c0c5359978e 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1894,6 +1894,22 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf165503)
     CPPUNIT_ASSERT_EQUAL(0, aNodes);
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf165655)
+{
+    createScDoc("xlsx/tdf165655.xlsx");
+
+    save("Calc Office Open XML");
+
+    xmlDocUniquePtr pDrawing = parseExport("xl/drawings/drawing1.xml");
+    CPPUNIT_ASSERT(pDrawing);
+
+    // Original has 3 drawingML and 1 VML objects
+    // Not sure if the VML dropdown should be exported, but as long as it 
cannot be
+    //  exported properly, it should not be exported at all (only the 3 
drawingMLs)
+    const int aNodes = countXPathNodes(pDrawing, 
"/xdr:wsDr/xdr:twoCellAnchor"_ostr);
+    CPPUNIT_ASSERT_EQUAL(3, aNodes);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index e9ae7bdeba42..09fa18036f09 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1305,6 +1305,13 @@ bool ScURLTransformer::isExternalURL(const OUString& 
rURL) const
 
 void XclObjAny::SaveXml( XclExpXmlStream& rStrm )
 {
+    // Return early if unknown shape type, otherwise bogus drawing XML gets 
written
+    if (!ShapeExport::IsShapeTypeKnown(mxShape))
+    {
+        SAL_INFO("sc.filter", "unknown shape");
+        return;
+    }
+
     // Do not output any of the detective shapes and validation circles.
     SdrObject* pObject = SdrObject::getSdrObjectFromXShape(mxShape);
     if (pObject)

Reply via email to