cui/source/dialogs/thesdlg.cxx | 2 cui/source/options/optlingu.cxx | 257 ++++++-------- editeng/inc/editeng/unolingu.hxx | 6 editeng/source/misc/unolingu.cxx | 32 - lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 16 linguistic/inc/linguistic/misc.hxx | 1 linguistic/source/lngsvcmgr.cxx | 2 linguistic/source/lngsvcmgr.hxx | 12 offapi/UnoApi_offapi.mk | 3 offapi/com/sun/star/linguistic2/LinguServiceManager.idl | 13 offapi/com/sun/star/linguistic2/XLinguServiceManager2.idl | 46 ++ offapi/type_reference/types.rdb |binary qadevOOo/objdsc/lng/com.sun.star.lingu2.LngSvcMgr.csv | 16 sc/CppunitTest_sc_filters_test.mk | 1 sc/CppunitTest_sc_macros_test.mk | 1 sc/CppunitTest_sc_subsequent_filters_test.mk | 1 sd/CppunitTest_sd_filters_test.mk | 1 sd/CppunitTest_sd_regression_test.mk | 1 sd/CppunitTest_sd_uimpress.mk | 1 sfx2/source/menu/thessubmenu.cxx | 35 - sfx2/source/menu/thessubmenu.hxx | 4 svx/source/dialog/langbox.cxx | 1 svx/source/unodraw/unoshtxt.cxx | 18 sw/CppunitTest_sw_subsequent_odfexport.mk | 1 sw/CppunitTest_sw_subsequent_odfimport.mk | 1 sw/CppunitTest_sw_subsequent_ooxmlexport.mk | 1 sw/CppunitTest_sw_subsequent_ooxmlimport.mk | 1 sw/CppunitTest_sw_subsequent_rtfexport.mk | 1 sw/CppunitTest_sw_subsequent_rtfimport.mk | 1 sw/CppunitTest_sw_subsequent_ww8export.mk | 1 sw/CppunitTest_sw_subsequent_ww8import.mk | 1 sw/inc/dlelstnr.hxx | 4 sw/source/ui/uno/dlelstnr.cxx | 48 +- vcl/source/gdi/outdev3.cxx | 16 34 files changed, 275 insertions(+), 271 deletions(-)
New commits: commit ddcf2363bad1d84874dfe4e31e4783ffd761d5bb Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 30 11:40:18 2012 +0100 fdo#46808: Improve previous commit * Removing m_xLngMgr.is() check from SfxThesSubMenuHelper::GetThesImplName was unsound with SfxThesSubMenuHelper ctor swallowing Exception; best fix appears to be to remove the swallowing. * Prefer forward declarations over #includes. Change-Id: Ie4e7dcd6cdb14046516d119605bbf78e81359768 diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 1a64588..f4c5f47 100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -64,18 +64,12 @@ void SfxThesSubMenuHelper::GetLocale( } -SfxThesSubMenuHelper::SfxThesSubMenuHelper() +SfxThesSubMenuHelper::SfxThesSubMenuHelper(): + m_xLngMgr( + linguistic2::LinguServiceManager::create( + comphelper::getProcessComponentContext())), + m_xThesarus(m_xLngMgr->getThesaurus()) { - try - { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - m_xLngMgr = linguistic2::LinguServiceManager::create(xContext); - m_xThesarus = m_xLngMgr->getThesaurus(); - } - catch (const uno::Exception &) - { - DBG_ASSERT( 0, "failed to get thesaurus" ); - } } diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx index 918ebf7..88ee1cc 100644 --- a/sw/inc/dlelstnr.hxx +++ b/sw/inc/dlelstnr.hxx @@ -23,7 +23,6 @@ #include <cppuhelper/weak.hxx> #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <cppuhelper/implbase2.hxx> // helper for implementations @@ -32,6 +31,7 @@ namespace com { namespace sun { namespace star { namespace linguistic2 { class XDictionaryList; + class XLinguServiceManager2; class XProofreadingIterator; } namespace frame { commit 43d9f35c2665e55cfb5ee911a554ef71933ad4d1 Author: Noel Grandin <n...@peralex.com> Date: Fri Oct 26 14:24:46 2012 +0200 fdo#46808, Adapt linguistic2::LinguServiceManager UNO service to new style Create a merged XLinguServiceManager2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I297bada1066cd74809108641b56ee4d5898112ec diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index 3763f68..590dda3 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -48,7 +48,7 @@ #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/linguistic2/XMeaning.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> using namespace ::com::sun::star; using ::rtl::OUString; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index f6b65f3..705bf0c 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -32,6 +32,7 @@ #include <tools/urlobj.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/linguistic2/XSpellChecker.hpp> #include <com/sun/star/linguistic2/XProofreader.hpp> #include <com/sun/star/linguistic2/XHyphenator.hpp> @@ -63,6 +64,7 @@ #include <cuires.hrc> #include "helpid.hrc" +#include <comphelper/componentcontext.hxx> #include <ucbhelper/content.hxx> #include <vector> @@ -518,7 +520,7 @@ class SvxLinguData_Impl LangImplNameTable aCfgThesTable; LangImplNameTable aCfgGrammarTable; uno::Reference< XMultiServiceFactory > xMSF; - uno::Reference< XLinguServiceManager > xLinguSrvcMgr; + uno::Reference< XLinguServiceManager2 > xLinguSrvcMgr; sal_Bool AddRemove( Sequence< OUString > &rConfigured, @@ -531,7 +533,7 @@ public: SvxLinguData_Impl & operator = (const SvxLinguData_Impl &rData); - uno::Reference<XLinguServiceManager> & GetManager() { return xLinguSrvcMgr; } + uno::Reference<XLinguServiceManager2> & GetManager() { return xLinguSrvcMgr; } void SetChecked( const Sequence< OUString > &rConfiguredServices ); void Reconfigure( const OUString &rDisplayName, sal_Bool bEnable ); @@ -731,143 +733,138 @@ SvxLinguData_Impl::SvxLinguData_Impl() : nDisplayServices (0) { xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < XInterface > xI = xMSF->createInstance( - "com.sun.star.linguistic2.LinguServiceManager" ); - xLinguSrvcMgr = uno::Reference<XLinguServiceManager>(xI, UNO_QUERY); - DBG_ASSERT(xLinguSrvcMgr.is(), "No linguistic service available!"); - if(xLinguSrvcMgr.is()) - { - Locale aCurrentLocale; - LanguageType eLang = Application::GetSettings().GetLanguage(); - SvxLanguageToLocale(aCurrentLocale, eLang); - Sequence<Any> aArgs(2);//second arguments has to be empty! - aArgs.getArray()[0] <<= SvxGetLinguPropertySet(); - - //read spell checker - Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices( - cSpell, Locale() ); - const OUString* pSpellNames = aSpellNames.getConstArray(); - - sal_Int32 nIdx; - for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++) + xLinguSrvcMgr = LinguServiceManager::create(comphelper::getComponentContext(xMSF)); + + Locale aCurrentLocale; + LanguageType eLang = Application::GetSettings().GetLanguage(); + SvxLanguageToLocale(aCurrentLocale, eLang); + Sequence<Any> aArgs(2);//second arguments has to be empty! + aArgs.getArray()[0] <<= SvxGetLinguPropertySet(); + + //read spell checker + Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices( + cSpell, Locale() ); + const OUString* pSpellNames = aSpellNames.getConstArray(); + + sal_Int32 nIdx; + for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++) + { + ServiceInfo_Impl aInfo; + aInfo.sSpellImplName = pSpellNames[nIdx]; + aInfo.xSpell = uno::Reference<XSpellChecker>( + xMSF->createInstanceWithArguments(aInfo.sSpellImplName, aArgs), UNO_QUERY); + + uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY); + if(xDispName.is()) + aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); + + const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() ); + //! suppress display of entries with no supported languages (see feature 110994) + if (aLocales.getLength()) { - ServiceInfo_Impl aInfo; - aInfo.sSpellImplName = pSpellNames[nIdx]; - aInfo.xSpell = uno::Reference<XSpellChecker>( - xMSF->createInstanceWithArguments(aInfo.sSpellImplName, aArgs), UNO_QUERY); - - uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } + lcl_MergeLocales( aAllServiceLocales, aLocales ); + lcl_MergeDisplayArray( *this, aInfo ); } + } - //read grammar checker - Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices( - cGrammar, Locale() ); - const OUString* pGrammarNames = aGrammarNames.getConstArray(); - for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++) - { - ServiceInfo_Impl aInfo; - aInfo.sGrammarImplName = pGrammarNames[nIdx]; - aInfo.xGrammar = uno::Reference<XProofreader>( - xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY); - - uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } - } + //read grammar checker + Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices( + cGrammar, Locale() ); + const OUString* pGrammarNames = aGrammarNames.getConstArray(); + for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++) + { + ServiceInfo_Impl aInfo; + aInfo.sGrammarImplName = pGrammarNames[nIdx]; + aInfo.xGrammar = uno::Reference<XProofreader>( + xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY); + + uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY); + if(xDispName.is()) + aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - //read hyphenator - Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices( - cHyph, Locale() ); - const OUString* pHyphNames = aHyphNames.getConstArray(); - for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++) + const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() ); + //! suppress display of entries with no supported languages (see feature 110994) + if (aLocales.getLength()) { - ServiceInfo_Impl aInfo; - aInfo.sHyphImplName = pHyphNames[nIdx]; - aInfo.xHyph = uno::Reference<XHyphenator>( - xMSF->createInstanceWithArguments(aInfo.sHyphImplName, aArgs), UNO_QUERY); - - uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } + lcl_MergeLocales( aAllServiceLocales, aLocales ); + lcl_MergeDisplayArray( *this, aInfo ); } + } + + //read hyphenator + Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices( + cHyph, Locale() ); + const OUString* pHyphNames = aHyphNames.getConstArray(); + for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++) + { + ServiceInfo_Impl aInfo; + aInfo.sHyphImplName = pHyphNames[nIdx]; + aInfo.xHyph = uno::Reference<XHyphenator>( + xMSF->createInstanceWithArguments(aInfo.sHyphImplName, aArgs), UNO_QUERY); - //read thesauri - Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices( - cThes, Locale() ); - const OUString* pThesNames = aThesNames.getConstArray(); - for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++) + uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY); + if(xDispName.is()) + aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); + + const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() ); + //! suppress display of entries with no supported languages (see feature 110994) + if (aLocales.getLength()) { - ServiceInfo_Impl aInfo; - aInfo.sThesImplName = pThesNames[nIdx]; - aInfo.xThes = uno::Reference<XThesaurus>( - xMSF->createInstanceWithArguments(aInfo.sThesImplName, aArgs), UNO_QUERY); - - uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xThes->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } + lcl_MergeLocales( aAllServiceLocales, aLocales ); + lcl_MergeDisplayArray( *this, aInfo ); } + } + + //read thesauri + Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices( + cThes, Locale() ); + const OUString* pThesNames = aThesNames.getConstArray(); + for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++) + { + ServiceInfo_Impl aInfo; + aInfo.sThesImplName = pThesNames[nIdx]; + aInfo.xThes = uno::Reference<XThesaurus>( + xMSF->createInstanceWithArguments(aInfo.sThesImplName, aArgs), UNO_QUERY); + + uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY); + if(xDispName.is()) + aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - Sequence< OUString > aCfgSvcs; - const Locale* pAllLocales = aAllServiceLocales.getConstArray(); - for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++) + const Sequence< Locale > aLocales( aInfo.xThes->getLocales() ); + //! suppress display of entries with no supported languages (see feature 110994) + if (aLocales.getLength()) { - sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] ); - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cSpell, pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgSpellTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cGrammar, pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgGrammarTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cHyph, pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgHyphTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cThes, pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgThesTable[ nLang ] = aCfgSvcs; + lcl_MergeLocales( aAllServiceLocales, aLocales ); + lcl_MergeDisplayArray( *this, aInfo ); } } + + Sequence< OUString > aCfgSvcs; + const Locale* pAllLocales = aAllServiceLocales.getConstArray(); + for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++) + { + sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] ); + + aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cSpell, pAllLocales[nLocale]); + SetChecked( aCfgSvcs ); + if (aCfgSvcs.getLength()) + aCfgSpellTable[ nLang ] = aCfgSvcs; + + aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cGrammar, pAllLocales[nLocale]); + SetChecked( aCfgSvcs ); + if (aCfgSvcs.getLength()) + aCfgGrammarTable[ nLang ] = aCfgSvcs; + + aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cHyph, pAllLocales[nLocale]); + SetChecked( aCfgSvcs ); + if (aCfgSvcs.getLength()) + aCfgHyphTable[ nLang ] = aCfgSvcs; + + aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cThes, pAllLocales[nLocale]); + SetChecked( aCfgSvcs ); + if (aCfgSvcs.getLength()) + aCfgThesTable[ nLang ] = aCfgSvcs; + } } SvxLinguData_Impl::SvxLinguData_Impl( const SvxLinguData_Impl &rData ) : @@ -1214,7 +1211,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet ) { sal_Int16 nLang = aIt->first; const Sequence< OUString > aImplNames( aIt->second ); - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); + uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() ); Locale aLocale( SvxCreateLocale(nLang) ); if (xMgr.is()) xMgr->setConfiguredServices( cSpell, aLocale, aImplNames ); @@ -1226,7 +1223,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet ) { sal_Int16 nLang = aIt->first; const Sequence< OUString > aImplNames( aIt->second ); - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); + uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() ); Locale aLocale( SvxCreateLocale(nLang) ); if (xMgr.is()) xMgr->setConfiguredServices( cGrammar, aLocale, aImplNames ); @@ -1238,7 +1235,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet ) { sal_Int16 nLang = aIt->first; const Sequence< OUString > aImplNames( aIt->second ); - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); + uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() ); Locale aLocale( SvxCreateLocale(nLang) ); if (xMgr.is()) xMgr->setConfiguredServices( cHyph, aLocale, aImplNames ); @@ -1250,7 +1247,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet ) { sal_Int16 nLang = aIt->first; const Sequence< OUString > aImplNames( aIt->second ); - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); + uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() ); Locale aLocale( SvxCreateLocale(nLang) ); if (xMgr.is()) xMgr->setConfiguredServices( cThes, aLocale, aImplNames ); diff --git a/editeng/inc/editeng/unolingu.hxx b/editeng/inc/editeng/unolingu.hxx index d35737a..66c5370 100644 --- a/editeng/inc/editeng/unolingu.hxx +++ b/editeng/inc/editeng/unolingu.hxx @@ -33,7 +33,7 @@ #include <tools/string.hxx> #include <com/sun/star/util/Language.hpp> #include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XHyphenator.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -52,7 +52,7 @@ class EDITENG_DLLPUBLIC LinguMgr friend class LinguMgrExitLstnr; static ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr; + ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr; static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; static ::com::sun::star::uno::Reference< @@ -107,7 +107,7 @@ public: ::com::sun::star::beans::XPropertySet > GetLinguPropertySet(); static ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr(); + ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr(); static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetStandardDic(); diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 16f2eba..b65ad60 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/linguistic2/XAvailableLocales.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp> @@ -73,16 +74,10 @@ using namespace ::com::sun::star::linguistic2; #define CSS com::sun::star -static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() +static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XLinguServiceManager > xRes; - uno::Reference< XMultiServiceFactory > xMgr = getProcessServiceFactory(); - if (xMgr.is()) - { - xRes = uno::Reference< XLinguServiceManager > ( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguServiceManager" ) ) ), UNO_QUERY ) ; - } + uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create(xContext); return xRes; } @@ -155,9 +150,8 @@ void ThesDummy_Impl::GetThes_Impl() { if (!xThes.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xThes = xLngSvcMgr->getThesaurus(); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xThes = xLngSvcMgr->getThesaurus(); if (xThes.is()) { @@ -261,9 +255,8 @@ void SpellDummy_Impl::GetSpell_Impl() { if (!xSpell.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); } } @@ -373,9 +366,8 @@ void HyphDummy_Impl::GetHyph_Impl() { if (!xHyph.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xHyph = xLngSvcMgr->getHyphenator(); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xHyph = xLngSvcMgr->getHyphenator(); } } @@ -536,7 +528,7 @@ void LinguMgrExitLstnr::AtExit() LinguMgrExitLstnr * LinguMgr::pExitLstnr = 0; sal_Bool LinguMgr::bExiting = sal_False; -uno::Reference< XLinguServiceManager > LinguMgr::xLngSvcMgr = 0; +uno::Reference< XLinguServiceManager2 > LinguMgr::xLngSvcMgr = 0; uno::Reference< XSpellChecker1 > LinguMgr::xSpell = 0; uno::Reference< XHyphenator > LinguMgr::xHyph = 0; uno::Reference< XThesaurus > LinguMgr::xThes = 0; @@ -546,7 +538,7 @@ uno::Reference< XDictionary > LinguMgr::xIgnoreAll = 0; uno::Reference< XDictionary > LinguMgr::xChangeAll = 0; -uno::Reference< XLinguServiceManager > LinguMgr::GetLngSvcMgr() +uno::Reference< XLinguServiceManager2 > LinguMgr::GetLngSvcMgr() { if (bExiting) return 0; diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index b5869c9..981dce4 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -22,6 +22,7 @@ #include <cppuhelper/factory.hxx> // helper for factories #include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <i18npool/mslangid.hxx> #include <tools/debug.hxx> #include <comphelper/processfactory.hxx> @@ -66,17 +67,10 @@ using ::rtl::OUStringToOString; /////////////////////////////////////////////////////////////////////////// -static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() +static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XLinguServiceManager > xRes; - uno::Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - xRes = uno::Reference< XLinguServiceManager > ( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguServiceManager" ) ) ), UNO_QUERY ) ; - } + uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ; return xRes; } @@ -306,7 +300,7 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes uno::Sequence< Reference< XMeaning > > aMeanings( 1 ); uno::Sequence< Reference< XMeaning > > noMeanings( 0 ); - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); uno::Reference< XSpellChecker1 > xSpell; OUString rTerm(qTerm); diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx index 0bf1c5c..984f0fe 100644 --- a/linguistic/inc/linguistic/misc.hxx +++ b/linguistic/inc/linguistic/misc.hxx @@ -57,7 +57,6 @@ class LocaleDataWrapper; #define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker" #define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator" #define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus" -#define SN_LINGU_SERVCICE_MANAGER "com.sun.star.linguistic2.LinguServiceManager" #define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties" #define SN_DICTIONARY_LIST "com.sun.star.linguistic2.DictionaryList" #define SN_DESKTOP "com.sun.star.frame.Desktop" diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 0e9a6e8..bef4892 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -2111,7 +2111,7 @@ uno::Sequence< OUString > LngSvcMgr::getSupportedServiceNames_Static() osl::MutexGuard aGuard( GetLinguMutex() ); uno::Sequence< OUString > aSNS( 1 ); // more than 1 service possible - aSNS.getArray()[0] = SN_LINGU_SERVCICE_MANAGER; + aSNS.getArray()[0] = "com.sun.star.linguistic2.LinguServiceManager"; return aSNS; } diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx index 05f93b9..91de15e 100644 --- a/linguistic/source/lngsvcmgr.hxx +++ b/linguistic/source/lngsvcmgr.hxx @@ -21,15 +21,13 @@ #define _LINGUISTIC_LNGSVCMGR_HXX_ #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include <cppuhelper/implbase5.hxx> // helper for implementations +#include <cppuhelper/implbase3.hxx> // helper for implementations #include <cppuhelper/interfacecontainer.h> //OMultiTypeInterfaceContainerHelper #include <com/sun/star/uno/Reference.h> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> -#include <com/sun/star/linguistic2/XAvailableLocales.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <unotools/configitem.hxx> @@ -57,11 +55,9 @@ namespace com { namespace sun { namespace star { namespace linguistic2 { class LngSvcMgr : - public cppu::WeakImplHelper5 + public cppu::WeakImplHelper3 < - com::sun::star::linguistic2::XLinguServiceManager, - com::sun::star::linguistic2::XAvailableLocales, - com::sun::star::lang::XComponent, + com::sun::star::linguistic2::XLinguServiceManager2, com::sun::star::lang::XServiceInfo, com::sun::star::util::XModifyListener >, diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b1b5e2d..f573d5b 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -158,6 +158,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\ LanguageGuessing \ + LinguServiceManager \ Proofreader \ ProofreadingIterator \ )) @@ -890,7 +891,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/linguis HangulHanjaConversionDictionary \ Hyphenator \ LinguProperties \ - LinguServiceManager \ SpellChecker \ Thesaurus \ )) @@ -2762,6 +2762,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/linguistic2,\ XLinguServiceEventBroadcaster \ XLinguServiceEventListener \ XLinguServiceManager \ + XLinguServiceManager2 \ XMeaning \ XPossibleHyphens \ XProofreader \ diff --git a/offapi/com/sun/star/linguistic2/LinguServiceManager.idl b/offapi/com/sun/star/linguistic2/LinguServiceManager.idl index efdeb0d..fb2d718 100644 --- a/offapi/com/sun/star/linguistic2/LinguServiceManager.idl +++ b/offapi/com/sun/star/linguistic2/LinguServiceManager.idl @@ -19,23 +19,14 @@ #ifndef __com_sun_star_linguistic2_LinguServiceManager_idl__ #define __com_sun_star_linguistic2_LinguServiceManager_idl__ -#include <com/sun/star/lang/XComponent.idl> - +#include <com/sun/star/linguistic2/XLinguServiceManager2.idl> module com { module sun { module star { module linguistic2 { - published interface XLinguServiceManager; - published interface XAvailableLocales; - /** offers linguistic functionality. Is to be used to access spell checker, hyphenator and thesaurus. */ -published service LinguServiceManager -{ - interface com::sun::star::linguistic2::XLinguServiceManager; - interface com::sun::star::linguistic2::XAvailableLocales; - interface com::sun::star::lang::XComponent; -}; +published service LinguServiceManager : XLinguServiceManager2; }; }; }; }; diff --git a/offapi/com/sun/star/linguistic2/XLinguServiceManager2.idl b/offapi/com/sun/star/linguistic2/XLinguServiceManager2.idl new file mode 100644 index 0000000..61a0c7b --- /dev/null +++ b/offapi/com/sun/star/linguistic2/XLinguServiceManager2.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_linguistic2_XLinguServiceManager2_idl__ +#define __com_sun_star_linguistic2_XLinguServiceManager2_idl__ + +#include <com/sun/star/lang/XComponent.idl> +#include <com/sun/star/linguistic2/XLinguServiceManager.idl> +#include <com/sun/star/linguistic2/XAvailableLocales.idl> + + +module com { module sun { module star { module linguistic2 { + +/** + Provides a unified interface for the LinguServiceManager service to implement. + + @since LibreOffice 3.7 +*/ +published interface XLinguServiceManager2 +{ + interface com::sun::star::linguistic2::XLinguServiceManager; + interface com::sun::star::linguistic2::XAvailableLocales; + interface com::sun::star::lang::XComponent; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb index 8a3c658..14cba0b 100644 Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ diff --git a/qadevOOo/objdsc/lng/com.sun.star.lingu2.LngSvcMgr.csv b/qadevOOo/objdsc/lng/com.sun.star.lingu2.LngSvcMgr.csv index 2b3a175..85205b3 100644 --- a/qadevOOo/objdsc/lng/com.sun.star.lingu2.LngSvcMgr.csv +++ b/qadevOOo/objdsc/lng/com.sun.star.lingu2.LngSvcMgr.csv @@ -5,11 +5,11 @@ "LngSvcMgr";"com::sun::star::lang::XComponent";"addEventListener()" "LngSvcMgr";"com::sun::star::lang::XComponent";"removeEventListener()" "LngSvcMgr";"com::sun::star::linguistic2::XAvailableLocales";"getAvailableLocales()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"getSpellChecker()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"getHyphenator()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"getThesaurus()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"addLinguServiceManagerListener()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"removeLinguServiceManagerListener()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"getAvailableServices()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"setConfiguredServices()" -"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager";"getConfiguredServices()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"getSpellChecker()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"getHyphenator()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"getThesaurus()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"addLinguServiceManagerListener()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"removeLinguServiceManagerListener()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"getAvailableServices()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"setConfiguredServices()" +"LngSvcMgr";"com::sun::star::linguistic2::XLinguServiceManager2";"getConfiguredServices()" diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk index 5f4c1aa..e058a55 100644 --- a/sc/CppunitTest_sc_filters_test.mk +++ b/sc/CppunitTest_sc_filters_test.mk @@ -107,6 +107,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_filters_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk index fca4947..d6c812c 100644 --- a/sc/CppunitTest_sc_macros_test.mk +++ b/sc/CppunitTest_sc_macros_test.mk @@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk index 72a7ccc..7092b31 100644 --- a/sc/CppunitTest_sc_subsequent_filters_test.mk +++ b/sc/CppunitTest_sc_subsequent_filters_test.mk @@ -101,6 +101,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\ framework/util/fwk \ i18npool/util/i18npool \ i18npool/source/search/i18nsearch \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk index f5fc026..4440c1d 100644 --- a/sd/CppunitTest_sd_filters_test.mk +++ b/sd/CppunitTest_sd_filters_test.mk @@ -96,6 +96,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_filters_test,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sd/CppunitTest_sd_regression_test.mk b/sd/CppunitTest_sd_regression_test.mk index abee99b..078eff1 100644 --- a/sd/CppunitTest_sd_regression_test.mk +++ b/sd/CppunitTest_sd_regression_test.mk @@ -94,6 +94,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_regression_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index 03453ff..48d5da8 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_uimpress,\ configmgr/source/configmgr \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ ucb/source/core/ucb1 \ )) diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 3a94f5e..1a64588 100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/linguistic2/XMeaning.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <comphelper/processfactory.hxx> #include <svl/stritem.hxx> @@ -68,9 +68,8 @@ SfxThesSubMenuHelper::SfxThesSubMenuHelper() { try { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - m_xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( - OUString( "com.sun.star.linguistic2.LinguServiceManager" )), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + m_xLngMgr = linguistic2::LinguServiceManager::create(xContext); m_xThesarus = m_xLngMgr->getThesaurus(); } catch (const uno::Exception &) @@ -140,16 +139,12 @@ bool SfxThesSubMenuHelper::GetMeanings( String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const { String aRes; - DBG_ASSERT( m_xLngMgr.is(), "LinguServiceManager missing" ); - if (m_xLngMgr.is()) - { - uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( - OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - } + uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( + OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; return aRes; } diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index a30883e..56f6639 100644 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -22,7 +22,7 @@ #define _THESSUBMENU_HXX_ #include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <vcl/menu.hxx> #include <sfx2/mnuitem.hxx> @@ -31,7 +31,7 @@ namespace css = ::com::sun::star; class SfxThesSubMenuHelper { - css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLngMgr; + css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLngMgr; css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; private: diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index c1dea3a..46258ad 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -26,7 +26,6 @@ * ************************************************************************/ -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> #include <com/sun/star/linguistic2/XAvailableLocales.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <linguistic/misc.hxx> diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index c1e3110..ea7a5f9 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -51,7 +51,7 @@ #include <editeng/editobj.hxx> #include <editeng/unotext.hxx> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <comphelper/processfactory.hxx> #include <svx/sdrpaintwindow.hxx> @@ -100,7 +100,7 @@ private: SdrOutliner* mpOutliner; SvxOutlinerForwarder* mpTextForwarder; SvxDrawOutlinerViewForwarder* mpViewForwarder; // if non-NULL, use GetViewModeTextForwarder text forwarder - css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLinguServiceManager; + css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLinguServiceManager; Point maTextOffset; sal_Bool mbDataValid; sal_Bool mbDestroyed; @@ -585,17 +585,13 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() if ( !m_xLinguServiceManager.is() ) { - css::uno::Reference< css::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - m_xLinguServiceManager = css::uno::Reference< css::linguistic2::XLinguServiceManager >( - xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LinguServiceManager" ))), css::uno::UNO_QUERY ); + css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + m_xLinguServiceManager.set(css::linguistic2::LinguServiceManager::create(xContext)); } - if ( m_xLinguServiceManager.is() ) - { - css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator( m_xLinguServiceManager->getHyphenator(), css::uno::UNO_QUERY ); - if( xHyphenator.is() ) - mpOutliner->SetHyphenator( xHyphenator ); - } + css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator( m_xLinguServiceManager->getHyphenator(), css::uno::UNO_QUERY ); + if( xHyphenator.is() ) + mpOutliner->SetHyphenator( xHyphenator ); } diff --git a/sw/CppunitTest_sw_subsequent_odfexport.mk b/sw/CppunitTest_sw_subsequent_odfexport.mk index ed559ba..34e5674 100644 --- a/sw/CppunitTest_sw_subsequent_odfexport.mk +++ b/sw/CppunitTest_sw_subsequent_odfexport.mk @@ -71,6 +71,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfexport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/util/package2 \ package/source/xstor/xstor \ sw/util/sw \ diff --git a/sw/CppunitTest_sw_subsequent_odfimport.mk b/sw/CppunitTest_sw_subsequent_odfimport.mk index 9cd8270..bb438b9 100644 --- a/sw/CppunitTest_sw_subsequent_odfimport.mk +++ b/sw/CppunitTest_sw_subsequent_odfimport.mk @@ -70,6 +70,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfimport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/util/package2 \ package/source/xstor/xstor \ sw/util/sw \ diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk index 9eff7dd..a6d6c80 100644 --- a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk +++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk @@ -72,6 +72,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlexport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk index d8b9bc4..66a977a 100644 --- a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk +++ b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk @@ -71,6 +71,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlimport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sw/CppunitTest_sw_subsequent_rtfexport.mk b/sw/CppunitTest_sw_subsequent_rtfexport.mk index d6d2a29..270139a 100644 --- a/sw/CppunitTest_sw_subsequent_rtfexport.mk +++ b/sw/CppunitTest_sw_subsequent_rtfexport.mk @@ -71,6 +71,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtfexport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/source/xstor/xstor \ package/util/package2 \ sax/source/expatwrap/expwrap \ diff --git a/sw/CppunitTest_sw_subsequent_rtfimport.mk b/sw/CppunitTest_sw_subsequent_rtfimport.mk index 906bf57..2c01fb8 100644 --- a/sw/CppunitTest_sw_subsequent_rtfimport.mk +++ b/sw/CppunitTest_sw_subsequent_rtfimport.mk @@ -72,6 +72,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtfimport,\ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/util/package2 \ sax/source/expatwrap/expwrap \ sw/util/sw \ diff --git a/sw/CppunitTest_sw_subsequent_ww8export.mk b/sw/CppunitTest_sw_subsequent_ww8export.mk index 1389597..68fd485 100644 --- a/sw/CppunitTest_sw_subsequent_ww8export.mk +++ b/sw/CppunitTest_sw_subsequent_ww8export.mk @@ -75,6 +75,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ww8export,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/source/xstor/xstor \ package/util/package2 \ sax/source/expatwrap/expwrap \ diff --git a/sw/CppunitTest_sw_subsequent_ww8import.mk b/sw/CppunitTest_sw_subsequent_ww8import.mk index c00f966..e5a3dd0 100644 --- a/sw/CppunitTest_sw_subsequent_ww8import.mk +++ b/sw/CppunitTest_sw_subsequent_ww8import.mk @@ -71,6 +71,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ww8import,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ package/util/package2 \ sw/util/msword \ sw/util/sw \ diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx index e8620f5..918ebf7 100644 --- a/sw/inc/dlelstnr.hxx +++ b/sw/inc/dlelstnr.hxx @@ -23,6 +23,7 @@ #include <cppuhelper/weak.hxx> #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <cppuhelper/implbase2.hxx> // helper for implementations @@ -31,7 +32,6 @@ namespace com { namespace sun { namespace star { namespace linguistic2 { class XDictionaryList; - class XLinguServiceManager; class XProofreadingIterator; } namespace frame { @@ -56,7 +56,7 @@ class SwLinguServiceEventListener : com::sun::star::uno::Reference< com::sun::star::frame::XDesktop > xDesktop; com::sun::star::uno::Reference< - com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr; + com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr; com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > xGCIterator; diff --git a/sw/source/ui/uno/dlelstnr.cxx b/sw/source/ui/uno/dlelstnr.cxx index 5dd5eb3..db158d8 100644 --- a/sw/source/ui/uno/dlelstnr.cxx +++ b/sw/source/ui/uno/dlelstnr.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp> #include <com/sun/star/linguistic2/XDictionaryList.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> @@ -57,35 +57,31 @@ using namespace ::com::sun::star::linguistic2::LinguServiceEventFlags; SwLinguServiceEventListener::SwLinguServiceEventListener() { Reference< XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); - if (xMgr.is()) + Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + try { - try - { - OUString aSvcName( OUString( "com.sun.star.frame.Desktop" ) ); - xDesktop = Reference< frame::XDesktop >( - xMgr->createInstance( aSvcName ), UNO_QUERY ); - if (xDesktop.is()) - xDesktop->addTerminateListener( this ); - - aSvcName = OUString( "com.sun.star.linguistic2.LinguServiceManager" ); - xLngSvcMgr = Reference< XLinguServiceManager >( xMgr->createInstance( aSvcName ), UNO_QUERY ); - if (xLngSvcMgr.is()) - xLngSvcMgr->addLinguServiceManagerListener( (XLinguServiceEventListener *) this ); - - if (SvtLinguConfig().HasGrammarChecker()) - { - aSvcName = OUString( "com.sun.star.linguistic2.ProofreadingIterator" ); - xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY ); - Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); - if (xBC.is()) - xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this ); - } - } - catch (const uno::Exception&) + OUString aSvcName( OUString( "com.sun.star.frame.Desktop" ) ); + xDesktop = Reference< frame::XDesktop >( + xMgr->createInstance( aSvcName ), UNO_QUERY ); + if (xDesktop.is()) + xDesktop->addTerminateListener( this ); + + xLngSvcMgr = LinguServiceManager::create(xContext); + xLngSvcMgr->addLinguServiceManagerListener( (XLinguServiceEventListener *) this ); + + if (SvtLinguConfig().HasGrammarChecker()) { - OSL_FAIL("exception caught in SwLinguServiceEventListener c-tor" ); + aSvcName = OUString( "com.sun.star.linguistic2.ProofreadingIterator" ); + xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY ); + Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); + if (xBC.is()) + xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this ); } } + catch (const uno::Exception&) + { + OSL_FAIL("exception caught in SwLinguServiceEventListener c-tor" ); + } } SwLinguServiceEventListener::~SwLinguServiceEventListener() diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 4a0451e..f1994bf 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -81,7 +81,8 @@ #include "com/sun/star/beans/PropertyValues.hpp" #include "com/sun/star/i18n/XBreakIterator.hpp" #include "com/sun/star/i18n/WordType.hpp" -#include "com/sun/star/linguistic2/XLinguServiceManager.hpp" +#include "com/sun/star/linguistic2/LinguServiceManager.hpp" +#include <comphelper/processfactory.hxx> #if defined UNX #define GLYPH_FONT_HEIGHT 128 @@ -4928,17 +4929,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ::rtl::OUString aText( rStr ); uno::Reference < i18n::XBreakIterator > xBI; // get service provider - uno::Reference< lang::XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - uno::Reference< linguistic2::XHyphenator > xHyph; - if( xSMgr.is() ) - { - uno::Reference< linguistic2::XLinguServiceManager> xLinguMgr(xSMgr->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.LinguServiceManager"))),uno::UNO_QUERY); - if ( xLinguMgr.is() ) - { - xHyph = xLinguMgr->getHyphenator(); - } - } + uno::Reference< linguistic2::XLinguServiceManager2> xLinguMgr = linguistic2::LinguServiceManager::create(xContext); + uno::Reference< linguistic2::XHyphenator > xHyph = xLinguMgr->getHyphenator(); i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 ); i18n::LineBreakUserOptions aUserOptions; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits