diff options
-rw-r--r-- | desktop/source/app/app.cxx | 68 | ||||
-rw-r--r-- | framework/inc/dispatch/startmoduledispatcher.hxx | 9 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/inc/services/backingcomp.hxx | 2 | ||||
-rw-r--r-- | framework/source/dispatch/closedispatcher.cxx | 14 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchprovider.cxx | 2 | ||||
-rw-r--r-- | framework/source/dispatch/startmoduledispatcher.cxx | 25 | ||||
-rw-r--r-- | framework/source/fwe/classes/framelistanalyzer.cxx | 4 | ||||
-rw-r--r-- | framework/source/services/backingcomp.cxx | 4 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/frame/StartModule.idl | 41 |
11 files changed, 96 insertions, 75 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b7b9a6cef9d6..fc8248b65de9 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/StartModule.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/view/XPrintable.hpp> #include <com/sun/star/awt/XTopWindow.hpp> @@ -121,6 +122,7 @@ #endif #endif //WNT +using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; @@ -2562,7 +2564,6 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) case ApplicationEvent::TYPE_APPEAR: if ( !GetCommandLineArgs().IsInvisible() ) { - Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); // find active task - the active task is always a visible task @@ -2590,25 +2591,18 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) xContainerWindow = xBackingFrame->getContainerWindow(); if (xContainerWindow.is()) { - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - Reference< XController > xBackingComp( - xSMGR->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), - UNO_QUERY); - if (xBackingComp.is()) - { - Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(xBackingWin, xBackingComp); - xBackingComp->attachFrame(xBackingFrame); - xContainerWindow->setVisible(sal_True); - - Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow()); - if (pCompWindow) - pCompWindow->Update(); - } + Reference< XController > xStartModule = StartModule::createWithParentWindow(xContext, xContainerWindow); + Reference< ::com::sun::star::awt::XWindow > xBackingWin(xStartModule, UNO_QUERY); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state every time ... + xBackingFrame->setComponent(xBackingWin, xStartModule); + xStartModule->attachFrame(xBackingFrame); + xContainerWindow->setVisible(sal_True); + + Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow()); + if (pCompWindow) + pCompWindow->Update(); } } } @@ -2816,7 +2810,6 @@ void Desktop::ShowBackingComponent(Desktop * progress) return; } Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - Reference< css::lang::XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); if (progress != 0) { @@ -2834,29 +2827,22 @@ void Desktop::ShowBackingComponent(Desktop * progress) { progress->SetSplashScreenProgress(75); } - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - Reference< XController > xBackingComp( - xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY); - if (xBackingComp.is()) + Reference< XController > xStartModule = StartModule::createWithParentWindow( xContext, xContainerWindow); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state everytimes ... + xBackingFrame->setComponent(Reference< XWindow >(xStartModule, UNO_QUERY), xStartModule); + if (progress != 0) { - Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(xBackingWin, xBackingComp); - if (progress != 0) - { - progress->SetSplashScreenProgress(100); - } - xBackingComp->attachFrame(xBackingFrame); - if (progress != 0) - { - progress->CloseSplashScreen(); - } - xContainerWindow->setVisible(sal_True); + progress->SetSplashScreenProgress(100); + } + xStartModule->attachFrame(xBackingFrame); + if (progress != 0) + { + progress->CloseSplashScreen(); } + xContainerWindow->setVisible(sal_True); } } diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx index 373c333eccbb..9518b45b4150 100644 --- a/framework/inc/dispatch/startmoduledispatcher.hxx +++ b/framework/inc/dispatch/startmoduledispatcher.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/util/URL.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> #include <cppuhelper/weak.hxx> @@ -64,7 +65,7 @@ class StartModuleDispatcher : public css::lang::XTypeProvider /** @short reference to an uno service manager, which can be used to create own needed uno resources. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; //--------------------------------------- /** @short our "context" frame. */ @@ -88,8 +89,8 @@ class StartModuleDispatcher : public css::lang::XTypeProvider @descr Such "owner frame" is used as context for all related operations. - @param xSMGR - an uno service manager, which is needed to create uno resource + @param xContext + an UNO service manager, which is needed to create UNO resource internaly. @param xFrame @@ -98,7 +99,7 @@ class StartModuleDispatcher : public css::lang::XTypeProvider @param sTarget the original target information used for the related queryDispatch() call. */ - StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame , const ::rtl::OUString& sTarget); diff --git a/framework/inc/services.h b/framework/inc/services.h index f15cb46151ad..3e95ffd09d22 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -46,7 +46,6 @@ namespace framework{ #define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) -#define SERVICENAME_STARTMODULE DECLARE_ASCII("com.sun.star.frame.StartModule" ) #define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" ) #define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") diff --git a/framework/inc/services/backingcomp.hxx b/framework/inc/services/backingcomp.hxx index f54ef495fd03..bf1dd84533e3 100644 --- a/framework/inc/services/backingcomp.hxx +++ b/framework/inc/services/backingcomp.hxx @@ -63,7 +63,7 @@ class BackingComp : public css::lang::XTypeProvider , public css::lang::XInitialization , public css::frame::XController // => XComponent , public css::awt::XKeyListener // => XEventListener - // attention! Must be the first base class to guarentee right initialize lock ... + // attention! Must be the first base class to guarantee right initialize lock ... , private ThreadHelpBase , public ::cppu::OWeakObject { diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index eb9087e0ec79..1809a9e82631 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/CommandGroup.hpp> +#include <com/sun/star/frame/StartModule.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/document/XActionLockable.hpp> @@ -549,17 +550,14 @@ sal_Bool CloseDispatcher::implts_establishBackingMode() return sal_False; css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow(); - css::uno::Sequence< css::uno::Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - css::uno::Reference< css::frame::XController > xBackingComp( - xSMGR->createInstanceWithArguments(SERVICENAME_STARTMODULE, lArgs), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XController > xStartModule = css::frame::StartModule::createWithParentWindow( + comphelper::getComponentContext(xSMGR), xContainerWindow); // Attention: You MUST(!) call setComponent() before you call attachFrame(). - css::uno::Reference< css::awt::XWindow > xBackingWin(xBackingComp, css::uno::UNO_QUERY); - xFrame->setComponent(xBackingWin, xBackingComp); - xBackingComp->attachFrame(xFrame); + css::uno::Reference< css::awt::XWindow > xBackingWin(xStartModule, css::uno::UNO_QUERY); + xFrame->setComponent(xBackingWin, xStartModule); + xStartModule->attachFrame(xFrame); xContainerWindow->setVisible(sal_True); return sal_True; diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index ea2e7aa86481..6185fc34e247 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -651,7 +651,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat case E_STARTMODULEDISPATCHER : { - StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( xFactory, xOwner, sTarget ); + StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( comphelper::getComponentContext(xFactory), xOwner, sTarget ); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } break; diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx index ed7959d41116..d5a3d93d697a 100644 --- a/framework/source/dispatch/startmoduledispatcher.cxx +++ b/framework/source/dispatch/startmoduledispatcher.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/CommandGroup.hpp> +#include <com/sun/star/frame/StartModule.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include "com/sun/star/beans/XFastPropertySet.hpp" #include <com/sun/star/frame/XModuleManager.hpp> @@ -67,12 +68,12 @@ DEFINE_XTYPEPROVIDER_4(StartModuleDispatcher , css::frame::XDispatch ) //----------------------------------------------- -StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame , const ::rtl::OUString& sTarget) : ThreadHelpBase (&Application::GetSolarMutex() ) , ::cppu::OWeakObject( ) - , m_xSMGR (xSMGR ) + , m_xContext (rxContext ) , m_xOwner (xFrame ) , m_sDispatchTarget (sTarget ) , m_lStatusListener (m_aLock.getShareableOslMutex()) @@ -148,12 +149,12 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY); + css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY); FrameListAnalyzer aCheck( xDesktop, @@ -179,21 +180,15 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XDesktop2> xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ); - css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame (SPECIALTARGET_BLANK, 0); - css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow (); - - css::uno::Sequence< css::uno::Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - - css::uno::Reference< css::frame::XController > xStartModule( - xSMGR->createInstanceWithArguments(SERVICENAME_STARTMODULE, lArgs), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2> xDesktop = css::frame::Desktop::create( xContext ); + css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame(SPECIALTARGET_BLANK, 0); + css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow(); + css::uno::Reference< css::frame::XController > xStartModule = css::frame::StartModule::createWithParentWindow(xContext, xContainerWindow); css::uno::Reference< css::awt::XWindow > xComponentWindow(xStartModule, css::uno::UNO_QUERY); xFrame->setComponent(xComponentWindow, xStartModule); xStartModule->attachFrame(xFrame); diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 8d781c5898c4..a223b3db41e9 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -126,7 +126,7 @@ void FrameListAnalyzer::impl_analyze() css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(m_xReferenceFrame); - m_bReferenceIsBacking = sModule.equals(SERVICENAME_STARTMODULE); + m_bReferenceIsBacking = sModule.equals("com.sun.star.frame.StartModule"); } catch(const css::frame::UnknownModuleException&) { @@ -201,7 +201,7 @@ void FrameListAnalyzer::impl_analyze() css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(xFrame); - if (sModule.equals(SERVICENAME_STARTMODULE)) + if (sModule.equals("com.sun.star.frame.StartModule")) { m_xBackingComponent = xFrame; continue; diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index 60e9ced7c611..43f808eaad74 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -268,7 +268,7 @@ sal_Bool SAL_CALL BackingComp::supportsService( /*IN*/ const ::rtl::OUString& sS throw(css::uno::RuntimeException) { return ( - sServiceName.equals(SERVICENAME_STARTMODULE ) || + sServiceName.equals("com.sun.star.frame.StartModule") || sServiceName.equals(SERVICENAME_FRAMECONTROLLER) ); } @@ -326,7 +326,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL BackingComp::getSupportedServiceN css::uno::Sequence< ::rtl::OUString > BackingComp::impl_getStaticSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lNames(1); - lNames[0] = SERVICENAME_STARTMODULE; + lNames[0] = "com.sun.star.frame.StartModule"; return lNames; } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index da456f444b9b..6677b3f655d4 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -132,6 +132,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ MediaTypeDetectionHelper \ ModuleManager \ PopupMenuControllerFactory \ + StartModule \ ToolBarControllerFactory \ UICommandDescription \ )) diff --git a/offapi/com/sun/star/frame/StartModule.idl b/offapi/com/sun/star/frame/StartModule.idl new file mode 100644 index 000000000000..8af9903cb526 --- /dev/null +++ b/offapi/com/sun/star/frame/StartModule.idl @@ -0,0 +1,41 @@ +/* -*- 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_StartModule_idl__ +#define __com_sun_star_frame_StartModule_idl__ + +#include <com/sun/star/awt/XWindow.idl> +#include <com/sun/star/frame/XController.idl> + + + module com { module sun { module star { module frame { + +/** + @since LibreOffice 4.1 + */ +service StartModule : com::sun::star::frame::XController +{ + createWithParentWindow([in] com::sun::star::awt::XWindow ContainerWindow); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |