summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-11-20 11:48:47 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-11-20 12:10:52 +0100
commita1d9caffa38b8acdf241feb94a2f8b66dfd5ea9a (patch)
treeab813f190117af0ce1a12e2dcb922ae2e568d248 /android
parent783d13a9276931e274a90b9b53de2c92dc8c055e (diff)
android: move toolkit and dummySmallDevice to bootstrapContext as well
Change-Id: I4b6ce49aa5e6d391e832dc1023e47d694a480948
Diffstat (limited to 'android')
-rw-r--r--android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java33
1 files changed, 17 insertions, 16 deletions
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 3837a04b0f03..9dc7540c66aa 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -127,8 +127,6 @@ public class DocumentLoader
private static final int PAGECACHE_SIZE = PAGECACHE_PLUSMINUS*2 + 1;
BootstrapContext bootstrapContext;
- XToolkitExperimental toolkit;
- XDevice dummySmallDevice;
Object doc;
int pageCount;
XRenderable renderable;
@@ -607,7 +605,7 @@ public class DocumentLoader
renderProps[0].Value = new Boolean(true);
renderProps[1] = new PropertyValue();
renderProps[1].Name = "RenderDevice";
- renderProps[1].Value = dummySmallDevice;
+ renderProps[1].Value = bootstrapContext.dummySmallDevice;
renderProps[2] = new PropertyValue();
renderProps[2].Name = "View";
renderProps[2].Value = new MyXController();
@@ -634,7 +632,7 @@ public class DocumentLoader
XDevice device;
if (pageWidth == 0) {
// Huh?
- device = toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(), 1, 1, 0, 0, wrapped_bb);
+ device = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(), 1, 1, 0, 0, wrapped_bb);
} else {
// Scale so that it fits our device which has a resolution of
@@ -684,7 +682,7 @@ public class DocumentLoader
Log.i(TAG, "Rendering page " + number + " level=" + level + " scale=" + scaleNumerator + "/" + scaleDenominator + ", offset=(" + xOffset + ", " + yOffset + ")");
- device = toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(),
+ device = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(flipper.getWidth(), flipper.getHeight(),
scaleNumerator, scaleDenominator,
-xOffset, -yOffset,
wrapped_bb);
@@ -817,25 +815,15 @@ public class DocumentLoader
long t1 = System.currentTimeMillis();
Log.i(TAG, "Loading took " + ((t1-t0)-bootstrapContext.timingOverhead) + " ms");
- Object toolkitService = bootstrapContext.mcf.createInstanceWithContext
- ("com.sun.star.awt.Toolkit", bootstrapContext.componentContext);
- toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
-
renderable = (XRenderable) UnoRuntime.queryInterface(XRenderable.class, doc);
- // Set up dummySmallDevice and use it to find out the number
- // of pages ("renderers").
- ByteBuffer smallbb = ByteBuffer.allocateDirect(SMALLSIZE*SMALLSIZE*4);
- long wrapped_smallbb = Bootstrap.new_byte_buffer_wrapper(smallbb);
- dummySmallDevice = toolkit.createScreenCompatibleDeviceUsingBuffer(SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, wrapped_smallbb);
-
PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter";
renderProps[0].Value = new Boolean(true);
renderProps[1] = new PropertyValue();
renderProps[1].Name = "RenderDevice";
- renderProps[1].Value = dummySmallDevice;
+ renderProps[1].Value = bootstrapContext.dummySmallDevice;
renderProps[2] = new PropertyValue();
renderProps[2].Name = "View";
renderProps[2].Value = new MyXController();
@@ -863,6 +851,8 @@ public class DocumentLoader
public XComponentContext componentContext;
public XMultiComponentFactory mcf;
public XComponentLoader componentLoader;
+ public XToolkitExperimental toolkit;
+ public XDevice dummySmallDevice;
}
static void dumpUNOObject(String objectName, Object object)
@@ -973,6 +963,17 @@ public class DocumentLoader
bootstrapContext.componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop);
Log.i(TAG, "componentLoader is" + (bootstrapContext.componentLoader!=null ? " not" : "") + " null");
+
+ Object toolkitService = bootstrapContext.mcf.createInstanceWithContext
+ ("com.sun.star.awt.Toolkit", bootstrapContext.componentContext);
+ bootstrapContext.toolkit = (XToolkitExperimental) UnoRuntime.queryInterface(XToolkitExperimental.class, toolkitService);
+
+ // Set up dummySmallDevice and use it to find out the number
+ // of pages ("renderers").
+ ByteBuffer smallbb = ByteBuffer.allocateDirect(SMALLSIZE*SMALLSIZE*4);
+ long wrapped_smallbb = Bootstrap.new_byte_buffer_wrapper(smallbb);
+ bootstrapContext.dummySmallDevice = bootstrapContext.toolkit.createScreenCompatibleDeviceUsingBuffer(SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, wrapped_smallbb);
+
}
catch (Exception e)
{