[PATCH libreoffice-4-0] fix 'Visible' property for XControlShape(s) Foreach support ...

Noel Power (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 5 01:48:01 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3209

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/09/3209/1

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 )

Change-Id: Ia5306b4c976f6dc9a5f82e245ca5440f204f5bab
---
M vbahelper/source/msforms/vbacontrol.cxx
M vbahelper/source/vbahelper/vbacommandbars.cxx
2 files changed, 18 insertions(+), 1 deletion(-)



diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 288cefa..e9be040 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -192,7 +192,14 @@
 sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
 {
     sal_Bool bVisible( sal_True );
-    m_xProps->getPropertyValue( "EnableVisible" ) >>= bVisible;
+    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->getPropertyValue ( "Visible" ) >>= bVisible;
+    }
+    else
+        m_xProps->getPropertyValue ( "EnableVisible" ) >>= bVisible;
     return bVisible;
 }
 
@@ -200,6 +207,12 @@
 {
     uno::Any aValue( bVisible );
     m_xProps->setPropertyValue( "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 ( "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 e8a2000..a1515fb 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -63,6 +63,10 @@
             {
                 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 ) );
+                // 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();

-- 
To view, visit https://gerrit.libreoffice.org/3209
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5306b4c976f6dc9a5f82e245ca5440f204f5bab
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Noel Power <noel.power at suse.com>



More information about the LibreOffice mailing list