Commits

Anonymous committed c478d2f Merge

mib20: Merge

  • Participants
  • Parent commits c84b140, a64cabd

Comments (0)

Files changed (14)

File framework/source/uielement/menubarmanager.cxx

 static const char ITEM_DESCRIPTOR_TYPE[]              = "Type";
 static const char ITEM_DESCRIPTOR_MODULEIDENTIFIER[]  = "ModuleIdentifier";
 static const char ITEM_DESCRIPTOR_DISPATCHPROVIDER[]  = "DispatchProvider";
-static const char   ITEM_DESCRIPTOR_STYLE[]         = "Style";
+static const char ITEM_DESCRIPTOR_STYLE[]             = "Style";
+static const char ITEM_DESCRIPTOR_ISVISIBLE[]         = "IsVisible";
+static const char ITEM_DESCRIPTOR_ENABLED[]           = "Enabled";
 
-const sal_Int32   LEN_DESCRIPTOR_COMMANDURL           = 10;
-const sal_Int32   LEN_DESCRIPTOR_HELPURL              = 7;
-const sal_Int32   LEN_DESCRIPTOR_CONTAINER            = 23;
-const sal_Int32   LEN_DESCRIPTOR_LABEL                = 5;
-const sal_Int32   LEN_DESCRIPTOR_TYPE                 = 4;
-const sal_Int32   LEN_DESCRIPTOR_MODULEIDENTIFIER     = 16;
-const sal_Int32   LEN_DESCRIPTOR_DISPATCHPROVIDER     = 16;
-static const sal_Int32 ITEM_DESCRIPTOR_STYLE_LEN       = 5;
+static const sal_Int32 LEN_DESCRIPTOR_COMMANDURL       = 10;
+static const sal_Int32 LEN_DESCRIPTOR_HELPURL          = 7;
+static const sal_Int32 LEN_DESCRIPTOR_CONTAINER        = 23;
+static const sal_Int32 LEN_DESCRIPTOR_LABEL            = 5;
+static const sal_Int32 LEN_DESCRIPTOR_TYPE             = 4;
+static const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16;
+static const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16;
+static const sal_Int32 LEN_DESCRIPTOR_STYLE            = 5;
+static const sal_Int32 LEN_DESCRIPTOR_ISVISIBLE        = 9;
+static const sal_Int32 LEN_DESCRIPTOR_ENABLED          = 7;
 
 const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500;
 
         rtl::OUString                   aLabel;
         rtl::OUString                   aHelpURL;
         rtl::OUString                   aModuleIdentifier( rModuleIdentifier );
+	    sal_Bool                        bShow(sal_True);
+	    sal_Bool                        bEnabled(sal_True);
         sal_uInt16                      nType = 0;
         Reference< XIndexAccess >       xIndexContainer;
         Reference< XDispatchProvider >  xDispatchProvider( rDispatchProvider );
                 for ( int i = 0; i < aProp.getLength(); i++ )
                 {
                     rtl::OUString aPropName = aProp[i].Name;
-                    if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL,
-                                                 LEN_DESCRIPTOR_COMMANDURL ))
+                    if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, LEN_DESCRIPTOR_COMMANDURL ))
                         aProp[i].Value >>= aCommandURL;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL,
-                                                      LEN_DESCRIPTOR_HELPURL ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, LEN_DESCRIPTOR_HELPURL ))
                         aProp[i].Value >>= aHelpURL;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER,
-                                                      LEN_DESCRIPTOR_CONTAINER ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, LEN_DESCRIPTOR_CONTAINER ))
                         aProp[i].Value >>= xIndexContainer;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL,
-                                                      LEN_DESCRIPTOR_LABEL ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, LEN_DESCRIPTOR_LABEL ))
                         aProp[i].Value >>= aLabel;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE,
-                                                      LEN_DESCRIPTOR_TYPE ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, LEN_DESCRIPTOR_TYPE ))
                         aProp[i].Value >>= nType;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER,
