diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-13 15:13:34 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-14 08:08:26 +0200 |
commit | 0fd6fc3776ada4682e7286f9a0aaaf4c07b42643 (patch) | |
tree | e09685e233909aa2220f224664b68acc2443992b /linguistic/source/hyphdsp.cxx | |
parent | 0394cb37a2d378511f265004b285fd93df37e5ca (diff) |
fdo#46808, Convert some XMultiServiceFactory to XComponentContext
Change-Id: Ia66283321d4d18d929b2e3406ad420627f73a3fd
Diffstat (limited to 'linguistic/source/hyphdsp.cxx')
-rw-r--r-- | linguistic/source/hyphdsp.cxx | 192 |
1 files changed, 94 insertions, 98 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index 75cd9456955f..7b5c0a96a714 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -321,44 +321,43 @@ Reference< XHyphenatedWord > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - // build service initialization argument - Sequence< Any > aArgs(2); - aArgs.getArray()[0] <<= GetPropSet(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); - // create specific service via it's implementation name - try - { - xHyph = Reference< XHyphenator >( - xMgr->createInstanceWithArguments( - pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "createInstanceWithArguments failed" ); - } - pRef [i] = xHyph; + // build service initialization argument + Sequence< Any > aArgs(2); + aArgs.getArray()[0] <<= GetPropSet(); - Reference< XLinguServiceEventBroadcaster > - xBroadcaster( xHyph, UNO_QUERY ); - if (xBroadcaster.is()) - rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); + // create specific service via it's implementation name + try + { + xHyph = Reference< XHyphenator >( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + pEntry->aSvcImplNames[0], aArgs, xContext ), + UNO_QUERY ); + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "createInstanceWithArguments failed" ); + } + pRef [i] = xHyph; - if (xHyph.is() && xHyph->hasLocale( rLocale )) - xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading, - rProperties ); + Reference< XLinguServiceEventBroadcaster > + xBroadcaster( xHyph, UNO_QUERY ); + if (xBroadcaster.is()) + rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); + + if (xHyph.is() && xHyph->hasLocale( rLocale )) + xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading, + rProperties ); - pEntry->nLastTriedSvcIndex = (sal_Int16) i; - ++i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; + ++i; - // if language is not supported by the services - // remove it from the list. - if (xHyph.is() && !xHyph->hasLocale( rLocale )) - aSvcMap.erase( nLanguage ); - } + // if language is not supported by the services + // remove it from the list. + if (xHyph.is() && !xHyph->hasLocale( rLocale )) + aSvcMap.erase( nLanguage ); } } // if (xEntry.is()) } @@ -453,44 +452,42 @@ Reference< XHyphenatedWord > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - // build service initialization argument - Sequence< Any > aArgs(2); - aArgs.getArray()[0] <<= GetPropSet(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); - // create specific service via it's implementation name - try - { - xHyph = Reference< XHyphenator >( - xMgr->createInstanceWithArguments( - pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "createInstanceWithArguments failed" ); - } - pRef [i] = xHyph; + // build service initialization argument + Sequence< Any > aArgs(2); + aArgs.getArray()[0] <<= GetPropSet(); - Reference< XLinguServiceEventBroadcaster > - xBroadcaster( xHyph, UNO_QUERY ); - if (xBroadcaster.is()) - rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); + // create specific service via it's implementation name + try + { + xHyph = Reference< XHyphenator >( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + pEntry->aSvcImplNames[0], aArgs, xContext ), UNO_QUERY ); + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "createInstanceWithArguments failed" ); + } + pRef [i] = xHyph; - if (xHyph.is() && xHyph->hasLocale( rLocale )) - xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale, - nChkIndex, rProperties ); + Reference< XLinguServiceEventBroadcaster > + xBroadcaster( xHyph, UNO_QUERY ); + if (xBroadcaster.is()) + rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); - pEntry->nLastTriedSvcIndex = (sal_Int16) i; - ++i; + if (xHyph.is() && xHyph->hasLocale( rLocale )) + xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale, + nChkIndex, rProperties ); - // if language is not supported by the services - // remove it from the list. - if (xHyph.is() && !xHyph->hasLocale( rLocale )) - aSvcMap.erase( nLanguage ); - } + pEntry->nLastTriedSvcIndex = (sal_Int16) i; + ++i; + + // if language is not supported by the services + // remove it from the list. + if (xHyph.is() && !xHyph->hasLocale( rLocale )) + aSvcMap.erase( nLanguage ); } } // if (xEntry.is()) } @@ -578,43 +575,42 @@ Reference< XPossibleHyphens > SAL_CALL { Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray(); - Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - // build service initialization argument - Sequence< Any > aArgs(2); - aArgs.getArray()[0] <<= GetPropSet(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); - // create specific service via it's implementation name - try - { - xHyph = Reference< XHyphenator >( - xMgr->createInstanceWithArguments( - pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "createWithArguments failed" ); - } - pRef [i] = xHyph; + // build service initialization argument + Sequence< Any > aArgs(2); + aArgs.getArray()[0] <<= GetPropSet(); + + // create specific service via it's implementation name + try + { + xHyph = Reference< XHyphenator >( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + pEntry->aSvcImplNames[0], aArgs, xContext ), + UNO_QUERY ); + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "createWithArguments failed" ); + } + pRef [i] = xHyph; - Reference< XLinguServiceEventBroadcaster > - xBroadcaster( xHyph, UNO_QUERY ); - if (xBroadcaster.is()) - rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); + Reference< XLinguServiceEventBroadcaster > + xBroadcaster( xHyph, UNO_QUERY ); + if (xBroadcaster.is()) + rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); - if (xHyph.is() && xHyph->hasLocale( rLocale )) - xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties ); + if (xHyph.is() && xHyph->hasLocale( rLocale )) + xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties ); - pEntry->nLastTriedSvcIndex = (sal_Int16) i; - ++i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; + ++i; - // if language is not supported by the services - // remove it from the list. - if (xHyph.is() && !xHyph->hasLocale( rLocale )) - aSvcMap.erase( nLanguage ); - } + // if language is not supported by the services + // remove it from the list. + if (xHyph.is() && !xHyph->hasLocale( rLocale )) + aSvcMap.erase( nLanguage ); } } // if (xEntry.is()) } |