include/comphelper/configuration.hxx | 12 ++++++++++++ unotools/source/config/securityoptions.cxx | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-)
New commits: commit ef6083200a4f28e43198c7a0878da6f4b880725f Author: Stephan Bergmann <[email protected]> AuthorDate: Wed Jan 17 18:21:40 2024 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Wed Jan 17 20:28:28 2024 +0100 Add ConfigurationGroup/Set::isReadOnly Change-Id: I0c6c00a8a3c5c8bba923af24d136adccd269cef5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162204 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx index 968fd88ac522..16cf19c0109c 100644 --- a/include/comphelper/configuration.hxx +++ b/include/comphelper/configuration.hxx @@ -308,6 +308,12 @@ private: /// from this template and make available its member functions to access each /// given configuration group. template< typename T > struct ConfigurationGroup { + /// Get the read-only status of the given configuration group. + static bool isReadOnly() + { + return detail::ConfigurationWrapper::get().isReadOnly(T::path()); + } + /// Get read-only access to the given configuration group. static css::uno::Reference< css::container::XHierarchicalNameAccess > @@ -341,6 +347,12 @@ private: /// from this template and make available its member functions to access each /// given configuration set. template< typename T > struct ConfigurationSet { + /// Get the read-only status of the given configuration set. + static bool isReadOnly() + { + return detail::ConfigurationWrapper::get().isReadOnly(T::path()); + } + /// Get read-only access to the given configuration set. static css::uno::Reference< css::container::XNameAccess > diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index f75a21ad6c82..a29a40894db1 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -90,9 +90,7 @@ bool IsReadOnly( EOption eOption ) bReadonly = officecfg::Office::Common::Security::Scripting::MacroSecurityLevel::isReadOnly(); break; case SvtSecurityOptions::EOption::MacroTrustedAuthors: - // the officecfg does not expose isReadOnly for a ConfigurationSet, so we have to code this ourself - bReadonly = - comphelper::detail::ConfigurationWrapper::get().isReadOnly(u"/org.openoffice.Office.Common/Security/Scripting/TrustedAuthors"_ustr); + bReadonly = officecfg::Office::Common::Security::Scripting::TrustedAuthors::isReadOnly(); break; case SvtSecurityOptions::EOption::CtrlClickHyperlink: bReadonly = officecfg::Office::Common::Security::Scripting::HyperlinksWithCtrlClick::isReadOnly();
