Introduce com.sun.star.frame.ControllerFactory singletons:

com.sun.star.frame.thePopupMenuControllerFactory
com.sun.star.frame.theStatusbarControllerFactory
com.sun.star.frame.theToolbarControllerFactory

To replace their single-instance service variants.

Change-Id: I00586d0d61e63f9482cb659071e88aa9cf02d5b5
This commit is contained in:
Matúš Kukan
2014-01-29 10:35:38 +01:00
parent 4613f593a8
commit af1c0ef8d3
16 changed files with 166 additions and 35 deletions

View File

@@ -72,8 +72,7 @@
#include <com/sun/star/ui/UIElementFactoryManager.hpp>
#include <com/sun/star/ui/WindowStateConfiguration.hpp>
#include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/office/Quickstart.hpp>
#include <toolkit/helper/vclunohelper.hxx>
@@ -2199,7 +2198,7 @@ void Desktop::PreloadConfigurationData()
// configuration file they also get preloaded!
Reference< css::frame::XUIControllerRegistration > xPopupMenuControllerFactory =
css::frame::PopupMenuControllerFactory::create( xContext );
css::frame::thePopupMenuControllerFactory::get( xContext );
try
{
xPopupMenuControllerFactory->hasController(

View File

@@ -121,11 +121,11 @@
#include <com/sun/star/frame/LayoutManagerEvents.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/OfficeFrameLoader.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/StartModule.hpp>
#include <com/sun/star/frame/StatusbarControllerFactory.hpp>
#include <com/sun/star/frame/theStatusbarControllerFactory.hpp>
#include <com/sun/star/frame/TaskCreator.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XControlNotificationListener.hpp>

View File

@@ -43,7 +43,7 @@
#include <com/sun/star/uno/XCurrentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/lang/SystemDependent.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/ItemType.hpp>
@@ -179,7 +179,7 @@ MenuBarManager::MenuBarManager(
, m_xURLTransformer(_xURLTransformer)
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create(m_xContext);
m_xPopupMenuControllerFactory = frame::thePopupMenuControllerFactory::get(m_xContext);
FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren );
}
@@ -1963,7 +1963,7 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen
m_bIsBookmarkMenu = sal_True;
OUString aModuleIdentifier;
m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create(
m_xPopupMenuControllerFactory = frame::thePopupMenuControllerFactory::get(
::comphelper::getProcessComponentContext());
Reference< XStatusListener > xStatusListener;

View File

@@ -32,7 +32,7 @@
#include <com/sun/star/awt/PopupMenuDirection.hpp>
#include <com/sun/star/awt/XPopupMenu.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/frame/XUIControllerFactory.hpp>
@@ -129,7 +129,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException )
try
{
m_xPopupMenuFactory.set(
css::frame::PopupMenuControllerFactory::create( m_xContext ) );
css::frame::thePopupMenuControllerFactory::get( m_xContext ) );
m_bHasController = m_xPopupMenuFactory->hasController(
m_aPopupCommand, getModuleName() );
}

View File

@@ -36,7 +36,7 @@
#include <helper/mischelper.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/StatusbarControllerFactory.hpp>
#include <com/sun/star/frame/theStatusbarControllerFactory.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -145,7 +145,7 @@ StatusBarManager::StatusBarManager(
m_xContext( rxContext )
{
m_xStatusbarControllerFactory = frame::StatusbarControllerFactory::create(
m_xStatusbarControllerFactory = frame::theStatusbarControllerFactory::get(
::comphelper::getProcessComponentContext());
m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) );

View File

@@ -42,7 +42,7 @@
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theToolbarControllerFactory.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIElementSettings.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
@@ -211,7 +211,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
if ( pWindow )
((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar );
m_xToolbarControllerFactory = frame::ToolbarControllerFactory::create( m_xContext );
m_xToolbarControllerFactory = frame::theToolbarControllerFactory::get( m_xContext );
m_xURLTransformer = URLTransformer::create( m_xContext );
m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) );

View File

@@ -101,6 +101,7 @@
</implementation>
<implementation name="com.sun.star.comp.framework.PopupMenuControllerFactory">
<service name="com.sun.star.frame.PopupMenuControllerFactory"/>
<singleton name="com.sun.star.frame.thePopupMenuControllerFactory"/>
</implementation>
<implementation name="com.sun.star.comp.framework.RecentFilesMenuController"
constructor="com_sun_star_comp_framework_RecentFilesMenuController_get_implementation">
@@ -108,6 +109,7 @@
</implementation>
<implementation name="com.sun.star.comp.framework.StatusBarControllerFactory">
<service name="com.sun.star.frame.StatusbarControllerFactory"/>
<singleton name="com.sun.star.frame.theStatusbarControllerFactory"/>
</implementation>
<implementation name="com.sun.star.comp.framework.StatusBarFactory">
<service name="com.sun.star.ui.StatusBarFactory"/>
@@ -121,6 +123,7 @@
</implementation>
<implementation name="com.sun.star.comp.framework.ToolBarControllerFactory">
<service name="com.sun.star.frame.ToolbarControllerFactory"/>
<singleton name="com.sun.star.frame.theToolbarControllerFactory"/>
</implementation>
<implementation name="com.sun.star.comp.framework.ToolBarFactory">
<service name="com.sun.star.ui.ToolBarFactory"/>

