diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-12-13 12:37:00 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-12-13 12:50:34 +0100 |
commit | bcdea3b379637a98e5bbc304078149ca6c2b6e03 (patch) | |
tree | a3803df980a54ab1a03c740c3114a54ca7d12f27 /configmgr/source/access.hxx | |
parent | ddf1cf333174777e7923aa0d6126daf2c8645fed (diff) |
Simplified, type-safe C++ configuration access.
* New offapi com.sun.star.configuration entities to access the complete
configuration read-only or read/write...
* ...configmgr adapted to support those new services/singletons...
* ...new unotools/configuration.hxx is the type-safe C++ plumbing on top of
that...
* ...officecfg now generates C++ headers to access all the properties and sets
given in the .xcs files...
* ...and svl's asiancfg.cxx exemplarily makes use of the new
officecfg/Office/Common.hxx to access the configuration.
* There is still TODOs: For one, see those listed in
officecfg/registry/cppheader.xsl. For another, at least a notification
mechanism for the new read-only configuration access and the C++ wrapper is
missing.
Diffstat (limited to 'configmgr/source/access.hxx')
-rw-r--r-- | configmgr/source/access.hxx | 136 |
1 files changed, 72 insertions, 64 deletions
diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index d2409cbb2f1d..6401df3f8344 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -51,7 +51,7 @@ #include "com/sun/star/container/NoSuchElementException.hpp" #include "com/sun/star/container/XContainer.hpp" #include "com/sun/star/container/XHierarchicalName.hpp" -#include "com/sun/star/container/XHierarchicalNameAccess.hpp" +#include "com/sun/star/container/XHierarchicalNameReplace.hpp" #include "com/sun/star/container/XNameContainer.hpp" #include "com/sun/star/container/XNamed.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" @@ -106,7 +106,7 @@ class Access: public cppu::OWeakObject, public com::sun::star::lang::XTypeProvider, public com::sun::star::lang::XServiceInfo, public com::sun::star::lang::XComponent, - public com::sun::star::container::XHierarchicalNameAccess, + public com::sun::star::container::XHierarchicalNameReplace, public com::sun::star::container::XContainer, public com::sun::star::beans::XExactName, public com::sun::star::beans::XPropertySetInfo, @@ -146,68 +146,6 @@ public: using OWeakObject::acquire; using OWeakObject::release; -protected: - Access(Components & components); - - virtual ~Access(); - - virtual rtl::OUString getNameInternal() = 0; - virtual rtl::Reference< RootAccess > getRootAccess() = 0; - virtual rtl::Reference< Access > getParentAccess() = 0; - - virtual void addTypes(std::vector< com::sun::star::uno::Type > * types) - const = 0; - - virtual void addSupportedServiceNames( - std::vector< rtl::OUString > * services) = 0; - - virtual void initDisposeBroadcaster(Broadcaster * broadcaster); - virtual void clearListeners() throw (); - - virtual com::sun::star::uno::Any SAL_CALL queryInterface( - com::sun::star::uno::Type const & aType) - throw (com::sun::star::uno::RuntimeException); - - Components & getComponents() const; - - void checkLocalizedPropertyAccess(); - - rtl::Reference< Node > getParentNode(); - rtl::Reference< ChildAccess > getChild(rtl::OUString const & name); - std::vector< rtl::Reference< ChildAccess > > getAllChildren(); - - void checkValue( - com::sun::star::uno::Any const & value, Type type, bool nillable); - - void insertLocalizedValueChild( - rtl::OUString const & name, com::sun::star::uno::Any const & value, - Modifications * localModifications); - - void reportChildChanges( - std::vector< com::sun::star::util::ElementChange > * changes); - - void commitChildChanges(bool valid, Modifications * globalModifications); - - void initBroadcasterAndChanges( - Modifications::Node const & modifications, Broadcaster * broadcaster, - std::vector< com::sun::star::util::ElementChange > * changes); - - bool isDisposed() const; - -private: - struct ModifiedChild { - rtl::Reference< ChildAccess > child; - bool directlyModified; - - ModifiedChild(); - - ModifiedChild( - rtl::Reference< ChildAccess > const & theChild, - bool theDirectlyModified); - }; - - typedef std::map< rtl::OUString, ModifiedChild > ModifiedChildren; - virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException); @@ -264,6 +202,14 @@ private: virtual sal_Bool SAL_CALL hasByHierarchicalName(rtl::OUString const & aName) throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceByHierarchicalName( + rtl::OUString const & aName, com::sun::star::uno::Any const & aElement) + throw ( + com::sun::star::lang::IllegalArgumentException, + com::sun::star::container::NoSuchElementException, + com::sun::star::lang::WrappedTargetException, + com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addContainerListener( com::sun::star::uno::Reference< com::sun::star::container::XContainerListener > const & xListener) @@ -491,6 +437,68 @@ private: com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); +protected: + Access(Components & components); + + virtual ~Access(); + + virtual rtl::OUString getNameInternal() = 0; + virtual rtl::Reference< RootAccess > getRootAccess() = 0; + virtual rtl::Reference< Access > getParentAccess() = 0; + + virtual void addTypes(std::vector< com::sun::star::uno::Type > * types) + const = 0; + + virtual void addSupportedServiceNames( + std::vector< rtl::OUString > * services) = 0; + + virtual void initDisposeBroadcaster(Broadcaster * broadcaster); + virtual void clearListeners() throw (); + + virtual com::sun::star::uno::Any SAL_CALL queryInterface( + com::sun::star::uno::Type const & aType) + throw (com::sun::star::uno::RuntimeException); + + Components & getComponents() const; + + void checkLocalizedPropertyAccess(); + + rtl::Reference< Node > getParentNode(); + rtl::Reference< ChildAccess > getChild(rtl::OUString const & name); + std::vector< rtl::Reference< ChildAccess > > getAllChildren(); + + void checkValue( + com::sun::star::uno::Any const & value, Type type, bool nillable); + + void insertLocalizedValueChild( + rtl::OUString const & name, com::sun::star::uno::Any const & value, + Modifications * localModifications); + + void reportChildChanges( + std::vector< com::sun::star::util::ElementChange > * changes); + + void commitChildChanges(bool valid, Modifications * globalModifications); + + void initBroadcasterAndChanges( + Modifications::Node const & modifications, Broadcaster * broadcaster, + std::vector< com::sun::star::util::ElementChange > * changes); + + bool isDisposed() const; + +private: + struct ModifiedChild { + rtl::Reference< ChildAccess > child; + bool directlyModified; + + ModifiedChild(); + + ModifiedChild( + rtl::Reference< ChildAccess > const & theChild, + bool theDirectlyModified); + }; + + typedef std::map< rtl::OUString, ModifiedChild > ModifiedChildren; + rtl::Reference< ChildAccess > getModifiedChild( ModifiedChildren::iterator const & childIterator); |