[Libreoffice-commits] core.git: framework/source

Maxim Monastirsky momonasmon at gmail.com
Wed May 17 23:16:26 UTC 2017


 framework/source/uielement/menubarmanager.cxx |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

New commits:
commit e5736b9e4ded62cdeaa49649763392779d312e0a
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Thu May 18 01:43:01 2017 +0300

    Revert "Popup menu controllers never attached to empty menus"
    
    This reverts commit 005f4a75e129dcbc74261b90432e2944ca99b131.
    
    There might be however old profiles/documents with this
    behavior. Let's revert for now.
    
    Change-Id: I2ee26287b7bd64e01a9b6b0a9586d70e63b9c83d

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index fac26401f590..d99019c435da 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1131,9 +1131,31 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
                 pMenu->SetHelpCommand( nItemId, "" );
             }
 
-            assert(!m_xPopupMenuControllerFactory.is() || !m_xPopupMenuControllerFactory->hasController( aItemCommand, m_aModuleIdentifier ));
+            if ( m_xPopupMenuControllerFactory.is() &&
+                 pPopup->GetItemCount() == 0 &&
+                 m_xPopupMenuControllerFactory->hasController( aItemCommand, m_aModuleIdentifier )
+                  )
+            {
+                // Check if we have to create a popup menu for a uno based popup menu controller.
+                // We have to set an empty popup menu into our menu structure so the controller also
+                // works with inplace OLE. Remove old dummy popup menu!
+                MenuItemHandler* pItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch );
+                VCLXPopupMenu* pVCLXPopupMenu = new VCLXPopupMenu;
+                PopupMenu* pNewPopupMenu = static_cast<PopupMenu *>(pVCLXPopupMenu->GetMenu());
+                pMenu->SetPopupMenu( nItemId, pNewPopupMenu );
+                pItemHandler->xPopupMenu.set( static_cast<OWeakObject *>(pVCLXPopupMenu), UNO_QUERY );
+                pItemHandler->aMenuItemURL = aItemCommand;
+                m_aMenuItemHandlerVector.push_back( pItemHandler );
+                pPopup.disposeAndClear();
 
-            if ( aItemCommand.startsWith( ADDONSPOPUPMENU_URL_PREFIX_STR ) )
+                if ( bAccessibilityEnabled )
+                {
+                    if ( CreatePopupMenuController( pItemHandler ))
+                        pItemHandler->xPopupMenuController->updatePopupMenu();
+                }
+                lcl_CheckForChildren(pMenu, nItemId);
+            }
+            else if ( aItemCommand.startsWith( ADDONSPOPUPMENU_URL_PREFIX_STR ) )
             {
                 // A special addon popup menu, must be created with a different ctor
                 MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer, pPopup, true );


More information about the Libreoffice-commits mailing list