diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2001-07-05 14:04:47 +0000 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2001-07-05 14:04:47 +0000 |
commit | 0e883d9dbb0e296c9a79ae7cd78e54981f37daaa (patch) | |
tree | 81c5f441a0888855abb4c2b821463c64db88f998 /ucbhelper | |
parent | 80ba7d2a8dd277bd308e73a19c9b6efb4778f27d (diff) |
#87187# - New error handling for getPropertyValues (returns sequence< any >).
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/workben/myucp/myucp_content.cxx | 60 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_content.hxx | 14 |
2 files changed, 59 insertions, 15 deletions
diff --git a/ucbhelper/workben/myucp/myucp_content.cxx b/ucbhelper/workben/myucp/myucp_content.cxx index 7b3719779fd3..61af51ad46f3 100644 --- a/ucbhelper/workben/myucp/myucp_content.cxx +++ b/ucbhelper/workben/myucp/myucp_content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_content.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: kso $ $Date: 2001-06-06 14:46:05 $ + * last change: $Author: kso $ $Date: 2001-07-05 15:04:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,6 +75,9 @@ #ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_ #include <com/sun/star/beans/XPropertyAccess.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_ILLEGALACCESSEXCEPTION_HPP_ +#include <com/sun/star/lang/IllegalAccessException.hpp> +#endif #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> #endif @@ -333,7 +336,7 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - setPropertyValues( aProperties, Environment ); + aRet <<= setPropertyValues( aProperties, Environment ); } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertySetInfo" ) ) ) @@ -692,12 +695,13 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( } //========================================================================= -void Content::setPropertyValues( +uno::Sequence< uno::Any > Content::setPropertyValues( const uno::Sequence< beans::PropertyValue >& rValues, const uno::Reference< star::ucb::XCommandEnvironment >& xEnv ) { osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); + uno::Sequence< uno::Any > aRet( rValues.getLength() ); uno::Sequence< beans::PropertyChangeEvent > aChanges( rValues.getLength() ); sal_Int32 nChanged = 0; @@ -723,16 +727,28 @@ void Content::setPropertyValues( RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) ) { // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ) { // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ) { // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) @@ -753,6 +769,17 @@ void Content::setPropertyValues( m_aProps.aTitle = aNewValue; nChanged++; } + else + { + // Old value equals new value. No error! + } + } + else + { + aRet[ n ] <<= beans::IllegalTypeException( + rtl::OUString::createFromAscii( + "Property value has wrong type!" ), + static_cast< cppu::OWeakObject * >( this ) ); } } @@ -798,20 +825,35 @@ void Content::setPropertyValues( aChanges.getArray()[ nChanged ] = aEvent; nChanged++; } + else + { + // Old value equals new value. No error! + } } - catch ( beans::UnknownPropertyException ) + catch ( beans::UnknownPropertyException const & e ) { + aRet[ n ] <<= e; } - catch ( lang::WrappedTargetException ) + catch ( lang::WrappedTargetException const & e ) { + aRet[ n ] <<= e; } - catch ( beans::PropertyVetoException ) + catch ( beans::PropertyVetoException const & e ) { + aRet[ n ] <<= e; } - catch ( lang::IllegalArgumentException ) + catch ( lang::IllegalArgumentException const & e ) { + aRet[ n ] <<= e; } } + else + { + aRet[ n ] <<= uno::Exception( + rtl::OUString::createFromAscii( + "No property set for storing the value!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } } } @@ -824,6 +866,8 @@ void Content::setPropertyValues( aChanges.realloc( nChanged ); notifyPropertiesChange( aChanges ); } + + return aRet; } #if 0 diff --git a/ucbhelper/workben/myucp/myucp_content.hxx b/ucbhelper/workben/myucp/myucp_content.hxx index b926ab289490..b24f0632c135 100644 --- a/ucbhelper/workben/myucp/myucp_content.hxx +++ b/ucbhelper/workben/myucp/myucp_content.hxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_content.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: kso $ $Date: 2001-06-06 14:46:05 $ + * last change: $Author: kso $ $Date: 2001-07-05 15:04:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -126,14 +126,14 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > getPropertyValues( const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties, + ::com::sun::star::beans::Property >& rProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); - void setPropertyValues( - const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); + const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); // typedef rtl::Reference< Content > ContentRef; // typedef std::list< ContentRef > ContentRefList; |