diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-04-18 10:00:51 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-04-18 10:01:59 +0300 |
commit | 4b663231f6b5937224fdc1c10a0e1fabd2bd85da (patch) | |
tree | 27c6bd2b1f99041be0596a6a966b69f9e063346f /android/experimental/DocumentLoader | |
parent | 8f80a0af7e48193d0c035c220537d7f40b915f56 (diff) |
Move DocumentLoader to the "experimental" subdirectory
Diffstat (limited to 'android/experimental/DocumentLoader')
9 files changed, 708 insertions, 0 deletions
diff --git a/android/experimental/DocumentLoader/AndroidManifest.xml b/android/experimental/DocumentLoader/AndroidManifest.xml new file mode 100644 index 000000000000..e3001d6875fa --- /dev/null +++ b/android/experimental/DocumentLoader/AndroidManifest.xml @@ -0,0 +1,18 @@ +<?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" /> + <application android:label="LO Experimental DocumentLoader" + android:debuggable="true"> + <activity android:name=".DocumentLoader" + android:label="LO DocumentLoader" + android:configChanges="orientation|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/DocumentLoader/Makefile b/android/experimental/DocumentLoader/Makefile new file mode 100644 index 000000000000..5dea15a9f929 --- /dev/null +++ b/android/experimental/DocumentLoader/Makefile @@ -0,0 +1,266 @@ +include ../../../config_host.mk + +# The package of this app +APP_PACKAGE=org.libreoffice.android.examples + +# We can't keep assuming APP_DATA_PATH like this, surely this can vary with +# Android versions and whatnot, this is temporary and works at least with the +# SDK 16 emulator... + +# Probably would be best to just stop fooling around with the possibilities to +# set various stuff with the -env command line parameters (and environment +# variables?) and in a plethora of rc files, and hardcode construction of +# *all* required pathnames based on the app installation location for Android +# (and iOS), etc. We don't really win anything by having so many layers of +# configurability on platforms like Android and iOS where apps based on LO +# code are very much self-contained pre-packaged thingies. +APP_DATA_PATH=/data/data/$(APP_PACKAGE) + +SODEST=libs/armeabi-v7a +OBJLOCAL=obj/local/armeabi-v7a + +define COPYSO +cp $(1) $(SODEST)$(if $(2),/$(2)) && $(STRIP) --strip-debug $(SODEST)$(if $(2),/$(2),/$(notdir $(1))) && \ +cp $(1) $(OBJLOCAL)$(if $(2),/$(2)) +endef + +define COPYJAR +cp $(1) libs +endef + +# The default target just builds. + +all: build-ant + +copy-stuff: +# First always clean + rm -rf libs $(OBJLOCAL) + mkdir -p $(SODEST) $(OBJLOCAL) +# +# Copy shared libraries (including UNO components) we need to +# libs/armeabi-v7a so that ant will include them in the .apk. +# +# Copy them to obj/local/armeabi-v7a, too, where gdb will look for +# them. +# + for F in $(strip \ + analysislo \ + basebmplo \ + basegfxlo \ + bootstrap.uno \ + cdrimportlo \ + comphelpgcc3 \ + datelo \ + dbaxmllo \ + dbtoolslo \ + evtattlo \ + expwrap.uno \ + fastsax.uno \ + fileacc \ + fontconfig \ + forlo \ + foruilo \ + freetype \ + frmlo \ + fsstorage.uno \ + gcc3_uno \ + hwplo \ + i18nisolang1gcc3 \ + i18npaperlo \ + i18npool.uno \ + i18nutilgcc3 \ + icudatalo \ + icui18nlo \ + iculelo \ + icuuclo \ + introspection.uno \ + java_uno \ + juh \ + juhx \ + jvmaccessgcc3 \ + jvmfwk \ + lo-bootstrap \ + localebe1.uno \ + localedata_en \ + localedata_others \ + lwpftlo \ + mergedlo \ + msfilterlo \ + msworkslo \ + ooxlo \ + raptor \ + rasqal \ + rdf \ + reflection.uno \ + reg \ + saxlo \ + sclo \ + scdlo \ + scfiltlo \ + sddlo \ + smdlo \ + sotlo \ + stocservices.uno \ + store \ + svgfilterlo \ + svllo \ + swdlo \ + swlo \ + t602filterlo \ + textinstream.uno \ + tllo \ + ucbhelper4gcc3 \ + uno_cppu \ + uno_cppuhelpergcc3 \ + uno_sal \ + uno_salhelpergcc3 \ + uno_cppuhelpergcc3 \ + unordflo \ + unoxmllo \ + utllo \ + vbahelperlo \ + vcllo \ + visioimportlo \ + wpftlo \ + wpgimportlo \ + xml2 \ + xmlfdlo \ + xmlreader \ + xmlsecurity \ + xslt \ + xstor \ + ); do \ + $(call COPYSO,$(OUTDIR)/lib/lib$${F}.so); \ + done +# +# Then the shared GNU C++ library + $(call COPYSO,$(ANDROID_NDK_HOME)/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so) +# +# Then other "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/bin/ure assets/lib assets/program assets/xml/ure assets/ComponentTarget/i18npool/util + cp $(OUTDIR)/bin/udkapi.rdb assets/bin + cp $(OUTDIR)/bin/types.rdb assets/bin + cp $(OUTDIR)/bin/ure/types.rdb assets/bin/ure +# 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 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:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb' >> assets/program/fundamentalrc + echo 'URE_MORE_SERVICES=file:///assets/xml/ure/services.rdb 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:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc + echo 'UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/xml/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 'ProductBuildid=3' >> assets/program/versionrc + echo 'ProductMajor=360' >> assets/program/versionrc + echo 'ProductMinor=1' >> assets/program/versionrc + echo 'ProductSource=OOO350' >> 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 + mkdir -p assets/unpack/user/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. + cp $(OUTDIR)/pck/Liberation*.ttf assets/unpack/user/fonts + cp $(OUTDIR)/pck/Gen*.ttf assets/unpack/user/fonts + cp $(OUTDIR)/pck/opens___.ttf assets/unpack/user/fonts +# +# Then gdbserver and gdb.setup so that we can debug with ndk-gdb. +# + cp $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver $(SODEST) + echo set solib-search-path ./obj/local/armeabi-v7a >$(SODEST)/gdb.setup + +build-ant: copy-stuff +# +# Copy jar files we need, and even construct one. +# + for F in $(strip \ + java_uno \ + juh \ + jurt \ + ridl \ + unoil \ + unoloader \ + ); do \ + $(call COPYJAR,$(OUTDIR)/bin/$${F}.jar); \ + done +# + unset JAVA_HOME && $(ANT) debug + +install: build-ant + unset JAVA_HOME && $(ANT) debug install + @echo + @echo 'Run it with something like what "make run" does (see Makefile)' + @echo + +uninstall: + $(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE) + +run: + adb shell am start -n org.libreoffice.android.examples/.DocumentLoader -e input /assets/test1.odt + +clean: + $(ANT) clean + rm -rf assets libs $(SODEST) $(OBJLOCAL) diff --git a/android/experimental/DocumentLoader/build.xml b/android/experimental/DocumentLoader/build.xml new file mode 100644 index 000000000000..5d960196c6b0 --- /dev/null +++ b/android/experimental/DocumentLoader/build.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="LibreOfficeDocumentLoader" 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="${sdk.dir}/tools/ant/build.xml" /> + + <!-- Re-define the "-package-resources" target to not compress resources --> + + <target name="-package-resources" depends="-crunch"> + <!-- only package resources if *not* a library project --> + <do-only-if-not-library elseText="Library project: do not package resources..." > + <aapt executable="${aapt}" + command="package" + versioncode="${version.code}" + versionname="${version.name}" + debug="${build.is.packaging.debug}" + manifest="AndroidManifest.xml" + assets="${asset.absolute.dir}" + androidjar="${android.jar}" + apkfolder="${out.absolute.dir}" + nocrunch="${build.packaging.nocrunch}" + resourcefilename="${resource.package.file.name}" + resourcefilter="${aapt.resource.filter}" + projectLibrariesResName="project.libraries.res" + projectLibrariesPackageName="project.libraries.package" + previousBuildType="${build.last.target}" + buildType="${build.target}"> + <res path="${out.res.absolute.dir}" /> + <res path="${resource.absolute.dir}" /> + <nocompress /> <!-- forces no compression on any files in assets or res/raw --> + <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw --> + </aapt> + </do-only-if-not-library> + </target> + +</project> diff --git a/android/experimental/DocumentLoader/fonts.conf b/android/experimental/DocumentLoader/fonts.conf new file mode 100644 index 000000000000..699e9d101048 --- /dev/null +++ b/android/experimental/DocumentLoader/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/DocumentLoader/jni/Android.mk b/android/experimental/DocumentLoader/jni/Android.mk new file mode 100644 index 000000000000..939a1ea503bb --- /dev/null +++ b/android/experimental/DocumentLoader/jni/Android.mk @@ -0,0 +1,8 @@ +# Needed just to satisfy ndk-gdb for now, but maybe later we will actually add +# some JNI code here + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +include $(BUILD_SHARED_LIBRARY) diff --git a/android/experimental/DocumentLoader/jni/Application.mk b/android/experimental/DocumentLoader/jni/Application.mk new file mode 100644 index 000000000000..f326d1a59879 --- /dev/null +++ b/android/experimental/DocumentLoader/jni/Application.mk @@ -0,0 +1,3 @@ +# File needed by ndk-gdb +APP_ABI := armeabi-v7a +APP_PLATFORM := android-14 diff --git a/android/experimental/DocumentLoader/local.properties.in b/android/experimental/DocumentLoader/local.properties.in new file mode 100644 index 000000000000..27c8eb5f4dac --- /dev/null +++ b/android/experimental/DocumentLoader/local.properties.in @@ -0,0 +1,2 @@ +# Location of the SDK. This is only used by Ant. +sdk.dir=@ANDROID_SDK_HOME@ diff --git a/android/experimental/DocumentLoader/project.properties b/android/experimental/DocumentLoader/project.properties new file mode 100644 index 000000000000..06b2d880c3d4 --- /dev/null +++ b/android/experimental/DocumentLoader/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/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java new file mode 100644 index 000000000000..76b545ff0c9a --- /dev/null +++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java @@ -0,0 +1,129 @@ +// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +// Version: MPL 1.1 / GPLv3+ / LGPLv3+ +// +// The contents of this file are subject to the Mozilla Public License Version +// 1.1 (the "License"); you may not use this file except in compliance with +// the License or as specified alternatively below. You may obtain a copy of +// the License at http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the +// License. +// +// Major Contributor(s): +// Copyright (C) 2011 Tor Lillqvist <tml@iki.fi> (initial developer) +// Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) +// +// All Rights Reserved. +// +// For minor contributions see the git repository. +// +// Alternatively, the contents of this file may be used under the terms of +// either the GNU General Public License Version 3 or later (the "GPLv3+"), or +// the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +// in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +// instead of those above. + +package org.libreoffice.android.examples; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +import com.sun.star.uno.UnoRuntime; + +import org.libreoffice.android.Bootstrap; + +public class DocumentLoader + extends Activity { + + private static String TAG = "DocumentLoader"; + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + try { + + Bootstrap.setup(this); + + Bootstrap.putenv("SAL_LOG=yes"); + + // Load a lot of shlibs here explicitly in advance because that + // makes debugging work better, sigh + Bootstrap.dlopen("libvcllo.so"); + Bootstrap.dlopen("libmergedlo.so"); + Bootstrap.dlopen("libswdlo.so"); + Bootstrap.dlopen("libswlo.so"); + + com.sun.star.uno.XComponentContext xContext = null; + + xContext = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext(); + + Log.i(TAG, "xContext is" + (xContext!=null ? " not" : "") + " null"); + + Log.i(TAG, "Sleeping NOW"); + Thread.sleep(20000); + + com.sun.star.lang.XMultiComponentFactory xMCF = + xContext.getServiceManager(); + + Log.i(TAG, "xMCF is" + (xMCF!=null ? " not" : "") + " null"); + + String input = getIntent().getStringExtra("input"); + if (input == null) + input = "/assets/test1.odt"; + + // We need to fake up abn 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); + + Bootstrap.initVCL(); + + 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); + + Log.i(TAG, "xCompLoader is" + (xCompLoader!=null ? " not" : "") + " null"); + + // Loading the wanted document + com.sun.star.beans.PropertyValue propertyValues[] = + new com.sun.star.beans.PropertyValue[2]; + propertyValues[0] = new com.sun.star.beans.PropertyValue(); + propertyValues[0].Name = "Hidden"; + propertyValues[0].Value = new Boolean(true); + propertyValues[1] = new com.sun.star.beans.PropertyValue(); + propertyValues[1].Name = "ReadOnly"; + propertyValues[1].Value = new Boolean(true); + + String sUrl = "file://" + input; + + Object oDoc = + xCompLoader.loadComponentFromURL + (sUrl, "_blank", 0, propertyValues); + Log.i(TAG, "oDoc is " + (oDoc!=null ? oDoc.toString() : "null")); + } + catch (Exception e) { + e.printStackTrace(System.err); + System.exit(1); + } + } +} + +// vim:set shiftwidth=4 softtabstop=4 expandtab: |