From 86c1ebc1ef4a90e9bc58fb69c2d1d978765a34ca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 May 2013 15:02:35 +0200 Subject: fdo#46808, Convert util::PathSettings service to new style Change-Id: I302be46b46518e1e872771e1c8a0647f7c330b30 --- linguistic/source/misc2.cxx | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'linguistic') diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx index de5ac2442b34..d3ed5504a06a 100644 --- a/linguistic/source/misc2.cxx +++ b/linguistic/source/misc2.cxx @@ -28,10 +28,10 @@ #include #include #include - #include #include #include +#include #include "linguistic/misc.hxx" @@ -70,28 +70,25 @@ static uno::Sequence< OUString > GetMultiPaths_Impl( OUString aWritablePath; bool bSuccess = true; - uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); - if (xMgr.is()) + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + try { - try - { - String aInternal( rPathPrefix ); - String aUser( rPathPrefix ); - String aWriteable( rPathPrefix ); - aInternal .AppendAscii( "_internal" ); - aUser .AppendAscii( "_user" ); - aWriteable.AppendAscii( "_writable" ); - - uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( - "com.sun.star.util.PathSettings" ), uno::UNO_QUERY_THROW ); - xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; - xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; - xPathSettings->getPropertyValue( aWriteable ) >>= aWritablePath; - } - catch (uno::Exception &) - { - bSuccess = false; - } + String aInternal( rPathPrefix ); + String aUser( rPathPrefix ); + String aWriteable( rPathPrefix ); + aInternal .AppendAscii( "_internal" ); + aUser .AppendAscii( "_user" ); + aWriteable.AppendAscii( "_writable" ); + + uno::Reference< util::XPathSettings > xPathSettings = + util::PathSettings::create( xContext ); + xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; + xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; + xPathSettings->getPropertyValue( aWriteable ) >>= aWritablePath; + } + catch (uno::Exception &) + { + bSuccess = false; } if (bSuccess) { -- cgit