summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-01 15:15:25 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-06 10:53:34 +0200
commit0fcd1a73f0e1ec564f3c6da1ccd890183d3c18db (patch)
tree3895ecd6f804b8f3ef3a8f03f1739e17918feeef /svtools
parent8a95074eaefd01621dc55db8567b19c8e6157f95 (diff)
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update code to use factory method URLTransformer::create Change-Id: I3fd2e838497bcfd8fc949615c0e7d60a6ea47118 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/templwin.cxx9
-rw-r--r--svtools/source/misc/acceleratorexecute.cxx5
-rw-r--r--svtools/source/uno/contextmenuhelper.cxx46
-rw-r--r--svtools/source/uno/framestatuslistener.cxx19
-rw-r--r--svtools/source/uno/generictoolboxcontroller.cxx6
-rw-r--r--svtools/source/uno/popupmenucontrollerbase.cxx4
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx7
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx14
8 files changed, 49 insertions, 61 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index a0f5a7b39e89..937236f785b0 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -710,8 +711,8 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B
{
com::sun::star::util::URL aURL;
aURL.Complete = rURL;
- Reference < com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->
- createInstance( ASCII_STR("com.sun.star.util.URLTransformer" ) ), UNO_QUERY );
+ Reference< com::sun::star::util::XURLTransformer > xTrans(
+ com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
xTrans->parseStrict( aURL );
String aTarget;
@@ -1615,8 +1616,8 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl)
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = ASCII_STR("slot:5540");
- Reference < com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->
- createInstance( ASCII_STR("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ Reference< com::sun::star::util::XURLTransformer > xTrans(
+ com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
xTrans->parseStrict( aTargetURL );
Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx
index b8cd25a74ee8..181a1dc35c5d 100644
--- a/svtools/source/misc/acceleratorexecute.cxx
+++ b/svtools/source/misc/acceleratorexecute.cxx
@@ -40,7 +40,9 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/componentcontext.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
@@ -448,8 +450,7 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge
// <- SAFE ----------------------------------
css::uno::Reference< css::util::XURLTransformer > xParser(
- xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- css::uno::UNO_QUERY_THROW);
+ css::util::URLTransformer::create( ::comphelper::ComponentContext(xSMGR).getUNOContext() ) );
// SAFE -> ----------------------------------
aLock.reset();
diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx
index 6d8578e7952c..541b3c920dfb 100644
--- a/svtools/source/uno/contextmenuhelper.cxx
+++ b/svtools/source/uno/contextmenuhelper.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <osl/conditn.hxx>
@@ -341,35 +342,28 @@ ContextMenuHelper::dispatchCommand(
{
if ( !m_xURLTransformer.is() )
{
- m_xURLTransformer = uno::Reference< util::XURLTransformer >(
- ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))),
- uno::UNO_QUERY );
+ m_xURLTransformer = util::URLTransformer::create( ::comphelper::getProcessComponentContext() );
}
util::URL aTargetURL;
+ aTargetURL.Complete = aCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+
uno::Reference< frame::XDispatch > xDispatch;
- if ( m_xURLTransformer.is() )
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider(
+ rFrame, uno::UNO_QUERY );
+ if ( xDispatchProvider.is() )
{
- aTargetURL.Complete = aCommandURL;
- m_xURLTransformer->parseStrict( aTargetURL );
-
- uno::Reference< frame::XDispatchProvider > xDispatchProvider(
- rFrame, uno::UNO_QUERY );
- if ( xDispatchProvider.is() )
+ try
+ {
+ xDispatch = xDispatchProvider->queryDispatch( aTargetURL, m_aSelf, 0 );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& )
{
- try
- {
- xDispatch = xDispatchProvider->queryDispatch( aTargetURL, m_aSelf, 0 );
- }
- catch ( uno::RuntimeException& )
- {
- throw;
- }
- catch ( uno::Exception& )
- {
- }
}
}
@@ -594,11 +588,7 @@ ContextMenuHelper::completeMenuProperties(
if ( !m_xURLTransformer.is() )
{
- m_xURLTransformer = uno::Reference< util::XURLTransformer >(
- ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))),
- uno::UNO_QUERY );
+ m_xURLTransformer = util::URLTransformer::create( ::comphelper::getProcessComponentContext() );
}
for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx
index 6579c26feae2..909170dd4da5 100644
--- a/svtools/source/uno/framestatuslistener.cxx
+++ b/svtools/source/uno/framestatuslistener.cxx
@@ -29,8 +29,10 @@
#include <svtools/framestatuslistener.hxx>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/componentcontext.hxx>
using namespace ::cppu;
using namespace ::com::sun::star::awt;
@@ -103,10 +105,7 @@ throw (::com::sun::star::uno::RuntimeException)
try
{
Reference< XDispatch > xDispatch( pIter->second );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = pIter->first;
xURLTransformer->parseStrict( aTargetURL );
@@ -193,9 +192,7 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL )
Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
if ( m_xServiceManager.is() && xDispatchProvider.is() )
{
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
aTargetURL.Complete = aCommandURL;
xURLTransformer->parseStrict( aTargetURL );
xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
@@ -253,9 +250,7 @@ void FrameStatusListener::bindListener()
URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
while ( pIter != m_aListenerMap.end() )
{
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = pIter->first;
xURLTransformer->parseStrict( aTargetURL );
@@ -324,9 +319,7 @@ void FrameStatusListener::unbindListener()
URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
while ( pIter != m_aListenerMap.end() )
{
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = pIter->first;
xURLTransformer->parseStrict( aTargetURL );
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index 3dfc34e77e94..9d7777836b05 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -35,6 +35,7 @@
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
+#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -45,6 +46,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
+#include <comphelper/componentcontext.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -116,9 +118,7 @@ throw ( RuntimeException )
m_xServiceManager.is() &&
!m_aCommandURL.isEmpty() )
{
- xURLTransformer = Reference< XURLTransformer >( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ xURLTransformer = com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() );
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx
index cdc12be41a6b..a20d4690ea9f 100644
--- a/svtools/source/uno/popupmenucontrollerbase.cxx
+++ b/svtools/source/uno/popupmenucontrollerbase.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/awt/XMenuExtended.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -52,6 +53,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
#include <osl/mutex.hxx>
+#include <comphelper/componentcontext.hxx>
//_________________________________________________________________________________________________________________
// Defines
@@ -87,7 +89,7 @@ PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XMultiService
m_xServiceManager( xServiceManager )
{
if ( m_xServiceManager.is() )
- m_xURLTransformer.set( m_xServiceManager->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),UNO_QUERY );
+ m_xURLTransformer.set( util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
}
PopupMenuControllerBase::~PopupMenuControllerBase()
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 34f72eba446b..55f383e87786 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
@@ -39,6 +40,7 @@
#include <svtools/imgdef.hxx>
#include <svtools/miscopt.hxx>
#include <toolkit/unohlp.hxx>
+#include <comphelper/componentcontext.hxx>
using namespace ::cppu;
using namespace ::com::sun::star::awt;
@@ -92,10 +94,7 @@ Reference< XURLTransformer > StatusbarController::getURLTransformer() const
SolarMutexGuard aSolarMutexGuard;
if ( !m_xURLTransformer.is() && m_xServiceManager.is() )
{
- m_xURLTransformer = Reference< XURLTransformer >(
- m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ m_xURLTransformer = com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() );
}
return m_xURLTransformer;
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index ea31875b346d..10b9e85862a4 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -33,12 +33,14 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/miscopt.hxx>
#include <toolkit/unohlp.hxx>
#include <vcl/toolbox.hxx>
+#include <comphelper/componentcontext.hxx>
const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE = 1;
const char TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE[] = "SupportsVisible";
@@ -103,9 +105,9 @@ ToolboxController::ToolboxController(
try
{
- m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ m_pImpl->m_xUrlTransformer.set(
+ ::com::sun::star::util::URLTransformer::create(
+ ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
}
catch(const Exception&)
{
@@ -241,9 +243,9 @@ throw ( Exception, RuntimeException )
try
{
if ( !m_pImpl->m_xUrlTransformer.is() && m_xServiceManager.is() )
- m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
+ m_pImpl->m_xUrlTransformer.set(
+ ::com::sun::star::util::URLTransformer::create(
+ ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
}
catch(const Exception&)
{