summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-18 07:15:37 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-18 07:15:37 +0000
commit0f930ce69094179f9c27c7fac3ff0c80447d3502 (patch)
tree5650a2b3826597ea85e4887a0215f9afec4a2619 /sfx2
parent5925d836a9079ed07079a28f41a541b0fec7e00e (diff)
CWS-TOOLING: integrate CWS dba31i
2009-02-12 09:37:16 +0100 fs r267635 : merging the fix for #i98549# from CWS rptfix04 to CWS dba31i 2009-02-09 10:09:03 +0100 fs r267502 : #i98467# 2009-02-03 14:40:59 +0100 fs r267328 : #i97159# +checkParameterTypes 2009-02-03 14:40:32 +0100 fs r267327 : some more data / correct query 'all orders' 2009-02-03 14:16:56 +0100 fs r267321 : #i97159# properly determine column alias / table range for parameters in BETWEEN clauses 2009-02-03 12:39:40 +0100 oj r267313 : #i97159# check for column range in parameter 2009-02-03 10:17:29 +0100 fs r267300 : #i98247# 2009-02-02 12:21:18 +0100 oj r267258 : #i98724# subst corrected
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/notify/eventsupplier.cxx79
1 files changed, 42 insertions, 37 deletions
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index a10d4f0075..9d64f696cb 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -73,6 +73,8 @@
#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY
namespace css = ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::PropertyValue;
//--------------------------------------------------------------------------------------------------------
// --- XNameReplace ---
@@ -83,55 +85,58 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY &
{
::osl::MutexGuard aGuard( maMutex );
- bool bReset = !rElement.hasValue();
// find the event in the list and replace the data
long nCount = maEventNames.getLength();
for ( long i=0; i<nCount; i++ )
{
if ( maEventNames[i] == aName )
{
+ Sequence< PropertyValue > aProperties;
// check for correct type of the element
- if ( bReset || ::getCppuType( (const SEQUENCE < PROPERTYVALUE > *)0 ) == rElement.getValueType() )
+ if ( rElement.hasValue() && !( rElement >>= aProperties ) )
+ throw ILLEGALARGUMENTEXCEPTION();
+
+ // create Configuration at first, creation might call this method also and that would overwrite everything
+ // we might have stored before!
+ USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName );
+ OSL_ENSURE( nID, "SfxEvents_Impl::replaceByName: no ID for the given event!" );
+ if ( !nID )
+ // throw?
+ return;
+
+ if ( mpObjShell && !mpObjShell->IsLoading() )
+ mpObjShell->SetModified( TRUE );
+
+ if ( aProperties.getLength() )
{
- // create Configuration at first, creation might call this method also and that would overwrite everything
- // we might have stored before!
- USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName );
- if ( nID )
+ // "normalize" the macro descriptor
+ ANY aValue;
+ BlowUpMacro( rElement, aValue, mpObjShell );
+ aValue >>= aProperties;
+
+ ::rtl::OUString sType;
+ if ( ( aProperties.getLength() == 1 )
+ && ( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 )
+ && ( aProperties[0].Value >>= sType )
+ && ( sType.getLength() == 0 )
+ )
{
- // pConfig becomes the owner of the new SvxMacro
- if ( mpObjShell && !mpObjShell->IsLoading() )
- mpObjShell->SetModified( TRUE );
-
- if ( bReset )
- {
- maEventData[i] = ANY();
- }
- else
- {
- ANY aValue;
- BlowUpMacro( rElement, aValue, mpObjShell );
-
- SEQUENCE < PROPERTYVALUE > aProperties;
- if ( aValue >>= aProperties )
- {
- ::rtl::OUString aType;
- if (( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) &&
- ( aProperties[0].Value >>= aType ) &&
- aType.getLength() == 0 )
- {
- // An empty event type means no binding. Therefore reset data
- // to reflect that state.
- maEventData[i] = ANY();
- }
- else
- maEventData[i] = aValue;
- }
- }
+ // An empty event type means no binding. Therefore reset data
+ // to reflect that state.
+ // (that's for compatibility only. Nowadays, the Tools/Customize dialog should
+ // set an empty sequence to indicate the request for resetting the assignment.)
+ aProperties.realloc( 0 );
}
}
- else
- throw ILLEGALARGUMENTEXCEPTION();
+ if ( aProperties.getLength() )
+ {
+ maEventData[i] = makeAny( aProperties );
+ }
+ else
+ {
+ maEventData[i].clear();
+ }
return;
}
}