diff options
author | Noel Power <noel.power@suse.com> | 2013-03-29 12:47:04 +0000 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-04-04 17:29:56 +0100 |
commit | 6076f94074959cdc1f1c74dc71b1fd4182a7f7e8 (patch) | |
tree | 7edb4721a15445f3b8b43ae5b8f69217bdf8dc67 | |
parent | squash NoSuchElementExceptions when modifying keybindings (diff) | |
download | core-6076f94074959cdc1f1c74dc71b1fd4182a7f7e8.tar.gz core-6076f94074959cdc1f1c74dc71b1fd4182a7f7e8.zip |
fix 'Visible' property for XControlShape(s) Foreach support for CommandBars
Seems now we need to additionally set 'Visible' property for XControlShapes
to ensure correct visibility
Also we need allow 'For Each' syntax to with with CommandBar collection.
Note: the implementation of the CommandBar enumeration seems wrong, I
would have thought that it should match ( and share ) implementation
details with normal index access ( it doesn't )
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.cxx | 16 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbacommandbars.cxx | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index a5cf70e807c2..975fb9955a8a 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -204,8 +204,17 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) { sal_Bool bVisible( sal_True ); + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); m_xProps->getPropertyValue (rtl::OUString( "EnableVisible" )) >>= bVisible; + if ( xControlShape.is() ) + { + bool bEnableVisible = bVisible; + uno::Reference< beans::XPropertySet > xProps( m_xControl, uno::UNO_QUERY_THROW ); + xProps->getPropertyValue + (rtl::OUString( "Visible" )) >>= bVisible; + bVisible = bVisible && bEnableVisible; + } return bVisible; } @@ -214,6 +223,13 @@ void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeE uno::Any aValue( bVisible ); m_xProps->setPropertyValue (rtl::OUString( "EnableVisible" ), aValue); + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + if ( xControlShape.is() ) + { + uno::Reference< beans::XPropertySet > xProps( m_xControl, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue + (rtl::OUString( "Visible" ), aValue); + } } double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) { diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx index d07f2e39981d..dbd1fc775d1d 100644 --- a/vbahelper/source/vbahelper/vbacommandbars.cxx +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx @@ -72,6 +72,10 @@ public: { uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl ); uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, m_pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) ); + // Strange, shouldn't the Enumeration support match/share the + // iteration code? ( e.g. ScVbaCommandBars::Item(...) ) + // and we at least should return here ( something ) it seems + return uno::makeAny( xCommandBar ); } else return nextElement(); |