View File

@@ -951,6 +951,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/frame,\
ToolbarController \
ToolbarControllerFactory \
TransientDocumentsDocumentContentFactory \
thePopupMenuControllerFactory \
theStatusbarControllerFactory \
theToolbarControllerFactory \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/gallery,\
GalleryItem \

View File

@@ -24,13 +24,10 @@
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered popup menu controller.
/**
A legacy (single-instance) service-variant of thePopupMenuControllerFactory singleton.
<p>
A pop-up menu controller can be registered for a command URL and a model service name.
A menu bar or context menu will automatically create a pop-up menu controller if
it contains a registered command URL.
</p>
@deprecated Use thePopupMenuControllerFactory singleton instead.
@since OOo 2.0
*/

View File

@@ -24,14 +24,10 @@
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered status bar
controller.
/**
A legacy (single-instance) service-variant of theStatusbarControllerFactory singleton.
<p>
A status bar controller can be registered for a command URL and a model
service name. A status bar will automatically create a status bar controller
if it contains a registered command URL.
</p>
@deprecated Use theStatusbarControllerFactory singleton instead.
@since OOo 2.0
*/

View File

@@ -22,11 +22,10 @@
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered toolbar controller.
/**
A legacy (single-instance) service-variant of theToolbarControllerFactory singleton.
<p>
A toolbar controller can be registered for a command URL and a model service name.
</p>
@deprecated Use theToolbarControllerFactory singleton instead.
@since OOo 2.0
*/

View File

@@ -0,0 +1,46 @@
/* -*- 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_thePopupMenuControllerFactory_idl__
#define __com_sun_star_frame_thePopupMenuControllerFactory_idl__
#include <com/sun/star/frame/XUIControllerFactory.idl>
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered popup menu controller.
<p>
A pop-up menu controller can be registered for a command URL and a model service name.
A menu bar or context menu will automatically create a pop-up menu controller if
it contains a registered command URL.
</p>
Prior to LibreOffice 4.3, this singleton was only available as a
(single-instance) PopupMenuControllerFactory service.
@since LibreOffice 4.3
*/
singleton thePopupMenuControllerFactory : XUIControllerFactory;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -0,0 +1,47 @@
/* -*- 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_theStatusbarControllerFactory_idl__
#define __com_sun_star_frame_theStatusbarControllerFactory_idl__
#include <com/sun/star/frame/XUIControllerFactory.idl>
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered status bar
controller.
<p>
A status bar controller can be registered for a command URL and a model
service name. A status bar will automatically create a status bar controller
if it contains a registered command URL.
</p>
Prior to LibreOffice 4.3, this singleton was only available as a
(single-instance) StatusbarControllerFactory service.
@since LibreOffice 4.3
*/
singleton theStatusbarControllerFactory : XUIControllerFactory;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -0,0 +1,41 @@
/*
* 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_theToolbarControllerFactory_idl__
#define __com_sun_star_frame_theToolbarControllerFactory_idl__
#include <com/sun/star/frame/XUIControllerFactory.idl>
module com { module sun { module star { module frame {
/** specifies a factory that creates instances of registered toolbar controller.
<p>
A toolbar controller can be registered for a command URL and a model service name.
</p>
Prior to LibreOffice 4.3, this singleton was only available as a
(single-instance) ToolbarControllerFactory service.
@since LibreOffice 4.3
*/
singleton theToolbarControllerFactory : XUIControllerFactory;
}; }; }; };
#endif

View File

@@ -253,7 +253,7 @@
#include <com/sun/star/frame/IllegalArgumentIOException.hpp>
#include <com/sun/star/frame/LayoutManagerEvents.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/frame/UntitledNumbersConst.hpp>
#include <com/sun/star/frame/XBorderResizeListener.hpp>

View File

@@ -23,7 +23,7 @@
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/theToolbarControllerFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <framework/sfxhelperfunctions.hxx>
@@ -147,7 +147,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController(
try
{
Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
Reference<frame::XUIControllerFactory> xFactory = frame::ToolbarControllerFactory::create( xContext );
Reference<frame::XUIControllerFactory> xFactory = frame::theToolbarControllerFactory::get( xContext );
OUString sModuleName (Tools::GetModuleName(rxFrame));
if (xFactory.is() && xFactory->hasController(rsCommandName, sModuleName))