summaryrefslogtreecommitdiff
authorEike Rathke <erack@redhat.com>2012-05-08 08:49:28 (GMT)
committer Michael Meeks <michael.meeks@suse.com>2012-05-08 09:17:20 (GMT)
commit62d1f855ce3b630f109efb8437237602590715fe (patch) (side-by-side diff)
treee6a9c199b810e3b846f75ca8aa366f7aa2f17c1d
parent0f555363a3e12d45c3c1d7dcb26e32dc2dcf0ce2 (diff)
downloadcore-62d1f855ce3b630f109efb8437237602590715fe.zip
core-62d1f855ce3b630f109efb8437237602590715fe.tar.gz
resolved rhbz#819118 catch exception from VBA lib container
If in an imported Excel document with VBA a sheet to be copied does not have a document object in the VBAProject container (whyever that may be the case) the getByName() rightly throws a NoSuchElement exception. Catch that. Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--sc/source/ui/docshell/docsh5.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index b965d50..53fda62 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -949,15 +949,21 @@ sal_Bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, sal_Bool bCopy, s
nTabToUse = aDocument.GetMaxTableNumber() - 1;
rtl::OUString sCodeName;
rtl::OUString sSource;
- Reference< XNameContainer > xLib;
- if( xLibContainer.is() )
+ try
{
- com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
+ Reference< XNameContainer > xLib;
+ if( xLibContainer.is() )
+ {
+ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+ if( xLib.is() )
+ {
+ xLib->getByName( sSrcCodeName ) >>= sSource;
+ }
}
- if( xLib.is() )
+ catch ( const com::sun::star::uno::Exception& )
{
- xLib->getByName( sSrcCodeName ) >>= sSource;
}
VBA_InsertModule( aDocument, nTabToUse, sCodeName, sSource );
}