protected XMenuBar AddMenuBar()
        {
            // create a menubar at the global MultiComponentFactory...
            Object oMenuBar = _xMCF.createInstanceWithContext(OO.Services.VCLX_MENU_BAR, _xContext);
            // add the menu items...
            XMenuBar xMenuBar = oMenuBar as XMenuBar;

            if (xMenuBar != null)
            {
                xMenuBar.addMenuListener(_xMenuListener);
                _xWindow.setMenuBar(xMenuBar);
                return(xMenuBar);
            }
            else
            {
                //TODO: handle if the cast fails
                throw new NullPointerException("Cast to XMenuBar fails:", oMenuBar);
            }
        }