summaryrefslogtreecommitdiff
path: root/desktop
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 /desktop
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 'desktop')
-rw-r--r--desktop/source/app/app.cxx167
-rw-r--r--desktop/source/app/dispatchwatcher.cxx31
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx7
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.hxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx9
-rw-r--r--desktop/test/deployment/active/active_native.cxx24
-rw-r--r--desktop/test/deployment/passive/passive_native.cxx24
7 files changed, 106 insertions, 160 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 493f19065491..7f87969d82ff 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -44,7 +44,7 @@
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/view/XPrintable.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
@@ -632,7 +632,7 @@ void Desktop::DeInit()
Reference< XComponent >(
comphelper::getProcessComponentContext(), UNO_QUERY_THROW )->
dispose();
- // nobody should get a destroyd service factory...
+ // nobody should get a destroyed service factory...
::comphelper::setProcessServiceFactory( NULL );
// clear lockfile
@@ -663,26 +663,15 @@ sal_Bool Desktop::QueryExit()
const sal_Char SUSPEND_QUICKSTARTVETO[] = "SuspendQuickstartVeto";
- Reference< ::com::sun::star::frame::XDesktop >
- xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.Desktop") ),
- UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
+ Reference< XPropertySet > xPropertySet(xDesktop, UNO_QUERY_THROW);
+ xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), Any((sal_Bool)sal_True) );
- Reference < ::com::sun::star::beans::XPropertySet > xPropertySet( xDesktop, UNO_QUERY );
- if ( xPropertySet.is() )
- {
- Any a;
- a <<= (sal_Bool)sal_True;
- xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), a );
- }
-
- sal_Bool bExit = ( !xDesktop.is() || xDesktop->terminate() );
+ sal_Bool bExit = xDesktop->terminate();
-
- if ( !bExit && xPropertySet.is() )
+ if ( !bExit )
{
- Any a;
- a <<= (sal_Bool)sal_False;
- xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), a );
+ xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), Any((sal_Bool)sal_False) );
}
else
{
@@ -1104,8 +1093,8 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave ,
xSMGR->createInstance(SERVICENAME_RECOVERYUI),
css::uno::UNO_QUERY_THROW);
- Reference< css::util::XURLTransformer > xURLParser(
- css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
+ Reference< css::util::XURLTransformer > xURLParser =
+ css::util::URLTransformer::create(::comphelper::getProcessComponentContext());
css::util::URL aURL;
if (bEmergencySave)
@@ -1404,16 +1393,15 @@ int Desktop::Main()
utl::Bootstrap::reloadData();
SetSplashScreenProgress(20);
- Reference< XMultiServiceFactory > xSMgr =
- ::comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference< XRestartManager > xRestartManager(
- OfficeRestartManager::get(comphelper::getProcessComponentContext()));
+ Reference< XRestartManager > xRestartManager( OfficeRestartManager::get(xContext) );
- Reference< XDesktop > xDesktop;
+ Reference< XDesktop2 > xDesktop;
try
{
- RegisterServices(comphelper::getProcessComponentContext());
+ RegisterServices(xContext);
SetSplashScreenProgress(25);
@@ -1495,12 +1483,11 @@ int Desktop::Main()
SvtPathOptions().SetWorkPath( aWorkPath );
}
- xDesktop = Reference<XDesktop>( xSMgr->createInstance(
- OUString( "com.sun.star.frame.Desktop" )), UNO_QUERY );
+ xDesktop = css::frame::Desktop::create( xContext );
// create service for loadin SFX (still needed in startup)
pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener >
- ( css::frame::GlobalEventBroadcaster::create(comphelper::getComponentContext(xSMgr)), UNO_QUERY_THROW );
+ ( css::frame::GlobalEventBroadcaster::create(xContext), UNO_QUERY_THROW );
/* ensure existance of a default window that messages can be dispatched to
This is for the benefit of testtool which uses PostUserEvent extensively
@@ -1848,7 +1835,7 @@ sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& r
sal_Bool bQuickstart = shouldLaunchQuickstart();
- // Try to instanciate quickstart service. This service is not mandatory, so
+ // Try to instantiate quickstart service. This service is not mandatory, so
// do nothing if service is not available
// #i105753# the following if was invented for performance
@@ -1984,17 +1971,13 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs )
Sequence < com::sun::star::beans::PropertyValue > args(1);
args[0].Name = ::rtl::OUString("Hidden");
args[0].Value <<= sal_True;
- Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY );
-
- if ( !xLoader.is() )
- return;
+ Reference < XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
if ( rArgs.IsWriter() )
{
try
{
- Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/swriter"),
+ Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/swriter"),
::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW );
xDoc->close( sal_False );
}
@@ -2006,7 +1989,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs )
{
try
{
- Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/scalc"),
+ Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/scalc"),
::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW );
xDoc->close( sal_False );
}
@@ -2018,7 +2001,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs )
{
try
{
- Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/sdraw"),
+ Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/sdraw"),
::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW );
xDoc->close( sal_False );
}
@@ -2030,7 +2013,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs )
{
try
{
- Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/simpress"),
+ Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/simpress"),
::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW );
xDoc->close( sal_False );
}
@@ -2044,8 +2027,7 @@ void Desktop::PreloadConfigurationData()
{
Reference< XMultiServiceFactory > rFactory = ::comphelper::getProcessServiceFactory();
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference< XNameAccess > xNameAccess(
- css::frame::UICommandDescription::create(xContext) );
+ Reference< XNameAccess > xNameAccess = css::frame::UICommandDescription::create(xContext);
rtl::OUString aWriterDoc( "com.sun.star.text.TextDocument" );
rtl::OUString aCalcDoc( "com.sun.star.sheet.SpreadsheetDocument" );
@@ -2445,10 +2427,8 @@ void Desktop::OpenClients()
}
// no default document if a document was loaded by recovery or by command line or if soffice is used as server
- Reference< XFramesSupplier > xTasksSupplier(
- ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.Desktop") ),
- ::com::sun::star::uno::UNO_QUERY_THROW );
- Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY_THROW );
+ Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
+ Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY_THROW );
if ( xList->hasElements() )
return;
@@ -2582,18 +2562,17 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
case ApplicationEvent::TYPE_APPEAR:
if ( !GetCommandLineArgs().IsInvisible() )
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ 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
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >
- xDesktop( xSMGR->createInstance( OUString("com.sun.star.frame.Desktop") ),
- ::com::sun::star::uno::UNO_QUERY );
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame();
+ Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext );
+ Reference< css::frame::XFrame > xTask = xDesktop->getActiveFrame();
if ( !xTask.is() )
{
// get any task if there is no active one
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY );
- if ( xList->getCount()>0 )
+ Reference< css::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY );
+ if ( xList->getCount() > 0 )
xList->getByIndex(0) >>= xTask;
}
@@ -2605,11 +2584,8 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
else
{
// no visible task that could be activated found
- Reference< XFrame > xBackingFrame;
Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY );
-
- xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0);
+ Reference< XFrame > xBackingFrame = xDesktop->findFrame(OUString( "_blank" ), 0);
if (xBackingFrame.is())
xContainerWindow = xBackingFrame->getContainerWindow();
if (xContainerWindow.is())
@@ -2709,17 +2685,11 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
// The user will try it again, in case nothing happens .-)
try
{
- Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference< css::frame::XDispatchProvider >
- xDesktop( xSMGR->createInstance( OUString("com.sun.star.frame.Desktop") ),
- ::com::sun::star::uno::UNO_QUERY );
+ Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext );
- // check provider ... we know it's weak reference only
- if ( ! xDesktop.is())
- return;
-
- Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
+ Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext);
css::util::URL aCommand;
if( rAppEvent.GetData() == ::rtl::OUString("PREFERENCES") )
aCommand.Complete = rtl::OUString( ".uno:OptionsTreeDialog" );
@@ -2845,52 +2815,47 @@ void Desktop::ShowBackingComponent(Desktop * progress)
{
return;
}
- Reference< XMultiServiceFactory > xSMgr(
- comphelper::getProcessServiceFactory(), UNO_SET_THROW);
- Reference< XFrame > xDesktopFrame(
- xSMgr->createInstance("com.sun.star.frame.Desktop"), UNO_QUERY);
- if (xDesktopFrame.is())
+ Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
+ Reference< css::lang::XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
+ Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xContext);
+ if (progress != 0)
{
+ progress->SetSplashScreenProgress(60);
+ }
+ Reference< XFrame > xBackingFrame = xDesktop->findFrame(OUString( "_blank" ), 0);
+ Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+ if (xBackingFrame.is())
+ xContainerWindow = xBackingFrame->getContainerWindow();
+ if (xContainerWindow.is())
+ {
+ SetDocumentExtendedStyle(xContainerWindow);
if (progress != 0)
{
- progress->SetSplashScreenProgress(60);
+ progress->SetSplashScreenProgress(75);
}
- Reference< XFrame > xBackingFrame;
- Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= xContainerWindow;
- xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0);
- if (xBackingFrame.is())
- xContainerWindow = xBackingFrame->getContainerWindow();
- if (xContainerWindow.is())
+ Reference< XController > xBackingComp(
+ xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY);
+ if (xBackingComp.is())
{
- SetDocumentExtendedStyle(xContainerWindow);
+ 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(75);
+ progress->SetSplashScreenProgress(100);
}
- Sequence< Any > lArgs(1);
- lArgs[0] <<= xContainerWindow;
-
- Reference< XController > xBackingComp(
- xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY);
- if (xBackingComp.is())
+ xBackingComp->attachFrame(xBackingFrame);
+ 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->CloseSplashScreen();
}
+ xContainerWindow->setVisible(sal_True);
}
}
}
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index e832377ff418..0ac65aa72a7e 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/util/CloseVetoException.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/util/URL.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/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
@@ -165,9 +165,7 @@ DispatchWatcher::~DispatchWatcher()
sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList, bool bNoTerminate )
{
- Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
- UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
DispatchList::const_iterator p;
std::vector< DispatchHolder > aDispatches;
@@ -279,14 +277,12 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
aURL.Complete = aName;
Reference < XDispatch > xDispatcher ;
- Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY );
Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) );
if( xParser.is() == sal_True )
xParser->parseStrict( aURL );
- if( xProvider.is() == sal_True )
- xDispatcher = xProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
+ xDispatcher = xDesktop->queryDispatch( aURL, ::rtl::OUString(), 0 );
if( xDispatcher.is() == sal_True )
{
@@ -309,14 +305,12 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
aURL.Complete = aName;
Reference < XDispatch > xDispatcher ;
- Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY );
Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) );
if( xParser.is() == sal_True )
xParser->parseStrict( aURL );
- if( xProvider.is() == sal_True )
- xDispatcher = xProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
+ xDispatcher = xDesktop->queryDispatch( aURL, ::rtl::OUString(), 0 );
if( xDispatcher.is() == sal_True )
{
@@ -605,16 +599,13 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
if ( bEmpty && !bNoTerminate /*m_aRequestContainer.empty()*/ )
{
// We have to check if we have an open task otherwise we have to shutdown the office.
- Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
aGuard.clear();
- Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
+ Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY );
if ( !xList->hasElements() )
{
// We don't have any task open so we have to shutdown ourself!!
- Reference< XDesktop > xDesktop2( xTasksSupplier, UNO_QUERY );
- if ( xDesktop2.is() )
- return xDesktop2->terminate();
+ return xDesktop->terminate();
}
}
@@ -637,17 +628,13 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) th
if ( !nCount && !OfficeIPCThread::AreRequestsPending() )
{
// We have to check if we have an open task otherwise we have to shutdown the office.
- Reference< XFramesSupplier > xTasksSupplier( ::comphelper::getProcessServiceFactory()->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
- UNO_QUERY );
- Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY );
if ( !xList->hasElements() )
{
// We don't have any task open so we have to shutdown ourself!!
- Reference< XDesktop > xDesktop( xTasksSupplier, UNO_QUERY );
- if ( xDesktop.is() )
- xDesktop->terminate();
+ xDesktop->terminate();
}
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 579c5bc840f9..65ca88fa73cf 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -26,6 +26,7 @@
#include "com/sun/star/beans/XPropertySet.hpp"
#include "com/sun/star/configuration/theDefaultProvider.hpp"
+#include "com/sun/star/frame/Desktop.hpp"
#include "dp_gui_dialog2.hxx"
#include "dp_gui_extensioncmdqueue.hxx"
@@ -91,10 +92,8 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
{
// the registration should be done after the construction has been ended
// otherwise an exception prevents object creation, but it is registered as a listener
- m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext(
- OUString("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY );
- if ( m_xDesktop.is() )
- m_xDesktop->addTerminateListener( this );
+ m_xDesktop.set( frame::Desktop::create(xContext), uno::UNO_QUERY_THROW );
+ m_xDesktop->addTerminateListener( this );
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index e292baf03532..ec2734e80cee 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -27,7 +27,7 @@
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/deployment/XExtensionManager.hpp"
#include "com/sun/star/deployment/ExtensionManager.hpp"
-#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/XDesktop2.hpp"
#include "com/sun/star/frame/XTerminateListener.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/util/XModifyListener.hpp"
@@ -49,7 +49,7 @@ class TheExtensionManager :
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop;
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index d41d57f37419..0664071ef5aa 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -49,7 +49,7 @@
#include "com/sun/star/deployment/XExtensionManager.hpp"
#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/deployment/XUpdateInformationProvider.hpp"
-#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/Desktop.hpp"
#include "com/sun/star/frame/XDispatch.hpp"
#include "com/sun/star/frame/XDispatchProvider.hpp"
#include "com/sun/star/lang/IllegalArgumentException.hpp"
@@ -837,13 +837,12 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly,
util::URL aURL;
xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete;
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference < util::XURLTransformer > xTransformer = util::URLTransformer::create(xContext);
xTransformer->parseStrict(aURL);
- uno::Reference < frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create( xContext );
uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(),
uno::UNO_QUERY_THROW );
uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0);
diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx
index 3e5e0c5581c8..ce88274c63c7 100644
--- a/desktop/test/deployment/active/active_native.cxx
+++ b/desktop/test/deployment/active/active_native.cxx
@@ -29,7 +29,7 @@
#include "com/sun/star/awt/XWindowPeer.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/frame/DispatchDescriptor.hpp"
-#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/Desktop.hpp"
#include "com/sun/star/frame/XDispatch.hpp"
#include "com/sun/star/frame/XDispatchProvider.hpp"
#include "com/sun/star/frame/XFrame.hpp"
@@ -216,23 +216,21 @@ void Dispatch::dispatch(
css::uno::Sequence< css::beans::PropertyValue > const &)
throw (css::uno::RuntimeException)
{
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_);
+ css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame();
+ css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW );
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_);
css::uno::Reference< css::awt::XMessageBox > box(
- css::awt::Toolkit::create(context_)->createMessageBox(
- css::uno::Reference< css::awt::XWindowPeer >(
- css::uno::Reference< css::frame::XFrame >(
- css::uno::Reference< css::frame::XDesktop >(
- (context_->getServiceManager()->
- createInstanceWithContext(
- "com.sun.star.frame.Desktop", context_)),
- css::uno::UNO_QUERY_THROW)->getCurrentFrame(),
- css::uno::UNO_SET_THROW)->getComponentWindow(),
- css::uno::UNO_QUERY_THROW),
+ xToolkit->createMessageBox(
+ xWindowPeer,
css::awt::Rectangle(), "infobox",
css::awt::MessageBoxButtons::BUTTONS_OK, "active", "native"),
css::uno::UNO_SET_THROW);
+
box->execute();
- css::uno::Reference< css::lang::XComponent >(
- box, css::uno::UNO_QUERY_THROW)->dispose();
+
+ css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW);
+ xComponent->dispose();
}
static cppu::ImplementationEntry const services[] = {
diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx
index c3fb5a3b0e72..819f6ab0ef59 100644
--- a/desktop/test/deployment/passive/passive_native.cxx
+++ b/desktop/test/deployment/passive/passive_native.cxx
@@ -29,7 +29,7 @@
#include "com/sun/star/awt/XWindowPeer.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/frame/DispatchDescriptor.hpp"
-#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/Desktop.hpp"
#include "com/sun/star/frame/XDispatch.hpp"
#include "com/sun/star/frame/XDispatchProvider.hpp"
#include "com/sun/star/frame/XFrame.hpp"
@@ -213,23 +213,21 @@ void Dispatch::dispatch(
css::uno::Sequence< css::beans::PropertyValue > const &)
throw (css::uno::RuntimeException)
{
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_);
+ css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame();
+ css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW );
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_);
css::uno::Reference< css::awt::XMessageBox > box(
- css::awt::Toolkit::create(context_)->createMessageBox(
- css::uno::Reference< css::awt::XWindowPeer >(
- css::uno::Reference< css::frame::XFrame >(
- css::uno::Reference< css::frame::XDesktop >(
- (context_->getServiceManager()->
- createInstanceWithContext(
- "com.sun.star.frame.Desktop", context_)),
- css::uno::UNO_QUERY_THROW)->getCurrentFrame(),
- css::uno::UNO_SET_THROW)->getComponentWindow(),
- css::uno::UNO_QUERY_THROW),
+ xToolkit->createMessageBox(
+ xWindowPeer,
css::awt::Rectangle(), "infobox",
css::awt::MessageBoxButtons::BUTTONS_OK, "passive", "native"),
css::uno::UNO_SET_THROW);
+
box->execute();
- css::uno::Reference< css::lang::XComponent >(
- box, css::uno::UNO_QUERY_THROW)->dispose();
+
+ css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW);
+ xComponent->dispose();
}
static cppu::ImplementationEntry const services[] = {