[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - framework/inc framework/source officecfg/registry sfx2/source
Herbert Dürr
hdu at apache.org
Fri May 16 07:08:01 PDT 2014
framework/inc/framework/addonmenu.hxx | 15 ++--
framework/source/classes/menumanager.cxx | 2
framework/source/dispatch/menudispatcher.cxx | 4 -
framework/source/fwe/classes/addonmenu.cxx | 78 ++++++++++++------------
framework/source/uielement/menubarmanager.cxx | 10 ---
officecfg/registry/data/org/openoffice/Inet.xcu | 44 -------------
sfx2/source/menu/virtmenu.cxx | 11 +--
7 files changed, 58 insertions(+), 106 deletions(-)
New commits:
commit 70c4adf42a0d7789abc900a0698a2ff4b5314944
Author: Herbert Dürr <hdu at apache.org>
Date: Fri May 16 12:57:29 2014 +0000
#i124881# drop ill-reputed euroseek search engine
Found-by: Rainer Bielefeld <rainerbielefeld_ooo_qa at bielefeldundbuss.de>
diff --git a/officecfg/registry/data/org/openoffice/Inet.xcu b/officecfg/registry/data/org/openoffice/Inet.xcu
index 1489697..f779044 100644
--- a/officecfg/registry/data/org/openoffice/Inet.xcu
+++ b/officecfg/registry/data/org/openoffice/Inet.xcu
@@ -91,50 +91,6 @@
</prop>
</node>
<node oor:name="SearchEngines">
- <node oor:name="Euroseek" oor:op="replace">
- <node oor:name="And">
- <prop oor:name="ooInetPrefix" oor:type="xs:string">
- <value>http://www.euroseek.com/system/search.cgi?mode=internet&string=</value>
- </prop>
- <prop oor:name="ooInetSuffix" oor:type="xs:string">
- <value>&language=en</value>
- </prop>
- <prop oor:name="ooInetCaseMatch" oor:type="xs:int">
- <value>0</value>
- </prop>
- <prop oor:name="ooInetSeparator" oor:type="xs:string">
- <value>+</value>
- </prop>
- </node>
- <node oor:name="Exact">
- <prop oor:name="ooInetPrefix" oor:type="xs:string">
- <value>http://www.euroseek.com/system/search.cgi?mode=internet&string=</value>
- </prop>
- <prop oor:name="ooInetSuffix" oor:type="xs:string">
- <value>&language=en</value>
- </prop>
- <prop oor:name="ooInetCaseMatch" oor:type="xs:int">
- <value>0</value>
- </prop>
- <prop oor:name="ooInetSeparator" oor:type="xs:string">
- <value>%20</value>
- </prop>
- </node>
- <node oor:name="Or">
- <prop oor:name="ooInetPrefix" oor:type="xs:string">
- <value>http://www.euroseek.com/system/search.cgi?mode=internet&string=</value>
- </prop>
- <prop oor:name="ooInetSuffix" oor:type="xs:string">
- <value>&language=en</value>
- </prop>
- <prop oor:name="ooInetCaseMatch" oor:type="xs:int">
- <value>0</value>
- </prop>
- <prop oor:name="ooInetSeparator" oor:type="xs:string">
- <value>+</value>
- </prop>
- </node>
- </node>
<node oor:name="Lycos" oor:op="replace">
<node oor:name="And">
<prop oor:name="ooInetPrefix" oor:type="xs:string">
commit 2aac0070dbef6c1ad7eeccf7d4015cdcbffe067e
Author: Tsutomu Uchino <hanya at apache.org>
Date: Fri May 16 12:48:54 2014 +0000
#i86528# use the module manager to identify the context for addons menu merging
diff --git a/framework/inc/framework/addonmenu.hxx b/framework/inc/framework/addonmenu.hxx
index 83b7f2b..6768dc7 100644
--- a/framework/inc/framework/addonmenu.hxx
+++ b/framework/inc/framework/addonmenu.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -92,23 +93,25 @@ class FWE_DLLPUBLIC AddonMenuManager
static sal_Bool IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
// Check if the context string matches the provided xModel context
- static sal_Bool IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const rtl::OUString& aContext );
+ static sal_Bool IsCorrectContext( const ::rtl::OUString& rModuleIdentifier, const rtl::OUString& aContext );
// Factory method to create different Add-On menu types
static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
// Create the Add-Ons menu
- static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
static void MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
- MenuBar* pMergeMenuBar );
+ MenuBar* pMergeMenuBar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
// Merge the addon popup menus into the given menu bar at the provided pos.
static void MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
- const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
sal_uInt16 nMergeAtPos,
- MenuBar* pMergeMenuBar );
+ MenuBar* pMergeMenuBar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
// Returns the next position to insert a menu item/sub menu
static sal_uInt16 GetNextPos( sal_uInt16 nPos );
@@ -120,7 +123,7 @@ class FWE_DLLPUBLIC AddonMenuManager
sal_uInt16& nUniqueMenuId,
com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition,
const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
- const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
+ const ::rtl::OUString& rModuleIdentifier );
// Retrieve the menu entry property values from a sequence
static void GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index f8daef4..d95df55 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -192,7 +192,7 @@ MenuManager::MenuManager(
AddonMenuManager::HasAddonMenuElements() )
{
sal_uInt16 nCount = 0;
- AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
+ AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame, xServiceFactory );
if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
{
if ( pPopupMenu->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index 40f2086..d06f4c4 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -344,10 +344,10 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
xModel = uno::Reference< XModel >( xController->getModel(), UNO_QUERY );
// retrieve addon popup menus and add them to our menu bar
- AddonMenuManager::MergeAddonPopupMenus( xFrame, xModel, nPos, pMenuBar );
+ AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, pMenuBar, m_xFactory );
// retrieve addon help menu items and add them to our help menu
- AddonMenuManager::MergeAddonHelpMenu( xFrame, pMenuBar );
+ AddonMenuManager::MergeAddonHelpMenu( xFrame, pMenuBar, m_xFactory );
}
// set new menu on our system window and create new menu manager
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index e0b45bf..dc6823b 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -33,6 +33,7 @@
#include <macros/debug/assertion.hxx>
#include <framework/imageproducer.hxx>
#include <framework/menuconfiguration.hxx>
+#include <services.h>
//_________________________________________________________________________________________________________________
// interface includes
@@ -40,7 +41,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -108,18 +109,21 @@ AddonPopupMenu::~AddonPopupMenu()
// ------------------------------------------------------------------------
-static Reference< XModel > GetModelFromFrame( const Reference< XFrame >& rFrame )
+static ::rtl::OUString GetModuleIdentifier( const Reference< XMultiServiceFactory >& rServiceManager,
+ const Reference< XFrame >& rFrame )
{
- // Query for the model to get check the context information
- Reference< XModel > xModel;
- if ( rFrame.is() )
+ Reference< XModuleManager > xModuleManager( rServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY );
+ if ( xModuleManager.is() )
{
- Reference< XController > xController( rFrame->getController(), UNO_QUERY );
- if ( xController.is() )
- xModel = xController->getModel();
+ try
+ {
+ return xModuleManager->identify( rFrame );
+ }
+ catch ( Exception& )
+ {
+ }
}
-
- return xModel;
+ return ::rtl::OUString();
}
// ------------------------------------------------------------------------
@@ -146,7 +150,8 @@ PopupMenu* AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Refe
}
// Create the Add-Ons menu
-AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame )
+AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame,
+ const Reference< XMultiServiceFactory >& rServiceManager )
{
AddonsOptions aOptions;
AddonMenu* pAddonMenu = NULL;
@@ -156,8 +161,8 @@ AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame
if ( rAddonMenuEntries.getLength() > 0 )
{
pAddonMenu = (AddonMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame );
- Reference< XModel > xModel = GetModelFromFrame( rFrame );
- AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, xModel );
+ ::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
+ AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, aModuleIdentifier );
// Don't return an empty Add-On menu
if ( pAddonMenu->GetItemCount() == 0 )
@@ -194,7 +199,9 @@ static sal_uInt16 FindMenuId( Menu* pMenu, const String aCommand )
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
-void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, MenuBar* pMergeMenuBar )
+void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame,
+ MenuBar* pMergeMenuBar,
+ const Reference< XMultiServiceFactory >& rServiceManager )
{
if ( pMergeMenuBar )
{
@@ -245,8 +252,8 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR )
nInsSepAfterPos = nInsPos;
- Reference< XModel > xModel = GetModelFromFrame( rFrame );
- AddonMenuManager::BuildMenu( pHelpMenu, ADDON_MENU, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, xModel );
+ ::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
+ AddonMenuManager::BuildMenu( pHelpMenu, ADDON_MENU, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, aModuleIdentifier );
if ( pHelpMenu->GetItemCount() > nItemCount )
{
@@ -267,9 +274,9 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me
// Merge the addon popup menus into the given menu bar at the provided pos.
void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
- const Reference< XModel >& rModel,
sal_uInt16 nMergeAtPos,
- MenuBar* pMergeMenuBar )
+ MenuBar* pMergeMenuBar,
+ const Reference< XMultiServiceFactory >& rServiceManager )
{
if ( pMergeMenuBar )
{
@@ -283,6 +290,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
::rtl::OUString aContext;
Sequence< Sequence< PropertyValue > > aAddonSubMenu;
sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
+ ::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
@@ -297,12 +305,12 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
if ( aTitle.getLength() > 0 &&
aURL.getLength() > 0 &&
aAddonSubMenu.getLength() > 0 &&
- AddonMenuManager::IsCorrectContext( rModel, aContext ))
+ AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext ))
{
sal_uInt16 nId = nUniqueMenuId++;
AddonPopupMenu* pAddonPopupMenu = (AddonPopupMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame );
- AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel );
+ AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, aModuleIdentifier );
if ( pAddonPopupMenu->GetItemCount() > 0 )
{
@@ -327,7 +335,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
sal_uInt16& nUniqueMenuId,
Sequence< Sequence< PropertyValue > > aAddonMenuDefinition,
const Reference< XFrame >& rFrame,
- const Reference< XModel >& rModel )
+ const ::rtl::OUString& rModuleIdentifier )
{
Sequence< Sequence< PropertyValue > > aAddonSubMenu;
sal_Bool bInsertSeparator = sal_False;
@@ -346,7 +354,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
{
GetMenuEntry( aAddonMenuDefinition[i], aTitle, aURL, aTarget, aImageId, aContext, aAddonSubMenu );
- if ( !IsCorrectContext( rModel, aContext ) || ( !aTitle.getLength() && !aURL.getLength() ))
+ if ( !IsCorrectContext( rModuleIdentifier, aContext ) || ( !aTitle.getLength() && !aURL.getLength() ))
continue;
if ( aURL == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:separator" )))
@@ -357,7 +365,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
if ( aAddonSubMenu.getLength() > 0 )
{
pSubMenu = AddonMenuManager::CreatePopupMenuType( nSubMenuType, rFrame );
- AddonMenuManager::BuildMenu( pSubMenu, nSubMenuType, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel );
+ AddonMenuManager::BuildMenu( pSubMenu, nSubMenuType, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModuleIdentifier );
// Don't create a menu item for an empty sub menu
if ( pSubMenu->GetItemCount() == 0 )
@@ -426,26 +434,18 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu
}
// Check if the context string matches the provided xModel context
-sal_Bool AddonMenuManager::IsCorrectContext( const Reference< XModel >& rModel, const ::rtl::OUString& aContext )
+sal_Bool AddonMenuManager::IsCorrectContext( const ::rtl::OUString& rModuleIdentifier, const ::rtl::OUString& aContext )
{
- if ( rModel.is() )
- {
- Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( rModel, UNO_QUERY );
- if ( xServiceInfo.is() )
- {
- sal_Int32 nIndex = 0;
- do
- {
- ::rtl::OUString aToken = aContext.getToken( 0, ',', nIndex );
+ if ( aContext.isEmpty() )
+ return sal_True;
- if ( xServiceInfo->supportsService( aToken ))
- return sal_True;
- }
- while ( nIndex >= 0 );
- }
+ if ( !rModuleIdentifier.isEmpty() )
+ {
+ sal_Int32 nIndex = aContext.indexOf( rModuleIdentifier );
+ return ( nIndex >= 0 );
}
- return ( aContext.getLength() == 0 );
+ return sal_False;
}
}
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 759da39..13f20f1 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1292,17 +1292,13 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
aCommand == aSpecialWindowCommand )
{
// Retrieve addon popup menus and add them to our menu bar
- Reference< com::sun::star::frame::XModel > xModel;
- Reference< com::sun::star::frame::XController > xController( rFrame->getController(), UNO_QUERY );
- if ( xController.is() )
- xModel = Reference< com::sun::star::frame::XModel >( xController->getModel(), UNO_QUERY );
- framework::AddonMenuManager::MergeAddonPopupMenus( rFrame, xModel, nPos, (MenuBar *)pMenu );
+ framework::AddonMenuManager::MergeAddonPopupMenus( rFrame, nPos, (MenuBar *)pMenu, mxServiceFactory );
break;
}
}
// Merge the Add-Ons help menu items into the Office help menu
- framework::AddonMenuManager::MergeAddonHelpMenu( rFrame, (MenuBar *)pMenu );
+ framework::AddonMenuManager::MergeAddonHelpMenu( rFrame, (MenuBar *)pMenu, mxServiceFactory );
}
String aEmpty;
@@ -1398,7 +1394,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
{
// Create addon popup menu if there exist elements and this is the tools popup menu
sal_uInt16 nCount = 0;
- AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
+ AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame, mxServiceFactory );
if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
{
if ( pPopup->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index 8564bb2..a20a489 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -341,20 +341,17 @@ void SfxVirtualMenu::CreateFromSVMenu()
if ( pSVMenu->IsMenuBar() )
{
+ Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
sal_uInt16 nPos = pSVMenu->GetItemPos( SID_MDIWINDOWLIST );
if ( nPos != MENU_ITEM_NOTFOUND && xFrame.is() )
{
// Retrieve addon popup menus and add them to our menu bar
- Reference< com::sun::star::frame::XModel > xModel;
- Reference< com::sun::star::frame::XController > xController( xFrame->getController(), UNO_QUERY );
- if ( xController.is() )
- xModel = Reference< com::sun::star::frame::XModel >( xController->getModel(), UNO_QUERY );
- framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, xModel, nPos, (MenuBar *)pSVMenu );
+ framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, (MenuBar *)pSVMenu, aXMultiServiceFactory );
}
// Merge the Add-Ons help menu items into the Office help menu
if ( xFrame.is() )
- framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, (MenuBar *)pSVMenu );
+ framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, (MenuBar *)pSVMenu, aXMultiServiceFactory );
// Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu
// is created immediately!
@@ -870,7 +867,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu )
PopupMenu* pAddonMenu = NULL;
try
{
- pAddonMenu = framework::AddonMenuManager::CreateAddonMenu( xFrame );
+ pAddonMenu = framework::AddonMenuManager::CreateAddonMenu( xFrame, aXMultiServiceFactory );
}
catch ( ::com::sun::star::lang::WrappedTargetException )
{
More information about the Libreoffice-commits
mailing list