summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-01 13:51:04 +0200
committerNoel Grandin <noel@peralex.com>2013-02-11 08:02:19 +0200
commiteb2f8c5a63df0bfcd3cc13b2071ea2194fa425f0 (patch)
tree8b699d6dace733bdb6ea67ce704936fbf9e8d7a5
parent0cd4caa547a75316c6b3f2992dd66b2294c6f1ae (diff)
fdo#46808, use linguistic2::LanguageGuessing service constructor
Change-Id: I5c650a96ea99a1cf16ca8aa61f2db4986790040b
-rw-r--r--editeng/source/editeng/eerdll.cxx11
-rw-r--r--framework/inc/helper/mischelper.hxx4
-rw-r--r--framework/source/fwi/helper/mischelper.cxx6
-rw-r--r--framework/source/uielement/langselectionmenucontroller.cxx2
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx2
-rw-r--r--sw/source/ui/app/swmodule.cxx10
6 files changed, 10 insertions, 25 deletions
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 740de3a76adb..8c076ff1c41b 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -22,7 +22,7 @@
#include <vcl/dialog.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
-#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+#include <com/sun/star/linguistic2/LanguageGuessing.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
@@ -181,14 +181,7 @@ uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGues
{
if (!xLanguageGuesser.is())
{
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString( "com.sun.star.linguistic2.LanguageGuessing" ) ),
- uno::UNO_QUERY );
- }
+ xLanguageGuesser = linguistic2::LanguageGuessing::create( comphelper::getProcessComponentContext() );
}
return xLanguageGuesser;
}
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index b559de74707e..f74f69ae907b 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -92,10 +92,10 @@ inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType
class FWI_DLLPUBLIC LanguageGuessingHelper
{
mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
public:
- LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){}
+ LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext) : m_xContext(_xContext){}
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const;
};
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index cc22e5b1e668..5245808255c8 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/UICommandDescription.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/linguistic2/LanguageGuessing.hpp>
#include <tools/debug.hxx>
#include <vcl/settings.hxx>
@@ -53,10 +54,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
{
try
{
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- m_xServiceManager->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.LanguageGuessing")) ),
- uno::UNO_QUERY );
+ m_xLanguageGuesser = linguistic2::LanguageGuessing::create( m_xContext );
}
catch (const uno::Exception &)
{
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index c3e96b0e5e46..c6ad1bf77b40 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -80,7 +80,7 @@ DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {}
LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
svt::PopupMenuControllerBase( xServiceManager ),
m_bShowMenu( sal_True ),
- m_aLangGuessHelper( xServiceManager )
+ m_aLangGuessHelper( comphelper::getComponentContext(xServiceManager) )
{
}
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index ebb83c0b87e9..83e60fd8e2b1 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -90,7 +90,7 @@ LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::R
svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), OUString(), 0 ),
m_bShowMenu( sal_True ),
m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ),
- m_aLangGuessHelper( xServiceManager )
+ m_aLangGuessHelper( comphelper::getComponentContext(xServiceManager) )
{
}
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 9d4bc1d5f79b..8d2c6266a874 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -54,6 +54,7 @@
#include <svx/modctrl.hxx>
#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/linguistic2/LanguageGuessing.hpp>
#include <comphelper/processfactory.hxx>
#include <docsh.hxx>
#include <swmodule.hxx>
@@ -227,14 +228,7 @@ uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser()
{
if (!m_xLanguageGuesser.is())
{
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.LanguageGuessing"))),
- uno::UNO_QUERY );
- }
+ m_xLanguageGuesser = linguistic2::LanguageGuessing::create( comphelper::getProcessComponentContext() );
}
return m_xLanguageGuesser;
}