filter/qa/unit/textfilterdetect.cxx        |   10 +--
 sd/qa/unit/export-tests-ooxml3.cxx         |   11 +---
 sd/qa/unit/export-tests-ooxml4.cxx         |   45 +++++++++--------
 sd/qa/unit/misc-tests.cxx                  |   31 ++----------
 sw/qa/extras/globalfilter/globalfilter.cxx |   35 +++++--------
 sw/qa/extras/odfimport/odfimport.cxx       |   73 ++++++++---------------------
 sw/qa/extras/rtfexport/rtfexport8.cxx      |   11 +---
 sw/qa/extras/uiwriter/uiwriter4.cxx        |   16 +-----
 sw/qa/extras/uiwriter/uiwriter7.cxx        |   33 ++++++-------
 9 files changed, 99 insertions(+), 166 deletions(-)

New commits:
commit 95f974c26b83f8a4516af07c77ca9ff4be5236ee
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Feb 2 11:00:02 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Feb 2 10:02:18 2026 +0100

    Use ScopedConfigValue
    
    testTdf115005_FallBack_Images didn't restore the manually set value.
    It previously also tested if the setting was read-only; this change
    drops that check (if it were read-only, the test would fail anyway).
    If for some reason, testing the read-only status will prove needed,
    it should be restored as a condition to skip the test.
    
    Change-Id: I7376ec4263a0ecefb4c87fbeedefba21e68ee3b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198506
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 51dd13644ec2..b7188bfaf8ca 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -13,6 +13,7 @@
 #include <editeng/unoprnms.hxx>
 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
+#include <test/commontesttools.hxx>
 
 #include <sdpage.hxx>
 
@@ -413,14 +414,8 @@ int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool 
bAddReplacementImages
 
     // check if fallback images were not created if 
AddReplacementImages=true/false
     // set AddReplacementImages
-    {
-        std::shared_ptr<comphelper::ConfigurationChanges> batch(
-            comphelper::ConfigurationChanges::create());
-        if 
(!officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly())
-            
officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(
-                bAddReplacementImages, batch);
-        batch->commit();
-    }
+    
ScopedConfigValue<officecfg::Office::Common::Save::Graphic::AddReplacementImages>
 aCfg(
+        bAddReplacementImages);
 
     // save the file with already set options
     save(TestFilter::ODP);
commit 4ed617ea728df107f89f9c402f51c138432dbf05
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Feb 2 10:51:27 2026 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Feb 2 10:02:08 2026 +0100

    Use ScopedConfigValue in places where the values weren't restored
    
    The config changes that didn't restore initial values could potentially
    affect other tests in the same test suite, so that could create test
    order dependency.
    
    Change-Id: I53cc2fe4e545852d0bcec865da31f2e2a7896d40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198505
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/filter/qa/unit/textfilterdetect.cxx 
b/filter/qa/unit/textfilterdetect.cxx
index 3f5c2768ada6..7ee499c4cb73 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -7,6 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <sal/config.h>
+
+#include <test/commontesttools.hxx>
 #include <test/unoapi_test.hxx>
 
 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
@@ -188,12 +191,7 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testEmptyFile)
 CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testHybridPDFFile)
 {
     // Make sure that file locking is ON
-    {
-        std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
-            comphelper::ConfigurationChanges::create());
-        
officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::set(true, 
xChanges);
-        xChanges->commit();
-    }
+    
ScopedConfigValue<officecfg::Office::Common::Misc::UseDocumentSystemFileLocking>
 aCfg(true);
 
     // Given a hybrid PDF file
 
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 3b276468048e..8f734e8db8c6 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -15,6 +15,7 @@
 #include <editeng/numitem.hxx>
 #include <docmodel/uno/UnoGradientTools.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <test/commontesttools.hxx>
 
 #include <svx/xlineit0.hxx>
 #include <svx/xlndsit.hxx>
@@ -1170,34 +1171,34 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testNotesAuthorDate)
 {
     createSdImpressDoc("pptx/pres-with-notes.pptx");
 
-    auto pBatch(comphelper::ConfigurationChanges::create());
-    // 1. Remove all personal info, but keep note info
-    
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true,
 pBatch);
-    
officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::set(true,
-                                                                               
         pBatch);
