Anonymous avatar Anonymous committed 07576af Merge

CWS-TOOLING: integrate CWS menuincustomtoolbar

Comments (0)

Files changed (16)

framework/inc/uielement/generictoolbarcontroller.hxx

 
 #include <svtools/toolboxcontroller.hxx>
 #include <vcl/toolbox.hxx>
+#include <memory>
+
+class PopupMenu;
 
 namespace framework
 {
 
          DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); 
     
-    private:
+    protected:
         ToolBox*        m_pToolbar;
         sal_uInt16      m_nID;
         sal_Bool        m_bEnumCommand : 1,
         rtl::OUString   m_aEnumCommand;
 };
 
+class MenuToolbarController : public GenericToolbarController
+{
+    com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc;
+    PopupMenu* pMenu;
+    com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager;
+    rtl::OUString m_aModuleIdentifier;
+    public:
+        MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, 
+                                  const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+                                  ToolBox* pToolBar,
+                                  USHORT   nID,
+                                  const rtl::OUString& aCommand, 
+                                  const rtl::OUString& aModuleIdentifier, 
+                                  const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc );
+
+    ~MenuToolbarController();
+    // XToolbarController
+    virtual void SAL_CALL click() throw ( ::com::sun::star::uno::RuntimeException );
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+
+};
+
 }
 
 #endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_

framework/inc/uielement/toolbarmanager.hxx

 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/frame/XModuleManager.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/frame/XUIControllerRegistration.hpp>
 #include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
 #include <com/sun/star/frame/XStatusListener.hpp>
 #include <com/sun/star/frame/XSubToolbarController.hpp>
 #include <com/sun/star/frame/XToolbarController.hpp>
         typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XSubToolbarController > > SubToolBarControllerVector;
         typedef BaseHash< SubToolBarControllerVector >                                                              SubToolBarToSubToolBarControllerMap;
 
+        typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > > MenuDescriptionMap;
         sal_Bool                                                                               m_bDisposed : 1,
                                                                                                m_bIsHiContrast : 1,
                                                                                                m_bSmallSymbols : 1,
         ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager >                m_xModuleImageManager;
         ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager >                m_xDocImageManager;
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >                 m_xImageOrientationListener;
+        ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >                m_xUICfgMgr;
+        ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >                m_xDocUICfgMgr;
+
         CommandToInfoMap                                                                       m_aCommandMap;
         SubToolBarToSubToolBarControllerMap                                                    m_aSubToolBarControllerMap;
         Timer				                                                                   m_aAsyncUpdateControllersTimer;
         sal_Int16                                                                              m_nSymbolsStyle;
+        MenuDescriptionMap m_aMenuMap;
 };
     
 }

framework/inc/xml/menuconfiguration.hxx

 			::rtl::OUString aTargetFrame;
 			::rtl::OUString	aImageId;
             ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
+                        sal_Int16 nStyle;
 		};
 						
 		MenuConfiguration(

framework/inc/xml/menudocumenthandler.hxx

 		::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> m_xReader;
 		void initPropertyCommon( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rProps,
 								 const rtl::OUString &rCommandURL, const rtl::OUString &rHelpId,
-								 const rtl::OUString &rLabel);
+                                 const rtl::OUString &rLabel, sal_Int16 nItemStyleBits );
 	private:
 		rtl::OUString m_aType;
 		rtl::OUString m_aLabel;
 		rtl::OUString m_aContainer;
 		rtl::OUString m_aHelpURL;
 		rtl::OUString m_aCommandURL;
+        rtl::OUString m_aStyle;
 		::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aItemProp;
 };
 
 		virtual void WriteMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rSubMenuContainer ) throw
 			( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
 
-        virtual void WriteMenuItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL );
+        virtual void WriteMenuItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, sal_Int16 nStyle = 0 );
 		virtual void WriteMenuSeparator();
 
         com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xMenuBarContainer;

framework/inc/xml/toolboxconfigurationdefines.hxx

 #define ATTRIBUTE_WIDTH				"width"
 #define ATTRIBUTE_USER				"userdefined"
 #define ATTRIBUTE_HELPID			"helpid"
+#define ATTRIBUTE_TOOLTIP			"tooltip"
 #define ATTRIBUTE_ITEMSTYLE			"style"
 
 #define ATTRIBUTE_ID				"id"
 #define ATTRIBUTE_ITEMSTYLE_AUTOSIZE	    "autosize"
 #define ATTRIBUTE_ITEMSTYLE_DROPDOWN	    "dropdown"
 #define ATTRIBUTE_ITEMSTYLE_REPEAT		    "repeat"
+#define ATTRIBUTE_ITEMSTYLE_TEXT    "text"
 #define ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY    "dropdownonly"
+#define ATTRIBUTE_ITEMSTYLE_IMAGE    "image"
 
 #endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATIONDEFINES_HXX_

framework/inc/xml/toolboxdocumenthandler.hxx

 			TB_ATTRIBUTE_HELPID,
 			TB_ATTRIBUTE_STYLE,
             TB_ATTRIBUTE_UINAME,
+            TB_ATTRIBUTE_TOOLTIP,
 			TB_XML_ENTRY_COUNT
 		};
 
 		sal_Int32																	    m_nHashCode_Style_DropDown;
 		sal_Int32																	    m_nHashCode_Style_Repeat;
         sal_Int32                                                                       m_nHashCode_Style_DropDownOnly;
+        sal_Int32                                                                       m_nHashCode_Style_Text;
+        sal_Int32                                                                       m_nHashCode_Style_Image;
 		rtl::OUString                                                                   m_aType;
 		rtl::OUString                                                                   m_aLabel;
 		rtl::OUString                                                                   m_aStyle;
 		rtl::OUString                                                                   m_aHelpURL;
+        rtl::OUString                                                                   m_aTooltip;
 		rtl::OUString                                                                   m_aIsVisible;
 		rtl::OUString                                                                   m_aCommandURL;
 };
 			  ::com::sun::star::uno::RuntimeException );
 	
 	protected:
-        virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL,
+        virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, const rtl::OUString& aTooltip, sal_Int16 nStyle,
                                        sal_Int16 nWidth, sal_Bool bVisible ) throw
 			( ::com::sun::star::xml::sax::SAXException,
 			  ::com::sun::star::uno::RuntimeException );

framework/source/classes/menumanager.cxx

 	for ( USHORT i = 0; i < nItemCount; i++ )
 	{
 		USHORT nItemId = FillItemCommand(aItemCommand,pMenu, i );
+        bool bShowMenuImages( m_bShowMenuImages );
+        MenuItemBits nBits =  pMenu->GetItemBits( nItemId );
+        // overwrite the default?
+        if ( nBits )
+            bShowMenuImages = ( ( nBits & MIB_ICON ) == MIB_ICON );
+
 
 		PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId );
 		if ( pPopupMenu )
 						    aQueryLabelItemIdVector.push_back( nItemId );
 #endif
 					    // Set image for the addon popup menu item
-					    if ( m_bShowMenuImages && !pPopupMenu->GetItemImage( ITEMID_ADDONLIST ))
+                        if ( bShowMenuImages && !pPopupMenu->GetItemImage( ITEMID_ADDONLIST ))
 					    {
 						    Image aImage = GetImageFromURL( rFrame, aItemCommand, FALSE, m_bWasHiContrast );
                 		    if ( !!aImage )
 				if ( pMenu->GetItemText( nItemId ).Len() == 0 )
 					aQueryLabelItemIdVector.push_back( nItemId );
 #endif
-
-				if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
+				
+                if ( bShowMenuImages && !pMenu->GetItemImage( nItemId ))
 				{
 					Image aImage = GetImageFromURL( rFrame, aItemCommand, FALSE, m_bWasHiContrast );
                 	if ( !!aImage )
 				if ( pMenu->GetItemText( nItemId ).Len() == 0 )
 					aQueryLabelItemIdVector.push_back( nItemId );
 #endif
-
-				if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
+				
+                if ( bShowMenuImages && !pMenu->GetItemImage( nItemId ))
 				{
 					Image aImage = GetImageFromURL( rFrame, aItemCommand, FALSE, m_bWasHiContrast );
                 	if ( !!aImage )
 			}
 			else if ( pMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
 			{
-			    if ( m_bShowMenuImages )
+                if ( bShowMenuImages )
 			    {
 			        if ( AddonMenuManager::IsAddonMenuId( nItemId ))
 			        {
 		USHORT nId = _pMenu->GetItemId( nPos );
 		if ( _pMenu->GetItemType( nPos ) != MENUITEM_SEPARATOR )
 		{
-			if ( bShowMenuImages )
+            bool bTmpShowMenuImages( bShowMenuImages );
+            MenuItemBits nBits =  _pMenu->GetItemBits( nId );
+            // overwrite the default?
+            if ( nBits )
+                bTmpShowMenuImages = ( ( nBits & MIB_ICON ) == MIB_ICON );
+
+            if ( bTmpShowMenuImages )
 			{
 				sal_Bool		bImageSet = sal_False;
 				::rtl::OUString aImageId;

framework/source/uielement/generictoolbarcontroller.cxx

 #include <classes/fwkresid.hxx>
 #include <dispatch/uieventloghelper.hxx>
 
+#include <xml/menuconfiguration.hxx>
+#include <uielement/menubarmanager.hxx>
+
 using namespace ::com::sun::star::awt;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::frame::status;
 using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
 
 namespace framework
 {
    return 0;
 }
 
+MenuToolbarController::MenuToolbarController( const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& rFrame, ToolBox* pToolBar, USHORT   nID, const rtl::OUString& aCommand, const rtl::OUString& aModuleIdentifier, const Reference< XIndexAccess >& xMenuDesc ) : GenericToolbarController( rServiceManager, rFrame, pToolBar, nID, aCommand ), m_xMenuDesc( xMenuDesc ), pMenu( NULL ), m_aModuleIdentifier( aModuleIdentifier )
+{
+}
+
+MenuToolbarController::~MenuToolbarController()
+{
+    try
+    {
+        if ( m_xMenuManager.is() )
+            m_xMenuManager->dispose();
+    }
+    catch( Exception& ) {}
+    if ( pMenu )
+    {
+        delete pMenu;
+        pMenu = NULL;
+    }
+ 
+}
+
+class Toolbarmenu : public PopupMenu
+{
+    public:
+    Toolbarmenu();
+    ~Toolbarmenu();
+};
+
+Toolbarmenu::Toolbarmenu()
+{
+    OSL_TRACE("**** contstructing Toolbarmenu 0x%x", this );
+}
+
+Toolbarmenu::~Toolbarmenu()
+{
+    OSL_TRACE("**** destructing Toolbarmenu 0x%x", this );
+}
+
+void SAL_CALL MenuToolbarController::click() throw (RuntimeException)
+{
+    createPopupWindow();
+}
+
+Reference< XWindow > SAL_CALL 
+MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::RuntimeException)
+{
+    if ( !pMenu ) 
+    {
+        Reference< XDispatchProvider > xDispatch;
+        Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
+        pMenu = new Toolbarmenu();
+        m_xMenuManager.set( new MenuBarManager( m_xServiceManager, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, sal_True, sal_True ) );
+        if ( m_xMenuManager.is() )
+        {
+            MenuBarManager* pMgr = dynamic_cast< MenuBarManager* >( m_xMenuManager.get() );
+            pMgr->SetItemContainer( m_xMenuDesc );
+        }
+    }
+
+    ::Rectangle aRect( m_pToolbar->GetItemRect( m_nID ) );
+    pMenu->Execute( m_pToolbar, aRect, POPUPMENU_EXECUTE_DOWN );
+    return NULL; 
+}
 } // namespace
 

framework/source/uielement/menubarmanager.cxx

 #include <com/sun/star/frame/XModuleManager.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/ItemStyle.hpp>
 #include <com/sun/star/frame/status/Visibility.hpp>
 
 //_________________________________________________________________________________________________________________
 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";
 
 const sal_Int32   LEN_DESCRIPTOR_COMMANDURL           = 10;
 const sal_Int32   LEN_DESCRIPTOR_HELPURL              = 7;
 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;
 
 const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500;
 
         Reference< XDispatch > xDispatch;
 		Reference< XStatusListener > xStatusListener;
 		PopupMenu* pPopup = pMenu->GetPopupMenu( nItemId );
+        bool bItemShowMenuImages = m_bShowMenuImages;
+        MenuItemBits nBits =  pMenu->GetItemBits( nItemId );
+        // overwrite the show icons on menu option?
+        if ( nBits )
+            bItemShowMenuImages = ( ( nBits & MIB_ICON ) == MIB_ICON );
 		if ( pPopup )
 		{
             // Retrieve module identifier from Help Command entry
                         pSubMenuManager->m_aMenuItemCommand = ::rtl::OUString();
 
 			            // Set image for the addon popup menu item
-			            if ( m_bShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
+			            if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
 			            {
                             Reference< XFrame > xTemp( rFrame );
                             Image aImage = GetImageFromURL( xTemp, aItemCommand, FALSE, m_bWasHiContrast );
 		}
         else if ( pMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
 		{
-			if ( m_bShowMenuImages )
+            if ( bItemShowMenuImages )
 			{
 			    if ( AddonMenuManager::IsAddonMenuId( nItemId ))
 			    {
         sal_uInt16                      nType = 0;
         Reference< XIndexAccess >       xIndexContainer;
         Reference< XDispatchProvider >  xDispatchProvider( rDispatchProvider );
-
+        sal_Int16 nStyle = 0;
         try
         {
             if ( rItemContainer->getByIndex( n ) >>= aProp )
                     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 ))
+                        aProp[i].Value >>= nStyle;
                 }
 
                 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::ICON )
+                           nBits |= MIB_ICON;
+                        if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT )
+                           nBits |= MIB_TEXT;
+                        pMenu->SetItemBits( nId, nBits );
+                    } 
                     if ( xIndexContainer.is() )
                     {
                         PopupMenu* pNewPopupMenu = new PopupMenu;

framework/source/uielement/toolbarmanager.cxx

 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/frame/XModuleManager.hpp>
 #include <com/sun/star/ui/XUIElementSettings.hpp>
-#include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 
 static const char   ITEM_DESCRIPTOR_COMMANDURL[]    = "CommandURL";
 static const char   ITEM_DESCRIPTOR_HELPURL[]       = "HelpURL";
+static const char   ITEM_DESCRIPTOR_TOOLTIP[]       = "Tooltip";
 static const char   ITEM_DESCRIPTOR_CONTAINER[]     = "ItemDescriptorContainer";
 static const char   ITEM_DESCRIPTOR_LABEL[]         = "Label";
 static const char   ITEM_DESCRIPTOR_TYPE[]          = "Type";
 
 static const sal_Int32 ITEM_DESCRIPTOR_COMMANDURL_LEN  = 10;
 static const sal_Int32 ITEM_DESCRIPTOR_HELPURL_LEN     = 7;
+static const sal_Int32 ITEM_DESCRIPTOR_TOOLTIP_LEN     = 7;
 static const sal_Int32 ITEM_DESCRIPTOR_CONTAINER_LEN   = 23;
 static const sal_Int32 ITEM_DESCRIPTOR_LABEL_LEN       = 5;
 static const sal_Int32 ITEM_DESCRIPTOR_TYPE_LEN        = 4;
 //static sal_Int32    HELPID_PREFIX_LENGTH            = 7;
 static const USHORT STARTID_CUSTOMIZE_POPUPMENU     = 1000;
 
+#define MENUPREFIX "private:resource/menubar/"
 
 class ImageOrientationListener : public svt::FrameStatusListener
 {
                 }
                 else
                 {
+                    MenuDescriptionMap::iterator it = m_aMenuMap.find( nId );
+                    if ( it == m_aMenuMap.end() )
                     xController = Reference< XStatusListener >(
                         new GenericToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL ));
+                    else
+                        xController = Reference< XStatusListener >(
+                            new MenuToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL, m_aModuleIdentifier, m_aMenuMap[ nId ] ));
                 }
             }
             else if ( pController )
         nItemBits |= TIB_REPEAT;
     if ( nStyle & ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY )
         nItemBits |= TIB_DROPDOWNONLY;
+    if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT )
+        nItemBits |= TIB_TEXT_ONLY;
+    if ( nStyle & ::com::sun::star::ui::ItemStyle::ICON )
+        nItemBits |= TIB_ICON_ONLY;
 
     return nItemBits;
 }
             Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
             if ( xSupplier.is() )
             {
-                Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY );
-                m_xDocImageManager = Reference< XImageManager >( xDocUICfgMgr->getImageManager(), UNO_QUERY );
+                m_xDocUICfgMgr.set( xSupplier->getUIConfigurationManager(), UNO_QUERY );
+                m_xDocImageManager = Reference< XImageManager >( m_xDocUICfgMgr->getImageManager(), UNO_QUERY );
                 m_xDocImageManager->addConfigurationListener(
                                         Reference< XUIConfigurationListener >(
                                             static_cast< OWeakObject* >( this ), UNO_QUERY ));
         Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( m_xServiceManager->createInstance(
                                                                                     SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ),
                                                                                   UNO_QUERY );
-        Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
-        m_xModuleImageManager = Reference< XImageManager >( xUICfgMgr->getImageManager(), UNO_QUERY );
+        m_xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
+        m_xModuleImageManager = Reference< XImageManager >( m_xUICfgMgr->getImageManager(), UNO_QUERY );
         m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >(
                                                             static_cast< OWeakObject* >( this ), UNO_QUERY ));
     }
     m_aControllerMap.clear();
     m_aCommandMap.clear();
 
+    m_aMenuMap.clear();
+
     CommandInfo aCmdInfo;
     for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
     {
         rtl::OUString               aCommandURL;
         rtl::OUString               aLabel;
         rtl::OUString               aHelpURL;
+        rtl::OUString               aTooltip;
         sal_uInt16                  nType( ::com::sun::star::ui::ItemType::DEFAULT );
         sal_uInt16                  nWidth( 0 );
         sal_Bool                    bIsVisible( sal_True );
         sal_uInt32                  nStyle( 0 );
 
+        Reference< XIndexAccess >   aMenuDesc;
         try
         {
             if ( rItemContainer->getByIndex( n ) >>= aProp )
                 for ( int i = 0; i < aProp.getLength(); i++ )
                 {
                     if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, ITEM_DESCRIPTOR_COMMANDURL_LEN ))
+                    {
                         aProp[i].Value >>= aCommandURL;
+                        if ( aCommandURL.compareToAscii(MENUPREFIX, RTL_CONSTASCII_LENGTH(MENUPREFIX) ) == 0  )
+                        {
+                            try
+                            {
+                                Reference< XIndexAccess > xMenuContainer;
+                                if ( m_xDocUICfgMgr.is() )
+                                    xMenuContainer  = m_xDocUICfgMgr->getSettings( aCommandURL, sal_False );
+                                if ( !xMenuContainer.is() && m_xUICfgMgr.is() )
+                                    xMenuContainer = m_xUICfgMgr->getSettings( aCommandURL, sal_False );
+                                if ( xMenuContainer.is() && xMenuContainer->getCount() )
+                                {
+                                    Sequence< PropertyValue > aProps; 
+                                    // drop down menu info is currently
+                                    // the first ( and only ) menu
+                                    // in the menusettings container
+                                    xMenuContainer->getByIndex(0) >>= aProps;
+                                    for ( sal_Int32 index=0; index<aProps.getLength(); ++index )
+                                    {
+                                        if ( aProps[ index ].Name.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, ITEM_DESCRIPTOR_CONTAINER_LEN ))
+ 
+                                        {
+                                            aProps[ index ].Value >>= aMenuDesc;
+                                            break;
+                                        }
+                                    }
+                                }
+                            }
+                            catch( Exception& )
+                            {
+                            }
+                        }
+                    }
                     else if (  aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, ITEM_DESCRIPTOR_HELPURL_LEN ))
                         aProp[i].Value >>= aHelpURL;
