fdo#46808, Convert linguistic2::ProofreadingIterator to new style

Change-Id: I1551f67ce503d58ea9b0e701219b26baadb25b78
This commit is contained in:
Noel Grandin
2013-03-07 13:13:10 +02:00
parent 70e7bd63ad
commit 524cedbd30
6 changed files with 15 additions and 25 deletions

View File

@@ -53,7 +53,6 @@ class LocaleDataWrapper;
#define SN_GRAMMARCHECKER "com.sun.star.linguistic2.Proofreader" #define SN_GRAMMARCHECKER "com.sun.star.linguistic2.Proofreader"
#define SN_GRAMMARCHECKINGITERATOR "com.sun.star.linguistic2.ProofreadingIterator"
#define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker" #define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker"
#define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator" #define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator"
#define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus" #define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus"

View File

@@ -1126,7 +1126,7 @@ static OUString GrammarCheckingIterator_getImplementationName() throw()
static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw() static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw()
{ {
uno::Sequence< OUString > aSNS( 1 ); uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = SN_GRAMMARCHECKINGITERATOR ; aSNS[0] = "com.sun.star.linguistic2.ProofreadingIterator";
return aSNS; return aSNS;
} }

View File

@@ -26,6 +26,7 @@
#include <com/sun/star/linguistic2/XSupportedLocales.hpp> #include <com/sun/star/linguistic2/XSupportedLocales.hpp>
#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp> #include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
#include <com/sun/star/linguistic2/ProofreadingIterator.hpp>
#include <tools/solar.h> #include <tools/solar.h>
#include <unotools/lingucfg.hxx> #include <unotools/lingucfg.hxx>
@@ -1010,12 +1011,9 @@ void LngSvcMgr::GetGrammarCheckerDsp_Impl( sal_Bool bSetSvcList )
uno::Reference< linguistic2::XProofreadingIterator > xGCI; uno::Reference< linguistic2::XProofreadingIterator > xGCI;
try try
{ {
uno::Reference< lang::XMultiServiceFactory > xMgr( xGCI = linguistic2::ProofreadingIterator::create( comphelper::getProcessComponentContext() );
comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
xGCI = uno::Reference< linguistic2::XProofreadingIterator >(
xMgr->createInstance( SN_GRAMMARCHECKINGITERATOR ), uno::UNO_QUERY_THROW );
} }
catch (uno::Exception &) catch (const uno::Exception &)
{ {
} }
DBG_ASSERT( xGCI.is(), "instantiating grammar checking iterator failed" ); DBG_ASSERT( xGCI.is(), "instantiating grammar checking iterator failed" );

View File

@@ -37,7 +37,7 @@ module com { module sun { module star { module linguistic2 {
@since OOo 3.0.1 @since OOo 3.0.1
*/ */
service ProofreadingIterator : XProofreadingIterator {}; service ProofreadingIterator : XProofreadingIterator;
}; }; }; }; }; }; }; };

View File

@@ -23,7 +23,7 @@
#include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/linguistic2/ProofreadingIterator.hpp>
#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
@@ -119,19 +119,14 @@ const sal_Char sGrfCollStr[] = "Graphikformatvorlage";
{ {
if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker()) if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker())
{ {
uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
if (xMgr.is()) try
{ {
try m_xGCIterator = linguistic2::ProofreadingIterator::create( xContext );
{ }
OUString aServiceName("com.sun.star.linguistic2.ProofreadingIterator"); catch (const uno::Exception &)
m_xGCIterator = uno::Reference< linguistic2::XProofreadingIterator > {
( xMgr->createInstance( aServiceName ), uno::UNO_QUERY_THROW ); OSL_FAIL( "No GCIterator" );
}
catch (uno::Exception &)
{
OSL_FAIL( "No GCIterator" );
}
} }
} }

View File

@@ -23,7 +23,7 @@
#include <com/sun/star/linguistic2/XDictionaryList.hpp> #include <com/sun/star/linguistic2/XDictionaryList.hpp>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/linguistic2/ProofreadingIterator.hpp>
#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
#include <unotools/lingucfg.hxx> #include <unotools/lingucfg.hxx>
@@ -48,7 +48,6 @@ using namespace ::com::sun::star::linguistic2::LinguServiceEventFlags;
SwLinguServiceEventListener::SwLinguServiceEventListener() SwLinguServiceEventListener::SwLinguServiceEventListener()
{ {
Reference< XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
try try
{ {
@@ -60,8 +59,7 @@ SwLinguServiceEventListener::SwLinguServiceEventListener()
if (SvtLinguConfig().HasGrammarChecker()) if (SvtLinguConfig().HasGrammarChecker())
{ {
OUString aSvcName( "com.sun.star.linguistic2.ProofreadingIterator" ); xGCIterator = ProofreadingIterator::create(xContext);
xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY );
Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY );
if (xBC.is()) if (xBC.is())
xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this ); xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this );