-    pBatch->commit();
+    using ScriptingCfg = officecfg::Office::Common::Security::Scripting;
+    ScopedConfigValue<ScriptingCfg::RemovePersonalInfoOnSaving> aCfg1(true);
+    {
+        // 1. Remove all personal info, but keep note info
+        ScopedConfigValue<ScriptingCfg::KeepNoteAuthorDateInfoOnSaving> 
aCfg2(true);
 
-    saveAndReload(TestFilter::PPTX);
+        saveAndReload(TestFilter::PPTX);
 
-    xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr);
-    assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Hans 
Wurst");
-    assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Max 
Muster");
+        xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr);
+        assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Hans 
Wurst");
+        assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Max 
Muster");
 
-    pXml = parseExport(u"ppt/comments/comment1.xml"_ustr);
-    assertXPath(pXml, "/p:cmLst/p:cm", "dt", u"2024-06-13T12:03:08.000000000");
+        pXml = parseExport(u"ppt/comments/comment1.xml"_ustr);
+        assertXPath(pXml, "/p:cmLst/p:cm", "dt", 
u"2024-06-13T12:03:08.000000000");
+    }
 
-    // 2. Remove all personal info
-    
officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::set(false,
-                                                                               
         pBatch);
-    pBatch->commit();
-    saveAndReload(TestFilter::PPTX);
+    {
+        // 2. Remove all personal info
+        ScopedConfigValue<ScriptingCfg::KeepNoteAuthorDateInfoOnSaving> 
aCfg2(false);
+        saveAndReload(TestFilter::PPTX);
 
-    pXml = parseExport(u"ppt/commentAuthors.xml"_ustr);
-    assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Author1");
-    assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Author2");
+        xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr);
+        assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", 
u"Author1");
+        assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", 
u"Author2");
 
-    pXml = parseExport(u"ppt/comments/comment1.xml"_ustr);
-    assertXPathNoAttribute(pXml, "/p:cmLst/p:cm", "dt");
+        pXml = parseExport(u"ppt/comments/comment1.xml"_ustr);
+        assertXPathNoAttribute(pXml, "/p:cmLst/p:cm", "dt");
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testTableCellVerticalPropertyRoundtrip)
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 298bded2dc12..336b25f2ea01 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -57,6 +57,7 @@
 #include <svx/sdmetitm.hxx>
 #include <svx/xfillit0.hxx>
 #include <svx/xbtmpit.hxx>
+#include <test/commontesttools.hxx>
 #include <unomodel.hxx>
 
 using namespace ::com::sun::star;
@@ -549,10 +550,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings()
     createSdDrawDoc("tdf101242_ODF.odg");
 
     // Saving including items in settings.xml
-    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, 
pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(true);
     save(TestFilter::ODG);
 
     // Verify, that the saved document still has the ODF attributes
@@ -603,10 +601,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings()
     createSdDrawDoc("tdf101242_ODF.odg");
 
     // Saving without items in settings.xml
-    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, 
pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(false);
     save(TestFilter::ODG);
 
     // Verify, that the saved document still has the ODF attributes
@@ -640,10 +635,7 @@ void SdMiscTest::testTdf101242_settings_keep()
     createSdDrawDoc("tdf101242_settings.odg");
 
     // Saving including items in settings.xml
-    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, 
pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(true);
     save(TestFilter::ODG);
 
     // Verify, that the saved document has the ODF attributes
@@ -695,10 +687,7 @@ void SdMiscTest::testTdf101242_settings_remove()
     createSdDrawDoc("tdf101242_settings.odg");
 
     // Saving without config items in settings.xml
-    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, 
pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(false);
     save(TestFilter::ODG);
 
     // Verify, that the saved document has the ODF attributes
@@ -728,10 +717,7 @@ void SdMiscTest::testTdf119392()
     // Loads a document which has two user layers "V--" and "V-L". Inserts a 
new layer "-P-" between them.
     // Checks, that the bitfields in the saved file have the bits in the 
correct order, in case
     // option WriteLayerAsConfigItem is true and the config items are written.
-    std::shared_ptr<comphelper::ConfigurationChanges> batch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, 
batch);
-    batch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(true);
 
     createSdDrawDoc("tdf119392_InsertLayer.odg");
     SdXImpressDocument* pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
