sw/CppunitTest_sw_ooxmlexport10.mk         |    4 +++
 sw/CppunitTest_sw_ooxmlimport.mk           |    4 +++
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |   32 +++++++++++++++++++++++------
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   17 +++++++++++----
 4 files changed, 47 insertions(+), 10 deletions(-)

New commits:
commit 0b888c78549f99987a31af33321f7618f771fe27
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Jan 6 16:24:32 2024 +0000
Commit:     Julien Nabet <[email protected]>
CommitDate: Sat Jan 6 19:12:02 2024 +0100

    fix build
    
    since:
    
    commit df1e72b853d2ec8c565c8cdf35087824e6a98f40
    Date:   Mon Jan 1 02:15:52 2024 +0100
    
        Use officecfg instead of SvtFilterOptions wrapper in sc
    
    Change-Id: I8b90389e60b3bebf6f88bca2784188fea3682e12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161711
    Reviewed-by: Julien Nabet <[email protected]>
    Tested-by: Julien Nabet <[email protected]>

diff --git a/sw/CppunitTest_sw_ooxmlexport10.mk 
b/sw/CppunitTest_sw_ooxmlexport10.mk
index 4976da4ac605..45ebc36d9035 100644
--- a/sw/CppunitTest_sw_ooxmlexport10.mk
+++ b/sw/CppunitTest_sw_ooxmlexport10.mk
@@ -11,4 +11,8 @@
 
 $(eval $(call sw_ooxmlexport_test,10))
 
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport10,\
+    officecfg/registry \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk
index 0df45a3b11c5..b419b6d7c1d8 100644
--- a/sw/CppunitTest_sw_ooxmlimport.mk
+++ b/sw/CppunitTest_sw_ooxmlimport.mk
@@ -15,6 +15,10 @@ ifneq ($(OS),MACOSX)
 $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_ooxmlimport))
 endif
 
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlimport,\
+    officecfg/registry \
+))
+
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_ooxmlimport, \
     sw/qa/extras/ooxmlimport/ooxmlimport \
 ))
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 44c93c5886fe..f519c9ddfe87 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -30,10 +30,10 @@
 #include <com/sun/star/text/XTextTablesSupplier.hpp>
 
 #include <tools/UnitConversion.hxx>
-#include <unotools/fltrcfg.hxx>
+#include <comphelper/scopeguard.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
-#include <comphelper/scopeguard.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -62,8 +62,18 @@ DECLARE_OOXMLEXPORT_TEST(testWPGtextboxes, 
"testWPGtextboxes.docx")
 
 CPPUNIT_TEST_FIXTURE(Test, testSmartart)
 {
-    SvtFilterOptions::Get().SetSmartArt2Shape(true);
-    comphelper::ScopeGuard g([] { 
SvtFilterOptions::Get().SetSmartArt2Shape(false); });
+    // experimental config setting
+    bool bOrigSet = 
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get();
+    Resetter resetter(
+        [bOrigSet] () {
+            std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+                    comphelper::ConfigurationChanges::create());
+            
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet,
 pBatch);
+            return pBatch->commit();
+        });
+    std::shared_ptr<comphelper::ConfigurationChanges> 
pBatch(comphelper::ConfigurationChanges::create());
+    
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true,
 pBatch);
+    pBatch->commit();
 
     auto verify = [this]() {
         CPPUNIT_ASSERT_EQUAL(1, getShapes());
@@ -532,8 +542,18 @@ DECLARE_OOXMLEXPORT_TEST(testStrict, "strict.docx")
 
 CPPUNIT_TEST_FIXTURE(Test, testSmartartStrict)
 {
-    SvtFilterOptions::Get().SetSmartArt2Shape(true);
-    comphelper::ScopeGuard g([] { 
SvtFilterOptions::Get().SetSmartArt2Shape(false); });
+    // experimental config setting
+    bool bOrigSet = 
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get();
+    Resetter resetter(
+        [bOrigSet] () {
+            std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+                    comphelper::ConfigurationChanges::create());
+            
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet,
 pBatch);
+            return pBatch->commit();
+        });
+    std::shared_ptr<comphelper::ConfigurationChanges> 
pBatch(comphelper::ConfigurationChanges::create());
+    
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true,
 pBatch);
+    pBatch->commit();
 
     auto verify = [this]() {
         uno::Reference<container::XIndexAccess> xGroup(getShape(1), 
uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4e0b0f80be57..b5f2eafdc6ae 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -56,13 +56,13 @@
 #include <com/sun/star/text/XTextTable.hpp>
 
 #include <o3tl/cppunittraitshelper.hxx>
-#include <unotools/fltrcfg.hxx>
-#include <comphelper/sequenceashashmap.hxx>
 #include <tools/datetimeutils.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
 #include <unotools/streamwrap.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 #include <vcl/TypeSerializer.hxx>
 #include <comphelper/scopeguard.hxx>
 
@@ -1374,8 +1374,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo87488)
     // The shape on the right (index 0, CustomShape within a
     // GroupShape) is rotated 90 degrees clockwise and contains text
     // rotated 90 degrees anticlockwise.
-    SvtFilterOptions::Get().SetSmartArt2Shape(true);
-    comphelper::ScopeGuard g([] { 
SvtFilterOptions::Get().SetSmartArt2Shape(false); });
+    bool bOrigSet = 
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get();
+    Resetter resetter(
+        [bOrigSet] () {
+            std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+                    comphelper::ConfigurationChanges::create());
+            
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet,
 pBatch);
+            return pBatch->commit();
+        });
+    std::shared_ptr<comphelper::ConfigurationChanges> 
pBatch(comphelper::ConfigurationChanges::create());
+    
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true,
 pBatch);
+    pBatch->commit();
     createSwDoc("fdo87488.docx");
     uno::Reference<container::XIndexAccess> group(getShape(1), uno::UNO_QUERY);
     {

Reply via email to