-                                                      LEN_DESCRIPTOR_MODULEIDENTIFIER ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER, LEN_DESCRIPTOR_MODULEIDENTIFIER ))
                         aProp[i].Value >>= aModuleIdentifier;
-                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER,
-                                                      LEN_DESCRIPTOR_DISPATCHPROVIDER ))
+                    else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER, LEN_DESCRIPTOR_DISPATCHPROVIDER ))
                         aProp[i].Value >>= xDispatchProvider;
-                   else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, ITEM_DESCRIPTOR_STYLE_LEN ))
+                    else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, LEN_DESCRIPTOR_STYLE ))
                         aProp[i].Value >>= nStyle;
+                    else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ISVISIBLE, LEN_DESCRIPTOR_ISVISIBLE ))
+		                aProp[i].Value >>= bShow;
+                    else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ENABLED, LEN_DESCRIPTOR_ENABLED ))
+		                aProp[i].Value >>= bEnabled;
                 }
 
                 if ( nType == ::com::sun::star::ui::ItemType::DEFAULT )
                     sal_Int32 nHelpId = aHelpURL.toInt32();
                     if ( nHelpId > 0 )
                         pMenu->SetHelpId( nId, (USHORT)nHelpId );
+                    
                     if ( nStyle )
                     {
                         MenuItemBits nBits = pMenu->GetItemBits( nId );
                         if ( nStyle & ::com::sun::star::ui::ItemStyle::RADIO_CHECK )
                            nBits |= MIB_RADIOCHECK;
                         pMenu->SetItemBits( nId, nBits );
-                    } 
+                    }
+		    
+                    if ( bShow )
+		                pMenu->ShowItem( nId );
+		            else
+                        pMenu->HideItem( nId );
+                    
+                    if ( bEnabled)
+                        pMenu->EnableItem( nId, TRUE );
+                    else
+                        pMenu->EnableItem( nId, FALSE );
+                    
                     if ( xIndexContainer.is() )
                     {
                         PopupMenu* pNewPopupMenu = new PopupMenu;

File oovbaapi/ooo/vba/excel/SheetObjects.idl

     /** Adds a new graphic object to the sheet this collection belongs to. The
         type of the object is determined by the type of the collection.
         
-        @param fLeft  Position of the left border in points (1/72 inch).
-        @param fTop  Position of the top border in points (1/72 inch).
-        @param fWidth  Width of the object in points (1/72 inch).
-        @param fHeight  Height of the object in points (1/72 inch).
+        @param Left  Position of the left border in points (1/72 inch).
+        @param Top  Position of the top border in points (1/72 inch).
+        @param Width  Width of the object in points (1/72 inch).
+        @param Height  Height of the object in points (1/72 inch).
         
         @return  The created graphic object.
      */
     /** Adds a new line object to the sheet this collection belongs to. The
         type of the object is determined by the type of the collection.
 
-        @param fX1  Position of the first X coordinate in points (1/72 inch).
-        @param fY1  Position of the first Y coordinate in points (1/72 inch).
-        @param fX2  Position of the last X coordinate in points (1/72 inch).
-        @param fY2  Position of the last Y coordinate in points (1/72 inch).
+        @param X1  Position of the first X coordinate in points (1/72 inch).
+        @param Y1  Position of the first Y coordinate in points (1/72 inch).
+        @param X2  Position of the last X coordinate in points (1/72 inch).
+        @param Y2  Position of the last Y coordinate in points (1/72 inch).
 
         @return  The created line object.
      */
 {
     /** Adds a new polygon object to the sheet this collection belongs to.
 
-        @param fX1  Position of the first X coordinate in points (1/72 inch).
-        @param fY1  Position of the first Y coordinate in points (1/72 inch).
-        @param fX2  Position of the last X coordinate in points (1/72 inch).
-        @param fY2  Position of the last Y coordinate in points (1/72 inch).
-        @param bClosed  True = outline closed (last and first point connected).
+        @param X1  Position of the first X coordinate in points (1/72 inch).
+        @param Y1  Position of the first Y coordinate in points (1/72 inch).
+        @param X2  Position of the last X coordinate in points (1/72 inch).
+        @param Y2  Position of the last Y coordinate in points (1/72 inch).
+        @param Closed  True = outline closed (last and first point connected).
 
         @return  The created polygon object.
      */

File sc/source/ui/unoobj/docuno.cxx

 
 using namespace com::sun::star;
 
+// #i111553# provides the name of the VBA constant for this document type (e.g. 'ThisExcelDoc' for Calc)
+#define SC_UNO_VBAGLOBNAME "VBAGlobalConstantName"
+
 //------------------------------------------------------------------------
 
 //	alles ohne Which-ID, Map nur fuer PropertySetInfo
         {MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC),       0, &getBooleanCppuType(),                                    0, 0},
         {MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES),    0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
         {MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES),   0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
+        {MAP_CHAR_LEN(SC_UNO_VBAGLOBNAME),       0, &getCppuType(static_cast< const rtl::OUString * >(0)),    beans::PropertyAttribute::READONLY, 0},
         {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN),       PROP_UNO_CALCASSHOWN, &getBooleanCppuType(),                                    0, 0},
         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),        0, &getCppuType((lang::Locale*)0),                           0, 0},
         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),        0, &getCppuType((lang::Locale*)0),                           0, 0},
         {
             aRet <<= pDocShell->GetDialogContainer();
         }
+        else if ( aString.EqualsAscii( SC_UNO_VBAGLOBNAME ) )
+        {
+            /*  #i111553# This property provides the name of the constant that
+                will be used to store this model in the global Basic manager.
+                That constant will be equivelant to 'ThisComponent' but for
+                each application, so e.g. a 'ThisExcelDoc' and a 'ThisWordDoc'
+                constant can co-exist, as required by VBA. */
+            aRet <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisExcelDoc" ) );
+        }
         else if ( aString.EqualsAscii( SC_UNO_RUNTIMEUID ) )
         {
             aRet <<= getRuntimeUID();

File sc/source/ui/vba/vbaapplication.cxx

 
 uno::Any sbxToUnoValue( SbxVariable* pVar );
 
-class ActiveWorkbook : public ScVbaWorkbook
-{
-protected:
-	virtual uno::Reference< frame::XModel > getModel()
-	{ 	
-		return getCurrentExcelDoc(mxContext); 
-	}
-public:
-	ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook(  xParent, xContext ){}
-};
-
 // ============================================================================
 
 /** Global application settings shared by all open workbooks. */
 {
     uno::Reference< excel::XWorkbook > xWrkbk;
     ScDocShell* pShell = excel::getDocShell( getCurrentExcelDoc( mxContext ) );
-    if ( pShell )
-    {
-        String aName;
-        if ( pShell->GetDocument() )
-        {
-            aName = pShell->GetDocument()->GetCodeName();
-            xWrkbk.set( getUnoDocModule(  aName, pShell ), uno::UNO_QUERY );
-            // fallback ( e.g. it's possible a new document was created via the api )
-            // in that case the document will not have the appropriate Document Modules
-            // #TODO #FIXME ( needs to be fixes as part of providing support for an overall document 
-            // vba mode etc. )
-            if ( !xWrkbk.is() )
-                return new ActiveWorkbook( this, mxContext );
-        }
-    }
-    return xWrkbk; 
+    if ( !pShell )
+        throw uno::RuntimeException();
+
+    String aName = pShell->GetDocument()->GetCodeName();
+    // will throw if active document is not in VBA compatibility mode (no object for codename)
+    return uno::Reference< excel::XWorkbook >( getUnoDocModule( aName, pShell ), uno::UNO_QUERY_THROW );
 }
 
 uno::Reference< excel::XWorkbook > SAL_CALL 
 ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException)
 {
-    uno::Reference< excel::XWorkbook > xWrkbk;
     ScDocShell* pShell = excel::getDocShell( getThisExcelDoc( mxContext ) );
-    if ( pShell )
-    {
-        String aName;
-        if ( pShell->GetDocument() )
-        {
-            aName = pShell->GetDocument()->GetCodeName();
-            xWrkbk.set( getUnoDocModule( aName, pShell ), uno::UNO_QUERY );
-            // fallback ( e.g. it's possible a new document was created via the api )
-            // in that case the document will not have the appropriate Document Modules
-            // #TODO #FIXME ( needs to be fixes as part of providing support for an overall document 
-            // vba mode etc. )
-            if ( !xWrkbk.is() )
-                return new ActiveWorkbook( this, mxContext );
-        }
-    }
-    return xWrkbk;
+    if ( !pShell )
+        throw uno::RuntimeException();
+
+    String aName = pShell->GetDocument()->GetCodeName();
+    // should never throw as this model is in VBA compatibility mode
+    return uno::Reference< excel::XWorkbook >( getUnoDocModule( aName, pShell ), uno::UNO_QUERY_THROW );
 }
 
 uno::Reference< XAssistant > SAL_CALL
 uno::Any SAL_CALL
 ScVbaApplication::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
 {
-    uno::Reference< excel::XWorkbook > xWorkbook( getActiveWorkbook(), uno::UNO_QUERY );
-        uno::Any result;
-    if ( xWorkbook.is() )
-        result  = xWorkbook->Worksheets( aIndex );
-
-    else
-        // Fixme - check if this is reasonable/desired behavior
-        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-            "No ActiveWorkBook available" ), uno::Reference< uno::XInterface >() );
-
-	return result;
+    uno::Reference< excel::XWorkbook > xWorkbook( getActiveWorkbook(), uno::UNO_SET_THROW );
+    return xWorkbook->Worksheets( aIndex );
 }
 
 uno::Any SAL_CALL

File sc/source/ui/vba/vbaformat.cxx

 {
 	try
 	{
-		mxServiceInfo.set( mxPropertySet, uno::UNO_QUERY_THROW );
 		if ( !mxModel.is() )
 			DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XModel Interface could not be retrieved") ) );
-		mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW ); 
+        // mxServiceInfo is unused,
+        // mxNumberFormatsSupplier is initialized when needed in initializeNumberFormats.
 	}
 	catch (uno::Exception& )
 	{

File sc/source/ui/vba/vbaformat.hxx

 	css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
 	css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
 	css::uno::Reference< css::frame::XModel > mxModel;
-	css::uno::Reference< css::lang::XServiceInfo > mxServiceInfo;
 	css::uno::Reference< css::beans::XPropertyState > xPropertyState;
 	sal_Bool mbCheckAmbiguoity;
 	sal_Bool mbAddIndent;
 	ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( css::script::BasicErrorException );
 	virtual ~ScVbaFormat() {}
 	virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0; 
-	css::uno::Reference< css::lang::XServiceInfo > getXServiceInfo() { return mxServiceInfo; }
 	 void SAL_CALL setAddIndent( const css::uno::Any& _BAddIndent) throw( css::uno::RuntimeException ) { _BAddIndent >>= mbAddIndent; }
 	 css::uno::Any SAL_CALL getAddIndent() throw( css::uno::RuntimeException ) { return css::uno::makeAny( mbAddIndent ); }
     	// Interface Methods

File sc/source/ui/vba/vbarange.cxx

 getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
 {
 	// need the ScCellRangesBase to get docshell
-	uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
+    uno::Reference< uno::XInterface > xIf( xRange );
 	return getDocShellFromIf(xIf );
 }
 
 getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
 {
 	// need the ScCellRangesBase to get docshell
-	uno::Reference< uno::XInterface > xIf( xRanges, uno::UNO_QUERY_THROW );
+    uno::Reference< uno::XInterface > xIf( xRanges );
 	return getDocShellFromIf(xIf );
 }
 
 
 uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
 {
-	uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
+    // the XInterface for getImplementation can be any derived interface, no need for queryInterface
+    uno::Reference< uno::XInterface > xIf( xRange );
 	return getModelFromXIf( xIf );
 }
 
 void
 ScVbaRange::visitArray( ArrayVisitor& visitor )
 {
-	uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW );
-	sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
-	sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
+    table::CellRangeAddress aRangeAddr = lclGetRangeAddress( mxRange );
+    sal_Int32 nRowCount = aRangeAddr.EndRow - aRangeAddr.StartRow + 1;
+    sal_Int32 nColCount = aRangeAddr.EndColumn - aRangeAddr.StartColumn + 1;
 	for ( sal_Int32 i=0; i<nRowCount; ++i )
 	{
 		for ( sal_Int32 j=0; j<nColCount; ++j )
 bool
 ScVbaRange::isSingleCellRange()
 {
-	uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY);
-	if ( xColumnRowRange.is() && xColumnRowRange->getRows()->getCount() == 1 && xColumnRowRange->getColumns()->getCount() == 1 )
-		return true;
-	return false;
+    uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxRange, uno::UNO_QUERY );
+    if ( xAddressable.is() )
+    {
+        table::CellRangeAddress aRangeAddr = xAddressable->getRangeAddress();
+        return ( aRangeAddr.EndColumn == aRangeAddr.StartColumn && aRangeAddr.EndRow == aRangeAddr.StartRow );
+    }
+    return false;
 }
 
 uno::Reference< excel::XCharacters > SAL_CALL 

