diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-11-11 22:48:37 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-11-11 22:49:21 +0100 |
commit | c1758889cbd5e8e4afb1044425c908715eb3e1cd (patch) | |
tree | ff58b017da12c009f0b17c067787d1dbbd52eb7a /unotools/inc | |
parent | WaE: OptValue::maValue may be used uninitialized (diff) | |
download | core-c1758889cbd5e8e4afb1044425c908715eb3e1cd.tar.gz core-c1758889cbd5e8e4afb1044425c908715eb3e1cd.zip |
Heavily simplified utl::ConfigManager.
Diffstat (limited to 'unotools/inc')
-rw-r--r-- | unotools/inc/unotools/configitem.hxx | 2 | ||||
-rw-r--r-- | unotools/inc/unotools/configmgr.hxx | 152 |
2 files changed, 68 insertions, 86 deletions
diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index 1b1558d024b4..fe3a0e991ad4 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -58,8 +58,6 @@ namespace utl #define CONFIG_MODE_DELAYED_UPDATE 0x01 #define CONFIG_MODE_ALL_LOCALES 0x02 #define CONFIG_MODE_RELEASE_TREE 0x04 -#define CONFIG_MODE_IGNORE_ERRORS 0x08 // prevent assertions, if creation fails -#define CONFIG_MODE_PROPAGATE_ERRORS 0x10 // throw exceptions, if creation fails enum ConfigNameFormat { diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx index 61bcac6b8737..1ac1868585d1 100644 --- a/unotools/inc/unotools/configmgr.hxx +++ b/unotools/inc/unotools/configmgr.hxx @@ -26,92 +26,76 @@ * ************************************************************************/ -#ifndef _UTL_CONFIGMGR_HXX_ -#define _UTL_CONFIGMGR_HXX_ +#ifndef INCLUDED_UNOTOOLS_CONFIGMGR_HXX +#define INCLUDED_UNOTOOLS_CONFIGMGR_HXX -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Any.hxx> -#include <rtl/ustring.hxx> +#include "sal/config.h" + +#include <list> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "sal/types.h" #include "unotools/unotoolsdllapi.h" -//----------------------------------------------------------------------------- -namespace com{ namespace sun{ namespace star{ - namespace lang{ - class XMultiServiceFactory; - } - namespace container{ - class XHierarchicalNameAccess; - } -}}} - -//----------------------------------------------------------------------------- -namespace utl -{ - struct ConfigMgr_Impl; - class ConfigItem; - class UNOTOOLS_DLLPUBLIC ConfigManager - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - xConfigurationProvider; - ConfigMgr_Impl* pMgrImpl; - - static void getBasisAboutBoxProductVersion( rtl::OUString& rVersion ); - - public: - ConfigManager(); - ConfigManager(com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider); - ~ConfigManager(); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - GetConfigurationProvider(); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - GetLocalConfigurationProvider(); - - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - AddConfigItem(utl::ConfigItem& rCfgItem); - - void RegisterConfigItem(utl::ConfigItem& rCfgItem); - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - AcquireTree(utl::ConfigItem& rCfgItem); - - - void RemoveConfigItem(utl::ConfigItem& rCfgItem); - - void StoreConfigItems(); - - static ConfigManager& GetConfigManager(); - static rtl::OUString GetConfigBaseURL(); - - enum ConfigProperty - { - INSTALLPATH, // deprecated. don't use - LOCALE, - OFFICEINSTALL, // deprecated. don't use - USERINSTALLURL, // deprecated. don't use - OFFICEINSTALLURL, // deprecated. don't use - PRODUCTNAME, - PRODUCTVERSION, - PRODUCTEXTENSION, - DEFAULTCURRENCY, - PRODUCTXMLFILEFORMATNAME, - PRODUCTXMLFILEFORMATVERSION, - WRITERCOMPATIBILITYVERSIONOOO11, - OPENSOURCECONTEXT, - ABOUTBOXPRODUCTVERSION, - OOOVENDOR - }; - //direct readonly access to some special configuration elements - static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp); - - sal_Bool IsLocalConfigProvider(); - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - GetHierarchyAccess(const rtl::OUString& rFullPath); - com::sun::star::uno::Any GetLocalProperty(const rtl::OUString& rProperty); - void PutLocalProperty(const rtl::OUString& , const com::sun::star::uno::Any& rValue); - - }; -}//namespace utl -#endif //_UTL_CONFIGMGR_HXX_ +namespace com { namespace sun { namespace star { + namespace container{ class XHierarchicalNameAccess; } +} } } +namespace rtl { class OUString; } +namespace utl { class ConfigItem; } + +namespace utl { + +class UNOTOOLS_DLLPUBLIC ConfigManager: private boost::noncopyable { +public: + static rtl::OUString getAboutBoxProductVersion(); + + static rtl::OUString getDefaultCurrency(); + + static rtl::OUString getLocale(); + + static rtl::OUString getProductExtension(); + + static rtl::OUString getProductName(); + + static rtl::OUString getProductXmlFileFormat(); + + static rtl::OUString getProductXmlFileFormatVersion(); + + static rtl::OUString getProductVersion(); + + static rtl::OUString getVendor(); + + static rtl::OUString getWriterCompatibilityVersionOOo_1_1(); + + static void storeConfigItems(); + + SAL_DLLPRIVATE static ConfigManager & getConfigManager(); + + SAL_DLLPRIVATE static com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess> + acquireTree(utl::ConfigItem & item); + + SAL_DLLPRIVATE ConfigManager(); + + SAL_DLLPRIVATE ~ConfigManager(); + + SAL_DLLPRIVATE com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess > + addConfigItem(utl::ConfigItem & item); + + SAL_DLLPRIVATE void removeConfigItem(utl::ConfigItem & item); + + SAL_DLLPRIVATE void registerConfigItem(utl::ConfigItem * item); + +private: + void doStoreConfigItems(); + + std::list< ConfigItem * > items_; +}; + +} + +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |