hg commig -mmib17:

This commit is contained in:
Mikhail Voytenko 2010-07-08 22:10:20 +02:00
parent dd6ba6b64a
commit 47ad982559
2 changed files with 17 additions and 7 deletions

View file

@ -73,6 +73,8 @@ private:
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
try
{
mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
@ -81,6 +83,12 @@ public:
for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
SetArrayElementTo( sXControls[ i ], i );
}
catch( uno::Exception& )
{
// accept the case when the dialog already does not exist
// in this case the wrapper should work in dummy mode
}
}
static rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
{
@ -186,7 +194,7 @@ ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent,
const css::uno::Reference< awt::XControl >& xDialog )
: ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
{
mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
mxDialog.set( xDialog, uno::UNO_QUERY );
}
uno::Reference< container::XEnumeration >

View file

@ -185,7 +185,9 @@ ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::Runtime
uno::Any SAL_CALL
ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
{
uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
// 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 ) );
if ( index.hasValue() )
return uno::makeAny( xControls->Item( index, uno::Any() ) );