incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1172123 - in /incubator/ooo/trunk/main: comphelper/inc/comphelper/namedvaluecollection.hxx comphelper/source/misc/namedvaluecollection.cxx sfx2/source/notify/eventsupplier.cxx
Date Sat, 17 Sep 2011 22:41:29 GMT
Author: mst
Date: Sat Sep 17 22:41:28 2011
New Revision: 1172123

URL: http://svn.apache.org/viewvc?rev=1172123&view=rev
Log:
fs34c: #i117625# when assigning events, only throw if there is an invalid type given, *not*
if the type is correct, but the sequence is merely empty

# HG changeset patch
# User Frank Schoenheit [fs] <frank.schoenheit@oracle.com>
# Date 1301640073 -7200
# Node ID e4014e6b2cb422bb8dca7dad4ba34f28d42cb86d
# Parent  a25f2ab3257e6b811ccb2436661f74d0c65719cd

Modified:
    incubator/ooo/trunk/main/comphelper/inc/comphelper/namedvaluecollection.hxx
    incubator/ooo/trunk/main/comphelper/source/misc/namedvaluecollection.cxx
    incubator/ooo/trunk/main/sfx2/source/notify/eventsupplier.cxx

Modified: incubator/ooo/trunk/main/comphelper/inc/comphelper/namedvaluecollection.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/comphelper/inc/comphelper/namedvaluecollection.hxx?rev=1172123&r1=1172122&r2=1172123&view=diff
==============================================================================
--- incubator/ooo/trunk/main/comphelper/inc/comphelper/namedvaluecollection.hxx (original)
+++ incubator/ooo/trunk/main/comphelper/inc/comphelper/namedvaluecollection.hxx Sat Sep 17
22:41:28 2011
@@ -117,6 +117,14 @@ namespace comphelper
             impl_assign( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue
>() );
         }
 
+        /** determines whether or not named values can be extracted from the given value
+
+            @return
+                <TRUE/> if and only if the given <code>Any</code> contains
a <code>NamedValue</code>, a
+                <code>PropertyValue</code>, or a sequence thereof.
+        */
+        static bool canExtractFrom( ::com::sun::star::uno::Any const & i_value );
+
         /// returns the number of elements in the collection
         size_t  size() const;
 

Modified: incubator/ooo/trunk/main/comphelper/source/misc/namedvaluecollection.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/comphelper/source/misc/namedvaluecollection.cxx?rev=1172123&r1=1172122&r2=1172123&view=diff
==============================================================================
--- incubator/ooo/trunk/main/comphelper/source/misc/namedvaluecollection.cxx (original)
+++ incubator/ooo/trunk/main/comphelper/source/misc/namedvaluecollection.cxx Sat Sep 17 22:41:28
2011
@@ -129,6 +129,19 @@ namespace comphelper
     }
 
 	//--------------------------------------------------------------------
+    bool NamedValueCollection::canExtractFrom( ::com::sun::star::uno::Any const & i_value
)
+    {
+        Type const & aValueType = i_value.getValueType();
+        if  (   aValueType.equals( ::cppu::UnoType< PropertyValue >::get() )
+            ||  aValueType.equals( ::cppu::UnoType< NamedValue >::get() )
+            ||  aValueType.equals( ::cppu::UnoType< Sequence< PropertyValue > >::get()
)
+            ||  aValueType.equals( ::cppu::UnoType< Sequence< NamedValue > >::get()
)
+            )
+            return true;
+        return false;
+    }    
+
+	//--------------------------------------------------------------------
     NamedValueCollection& NamedValueCollection::merge( const NamedValueCollection&
_rAdditionalValues, bool _bOverwriteExisting )
     {
         for (   NamedValueRepository::const_iterator namedValue = _rAdditionalValues.m_pImpl->aValues.begin();

Modified: incubator/ooo/trunk/main/sfx2/source/notify/eventsupplier.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/notify/eventsupplier.cxx?rev=1172123&r1=1172122&r2=1172123&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/notify/eventsupplier.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/notify/eventsupplier.cxx Sat Sep 17 22:41:28 2011
@@ -90,10 +90,10 @@ void SAL_CALL SfxEvents_Impl::replaceByN
 	{
 		if ( maEventNames[i] == aName )
 		{
-            const ::comphelper::NamedValueCollection aEventDescriptor( rElement );
 			// check for correct type of the element
-            if ( rElement.hasValue() && aEventDescriptor.empty() )
+            if ( !::comphelper::NamedValueCollection::canExtractFrom( rElement ) )
 				throw ILLEGALARGUMENTEXCEPTION();
+            ::comphelper::NamedValueCollection const aEventDescriptor( rElement );
 
             // create Configuration at first, creation might call this method also and that
would overwrite everything
 			// we might have stored before!



Mime
View raw message