summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/inc/comphelper/processfactory.hxx30
-rw-r--r--comphelper/source/processfactory/processfactory.cxx41
-rw-r--r--editeng/source/misc/svxacorr.cxx2
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx2
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx2
-rw-r--r--vcl/source/app/svmain.cxx2
-rw-r--r--vcl/source/gdi/impimagetree.cxx3
7 files changed, 29 insertions, 53 deletions
diff --git a/comphelper/inc/comphelper/processfactory.hxx b/comphelper/inc/comphelper/processfactory.hxx
index dbcd647ee54e..e6833fc49327 100644
--- a/comphelper/inc/comphelper/processfactory.hxx
+++ b/comphelper/inc/comphelper/processfactory.hxx
@@ -39,34 +39,17 @@ namespace comphelper
COMPHELPER_DLLPUBLIC void setProcessServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr);
/**
- * This function get the process service factory. If no service factory is set the function returns
- * a null interface.
+ * This function gets the process service factory.
+ *
+ * If no service factory is set the function throws a RuntimeException.
*
* @author Juergen Schmidt
*/
COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getProcessServiceFactory();
-/** creates a component, using the process factory if set
- @see getProcessServiceFactory
- @see setProcessServiceFactory
-*/
-COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
- createProcessComponent(
- const ::rtl::OUString& _rServiceSpecifier
- ) SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) );
-
-/** creates a component with arguments, using the process factory if set
+/** Obtains a component context from a service factory.
- @see getProcessServiceFactory
- @see setProcessServiceFactory
-*/
-COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
- createProcessComponentWithArguments(
- const ::rtl::OUString& _rServiceSpecifier,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArgs
- ) SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) );
-
-/** Tries to obtain a component context from a service factory.
+ Throws a RuntimeException if no component context can be obtained.
@param factory may be null
@return may be null
@@ -79,7 +62,8 @@ getComponentContext(
/**
* This function gets the process service factory's default component context.
- * If no service factory is set the function returns a null interface.
+ *
+ * Throws a RuntimeException if no component context can be obtained.
*/
COMPHELPER_DLLPUBLIC
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx
index c44d57991934..deb9b4f80260 100644
--- a/comphelper/source/processfactory/processfactory.cxx
+++ b/comphelper/source/processfactory/processfactory.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "com/sun/star/beans/XPropertySet.hpp"
-
+#include "com/sun/star/uno/DeploymentException.hpp"
using namespace ::com::sun::star;
using namespace com::sun::star::uno;
@@ -59,32 +59,14 @@ Reference< XMultiServiceFactory > getProcessServiceFactory()
{
Reference< XMultiServiceFactory> xReturn;
xReturn = localProcessFactory( xReturn, sal_False );
+ if ( !xReturn.is() )
+ {
+ throw DeploymentException(
+ "null process service factory", Reference< XInterface >() );
+ }
return xReturn;
}
-Reference< XInterface > createProcessComponent( const ::rtl::OUString& _rServiceSpecifier ) SAL_THROW( ( RuntimeException ) )
-{
- Reference< XInterface > xComponent;
-
- Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
- if ( xFactory.is() )
- xComponent = xFactory->createInstance( _rServiceSpecifier );
-
- return xComponent;
-}
-
-Reference< XInterface > createProcessComponentWithArguments( const ::rtl::OUString& _rServiceSpecifier,
- const Sequence< Any >& _rArgs ) SAL_THROW( ( RuntimeException ) )
-{
- Reference< XInterface > xComponent;
-
- Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
- if ( xFactory.is() )
- xComponent = xFactory->createInstanceWithArguments( _rServiceSpecifier, _rArgs );
-
- return xComponent;
-}
-
Reference< XComponentContext > getComponentContext(
Reference< XMultiServiceFactory > const & factory)
{
@@ -96,9 +78,18 @@ Reference< XComponentContext > getComponentContext(
RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ),
uno::UNO_QUERY );
}
- catch (beans::UnknownPropertyException const&) {
+ catch (beans::UnknownPropertyException & e) {
+ throw DeploymentException(
+ "unknown service factory DefaultContext property: " + e.Message,
+ Reference< XInterface >( factory, UNO_QUERY ) );
}
}
+ if ( !xRet.is() )
+ {
+ throw DeploymentException(
+ "no service factory DefaultContext",
+ Reference< XInterface >( factory, UNO_QUERY ) );
+ }
return xRet;
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ed83e4d592aa..68c0d29547d3 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -443,7 +443,7 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber(
// Check if the characters after that number correspond to the ordinal suffix
rtl::OUString sServiceName("com.sun.star.i18n.OrdinalSuffix");
uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix(
- comphelper::createProcessComponent( sServiceName ),
+ comphelper::getProcessServiceFactory()->createInstance( sServiceName ),
uno::UNO_QUERY );
if ( xOrdSuffix.is( ) )
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index 9f9734be4859..0ddd918e84fa 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -270,7 +270,7 @@ void AccessibleControlShape::Init()
// finally, aggregate a proxy for the control context
// first a factory for the proxy
Reference< XProxyFactory > xFactory;
- xFactory = xFactory.query( createProcessComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ) ) );
+ xFactory = xFactory.query( getProcessServiceFactory()->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ) ) );
OSL_ENSURE( xFactory.is(), "AccessibleControlShape::Init: could not create a proxy factory!" );
// then the proxy itself
if ( xFactory.is() && xNativeControlContext.is() )
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index 230f966fdf48..93c8f1768821 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -84,7 +84,7 @@ namespace toolkit
{
rbTriedCreation = true;
rDefaultFormats = Reference< XNumberFormatsSupplier >(
- ::comphelper::createProcessComponent(
+ ::comphelper::getProcessServiceFactory()->createInstance(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier" ) ) ),
UNO_QUERY_THROW
);
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index fe895a54da0e..285f7137ccd4 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -487,7 +487,7 @@ void DeInitVCL()
try
{
uno::Reference<lang::XComponent> const xDesktop(
- comphelper::createProcessComponent(
+ comphelper::getProcessServiceFactory()->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),
uno::UNO_QUERY_THROW)
;
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 374ce851eae8..1e34be389a31 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -39,6 +39,7 @@
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/io/XInputStream.hpp"
#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
@@ -409,7 +410,7 @@ bool ImplImageTree::find(
args[0] <<= i->first + ".zip";
try {
i->second.set(
- comphelper::createProcessComponentWithArguments(
+ comphelper::getProcessServiceFactory()->createInstanceWithArguments(
rtl::OUString( "com.sun.star.packages.zip.ZipFileAccess"),
args),
css::uno::UNO_QUERY_THROW);