diff options
author | Noel Power <nopower@novell.com> | 2011-08-12 00:36:51 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-16 21:22:42 -0400 |
commit | 4fae740db79d4e7cc97440e2bab8d1ef612d9b51 (patch) | |
tree | c014cedf4204e02dd4946c5d0aafed34e1d13205 | |
parent | Let's not even fall back to the old method. (diff) | |
download | core-4fae740db79d4e7cc97440e2bab8d1ef612d9b51.tar.gz core-4fae740db79d4e7cc97440e2bab8d1ef612d9b51.zip |
Disable fake VBA events for the old-style form controls.
-rw-r--r-- | forms/source/component/FormComponent.cxx | 20 | ||||
-rw-r--r-- | forms/source/inc/FormComponent.hxx | 1 | ||||
-rw-r--r-- | forms/source/inc/frm_strings.hxx | 1 | ||||
-rw-r--r-- | forms/source/inc/property.hrc | 1 | ||||
-rw-r--r-- | forms/source/misc/InterfaceContainer.cxx | 10 | ||||
-rw-r--r-- | forms/source/misc/property.cxx | 1 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 7 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 |
8 files changed, 40 insertions, 2 deletions
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 14c9f4fce067..6fb056ea9447 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -597,6 +597,7 @@ OControlModel::OControlModel( ,m_nTabIndex(FRM_DEFAULT_TABINDEX) ,m_nClassId(FormComponentType::CONTROL) ,m_bNativeLook( sal_False ) + ,m_bGenerateVbEvents( sal_False ) // form controls are usually embedded into documents, not dialogs, and in documents // the native look is ugly .... // #i37342# @@ -630,6 +631,7 @@ OControlModel::OControlModel( // Refcount wieder bei NULL decrement(m_refCount); } + } //------------------------------------------------------------------ @@ -651,6 +653,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< m_nTabIndex = _pOriginal->m_nTabIndex; m_nClassId = _pOriginal->m_nClassId; m_bNativeLook = _pOriginal->m_bNativeLook; + m_bGenerateVbEvents = _pOriginal->m_bGenerateVbEvents; if ( _bCloneAggregate ) { @@ -672,6 +675,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< // decrement ref count decrement( m_refCount ); } + } //------------------------------------------------------------------ @@ -988,6 +992,11 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const aReturn <<= (sal_Bool)sal_True; break; + case PROPERTY_ID_GENERATEVBAEVENTS: + aReturn <<= (sal_Bool)sal_False; + break; + + default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) m_aPropertyBagHelper.getDynamicPropertyDefaultByHandle( _nHandle, aReturn ); @@ -1017,6 +1026,8 @@ void OControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) con case PROPERTY_ID_NATIVE_LOOK: _rValue <<= (sal_Bool)m_bNativeLook; break; + case PROPERTY_ID_GENERATEVBAEVENTS: + _rValue <<= (sal_Bool)m_bGenerateVbEvents; default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) m_aPropertyBagHelper.getDynamicFastPropertyValue( _nHandle, _rValue ); @@ -1046,6 +1057,9 @@ sal_Bool OControlModel::convertFastPropertyValue( case PROPERTY_ID_NATIVE_LOOK: bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bNativeLook); break; + case PROPERTY_ID_GENERATEVBAEVENTS: + bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bGenerateVbEvents); + break; default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) bModified = m_aPropertyBagHelper.convertDynamicFastPropertyValue( _nHandle, _rValue, _rConvertedValue, _rOldValue ); @@ -1080,6 +1094,9 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A case PROPERTY_ID_NATIVE_LOOK: OSL_VERIFY( _rValue >>= m_bNativeLook ); break; + case PROPERTY_ID_GENERATEVBAEVENTS: + OSL_VERIFY( _rValue >>= m_bGenerateVbEvents ); + break; default: if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) ) m_aPropertyBagHelper.setDynamicFastPropertyValue( _nHandle, _rValue ); @@ -1092,11 +1109,12 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A //------------------------------------------------------------------------------ void OControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const { - BEGIN_DESCRIBE_BASE_PROPERTIES( 4 ) + BEGIN_DESCRIBE_BASE_PROPERTIES( 5 ) DECL_PROP2 (CLASSID, sal_Int16, READONLY, TRANSIENT); DECL_PROP1 (NAME, ::rtl::OUString, BOUND); DECL_BOOL_PROP2 (NATIVE_LOOK, BOUND, TRANSIENT); DECL_PROP1 (TAG, ::rtl::OUString, BOUND); + DECL_PROP1 (GENERATEVBAEVENTS, sal_Bool, TRANSIENT); END_DESCRIBE_PROPERTIES() } diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx index 40a4a0705ca5..104117856f33 100644 --- a/forms/source/inc/FormComponent.hxx +++ b/forms/source/inc/FormComponent.hxx @@ -376,6 +376,7 @@ protected: sal_Int16 m_nTabIndex; // index within the taborder sal_Int16 m_nClassId; // type of the control sal_Bool m_bNativeLook; // should the control use the native platform look? + sal_Bool m_bGenerateVbEvents; // should the control generate fake vba events // </properties> diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx index 57d4ff9bccd5..b6c3e8fcce79 100644 --- a/forms/source/inc/frm_strings.hxx +++ b/forms/source/inc/frm_strings.hxx @@ -327,6 +327,7 @@ namespace frm FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_FOCUS, "ControlBorderColorOnFocus" ); FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_MOUSE, "ControlBorderColorOnHover" ); FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_INVALID,"ControlBorderColorOnInvalid" ); + FORMS_CONSTASCII_STRING( PROPERTY_GENERATEVBAEVENTS, "GenerateVbaEvents" ); //-------------------------------------------------------------------------- //- URLs diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc index b0216f4f63b6..39b2f9694c26 100644 --- a/forms/source/inc/property.hrc +++ b/forms/source/inc/property.hrc @@ -305,6 +305,7 @@ namespace frm #define PROPERTY_ID_XSD_TYPE_CLASS ( PROPERTY_ID_START + 258 ) #define PROPERTY_ID_LINEEND_FORMAT ( PROPERTY_ID_START + 259 ) // css.awt.LineEndFormat +#define PROPERTY_ID_GENERATEVBAEVENTS ( PROPERTY_ID_START + 260 ) // start ID fuer aggregierte Properties #define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000) diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index de178b800dd3..1301c08c255d 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -828,6 +828,14 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException ) { const bool bHandleEvents = _bEvents && m_xEventAttacher.is(); + bool bHandleVbaEvents = false; + try + { + _rxElement->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GenerateVbaEvents") ) ) >>= bHandleVbaEvents; + } + catch( const Exception& ) + { + } // SYNCHRONIZED -----> ::osl::ClearableMutexGuard aGuard( m_rMutex ); @@ -883,7 +891,7 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper // <----- SYNCHRONIZED // insert faked VBA events? - if ( bHandleEvents ) + if ( bHandleVbaEvents ) { Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY ); if ( xMgr.is() ) diff --git a/forms/source/misc/property.cxx b/forms/source/misc/property.cxx index 0d97609f0eb7..5474c4d730dd 100644 --- a/forms/source/misc/property.cxx +++ b/forms/source/misc/property.cxx @@ -241,6 +241,7 @@ void PropertyInfoService::initialize() ADD_PROP_ASSIGNMENT(DEFAULT_SPIN_VALUE); ADD_PROP_ASSIGNMENT( WRITING_MODE ); ADD_PROP_ASSIGNMENT( CONTEXT_WRITING_MODE ); + ADD_PROP_ASSIGNMENT( GENERATEVBAEVENTS ); // now sort the array by name diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 0eef022eaef7..c69cc1fa1101 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -1892,6 +1892,13 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr { PropertyMap aPropMap; aPropMap.setProperty( PROP_Name, maName ); + try + { + aPropMap.setProperty( PROP_GenerateVbaEvents, true); + } + catch( Exception& ) + { + } mxModel->convertProperties( aPropMap, rConv ); PropertySet aPropSet( rxCtrlModel ); aPropSet.setProperties( aPropMap ); diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index a4b270ab4124..fa5b1ee51c50 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -179,6 +179,7 @@ FormulaConvention Function GapwidthSequence Geometry3D +GenerateVbaEvents GradientName Graphic GraphicColorMode |