diff options
Diffstat (limited to 'sc/source/ui/vba/vbamenuitems.cxx')
-rw-r--r-- | sc/source/ui/vba/vbamenuitems.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx index 8d12983e28d6..fc89a1e3415b 100644 --- a/sc/source/ui/vba/vbamenuitems.cxx +++ b/sc/source/ui/vba/vbamenuitems.cxx @@ -34,23 +34,22 @@ 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 ); - } - else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton ) - { - uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) ); - return uno::makeAny( xMenuItem ); - } - nextElement(); + uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) ); + return uno::makeAny( xMenu ); } - else - throw container::NoSuchElementException(); + else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton ) + { + uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) ); + return uno::makeAny( xMenuItem ); + } + nextElement(); + return uno::Any(); } }; |