@@ -1261,10 +1247,7 @@ void SdMiscTest::testCanvasSlideExportODP()
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), 
pDocument->GetSdPageCount(PageKind::Standard));
 
     // saving with config items in settings.xml
-    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, 
pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem> 
aCfg(true);
     save(TestFilter::ODP);
 
     // Verify if the "HasCanvasPage" item is true
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 3d980b914b7e..8f46e9675c31 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -47,6 +47,8 @@
 
 namespace
 {
+using MSFilterCfg = officecfg::Office::Common::Filter::Microsoft;
+
 class Test : public SwModelTestBase
 {
 public:
@@ -544,18 +546,17 @@ void Test::testCharStyleHighlight()
 
 void Test::testCharHighlight()
 {
-    auto batch = comphelper::ConfigurationChanges::create();
-    
officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false,
 batch);
-    batch->commit();
-
-    testCharHighlightBody();
-    testCharStyleHighlight();
-
-    
officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true,
 batch);
-    batch->commit();
+    {
+        ScopedConfigValue<MSFilterCfg::Export::CharBackgroundToHighlighting> 
aCfg(false);
+        testCharHighlightBody();
+        testCharStyleHighlight();
+    }
 
-    testCharHighlightBody();
-    testCharStyleHighlight();
+    {
+        ScopedConfigValue<MSFilterCfg::Export::CharBackgroundToHighlighting> 
aCfg(true);
+        testCharHighlightBody();
+        testCharStyleHighlight();
+    }
 }
 
 void Test::testCharHighlightODF()
@@ -637,9 +638,7 @@ void Test::testMSCharBackgroundEditing()
         TestFilter::DOCX,
     };
 
-    auto batch = comphelper::ConfigurationChanges::create();
-    
officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true,
 batch);
