[Libreoffice-commits] .: 3 commits - android/experimental testtools/Module_testtools.mk
Tor Lillqvist
tml at kemper.freedesktop.org
Wed May 30 14:07:29 PDT 2012
android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 111 +++++++++-
testtools/Module_testtools.mk | 4
2 files changed, 105 insertions(+), 10 deletions(-)
New commits:
commit 82f65054561020d38e37dd376e4f652dcd1bcca8
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Wed May 30 23:11:22 2012 +0300
Progress finally
Now I get (a page of) the document rendered into a
bitmap. Unfortunately css.awt.XBitmap::getDIB() provides an in-core
24-bit (BGR) BMP file. (Yes, despite the name, it's not just the DIB,
but is prefixed with a BMP file header.) Android's Image class wants
RGBA. Hmm.
Change-Id: Ie0effef20751e1959644861af358d81538b6d6ea
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 ac95164..c39741e 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -105,7 +105,7 @@ public class DocumentLoader
}
}
- static void dump(String objectName, Object object)
+ static void dumpUNOObject(String objectName, Object object)
{
Log.i(TAG, objectName + " is " + (object != null ? object.toString() : "null"));
@@ -128,6 +128,17 @@ public class DocumentLoader
Log.i(TAG, " " + t.getTypeName());
}
+ static void dumpBytes(byte[] image)
+ {
+ for (int i = 0; i < 160; i += 16) {
+ String s = "";
+ for (int j = 0; j < 16; j++)
+ s = s + String.format(" %02x", image[i+j]);
+
+ Log.i(TAG, s);
+ }
+ }
+
@Override
public void onCreate(Bundle savedInstanceState)
{
@@ -207,7 +218,7 @@ public class DocumentLoader
xCompLoader.loadComponentFromURL
(sUrl, "_blank", 0, loadProps);
- dump("oDoc", oDoc);
+ dumpUNOObject("oDoc", oDoc);
// Test stuff, try creating various services, see what types
// they offer, stuff that is hard to find out by reading
@@ -219,12 +230,12 @@ public class DocumentLoader
xCompLoader.loadComponentFromURL
("private:factory/swriter", "_blank", 0, loadProps);
- dump("swriter", swriter);
+ dumpUNOObject("swriter", swriter);
Object frameControl = xMCF.createInstanceWithContext
("com.sun.star.frame.FrameControl", xContext);
- dump("frameControl", frameControl);
+ dumpUNOObject("frameControl", frameControl);
com.sun.star.awt.XControl control = (com.sun.star.awt.XControl)
UnoRuntime.queryInterface(com.sun.star.awt.XControl.class, frameControl);
@@ -232,14 +243,14 @@ public class DocumentLoader
Object toolkit = xMCF.createInstanceWithContext
("com.sun.star.awt.Toolkit", xContext);
- dump("toolkit", toolkit);
+ dumpUNOObject("toolkit", toolkit);
com.sun.star.awt.XToolkit xToolkit = (com.sun.star.awt.XToolkit)
UnoRuntime.queryInterface(com.sun.star.awt.XToolkit.class, toolkit);
com.sun.star.awt.XDevice device = xToolkit.createScreenCompatibleDevice(1024, 1024);
- dump("device", device);
+ dumpUNOObject("device", device);
// I guess the XRenderable thing might be what we want to use,
// having the code pretend it is printing?
@@ -262,6 +273,14 @@ public class DocumentLoader
Log.i(TAG, "getRendererCount: " + renderBabe.getRendererCount(oDoc, renderProps));
renderBabe.render(0, oDoc, renderProps);
+
+ com.sun.star.awt.XBitmap bitmap = device.createBitmap(0, 0, 1024, 1024);
+
+ byte[] image = bitmap.getDIB();
+
+ Log.i(TAG, "image is " + image.length + " bytes");
+
+ dumpBytes(image);
}
}
catch (Exception e) {
commit d69bcc9979f56ab5dc59b9d10bbc601d38506873
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Wed May 30 20:25:01 2012 +0300
Getting closer, maybe
Change-Id: Ifcfdd33631c257d2cf6f54fe0d00444200f48335
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 5a45406..ac95164 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,70 @@ public class DocumentLoader
private static String TAG = "DocumentLoader";
+ class MyXController
+ implements com.sun.star.frame.XController {
+
+ com.sun.star.frame.XModel model;
+ com.sun.star.frame.XFrame frame;
+
+ public void attachFrame(com.sun.star.frame.XFrame frame)
+ {
+ Log.i(TAG, "attachFrame");
+ this.frame = frame;
+ }
+
+ public boolean attachModel(com.sun.star.frame.XModel model)
+ {
+ Log.i(TAG, "attachModel");
+ this.model = model;
+ return true;
+ }
+
+ public boolean suspend(boolean doSuspend)
+ {
+ Log.i(TAG, "suspend");
+ return false;
+ }
+
+ public Object getViewData()
+ {
+ Log.i(TAG, "getViewData");
+ return null;
+ }
+
+ public void restoreViewData(Object data)
+ {
+ Log.i(TAG, "restoreViewData");
+ }
+
+ public com.sun.star.frame.XModel getModel()
+ {
+ Log.i(TAG, "getModel");
+ return model;
+ }
+
+ public com.sun.star.frame.XFrame getFrame()
+ {
+ Log.i(TAG, "getFrame");
+ return frame;
+ }
+
+ public void dispose()
+ {
+ Log.i(TAG, "dispose");
+ }
+
+ public void addEventListener(com.sun.star.lang.XEventListener listener)
+ {
+ Log.i(TAG, "addEventListener");
+ }
+
+ public void removeEventListener(com.sun.star.lang.XEventListener listener)
+ {
+ Log.i(TAG, "removeEventListener");
+ }
+ }
+
static void dump(String objectName, Object object)
{
Log.i(TAG, objectName + " is " + (object != null ? object.toString() : "null"));
@@ -170,6 +234,13 @@ public class DocumentLoader
dump("toolkit", toolkit);
+ com.sun.star.awt.XToolkit xToolkit = (com.sun.star.awt.XToolkit)
+ UnoRuntime.queryInterface(com.sun.star.awt.XToolkit.class, toolkit);
+
+ com.sun.star.awt.XDevice device = xToolkit.createScreenCompatibleDevice(1024, 1024);
+
+ dump("device", device);
+
// I guess the XRenderable thing might be what we want to use,
// having the code pretend it is printing?
@@ -177,13 +248,16 @@ public class DocumentLoader
UnoRuntime.queryInterface(com.sun.star.view.XRenderable.class, oDoc);
com.sun.star.beans.PropertyValue renderProps[] =
- new com.sun.star.beans.PropertyValue[1];
+ new com.sun.star.beans.PropertyValue[3];
renderProps[0] = new com.sun.star.beans.PropertyValue();
renderProps[0].Name = "IsPrinter";
renderProps[0].Value = new Boolean(true);
-// renderProps[1] = new com.sun.star.beans.PropertyValue();
-// renderProps[1].Name = "View";
-// renderProps[1].Value = no idea where to get an XController...
+ renderProps[1] = new com.sun.star.beans.PropertyValue();
+ renderProps[1].Name = "RenderDevice";
+ renderProps[1].Value = device;
+ renderProps[2] = new com.sun.star.beans.PropertyValue();
+ renderProps[2].Name = "View";
+ renderProps[2].Value = new MyXController();
Log.i(TAG, "getRendererCount: " + renderBabe.getRendererCount(oDoc, renderProps));
commit eceeb15c13644537ed7d78921b6598daecda650a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Wed May 30 16:55:26 2012 +0300
Just bypass completely when cross-compiling
Change-Id: I4f3ca66cbba141bc26ae0b4bbd622fe8e3e86674
diff --git a/testtools/Module_testtools.mk b/testtools/Module_testtools.mk
index c2e3068..2ae6fed 100644
--- a/testtools/Module_testtools.mk
+++ b/testtools/Module_testtools.mk
@@ -26,6 +26,8 @@
$(eval $(call gb_Module_Module,testtools))
+ifneq ($(CROSS_COMPILING),YES)
+
$(eval $(call gb_Module_add_targets,testtools,\
CustomTarget_bridgetest \
InternalUnoApi_bridgetest \
@@ -53,7 +55,6 @@ endif
#))
#endif
-ifneq ($(CROSS_COMPILING),YES)
# FIXME: Mac OSX PPC GCC fails this test!, likely broken UNO bridge.
# (is it still relevant?)
ifneq ($(COM)$(OS)$(CPU),GCCMACOSXP)
@@ -61,6 +62,7 @@ $(eval $(call gb_Module_add_check_targets,testtools,\
CustomTarget_uno_test \
))
endif
+
endif
# vim:set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list