From 0b888c78549f99987a31af33321f7618f771fe27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 6 Jan 2024 16:24:32 +0000 Subject: [PATCH] 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 Tested-by: Julien Nabet --- sw/CppunitTest_sw_ooxmlexport10.mk | 4 +++ sw/CppunitTest_sw_ooxmlimport.mk | 4 +++ sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 34 +++++++++++++++++----- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 17 ++++++++--- 4 files changed, 48 insertions(+), 11 deletions(-) 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 #include -#include -#include -#include #include +#include +#include +#include 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 pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet, pBatch); + return pBatch->commit(); + }); + std::shared_ptr 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 pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet, pBatch); + return pBatch->commit(); + }); + std::shared_ptr pBatch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true, pBatch); + pBatch->commit(); auto verify = [this]() { uno::Reference 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 #include -#include -#include #include +#include #include #include #include #include +#include #include #include @@ -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 pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(bOrigSet, pBatch); + return pBatch->commit(); + }); + std::shared_ptr pBatch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true, pBatch); + pBatch->commit(); createSwDoc("fdo87488.docx"); uno::Reference group(getShape(1), uno::UNO_QUERY); {