diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2008-07-16 12:48:06 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2008-07-16 12:48:06 +0000 |
commit | bd0b83172e62e95983283cd478528c4478402726 (patch) | |
tree | ae028bd0324f8527ba9366799998954bea20988b /linguistic/source/lngsvcmgr.cxx | |
parent | 4e6106c38fcd9b072fc172914fd5b85a5e04e7a9 (diff) |
INTEGRATION: CWS tl55 (1.31.2); FILE MERGED
2008/06/13 15:20:17 tl 1.31.2.2: #i85999# grammart checking framework
2008/06/11 08:17:41 mba 1.31.2.1: some fixes
Diffstat (limited to 'linguistic/source/lngsvcmgr.cxx')
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 80 |
1 files changed, 46 insertions, 34 deletions
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 3c3b273965dc..a8d595e85789 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: lngsvcmgr.cxx,v $ - * $Revision: 1.31 $ + * $Revision: 1.32 $ * * This file is part of OpenOffice.org. * @@ -858,20 +858,24 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl() while (xEnum->hasMoreElements()) { Any aCurrent = xEnum->nextElement(); + Reference< XSingleComponentFactory > xCompFactory; Reference< XSingleServiceFactory > xFactory; - if (!::cppu::extractInterface( xFactory, aCurrent ) || - !xFactory.is()) - continue; - Reference< XSpellChecker > xSvc; - try - { - xSvc = Reference< XSpellChecker >( xFactory->createInstance(), UNO_QUERY ); - } - catch (uno::Exception &) + if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) ) { - DBG_ERROR( "createInstance failed" ); + try + { + Reference < XComponentContext > xContext; + Reference< XPropertySet > xProps( xFac, UNO_QUERY ); + + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; + xSvc = Reference< XSpellChecker >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY ); + } + catch (uno::Exception &) + { + DBG_ERROR( "createInstance failed" ); + } } if (xSvc.is()) @@ -905,35 +909,38 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl() if (!pAvailHyphSvcs) { pAvailHyphSvcs = new SvcInfoArray; - Reference< XMultiServiceFactory > xFac( getProcessServiceFactory() ); if (xFac.is()) { Reference< XContentEnumerationAccess > xEnumAccess( xFac, UNO_QUERY ); Reference< XEnumeration > xEnum; if (xEnumAccess.is()) - xEnum = xEnumAccess->createContentEnumeration( - A2OU( SN_HYPHENATOR ) ); + xEnum = xEnumAccess->createContentEnumeration( A2OU( SN_HYPHENATOR ) ); if (xEnum.is()) { while (xEnum->hasMoreElements()) { Any aCurrent = xEnum->nextElement(); + Reference< XSingleComponentFactory > xCompFactory; Reference< XSingleServiceFactory > xFactory; - if (!::cppu::extractInterface( xFactory, aCurrent ) || - !xFactory.is()) - continue; - Reference< XHyphenator > xSvc; - try + if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) ) { - xSvc = Reference< XHyphenator >( xFactory->createInstance(), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ERROR( "createInstance failed" ); + try + { + Reference < XComponentContext > xContext; + Reference< XPropertySet > xProps( xFac, UNO_QUERY ); + + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; + xSvc = Reference< XHyphenator >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY ); + + } + catch (uno::Exception &) + { + DBG_ERROR( "createInstance failed" ); + } } if (xSvc.is()) @@ -982,20 +989,25 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl() while (xEnum->hasMoreElements()) { Any aCurrent = xEnum->nextElement(); - Reference< XSingleServiceFactory > xFactory; - if (!::cppu::extractInterface( xFactory, aCurrent ) || - !xFactory.is()) - continue; + Reference< XSingleComponentFactory > xCompFactory; + Reference< XSingleServiceFactory > xFactory; Reference< XThesaurus > xSvc; - try + if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) ) { - xSvc = Reference< XThesaurus >( xFactory->createInstance(), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ERROR( "createInstance failed" ); + try + { + Reference < XComponentContext > xContext; + Reference< XPropertySet > xProps( xFac, UNO_QUERY ); + + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; + xSvc = Reference< XThesaurus >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY ); + } + catch (uno::Exception &) + { + DBG_ERROR( "createInstance failed" ); + } } if (xSvc.is()) |