-    batch->commit();
+    ScopedConfigValue<MSFilterCfg::Export::CharBackgroundToHighlighting> 
aCfg(true);
 
     for (TestFilter eFilterName : aFilterNames)
     {
@@ -743,9 +742,7 @@ void Test::testCharBackgroundToHighlighting()
 
         OString sFailedMessage = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(eFilterName).toUtf8();
 
-        auto batch = comphelper::ConfigurationChanges::create();
-        
officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(true,
 batch);
-        batch->commit();
+        ScopedConfigValue<MSFilterCfg::Export::CharBackgroundToHighlighting> 
aCfg(true);
 
         // Export the document and import again for a check
         saveAndReload(eFilterName);
@@ -851,9 +848,7 @@ void Test::testSkipImages()
 void Test::testNestedFieldmark()
 {
     // experimental config setting
-    ScopedConfigValue<
-        
officecfg::Office::Common::Filter::Microsoft::Import::ForceImportWWFieldsAsGenericFields>
-        aCfg(true);
+    ScopedConfigValue<MSFilterCfg::Import::ForceImportWWFieldsAsGenericFields> 
aCfg(true);
 
     auto verify = [this](OUString const& rTestName) {
         SwDoc* pDoc = getSwDoc();
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index b05a7ba8e142..7ed50f8f0677 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -46,6 +46,7 @@
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <editeng/boxitem.hxx>
+#include <test/commontesttools.hxx>
 #include <vcl/scheduler.hxx>
 
 #include <IDocumentSettingAccess.hxx>
@@ -1407,9 +1408,7 @@ void 
runWindowsFileZoneTests(css::uno::Reference<css::frame::XDesktop2> const &
                              bool expectedResult)
 {
     // Set desired configuration params
-    auto xChanges = comphelper::ConfigurationChanges::create();
-    T::set(configValue, xChanges);
-    xChanges->commit();
+    ScopedConfigValue<T> aCfg(configValue);
 
     // Set Windows Security Zone for temp file
     sal::systools::COMReference<IZoneIdentifier> 
pZoneId(CLSID_PersistentZoneIdentifier);
@@ -1458,6 +1457,8 @@ CPPUNIT_TEST_FIXTURE(Test, testWindowsFileZone)
     // Tweak macro security to 1
     SvtSecurityOptions::SetMacroSecurityLevel(1);
 
+    using ZoneCfg = 
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone;
+
     // Run all tests: set for temp file security zone and then check if macro 
are enabled
     // depending on configuration values for given zone
     // There is no easy way to check default (0) variant, so macro are 
disabled by default in these tests.
@@ -1466,57 +1467,27 @@ CPPUNIT_TEST_FIXTURE(Test, testWindowsFileZone)
     // ignores Zone 0 (see above) - assuming the initial file state is
     // local after a copy, we're still triggering the expected
     // behaviour
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneLocal>(
-        mxDesktop, aTempFile.GetURL(), 0, 0, false);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneLocal>(
-        mxDesktop, aTempFile.GetURL(), 1, 0, true);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneLocal>(
-        mxDesktop, aTempFile.GetURL(), 2, 0, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneLocal>(mxDesktop, aTempFile.GetURL(), 
0, 0, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneLocal>(mxDesktop, aTempFile.GetURL(), 
1, 0, true);
+    runWindowsFileZoneTests<ZoneCfg::ZoneLocal>(mxDesktop, aTempFile.GetURL(), 
2, 0, false);
 
     // run tests for other zones (these actually set the Windows
     // Security Zone at the file)
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneUntrusted>(
-        mxDesktop, aTempFile.GetURL(), 0, 4, false);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneUntrusted>(
-        mxDesktop, aTempFile.GetURL(), 1, 4, true);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneUntrusted>(
-        mxDesktop, aTempFile.GetURL(), 2, 4, false);
-
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneInternet>(
-        mxDesktop, aTempFile.GetURL(), 0, 3, false);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneInternet>(
-        mxDesktop, aTempFile.GetURL(), 1, 3, true);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneInternet>(
-        mxDesktop, aTempFile.GetURL(), 2, 3, false);
-
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneTrusted>(
-        mxDesktop, aTempFile.GetURL(), 0, 2, false);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneTrusted>(
-        mxDesktop, aTempFile.GetURL(), 1, 2, true);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneTrusted>(
-        mxDesktop, aTempFile.GetURL(), 2, 2, false);
-
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneIntranet>(
-        mxDesktop, aTempFile.GetURL(), 0, 1, false);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneIntranet>(
-        mxDesktop, aTempFile.GetURL(), 1, 1, true);
-    runWindowsFileZoneTests<
-        
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone::ZoneIntranet>(
-        mxDesktop, aTempFile.GetURL(), 2, 1, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneUntrusted>(mxDesktop, 
aTempFile.GetURL(), 0, 4, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneUntrusted>(mxDesktop, 
aTempFile.GetURL(), 1, 4, true);
+    runWindowsFileZoneTests<ZoneCfg::ZoneUntrusted>(mxDesktop, 
aTempFile.GetURL(), 2, 4, false);
+
+    runWindowsFileZoneTests<ZoneCfg::ZoneInternet>(mxDesktop, 
aTempFile.GetURL(), 0, 3, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneInternet>(mxDesktop, 
aTempFile.GetURL(), 1, 3, true);
+    runWindowsFileZoneTests<ZoneCfg::ZoneInternet>(mxDesktop, 
aTempFile.GetURL(), 2, 3, false);
+
+    runWindowsFileZoneTests<ZoneCfg::ZoneTrusted>(mxDesktop, 
aTempFile.GetURL(), 0, 2, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneTrusted>(mxDesktop, 
aTempFile.GetURL(), 1, 2, true);
+    runWindowsFileZoneTests<ZoneCfg::ZoneTrusted>(mxDesktop, 
aTempFile.GetURL(), 2, 2, false);
+
+    runWindowsFileZoneTests<ZoneCfg::ZoneIntranet>(mxDesktop, 
aTempFile.GetURL(), 0, 1, false);
+    runWindowsFileZoneTests<ZoneCfg::ZoneIntranet>(mxDesktop, 
aTempFile.GetURL(), 1, 1, true);
+    runWindowsFileZoneTests<ZoneCfg::ZoneIntranet>(mxDesktop, 
aTempFile.GetURL(), 2, 1, false);
 #endif
 }
 
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 136b614ab125..3a4dd6b330c6 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -31,6 +31,7 @@
 #include <tools/UnitConversion.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <test/commontesttools.hxx>
 
 #include <unotxdoc.hxx>
 #include <docsh.hxx>
@@ -586,10 +587,9 @@ CPPUNIT_TEST_FIXTURE(Test, testNotesAuthorDate)
 {
     createSwDoc("text-with-comment.rtf");
 
-    auto pBatch(comphelper::ConfigurationChanges::create());
     // Remove all personal info
-    
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true,
 pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving>
+        aCfg(true);
     saveAndReload(TestFilter::RTF);
 
     SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
@@ -612,10 +612,9 @@ CPPUNIT_TEST_FIXTURE(Test, testChangesAuthor)
 {
     createSwDoc("text-change-tracking.rtf");
 
-    auto pBatch(comphelper::ConfigurationChanges::create());
     // Remove all personal info
-    
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true,
 pBatch);
-    pBatch->commit();
+    
ScopedConfigValue<officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving>
+        aCfg(true);
     saveAndReload(TestFilter::RTF);
 
     SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index a4c3b4a62bbc..fe6e3ab099a6 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -49,6 +49,7 @@
 #include <unotxdoc.hxx>
 #include <unotools/transliterationwrapper.hxx>
 #include <officecfg/Office/Writer.hxx>
+#include <test/commontesttools.hxx>
 
 namespace
 {
@@ -2026,10 +2027,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105625)
     SwDoc* pDoc = getSwDoc();
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     // Ensure correct initial setting
-    std::shared_ptr<comphelper::ConfigurationChanges> batch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, 
batch);
-    batch->commit();
+    
ScopedConfigValue<officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea>
 aCfg(false);
     // We should be able to edit at positions adjacent to fields.
     // Check if the start and the end of the 1st paragraph are not protected
     // (they are adjacent to FORMCHECKBOX)
@@ -2060,10 +2058,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf125151_protected)
     createSwDoc("tdf125151_protected.fodt");
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     // Ensure correct initial setting
-    std::shared_ptr<comphelper::ConfigurationChanges> batch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, 
batch);
-    batch->commit();
+    
ScopedConfigValue<officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea>
 aCfg(false);
     pWrtShell->Down(/*bSelect=*/false);
     // The cursor moved inside of the FieldMark textbox.
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Readonly 1", false, 
pWrtShell->HasReadonlySel());
@@ -2078,10 +2073,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf125151_protectedB)
     createSwDoc("tdf125151_protectedB.fodt");
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
     // Ensure correct initial setting
-    std::shared_ptr<comphelper::ConfigurationChanges> batch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, 
batch);
-    batch->commit();
+    
ScopedConfigValue<officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea>
 aCfg(false);
     // The cursor starts inside of the FieldMark textbox.
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Readonly 1", false, 
pWrtShell->HasReadonlySel());
     // Move left to the start/definition of the textbox
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 460fe78fc844..a28423a0a056 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -1872,23 +1872,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90362)
 {
     createSwDoc("tdf90362.fodt");
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
-    // Ensure correct initial setting
-    std::shared_ptr<comphelper::ConfigurationChanges> batch(
-        comphelper::ConfigurationChanges::create());
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, 
batch);
-    batch->commit();
-    // First check if the end of the second paragraph is indeed protected.
-    pWrtShell->EndPara();
-    pWrtShell->Down(/*bSelect=*/false);
-    CPPUNIT_ASSERT_EQUAL(true, pWrtShell->HasReadonlySel());
-
-    // Then enable ignoring of protected areas and make sure that this time 
the cursor is read-write.
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(true, 
batch);
-    batch->commit();
-    CPPUNIT_ASSERT_EQUAL(false, pWrtShell->HasReadonlySel());
-    // Clean up, otherwise following tests will have that option set
-    officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, 
batch);
-    batch->commit();
+    {
+        // Ensure correct initial setting
+        
ScopedConfigValue<officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea>
 aCfg(
+            false);
+        // First check if the end of the second paragraph is indeed protected.
+        pWrtShell->EndPara();
+        pWrtShell->Down(/*bSelect=*/false);
+        CPPUNIT_ASSERT_EQUAL(true, pWrtShell->HasReadonlySel());
+    }
+
+    {
+        // Then enable ignoring of protected areas and make sure that this 
time the cursor is read-write.
+        
ScopedConfigValue<officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea>
 aCfg(
+            true);
+        CPPUNIT_ASSERT_EQUAL(false, pWrtShell->HasReadonlySel());
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsCharTdf107512)

Reply via email to