summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2000-09-26 08:25:59 +0000
committerOliver Specht <os@openoffice.org>2000-09-26 08:25:59 +0000
commitfcab6717682a5f9cd185f1c49c8849b5a3ae0422 (patch)
tree490a8be0ef0f8c633ba56fc73c7f1cc185876d54 /unotools
parent786be03d55134f3a5fc0e0e1d2ac7bb734b1509d (diff)
new: static GetDirectConfigProperty()
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/configmgr.hxx17
-rw-r--r--unotools/source/config/configmgr.cxx47
2 files changed, 60 insertions, 4 deletions
diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx
index a3dbdd8370d3..ca82060adbc9 100644
--- a/unotools/inc/unotools/configmgr.hxx
+++ b/unotools/inc/unotools/configmgr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: configmgr.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-09-21 12:40:13 $
+ * last change: $Author: os $ $Date: 2000-09-26 09:25:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,9 @@
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
#ifndef _RTL_USTRING_
#include <rtl/ustring>
#endif
@@ -108,6 +111,16 @@ namespace utl
static ConfigManager* GetConfigManager();
static void RemoveConfigManager();
static rtl::OUString GetConfigBaseURL();
+
+ enum ConfigProperty
+ {
+ INSTALLPATH,
+ LOCALE,
+ OFFICEINSTALL
+ };
+ //direct readonly access to some special configuration elements
+ static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp);
+
};
}//namespace utl
#endif //_UTL_CONFIGMGR_HXX_
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 2d80097fbcf9..9b11c4bd1d8b 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: configmgr.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-09-21 12:46:37 $
+ * last change: $Author: os $ $Date: 2000-09-26 09:25:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -265,4 +265,47 @@ rtl::OUString ConfigManager::GetConfigBaseURL()
{
return C2U(cConfigBaseURL);
}
+/* -----------------------------25.09.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
+{
+ Any aRet;
+ OUString sPath = C2U(cConfigBaseURL);
+ switch(eProp)
+ {
+ case INSTALLPATH: sPath += C2U("UserProfile/Office"); break;
+ case LOCALE: sPath += C2U("UserProfile/International"); break;
+ case OFFICEINSTALL: sPath += C2U("Office.Common/Path"); break;
+ }
+ Sequence< Any > aArgs(1);
+ aArgs[0] <<= sPath;
+ Reference< XMultiServiceFactory > xCfgProvider = GetConfigManager()->GetConfigurationProvider();
+ Reference< XInterface > xIFace;
+ try
+ {
+ xIFace = xCfgProvider->createInstanceWithArguments(
+ C2U(cAccessSrvc),
+ aArgs);
+
+ }
+ catch(Exception&){}
+ Reference<XHierarchicalNameAccess> xHierarchyAccess(xIFace, UNO_QUERY);
+ if(xHierarchyAccess.is())
+ {
+ OUString sProperty;
+ switch(eProp)
+ {
+ case INSTALLPATH: sProperty = C2U("InstallPath"); break;
+ case LOCALE: sProperty = C2U("Locale"); break;
+ case OFFICEINSTALL: sProperty = C2U("OfficeInstall"); break;
+ }
+ try
+ {
+ aRet = xHierarchyAccess->getByHierarchicalName(sProperty);
+ }
+ catch(Exception&) {}
+ }
+ return aRet;
+}