diff options
author | Noel Grandin <noel@peralex.com> | 2013-04-17 14:59:35 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-19 07:52:08 +0000 |
commit | 8d87758d65e4a03271f76e354dfc84c1fcd5fe21 (patch) | |
tree | bc8f4f0df6981ad10fe1333db1a2b015ea079709 /odk/examples/DevelopersGuide/OfficeDev/Linguistic | |
parent | d62425cc27e04a3237cfec2ea2663b8b11284ec8 (diff) |
Java cleanup, remove the rest of the unnecessary casts
Change-Id: Ia61d250f6b3711abc29569c5ece38a6f87e38daa
Reviewed-on: https://gerrit.libreoffice.org/3432
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'odk/examples/DevelopersGuide/OfficeDev/Linguistic')
6 files changed, 14 insertions, 15 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java index b21190d173aa..7cdf7f68b381 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java @@ -113,8 +113,7 @@ public class LinguisticExamples if (mxRemoteContext != null && mxRemoteServiceManager != null) { Object aObj = mxRemoteServiceManager.createInstanceWithContext( "com.sun.star.linguistic2.LinguServiceManager", mxRemoteContext ); - mxLinguSvcMgr = (XLinguServiceManager) - UnoRuntime.queryInterface(XLinguServiceManager.class, aObj); + mxLinguSvcMgr = UnoRuntime.queryInterface(XLinguServiceManager.class, aObj); } return mxLinguSvcMgr != null; } @@ -291,7 +290,7 @@ public class LinguisticExamples // get access to LinguProperties property set Object aObj = mxRemoteServiceManager.createInstanceWithContext( "com.sun.star.linguistic2.LinguProperties", mxRemoteContext); - XPropertySet aLinguProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet aLinguProps = UnoRuntime.queryInterface( XPropertySet.class,aObj); // set a spellchecker and hyphenator property value to a defined state diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java index 05f34cc6ab85..114d1bda2e94 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java @@ -90,14 +90,14 @@ public class OneInstanceFactory implements //!! workaround for services not always being created //!! via 'createInstanceWithArguments' - XInitialization xIni = (XInitialization) UnoRuntime.queryInterface( + XInitialization xIni = UnoRuntime.queryInterface( XInitialization.class, createInstance()); if (xIni != null) { Object[] aArguments = new Object[]{ null, null }; if (xMultiFactory != null) { - XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class , xMultiFactory.createInstance( "com.sun.star.linguistic2.LinguProperties" ) ); aArguments[0] = xPropSet; @@ -114,7 +114,7 @@ public class OneInstanceFactory implements { if (xInstantiatedService == null) { - XInitialization xIni = (XInitialization) UnoRuntime.queryInterface( + XInitialization xIni = UnoRuntime.queryInterface( XInitialization.class, createInstance()); if (xIni != null) xIni.initialize( aArguments ); diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java index 498a8919b20c..2932a7791367 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java @@ -83,7 +83,7 @@ public class PropChgHelper implements for (int i = 0; i < nCnt; ++i) { XLinguServiceEventListener xLstnr = - (XLinguServiceEventListener) aLngSvcEvtListeners.get(i); + aLngSvcEvtListeners.get(i); if (xLstnr != null) xLstnr.processLinguServiceEvent( aEvt ); } @@ -105,7 +105,7 @@ public class PropChgHelper implements { try { xPropSet.addPropertyChangeListener( - aPropNames[i], (XPropertyChangeListener) this ); + aPropNames[i], this ); } catch( Exception e ) { } @@ -125,7 +125,7 @@ public class PropChgHelper implements { try { xPropSet.removePropertyChangeListener( - aPropNames[i], (XPropertyChangeListener) this ); + aPropNames[i], this ); } catch( Exception e ) { } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java index a81aad0e1ab6..d786d0ad98b3 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java @@ -84,7 +84,7 @@ public class SampleHyphenator extends ComponentBase implements "HyphMinTrailing", "HyphMinWordLength" }; - aPropChgHelper = new PropChgHelper_Hyph( (XHyphenator) this, aProps ); + aPropChgHelper = new PropChgHelper_Hyph( this, aProps ); aEvtListeners = new ArrayList<Object>();; bDisposing = false; } @@ -442,7 +442,7 @@ public class SampleHyphenator extends ComponentBase implements int nLen = aArguments.length; if (2 == nLen) { - XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, aArguments[0]); // start listening to property changes aPropChgHelper.AddAsListenerTo( xPropSet ); diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java index 10ec0aa9f46e..c4c61eb73beb 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java @@ -84,7 +84,7 @@ public class SampleSpellChecker extends ComponentBase implements "IsSpellWithDigits", "IsSpellCapitalization" }; - aPropChgHelper = new PropChgHelper_Spell( (XSpellChecker) this, aProps ); + aPropChgHelper = new PropChgHelper_Spell( this, aProps ); aEvtListeners = new ArrayList<Object>(); bDisposing = false; } @@ -386,7 +386,7 @@ public class SampleSpellChecker extends ComponentBase implements int nLen = aArguments.length; if (2 == nLen) { - XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, aArguments[0]); // start listening to property changes aPropChgHelper.AddAsListenerTo( xPropSet ); diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java index e33929a4b77a..fb8c96f3bcfe 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java @@ -80,7 +80,7 @@ public class SampleThesaurus extends ComponentBase implements // which is here basically used only to keep track of the // property set (and it's lifetime) since it gets used in the // 'GetValueToUse' function - aPropChgHelper = new PropChgHelper( (XThesaurus) this, aProps ); + aPropChgHelper = new PropChgHelper( this, aProps ); aEvtListeners = new ArrayList<Object>(); bDisposing = false; @@ -222,7 +222,7 @@ public class SampleThesaurus extends ComponentBase implements int nLen = aArguments.length; if (2 == nLen) { - XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, aArguments[0]); // start listening to property changes aPropChgHelper.AddAsListenerTo( xPropSet ); |