Add ConfigurationGroup/Set::isReadOnly
Change-Id: I0c6c00a8a3c5c8bba923af24d136adccd269cef5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162204
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx
index 968fd88..16cf19c0 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 f75a21a..a29a408 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();