diff options
Diffstat (limited to 'sc/source/ui/vba/vbamenus.cxx')
-rw-r--r-- | sc/source/ui/vba/vbamenus.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx index 9c3f86ad904c..d2a73bf10bde 100644 --- a/sc/source/ui/vba/vbamenus.cxx +++ b/sc/source/ui/vba/vbamenus.cxx @@ -33,18 +33,17 @@ public: virtual uno::Any SAL_CALL nextElement() override { // FIXME: should be add menu - if( hasMoreElements() ) + if( !hasMoreElements() ) + throw container::NoSuchElementException(); + + uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); + if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup ) { - uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup ) - { - uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) ); - return uno::makeAny( xMenu ); - } - nextElement(); + uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) ); + return uno::makeAny( xMenu ); } - else - throw container::NoSuchElementException(); + nextElement(); + return uno::Any(); } }; |