summaryrefslogtreecommitdiff
path: root/android/experimental/desktop
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-02-22 15:08:23 +0200
committerTor Lillqvist <tml@iki.fi>2013-02-22 18:15:57 +0200
commitb02c075a16ff0b198053cf36828056c6e7ab45e7 (patch)
tree4f727f70dcad517a4a2bee06c10b95269a31020a /android/experimental/desktop
parent99501a839f6d777c24bc9210787fd14dc3aad67d (diff)
Rename android/qa/desktop to android/experimenmtal/desktop
It's not really a "QA" thing. Change-Id: I85f7b5610ecd409972b7d504bfc567707d35556e
Diffstat (limited to 'android/experimental/desktop')
-rw-r--r--android/experimental/desktop/AndroidManifest.xml21
-rw-r--r--android/experimental/desktop/Makefile164
-rw-r--r--android/experimental/desktop/ant.properties17
-rw-r--r--android/experimental/desktop/build.xml84
-rw-r--r--android/experimental/desktop/fonts.conf154
-rw-r--r--android/experimental/desktop/jni/Android.mk23
-rw-r--r--android/experimental/desktop/native-code.cxx123
-rw-r--r--android/experimental/desktop/project.properties14
-rw-r--r--android/experimental/desktop/res/layout/main.xml12
-rw-r--r--android/experimental/desktop/res/values/strings.xml4
-rw-r--r--android/experimental/desktop/src/org/libreoffice/android/examples/LODesktop.java312
11 files changed, 928 insertions, 0 deletions
diff --git a/android/experimental/desktop/AndroidManifest.xml b/android/experimental/desktop/AndroidManifest.xml
new file mode 100644
index 000000000000..c5a6cc0927ac
--- /dev/null
+++ b/android/experimental/desktop/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.libreoffice.android.examples"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="9"
+ android:targetSdkVersion="14"/>
+ <application android:label="LO Desktop App"
+ android:debuggable="true"
+ android:largeHeap="true"
+ android:hardwareAccelerated="true">
+ <activity android:name=".LODesktop"
+ android:label="LO Desktop App"
+ android:configChanges="keyboardHidden">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile
new file mode 100644
index 000000000000..5ea6f3591933
--- /dev/null
+++ b/android/experimental/desktop/Makefile
@@ -0,0 +1,164 @@
+include ../../../config_host.mk
+
+# The default target just builds.
+all: build-ant
+
+# The package of this app
+APP_PACKAGE=org.libreoffice.android.examples
+
+BOOTSTRAPDIR=../../Bootstrap
+include $(BOOTSTRAPDIR)/Makefile.shared
+
+# The name of the Bootstrap activity class
+BOOTSTRAP=org.libreoffice.android.Bootstrap
+
+# The default target just builds.
+
+copy-stuff:
+# Then "assets". Let the directory structure under assets mimic
+# that under solver for now.
+#
+# Please note that I have no idea what all of this is really necessary and for
+# much of this stuff being copied, no idea whether it makes any sense at all.
+# Much of this is copy-pasted from android/qa/sc/Makefile (where a couple of
+# unit tests for sc are built, and those do seem to mostly work) and
+# android/qa/desktop/Makefile (mmeeks's desktop demo, also works to some
+# extent).
+#
+ mkdir -p assets/gz.unpack/program/ure assets/lib assets/program assets/xml/ure assets/ComponentTarget/i18npool/util
+ gzip -9 <$(OUTDIR)/bin/offapi.rdb >assets/gz.unpack/program/offapi.rdb
+ gzip -9 <$(OUTDIR)/bin/oovbaapi.rdb >assets/gz.unpack/program/oovbaapi.rdb
+ gzip -9 <$(OUTDIR)/bin/types.rdb >assets/gz.unpack/program/types.rdb
+ gzip -9 <$(OUTDIR)/bin/ure/types.rdb >assets/gz.unpack/program/ure/types.rdb
+# For some reason the vnd.sun.star.expand:$LO_LIB_DIR doesn't seem to work, it expands to empty!?
+# So just hardcode the known APP_DATA_PATH for now...
+ for F in xml/services xml/ure/services; do \
+ sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$(APP_DATA_PATH)/lib/!g' <$(OUTDIR)/$$F.rdb >assets/$$F.rdb; \
+ done
+ cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt \
+ $(SRC_ROOT)/sc/qa/unit/data/xls/border.xls \
+ $(SRC_ROOT)/sw/qa/core/data/odt/test.odt \
+ $(SRC_ROOT)/sw/qa/core/data/doc/testVba.doc \
+ assets
+ cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util
+#
+ mkdir -p assets/ure/share/misc assets/share/registry/res assets/share/config/soffice.cfg
+ cp -R $(OUTDIR)/xml/*.xcd assets/share/registry
+ mv assets/share/registry/fcfg_langpack_en-US.xcd assets/share/registry/res
+ cp -R $(OUTDIR)/xml/uiconfig/* assets/share/config/soffice.cfg
+ cp -R $(OUTDIR)/xml/registry/* assets/share/registry
+#
+# Set up rc, the "inifile". See BootstrapMap::getBaseIni(). As this app
+# doesn't use soffice_main() (at least I think it shouldn't), the
+# rtl::Bootstrap::setIniFilename() call there that hardcodes
+# /assets/program/lofficerc isn't executed. Instead the hardcoding of
+# /assets/rc in BootstrapMap::getBaseIni() gets used.
+ echo '[Bootstrap]' > assets/rc
+ echo 'Logo=1' >> assets/rc
+ echo 'NativeProgress=1' >> assets/rc
+ echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/rc
+# echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/rc
+ echo "HOME=$(APP_DATA_PATH)/cache" >> assets/rc
+ echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/cache" >> assets/rc
+#
+# Set up fundamentalrc
+ echo '[Bootstrap]' > assets/program/fundamentalrc
+ echo "LO_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc
+ echo "URE_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc # checkme - is this used to find configs ?
+ echo 'BRAND_BASE_DIR=file:///assets' >> assets/program/fundamentalrc
+ echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/share/registry module:$${BRAND_BASE_DIR}/share/registry/modules res:$${BRAND_BASE_DIR}/share/registry' >> assets/program/fundamentalrc
+ echo 'URE_BIN_DIR=file:///assets/ure/bin/dir/not-here/can-we/exec-anyway' >> assets/program/fundamentalrc
+ echo 'URE_MORE_TYPES=file://$(APP_DATA_PATH)/program/offapi.rdb file://$(APP_DATA_PATH)/program/oovbaapi.rdb' >> assets/program/fundamentalrc
+ echo 'URE_MORE_SERVICES=file:///assets/xml/services.rdb <$$BRAND_BASE_DIR/program/services>*' >> assets/program/fundamentalrc
+#
+# Set up unorc
+ echo '[Bootstrap]' > assets/program/unorc
+ echo "URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/unorc
+ echo 'UNO_TYPES=file://$(APP_DATA_PATH)/program/ure/types.rdb file://$(APP_DATA_PATH)/program/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc
+ echo 'UNO_SERVICES=file:///assets/xml/ure/services.rdb $${URE_MORE_SERVICES}' >> assets/program/unorc
+#
+# Set up bootstraprc
+ echo '[Bootstrap]' > assets/program/bootstraprc
+ echo 'InstallMode=<installmode>' >> assets/program/bootstraprc
+ echo 'ProductKey=LibreOffice 3.6' >> assets/program/bootstraprc
+ echo "UserInstallation=file://$(APP_DATA_PATH)" >> assets/program/bootstraprc
+#
+# Set up versionrc
+ echo '[Version]' > assets/program/versionrc
+ echo 'AllLanguages=en-US' >> assets/program/versionrc
+ echo 'BuildVersion=' >> assets/program/versionrc
+ echo 'buildid=dead-beef' >> assets/program/versionrc
+ echo 'ProductMajor=360' >> assets/program/versionrc
+ echo 'ProductMinor=1' >> assets/program/versionrc
+ echo 'ReferenceOOoMajorMinor=3.6' >> assets/program/versionrc
+#
+# .res files
+ mkdir -p assets/program/resource
+ cp $(OUTDIR)/bin/*en-US.res assets/program/resource
+#
+# Assets that are unpacked at run-time into the app's data directory. These
+# are files read by non-LO code, fontconfig and freetype for now, that doesn't
+# understand "/assets" paths.
+ mkdir -p assets/unpack/etc/fonts
+ cp fonts.conf assets/unpack/etc/fonts
+# $UserInstallation/user/fonts is added to the fontconfig path in
+# vcl/generic/fontmanager/helper.cxx: psp::getFontPath(). UserInstallation is
+# set to the app's data dir above.
+ mkdir -p assets/gz.unpack/user/fonts
+ for F in $(OUTDIR)/pck/Liberation*.ttf $(OUTDIR)/pck/Gen*.ttf $(OUTDIR)/pck/opens___.ttf; do \
+ gzip -9 <$$F >assets/gz.unpack/user/fonts/`basename $$F`; \
+ done
+#
+# Then gdbserver and gdb.setup so that we can debug with ndk-gdb.
+#
+ mkdir -p $(SODEST)
+ cp $(ANDROID_NDK_GDBSERVER) $(SODEST)
+ echo set solib-search-path ./obj/local/$(ANDROID_APP_ABI) >$(SODEST)/gdb.setup
+# ------------ Pieces not from DocumentLoader ------------
+# tango artwork / icons
+ mkdir -p assets/share/config
+ cp -R $(OUTDIR)/bin/images_tango.zip assets/share/config/images.zip
+# shell / splash images
+ mkdir -p assets/program
+ cp -r $(SRC_ROOT)/icon-themes/galaxy/brand/* assets/program
+# presets - becomes the users home directory, .stamp forces .zip dir creation
+ for D in $(strip autocorr autotext backup basic config gallery \
+ psprint/driver psprint/fontmetric template \
+ uno_packages/cache wordbook); do \
+ mkdir -p assets/presets/$$D ; \
+ echo "content" > assets/presets/$$D/stamp; \
+ done
+# lofficerc
+ mkdir -p assets/program/
+ echo "[Bootstrap]" > assets/program/lofficerc
+ echo "Logo=1" >> assets/program/lofficerc
+ echo "NativeProgress=1" >> assets/program/lofficerc
+ echo "URE_BOOTSTRAP=file:///assets/program/fundamentalrc" >> assets/program/lofficerc
+# echo "RTL_LOGFILE=file:///dev/log/main" >> assets/program/lofficerc
+ echo "HOME=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
+ echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
+# - this looks useful but breaks more than it fixes ...
+# echo "DISABLE_EXTENSION_SYNCHRONIZATION=1" >> assets/program/lofficerc
+
+
+setup-jars:
+#
+# Copy jar files we need
+#
+ for F in $(strip \
+ java_uno \
+ juh \
+ jurt \
+ ridl \
+ unoil \
+ unoloader \
+ ); do \
+ $(call COPYJAR,$(OUTDIR)/bin/$${F}.jar); \
+ done
+
+build-ant: android_version_setup copy-stuff link-so properties setup-jars
+ unset JAVA_HOME && $(ANT) debug
+
+run:
+ $(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n org.libreoffice.android.examples/.LODesktop -e input /asset/test1.odt
+# -e lo-main-delay 20 -e lo-strace yes \ No newline at end of file
diff --git a/android/experimental/desktop/ant.properties b/android/experimental/desktop/ant.properties
new file mode 100644
index 000000000000..ee52d86d94a4
--- /dev/null
+++ b/android/experimental/desktop/ant.properties
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+# 'source.dir' for the location of your java source folder and
+# 'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+# 'key.store' for the location of your keystore and
+# 'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
diff --git a/android/experimental/desktop/build.xml b/android/experimental/desktop/build.xml
new file mode 100644
index 000000000000..4aac2f548251
--- /dev/null
+++ b/android/experimental/desktop/build.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="LibreOfficeQA-SC" default="help">
+
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <loadproperties srcFile="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+ unless="sdk.dir"
+ />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+ in between standard targets -->
+<!--
+ <target name="-pre-build">
+ </target>
+ <target name="-pre-compile">
+ </target>
+
+ /* This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir} */
+ <target name="-post-compile">
+ </target>
+-->
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${android.library.reference.1}/no-resource-compress.xml" />
+</project>
diff --git a/android/experimental/desktop/fonts.conf b/android/experimental/desktop/fonts.conf
new file mode 100644
index 000000000000..699e9d101048
--- /dev/null
+++ b/android/experimental/desktop/fonts.conf
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<!-- /etc/fonts/fonts.conf file to configure system font access -->
+<fontconfig>
+
+<!-- Font directory list -->
+
+ <dir>/system/fonts</dir>
+
+ <alias>
+ <family>serif</family>
+ <prefer>
+ <family>Droid Serif</family>
+ </prefer>
+ </alias>
+ <alias>
+ <family>sans-serif</family>
+ <prefer>
+ <family>Roboto</family>
+ <family>Droid Sans Fallback</family>
+ </prefer>
+ </alias>
+ <alias>
+ <family>monospace</family>
+ <prefer>
+ <family>Droid Sans Mono</family>
+ </prefer>
+ </alias>
+
+<!--
+ Accept deprecated 'mono' alias, replacing it with 'monospace'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>mono</string>
+ </test>
+ <edit name="family" mode="assign">
+ <string>monospace</string>
+ </edit>
+ </match>
+
+<!--
+ Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>sans serif</string>
+ </test>
+ <edit name="family" mode="assign">
+ <string>sans-serif</string>
+ </edit>
+ </match>
+
+<!--
+ Accept deprecated 'sans' alias, replacing it with 'sans-serif'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>sans</string>
+ </test>
+ <edit name="family" mode="assign">
+ <string>sans-serif</string>
+ </edit>
+ </match>
+
+<!--
+ Load local system customization file
+-->
+ <include ignore_missing="yes">conf.d</include>
+
+<!-- Font cache directory list -->
+
+ <!-- Yeah this hardcoding is wrong of course, will have to fix
+ later to patch in proper code in fontonfig on Android to
+ find out a good place.
+ -->
+ <cachedir>/data/data/org.libreoffice.android.examples/fontconfig</cachedir>
+
+ <config>
+<!--
+ These are the default Unicode chars that are expected to be blank
+ in fonts. All other blank chars are assumed to be broken and
+ won't appear in the resulting charsets
+ -->
+ <blank>
+ <int>0x0020</int> <!-- SPACE -->
+ <int>0x00A0</int> <!-- NO-BREAK SPACE -->
+ <int>0x00AD</int> <!-- SOFT HYPHEN -->
+ <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
+ <int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
+ <int>0x0601</int> <!-- ARABIC SIGN SANAH -->
+ <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
+ <int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
+ <int>0x06DD</int> <!-- ARABIC END OF AYAH -->
+ <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
+ <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
+ <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
+ <int>0x1680</int> <!-- OGHAM SPACE MARK -->
+ <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
+ <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
+ <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
+ <int>0x2000</int> <!-- EN QUAD -->
+ <int>0x2001</int> <!-- EM QUAD -->
+ <int>0x2002</int> <!-- EN SPACE -->
+ <int>0x2003</int> <!-- EM SPACE -->
+ <int>0x2004</int> <!-- THREE-PER-EM SPACE -->
+ <int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
+ <int>0x2006</int> <!-- SIX-PER-EM SPACE -->
+ <int>0x2007</int> <!-- FIGURE SPACE -->
+ <int>0x2008</int> <!-- PUNCTUATION SPACE -->
+ <int>0x2009</int> <!-- THIN SPACE -->
+ <int>0x200A</int> <!-- HAIR SPACE -->
+ <int>0x200B</int> <!-- ZERO WIDTH SPACE -->
+ <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
+ <int>0x200D</int> <!-- ZERO WIDTH JOINER -->
+ <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
+ <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
+ <int>0x2028</int> <!-- LINE SEPARATOR -->
+ <int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
+ <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
+ <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
+ <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
+ <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
+ <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
+ <int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
+ <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
+ <int>0x2060</int> <!-- WORD JOINER -->
+ <int>0x2061</int> <!-- FUNCTION APPLICATION -->
+ <int>0x2062</int> <!-- INVISIBLE TIMES -->
+ <int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
+ <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
+ <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
+ <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
+ <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
+ <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
+ <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
+ <int>0x2800</int> <!-- BRAILLE PATTERN BLANK -->
+ <int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
+ <int>0x3164</int> <!-- HANGUL FILLER -->
+ <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
+ <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
+ <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
+ <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
+ <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
+ </blank>
+<!--
+ Rescan configuration every 3600 seconds when FcFontSetList is called
+ -->
+ <rescan>
+ <int>3600</int>
+ </rescan>
+ </config>
+
+</fontconfig>
diff --git a/android/experimental/desktop/jni/Android.mk b/android/experimental/desktop/jni/Android.mk
new file mode 100644
index 000000000000..c5c2ed3b0293
--- /dev/null
+++ b/android/experimental/desktop/jni/Android.mk
@@ -0,0 +1,23 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := dummy
+LOCAL_SRC_FILES := dummy.c
+LOCAL_LDLIBS :=
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
new file mode 100644
index 000000000000..4f54ccd65c16
--- /dev/null
+++ b/android/experimental/desktop/native-code.cxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "osl/detail/android-bootstrap.h"
+
+extern "C"
+{
+ extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * cui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * dba_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * dbaxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * evtatt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * fileacc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * frm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * fsstorage_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * fwk_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * fwl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * fwm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * hwp_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * hyphen_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * lng_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * lnth_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * lotuswordpro_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * protocolhandler_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * oox_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sb_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * scd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * scfilt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sdd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * smd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * spl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * spell_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * svgfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * sw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * svx_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * wpftdraw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * wpftwriter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * xmlsecurity_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * xo_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * xof_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+}
+
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_libmap(void)
+{
+ static lib_to_component_mapping map[] = {
+ { "libanimcorelo.a", animcore_component_getFactory },
+ { "libavmedialo.a", avmedia_component_getFactory },
+ { "libdbalo.a", dba_component_getFactory },
+ { "libdbaxmllo.a", dbaxml_component_getFactory },
+ { "libcuilo.a", cui_component_getFactory },
+ { "libevtattlo.a", evtatt_component_getFactory },
+ { "libfileacc.a", fileacc_component_getFactory },
+ { "libfrmlo.a", frm_component_getFactory },
+ { "libfsstorage.uno.a", fsstorage_component_getFactory },
+ { "libfwklo.a", fwk_component_getFactory },
+ { "libfwllo.a", fwl_component_getFactory },
+ { "libfwmlo.a", fwm_component_getFactory },
+ { "libhwplo.a", hwp_component_getFactory },
+ { "libhyphenlo.a", hyphen_component_getFactory },
+ { "liblnglo.a", lng_component_getFactory },
+ { "liblnthlo.a", lnth_component_getFactory },
+ { "liblwpftlo.a", lotuswordpro_component_getFactory },
+ { "libooxlo.a", oox_component_getFactory },
+ { "libprotocolhandlerlo.a", protocolhandler_component_getFactory },
+ { "libscdlo.a", scd_component_getFactory },
+ { "libscfiltlo.a", scfilt_component_getFactory },
+ { "libsblo.a", sb_component_getFactory },
+ { "libsclo.a", sc_component_getFactory },
+ { "libsddlo.a", sdd_component_getFactory },
+ { "libsdlo.a", sd_component_getFactory },
+ { "libsmdlo.a", smd_component_getFactory },
+ { "libsmlo.a", sm_component_getFactory },
+ { "libspllo.a", spl_component_getFactory },
+ { "libsvgfilterlo.a", svgfilter_component_getFactory },
+ { "libsvxlo.a", svx_component_getFactory },
+ { "libswdlo.a", swd_component_getFactory },
+ { "libswlo.a", sw_component_getFactory },
+ { "libt602filterlo.a", t602filter_component_getFactory },
+ { "libtextfdlo.a", textfd_component_getFactory },
+ { "libunordflo.a", unordf_component_getFactory },
+ { "libunoxmllo.a", unoxml_component_getFactory },
+ { "libuuilo.a", uui_component_getFactory },
+ { "libwpftdrawlo.a", wpftdraw_component_getFactory },
+ { "libwpftwriterlo.a", wpftwriter_component_getFactory },
+ { "libxmlfdlo.a", xmlfd_component_getFactory },
+ { "libxmlsecurity.a", xmlsecurity_component_getFactory },
+ { "libxoflo.a", xof_component_getFactory },
+ { "libxolo.a", xo_component_getFactory },
+ { NULL, NULL }
+ };
+
+ // We need to pull this in, too, as it isn't in any of the libs we
+ // link with -Wl,--whole-archive.
+ extern void Java_org_libreoffice_android_examples_LODesktop_spawnMain();
+ volatile void *p = (void *) Java_org_libreoffice_android_examples_LODesktop_spawnMain;
+
+ extern void Java_org_libreoffice_android_examples_LODesktop_renderVCL();
+ volatile void *q = (void *) Java_org_libreoffice_android_examples_LODesktop_renderVCL;
+
+ return map;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/desktop/project.properties b/android/experimental/desktop/project.properties
new file mode 100644
index 000000000000..06b2d880c3d4
--- /dev/null
+++ b/android/experimental/desktop/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-14
+
+# Use the Bootstrap class
+android.library.reference.1=../../Bootstrap
diff --git a/android/experimental/desktop/res/layout/main.xml b/android/experimental/desktop/res/layout/main.xml
new file mode 100644
index 000000000000..5839d8cda704
--- /dev/null
+++ b/android/experimental/desktop/res/layout/main.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+<TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello World"
+ />
+</LinearLayout>
diff --git a/android/experimental/desktop/res/values/strings.xml b/android/experimental/desktop/res/values/strings.xml
new file mode 100644
index 000000000000..1672493c1606
--- /dev/null
+++ b/android/experimental/desktop/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">LibreOffice Viewer test</string>
+</resources>
diff --git a/android/experimental/desktop/src/org/libreoffice/android/examples/LODesktop.java b/android/experimental/desktop/src/org/libreoffice/android/examples/LODesktop.java
new file mode 100644
index 000000000000..bf370e6e36cd
--- /dev/null
+++ b/android/experimental/desktop/src/org/libreoffice/android/examples/LODesktop.java
@@ -0,0 +1,312 @@
+// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+// This is just a testbed for ideas and implementations. (Still, it might turn
+// out to be somewhat useful as such while waiting for "real" apps.)
+
+// Important points:
+
+// Everything that might take a long time should be done asynchronously:
+// - loading the document (loadComponentFromURL())
+// - counting number of pages (getRendererCount())
+// - rendering a page (render())
+
+// Unclear whether pages can be rendered in parallel. Probably best to
+// serialize all the above in the same worker thread. We use
+// AsyncTask.SERIAL_EXECUTOR below.
+
+// While a page is loading ideally should display some animated spinner (but
+// for now just a static "please wait" text).
+
+// ===
+
+// How should we handle re-rendering at higher resolution when zooming in, and
+// then panning around?
+
+// Hopefully when LO is asked to render just a part of a page (i.e. the
+// MapMode of the device rendered to causes significant parts of the page to
+// be outside the device) the code is clever enough to quickly skip stuff that
+// will be clipped. But I don't hold my breath.
+
+// How could we do it?
+
+// 1/ Re-render just the zoomed-in area. Probably not a good idea, as probably
+// the user will almost immediately also pan a bit or zoom out a bit, which
+// would cause a re-render.
+
+// 2/ Some kind of tiled approach. Initially just one tile for the whole
+// page. When zooming in, at some point (2x?) split the currently visible
+// tiles into four sub-tiles, each initially displaying the same resolution as
+// the parent tile. Start asynchronous rendering of visible sub-tiles at
+// double resolution. Keep the "parent" rendered bitmap but don't keep bitmaps
+// that go out of view. (Except perhaps for some caching.) When zooming out,
+// at some point (0.5x?) merge four sub-tiles back into one. Hmm. Is this the
+// right approach?
+
+// In any case, also this rendering at higher resolution should be done
+// asynchronously, of course. If the user zooms in and pans around, the
+// existing bitmap will be shown scaled (and ugly) until required rendering
+// has finished and then the affected tiles are replaced with
+// higher-resolution ones.
+
+package org.libreoffice.android.examples;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Matrix;
+import android.graphics.PixelFormat;
+import android.graphics.Paint;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationSet;
+import android.view.animation.TranslateAnimation;
+import android.widget.ImageView;
+import android.widget.NumberPicker;
+import android.widget.TextView;
+import android.widget.ViewFlipper;
+import android.widget.ViewSwitcher;
+
+import junit.framework.Assert;
+
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XBitmap;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XDevice;
+import com.sun.star.awt.XToolkitExperimental;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.view.XRenderable;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+
+import org.libreoffice.android.Bootstrap;
+
+public class LODesktop
+ extends Activity
+{
+ private static final String TAG = "LODesktop";
+
+ /* implementend by desktop */
+ private static native void spawnMain();
+
+ /* implementend by vcl */
+ public static native void renderVCL(Bitmap bitmap);
+
+ /**
+ * This class contains the state that is initialized once and never changes
+ * (not specific to a document or a view).
+ */
+ class BootstrapContext
+ {
+ public long timingOverhead;
+ public XComponentContext componentContext;
+ public XMultiComponentFactory mcf;
+ public XComponentLoader componentLoader;
+ public XToolkitExperimental toolkit;
+ public XDevice dummySmallDevice;
+ }
+
+ BootstrapContext bootstrapContext;
+ Bundle extras;
+
+ class MyXController
+ implements XController
+ {
+
+ XFrame frame;
+ XModel model;
+
+ public void attachFrame(XFrame frame)
+ {
+ Log.i(TAG, "attachFrame");
+ this.frame = frame;
+ }
+
+ public boolean attachModel(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 XModel getModel()
+ {
+ Log.i(TAG, "getModel");
+ return model;
+ }
+
+ public XFrame getFrame()
+ {
+ Log.i(TAG, "getFrame");
+ return frame;
+ }
+
+ public void dispose()
+ {
+ Log.i(TAG, "dispose");
+ }
+
+ public void addEventListener(XEventListener listener)
+ {
+ Log.i(TAG, "addEventListener");
+ }
+
+ public void removeEventListener(XEventListener listener)
+ {
+ Log.i(TAG, "removeEventListener");
+ }
+ }
+
+ // FIXME: we should prolly manage a bitmap buffer here and give it to
+ // VCL to render into ... and pull the WM/stacking pieces up into the Java ...
+ // [ perhaps ;-]
+ // how can we get an event to "create a window" - need a JNI callback I guess ...
+
+ private void initBootstrapContext()
+ {
+ try
+ {
+ bootstrapContext = new BootstrapContext();
+
+ long t0 = System.currentTimeMillis();
+ long t1 = System.currentTimeMillis();
+ bootstrapContext.timingOverhead = t1 - t0;
+
+ Bootstrap.setup(this);
+
+ // Avoid all the old style OSL_TRACE calls especially in vcl
+ Bootstrap.putenv("SAL_LOG=+WARN+INFO");
+
+ // Log.i(TAG, "Sleeping NOW");
+ // Thread.sleep(20000);
+
+ bootstrapContext.componentContext = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext();
+
+ Log.i(TAG, "context is" + (bootstrapContext.componentContext!=null ? " not" : "") + " null");
+
+ bootstrapContext.mcf = bootstrapContext.componentContext.getServiceManager();
+
+ Log.i(TAG, "mcf is" + (bootstrapContext.mcf!=null ? " not" : "") + " null");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ finish();
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ Log.i(TAG, "onCreate - added here\n");
+
+ try {
+ String input;
+// input = getIntent().getStringExtra("input");
+// if (input == null)
+// input = "/assets/test1.odt";
+ input = "-writer";
+
+ // We need to fake up an argv, and the argv[0] even needs to
+ // point to some file name that we can pretend is the "program".
+ // setCommandArgs() will prefix argv[0] with the app's data
+ // directory.
+
+ String[] argv = { "lo-document-loader", input };
+
+ Bootstrap.setCommandArgs(argv);
+
+ if (bootstrapContext == null)
+ initBootstrapContext();
+
+ spawnMain();
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.err);
+ finish();
+ }
+
+ Log.i(TAG, "onCreate - set content view\n");
+ setContentView(new BitmapView(this, this));
+ }
+}
+
+ class BitmapView extends android.view.View
+ {
+ LODesktop mDesktop;
+ Bitmap mBitmap;
+
+ public BitmapView(Context context, LODesktop desktop)
+ {
+ super(context);
+ mDesktop = desktop;
+ mBitmap = Bitmap.createBitmap(1000, 600, Bitmap.Config.ARGB_8888);
+ }
+
+ @Override protected void onDraw(Canvas canvas) {
+// canvas.drawColor(0xFF1ABCDD);
+
+ mDesktop.renderVCL(mBitmap);
+ canvas.drawBitmap(mBitmap, 0, 0, null);
+
+ // re-call ourselves a bit later ...
+ invalidate();
+ }
+ }
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab: