Revert "fdo#46808, Adapt frame::PopupMenuControllerFactory UNO service"

This reverts commit e93a0018871ebea4da1959c72c06f3c7f4dc7b27.

Conflicts:
	desktop/source/app/app.cxx
	framework/source/uielement/menubarmanager.cxx
	framework/source/uielement/popupmenucontroller.cxx
	offapi/UnoApi_offapi.mk

Change-Id: I3d4d49f98603e75357fb315a603a10851b3a7090
This commit is contained in:
Caolán McNamara 2013-05-20 17:18:56 +01:00
parent e9679a4a76
commit f4bccae9eb
10 changed files with 93 additions and 115 deletions

View File

@ -41,7 +41,6 @@
#include <com/sun/star/frame/SessionListener.hpp>
#include <com/sun/star/frame/XSessionManagerListener.hpp>
#include <com/sun/star/frame/XSynchronousDispatch.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
#include <com/sun/star/configuration/CorruptedConfigurationException.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@ -2215,16 +2214,21 @@ void Desktop::PreloadConfigurationData()
// preload popup menu controller factories. As all controllers are in the same
// configuration file they also get preloaded!
Reference< css::frame::XToolbarControllerFactory > xPopupMenuControllerFactory =
css::frame::PopupMenuControllerFactory::create( xContext );
try
{
xPopupMenuControllerFactory->hasController(
OUString( ".uno:CharFontName" ),
OUString() );
}
catch ( const ::com::sun::star::uno::Exception& )
Reference< ::com::sun::star::frame::XUIControllerRegistration > xPopupMenuControllerFactory(
rFactory->createInstance(
rtl::OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
UNO_QUERY );
if ( xPopupMenuControllerFactory.is() )
{
try
{
xPopupMenuControllerFactory->hasController(
rtl::OUString( ".uno:CharFontName" ),
OUString() );
}
catch ( const ::com::sun::star::uno::Exception& )
{
}
}
// preload filter configuration
@ -2269,6 +2273,8 @@ void Desktop::OpenClients()
const CommandLineArgs& rArgs = GetCommandLineArgs();
Reference<XMultiServiceFactory> rFactory = ::comphelper::getProcessServiceFactory();
if (!rArgs.IsQuickstart())
{
sal_Bool bShowHelp = sal_False;

View File

@ -38,6 +38,7 @@ namespace framework{
#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" )
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
#define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" )
#define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" )
#define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" )
#define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
#define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" )

View File

@ -34,7 +34,6 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/FeatureStateEvent.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
#include <com/sun/star/frame/XToolbarControllerFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
@ -236,7 +235,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
Menu* m_pVCLMenu;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarControllerFactory > m_xPopupMenuControllerRegistration;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration;
::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;

View File

@ -29,9 +29,10 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/frame/XToolbarControllerFactory.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <rtl/ustring.hxx>
namespace framework
@ -39,8 +40,9 @@ namespace framework
class ConfigurationAccess_ControllerFactory;
class ToolbarControllerFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
com::sun::star::frame::XToolbarControllerFactory>
public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo,
com::sun::star::lang::XMultiComponentFactory,
com::sun::star::frame::XUIControllerRegistration>
{
public:
ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );

View File

@ -36,7 +36,6 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/util/XStringWidth.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@ -183,7 +182,9 @@ MenuBarManager::MenuBarManager(
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" );
m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext );
m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
UNO_QUERY );
FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren );
}
@ -1186,30 +1187,37 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CreatePopupMenuController" );
OUString aItemCommand( pMenuItemHandler->aMenuItemURL );
// Try instantiate a popup menu controller. It is stored in the menu item handler.
Sequence< Any > aSeq( 2 );
PropertyValue aPropValue;
aPropValue.Name = OUString( "ModuleName" );
aPropValue.Value <<= m_aModuleIdentifier;
aSeq[0] <<= aPropValue;
aPropValue.Name = OUString( "Frame" );
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
Reference< XPopupMenuController > xPopupMenuController(
m_xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext(
aItemCommand,
aSeq,
m_xContext ),
UNO_QUERY );
if ( xPopupMenuController.is() )
// Try instanciate a popup menu controller. It is stored in the menu item handler.
Reference< XMultiComponentFactory > xPopupMenuControllerFactory( m_xPopupMenuControllerRegistration, UNO_QUERY );
if ( xPopupMenuControllerFactory.is() )
{
// Provide our awt popup menu to the popup menu controller
pMenuItemHandler->xPopupMenuController = xPopupMenuController;
xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu );
return sal_True;
Sequence< Any > aSeq( 2 );
PropertyValue aPropValue;
aPropValue.Name = OUString( "ModuleName" );
aPropValue.Value <<= m_aModuleIdentifier;
aSeq[0] <<= aPropValue;
aPropValue.Name = OUString( "Frame" );
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( getServiceFactory() ) );
Reference< XPopupMenuController > xPopupMenuController(
xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(
aItemCommand,
aSeq,
xComponentContext ),
UNO_QUERY );
if ( xPopupMenuController.is() )
{
// Provide our awt popup menu to the popup menu controller
pMenuItemHandler->xPopupMenuController = xPopupMenuController;
xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu );
return sal_True;
}
}
return sal_False;
@ -2012,7 +2020,9 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen
m_bIsBookmarkMenu = sal_True;
OUString aModuleIdentifier;
m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext );
m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
UNO_QUERY );
Reference< XStatusListener > xStatusListener;
Reference< XDispatch > xDispatch;

View File

@ -20,7 +20,6 @@
#include <com/sun/star/awt/XPopupMenu.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <toolkit/helper/vclunohelper.hxx>
@ -156,7 +155,7 @@ void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException)
bool PopupMenuController::CreatePopupMenuController() throw (Exception)
{
Reference< XToolbarControllerFactory > xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext );
Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW );
Sequence< Any > aSeq( 2 );
PropertyValue aPropValue;
@ -168,7 +167,10 @@ bool PopupMenuController::CreatePopupMenuController() throw (Exception)
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, m_xContext ), UNO_QUERY );
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( getServiceManager() ) );
Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY );
if ( xPopupMenuController.is() )
{
mxPopupMenuController = xPopupMenuController;

View File

@ -54,7 +54,7 @@ namespace framework
//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory ,
::cppu::OWeakObject ,
DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory"),
SERVICENAME_POPUPMENUCONTROLLERFACTORY ,
IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY
)

View File

@ -198,7 +198,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
GlobalEventBroadcaster \
MediaTypeDetectionHelper \
ModuleManager \
PopupMenuControllerFactory \
SessionListener \
StartModule \
TaskCreator \
@ -942,6 +941,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\
FramesContainer \
LayoutManager \
PopupMenuController \
PopupMenuControllerFactory \
ProtocolHandler \
SessionManager \
Settings \
@ -2630,7 +2630,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
XTitleChangeBroadcaster \
XTitleChangeListener \
XToolbarController \
XToolbarControllerFactory \
XToolbarControllerListener \
XTransientDocumentsDocumentContentFactory \
XUIControllerRegistration \

View File

@ -20,7 +20,8 @@
#ifndef __com_sun_star_frame_PopupMenuControllerFactory_idl__
#define __com_sun_star_frame_PopupMenuControllerFactory_idl__
#include <com/sun/star/frame/XToolbarControllerFactory.idl>
#include <com/sun/star/lang/XMultiComponentFactory.idl>
#include <com/sun/star/frame/XUIControllerRegistration.idl>
module com { module sun { module star { module frame {
@ -37,7 +38,30 @@ module com { module sun { module star { module frame {
@since OOo 2.0
*/
service PopupMenuControllerFactory : XToolbarControllerFactory;
service PopupMenuControllerFactory
{
/** this interface provides functions to create new instances of a registered pop-up menu controller.
<p>
Use <member scope="com.sun.star.lang">XMultiComponentFactory::createInstanceWithArguments()</member> to create
a new pop-up menu controller instance. Use the CommandURL as the service specifier.
This call supports the following arguments provided as <type scope="com::sun::star::beans">PropertyValue</type>:
<ul>
<li><b>Frame</b><br>specifies the <type scope="com::sun::star::frame">XFrame</type>
instance to which the pop-up menu controller belongs to. This property must be provided to
the pop-up menu controller, otherwise it cannot dispatch its internal commands.</li>
<li><b>ModuleIdentifier</b><br>optional string that specifies in which module context the pop-up menu
controller should be created.</li>
</ul>
</p>
*/
interface com::sun::star::lang::XMultiComponentFactory;
/** provides functions to query for, register and deregister a pop-up menu controller.
*/
interface com::sun::star::frame::XUIControllerRegistration;
};
}; }; }; };

View File

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_frame_XToolbarControllerFactory_idl__
#define __com_sun_star_frame_XToolbarControllerFactory_idl__
#include <com/sun/star/lang/XMultiComponentFactory.idl>
#include <com/sun/star/frame/XUIControllerRegistration.idl>
module com { module sun { module star { module frame {
/** Provides a unified interface for the new-style PopupMenuControllerFactory service to implement.
@since LibreOffice 4.1
*/
interface XToolbarControllerFactory
{
/** this interface provides functions to create new instances of a registered pop-up menu controller.
<p>
Use <member scope="com.sun.star.lang">XMultiComponentFactory::createInstanceWithArguments()</member> to create
a new pop-up menu controller instance. Use the CommandURL as the service specifier.
This call supports the following arguments provided as <type scope="com::sun::star::beans">PropertyValue</type>:
<ul>
<li><b>Frame</b><br>specifies the <type scope="com::sun::star::frame">XFrame</type>
instance to which the pop-up menu controller belongs to. This property must be provided to
the pop-up menu controller, otherwise it cannot dispatch its internal commands.</li>
<li><b>ModuleIdentifier</b><br>optional string that specifies in which module context the pop-up menu
controller should be created.</li>
</ul>
</p>
*/
interface com::sun::star::lang::XMultiComponentFactory;
/** provides functions to query for, register and deregister a pop-up menu controller.
*/
interface com::sun::star::frame::XUIControllerRegistration;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */