diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-05-29 23:59:03 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-05-30 00:02:18 +0300 |
commit | e28ad1b5d8258df9d4014692867d6c6ee0612047 (patch) | |
tree | b56304b5a5b6b0731ec97f801549d0386a333230 /android | |
parent | c9f5b8a33434266c025d546eeb4c11f49fad8570 (diff) |
More experimentation
Change-Id: I8ad45f173c4f2b37aca6506d9021e8346c17db16
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/DocumentLoader/Makefile | 1 | ||||
-rw-r--r-- | android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 82 |
2 files changed, 61 insertions, 22 deletions
diff --git a/android/experimental/DocumentLoader/Makefile b/android/experimental/DocumentLoader/Makefile index 3774680fb9fb..1e9cebcbe8be 100644 --- a/android/experimental/DocumentLoader/Makefile +++ b/android/experimental/DocumentLoader/Makefile @@ -53,6 +53,7 @@ copy-stuff: basegfxlo \ bootstrap.uno \ comphelpgcc3 \ + ctllo \ datelo \ dbaxmllo \ dbtoolslo \ diff --git a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java index 975cd053766e..5a454066878a 100644 --- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java +++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java @@ -41,6 +41,29 @@ public class DocumentLoader private static String TAG = "DocumentLoader"; + static void dump(String objectName, Object object) + { + Log.i(TAG, objectName + " is " + (object != null ? object.toString() : "null")); + + if (object == null) + return; + + com.sun.star.lang.XTypeProvider typeProvider = (com.sun.star.lang.XTypeProvider) + UnoRuntime.queryInterface(com.sun.star.lang.XTypeProvider.class, object); + + Log.i(TAG, "typeProvider is " + (typeProvider != null ? typeProvider.toString() : "null")); + + if (typeProvider == null) + return; + + com.sun.star.uno.Type[] types = typeProvider.getTypes(); + if (types == null) + return; + + for (com.sun.star.uno.Type t : types) + Log.i(TAG, " " + t.getTypeName()); + } + @Override public void onCreate(Bundle savedInstanceState) { @@ -88,17 +111,15 @@ public class DocumentLoader Bootstrap.initVCL(); - Object oDesktop = xMCF.createInstanceWithContext( - "com.sun.star.frame.Desktop", xContext); + Object oDesktop = xMCF.createInstanceWithContext + ("com.sun.star.frame.Desktop", xContext); Log.i(TAG, "oDesktop is" + (oDesktop!=null ? " not" : "") + " null"); Bootstrap.initUCBHelper(); - com.sun.star.frame.XComponentLoader xCompLoader = - (com.sun.star.frame.XComponentLoader) - UnoRuntime.queryInterface( - com.sun.star.frame.XComponentLoader.class, oDesktop); + com.sun.star.frame.XComponentLoader xCompLoader = (com.sun.star.frame.XComponentLoader) + UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, oDesktop); Log.i(TAG, "xCompLoader is" + (xCompLoader!=null ? " not" : "") + " null"); @@ -121,22 +142,39 @@ public class DocumentLoader Object oDoc = xCompLoader.loadComponentFromURL (sUrl, "_blank", 0, loadProps); - Log.i(TAG, "oDoc is " + (oDoc!=null ? oDoc.toString() : "null")); - - com.sun.star.lang.XTypeProvider typeProvider = (com.sun.star.lang.XTypeProvider) UnoRuntime.queryInterface(com.sun.star.lang.XTypeProvider.class, oDoc); - Log.i(TAG, "typeProvider is " + (typeProvider!=null ? typeProvider.toString() : "null")); - - if (typeProvider != null) { - com.sun.star.uno.Type[] types = typeProvider.getTypes(); - if (types != null) { - for (com.sun.star.uno.Type t : types) { - Log.i(TAG, " " + t.getTypeName()); - } - } - } - - com.sun.star.view.XRenderable renderBabe = (com.sun.star.view.XRenderable) UnoRuntime.queryInterface(com.sun.star.view.XRenderable.class, oDoc); - Log.i(TAG, "renderBabe is " + (renderBabe!=null ? renderBabe.toString() : "null")); + + dump("oDoc", oDoc); + + // Test stuff, try creating various services, see what types + // they offer, stuff that is hard to find out by reading + // nonexistent useful documentation. + + Log.i(TAG, "Attempting to load private:factory/swriter"); + + Object swriter = + xCompLoader.loadComponentFromURL + ("private:factory/swriter", "_blank", 0, loadProps); + + dump("swriter", swriter); + + Object frameControl = xMCF.createInstanceWithContext + ("com.sun.star.frame.FrameControl", xContext); + + dump("frameControl", frameControl); + + com.sun.star.awt.XControl control = (com.sun.star.awt.XControl) + UnoRuntime.queryInterface(com.sun.star.awt.XControl.class, frameControl); + + Object toolkit = xMCF.createInstanceWithContext + ("com.sun.star.awt.Toolkit", xContext); + + dump("toolkit", toolkit); + + // I guess the XRenderable thing might be what we want to use, + // having the code pretend it is printing? + + com.sun.star.view.XRenderable renderBabe = (com.sun.star.view.XRenderable) + UnoRuntime.queryInterface(com.sun.star.view.XRenderable.class, oDoc); com.sun.star.beans.PropertyValue renderProps[] = new com.sun.star.beans.PropertyValue[1]; |