sw/source/filter/ww8/wrtww8.cxx   |   16 ----------------
 sw/source/filter/ww8/wrtww8gr.cxx |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit 4d751703f2ceb78c1ff345c251eb82b7dbe2e32c
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Feb 5 16:19:54 2025 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Feb 7 09:18:21 2025 +0100

    defer getting SvtFilterOptions until its needed
    
    which might be never
    
    Change-Id: I72c71efd754f40371ce77dd507bdd530ec376855
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181187
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 32581a995a9c..d8f742ab9684 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3431,22 +3431,6 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll 
)
     m_pRedlAuthors = nullptr;
     m_aTOXArr.clear();
 
-    if ( !m_oOLEExp )
-    {
-        sal_uInt32 nSvxMSDffOLEConvFlags = 0;
-        const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
-        if ( rOpt.IsMath2MathType() )
-            nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE;
-        if ( rOpt.IsWriter2WinWord() )
-            nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD;
-        if ( rOpt.IsCalc2Excel() )
-            nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL;
-        if ( rOpt.IsImpress2PowerPoint() )
-            nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT;
-
-        m_oOLEExp.emplace( nSvxMSDffOLEConvFlags );
-    }
-
     if ( !m_pOCXExp && m_rDoc.GetDocShell() )
         m_pOCXExp.reset(new SwMSConvertControls(m_rDoc.GetDocShell(), 
m_pCurPam.get()));
 
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx 
b/sw/source/filter/ww8/wrtww8gr.cxx
index 824794430ee6..83da52665c9e 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -36,6 +36,7 @@
 #include <editeng/fhgtitem.hxx>
 #include <svx/svdoole2.hxx>
 
+#include <unotools/fltrcfg.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <fmtanchr.hxx>
 #include <ndgrf.hxx>
@@ -239,6 +240,23 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
     {
         sal_Int64 nAspect = rOLENode.GetAspect();
         svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
+
+        if ( !m_oOLEExp )
+        {
+            sal_uInt32 nSvxMSDffOLEConvFlags = 0;
+            const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
+            if ( rOpt.IsMath2MathType() )
+                nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE;
+            if ( rOpt.IsWriter2WinWord() )
+                nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD;
+            if ( rOpt.IsCalc2Excel() )
+                nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL;
+            if ( rOpt.IsImpress2PowerPoint() )
+                nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT;
+
+            m_oOLEExp.emplace( nSvxMSDffOLEConvFlags );
+        }
+
         m_oOLEExp->ExportOLEObject( aObjRef, *xOleStg );
         if ( nAspect == embed::Aspects::MSOLE_ICON )
         {

Reply via email to