1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _UTL_CONFIGMGR_HXX_ 25 #define _UTL_CONFIGMGR_HXX_ 26 27 #include <com/sun/star/uno/Reference.h> 28 #include <com/sun/star/uno/Any.hxx> 29 #include <rtl/ustring.hxx> 30 #include "unotools/unotoolsdllapi.h" 31 32 //----------------------------------------------------------------------------- 33 namespace com{ namespace sun{ namespace star{ 34 namespace lang{ 35 class XMultiServiceFactory; 36 } 37 namespace container{ 38 class XHierarchicalNameAccess; 39 } 40 }}} 41 42 //----------------------------------------------------------------------------- 43 namespace utl 44 { 45 struct ConfigMgr_Impl; 46 class ConfigItem; 47 class UNOTOOLS_DLLPUBLIC ConfigManager 48 { 49 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 50 xConfigurationProvider; 51 ConfigMgr_Impl* pMgrImpl; 52 53 static ConfigManager* pConfigManager; 54 static void getBasisAboutBoxProductVersion( rtl::OUString& rVersion ); 55 56 public: 57 ConfigManager(); 58 ConfigManager(com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider); 59 ~ConfigManager(); 60 61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 62 GetConfigurationProvider(); 63 64 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 65 GetLocalConfigurationProvider(); 66 67 com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> 68 AddConfigItem(utl::ConfigItem& rCfgItem); 69 70 void RegisterConfigItem(utl::ConfigItem& rCfgItem); 71 com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> 72 AcquireTree(utl::ConfigItem& rCfgItem); 73 74 75 void RemoveConfigItem(utl::ConfigItem& rCfgItem); 76 77 void StoreConfigItems(); 78 79 static ConfigManager* GetConfigManager(); 80 static void RemoveConfigManager(); 81 static rtl::OUString GetConfigBaseURL(); 82 83 enum ConfigProperty 84 { 85 INSTALLPATH, // deprecated. don't use 86 LOCALE, 87 OFFICEINSTALL, // deprecated. don't use 88 USERINSTALLURL, // deprecated. don't use 89 OFFICEINSTALLURL, // deprecated. don't use 90 PRODUCTNAME, 91 PRODUCTVERSION, 92 PRODUCTEXTENSION, 93 DEFAULTCURRENCY, 94 PRODUCTXMLFILEFORMATNAME, 95 PRODUCTXMLFILEFORMATVERSION, 96 WRITERCOMPATIBILITYVERSIONOOO11, 97 OPENSOURCECONTEXT, 98 ABOUTBOXPRODUCTVERSION, 99 OOOVENDOR, 100 FULLPRODUCTNAME 101 }; 102 //direct readonly access to some special configuration elements 103 static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp); 104 105 sal_Bool IsLocalConfigProvider(); 106 com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> 107 GetHierarchyAccess(const rtl::OUString& rFullPath); 108 com::sun::star::uno::Any GetLocalProperty(const rtl::OUString& rProperty); 109 void PutLocalProperty(const rtl::OUString& , const com::sun::star::uno::Any& rValue); 110 111 }; 112 }//namespace utl 113 #endif //_UTL_CONFIGMGR_HXX_ 114