// some little notes // XDialog implementation has the following interesting bits // a Controls property ( which is an array of the container controls ) // each item in the controls array is a XControl, where the model is // basically a property bag // additionally the XDialog instance has itself a model // this model has a ControlModels ( array of models ) property // the models in ControlModels can be accessed by name // also the XDialog is a XControl ( to access the model above
// in case the dialog is already closed the VBA implementation should not throw exceptions if ( aObject.hasValue() )
{ // The Object *must* support XDefaultProperty here because getValue will // only return properties that are Objects ( e.g. controls ) // e.g. Userform1.aControl = something // 'aControl' has to support XDefaultProperty to make sense here
uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( cppu::UnoType<beans::XPropertySet>::get()), uno::UNO_QUERY_THROW );
xPropSet->setPropertyValue( aDfltPropName, aValue );
}
}
// in case the dialog is already closed the VBA implementation should not throw exceptions if ( m_xDialog.is() )
{
uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControl > xControl = nestedSearch( aPropertyName, xContainer );
xContainer->getControl( aPropertyName ); if ( xControl.is() )
{
uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); if (pControl && !m_sLibName.isEmpty())
pControl->setLibraryAndCodeName( m_sLibName + "." + getName() );
aResult <<= xVBAControl;
}
}
return aResult;
}
sal_Bool SAL_CALL
ScVbaUserForm::hasMethod( const OUString& /*aName*/ )
{ returnfalse;
}
uno::Any SAL_CALL
ScVbaUserForm::Controls( const uno::Any& index )
{ // if the dialog already closed we should do nothing, but the VBA will call methods of the Controls objects // thus we have to provide a dummy object in this case
uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY );
uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ) ); if ( index.hasValue() ) return xControls->Item( index, uno::Any() ); return uno::Any( xControls );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.