File sfx2/source/doc/objxtor.cxx

 #include "precompiled_sfx2.hxx"
 
 #include "arrdecl.hxx"
+#include <map>
 
 #include <cppuhelper/implbase1.hxx>
 
 #include <com/sun/star/frame/XTitle.hpp>
 #include <vos/mutex.hxx>
 
-#ifndef _SV_RESARY_HXX
 #include <tools/resary.hxx>
-#endif
-#ifndef _MSGBOX_HXX //autogen
 #include <vcl/msgbox.hxx>
-#endif
-#ifndef _WRKWIN_HXX //autogen
 #include <vcl/wrkwin.hxx>
-#endif
 #include <vcl/svapp.hxx>
 #include <svl/eitem.hxx>
 #include <tools/rtti.hxx>
 #include <sfx2/signaturestate.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
 
-#ifndef _BASIC_SBUNO_HXX
 #include <basic/sbuno.hxx>
-#endif
 #include <svtools/sfxecode.hxx>
 #include <svtools/ehdl.hxx>
 #include <unotools/printwarningoptions.hxx>
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
 #include <comphelper/processfactory.hxx>
-#endif
 
 #include <com/sun/star/document/XStorageBasedDocument.hpp>
 #include <com/sun/star/script/DocumentDialogLibraryContainer.hpp>
 #define DocumentInfo
 #include "sfxslots.hxx"
 
+namespace {
+
 static WeakReference< XInterface > s_xCurrentComponent;
 
+// remember all registered components for VBA compatibility, to be able to remove them on disposing the model
+typedef ::std::map< XInterface*, ::rtl::OString > VBAConstantNameMap;
+static VBAConstantNameMap s_aRegisteredVBAConstants;
+
+::rtl::OString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent )
+{
+    OSL_ENSURE( rxComponent.is(), "lclGetVBAGlobalConstName - missing component" );
+
+    VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( rxComponent.get() );
+    if( aIt != s_aRegisteredVBAConstants.end() )
+        return aIt->second;
+    
+    uno::Reference< beans::XPropertySet > xProps( rxComponent, uno::UNO_QUERY );
+    if( xProps.is() ) try
+    {
+        ::rtl::OUString aConstName;
+        xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobalConstantName" ) ) ) >>= aConstName;
+        return ::rtl::OUStringToOString( aConstName, RTL_TEXTENCODING_ASCII_US );
+    }
+    catch( uno::Exception& ) // not supported
+    {
+    }
+    return ::rtl::OString();
+}
+
+} // namespace
+
 //=========================================================================
 
 
 
 void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::EventObject& _rEvent ) throw ( com::sun::star::uno::RuntimeException )
 {
+    ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
     // am I ThisComponent in AppBasic?
-    ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
     if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
-    {
+    { 
         // remove ThisComponent reference from AppBasic
         SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
     }
 
+    /*  Remove VBA component from AppBasic. As every application registers its
+        own current component, the disposed component may not be the "current
+        component" of the SfxObjectShell. */
+    if ( _rEvent.Source.is() )
+    {
+        VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( _rEvent.Source.get() );
+        if ( aIt != s_aRegisteredVBAConstants.end() )
+        {
+            if ( BasicManager* pAppMgr = SFX_APP()->GetBasicManager() )
+                pAppMgr->SetGlobalUNOConstant( aIt->second.getStr(), Any( Reference< XInterface >() ) );
+            s_aRegisteredVBAConstants.erase( aIt );
+        }
+    }
+
     if ( mpDoc->Get_Impl()->bHiddenLockedByAPI )
 	{
         mpDoc->Get_Impl()->bHiddenLockedByAPI = FALSE;
 
 void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
 {
-    Reference< XInterface > xTest(s_xCurrentComponent);
-    if ( _rxComponent == xTest )
+    Reference< XInterface > xOldCurrentComp(s_xCurrentComponent);
+    if ( _rxComponent == xOldCurrentComp )
         // nothing to do
         return;
     // note that "_rxComponent.get() == s_xCurrentComponent.get().get()" is /sufficient/, but not
     BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
     s_xCurrentComponent = _rxComponent;
     if ( pAppMgr )
-        pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
+    {
+        // set "ThisComponent" for Basic
+        pAppMgr->SetGlobalUNOConstant( "ThisComponent", Any( _rxComponent ) );
+
+        // set new current component for VBA compatibility
+        if ( _rxComponent.is() )
+        {
+            ::rtl::OString aVBAConstName = lclGetVBAGlobalConstName( _rxComponent );
+            if ( aVBAConstName.getLength() > 0 )
+            {
+                pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( _rxComponent ) );
+                s_aRegisteredVBAConstants[ _rxComponent.get() ] = aVBAConstName;
+            }
+        }
+        // no new component passed -> remove last registered VBA component
+        else if ( xOldCurrentComp.is() )
+        {
+            ::rtl::OString aVBAConstName = lclGetVBAGlobalConstName( xOldCurrentComp );
+            if ( aVBAConstName.getLength() > 0 )
+            {
+                pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( Reference< XInterface >() ) );
+                s_aRegisteredVBAConstants.erase( xOldCurrentComp.get() );
+            }
+        }
+    }
 
 #if OSL_DEBUG_LEVEL > 0
     const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void";

File vbahelper/source/vbahelper/vbacommandbar.cxx

 uno::Any SAL_CALL 
 ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
 {
-    uno::Reference< awt::XMenu > xMenu;
-    if( m_bIsMenu )
-    {
-        uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager();
-        uno::Reference< beans::XPropertySet > xPropertySet( xLayoutManager->getElement( m_sResourceUrl ), uno::UNO_QUERY_THROW );
-        xMenu.set( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("XMenuBar") ), uno::UNO_QUERY );
-    }
-    uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
+    uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
     if( aIndex.hasValue() )
     {
         return xCommandBarControls->Item( aIndex, uno::Any() );

File vbahelper/source/vbahelper/vbacommandbarcontrol.cxx

 ::sal_Bool SAL_CALL 
 ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
 {
-    /*sal_Bool bVisible = sal_True;
-    uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
+    sal_Bool bVisible = sal_True;
+    uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ) );
     if( aValue.hasValue() )
         aValue >>= bVisible;
-    return bVisible;*/
-	return getEnabled();
-
+    return bVisible;
 }
 void SAL_CALL 
 ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
 {
-    /*uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
+    uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ) );
     if( aValue.hasValue() )
     {
-        setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) );
+        setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ), uno::makeAny( _visible ) );
         ApplyChange();
-    }*/
-	setEnabled( _visible);
+    }
 }
 
 ::sal_Bool SAL_CALL 
 ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException)
 {
     sal_Bool bEnabled = sal_True;
-	rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___");
-	rtl::OUString aCommandURL ;
 
-    if( m_xParentMenu.is() )
+    uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ) );
+    if( aValue.hasValue() )
     {
-        // currently only the menu in the MenuBat support Enable/Disable
-        // FIXME: how to support the menu item in Toolbar
-        bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ) );
+        aValue >>= bEnabled;
     }
     else
     {
         // emulated with Visible
-        //bEnabled = getVisible();
-		uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") );
-		if (aValue >>= aCommandURL){
-			if (0 == aCommandURL.indexOf(aCommandURLappendix)){
-					bEnabled = sal_False;
-				}
-			}		
-
-    }    
+        bEnabled = getVisible();
+    }
     return bEnabled;
 }
 
 void SAL_CALL
 ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
 {
-	rtl::OUString aCommandURL ;
-	rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___");
-	rtl::OUStringBuffer aCommandURLSringBuffer;
-    if( m_xParentMenu.is() )
+    uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ) );
+    if( aValue.hasValue() )
     {
-        // currently only the menu in the MenuBat support Enable/Disable
-        m_xParentMenu->enableItem( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ), _enabled );
+        setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ), uno::makeAny( _enabled ) );
+        ApplyChange();
     }
     else
     {
-		uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") );
-		if (aValue >>= aCommandURL){
-			if (0 == aCommandURL.indexOf(aCommandURLappendix)){
-				aCommandURL = aCommandURL.copy(3);
-				}
-			if (false == _enabled){ 
-				aCommandURLSringBuffer = aCommandURLappendix;
-			}
-			aCommandURLSringBuffer.append(aCommandURL);
-			setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURLSringBuffer.makeStringAndClear()) );
-		    ApplyChange();
-		}
         // emulated with Visible
