summaryrefslogtreecommitdiffstats
path: root/svtools/source/misc
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 /svtools/source/misc
parentUpdated core (diff)
downloadcore-bb121c864cc3c101ef733a4088c7ba3e36eced14.tar.gz
core-bb121c864cc3c101ef733a4088c7ba3e36eced14.zip
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 'svtools/source/misc')
-rw-r--r--svtools/source/misc/acceleratorexecute.cxx21
-rw-r--r--svtools/source/misc/transfer.cxx35
2 files changed, 16 insertions, 40 deletions
diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx
index ea21f8640d9c..d68fc58bfff7 100644
--- a/svtools/source/misc/acceleratorexecute.cxx
+++ b/svtools/source/misc/acceleratorexecute.cxx
@@ -20,7 +20,7 @@
#include <svtools/acceleratorexecute.hxx>
#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
@@ -105,27 +105,25 @@ AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper()
}
//-----------------------------------------------
-void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
+void AcceleratorExecute::init(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const css::uno::Reference< css::frame::XFrame >& xEnv )
{
// SAFE -> ----------------------------------
::osl::ResettableMutexGuard aLock(m_aLock);
// take over the uno service manager
- m_xSMGR = xSMGR;
+ m_xContext = rxContext;
// specify our internal dispatch provider
// frame or desktop?! => document or global config.
sal_Bool bDesktopIsUsed = sal_False;
- m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY);
+ m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY);
if (!m_xDispatcher.is())
{
aLock.clear();
// <- SAFE ------------------------------
- css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(
- xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(css::frame::Desktop::create(rxContext), css::uno::UNO_QUERY_THROW);
// SAFE -> ------------------------------
aLock.reset();
@@ -143,11 +141,11 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic
css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ;
// global cfg
- xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(xSMGR));
+ xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(rxContext);
if (!bDesktopIsUsed)
{
// module cfg
- xModuleCfg = AcceleratorExecute::st_openModuleConfig(comphelper::getComponentContext(xSMGR), xEnv);
+ xModuleCfg = AcceleratorExecute::st_openModuleConfig(rxContext, xEnv);
// doc cfg
css::uno::Reference< css::frame::XController > xController;
@@ -417,13 +415,12 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge
if (m_xURLParser.is())
return m_xURLParser;
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
aLock.clear();
// <- SAFE ----------------------------------
- css::uno::Reference< css::util::XURLTransformer > xParser(
- css::util::URLTransformer::create( ::comphelper::getComponentContext(xSMGR) ) );
+ css::uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create( xContext );
// SAFE -> ----------------------------------
aLock.reset();
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 4bed02dae0c2..735b52eefb40 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -45,7 +45,7 @@
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include "svl/urlbmk.hxx"
@@ -527,15 +527,8 @@ void SAL_CALL TransferableHelper::lostOwnership( const Reference< XClipboard >&,
{
if( mxTerminateListener.is() )
{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
-
- if( xFact.is() )
- {
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY );
-
- if( xDesktop.is() )
- xDesktop->removeTerminateListener( mxTerminateListener );
- }
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ xDesktop->removeTerminateListener( mxTerminateListener );
mxTerminateListener = Reference< XTerminateListener >();
}
@@ -1053,15 +1046,8 @@ void TransferableHelper::CopyToClipboard( Window *pWindow ) const
try
{
TransferableHelper* pThis = const_cast< TransferableHelper* >( this );
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
-
- if( xFact.is() )
- {
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY );
-
- if( xDesktop.is() )
- xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
- }
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
mxClipboard->setContents( pThis, pThis );
}
@@ -1090,15 +1076,8 @@ void TransferableHelper::CopyToSelection( Window *pWindow ) const
try
{
TransferableHelper* pThis = const_cast< TransferableHelper* >( this );
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
-
- if( xFact.is() )
- {
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY );
-
- if( xDesktop.is() )
- xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
- }
+ Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
+ xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
xSelection->setContents( pThis, pThis );
}