diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-23 15:09:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-24 16:52:52 +0200 |
commit | 095e3ac51eaae12da641018e889d79e3ae029038 (patch) | |
tree | 727e80e718c80b970f45f7b077badf58a595680b | |
parent | 4e511cc7dfbf14b6176ce352db8125c16eefeebf (diff) |
use officecfg to retrieve SaveRelFSys
Change-Id: If4e943153080e1c8fea02e712038dd6dee92c5a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119454
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | cui/source/options/optsave.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 5 | ||||
-rw-r--r-- | include/unotools/saveopt.hxx | 4 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/excel/xeroot.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 3 | ||||
-rw-r--r-- | sw/CppunitTest_sw_ooxmllinks.mk | 4 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 29 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 3 | ||||
-rw-r--r-- | unotools/source/config/saveopt.cxx | 48 |
12 files changed, 34 insertions, 85 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index cb67147bdbf1..f9055cd94b2f 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -24,6 +24,7 @@ #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include "optsave.hxx" +#include <officecfg/Office/Common.hxx> #include <comphelper/processfactory.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/saveopt.hxx> @@ -447,8 +448,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* ) m_xAutoSaveEdit->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime)); // save relatively - m_xRelativeFsysCB->set_active(aSaveOpt.IsSaveRelFSys()); - m_xRelativeFsysCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelFsys)); + m_xRelativeFsysCB->set_active(officecfg::Office::Common::Save::URL::FileSystem::get()); + m_xRelativeFsysCB->set_sensitive(!officecfg::Office::Common::Save::URL::FileSystem::isReadOnly()); m_xRelativeInetCB->set_active(aSaveOpt.IsSaveRelINet()); m_xRelativeInetCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelInet)); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index b0b6e50afd54..c8a75c1e725d 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1618,9 +1618,8 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) ); - SvtSaveOptions aSaveOpt; xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get())); - if ( aSaveOpt.IsSaveRelFSys() ) + if ( officecfg::Office::Common::Save::URL::FileSystem::get() ) { OUString sBaseURI = _rMediaDescriptor.getOrDefault("BaseURI", OUString()); if (sBaseURI.isEmpty()) @@ -1654,7 +1653,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r OUString aVersion; SvtSaveOptions::ODFSaneDefaultVersion const nDefVersion = - aSaveOpt.GetODFSaneDefaultVersion(); + SvtSaveOptions().GetODFSaneDefaultVersion(); // older versions can not have this property set, // it exists only starting from ODF1.2 if (nDefVersion >= SvtSaveOptions::ODFSVER_013) diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx index cfaa51389db3..774fa6fe62ff 100644 --- a/include/unotools/saveopt.hxx +++ b/include/unotools/saveopt.hxx @@ -39,7 +39,6 @@ public: DocInfSave, SaveWorkingSet, SaveRelInet, - SaveRelFsys, WarnAlienFormat, LoadDocPrinter, OdfDefaultVersion, @@ -116,9 +115,6 @@ public: void SetSaveRelINet( bool b ); bool IsSaveRelINet() const; - void SetSaveRelFSys( bool b ); - bool IsSaveRelFSys() const; - void SetLoadUserSettings(bool b); bool IsLoadUserSettings() const; diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 3884d06198f9..ebd735a8f296 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -1318,9 +1318,8 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS }; uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) ); - SvtSaveOptions aSaveOpt; xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get())); - if ( aSaveOpt.IsSaveRelFSys() ) + if ( officecfg::Office::Common::Save::URL::FileSystem::get() ) { const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL(),OUString()) ); xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sVal)); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 575aee0c540f..3bfca778f159 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <officecfg/Office/Common.hxx> #include <rtl/random.h> #include <sal/log.hxx> #include <sfx2/docfile.hxx> @@ -58,7 +59,7 @@ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, true ) { SvtSaveOptions aSaveOpt; - mbRelUrl = mrMedium.IsRemote() ? aSaveOpt.IsSaveRelINet() : aSaveOpt.IsSaveRelFSys(); + mbRelUrl = mrMedium.IsRemote() ? aSaveOpt.IsSaveRelINet() : officecfg::Office::Common::Save::URL::FileSystem::get(); maStringBuf.setLength(0); } diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index d54a9bb42b6b..c540a6059e76 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -265,8 +265,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) case SID_SAVEREL_FSYS : { bRet = true; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::SaveRelFsys)) - if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), aSaveOptions.IsSaveRelFSys() ))) + if (!officecfg::Office::Common::Save::URL::FileSystem::isReadOnly()) + if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), + officecfg::Office::Common::Save::URL::FileSystem::get() ))) bRet = false; } break; @@ -533,7 +534,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), true, &pItem)) { DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); - aSaveOptions.SetSaveRelFSys(static_cast<const SfxBoolItem *>(pItem)->GetValue()); + officecfg::Office::Common::Save::URL::FileSystem::set( + static_cast<const SfxBoolItem *>(pItem)->GetValue(), + batch); } // Undo-Count diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index b9e089eb8b82..9497d3a144b0 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -642,7 +642,8 @@ OUString SfxMedium::GetBaseURL( bool bForSaving ) { SvtSaveOptions aOpt; bool bIsRemote = IsRemote(); - if( (bIsRemote && !aOpt.IsSaveRelINet()) || (!pImpl->m_bRemote && !aOpt.IsSaveRelFSys()) ) + if( (bIsRemote && !aOpt.IsSaveRelINet()) + || (!pImpl->m_bRemote && !officecfg::Office::Common::Save::URL::FileSystem::get()) ) return OUString(); } diff --git a/sw/CppunitTest_sw_ooxmllinks.mk b/sw/CppunitTest_sw_ooxmllinks.mk index 7018cc4f5bd7..79c1cfd1a000 100644 --- a/sw/CppunitTest_sw_ooxmllinks.mk +++ b/sw/CppunitTest_sw_ooxmllinks.mk @@ -44,6 +44,10 @@ $(eval $(call gb_CppunitTest_use_vcl,sw_ooxmllinks)) $(eval $(call gb_CppunitTest_use_rdb,sw_ooxmllinks,services)) +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmllinks,\ + officecfg/registry \ +)) + $(eval $(call gb_CppunitTest_use_configuration,sw_ooxmllinks)) # vim: set noet sw=4 ts=4: diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index d5f0e8784516..743c5a3ad31c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -11,6 +11,7 @@ #include <unotools/tempfile.hxx> #include <tools/urlobj.hxx> #include <unotools/saveopt.hxx> +#include <officecfg/Office/Common.hxx> // This file contains tests to check relative/absolute hyperlinks handling @@ -59,17 +60,9 @@ CPPUNIT_TEST_SUITE_END(); \ void Import_Export_Import() \ { \ - SvtSaveOptions aOpt; \ - if (bAbsolute) \ - { \ - aOpt.SetSaveRelFSys(false); \ - CPPUNIT_ASSERT(!aOpt.IsSaveRelFSys()); \ - } \ - else \ - { \ - aOpt.SetSaveRelFSys(true); \ - CPPUNIT_ASSERT(aOpt.IsSaveRelFSys()); \ - } \ + auto xChanges = comphelper::ConfigurationChanges::create(); \ + officecfg::Office::Common::Save::URL::FileSystem::set(!bAbsolute, xChanges); \ + xChanges->commit(); \ executeLoadReloadVerify(FileName); \ } \ void verify() override; \ @@ -90,17 +83,9 @@ CPPUNIT_TEST_SUITE_END(); \ void Import() \ { \ - SvtSaveOptions aOpt; \ - if (bAbsolute) \ - { \ - aOpt.SetSaveRelFSys(false); \ - CPPUNIT_ASSERT(!aOpt.IsSaveRelFSys()); \ - } \ - else \ - { \ - aOpt.SetSaveRelFSys(true); \ - CPPUNIT_ASSERT(aOpt.IsSaveRelFSys()); \ - } \ + auto xChanges = comphelper::ConfigurationChanges::create(); \ + officecfg::Office::Common::Save::URL::FileSystem::set(!bAbsolute, xChanges); \ + xChanges->commit(); \ executeImportTest(FileName); \ } \ void verify() override; \ diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 29058a3cd691..7c77c9d6c7ac 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -22,6 +22,7 @@ #include <hintids.hxx> +#include <officecfg/Office/Common.hxx> #include <o3tl/any.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <vcl/svapp.hxx> @@ -107,7 +108,7 @@ bool SwBasicEscherEx::IsRelUrl() const bool bRelUrl = false; SfxMedium * pMedium = rWrt.GetWriter().GetMedia(); if ( pMedium ) - bRelUrl = pMedium->IsRemote() ? aSaveOpt.IsSaveRelINet() : aSaveOpt.IsSaveRelFSys(); + bRelUrl = pMedium->IsRemote() ? aSaveOpt.IsSaveRelINet() : officecfg::Office::Common::Save::URL::FileSystem::get(); return bRelUrl; } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index f28221e3912c..d2735ca3c8e3 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -24,6 +24,7 @@ #include "docxexport.hxx" +#include <officecfg/Office/Common.hxx> #include <i18nlangtag/mslangid.hxx> #include <hintids.hxx> #include <tools/urlobj.hxx> @@ -1007,7 +1008,7 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, const OUString& /*rT if ( aProtocol == INetProtocol::File || aProtocol == INetProtocol::NotValid ) { // INetProtocol::NotValid - may be a relative link - bool bExportRelative = m_aSaveOpt.IsSaveRelFSys(); + bool bExportRelative = officecfg::Office::Common::Save::URL::FileSystem::get(); sURL = ConvertURL( rUrl, !bExportRelative ); } } diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 6208ae1c78ae..234299dd61fd 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -67,7 +67,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bDocInfSave, bSaveWorkingSet, bSaveRelINet, - bSaveRelFSys, bWarnAlienFormat, bLoadDocPrinter; @@ -82,7 +81,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bRODocInfSave, bROSaveWorkingSet, bROSaveRelINet, - bROSaveRelFSys, bROWarnAlienFormat, bROLoadDocPrinter, bROODFDefaultVersion; @@ -103,7 +101,6 @@ public: bool IsDocInfoSave() const { return bDocInfSave; } bool IsSaveWorkingSet() const { return bSaveWorkingSet; } bool IsSaveRelINet() const { return bSaveRelINet; } - bool IsSaveRelFSys() const { return bSaveRelFSys; } bool IsWarnAlienFormat() const { return bWarnAlienFormat; } bool IsLoadDocPrinter() const { return bLoadDocPrinter; } @@ -119,7 +116,6 @@ public: void SetDocInfoSave( bool b ); void SetSaveWorkingSet( bool b ); void SetSaveRelINet( bool b ); - void SetSaveRelFSys( bool b ); void SetWarnAlienFormat( bool _bDoPP ); void SetLoadDocPrinter( bool bNew ); void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ); @@ -213,15 +209,6 @@ void SvtSaveOptions_Impl::SetSaveRelINet( bool b ) } } -void SvtSaveOptions_Impl::SetSaveRelFSys( bool b ) -{ - if (!bROSaveRelFSys && bSaveRelFSys!=b) - { - bSaveRelFSys = b; - SetModified(); - } -} - void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP ) { if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP) @@ -281,9 +268,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const case SvtSaveOptions::EOption::SaveRelInet : bReadOnly = bROSaveRelINet; break; - case SvtSaveOptions::EOption::SaveRelFsys : - bReadOnly = bROSaveRelFSys; - break; case SvtSaveOptions::EOption::WarnAlienFormat : bReadOnly = bROWarnAlienFormat; break; @@ -306,10 +290,9 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const #define EDITPROPERTY 6 #define WARNALIENFORMAT 7 #define LOADDOCPRINTER 8 -#define FILESYSTEM 9 -#define INTERNET 10 -#define SAVEWORKINGSET 11 -#define ODFDEFAULTVERSION 12 +#define INTERNET 9 +#define SAVEWORKINGSET 10 +#define ODFDEFAULTVERSION 11 static Sequence< OUString > GetPropertyNames() { @@ -324,7 +307,6 @@ static Sequence< OUString > GetPropertyNames() "Document/EditProperty", "Document/WarnAlienFormat", "Document/LoadPrinter", - "URL/FileSystem", "URL/Internet", "WorkingSet", "ODF/DefaultVersion" @@ -350,7 +332,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bDocInfSave( false ) , bSaveWorkingSet( false ) , bSaveRelINet( false ) - , bSaveRelFSys( false ) , bWarnAlienFormat( true ) , bLoadDocPrinter( true ) , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) @@ -363,7 +344,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bRODocInfSave( CFG_READONLY_DEFAULT ) , bROSaveWorkingSet( CFG_READONLY_DEFAULT ) , bROSaveRelINet( CFG_READONLY_DEFAULT ) - , bROSaveRelFSys( CFG_READONLY_DEFAULT ) , bROWarnAlienFormat( CFG_READONLY_DEFAULT ) , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) @@ -446,10 +426,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() bSaveWorkingSet = bTemp; bROSaveWorkingSet = pROStates[nProp]; break; - case FILESYSTEM : - bSaveRelFSys = bTemp; - bROSaveRelFSys = pROStates[nProp]; - break; case INTERNET : bSaveRelINet = bTemp; bROSaveRelINet = pROStates[nProp]; @@ -568,14 +544,6 @@ void SvtSaveOptions_Impl::ImplCommit() ++nRealCount; } break; - case FILESYSTEM : - if (!bROSaveRelFSys) - { - pValues[nRealCount] <<= bSaveRelFSys; - pNames[nRealCount] = pOrgNames[i]; - ++nRealCount; - } - break; case INTERNET : if (!bROSaveRelINet) { @@ -801,16 +769,6 @@ bool SvtSaveOptions::IsSaveRelINet() const return pImp->pSaveOpt->IsSaveRelINet(); } -void SvtSaveOptions::SetSaveRelFSys( bool b ) -{ - pImp->pSaveOpt->SetSaveRelFSys( b ); -} - -bool SvtSaveOptions::IsSaveRelFSys() const -{ - return pImp->pSaveOpt->IsSaveRelFSys(); -} - void SvtSaveOptions::SetLoadUserSettings(bool b) { pImp->pLoadOpt->SetLoadUserSettings(b); |