diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-02-09 14:41:17 +0100 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-02-09 14:41:17 +0100 |
commit | 8d3cb635183cb2e36322d1664ad9cbaad4e991a2 (patch) | |
tree | bf6b2c37c852d729edc87347513a085143b5b82f /unotools | |
parent | 102d3a0d21506d212b3956ae575a00b8e0dbd75a (diff) | |
parent | da2c680d23b67d4721aa29f740475fd6d40e2e08 (diff) |
cbosdo02: merging changesets up to DEV300_m71
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/confignode.hxx | 3 | ||||
-rw-r--r-- | unotools/source/config/confignode.cxx | 60 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucbhelper.cxx | 16 |
3 files changed, 34 insertions, 45 deletions
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index 580274004e1a..2e305030fa2b 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -88,6 +88,9 @@ namespace utl /// dtor ~OConfigurationNode() {} + /// returns the local name of the node + ::rtl::OUString getLocalName() const; + /** open a sub node @param _rPath access path of the to-be-opened sub node. May be a hierarchical path. */ diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 4b1b9fe272db..c8134137db0c 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/util/XStringEscape.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> #include <comphelper/extract.hxx> #include <rtl/string.hxx> #if OSL_DEBUG_LEVEL > 0 @@ -139,6 +140,22 @@ namespace utl } //------------------------------------------------------------------------ + ::rtl::OUString OConfigurationNode::getLocalName() const + { + ::rtl::OUString sLocalName; + try + { + Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); + sLocalName = xNamed->getName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sLocalName; + } + + //------------------------------------------------------------------------ ::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const { ::rtl::OUString sName(_rName); @@ -155,13 +172,9 @@ namespace utl else sName = xEscaper->unescapeString(sName); } - catch(IllegalArgumentException&) - { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: illegal argument (caught an exception saying so)!"); - } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: caught an exception!"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -455,16 +468,9 @@ namespace utl aReturn = m_xHierarchyAccess->getByHierarchicalName(_rPath); } } - catch(NoSuchElementException& e) + catch(const NoSuchElementException&) { - #if OSL_DEBUG_LEVEL > 0 - rtl::OStringBuffer aBuf( 256 ); - aBuf.append("OConfigurationNode::getNodeValue: caught a NoSuchElementException while trying to open "); - aBuf.append( rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE(sal_False, aBuf.getStr()); - #else - (void)e; - #endif + DBG_UNHANDLED_EXCEPTION(); } return aReturn; } @@ -487,7 +493,7 @@ namespace utl } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::cloneAsRoot: could not retrieve the node path!"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -548,13 +554,9 @@ namespace utl m_xCommitter->commitChanges(); return sal_True; } - catch(WrappedTargetException&) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a WrappedTargetException!"); - } - catch(RuntimeException&) + catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a RuntimeException!"); + DBG_UNHANDLED_EXCEPTION(); } return sal_False; } @@ -591,7 +593,7 @@ namespace utl } catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: unable to check the service conformance of the provider given!"); + DBG_UNHANDLED_EXCEPTION(); } } #endif @@ -635,15 +637,9 @@ namespace utl try { xComp->dispose(); } catch(Exception&) { } } } - catch(Exception& e) + catch(const Exception&) { - #if OSL_DEBUG_LEVEL > 0 - ::rtl::OString sMessage( "OConfigurationTreeRoot::createWithProvider: caught an exception while creating the access object!\nmessage:\n" ); - sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); - OSL_ENSURE( sal_False, sMessage.getStr() ); - #else - (void)e; - #endif + DBG_UNHANDLED_EXCEPTION(); } } bTryAgain = CM_PREFER_UPDATABLE == _eMode; @@ -670,9 +666,9 @@ namespace utl if (xProviderAsFac.is()) return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite); } - catch(Exception&) + catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithServiceFactory: error while instantiating the provider service!"); + DBG_UNHANDLED_EXCEPTION(); } } return OConfigurationTreeRoot(); diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 2b301efc4e52..a798f485516a 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -46,15 +46,13 @@ #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XCommandInfo.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> +#include <com/sun/star/ucb/ContentInfo.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> -#include <com/sun/star/ucb/XContentCreator.hpp> #include <com/sun/star/ucb/XDynamicResultSet.hpp> #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/container/XChild.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveIOException.hpp> -#endif #include <com/sun/star/task/XInteractionHandler.hpp> #include <ucbhelper/commandenvironment.hxx> #include <ucbhelper/content.hxx> @@ -489,11 +487,7 @@ sal_Bool UCBContentHelper::CanMakeFolder( const String& rFolder ) try { Content aCnt( rFolder, uno::Reference< XCommandEnvironment > () ); - uno::Reference< XContentCreator > xCreator = uno::Reference< XContentCreator >( aCnt.get(), UNO_QUERY ); - if ( !xCreator.is() ) - return sal_False; - - Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo(); + Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); sal_Int32 nCount = aInfo.getLength(); if ( nCount == 0 ) return sal_False; @@ -538,11 +532,7 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont try { - uno::Reference< XContentCreator > xCreator( aCnt.get(), UNO_QUERY ); - if ( !xCreator.is() ) - return sal_False; - - Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo(); + Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); sal_Int32 nCount = aInfo.getLength(); if ( nCount == 0 ) return sal_False; |