summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/templatedlg.hxx3
-rw-r--r--sfx2/source/appl/appinit.cxx6
-rw-r--r--sfx2/source/appl/appopen.cxx4
-rw-r--r--sfx2/source/appl/appserv.cxx27
-rw-r--r--sfx2/source/appl/sfxhelp.cxx24
-rw-r--r--sfx2/source/appl/shutdownicon.cxx36
-rw-r--r--sfx2/source/appl/shutdownicon.hxx8
-rw-r--r--sfx2/source/doc/doctempl.cxx6
-rw-r--r--sfx2/source/doc/objxtor.cxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx4
-rw-r--r--sfx2/source/doc/templatedlg.cxx3
-rw-r--r--sfx2/source/inet/inettbc.cxx5
-rw-r--r--sfx2/source/menu/virtmenu.cxx71
-rw-r--r--sfx2/source/notify/eventsupplier.cxx10
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx29
-rw-r--r--sfx2/source/view/frame2.cxx6
-rw-r--r--sfx2/source/view/viewfrm.cxx12
-rw-r--r--sfx2/source/view/viewsh.cxx2
18 files changed, 113 insertions, 147 deletions
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 44a665312dce..4a18ab2afa4e 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -15,6 +15,7 @@
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/tabctrl.hxx>
+#include <com/sun/star/frame/XDesktop2.hpp>
class Edit;
class PopupMenu;
@@ -143,7 +144,7 @@ private:
bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not.
com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel;
- com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop;
+ com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2 > mxDesktop;
bool mbIsSynced; ///< Tells whether maRepositories is synchronized with the user config
std::vector<TemplateRepository*> maRepositories; ///< Stores the remote repositories for templates
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index e4fd8cde0e8f..1e0864f0f694 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <svtools/soerr.hxx>
@@ -215,9 +215,7 @@ bool SfxApplication::Initialize_Impl()
StgIo::SetErrorLink( LINK( this, SfxStorageErrHdl, Error ) );
#endif
- Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- if (!xDesktop.is())
- throw RuntimeException( rtl::OUString( "Couldn't create mandatory desktop service!" ), xDesktop );
+ Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
xDesktop->addTerminateListener( new SfxTerminateListener_Impl() );
Application::EnableAutoHelpId();
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 9a295b726c38..f9714d41a636 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp>
#include <com/sun/star/util/URL.hpp>
@@ -1147,7 +1147,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
else
{
- xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.frame.Desktop")), UNO_QUERY );
+ xTargetFrame.set( Desktop::create(::comphelper::getProcessComponentContext()), UNO_QUERY );
}
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 4a4fc90f94a5..3d09aece7037 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/DispatchResultEvent.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
@@ -205,7 +206,7 @@ static sal_Bool checkURL( const char *pName, const char *pExt, rtl::OUString &rU
static void showDocument( const char* pBaseName )
{
try {
- Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
Sequence < com::sun::star::beans::PropertyValue > args(2);
args[0].Name = ::rtl::OUString("ViewOnly");
args[0].Value <<= sal_True;
@@ -216,7 +217,7 @@ static void showDocument( const char* pBaseName )
if ( checkURL ( pBaseName, ".odt", aURL ) ||
checkURL ( pBaseName, ".html", aURL ) ||
checkURL ( pBaseName, "", aURL ) ) {
- xLoader->loadComponentFromURL( aURL, ::rtl::OUString("_blank"), 0, args );
+ xDesktop->loadComponentFromURL( aURL, ::rtl::OUString("_blank"), 0, args );
}
} catch (const ::com::sun::star::uno::Exception &) {
}
@@ -353,7 +354,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
// block reentrant calls
pAppData_Impl->bInQuit = sal_True;
- Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
rReq.ForgetAllArgs();
@@ -419,7 +420,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_CLOSEWINS:
{
- Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
if ( !xTasks.is() )
break;
@@ -695,10 +696,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
if ( pToolbarName )
{
- com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame;
- Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- xFrame = xDesktop->getActiveFrame();
+ Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
+ Reference< XFrame > xFrame = xDesktop->getActiveFrame();
Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
@@ -819,7 +818,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
case SID_CLOSEDOCS:
case SID_CLOSEWINS:
{
- Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
if ( !xTasks.is() || !xTasks->getCount() )
rSet.DisableItem(nWhich);
@@ -993,14 +992,14 @@ namespace
}
return pView;
}
- Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext )
+ Reference< XFrame > lcl_findStartModuleFrame( const Reference<XComponentContext> & rxContext )
{
try
{
- Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
- Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW );
+ Reference < XDesktop2 > xDesktop = Desktop::create( rxContext );
+ Reference < XIndexAccess > xContainer( xDesktop->getFrames(), UNO_QUERY_THROW );
- Reference< XModuleManager2 > xCheck( ModuleManager::create(i_rContext.getUNOContext()) );
+ Reference< XModuleManager2 > xCheck = ModuleManager::create(rxContext);
sal_Int32 nCount = xContainer->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
@@ -1166,7 +1165,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
aLoadArgs.put( "Model", pBasicIDE->GetModel() );
aLoadArgs.put( "URL", ::rtl::OUString( "private:factory/sbasic" ) );
- Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) );
+ Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext.getUNOContext() ) );
if ( !xTargetFrame.is() )
xTargetFrame = SfxFrame::CreateBlankFrame();
ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" );
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index b2be3e3f78de..0adbf1229b34 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -22,6 +22,7 @@
#include <set>
#include <algorithm>
#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -414,12 +415,10 @@ OUString getDefaultModule_Impl()
OUString getCurrentModuleIdentifier_Impl()
{
OUString sIdentifier;
- Reference < XFrame > xCurrentFrame;
- Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) );
- Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- if ( xDesktop.is() )
- xCurrentFrame = xDesktop->getCurrentFrame();
+ Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext);
+ Reference < XDesktop2 > xDesktop = Desktop::create(xContext);
+ Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
if ( xCurrentFrame.is() )
{
@@ -542,8 +541,7 @@ OUString SfxHelp::CreateHelpURL_Impl( const OUString& aCommandURL, const OUStrin
SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask ,
Reference< XFrame >& rHelpContent)
{
- Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
// otherwhise - create new help task
Reference< XFrame > xHelpTask = xDesktop->findFrame(
@@ -746,8 +744,7 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const
}
}
- Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
// check if help window is still open
// If not, create a new one and return access directly to the internal sub frame showing the help content
@@ -813,11 +810,8 @@ void SfxHelp::OpenHelpAgent( const OString& sHelpId )
Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
xTrans->parseStrict(aURL);
- Reference < XFrame > xCurrentFrame;
- Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- if ( xDesktop.is() )
- xCurrentFrame = xDesktop->getCurrentFrame();
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
Reference< XDispatchProvider > xDispProv( xCurrentFrame, UNO_QUERY );
Reference< XDispatch > xHelpDispatch;
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index f8cf04083351..ba6fd3f307bb 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -24,6 +24,7 @@
#include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp>
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
@@ -100,7 +101,7 @@ void SAL_CALL SfxNotificationListener_Impl::disposing( const EventObject& ) thro
{
}
-SFX_IMPL_XSERVICEINFO( ShutdownIcon, "com.sun.star.office.Quickstart", "com.sun.star.comp.desktop.QuickstartWrapper" ) \
+SFX_IMPL_XSERVICEINFO_CTX( ShutdownIcon, "com.sun.star.office.Quickstart", "com.sun.star.comp.desktop.QuickstartWrapper" ) \
SFX_IMPL_ONEINSTANCEFACTORY( ShutdownIcon );
bool ShutdownIcon::bModalMode = false;
@@ -210,9 +211,9 @@ public:
class IdleTerminate : Timer
{
- Reference< XDesktop > m_xDesktop;
+ Reference< XDesktop2 > m_xDesktop;
public:
- IdleTerminate (Reference< XDesktop > xDesktop)
+ IdleTerminate (Reference< XDesktop2 > xDesktop)
{
m_xDesktop = xDesktop;
Start();
@@ -254,14 +255,14 @@ void ShutdownIcon::deInitSystray()
}
-ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) :
+ShutdownIcon::ShutdownIcon( const Reference< XComponentContext > & rxContext ) :
ShutdownIconServiceBase( m_aMutex ),
m_bVeto ( false ),
m_bListenForTermination ( false ),
m_bSystemDialogs( false ),
m_pResMgr( NULL ),
m_pFileDlg( NULL ),
- m_xServiceManager( aSMgr ),
+ m_xContext( rxContext ),
m_pInitSystray( 0 ),
m_pDeInitSystray( 0 ),
m_pPlugin( 0 ),
@@ -567,7 +568,7 @@ void ShutdownIcon::addTerminateListener()
if (pInst->m_bListenForTermination)
return;
- Reference< XDesktop > xDesktop = pInst->m_xDesktop;
+ Reference< XDesktop2 > xDesktop = pInst->m_xDesktop;
if ( ! xDesktop.is())
return;
@@ -583,7 +584,7 @@ void ShutdownIcon::terminateDesktop()
if ( ! pInst)
return;
- Reference< XDesktop > xDesktop = pInst->m_xDesktop;
+ Reference< XDesktop2 > xDesktop = pInst->m_xDesktop;
if ( ! xDesktop.is())
return;
@@ -592,13 +593,9 @@ void ShutdownIcon::terminateDesktop()
xDesktop->removeTerminateListener( pInst );
// terminate desktop only if no tasks exist
- Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY );
- if ( xSupplier.is() )
- {
- Reference< XIndexAccess > xTasks ( xSupplier->getFrames(), UNO_QUERY );
- if( xTasks.is() && xTasks->getCount() < 1 )
- new IdleTerminate( xDesktop );
- }
+ Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY );
+ if( xTasks.is() && xTasks->getCount() < 1 )
+ new IdleTerminate( xDesktop );
// remove the instance pointer
ShutdownIcon::pShutdownIcon = 0;
@@ -621,8 +618,7 @@ ShutdownIcon* ShutdownIcon::createInstance()
ShutdownIcon *pIcon = NULL;
try {
- Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() );
- pIcon = new ShutdownIcon( xSMgr );
+ pIcon = new ShutdownIcon( comphelper::getProcessComponentContext() );
pIcon->init ();
pShutdownIcon = pIcon;
} catch (...) {
@@ -641,9 +637,7 @@ void ShutdownIcon::init() throw( ::com::sun::star::uno::Exception )
::osl::ResettableMutexGuard aGuard( m_aMutex );
m_pResMgr = pResMgr;
aGuard.clear();
- Reference < XDesktop > xDesktop( m_xServiceManager->createInstance(
- DEFINE_CONST_UNICODE( "com.sun.star.frame.Desktop" )),
- UNO_QUERY );
+ Reference < XDesktop2 > xDesktop = Desktop::create( m_xContext );
aGuard.reset();
m_xDesktop = xDesktop;
}
@@ -652,8 +646,8 @@ void ShutdownIcon::init() throw( ::com::sun::star::uno::Exception )
void SAL_CALL ShutdownIcon::disposing()
{
- m_xServiceManager = Reference< XMultiServiceFactory >();
- m_xDesktop = Reference< XDesktop >();
+ m_xContext.clear();
+ m_xDesktop.clear();
}
// ---------------------------------------------------------------------------
diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx
index b8ed97d5d9e2..cfa5e5371409 100644
--- a/sfx2/source/appl/shutdownicon.hxx
+++ b/sfx2/source/appl/shutdownicon.hxx
@@ -21,7 +21,7 @@
#define __SHUTDOWNICON_HXX__
#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -68,7 +68,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
bool m_bSystemDialogs;
ResMgr* m_pResMgr;
sfx2::FileDialogHelper* m_pFileDlg;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
static ShutdownIcon *pShutdownIcon; // one instance
@@ -90,7 +90,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
friend class SfxNotificationListener_Impl;
public:
- ShutdownIcon( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > aSMgr );
+ ShutdownIcon( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext );
virtual ~ShutdownIcon();
@@ -159,7 +159,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop;
#ifdef WNT
static void EnableAutostartW32( const rtl::OUString &aShortcutName );
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index aa3c60327b8e..7d258b46ff95 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/DocumentTemplates.hpp>
#include <com/sun/star/frame/XDocumentTemplates.hpp>
@@ -105,7 +106,6 @@ using ::std::advance;
#define COMMAND_TRANSFER "transfer"
#define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties"
-#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop"
//========================================================================
@@ -889,9 +889,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom
}
else
{
- OUString aService( SERVICENAME_DESKTOP );
- uno::Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( aService ),
- UNO_QUERY );
+ uno::Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );;
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = ::rtl::OUString("Hidden");
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 08b2743acc7f..6bc7a7260d9e 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
@@ -1100,8 +1101,7 @@ Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxIte
xLoader = uno::Reference < frame::XComponentLoader >( pFrame->GetFrameInterface(), uno::UNO_QUERY );
}
else
- xLoader = uno::Reference < frame::XComponentLoader >( comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString("com.sun.star.frame.Desktop") ), uno::UNO_QUERY );
+ xLoader = uno::Reference < frame::XComponentLoader >( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY );
Reference <lang::XComponent> xComp;
try
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 5dd7d63246c1..d0cb58f35c3b 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/IllegalArgumentIOException.hpp>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/frame/UntitledNumbersConst.hpp>
@@ -3904,8 +3905,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper ()
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- const ::rtl::OUString SERVICENAME_DESKTOP("com.sun.star.frame.Desktop");
- css::uno::Reference< css::frame::XUntitledNumbers > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XUntitledNumbers > xDesktop( css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW);
::framework::TitleHelper* pHelper = new ::framework::TitleHelper(xContext);
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 26cf58bf8f12..48a7cff69ee8 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -107,7 +108,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))),
mpOnlineView(new TemplateRemoteView(this, WB_VSCROLL,false)),
mbIsSaveMode(false),
- mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ),
+ mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ),
mbIsSynced(false),
maRepositories()
{
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 181204607a10..1a70998f1d2c 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -21,6 +21,7 @@
#include "inettbc.hxx"
#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <svl/eitem.hxx>
@@ -182,9 +183,7 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl)
if ( m_xServiceManager.is() )
{
- Reference< XFramesSupplier > xDesktop( m_xServiceManager->createInstance(
- ::rtl::OUString("com.sun.star.frame.Desktop")),
- UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(m_xServiceManager) );
Reference< XFrame > xFrame( xDesktop->getActiveFrame(), UNO_QUERY );
if ( xFrame.is() )
{
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index d056d9cb9ee4..81f186c3e541 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -23,7 +23,7 @@
#include <svtools/imagemgr.hxx>
#include <svl/imageitm.hxx>
#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <comphelper/processfactory.hxx>
#include <toolkit/unohlp.hxx>
@@ -842,34 +842,29 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
- Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );;
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();
+ 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 nFrameCount = xList->getCount();
- for( sal_Int32 i=0; i<nFrameCount; ++i )
- {
- Reference< XFrame > xFrame;
- Any aVal = xList->getByIndex(i);
- if (!(aVal>>=xFrame) || !xFrame.is() )
- continue;
+ Reference< XFrame > xFrame;
+ Any aVal = xList->getByIndex(i);
+ if (!(aVal>>=xFrame) || !xFrame.is() )
+ continue;
- if ( xFrame == xCurrentFrame )
- nActiveItemId = nItemId;
+ if ( xFrame == xCurrentFrame )
+ nActiveItemId = nItemId;
- Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- if ( pWin && pWin->IsVisible() )
- {
- aNewWindowListVector.push_back( pWin->GetText() );
- ++nItemId;
- }
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ if ( pWin && pWin->IsVisible() )
+ {
+ aNewWindowListVector.push_back( pWin->GetText() );
+ ++nItemId;
}
}
@@ -974,27 +969,23 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu )
if ( nSlotId >= START_ITEMID_WINDOWLIST && nSlotId <= END_ITEMID_WINDOWLIST )
{
// window list menu item selected
- Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
- if ( xDesktop.is() )
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
+ Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ sal_Int32 nFrameCount = xList->getCount();
+ for ( sal_Int32 i=0; i<nFrameCount; ++i )
{
- sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
- Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
- sal_Int32 nFrameCount = xList->getCount();
- for ( sal_Int32 i=0; i<nFrameCount; ++i )
+ Any aItem = xList->getByIndex(i);
+ Reference< XFrame > xFrame;
+ if (( aItem >>= xFrame ) && xFrame.is() && nTaskId == nSlotId )
{
- Any aItem = xList->getByIndex(i);
- Reference< XFrame > xFrame;
- if (( aItem >>= xFrame ) && xFrame.is() && nTaskId == nSlotId )
- {
- 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++;
}
return sal_True;
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 8218d20236f5..81db58e525c6 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/task/JobExecutor.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
@@ -247,12 +248,9 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg
}
else
{
- xProv = ::com::sun::star::uno::Reference
- < ::com::sun::star::frame::XDispatchProvider > (
- ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString(
- "com.sun.star.frame.Desktop" ) ),
- UNO_QUERY );
+ xProv = css::uno::Reference< css::frame::XDispatchProvider > (
+ css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ),
+ UNO_QUERY );
}
::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDisp;
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 64e8901ed514..f88a781da7d4 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -1623,33 +1624,27 @@ long Select_Impl( void* /*pHdl*/, void* pVoid )
if( !aURL.Len() )
return 0;
- Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop =
- Reference < ::com::sun::star::frame::XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- Reference < ::com::sun::star::frame::XFrame > xFrame( xDesktop, UNO_QUERY );
+ Reference < ::com::sun::star::frame::XDesktop2 > xDesktop =
+ ::com::sun::star::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
URL aTargetURL;
aTargetURL.Complete = aURL;
Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
xTrans->parseStrict( aTargetURL );
- Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
Reference < XDispatch > xDisp;
- if ( xProv.is() )
+ if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL )
+ xDisp = xDesktop->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+ else
{
- if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL )
- xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- else
- {
- ::rtl::OUString aTargetFrame( ::rtl::OUString("_blank") );
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() );
+ ::rtl::OUString aTargetFrame( ::rtl::OUString("_blank") );
+ ::framework::MenuConfiguration::Attributes* pMenuAttributes =
+ (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() );
- if ( pMenuAttributes )
- aTargetFrame = pMenuAttributes->aTargetFrame;
+ if ( pMenuAttributes )
+ aTargetFrame = pMenuAttributes->aTargetFrame;
- xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 );
- }
+ xDisp = xDesktop->queryDispatch( aTargetURL, aTargetFrame , 0 );
}
if ( xDisp.is() )
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 08dabbbea4c8..3b4c060de69f 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
@@ -227,8 +228,7 @@ Reference < XFrame > SfxFrame::CreateBlankFrame()
Reference < XFrame > xFrame;
try
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW );
}
catch( const Exception& )
@@ -245,7 +245,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nV
{
// create and initialize new top level frame for this window
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
+ Reference < XDesktop2 > xDesktop = Desktop::create( aContext.getUNOContext() );
Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW );
Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW );
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b97f7615ecbf..5cdfe81dccbe 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -23,6 +23,7 @@
#include <sfx2/infobar.hxx>
#include <sfx2/viewfrm.hxx>
#include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/DispatchRecorderSupplier.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -1869,8 +1870,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell
{
if ( !xFrame.is() )
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
+ Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
if ( !i_bHidden )
{
@@ -2321,13 +2321,11 @@ void SfxViewFrame::ExecView_Impl
*/
sal_Bool impl_maxOpenDocCountReached()
{
- static ::rtl::OUString SERVICE_DESKTOP("com.sun.star.frame.Desktop");
-
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
- ::comphelper::getProcessComponentContext(),
+ xContext,
::rtl::OUString("org.openoffice.Office.Common/"),
::rtl::OUString("Misc"),
::rtl::OUString("MaxOpenDocuments"),
@@ -2341,7 +2339,7 @@ sal_Bool impl_maxOpenDocCountReached()
sal_Int32 nMaxDocs = 0;
aVal >>= nMaxDocs;
- css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(xContext);
css::uno::Reference< css::container::XIndexAccess > xCont (xDesktop->getFrames() , css::uno::UNO_QUERY_THROW);
sal_Int32 c = xCont->getCount();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 466d8261b595..ee97af94bc56 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1648,7 +1648,7 @@ sal_Bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
{
pImp->m_pAccExec.reset(
::svt::AcceleratorExecute::createAcceleratorHelper() );
- pImp->m_pAccExec->init(::comphelper::getProcessServiceFactory(),
+ pImp->m_pAccExec->init(::comphelper::getProcessComponentContext(),
pFrame->GetFrame().GetFrameInterface());
}