+                    else if (  aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_TOOLTIP, ITEM_DESCRIPTOR_TOOLTIP_LEN ))
+                        aProp[i].Value >>= aTooltip;
                     else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, ITEM_DESCRIPTOR_LABEL_LEN ))
                         aProp[i].Value >>= aLabel;
                     else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, ITEM_DESCRIPTOR_TYPE_LEN ))
                     ::rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL ));
 
                     sal_uInt16 nItemBits = ConvertStyleToToolboxItemBits( nStyle );
+                    if ( aMenuDesc.is() )
+                        m_aMenuMap[ nId ] = aMenuDesc;
                     m_pToolBar->InsertItem( nId, aString, nItemBits );
                     m_pToolBar->SetItemCommand( nId, aCommandURL );
+                    if ( aTooltip.getLength() )
+                        m_pToolBar->SetQuickHelpText( nId, aTooltip );
+                    else
                     m_pToolBar->SetQuickHelpText( nId, aString );
                     if ( aLabel.getLength() > 0 )
                         m_pToolBar->SetItemText( nId, aLabel );

framework/source/xml/menudocumenthandler.cxx

 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
 #include <com/sun/star/ui/ItemType.hpp>
+#include <com/sun/star/ui/ItemStyle.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
 #define ATTRIBUTE_LABEL			    "http://openoffice.org/2001/menu^label"
 #define ATTRIBUTE_HELPID		    "http://openoffice.org/2001/menu^helpid"
 #define ATTRIBUTE_LINEBREAK		    "http://openoffice.org/2001/menu^linebreak"
+#define ATTRIBUTE_STYLE		    "http://openoffice.org/2001/menu^style"
 
 #define ATTRIBUTE_NS_ID			    "menu:id"
 #define ATTRIBUTE_NS_LABEL		    "menu:label"
 #define ATTRIBUTE_NS_HELPID		    "menu:helpid"
 #define ATTRIBUTE_NS_LINEBREAK	    "menu:linebreak"
+#define ATTRIBUTE_NS_STYLE		    "menu:style"
 
 #define ATTRIBUTE_XMLNS_MENU	    "xmlns:menu"
 
 
 #define MENUBAR_DOCTYPE			    "<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">"
 
+#define ATTRIBUTE_ITEMSTYLE_TEXT    "text"
+#define ATTRIBUTE_ITEMSTYLE_IMAGE    "image"
+
 // Property names of a menu/menu item ItemDescriptor
 static const char ITEM_DESCRIPTOR_COMMANDURL[]  = "CommandURL";
 static const char ITEM_DESCRIPTOR_HELPURL[]     = "HelpURL";
 static const char ITEM_DESCRIPTOR_CONTAINER[]   = "ItemDescriptorContainer";
 static const char ITEM_DESCRIPTOR_LABEL[]       = "Label";
 static const char ITEM_DESCRIPTOR_TYPE[]        = "Type";
+static const char ITEM_DESCRIPTOR_STYLE[]       = "Style";
 
 // special popup menus (filled during runtime) must be saved as an empty popup menu or menuitem!!!
 static const sal_Int32 CMD_PROTOCOL_SIZE        = 5;
 namespace framework
 {
 
+struct MenuStyleItem
+{
+    sal_Int16 nBit;
+    const char* attrName;
+};
+
+MenuStyleItem MenuItemStyles[ ] = {
+    { ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE },
+    { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
+};
+
+
+sal_Int32 nMenuStyleItemEntries = sizeof( MenuItemStyles ) / sizeof( MenuItemStyles[ 0 ] );
+
 static void ExtractMenuParameters( const Sequence< PropertyValue > rProp,
                                    ::rtl::OUString&                       rCommandURL,
                                    ::rtl::OUString&                       rLabel,
                                    ::rtl::OUString&                       rHelpURL,
                                    Reference< XIndexAccess >&      rSubMenu,
-                                   sal_Int16&                      rType )
+                                   sal_Int16&                      rType,
+                                   sal_Int16&                      rStyle )
 {
     for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
     {
         {
             rProp[i].Value >>= rType;
         }
+        else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+        {
+            rProp[i].Value >>= rStyle;
+        }
     }
 }
 
 	m_aLabel( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )),
 	m_aContainer( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )),
 	m_aHelpURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )),
-	m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ))
+    m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL )),
+    m_aStyle( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE ))
 {
 }
 
 
 void ReadMenuDocumentHandlerBase::initPropertyCommon(
 	Sequence< PropertyValue > &rProps, const rtl::OUString &rCommandURL,
-	const rtl::OUString &rHelpId, const rtl::OUString &rLabel)
+    const rtl::OUString &rHelpId, const rtl::OUString &rLabel, sal_Int16 nItemStyleBits )
 {
 	rProps[0].Name = m_aCommandURL;
 	rProps[1].Name = m_aHelpURL;
 	rProps[2].Name = m_aContainer;
 	rProps[3].Name = m_aLabel;
-	rProps[4].Name = m_aType;
+    rProps[4].Name = m_aStyle;
+    rProps[5].Name = m_aType;
 
 	// Common values
 	rProps[0].Value <<= rCommandURL.intern();
 	rProps[1].Value <<= rHelpId;
 	rProps[2].Value <<= Reference< XIndexContainer >();
 	rProps[3].Value <<= rLabel;
-	rProps[4].Value <<= ::com::sun::star::ui::ItemType::DEFAULT;
+    rProps[4].Value <<= nItemStyleBits;
+    rProps[5].Value <<= ::com::sun::star::ui::ItemType::DEFAULT;
 }
 
 // -----------------------------------------------------------------------------
 		::rtl::OUString aHelpId;
 		::rtl::OUString aCommandId;
 		::rtl::OUString aLabel;
+        sal_Int16 nItemBits(0);
 
 		m_bMenuMode = sal_True;
 
 				    aLabel = aValue;
 			    else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
 				    aHelpId = aValue;
+                else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+                {
+                    ::rtl::OUString aTemp( aValue );
+                    sal_Int32 nIndex = 0;
+                    do
+                    {
+                        ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+                        if ( aToken.getLength() > 0 )
+                        {
+                            if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+                                nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+                            if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+                                nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+                        }
+                    }
+                    while ( nIndex >= 0 );                    
+                }
 		    }
 
 		    if ( aCommandId.getLength() > 0 )
 		    {
-                Sequence< PropertyValue > aSubMenuProp( 5 );
-				initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel );
+                Sequence< PropertyValue > aSubMenuProp( 6 );
+                initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
 				aSubMenuProp[2].Value <<= xSubItemContainer;
 
                 m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), makeAny( aSubMenuProp ) );
 		::rtl::OUString aHelpId;
 		::rtl::OUString aCommandId;
 		::rtl::OUString aLabel;
+        sal_Int16 nItemBits(0);
 
 		m_bMenuMode = sal_True;
 
 				aLabel = aValue;
 			else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
 				aHelpId = aValue;
+            else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+            {
+                ::rtl::OUString aTemp( aValue );
+                sal_Int32 nIndex = 0;
+                do
+                {
+                    ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+                    if ( aToken.getLength() > 0 )
+                    {
+                        if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+                            nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+                        if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+                            nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+                    }
+                }
+                while ( nIndex >= 0 );                    
+            }
+
 		}
 
 		if ( aCommandId.getLength() > 0 )
 		{
-            Sequence< PropertyValue > aSubMenuProp( 5 );
-			initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel );
+            Sequence< PropertyValue > aSubMenuProp( 6 );
+            initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
 			aSubMenuProp[2].Value <<= xSubItemContainer;
 
             m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aSubMenuProp ) );
 		::rtl::OUString aHelpId;
 		::rtl::OUString aCommandId;
 		::rtl::OUString aLabel;
-
+        sal_Int16 nItemBits(0);
 		// read attributes for menu item
 		for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ )
 		{
 				aLabel = aValue;
 			else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
 				aHelpId = aValue;
+            else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+            {
+                ::rtl::OUString aTemp( aValue );
+                sal_Int32 nIndex = 0;
+                do
+                {
+                    ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+                    if ( aToken.getLength() > 0 )
+                    {
+                        if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+                            nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+                        if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+                            nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+                    }
+                }
+                while ( nIndex >= 0 );                    
+            }
+
 		}
 
 		if ( aCommandId.getLength() > 0 )
 		{
-            Sequence< PropertyValue > aMenuItem( 5 );
-			initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel );
+            Sequence< PropertyValue > aMenuItem( 6 );
+            initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel, nItemBits );
 			aMenuItem[2].Value <<= Reference< XIndexContainer >();
 
             m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuItem ) );
             ::rtl::OUString    aLabel;
             ::rtl::OUString    aHelpURL;
             sal_Int16   nType( ::com::sun::star::ui::ItemType::DEFAULT );
+            sal_Int16   nItemBits( 0 );
             Reference< XIndexAccess > xSubMenu;
 
-            ExtractMenuParameters( aProps, aCommandURL, aLabel, aHelpURL, xSubMenu, nType );
+            ExtractMenuParameters( aProps, aCommandURL, aLabel, aHelpURL, xSubMenu, nType, nItemBits );
             if ( xSubMenu.is() )
 		    {
                 if ( aCommandURL.equalsAscii( ADDDIRECT_CMD ) ||
                     aCommandURL.equalsAscii( AUTOPILOTMENU_CMD ))
                 {
-                    WriteMenuItem( aCommandURL, aLabel, aHelpURL );
+                    WriteMenuItem( aCommandURL, aLabel, aHelpURL, nItemBits );
                     bSeparator = sal_False;
                 }
 			    else if (( aCommandURL.getLength() > 0 ) && !AddonPopupMenu::IsCommandURLPrefix ( aCommandURL ))
                     if ( aCommandURL.getLength() > 0 )
                     {
                         bSeparator = FALSE;
-                        WriteMenuItem( aCommandURL, aLabel, aHelpURL );
+                        WriteMenuItem( aCommandURL, aLabel, aHelpURL, nItemBits );
                     }
 			    }
 			    else if ( !bSeparator )
 }
 
 
-void OWriteMenuDocumentHandler::WriteMenuItem( const ::rtl::OUString& aCommandURL, const ::rtl::OUString& aLabel, const ::rtl::OUString& aHelpURL)
+void OWriteMenuDocumentHandler::WriteMenuItem( const ::rtl::OUString& aCommandURL, const ::rtl::OUString& aLabel, const ::rtl::OUString& aHelpURL, sal_Int16 nStyle )
 {
 	::comphelper::AttributeList* pList = new ::comphelper::AttributeList;
 	Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY );
 							    m_aAttributeType,
 							    aLabel );
     }
+    if (( nStyle > 0 ) && !( aCommandURL.copy( CMD_PROTOCOL_SIZE ).equalsAscii( CMD_PROTOCOL )))
+    {
+        rtl::OUString aValue;
+        MenuStyleItem* pStyle = MenuItemStyles;
+
+        for ( sal_Int32 nIndex = 0; nIndex < nMenuStyleItemEntries; ++nIndex, ++pStyle )
+        {
+            if ( nStyle & pStyle->nBit )
+            {
+                if ( aValue.getLength() )
+                    aValue = aValue.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("+") ) );
+                aValue += rtl::OUString::createFromAscii( pStyle->attrName );
+            }
+        }
+        pList->AddAttribute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_STYLE )),
+                                m_aAttributeType,
+                                aValue );
+    }
 
 	m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() );
 	m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUITEM )), xList );

framework/source/xml/toolboxdocumenthandler.cxx

 // Property names of a menu/menu item ItemDescriptor
 static const char ITEM_DESCRIPTOR_COMMANDURL[]  = "CommandURL";
 static const char ITEM_DESCRIPTOR_HELPURL[]     = "HelpURL";
+static const char ITEM_DESCRIPTOR_TOOLTIP[]     = "Tooltip";
 static const char ITEM_DESCRIPTOR_LABEL[]       = "Label";
 static const char ITEM_DESCRIPTOR_TYPE[]        = "Type";
 static const char ITEM_DESCRIPTOR_STYLE[]       = "Style";
                                       ::rtl::OUString&                       rCommandURL,
                                       ::rtl::OUString&                       rLabel,
                                       ::rtl::OUString&                       rHelpURL,
+                                      ::rtl::OUString&                       rTooltip,
+                                      sal_Int16&                      rStyle,
                                       sal_Int16&                      rWidth,
                                       sal_Bool&                       rVisible,
                                       sal_Int16&                      rType )
         }
         else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
             rProp[i].Value >>= rHelpURL;
+        else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TOOLTIP ))
+            rProp[i].Value >>= rTooltip;
         else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
             rProp[i].Value >>= rLabel;
         else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
             rProp[i].Value >>= rVisible;
         else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH ))
             rProp[i].Value >>= rWidth;
+        else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+            rProp[i].Value >>= rStyle;
     }
 }
 
