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); {