summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-14 12:58:00 +0200
committerNoel Grandin <noel@peralex.com>2012-12-21 10:57:09 +0200
commitbb121c864cc3c101ef733a4088c7ba3e36eced14 (patch)
tree2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /framework
parent6d818ed651aaafcfb12ebc21449d35947d2e85a9 (diff)
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface because it introduced method name conflicts (addEventListener). Shouldn't be an issue since it was scheduled to be dropped anyhow, and the service implementation still implements it, so existing clients will be fine. I dropped the interface XPropertySet from the combined IDL because nobody seems to be using it, and it's primary purpose appears to be to set weird flags. I dropped the optional interfaces XStatusIndicatorFactory XDispatchInformationProvider from the combined IDL because the service does not implement them, and nobody seems to be using them. I suspect they were mistakenly copied from XFrame. I also did not convert the Title, UserDefinedAttributes and LayoutManager properties to attributes, again because no-one is using them. Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/classes/menumanager.hxx2
-rw-r--r--framework/inc/jobs/helponstartup.hxx9
-rw-r--r--framework/inc/jobs/job.hxx4
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/inc/services/desktop.hxx9
-rw-r--r--framework/source/classes/menumanager.cxx75
-rw-r--r--framework/source/classes/taskcreator.cxx3
-rw-r--r--framework/source/dispatch/closedispatcher.cxx10
-rw-r--r--framework/source/dispatch/startmoduledispatcher.cxx7
-rw-r--r--framework/source/jobs/helponstartup.cxx24
-rw-r--r--framework/source/jobs/job.cxx18
-rw-r--r--framework/source/loadenv/loadenv.cxx7
-rw-r--r--framework/source/services/autorecovery.cxx13
-rw-r--r--framework/source/services/backingwindow.cxx8
-rw-r--r--framework/source/services/backingwindow.hxx1
-rw-r--r--framework/source/services/desktop.cxx10
-rw-r--r--framework/source/services/sessionlistener.cxx4
-rw-r--r--framework/source/uielement/menubarmanager.cxx35
18 files changed, 111 insertions, 129 deletions
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index 81e1711b4fef..8e2ac6f076e8 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -83,7 +83,7 @@ class MenuManager : public ThreadHelpBase ,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
- static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
+ static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,IMutex& _rMutex);
static void FillMenuImages(
::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,
Menu* _pMenu,
diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx
index 4111c98bbae0..09f949aae37b 100644
--- a/framework/inc/jobs/helponstartup.hxx
+++ b/framework/inc/jobs/helponstartup.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/task/XJob.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
@@ -53,7 +54,7 @@ class HelpOnStartup : private ThreadHelpBase
//.......................................
/** @short reference to an uno service manager. */
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
//.......................................
/** @short such module manager is used to classify new opened documents. */
@@ -61,7 +62,7 @@ class HelpOnStartup : private ThreadHelpBase
//.......................................
/** @short is needed to locate a might open help frame. */
- css::uno::Reference< css::frame::XFrame > m_xDesktop;
+ css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
//.......................................
/** @short provides read access to the underlying configuration. */
@@ -86,11 +87,11 @@ class HelpOnStartup : private ThreadHelpBase
//---------------------------------------
/** @short create new instance of this class.
- @param xSMGR
+ @param xContext
reference to the uno service manager, which created this instance.
Can be used later to create own needed uno resources on demand.
*/
- HelpOnStartup(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+ HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext);
//---------------------------------------
/** @short does nothing real ...
diff --git a/framework/inc/jobs/job.hxx b/framework/inc/jobs/job.hxx
index cd03bff7c824..7f18dc69a18f 100644
--- a/framework/inc/jobs/job.hxx
+++ b/framework/inc/jobs/job.hxx
@@ -32,7 +32,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp>
#include <com/sun/star/task/XJobListener.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
@@ -128,7 +128,7 @@ class Job : public css::lang::XTypeProvider
We are registered at this instance to listen for office shutdown events.
It's neccessary supress it (if possible) or to react in the right way.
*/
- css::uno::Reference< css::frame::XDesktop > m_xDesktop;
+ css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
/**
A job can return a dispatch result event after finishing its work.
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 6606328fcab5..e3131365e2ec 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -29,7 +29,6 @@ namespace framework{
//_________________________________________________________________________________________________________________
#define SERVICENAME_FRAME DECLARE_ASCII("com.sun.star.frame.Frame" )
-#define SERVICENAME_DESKTOP DECLARE_ASCII("com.sun.star.frame.Desktop" )
#define SERVICENAME_TASK DECLARE_ASCII("com.sun.star.frame.Task" )
#define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" )
#define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" )
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 0f5c65d1a3f9..d6d2aaea260f 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -32,7 +32,7 @@
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/WindowArrange.hpp>
#include <com/sun/star/frame/TerminationVetoException.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
@@ -47,7 +47,6 @@
#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/FrameAction.hpp>
-#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/frame/XTasksSupplier.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -107,12 +106,8 @@ enum ELoadState
class Desktop : // interfaces
public css::lang::XTypeProvider ,
public css::lang::XServiceInfo ,
- public css::frame::XDesktop ,
- public css::frame::XComponentLoader ,
+ public css::frame::XDesktop2 ,
public css::frame::XTasksSupplier ,
- public css::frame::XDispatchProvider ,
- public css::frame::XDispatchProviderInterception,
- public css::frame::XFramesSupplier , // => XFrame => XComponent
public css::frame::XDispatchResultListener , // => XEventListener
public css::task::XInteractionHandler ,
public css::frame::XUntitledNumbers ,
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index d12f80c54555..54e4dc34ffd1 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/util/XStringWidth.hpp>
@@ -622,39 +622,35 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
}
-void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
+void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComponentContext >& xContext,framework::IMutex& _rMutex )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
- Reference< XDesktop > xDesktop( xServiceFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( xContext );
sal_uInt16 nActiveItemId = 0;
sal_uInt16 nItemId = START_ITEMID_WINDOWLIST;
- if ( xDesktop.is() )
+ Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
+ Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ sal_Int32 nFrameCount = xList->getCount();
+ aNewWindowListVector.reserve(nFrameCount);
+ for (sal_Int32 i=0; i<nFrameCount; ++i )
{
- Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
- Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
- Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
- sal_Int32 nCount = xList->getCount();
- aNewWindowListVector.reserve(nCount);
- for (sal_Int32 i=0; i<nCount; ++i )
+ Reference< XFrame > xFrame;
+ xList->getByIndex(i) >>= xFrame;
+
+ if (xFrame.is())
{
- Reference< XFrame > xFrame;
- xList->getByIndex(i) >>= xFrame;
+ if ( xFrame == xCurrentFrame )
+ nActiveItemId = nItemId;
- if (xFrame.is())
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ if ( pWin && pWin->IsVisible() )
{
- if ( xFrame == xCurrentFrame )
- nActiveItemId = nItemId;
-
- Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- if ( pWin && pWin->IsVisible() )
- {
- aNewWindowListVector.push_back( pWin->GetText() );
- ++nItemId;
- }
+ aNewWindowListVector.push_back( pWin->GetText() );
+ ++nItemId;
}
}
}
@@ -767,7 +763,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
if ( m_aMenuItemCommand == aSpecialFileMenu || m_aMenuItemCommand == aSlotSpecialFileMenu || aCommand == aSpecialFileCommand )
UpdateSpecialFileMenu( pMenu );
else if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu, getServiceFactory(), m_aLock );
+ UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock );
// Check if some modes have changed so we have to update our menu images
if ( bShowMenuImages != m_bShowMenuImages )
@@ -866,28 +862,25 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
{
// window list menu item selected
- Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) );
- if ( xDesktop.is() )
+ sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
+ Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ sal_Int32 nCount = xList->getCount();
+ for ( sal_Int32 i=0; i<nCount; ++i )
{
- sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
- Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
- sal_Int32 nCount = xList->getCount();
- for ( sal_Int32 i=0; i<nCount; ++i )
- {
- Reference< XFrame > xFrame;
- xList->getByIndex(i) >>= xFrame;
+ Reference< XFrame > xFrame;
+ xList->getByIndex(i) >>= xFrame;
- if ( xFrame.is() && nTaskId == nCurItemId )
- {
- Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- pWin->GrabFocus();
- pWin->ToTop( TOTOP_RESTOREWHENMIN );
- break;
- }
-
- nTaskId++;
+ if ( xFrame.is() && nTaskId == nCurItemId )
+ {
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ pWin->GrabFocus();
+ pWin->ToTop( TOTOP_RESTOREWHENMIN );
+ break;
}
+
+ nTaskId++;
}
}
else
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index 74e212bdc6d2..87dd6d302073 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -23,6 +23,7 @@
#include <loadenv/targethelper.hxx>
#include <services.h>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -102,7 +103,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl::
css::beans::NamedValue aArg ;
aArg.Name = rtl::OUString(ARGUMENT_PARENTFRAME);
- aArg.Value <<= css::uno::Reference< css::frame::XFrame >(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ aArg.Value <<= css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW);
lArgs[0] <<= aArg;
aArg.Name = rtl::OUString(ARGUMENT_CREATETOPWINDOW);
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index 258b5b575acd..675c507ab898 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -25,7 +25,7 @@
#include <services.h>
#include <general.h>
-#include <com/sun/star/frame/XDesktop.hpp>
+#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/lang/DisposedException.hpp>
@@ -39,6 +39,7 @@
#include "vcl/syswin.hxx"
#include <osl/mutex.hxx>
#include <unotools/moduleoptions.hxx>
+#include <comphelper/processfactory.hxx>
using namespace com::sun::star;
@@ -299,7 +300,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback)
// Analyze the environment a first time.
// If we found some special cases, we can
// make some decisions erliar!
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create(comphelper::getComponentContext(xSMGR)), css::uno::UNO_QUERY_THROW);
FrameListAnalyzer aCheck1(xDesktop, xCloseFrame, FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT);
// a) If the curent frame (where the close dispatch was requested for) does not have
@@ -471,7 +472,7 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW);
FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL);
sal_Int32 c = aCheck.m_lModelFrames.getLength();
@@ -573,8 +574,7 @@ sal_Bool CloseDispatcher::implts_terminateApplication()
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::frame::XDesktop > xDesktop(
- xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) );
return xDesktop->terminate();
}
diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx
index c609a83a6ecb..ed7959d41116 100644
--- a/framework/source/dispatch/startmoduledispatcher.cxx
+++ b/framework/source/dispatch/startmoduledispatcher.cxx
@@ -29,7 +29,7 @@
#include <services.h>
#include <general.h>
-#include <com/sun/star/frame/XDesktop.hpp>
+#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/awt/XTopWindow.hpp>
@@ -41,6 +41,7 @@
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <unotools/moduleoptions.hxx>
+#include <comphelper/processfactory.hxx>
namespace framework{
@@ -152,7 +153,7 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
// <- SAFE ----------------------------------
css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
- xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY);
FrameListAnalyzer aCheck(
xDesktop,
@@ -182,7 +183,7 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ 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 ();
diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx
index 3d1285e3c222..0d90cf279467 100644
--- a/framework/source/jobs/helponstartup.cxx
+++ b/framework/source/jobs/helponstartup.cxx
@@ -39,7 +39,7 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
namespace framework{
@@ -69,7 +69,7 @@ static ::rtl::OUString ENVTYPE_DOCUMENTEVENT ("DOCUMENTEVENT");
//-----------------------------------------------
-DEFINE_XSERVICEINFO_MULTISERVICE(HelpOnStartup ,
+DEFINE_XSERVICEINFO_MULTISERVICE_2(HelpOnStartup ,
::cppu::OWeakObject ,
SERVICENAME_JOB ,
IMPLEMENTATIONNAME_HELPONSTARTUP)
@@ -82,23 +82,20 @@ DEFINE_INIT_SERVICE(HelpOnStartup,
see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
*/
// create some needed uno services and cache it
- css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getComponentContext(m_xSMGR);
- m_xModuleManager = css::frame::ModuleManager::create( xContext );
+ m_xModuleManager = css::frame::ModuleManager::create( m_xContext );
- m_xDesktop = css::uno::Reference< css::frame::XFrame >(
- m_xSMGR->createInstance(SERVICENAME_DESKTOP),
- css::uno::UNO_QUERY_THROW);
+ m_xDesktop = css::frame::Desktop::create(m_xContext);
m_xConfig = css::uno::Reference< css::container::XNameAccess >(
::comphelper::ConfigurationHelper::openConfig(
- xContext,
+ m_xContext,
CFG_PACKAGE_MODULES,
::comphelper::ConfigurationHelper::E_READONLY),
css::uno::UNO_QUERY_THROW);
// ask for office locale
::comphelper::ConfigurationHelper::readDirectKey(
- xContext,
+ m_xContext,
CFG_PACKAGE_SETUP,
CFG_PATH_L10N,
CFG_KEY_LOCALE,
@@ -106,7 +103,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup,
// detect system
::comphelper::ConfigurationHelper::readDirectKey(
- xContext,
+ m_xContext,
CFG_PACKAGE_COMMON,
CFG_PATH_HELP,
CFG_KEY_HELPSYSTEM,
@@ -128,9 +125,9 @@ DEFINE_INIT_SERVICE(HelpOnStartup,
)
//-----------------------------------------------
-HelpOnStartup::HelpOnStartup(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+HelpOnStartup::HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext)
: ThreadHelpBase( )
- , m_xSMGR (xSMGR)
+ , m_xContext (xContext)
{
}
@@ -265,7 +262,7 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent)
{
// SAFE ->
ResetableGuard aLock(m_aLock);
- css::uno::Reference< css::frame::XFrame > xDesktop = m_xDesktop;
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = m_xDesktop;
aLock.unlock();
// <- SAFE
@@ -310,7 +307,6 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent)
// SAFE ->
ResetableGuard aLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (m_xSMGR, css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::container::XNameAccess > xConfig = m_xConfig;
::rtl::OUString sLocale = m_sLocale;
::rtl::OUString sSystem = m_sSystem;
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index 62ec7ebdd573..a38c2f499c92 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -23,6 +23,7 @@
#include <general.h>
#include <services.h>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/task/XJob.hpp>
#include <com/sun/star/task/XAsyncJob.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
@@ -337,7 +338,7 @@ void Job::die()
m_xJob = css::uno::Reference< css::uno::XInterface >();
m_xFrame = css::uno::Reference< css::frame::XFrame >();
m_xModel = css::uno::Reference< css::frame::XModel >();
- m_xDesktop = css::uno::Reference< css::frame::XDesktop >();
+ m_xDesktop = css::uno::Reference< css::frame::XDesktop2 >();
m_xResultListener = css::uno::Reference< css::frame::XDispatchResultListener >();
m_xResultSourceFake = css::uno::Reference< css::uno::XInterface >();
m_bPendingCloseFrame = sal_False;
@@ -541,17 +542,14 @@ void Job::impl_startListening()
{
try
{
- m_xDesktop = css::uno::Reference< css::frame::XDesktop >(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ m_xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) );
css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- if (m_xDesktop.is())
- {
- m_xDesktop->addTerminateListener(xThis);
- m_bListenOnDesktop = sal_True;
- }
+ m_xDesktop->addTerminateListener(xThis);
+ m_bListenOnDesktop = sal_True;
}
catch(const css::uno::Exception&)
{
- m_xDesktop = css::uno::Reference< css::frame::XDesktop >();
+ m_xDesktop.clear();
}
}
@@ -614,7 +612,7 @@ void Job::impl_stopListening()
{
css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this) , css::uno::UNO_QUERY);
m_xDesktop->removeTerminateListener(xThis);
- m_xDesktop = css::uno::Reference< css::frame::XDesktop >();
+ m_xDesktop.clear();
m_bListenOnDesktop = sal_False;
}
catch(const css::uno::Exception&)
@@ -887,7 +885,7 @@ void SAL_CALL Job::disposing( const css::lang::EventObject& aEvent ) throw(css::
if (m_xDesktop.is() && aEvent.Source == m_xDesktop)
{
- m_xDesktop = css::uno::Reference< css::frame::XDesktop >();
+ m_xDesktop.clear();
m_bListenOnDesktop = sal_False;
}
else if (m_xFrame.is() && aEvent.Source == m_xFrame)
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 78bc67c8c42f..0b5f95db11a1 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrameLoader.hpp>
#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
@@ -972,7 +973,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed()
aVal >>= nMaxOpenDocuments;
css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
- xSMGR->createInstance(SERVICENAME_DESKTOP),
+ css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)),
css::uno::UNO_QUERY_THROW);
FrameListAnalyzer aAnalyzer(xDesktop,
@@ -1295,7 +1296,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
// otherwhise - iterate through the tasks of the desktop container
// to find out, which of them might contains the requested document
- css::uno::Reference< css::frame::XFramesSupplier > xSupplier(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XDesktop2 > xSupplier = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) );
css::uno::Reference< css::container::XIndexAccess > xTaskList(xSupplier->getFrames() , css::uno::UNO_QUERY);
if (!xTaskList.is())
@@ -1436,7 +1437,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget()
if (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False) == sal_True)
return css::uno::Reference< css::frame::XFrame >();
- css::uno::Reference< css::frame::XFramesSupplier > xSupplier(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFramesSupplier > xSupplier( css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ), css::uno::UNO_QUERY);
FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference< css::frame::XFrame >(), FrameListAnalyzer::E_BACKINGCOMPONENT);
if (aTasksAnalyzer.m_xBackingComponent.is())
{
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 3d4a794eba89..d84086b69c0f 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XModel2.hpp>
@@ -1988,7 +1989,7 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible)
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY);
lcl_changeVisibility( xDesktop, bVisible );
aReadLock.unlock();
@@ -2128,8 +2129,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl
if (pParams)
xExternalProgress = pParams->m_xProgress;
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
- ::rtl::OUString sBackupPath (SvtPathOptions().GetBackupPath());
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR));
+ ::rtl::OUString sBackupPath(SvtPathOptions().GetBackupPath());
css::uno::Reference< css::frame::XController > xActiveController;
css::uno::Reference< css::frame::XModel > xActiveModel ;
@@ -2625,7 +2626,7 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::frame::XFrame > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW );
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR));
::std::vector< Reference< XComponent > > aCleanup;
try
@@ -3361,9 +3362,7 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()
try
{
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
- xSMGR->createInstance(SERVICENAME_DESKTOP),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR));
css::uno::Reference< css::container::XIndexAccess > xContainer(
xDesktop->getFrames(),
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index c6d83b3cc86f..d633f8760b49 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -51,6 +51,7 @@
#include "rtl/ustrbuf.hxx"
#include "osl/file.h"
+#include "com/sun/star/frame/Desktop.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/configuration/theDefaultProvider.hpp"
@@ -213,9 +214,8 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
maToolbox.ShowItem( nItemId_Info );
// get dispatch provider
- mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_DESKTOP ),UNO_QUERY );
- if( mxDesktop.is() )
- mxDesktopDispatchProvider = Reference< XDispatchProvider >( mxDesktop, UNO_QUERY );
+ Reference<XDesktop2> xDesktop = Desktop::create( comphelper::getProcessComponentContext() );
+ mxDesktopDispatchProvider = Reference< XDispatchProvider >( xDesktop, UNO_QUERY );
maWriterButton.SetHelpId( ".HelpId:StartCenter:WriterButton" );
maCalcButton.SetHelpId( ".HelpId:StartCenter:CalcButton" );
@@ -702,7 +702,7 @@ long BackingWindow::Notify( NotifyEvent& rNEvt )
if( ! mpAccExec )
{
mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
- mpAccExec->init( comphelper::getProcessServiceFactory(), mxFrame);
+ mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame);
}
const KeyEvent* pEvt = rNEvt.GetKeyEvent();
diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx
index fdacdbfa630e..94c16dd24eb6 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -75,7 +75,6 @@ namespace framework
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgSeq;
};
- com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop;
com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster;
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 7913bdb1db5a..a695eb2000a9 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -79,10 +79,11 @@ namespace framework{
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_15 ( Desktop ,
+DEFINE_XINTERFACE_16 ( Desktop ,
OWeakObject ,
DIRECT_INTERFACE( css::lang::XTypeProvider ),
DIRECT_INTERFACE( css::lang::XServiceInfo ),
+ DIRECT_INTERFACE( css::frame::XDesktop2 ),
DIRECT_INTERFACE( css::frame::XDesktop ),
DIRECT_INTERFACE( css::frame::XComponentLoader ),
DIRECT_INTERFACE( css::frame::XTasksSupplier ),
@@ -98,9 +99,10 @@ DEFINE_XINTERFACE_15 ( Desktop
DIRECT_INTERFACE( css::frame::XUntitledNumbers )
)
-DEFINE_XTYPEPROVIDER_15 ( Desktop ,
+DEFINE_XTYPEPROVIDER_16 ( Desktop ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
+ css::frame::XDesktop2 ,
css::frame::XDesktop ,
css::frame::XComponentLoader ,
css::frame::XTasksSupplier ,
@@ -118,7 +120,7 @@ DEFINE_XTYPEPROVIDER_15 ( Desktop
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( Desktop ,
::cppu::OWeakObject ,
- SERVICENAME_DESKTOP ,
+ DECLARE_ASCII("com.sun.star.frame.Desktop" ),
IMPLEMENTATIONNAME_DESKTOP
)
@@ -198,7 +200,7 @@ Desktop::Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >&
// Init baseclasses first
// Attention: Don't change order of initialization!
// ThreadHelpBase is a struct with a lock as member. We can't use a lock as direct member!
- // We must garant right initialization and a valid value of this to initialize other baseclasses!
+ // We must guarantee right initialization and a valid value of this to initialize other baseclasses!
: ThreadHelpBase ( &Application::GetSolarMutex() )
, TransactionBase ( )
, ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType > ( m_aLock.getShareableOslMutex() )
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 1cda58996e62..51f7a398ee86 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -41,7 +41,7 @@
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -301,7 +301,7 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted
// first of all let the session be stored to be sure that we lose no information
StoreSession( sal_False );
- css::uno::Reference< css::frame::XDesktop > xDesktop( m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) );
// honestly: how many implementations of XDesktop will we ever have?
// so casting this directly to the implementation
Desktop* pDesktop(dynamic_cast<Desktop*>(xDesktop.get()));
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 49c35c4cc83f..4303f4e58bc1 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/XDesktop.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>
@@ -853,7 +853,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
::rtl::OUString aMenuCommand( m_aMenuItemCommand );
if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand )
- MenuManager::UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock );
+ MenuManager::UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock );
// Check if some modes have changed so we have to update our menu images
sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle();
@@ -1078,27 +1078,24 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
{
// window list menu item selected
- Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) );
- if ( xDesktop.is() )
+ sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
+ Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ sal_Int32 nCount = xList->getCount();
+ for ( sal_Int32 i=0; i<nCount; ++i )
{
- sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
- Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
- sal_Int32 nCount = xList->getCount();
- for ( sal_Int32 i=0; i<nCount; ++i )
+ Reference< XFrame > xFrame;
+ xList->getByIndex(i) >>= xFrame;
+ if ( xFrame.is() && nTaskId == nCurItemId )
{
- Reference< XFrame > xFrame;
- xList->getByIndex(i) >>= xFrame;
- if ( xFrame.is() && nTaskId == nCurItemId )
- {
- Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- pWin->GrabFocus();
- pWin->ToTop( TOTOP_RESTOREWHENMIN );
- break;
- }
-
- nTaskId++;
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ pWin->GrabFocus();
+ pWin->ToTop( TOTOP_RESTOREWHENMIN );
+ break;
}
+
+ nTaskId++;
}
}
else