diff options
25 files changed, 58 insertions, 73 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 6005c7a76eec..5f44542fe620 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -50,7 +50,7 @@ #include <com/sun/star/script/BasicErrorException.hpp> #include <com/sun/star/script/XAllListener.hpp> #include <com/sun/star/script/XInvocationAdapterFactory.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> #include <com/sun/star/script/XDefaultMethod.hpp> #include <com/sun/star/script/XDirectInvocation.hpp> @@ -263,11 +263,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void ) Reference< XComponentContext > xContext = getComponentContext_Impl(); if( xContext.is() ) { - Reference<XMultiComponentFactory> xSMgr = xContext->getServiceManager(); - xTypeConverter = Reference<XTypeConverter>( - xSMgr->createInstanceWithContext( - ::rtl::OUString( "com.sun.star.script.Converter"), - xContext ), UNO_QUERY ); + xTypeConverter = Converter::create(xContext); } if( !xTypeConverter.is() ) { diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index 3ade1e7428e5..644d2d9a54ef 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/reflection/XIdlClass.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XIdlMethod.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/script/XEngineListener.hpp> #include <com/sun/star/script/XEventAttacher2.hpp> #include <com/sun/star/script/XEventAttacherManager.hpp> @@ -43,6 +43,7 @@ #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> +#include <comphelper/componentcontext.hxx> #include <deque> #include <algorithm> @@ -381,11 +382,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect { xAttacher = Reference< XEventAttacher2 >::query( xIFace ); } - xIFace = rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )) ); - if ( xIFace.is() ) - { - xConverter = Reference< XTypeConverter >::query( xIFace ); - } + xConverter = Converter::create(comphelper::ComponentContext(rSMgr).getUNOContext()); } Reference< XInitialization > xInit( xAttacher, UNO_QUERY ); diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 209ca09dce31..1b63c7d7e540 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -82,6 +82,7 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/sdbc/XRow.hpp> using rtl::OUStringBuffer; @@ -97,6 +98,7 @@ using com::sun::star::lang::XComponent; using com::sun::star::lang::XInitialization; using com::sun::star::lang::IllegalArgumentException; +using com::sun::star::script::Converter; using com::sun::star::script::XTypeConverter; using com::sun::star::uno::RuntimeException; @@ -543,9 +545,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) OUString url; Sequence< PropertyValue > args; - Reference< XTypeConverter > tc( m_ctx->getServiceManager()->createInstanceWithContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" ) ), m_ctx ), - UNO_QUERY); + Reference< XTypeConverter > tc( Converter::create(m_ctx) ); if( ! tc.is() ) { throw RuntimeException( diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 5c09efc38dfe..854c7f122a4e 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/i18n/XLocaleData.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> #include <com/sun/star/sdb/SQLFilterOperator.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> @@ -1594,7 +1595,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert if ( aValue.hasValue() ) { if( !m_xTypeConverter.is() ) - m_aContext.createComponent( "com.sun.star.script.Converter", m_xTypeConverter ); + m_xTypeConverter.set( Converter::create(m_aContext.getUNOContext()) ); OSL_ENSURE(m_xTypeConverter.is(),"NO typeconverter!"); if ( nType != DataType::BOOLEAN && DataType::BIT != nType ) diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index dbf3943d8544..0cd31ad5274e 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/table/ShadowLocation.hpp> #include <com/sun/star/table/TableBorder.hpp> @@ -2013,8 +2013,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { // serialization for basic macro recording uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")), - uno::UNO_QUERY ); + ( script::Converter::create(::comphelper::getProcessComponentContext()) ); uno::Sequence < uno::Any > aSeq; uno::Any aNew; try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); } @@ -2817,9 +2816,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE ) { // serialization for basic macro recording - uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")), - uno::UNO_QUERY ); + uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(::comphelper::getProcessComponentContext()) ); uno::Any aNew; uno::Sequence < uno::Any > aSeq; try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); } diff --git a/eventattacher/Library_evtatt.mk b/eventattacher/Library_evtatt.mk index bab924313dd9..02363a0e81b2 100644 --- a/eventattacher/Library_evtatt.mk +++ b/eventattacher/Library_evtatt.mk @@ -33,6 +33,7 @@ $(eval $(call gb_Library_Library,evtatt)) $(eval $(call gb_Library_set_componentfile,evtatt,eventattacher/source/evtatt)) $(eval $(call gb_Library_use_libraries,evtatt,\ + comphelper \ cppuhelper \ cppu \ sal \ diff --git a/eventattacher/prj/build.lst b/eventattacher/prj/build.lst index 6e5faf8a8fa5..1f634bf3868b 100644 --- a/eventattacher/prj/build.lst +++ b/eventattacher/prj/build.lst @@ -1,2 +1,2 @@ -ea eventattacher : offapi cppuhelper LIBXSLT:libxslt NULL +ea eventattacher : offapi comphelper cppuhelper LIBXSLT:libxslt NULL ea eventattacher\prj nmake - all ea_prj NULL diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 2224d33424ae..522940eb30ae 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -25,13 +25,14 @@ #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/script/XEventAttacher2.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/script/XAllListener.hpp> #include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> // InvocationToAllListenerMapper #include <com/sun/star/script/XInvocation.hpp> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase1.hxx> @@ -433,8 +434,7 @@ Reference< XTypeConverter > EventAttacherImpl::getConverter() throw( Exception ) Guard< Mutex > aGuard( m_aMutex ); if( !m_xConverter.is() ) { - Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString("com.sun.star.script.Converter") ) ); - m_xConverter = Reference< XTypeConverter >( xIFace, UNO_QUERY ); + m_xConverter = Converter::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()); } return m_xConverter; } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 6d630decda24..4d19034ce73e 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XHyperlinkControl.hpp> #include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -316,10 +317,7 @@ namespace pcr { DBG_CTOR( GenericPropertyHandler, NULL ); - m_xTypeConverter = Reference< XTypeConverter >( - m_aContext.createComponent( "com.sun.star.script.Converter" ), - UNO_QUERY_THROW - ); + m_xTypeConverter = Converter::create(_rxContext); } //-------------------------------------------------------------------- diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index b41c0fc2255a..d19ebf358e4f 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/script/Converter.hpp> #include <tools/debug.hxx> #include <unotools/confignode.hxx> @@ -73,10 +74,7 @@ namespace pcr { DBG_CTOR( PropertyHandler, NULL ); - m_xTypeConverter = Reference< XTypeConverter >( - m_aContext.createComponent( "com.sun.star.script.Converter" ), - UNO_QUERY_THROW - ); + m_xTypeConverter = Converter::create(_rxContext); } //-------------------------------------------------------------------- diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx index b061da596aaa..525db6125287 100644 --- a/framework/source/recording/dispatchrecorder.cxx +++ b/framework/source/recording/dispatchrecorder.cxx @@ -29,10 +29,12 @@ #include <recording/dispatchrecorder.hxx> #include <com/sun/star/frame/DispatchStatement.hpp> +#include <com/sun/star/script/Converter.hpp> #include <threadhelp/writeguard.hxx> #include <threadhelp/readguard.hxx> #include <services.h> #include <vcl/svapp.hxx> +#include <comphelper/componentcontext.hxx> using namespace ::com::sun::star::uno; @@ -130,7 +132,7 @@ DispatchRecorder::DispatchRecorder( const css::uno::Reference< css::lang::XMulti : ThreadHelpBase ( &Application::GetSolarMutex() ) , ::cppu::OWeakObject( ) , m_xSMGR ( xSMGR ) - , m_xConverter( m_xSMGR->createInstance(::rtl::OUString("com.sun.star.script.Converter")), css::uno::UNO_QUERY ) + , m_xConverter( css::script::Converter::create(comphelper::ComponentContext(m_xSMGR).getUNOContext()) ) { } diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index b021fdd43e1a..3196be6e399f 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -30,6 +30,7 @@ #include <typelib/typedescription.hxx> #include <com/sun/star/beans/XMaterialHolder.hpp> +#include <com/sun/star/script/Converter.hpp> using rtl::OUString; using rtl::OUStringToOString; @@ -50,6 +51,7 @@ using com::sun::star::uno::XComponentContext; using com::sun::star::lang::XSingleServiceFactory; using com::sun::star::lang::XUnoTunnel; using com::sun::star::reflection::XIdlReflection; +using com::sun::star::script::Converter; using com::sun::star::script::XTypeConverter; using com::sun::star::script::XInvocationAdapterFactory2; using com::sun::star::script::XInvocation; @@ -256,11 +258,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx ) OUString( "pyuno: couldn't instantiate invocation service" ), Reference< XInterface > () ); - c->xTypeConverter = Reference< XTypeConverter > ( - ctx->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.script.Converter" ), - ctx ), - UNO_QUERY ); + c->xTypeConverter = Converter::create(ctx); if( ! c->xTypeConverter.is() ) throw RuntimeException( OUString( "pyuno: couldn't instantiate typeconverter service" ), diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 8866591f1d78..f044ace483b4 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/inspection/XNumericControl.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/util/MeasureUnit.hpp> @@ -73,7 +74,7 @@ DataProviderHandler::DataProviderHandler(uno::Reference< uno::XComponentContext try { m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW); - m_xTypeConverter.set(m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW); + m_xTypeConverter.set(script::Converter::create(m_xContext)); }catch(const uno::Exception &) { diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 2f8dc63133db..796ebd8c7841 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/report/XSection.hpp> #include <com/sun/star/report/XFormattedField.hpp> #include <com/sun/star/report/XFixedLine.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdb/SQLContext.hpp> @@ -256,7 +257,7 @@ GeometryHandler::GeometryHandler(uno::Reference< uno::XComponentContext > const { const uno::Reference< lang::XMultiComponentFactory > xFac = m_xContext->getServiceManager(); m_xFormComponentHandler.set(xFac->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW); - m_xTypeConverter.set(xFac->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW); + m_xTypeConverter.set(script::Converter::create(context)); loadDefaultFunctions(); } catch(const uno::Exception&) diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index b5fda853b822..a2a2217531f7 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -90,7 +91,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) uno::Reference< script::XTypeConverter > getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) { - static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( "com.sun.star.script.Converter" ), xContext ), uno::UNO_QUERY_THROW ); + static uno::Reference< script::XTypeConverter > xTypeConv( script::Converter::create(xContext) ); return xTypeConv; } // helper method to determine if the view ( calc ) is in print-preview mode diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 44b1a3392813..46131aae5c7c 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -39,7 +39,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <rtl/bootstrap.hxx> @@ -214,10 +214,8 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL, OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, sal_False, eDestEnc, pNonConvertableChars); - uno::Reference < script::XTypeConverter > xConverter( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.script.Converter")), - uno::UNO_QUERY_THROW ); + uno::Reference < script::XTypeConverter > xConverter( script::Converter::create( + ::comphelper::getProcessComponentContext() ) ); uno::Reference<beans::XPropertySet> xUserDefinedProps( i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); DBG_ASSERT(xUserDefinedProps.is(), "UserDefinedProperties is null"); diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index 2e89bca14abd..333a97c3ae45 100644 --- a/svl/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -73,8 +73,7 @@ SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const bool SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")), - com::sun::star::uno::UNO_QUERY ); + ( com::sun::star::script::Converter::create( ::comphelper::getProcessComponentContext() )); com::sun::star::uno::Sequence< sal_Int8 > aSeq; com::sun::star::uno::Any aNew; diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index 15398473b9d6..e9b94fdba65d 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> @@ -73,8 +73,7 @@ SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const bool SfxIntegerListItem::PutValue ( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { ::com::sun::star::uno::Reference < ::com::sun::star::script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.script.Converter")), - ::com::sun::star::uno::UNO_QUERY ); + ( ::com::sun::star::script::Converter::create(::comphelper::getProcessComponentContext()) ); ::com::sun::star::uno::Any aNew; try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); } catch (::com::sun::star::uno::Exception&) diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index b634a72a7a8b..de0ca82641df 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -31,7 +31,7 @@ #include <hintids.hxx> #include <com/sun/star/text/XText.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/text/SetVariableType.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/text/UserDataPart.hpp> @@ -954,8 +954,7 @@ String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat, uno::UNO_QUERY_THROW); aAny = xSet->getPropertyValue( rName ); - uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory() - ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY ); + uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) ); uno::Any aNew; aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING ); aNew >>= sVal; @@ -1105,8 +1104,7 @@ String SwDocInfoField::Expand() const { // if the field is "fixed" we don't update it from the property ::rtl::OUString sVal; - uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory() - ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY ); + uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) ); util::Date aDate; util::DateTime aDateTime; util::Duration aDuration; diff --git a/ucb/Library_cached1.mk b/ucb/Library_cached1.mk index e548fa710099..85b1fc29c596 100644 --- a/ucb/Library_cached1.mk +++ b/ucb/Library_cached1.mk @@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,cached1,ucb/source/cacher/cached1)) $(eval $(call gb_Library_use_sdk_api,cached1)) $(eval $(call gb_Library_use_libraries,cached1,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/ucb/Library_ucpfile1.mk b/ucb/Library_ucpfile1.mk index d0b301e12d6a..ed68c8938fb1 100644 --- a/ucb/Library_ucpfile1.mk +++ b/ucb/Library_ucpfile1.mk @@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,ucpfile1,ucb/source/ucp/file/ucpfile1 $(eval $(call gb_Library_use_sdk_api,ucpfile1)) $(eval $(call gb_Library_use_libraries,ucpfile1,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index e08b6572f530..d1cc70444721 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -32,10 +32,11 @@ #include <com/sun/star/ucb/FetchError.hpp> #include <com/sun/star/ucb/ResultSetException.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <rtl/ustring.hxx> #include <osl/diagnose.h> +#include <comphelper/componentcontext.hxx> using namespace com::sun::star::beans; using namespace com::sun::star::lang; @@ -2148,10 +2149,7 @@ const Reference< XTypeConverter >& CachedContentResultSet::getTypeConverter() if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() ) { m_bTriedToGetTypeConverter = sal_True; - m_xTypeConverter = Reference< XTypeConverter >( - m_xSMgr->createInstance( - OUString( "com.sun.star.script.Converter" ) ), - UNO_QUERY ); + m_xTypeConverter = Reference< XTypeConverter >( Converter::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()) ); OSL_ENSURE( m_xTypeConverter.is(), "PropertyValueSet::getTypeConverter() - " diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx index 0c78507540af..90fe7c917ace 100644 --- a/ucb/source/ucp/file/filrow.cxx +++ b/ucb/source/ucp/file/filrow.cxx @@ -29,6 +29,8 @@ #include "filrow.hxx" #include "shell.hxx" #include "prov.hxx" +#include <com/sun/star/script/Converter.hpp> +#include <comphelper/componentcontext.hxx> using namespace fileaccess; using namespace com::sun::star; @@ -51,8 +53,7 @@ sal_Bool convert( shell* pShell, if( ! xConverter.is() ) { xConverter = uno::Reference< script::XTypeConverter >( - pShell->m_xMultiServiceFactory->createInstance( - rtl::OUString("com.sun.star.script.Converter") ), uno::UNO_QUERY ); + script::Converter::create(comphelper::ComponentContext(pShell->m_xMultiServiceFactory).getUNOContext()) ); } try diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx index e08122bc4e08..11308d37a79f 100644 --- a/ucbhelper/source/provider/propertyvalueset.cxx +++ b/ucbhelper/source/provider/propertyvalueset.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/script/Converter.hpp> #include "osl/diagnose.h" #include "osl/mutex.hxx" @@ -628,11 +628,9 @@ const Reference< XTypeConverter >& PropertyValueSet::getTypeConverter() if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() ) { m_bTriedToGetTypeConverter = sal_True; - m_xTypeConverter = Reference< XTypeConverter >( - m_xSMgr->createInstance( - OUString( - "com.sun.star.script.Converter" ) ), - UNO_QUERY ); + Reference< XPropertySet > xFactoryProperties( m_xSMgr, UNO_QUERY_THROW ); + Reference< XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY_THROW ); + m_xTypeConverter = Converter::create(xContext); OSL_ENSURE( m_xTypeConverter.is(), "PropertyValueSet::getTypeConverter() - " diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index ff9681d4c721..748a4c067344 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> +#include <com/sun/star/script/Converter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -118,7 +119,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) uno::Reference< script::XTypeConverter > getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) { - static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( "com.sun.star.script.Converter" ), xContext ), uno::UNO_QUERY_THROW ); + static uno::Reference< script::XTypeConverter > xTypeConv( script::Converter::create(xContext) ); return xTypeConv; } const uno::Any& |