diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-23 15:27:51 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-23 15:28:36 -0500 |
commit | ba897375db27a2b74ead5251516824572260b029 (patch) | |
tree | 63bb9872f28f758ef7ac3362f862be44cef73bf9 /sc | |
parent | 2ee55872ebc5aeb71041c3267d9b3baa9607b85b (diff) |
Let's throw out-of-bound exception on out-of-bound destination position.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docuno.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 1ca0d7165dd1..35296da3400b 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -406,7 +406,9 @@ public: ::com::sun::star::sheet::XSpreadsheetDocument > & xDocSrc, const rtl::OUString& srcName, const sal_Int32 nDestPosition) - throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); // XCellRangesAccess diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 95632e613611..3bc1018c000c 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2632,7 +2632,7 @@ void SAL_CALL ScTableSheetsObj::removeByName( const rtl::OUString& aName ) sal_Int32 ScTableSheetsObj::importSheet( const uno::Reference < sheet::XSpreadsheetDocument > & xDocSrc, const rtl::OUString& srcName, const sal_Int32 nDestPosition ) - throw( lang::IllegalArgumentException, uno::RuntimeException ) + throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException, uno::RuntimeException ) { //pDocShell is the destination ScDocument* pDocDest = pDocShell->GetDocument(); @@ -2655,11 +2655,11 @@ sal_Int32 ScTableSheetsObj::importSheet( SCTAB nCount = pDocDest->GetTableCount(); nIndexDest = static_cast<SCTAB>(nDestPosition); if ( nIndexDest > nCount ) - nIndexDest = nCount; + throw lang::IndexOutOfBoundsException(); // control nDestPosition > 0 - if ( nIndexDest < 0) - nIndexDest = 0; + if (nIndexDest < 0) + throw lang::IndexOutOfBoundsException(); // Transfert Tab bool bInsertNew = true; |