diff options
-rw-r--r-- | configmgr/source/api2/confprovider2.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/api2/confproviderimpl2.cxx | 14 | ||||
-rw-r--r-- | configmgr/source/api2/providerimpl.cxx | 9 | ||||
-rw-r--r-- | configmgr/source/inc/bootstrap.hxx | 13 | ||||
-rw-r--r-- | configmgr/source/inc/options.hxx | 147 | ||||
-rw-r--r-- | configmgr/source/tree/cmtree.cxx | 16 | ||||
-rw-r--r-- | configmgr/source/xml/typeconverter.cxx | 16 |
7 files changed, 197 insertions, 24 deletions
diff --git a/configmgr/source/api2/confprovider2.cxx b/configmgr/source/api2/confprovider2.cxx index 1450cc9b756a..298bb7599ae1 100644 --- a/configmgr/source/api2/confprovider2.cxx +++ b/configmgr/source/api2/confprovider2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: confprovider2.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dg $ $Date: 2000-11-10 22:43:58 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:14:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -244,7 +244,7 @@ namespace configmgr { MutexGuard aGuard(m_aMutex); ensureConnection(); - m_pImpl->setInternationalHelper(m_aModule.getInternationalHelper()); + m_pImpl->setOptions(m_aModule.getOptions()); if (ServiceCreationInfo const* pInfo = findCreationInfo(aServiceSpecifier)) { diff --git a/configmgr/source/api2/confproviderimpl2.cxx b/configmgr/source/api2/confproviderimpl2.cxx index 6e0b00967722..d0eaf3b03c68 100644 --- a/configmgr/source/api2/confproviderimpl2.cxx +++ b/configmgr/source/api2/confproviderimpl2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: confproviderimpl2.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dg $ $Date: 2000-11-13 11:54:09 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:14:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,11 +84,14 @@ #include <com/sun/star/beans/PropertyValue.hpp> #endif +#include "hashhelper.hxx" + namespace configmgr { namespace css = ::com::sun::star; namespace uno = css::uno; namespace beans = css::beans; + using ::rtl::OUString; using configapi::NodeElement; @@ -113,7 +116,9 @@ namespace configmgr sal_Int32 nLevels; OProviderImpl::FactoryArguments::extractArgs(aArgs, sPath, sUser, sLocale, nLevels); ::rtl::OUString sNodeAccessor = IConfigSession::composeNodeAccessor(sPath, sUser); - m_pConfiguration->setLocale(sLocale); + + m_pConfiguration->setOptions(getOptions()); + getOptions()->add("Locale", sLocale); CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sNodeAccessor)); CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels); @@ -150,7 +155,8 @@ namespace configmgr CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sNodeAccessor)); CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels); - m_aI18n.setLocale(sLocale); + m_pConfiguration->setOptions(getOptions()); + getOptions()->add("Locale", sLocale); // create the access object uno::Reference< uno::XInterface > xReturn; diff --git a/configmgr/source/api2/providerimpl.cxx b/configmgr/source/api2/providerimpl.cxx index bcb77ba00032..855021f9c723 100644 --- a/configmgr/source/api2/providerimpl.cxx +++ b/configmgr/source/api2/providerimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: providerimpl.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dg $ $Date: 2000-11-10 22:42:54 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:14:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -314,7 +314,7 @@ namespace configmgr //----------------------------------------------------------------------------------- NodeElement* OProviderImpl::buildUpdateAccess(OUString const& _rAccessor, sal_Int32 nMinLevels) throw (uno::Exception, uno::RuntimeException) { - m_pConfiguration->setInternationalHelper(getInternationalHelper()); + m_pConfiguration->setOptions(getOptions()); CFG_TRACE_INFO("config provider: requesting the tree from the cache manager"); @@ -458,6 +458,7 @@ namespace configmgr bExtractSuccess = (aCurrent.Value >>= nLevelDepth); else if (aCurrent.Name.equalsIgnoreCase(OProviderImpl::FactoryArguments::sLocale)) bExtractSuccess = (aCurrent.Value >>= sLocale); +/* #ifdef DBG_UTIL else { @@ -467,6 +468,7 @@ namespace configmgr OSL_ENSHURE(sal_False, sMessage.getStr()); } #endif +*/ if (!bExtractSuccess) throw lang::IllegalArgumentException( @@ -505,6 +507,7 @@ namespace configmgr _rLocale = sLocale; _rUser = sUser; } + } // namespace configmgr diff --git a/configmgr/source/inc/bootstrap.hxx b/configmgr/source/inc/bootstrap.hxx index 218fd98ad4e4..0571cffb26f9 100644 --- a/configmgr/source/inc/bootstrap.hxx +++ b/configmgr/source/inc/bootstrap.hxx @@ -2,9 +2,9 @@ * * $RCSfile: bootstrap.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: lla $ $Date: 2000-11-03 08:51:03 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:13:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,9 +78,7 @@ namespace com { namespace sun { namespace star { } } } #include <rtl/ustring.hxx> - -#include <hashhelper.hxx> // I18n - +#include "options.hxx" namespace configmgr { @@ -95,8 +93,6 @@ namespace configmgr { OUString m_sSettingsFile; - mutable InternationalHelper m_aI18n; - public: ConnectionSettings(); explicit @@ -107,9 +103,8 @@ namespace configmgr is not empty, the security override will be used (if applicable), else it will be ignored */ IConfigSession* createConnection(uno::Reference<lang::XMultiServiceFactory> const& aServiceMgr, - const SettingsOverride& _rSettings) const; + const SettingsOverride& _rSettings, vos::ORef<OOptions> &_aOptions) const; - const InternationalHelper getInternationalHelper() const {return m_aI18n;} }; } diff --git a/configmgr/source/inc/options.hxx b/configmgr/source/inc/options.hxx new file mode 100644 index 000000000000..7697179213c1 --- /dev/null +++ b/configmgr/source/inc/options.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * $RCSfile: options.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: lla $ $Date: 2000-11-13 13:14:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CONFIGMGR_MISC_OPTIONS_HXX_ +#define CONFIGMGR_MISC_OPTIONS_HXX_ + +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Any.hxx> +#include "hashhelper.hxx" + +#ifndef ASCII +#define ASCII(x) OUString::createFromAscii(x) +#endif + +#include <vos/ref.hxx> + +namespace configmgr +{ + namespace css = ::com::sun::star; + namespace uno = css::uno; + + class OptionValue { + rtl::OUString m_aName; + uno::Any m_aValue; + public: + OptionValue(const rtl::OUString &_aName, const uno::Any& _aValue) + : m_aName(_aName), + m_aValue(_aValue) + {} + + rtl::OUString getName() {return m_aName;} + uno::Any getValue() {return m_aValue;} + + void setName(const rtl::OUString &_aName) {m_aName = _aName;} + void setValue(const uno::Any &_aAny) {m_aValue = _aAny;} + }; + + /** + class OOptions is created one time per Configuration[update]Access + all important options should stored in this class. + The object will be [weiterleiten] to all other objects so we only + need to extend this classobject and all other class can work with + the new options or important options etc. + */ + + // jb won't take a PropertyValue so we must [nachbilden] something like that. + + class OOptions : public vos::OReference + { + HashMapAny m_aHashMap; + public: + OOptions() + {} + + void add(const rtl::OUString &_aName, const uno::Any& _aValue) + { + m_aHashMap[_aName] = _aValue; + } + uno::Any getValue(const rtl::OUString &_aName) + { + return m_aHashMap[_aName]; + } + + // Some Helperfunctions, to esaier setting Values + void add(const sal_Char* _pChar, const rtl::OUString &_aValueAsString) + { + uno::Any aAny; + aAny <<= _aValueAsString; + m_aHashMap[ASCII(_pChar)] = aAny; + } + + rtl::OUString getLocale() + { + rtl::OUString aLocalStr; + uno::Any aAny; + aAny = m_aHashMap[ASCII("Locale")]; + if (aAny >>= aLocalStr) + { + return aLocalStr; + } + return ASCII("en-US"); // Fallback Language + } + + // vos::OReference implements acquire and release + // ... + }; +} // namespace + +#endif diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx index fc793ea77a87..e13b89fa5453 100644 --- a/configmgr/source/tree/cmtree.cxx +++ b/configmgr/source/tree/cmtree.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cmtree.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jb $ $Date: 2000-11-10 16:38:38 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:14:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -233,6 +233,18 @@ namespace configmgr INode* Subtree::doGetChild(OUString const& aName) const { SearchNode searchObj(aName); + +#ifdef DEBUG + for (ChildList::iterator it2 = m_aChildren.GetSet().begin(); + it2 != m_aChildren.GetSet().end(); + ++it2) + { + INode* pINode = *it2; + OUString aName2 = pINode->getName(); + volatile int dummy = 0; + } +#endif + ChildList::iterator it = m_aChildren.GetSet().find(&searchObj); if (it == m_aChildren.GetSet().end()) return NULL; diff --git a/configmgr/source/xml/typeconverter.cxx b/configmgr/source/xml/typeconverter.cxx index 986fa10ba44b..da32931bb3d6 100644 --- a/configmgr/source/xml/typeconverter.cxx +++ b/configmgr/source/xml/typeconverter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: typeconverter.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: lla $ $Date: 2000-11-03 08:51:06 $ + * last change: $Author: lla $ $Date: 2000-11-13 13:12:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,8 +135,18 @@ namespace configmgr } catch (script::CannotConvertException&) { + // ok, next try with trim() if (_rValue.getLength() != 0) - OSL_ENSHURE(sal_False, "toAny : could not convert !"); + { + try + { + aRes = xTypeConverter->convertToSimpleType(uno::makeAny(_rValue.trim()), _rTypeClass); + } + catch (script::CannotConvertException&) + { + OSL_ENSHURE(sal_False, "toAny : could not convert !"); + } + } } catch (lang::IllegalArgumentException&) { |