Kaydet (Commit) 4fae740d authored tarafından Noel Power's avatar Noel Power Kaydeden (comit) Kohei Yoshida

Disable fake VBA events for the old-style form controls.

üst aadd7404
......@@ -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()
}
......
......@@ -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>
......
......@@ -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
......
......@@ -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)
......
......@@ -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() )
......
......@@ -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
......
......@@ -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 );
......
......@@ -179,6 +179,7 @@ FormulaConvention
Function
GapwidthSequence
Geometry3D
GenerateVbaEvents
GradientName
Graphic
GraphicColorMode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment