diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-01 14:08:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-01 14:26:26 +0200 |
commit | 7bcf64c29a0f5d3d2d60fe98afadab6e48dbe8b3 (patch) | |
tree | dd7791b6390b8587e81b79dda2547eb6a67db34a /include | |
parent | f14e4cffcc757a4fcf1875d638ef8df4acd5bc27 (diff) |
Add isReadOnly() support to simplified configuration access
[API CHANGE]: extends the css.configuration.XReadWriteAccess in an incompatible
way, but that is unpublished, has been commented as "still unpublished and
unstable," and was specifically introduced for internal use by the simplified
configuration access, so should not affect 3rd party code.
Change-Id: I99ce045f5bd8c598e689d46fb0d3626dfaa6d0a0
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/configuration.hxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx index 2a0a593cf255..d4630c74ae64 100644 --- a/include/comphelper/configuration.hxx +++ b/include/comphelper/configuration.hxx @@ -93,6 +93,8 @@ public: SAL_DLLPRIVATE ~ConfigurationWrapper(); + bool isReadOnly(OUString const & path) const; + com::sun::star::uno::Any getPropertyValue(OUString const & path) const; void setPropertyValue( @@ -136,7 +138,11 @@ private: context_; com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > access_; + com::sun::star::configuration::XReadWriteAccess > access_; + // should really be an css.configuration.ReadOnlyAccess (with added + // css.beans.XHierarchicalPropertySetInfo), but then + // configmgr::Access::asProperty() would report all properties as + // READONLY, so isReadOnly() would not work }; /// @internal @@ -187,6 +193,15 @@ private: /// each given configuration property. template< typename T, typename U > struct ConfigurationProperty { + /// Get the read-only status of the given (non-localized) configuration + /// property. + static bool isReadOnly( + css::uno::Reference<css::uno::XComponentContext> const & context + = comphelper::getProcessComponentContext()) + { + return detail::ConfigurationWrapper::get(context).isReadOnly(T::path()); + } + /// Get the value of the given (non-localized) configuration property. /// /// For nillable properties, U is of type boost::optional<U'>. @@ -231,6 +246,14 @@ private: /// to access each given localized configuration property. template< typename T, typename U > struct ConfigurationLocalizedProperty { + /// Get the read-only status of the given localized configuration property. + static bool isReadOnly( + css::uno::Reference<css::uno::XComponentContext> const & context + = comphelper::getProcessComponentContext()) + { + return detail::ConfigurationWrapper::get(context).isReadOnly(T::path()); + } + /// Get the value of the given localized configuration property, for the /// locale currently set at the /// com.sun.star.configuration.theDefaultProvider. |