fix build

since:

commit df1e72b853
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 <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Caolán McNamara 2024-01-06 16:24:32 +00:00 committed by Julien Nabet
parent 0ba4e0483b
commit 0b888c7854
4 changed files with 48 additions and 11 deletions

View file

@ -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:

View file

@ -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 \
))

View file

@ -30,10 +30,10 @@
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <tools/UnitConversion.hxx>
#include <unotools/fltrcfg.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <officecfg/Office/Common.hxx>
#include <oox/drawingml/drawingmltypes.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);

View file

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