diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-09-23 09:34:17 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-09-23 12:25:52 +0000 |
commit | 065ef005e9c93db43efdb7733bf7371673fcbd17 (patch) | |
tree | 59beb4d84571e65912f7afb1c17e11e76ee6dadc /qadevOOo/runner | |
parent | 01889962cab8449e1d9682d22db0f6e1e28252fd (diff) |
Make createDesktop return XDesktop, not Object
and adjust/cleanup calling instances
Change-Id: I6b7be34fe6fce0a6fdbf2227f3e565b2f434c88c
Reviewed-on: https://gerrit.libreoffice.org/29221
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r-- | qadevOOo/runner/util/DesktopTools.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 3bc95dca2189..1650a04fdb71 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -58,11 +58,8 @@ public class DesktopTools */ private static XComponentLoader getCLoader(XMultiServiceFactory xMSF) { - XDesktop oDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - XComponentLoader oCLoader = UnoRuntime.queryInterface( - XComponentLoader.class, oDesktop); + XComponentLoader.class, createDesktop(xMSF)); return oCLoader; } @@ -71,22 +68,23 @@ public class DesktopTools * Creates an Instance of the Desktop service * * @param xMSF the MultiServiceFactory - * @return the gained Object + * @return the gained XDesktop object */ - public static Object createDesktop(XMultiServiceFactory xMSF) + public static XDesktop createDesktop(XMultiServiceFactory xMSF) { - Object oInterface; + XDesktop xDesktop; try { - oInterface = xMSF.createInstance("com.sun.star.comp.framework.Desktop"); + xDesktop = UnoRuntime.queryInterface( + XDesktop.class, xMSF.createInstance("com.sun.star.comp.framework.Desktop")); } catch (com.sun.star.uno.Exception e) { throw new IllegalArgumentException("Desktop Service not available", e); } - return oInterface; + return xDesktop; } /** @@ -96,9 +94,7 @@ public class DesktopTools */ public static XEnumeration getAllComponents(XMultiServiceFactory xMSF) { - XDesktop xDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - return xDesktop.getComponents().createEnumeration(); + return createDesktop(xMSF).getComponents().createEnumeration(); } @@ -110,9 +106,7 @@ public class DesktopTools */ public static XFrame getCurrentFrame(XMultiServiceFactory xMSF) { - XDesktop xDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - return xDesktop.getCurrentFrame(); + return createDesktop(xMSF).getCurrentFrame(); } /** @@ -123,8 +117,6 @@ public class DesktopTools public static Object[] getAllOpenDocuments(XMultiServiceFactory xMSF) { ArrayList<XComponent> components = new ArrayList<XComponent>(); - UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); XEnumeration allComp = getAllComponents(xMSF); |