summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorMikhail Voytenko <mav@openoffice.org>2010-07-08 22:10:20 +0200
committerMikhail Voytenko <mav@openoffice.org>2010-07-08 22:10:20 +0200
commit47ad9825590f931c574f83602b0745a122a79485 (patch)
tree756237de700e117bd14aa2502d7924cd9767bb3b /vbahelper
parentdd6ba6b64aec20d37a402bee233e742e29285e88 (diff)
hg commig -mmib17:
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx20
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx4
2 files changed, 17 insertions, 7 deletions
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index b7fad7d9372d..8d01687ef905 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -74,12 +74,20 @@ private:
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
- mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
+ try
+ {
+ mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
- msNames.realloc( sXControls.getLength() );
- for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
- SetArrayElementTo( sXControls[ i ], i );
+ msNames.realloc( sXControls.getLength() );
+ 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 >
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 1ce403fc19c3..2a4cecfc2338 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -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() ) );