+struct ToolboxStyleItem
+{
+    sal_Int16 nBit;
+    const char* attrName;
+};
+
+ToolboxStyleItem Styles[ ] = {
+    { ::com::sun::star::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO },
+    { ::com::sun::star::ui::ItemStyle::ALIGN_LEFT, ATTRIBUTE_ITEMSTYLE_LEFT },
+    { ::com::sun::star::ui::ItemStyle::AUTO_SIZE, ATTRIBUTE_ITEMSTYLE_AUTO },
+    { ::com::sun::star::ui::ItemStyle::REPEAT, ATTRIBUTE_ITEMSTYLE_REPEAT },
+    { ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY, ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY },
+    { ::com::sun::star::ui::ItemStyle::DROP_DOWN, ATTRIBUTE_ITEMSTYLE_DROPDOWN },
+    { ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE },
+    { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
+};
+
+sal_Int32 nStyleItemEntries = sizeof( Styles ) / sizeof( Styles[ 0 ] );
+
 struct ToolBarEntryProperty
 {
 	OReadToolBoxDocumentHandler::ToolBox_XML_Namespace	nNamespace;
 	{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,	ATTRIBUTE_USER				},
 	{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,	ATTRIBUTE_HELPID			},
 	{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,	ATTRIBUTE_ITEMSTYLE			},
-    { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_UINAME            }
+    { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_UINAME            },
+    { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,	ATTRIBUTE_TOOLTIP			},
 };
 
 OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XIndexContainer >& rItemContainer ) :
     m_aLabel( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )),
     m_aStyle( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE )),
     m_aHelpURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )),
+    m_aTooltip( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TOOLTIP )),
     m_aIsVisible( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_VISIBLE )),
     m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ))
  {
 	m_nHashCode_Style_DropDown	    = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_DROPDOWN ).hashCode();
 	m_nHashCode_Style_Repeat	    = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_REPEAT ).hashCode();
     m_nHashCode_Style_DropDownOnly  = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ).hashCode();
+    m_nHashCode_Style_Text  = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_TEXT ).hashCode();
+    m_nHashCode_Style_Image  = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_IMAGE ).hashCode();
 
 	m_bToolBarStartFound			= sal_False;
 	m_bToolBarEndFound				= sal_False;
                 ::rtl::OUString        aLabel;
                 ::rtl::OUString        aCommandURL;
                 ::rtl::OUString        aHelpURL;
+                ::rtl::OUString        aTooltip;
                 ::rtl::OUString        aBitmapName;
                 sal_uInt16      nItemBits( 0 );
                 sal_uInt16      nWidth( 0 );
 							}
 							break;
 
+                            case TB_ATTRIBUTE_TOOLTIP:
+                            {
+                                aTooltip = xAttribs->getValueByIndex( n );
+                            }
+                            break;
+
 							case TB_ATTRIBUTE_STYLE:
 							{
 								// read space seperated item style list
                                             nItemBits |= ::com::sun::star::ui::ItemStyle::REPEAT;
                                         else if ( nHashCode == m_nHashCode_Style_DropDownOnly )
                                             nItemBits |= ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY;
+                                        else if ( nHashCode == m_nHashCode_Style_DropDown )
+                                            nItemBits |= ::com::sun::star::ui::ItemStyle::DROP_DOWN;
+                                        else if ( nHashCode == m_nHashCode_Style_Text )
+                                            nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+                                        else if ( nHashCode == m_nHashCode_Style_Image )
+                                            nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
 									}
 								}
 								while ( nIndex >= 0 );
 
 		        if ( aCommandURL.getLength() > 0 )
 		        {
-                    Sequence< PropertyValue > aToolbarItemProp( 6 );
+                    Sequence< PropertyValue > aToolbarItemProp( 7 );
                     aToolbarItemProp[0].Name = m_aCommandURL;
                     aToolbarItemProp[1].Name = m_aHelpURL;
                     aToolbarItemProp[2].Name = m_aLabel;
                     aToolbarItemProp[3].Name = m_aType;
                     aToolbarItemProp[4].Name = m_aStyle;
                     aToolbarItemProp[5].Name = m_aIsVisible;
+                    aToolbarItemProp[6].Name = m_aTooltip;
 
                     aToolbarItemProp[0].Value <<= aCommandURL;
                     aToolbarItemProp[1].Value <<= aHelpURL;
                     aToolbarItemProp[3].Value = makeAny( ::com::sun::star::ui::ItemType::DEFAULT );
                     aToolbarItemProp[4].Value <<= nItemBits;
                     aToolbarItemProp[5].Value <<= bVisible;
+                    aToolbarItemProp[6].Value <<= aTooltip;
 
                     m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
 		        }
             ::rtl::OUString    aCommandURL;
             ::rtl::OUString    aLabel;
             ::rtl::OUString    aHelpURL;
+            ::rtl::OUString    aTooltip;
             sal_Bool    bVisible( sal_True );
             sal_Int16   nType( ::com::sun::star::ui::ItemType::DEFAULT );
             sal_Int16   nWidth( 0 );
+            sal_Int16   nStyle( 0 );
 
-            ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, nWidth, bVisible, nType );
+            ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible, nType );
             if ( nType == ::com::sun::star::ui::ItemType::DEFAULT )
-                WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, nWidth, bVisible );
+                WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible );
             else if ( nType == ::com::sun::star::ui::ItemType::SEPARATOR_SPACE )
 				WriteToolBoxSpace();
             else if ( nType == ::com::sun::star::ui::ItemType::SEPARATOR_LINE )
     const ::rtl::OUString& rCommandURL,
     const ::rtl::OUString& rLabel,
     const ::rtl::OUString& rHelpURL,
+    const ::rtl::OUString& rTooltip,
+    sal_Int16       nStyle,
     sal_Int16       nWidth,
     sal_Bool        bVisible )
 throw ( SAXException, RuntimeException )
 							 rHelpURL );
 	}
 
+    if ( rTooltip.getLength() > 0 )
+    {
+        pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TOOLTIP )),
+                             m_aAttributeType,
+                             rTooltip );
+    }
+
+    if ( nStyle > 0 )
+    {
+        rtl::OUString aValue;
+        ToolboxStyleItem* pStyle = Styles;
+
+        for ( sal_Int32 nIndex = 0; nIndex < nStyleItemEntries; ++nIndex, ++pStyle )
+        {
+            if ( nStyle & pStyle->nBit )
+            {
+                if ( aValue.getLength() )
+                    aValue = aValue.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") ) );
+                aValue += rtl::OUString::createFromAscii( pStyle->attrName );
+            }
+        } 
+        pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ITEMSTYLE )),
+                             m_aAttributeType,
+                             aValue );
+    }
+
     if ( nWidth > 0 )
     {
 		pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_WIDTH )),

offapi/com/sun/star/ui/ItemStyle.idl

     /** specifies if an icon is placed on left side of the text, like an entry in a taskbar.
         <p>This style is only valid if the item describes a toolbar item and visible if
         style of the toolbar is set to symboltext.</p>
+        <p> This style can also be used for custom toolbars and menus, in a custom toolbar an item's Style setting can used to override the toolbar container setting, the style can be bitwise OR-ed with <member scope="::com::sun::star::ui::ItemStyle">TEXT</member> to define text, text+icon or icon only is to be displayed. Similarly for menu items, an items Style can override the application setting to display either text or icon ( note: for menu an icon only setting interpreted as icon+text ) </p> 
     */
     const short ICON          = 128;
     
         <p>This style is only valid if the item describes a toolbar item.</p>
     */
     const short DROPDOWN_ONLY = 1024;
+    /** indicates if icon, text or text+icon is displayed for the item. 
+        <p> This style can be used for custom toolbars and menus, in a custom toolbar an item's Style setting can used to override the toolbar container setting, the style can be bitwise OR-ed with <member scope="com::sun::star::ui::ItemStyle">ICON</member> to define text, text+icon or icon only is to be displayed. Similarly for menu items, an items Style can override the application setting to display either text or icon ( note: for menu an icon only setting interpreted as icon+text ) </p> 
+    */
+    const short TEXT = 2048;
 };
 
 }; }; }; };

vcl/inc/vcl/menu.hxx

 #define MIB_POPUPSELECT 		((MenuItemBits)0x0020)
 // not in rsc/vclsrc.hxx because only a prelimitary solution
 #define MIB_NOSELECT 		    ((MenuItemBits)0x0040)
+#define MIB_ICON 		    ((MenuItemBits)0x0080)
+#define MIB_TEXT 		    ((MenuItemBits)0x0100)
 
 #define MENU_FLAG_NOAUTOMNEMONICS		0x0001
 #define MENU_FLAG_HIDEDISABLEDENTRIES	0x0002

vcl/inc/vcl/toolbox.hxx

 #define TIB_DROPDOWN            ((ToolBoxItemBits)0x0020)
 #define TIB_REPEAT              ((ToolBoxItemBits)0x0040)
 #define TIB_DROPDOWNONLY        ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN)    // this button has only drop down functionality
+#define TIB_TEXT_ONLY           ((ToolBoxItemBits)0x0100)
+#define TIB_ICON_ONLY           ((ToolBoxItemBits)0x0200)
+#define TIB_TEXTICON            ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
 
 // -----------------
 // - ToolBox-Types -

vcl/source/window/toolbox.cxx

     }
     return width;
 }
+
+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
+{
+    ButtonType tmpButtonType = defaultType;
+    ToolBoxItemBits nBits( pItem->mnBits & 0x300 );
+    if ( nBits & TIB_TEXTICON ) // item has custom setting
+    {
+        tmpButtonType = BUTTON_SYMBOLTEXT; 
+        if ( nBits == TIB_TEXT_ONLY )
+            tmpButtonType = BUTTON_TEXT; 
+        else if ( nBits == TIB_ICON_ONLY )
+            tmpButtonType = BUTTON_SYMBOL; 
+    }
+    return tmpButtonType;
+}
+
 // -----------------------------------------------------------------------
 
 void ToolBox::ImplUpdateDragArea( ToolBox *pThis )
                     bText = FALSE;
                 else
                     bText = TRUE;
-
+                ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting 
                 if ( bImage || bText )
                 {
+
                     it->mbEmptyBtn = FALSE;
 
-                    if ( meButtonType == BUTTON_SYMBOL )
+                    if ( tmpButtonType == BUTTON_SYMBOL )
                     {
                         // we're drawing images only
                         if ( bImage || !bText )
                             it->mbVisibleText = TRUE;
                         }
                     }
-                    else if ( meButtonType == BUTTON_TEXT )
+                    else if ( tmpButtonType == BUTTON_TEXT )
                     {
                         // we're drawing text only
                         if ( bText || !bImage )
     // determine what has to be drawn on the button: image, text or both
     BOOL bImage;
     BOOL bText;
-    pItem->DetermineButtonDrawStyle( meButtonType, bImage, bText );
+    ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting 
+    pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText );
 
     // compute output values
     long    nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.