diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-01-25 18:17:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-01-25 18:18:52 +0100 |
commit | d70aa23c2d3af951c8846b4aea83c87c06a37a35 (patch) | |
tree | 4669966eef4aef87b3da1d818884cd0d7f04c4f9 /unotools/inc | |
parent | 866df124ee89a9d7b1f2b7803892f02c1010a9be (diff) |
Add configuration wrappers for groups, too (to add listeners etc.).
Diffstat (limited to 'unotools/inc')
-rw-r--r-- | unotools/inc/unotools/configuration.hxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/unotools/inc/unotools/configuration.hxx b/unotools/inc/unotools/configuration.hxx index c9969c8a024f..cfcc7e776404 100644 --- a/unotools/inc/unotools/configuration.hxx +++ b/unotools/inc/unotools/configuration.hxx @@ -43,6 +43,7 @@ namespace com { namespace sun { namespace star { namespace configuration { class XReadWriteAccess; } namespace container { class XHierarchicalNameAccess; + class XHierarchicalNameReplace; class XNameAccess; class XNameContainer; } @@ -80,6 +81,10 @@ private: rtl::OUString const & path, com::sun::star::uno::Any const & value) const; + SAL_DLLPRIVATE com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameReplace > + getGroup(rtl::OUString const & path) const; + SAL_DLLPRIVATE com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > getSet(rtl::OUString const & path) const; @@ -120,6 +125,16 @@ public: rtl::OUString const & path, com::sun::star::uno::Any const & value) const; + com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess > + getGroupReadOnly(rtl::OUString const & path) const; + + com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameReplace > + getGroupReadWrite( + boost::shared_ptr< ConfigurationChanges > const & batch, + rtl::OUString const & path) const; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getSetReadOnly(rtl::OUString const & path) const; @@ -230,6 +245,39 @@ private: ~ConfigurationLocalizedProperty(); // not defined }; +/// A type-safe wrapper around a configuration group. +/// +/// Automatically generated headers for the various configuration groups derive +/// from this template and make available its member functions to access each +/// given configuration group. +template< typename T > struct ConfigurationGroup: private boost::noncopyable { + /// Get read-only access to the given configuration group. + static com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess > + get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context) + { + return detail::ConfigurationWrapper::get(context).getGroupReadOnly( + T::path()); + } + + /// Get read/write access to the given configuration group, storing any + /// modifications via the given changes batch. + static com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameReplace > + get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context, + boost::shared_ptr< ConfigurationChanges > const & batch) + { + return detail::ConfigurationWrapper::get(context).getGroupReadWrite( + batch, T::path()); + } + +private: + ConfigurationGroup(); // not defined + ~ConfigurationGroup(); // not defined +}; + /// A type-safe wrapper around a configuration set. /// /// Automatically generated headers for the various configuration sets derive |