summaryrefslogtreecommitdiff
path: root/framework/source/uielement
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2013-04-26 21:55:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-22 11:34:39 +0100
commit8b6d5901d8476e8a3ff72c8d50d53f961849111a (patch)
treec8efef761128d671652142e73440115bbeee47ee /framework/source/uielement
parent7eb678e353f21d12d2e64a0b2a71ec917a2b53cc (diff)
UI Controller Factory fixes
- "ModuleName" --> "ModuleIdentifier": the IDL definition for css::frame::PopupMenuControllerFactory and css::frame::StatusbarControllerFactory tells to use a property named "ModuleIdentifier", but in the code it is named "ModuleName" - Undocumented css::frame::ToolbarControllerFactory - Fix service name of ToolbarControllerFactory (ToolbarControllerFactory instead of ToolBarControllerFactory) - Convert the three service factories to new style, and use these new-style services in the source code - Implement multiple inheritance: added new css::frame::XUIControllerFactory - Added a (true) base class and implemented the three factories in a single file (cherry picked from commit acc7fed28f54f836b0923180431a0c180f91e98c) Conflicts: framework/inc/pch/precompiled_framework.hxx framework/inc/uielement/toolbarmanager.hxx framework/inc/uifactory/popupmenucontrollerfactory.hxx framework/inc/uifactory/statusbarcontrollerfactory.hxx framework/inc/uifactory/uicontrollerfactory.hxx framework/source/uielement/addonstoolbarmanager.cxx framework/source/uielement/menubarmanager.cxx framework/source/uielement/popupmenucontroller.cxx framework/source/uielement/statusbarmanager.cxx framework/source/uielement/toolbarmanager.cxx framework/source/uifactory/popupmenucontrollerfactory.cxx framework/source/uifactory/statusbarcontrollerfactory.cxx framework/source/uifactory/uicontrollerfactory.cxx framework/source/unotypes/fwk.xml offapi/com/sun/star/frame/PopupMenuControllerFactory.idl offapi/com/sun/star/frame/StatusbarControllerFactory.idl offapi/com/sun/star/frame/makefile.mk svtools/source/uno/toolboxcontroller.cxx Change-Id: Ia8580539badf650a84bc6e57a6b832071e011f0a (cherry picked from commit 8b050d1e91a6623fb2770421e564a74d6259d816)
Diffstat (limited to 'framework/source/uielement')
-rw-r--r--framework/source/uielement/addonstoolbarmanager.cxx65
-rw-r--r--framework/source/uielement/menubarmanager.cxx82
-rw-r--r--framework/source/uielement/popupmenucontroller.cxx10
-rw-r--r--framework/source/uielement/statusbarmanager.cxx86
-rw-r--r--framework/source/uielement/toolbarmanager.cxx65
5 files changed, 144 insertions, 164 deletions
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index b0992eeac48d..0bde95d0ccae 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -221,8 +221,6 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
{
}
- Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
-
sal_uInt32 nElements( 0 );
sal_Bool bAppendSeparator( sal_False );
Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
@@ -279,42 +277,39 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
sal_Bool bMustBeInit( sal_True );
// Support external toolbar controller for add-ons!
- if ( m_xToolbarControllerRegistration.is() &&
- m_xToolbarControllerRegistration->hasController( aURL, m_aModuleIdentifier ))
+ if ( m_xToolbarControllerFactory.is() &&
+ m_xToolbarControllerFactory->hasController( aURL, m_aModuleIdentifier ))
{
- if ( xToolbarControllerFactory.is() )
+ Sequence< Any > aArgs(5);
+ PropertyValue aPropValue;
+
+ aPropValue.Name = OUString( "ModuleIdentifier" );
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aArgs[0] <<= aPropValue;
+ aPropValue.Name = OUString( "Frame" );
+ aPropValue.Value <<= m_xFrame;
+ aArgs[1] <<= aPropValue;
+ aPropValue.Name = OUString( "ServiceManager" );
+ Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
+ aPropValue.Value <<= xMSF;
+ aArgs[2] <<= aPropValue;
+ aPropValue.Name = OUString( "ParentWindow" );
+ aPropValue.Value <<= xToolbarWindow;
+ aArgs[3] <<= aPropValue;
+ aPropValue.Name = OUString( "ItemId" );
+ aPropValue.Value = makeAny( sal_Int32( nId ));
+ aArgs[4] <<= aPropValue;
+
+ try
+ {
+ xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
+ aURL, aArgs, m_xContext ),
+ UNO_QUERY );
+ }
+ catch ( uno::Exception& )
{
- Sequence< Any > aArgs(5);
- PropertyValue aPropValue;
-
- aPropValue.Name = OUString( "ModuleName" );
- aPropValue.Value <<= m_aModuleIdentifier;
- aArgs[0] <<= aPropValue;
- aPropValue.Name = OUString( "Frame" );
- aPropValue.Value <<= m_xFrame;
- aArgs[1] <<= aPropValue;
- aPropValue.Name = OUString( "ServiceManager" );
- Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
- aPropValue.Value <<= xMSF;
- aArgs[2] <<= aPropValue;
- aPropValue.Name = OUString( "ParentWindow" );
- aPropValue.Value <<= xToolbarWindow;
- aArgs[3] <<= aPropValue;
- aPropValue.Name = OUString( "ItemId" );
- aPropValue.Value = makeAny( sal_Int32( nId ));
- aArgs[4] <<= aPropValue;
-
- try
- {
- xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
- aURL, aArgs, m_xContext ),
- UNO_QUERY );
- }
- catch ( const uno::Exception& )
- {
- }
- bMustBeInit = sal_False; // factory called init already!
}
+ bMustBeInit = sal_False; // factory called init already!
}
else
{
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 91e7df87f2df..f8a330b9590a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -31,6 +31,7 @@
#include <classes/resource.hrc>
#include <services.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -42,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/XUIControllerRegistration.hpp>
+#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/lang/SystemDependent.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/ItemType.hpp>
@@ -182,9 +183,7 @@ MenuBarManager::MenuBarManager(
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" );
- m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
- getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
- UNO_QUERY );
+ m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create(m_xContext);
FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren );
}
@@ -387,7 +386,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException )
m_xModuleAcceleratorManager.clear();
m_xDocAcceleratorManager.clear();
m_xUICommandLabels.clear();
- m_xPopupMenuControllerRegistration.clear();
+ m_xPopupMenuControllerFactory.clear();
m_xContext.clear();
}
}
@@ -953,7 +952,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
sal_Bool bPopupMenu( sal_False );
if ( !pMenuItemHandler->xPopupMenuController.is() &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, OUString() ))
+ m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() ))
{
bPopupMenu = CreatePopupMenuController( pMenuItemHandler );
}
@@ -1188,36 +1187,32 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
OUString aItemCommand( pMenuItemHandler->aMenuItemURL );
// Try instanciate a popup menu controller. It is stored in the menu item handler.
- Reference< XMultiComponentFactory > xPopupMenuControllerFactory( m_xPopupMenuControllerRegistration, UNO_QUERY );
- if ( xPopupMenuControllerFactory.is() )
+ if ( !m_xPopupMenuControllerFactory.is() )
+ return sal_False;
+
+ Sequence< Any > aSeq( 2 );
+ PropertyValue aPropValue;
+
+ aPropValue.Name = OUString( "ModuleIdentifier" );
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aSeq[0] <<= aPropValue;
+ aPropValue.Name = OUString( "Frame" );
+ aPropValue.Value <<= m_xFrame;
+ aSeq[1] <<= aPropValue;
+
+ Reference< XPopupMenuController > xPopupMenuController(
+ m_xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(
+ aItemCommand,
+ aSeq,
+ m_xContext ),
+ UNO_QUERY );
+
+ if ( xPopupMenuController.is() )
{
- 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;
- }
+ // Provide our awt popup menu to the popup menu controller
+ pMenuItemHandler->xPopupMenuController = xPopupMenuController;
+ xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu );
+ return sal_True;
}
return sal_False;
@@ -1311,9 +1306,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
pMenu->SetHelpCommand( nItemId, aEmpty );
}
- if ( m_xPopupMenuControllerRegistration.is() &&
+ if ( m_xPopupMenuControllerFactory.is() &&
pPopup->GetItemCount() == 0 &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, OUString() )
+ m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() )
)
{
// Check if we have to create a popup menu for a uno based popup menu controller.
@@ -1446,8 +1441,8 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
MenuItemHandler* pItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch );
pItemHandler->aMenuItemURL = aItemCommand;
- if ( m_xPopupMenuControllerRegistration.is() &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, OUString() ))
+ if ( m_xPopupMenuControllerFactory.is() &&
+ m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() ))
{
// 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
@@ -2020,9 +2015,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen
m_bIsBookmarkMenu = sal_True;
OUString aModuleIdentifier;
- m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
- getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
- UNO_QUERY );
+ m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create(
+ ::comphelper::getProcessComponentContext());
Reference< XStatusListener > xStatusListener;
Reference< XDispatch > xDispatch;
@@ -2069,8 +2063,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen
// 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.
- if ( m_xPopupMenuControllerRegistration.is() &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, OUString() ))
+ if ( m_xPopupMenuControllerFactory.is() &&
+ m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() ))
{
VCLXPopupMenu* pVCLXPopupMenu = new VCLXPopupMenu;
PopupMenu* pCtlPopupMenu = (PopupMenu *)pVCLXPopupMenu->GetMenu();
diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx
index 571b5cb03dfc..76e89490a7c8 100644
--- a/framework/source/uielement/popupmenucontroller.cxx
+++ b/framework/source/uielement/popupmenucontroller.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <toolkit/helper/vclunohelper.hxx>
@@ -155,22 +156,19 @@ void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException)
bool PopupMenuController::CreatePopupMenuController() throw (Exception)
{
- Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW );
+ Reference< XMultiComponentFactory > xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext );
Sequence< Any > aSeq( 2 );
PropertyValue aPropValue;
- aPropValue.Name = OUString( "ModuleName" );
+ aPropValue.Name = OUString( "ModuleIdentifier" );
aPropValue.Value <<= getModuleName();
aSeq[0] <<= aPropValue;
aPropValue.Name = OUString( "Frame" );
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
- Reference< XComponentContext > xComponentContext(
- comphelper::getComponentContext( getServiceManager() ) );
-
- Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY );
+ Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, m_xContext ), UNO_QUERY );
if ( xPopupMenuController.is() )
{
mxPopupMenuController = xPopupMenuController;
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 35f8930b5cd2..fb8ce454c3f3 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/StatusbarControllerFactory.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
#include <com/sun/star/ui/ItemType.hpp>
@@ -49,6 +50,7 @@
#include <toolkit/unohlp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/statusbarcontroller.hxx>
+#include <comphelper/processfactory.hxx>
#include <vcl/status.hxx>
#include <vcl/svapp.hxx>
@@ -172,10 +174,8 @@ StatusBarManager::StatusBarManager(
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" );
- if ( m_xServiceManager.is() )
- m_xStatusbarControllerRegistration = uno::Reference< css::frame::XUIControllerRegistration >(
- m_xServiceManager->createInstance( SERVICENAME_STATUSBARCONTROLLERFACTORY ),
- uno::UNO_QUERY );
+ m_xStatusbarControllerFactory = frame::StatusbarControllerFactory::create(
+ ::comphelper::getProcessComponentContext());
m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) );
m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) );
@@ -353,7 +353,6 @@ OUString StatusBarManager::RetrieveLabelFromCommand( const OUString& aCmdURL )
void StatusBarManager::CreateControllers()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" );
- uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xComponentContext(
comphelper::getComponentContext( m_xServiceManager ) );
uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar );
@@ -375,47 +374,44 @@ void StatusBarManager::CreateControllers()
svt::StatusbarController* pController( 0 );
// 1º) UNO Statusbar controllers, registered in Controllers.xcu
- if ( m_xStatusbarControllerRegistration.is() &&
- m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier ))
+ if ( m_xStatusbarControllerFactory.is() &&
+ m_xStatusbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier ))
{
- if ( xStatusbarControllerFactory.is() )
- {
- beans::PropertyValue aPropValue;
- std::vector< uno::Any > aPropVector;
-
- aPropValue.Name = OUString( "ModuleName" );
- aPropValue.Value = uno::makeAny( m_aModuleIdentifier );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = uno::makeAny( m_xFrame );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- // TODO remove this
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- aPropValue.Value = uno::makeAny( m_xServiceManager );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
- aPropValue.Value = uno::makeAny( xStatusbarWindow );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- // TODO still needing with the css::ui::XStatusbarItem?
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" ));
- aPropValue.Value = uno::makeAny( nId );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" ));
- aPropValue.Value <<= xStatusbarItem;
- aPropVector.push_back( uno::makeAny( aPropValue ) );
-
- uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) );
- xController = uno::Reference< frame::XStatusListener >(
- xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
- aCommandURL, aArgs, xComponentContext ),
- uno::UNO_QUERY );
- bInit = sal_False; // Initialization is done through the factory service
- }
+ beans::PropertyValue aPropValue;
+ std::vector< uno::Any > aPropVector;
+
+ aPropValue.Name = OUString( "ModuleIdentifier" );
+ aPropValue.Value = uno::makeAny( m_aModuleIdentifier );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ aPropValue.Name = OUString( "Frame" );
+ aPropValue.Value = uno::makeAny( m_xFrame );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ // TODO remove this
+ aPropValue.Name = OUString( "ServiceManager" );
+ aPropValue.Value = uno::makeAny( m_xServiceManager );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ aPropValue.Name = OUString( "ParentWindow" );
+ aPropValue.Value = uno::makeAny( xStatusbarWindow );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ // TODO still needing with the css::ui::XStatusbarItem?
+ aPropValue.Name = OUString( "Identifier" );
+ aPropValue.Value = uno::makeAny( nId );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ aPropValue.Name = OUString( "StatusbarItem" );
+ aPropValue.Value <<= xStatusbarItem;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+ uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) );
+ xController = uno::Reference< frame::XStatusListener >(
+ m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
+ aCommandURL, aArgs, xComponentContext ),
+ uno::UNO_QUERY );
+ bInit = sal_False; // Initialization is done through the factory service
}
if ( !xController.is() )
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index ca4e2cfc3a99..05f15ba3fb2c 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIElementSettings.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
@@ -229,7 +230,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
if ( pWindow )
((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar );
- m_xToolbarControllerRegistration = frame::ToolBarControllerFactory::create( m_xContext );
+ m_xToolbarControllerFactory = frame::ToolbarControllerFactory::create( m_xContext );
m_xURLTransformer = URLTransformer::create( m_xContext );
m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) );
@@ -873,7 +874,6 @@ void ToolBarManager::CreateControllers()
{
RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" );
- Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
css::util::URL aURL;
@@ -908,41 +908,38 @@ void ToolBarManager::CreateControllers()
}
}
- if ( m_xToolbarControllerRegistration.is() &&
- m_xToolbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier ))
+ if ( m_xToolbarControllerFactory.is() &&
+ m_xToolbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier ))
{
- if ( xToolbarControllerFactory.is() )
+ PropertyValue aPropValue;
+ std::vector< Any > aPropertyVector;
+
+ aPropValue.Name = OUString( "ModuleIdentifier" );
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+ aPropValue.Name = OUString( "Frame" );
+ aPropValue.Value <<= m_xFrame;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+ aPropValue.Name = OUString( "ServiceManager" );
+ Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
+ aPropValue.Value <<= xMSF;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+ aPropValue.Name = OUString( "ParentWindow" );
+ aPropValue.Value <<= xToolbarWindow;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+
+ if ( nWidth > 0 )
{
- PropertyValue aPropValue;
- std::vector< Any > aPropertyVector;
-
- aPropValue.Name = OUString( "ModuleName" );
- aPropValue.Value <<= m_aModuleIdentifier;
+ aPropValue.Name = OUString( "Width" );
+ aPropValue.Value <<= nWidth;
aPropertyVector.push_back( makeAny( aPropValue ));
- aPropValue.Name = OUString( "Frame" );
- aPropValue.Value <<= m_xFrame;
- aPropertyVector.push_back( makeAny( aPropValue ));
- aPropValue.Name = OUString( "ServiceManager" );
- Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
- aPropValue.Value <<= xMSF;
- aPropertyVector.push_back( makeAny( aPropValue ));
- aPropValue.Name = OUString( "ParentWindow" );
- aPropValue.Value <<= xToolbarWindow;
- aPropertyVector.push_back( makeAny( aPropValue ));
-
- if ( nWidth > 0 )
- {
- aPropValue.Name = OUString( "Width" );
- aPropValue.Value <<= nWidth;
- aPropertyVector.push_back( makeAny( aPropValue ));
- }
-
- Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector ));
- xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
- aCommandURL, aArgs, m_xContext ),
- UNO_QUERY );
- bInit = sal_False; // Initialization is done through the factory service
}
+
+ Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector ));
+ xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
+ aCommandURL, aArgs, m_xContext ),
+ UNO_QUERY );
+ bInit = sal_False; // Initialization is done through the factory service
}
if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId)))
@@ -1040,7 +1037,7 @@ void ToolBarManager::CreateControllers()
aPropValue.Name = OUString( "ParentWindow" );
aPropValue.Value <<= xToolbarWindow;
aPropertyVector.push_back( makeAny( aPropValue ));
- aPropValue.Name = OUString( "ModuleName" );
+ aPropValue.Name = OUString( "ModuleIdentifier" );
aPropValue.Value <<= m_aModuleIdentifier;
aPropertyVector.push_back( makeAny( aPropValue ));