-        //setVisible( _enabled );
-    }    
+        setVisible( _enabled );
+    }
 }
 
 ::sal_Bool SAL_CALL
     if( !xSubMenu.is() )
         throw uno::RuntimeException();
     
-    uno::Reference< awt::XMenu > xMenu;
-    if( m_xParentMenu.is() )
-    {
-        sal_Int16 nItemId = m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) );
-        xMenu.set( m_xParentMenu->getPopupMenu( nItemId ), uno::UNO_QUERY );
-    }    
-
-    uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
+    uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
     if( aIndex.hasValue() )
     {
         return xCommandBarControls->Item( aIndex, uno::Any() );
 }
 
 //////////// ScVbaCommandBarPopup //////////////////////////////
-ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
 {
     m_nPosition = nPosition;
     m_bTemporary = bTemporary;
     m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
-    m_xParentMenu = xMenu;
 }
 
 rtl::OUString& 
 }
 
 //////////// ScVbaCommandBarButton //////////////////////////////
-ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
+ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
 {
     m_nPosition = nPosition;
     m_bTemporary = bTemporary;
     m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
-    m_xParentMenu = xMenu;
 }
 
 rtl::OUString& 

File vbahelper/source/vbahelper/vbacommandbarcontrol.hxx

 protected:
     VbaCommandBarHelperRef pCBarHelper;
     rtl::OUString       m_sResourceUrl;
-    css::uno::Reference< css::container::XIndexAccess >          m_xCurrentSettings;
-    css::uno::Reference< css::container::XIndexAccess >          m_xBarSettings;
-    css::uno::Sequence< css::beans::PropertyValue >              m_aPropertyValues;
-    css::uno::Reference< css::awt::XMenu >                        m_xParentMenu;
+    css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
+    css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
+    css::uno::Sequence< css::beans::PropertyValue >     m_aPropertyValues;
 
     sal_Int32           m_nPosition;
     sal_Bool            m_bTemporary;
 class ScVbaCommandBarPopup : public CommandBarPopup_BASE
 {
 public:
-    ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
+    ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
 
     virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
     {
 class ScVbaCommandBarButton : public CommandBarButton_BASE
 {
 public:
-    ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
+    ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
 
     virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
     {

File vbahelper/source/vbahelper/vbacommandbarcontrols.cxx

     }
 };
 
-ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl, const uno::Reference< awt::XMenu >& xMenu  ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_xMenu( xMenu )
+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl )
 {
     m_bIsMenu = sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ? sal_True : sal_False;
 }
 
-uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu )
+uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL,
+                                                                                   const rtl::OUString& sHelpURL,
+                                                                                   const rtl::OUString& sLabel,
+                                                                                   sal_uInt16 nType,
+                                                                                   const uno::Any& aSubMenu,
+                                                                                   sal_Bool isVisible,
+                                                                                   sal_Bool isEnabled )
 {
-    uno::Sequence< beans::PropertyValue > aProps(5);
+    uno::Sequence< beans::PropertyValue > aProps(7);
 
     aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL );
     aProps[0].Value <<= sCommandURL;
     aProps[3].Value <<= nType;
     aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER );
     aProps[4].Value = aSubMenu;
+    aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE );
+    aProps[5].Value <<= isVisible;
+    aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED );
+    aProps[6].Value <<= isEnabled;
 
     return aProps;
 }
     getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
     ScVbaCommandBarControl* pNewCommandBarControl = NULL;
     if( xSubMenu.is() )
-        pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
+        pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
     else
-        pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
+        pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
 
     return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
 }
     sal_uInt16 nItemType = 0;
     if( IsMenu() )
     {
-        aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu );
+        aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, true, true );
     }
     else
     {
 
     pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
 
-    // sometimes it would crash if passing m_xMenu instead of uno::Reference< awt::XMenu >() in Linux. 
     ScVbaCommandBarControl* pNewCommandBarControl = NULL;
     if( nType == office::MsoControlType::msoControlPopup )
-        pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
+        pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
     else
-        pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
+        pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
 
     return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
 }

File vbahelper/source/vbahelper/vbacommandbarcontrols.hxx

 class ScVbaCommandBarControls : public CommandBarControls_BASE
 {
 private:
-    VbaCommandBarHelperRef pCBarHelper;
-    css::uno::Reference< css::container::XIndexAccess >          m_xBarSettings;
-    rtl::OUString       m_sResourceUrl;
-    css::uno::Reference< css::awt::XMenu >                        m_xMenu;
-    sal_Bool m_bIsMenu;
+    VbaCommandBarHelperRef                              pCBarHelper;
+    css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
+    rtl::OUString                                       m_sResourceUrl;
+    sal_Bool                                            m_bIsMenu;
 
-    css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu );
+    css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL,
+                                                                        const rtl::OUString& sHelpURL,
+                                                                        const rtl::OUString& sLabel,
+                                                                        sal_uInt16 nType,
+                                                                        const css::uno::Any& aSubMenu,
+                                                                        sal_Bool isVisible,
+                                                                        sal_Bool isEnabled );
     css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle );
 
 public:
-    ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw( css::uno::RuntimeException );
+    ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw( css::uno::RuntimeException );
     sal_Bool IsMenu(){ return m_bIsMenu; }
 
     // XEnumerationAccess

File vbahelper/source/vbahelper/vbacommandbarhelper.hxx

 static const char ITEM_DESCRIPTOR_ISVISIBLE[]   = "IsVisible";
 static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
 static const char ITEM_DESCRIPTOR_UINAME[]		= "UIName";
+static const char ITEM_DESCRIPTOR_ENABLED[]     = "Enabled";
 
 static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar";
 static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/";