diff --git a/android/examples/DocumentLoader/AndroidManifest.xml b/android/examples/DocumentLoader/AndroidManifest.xml new file mode 100644 index 000000000000..c137311155d1 --- /dev/null +++ b/android/examples/DocumentLoader/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/android/examples/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/examples/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java new file mode 100644 index 000000000000..41f69dd019b0 --- /dev/null +++ b/android/examples/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java @@ -0,0 +1,97 @@ +// -*- 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 (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.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.EditText; + +import com.sun.star.uno.UnoRuntime; + +import org.libreoffice.android.Bootstrap; + +public class DocumentLoader + extends Activity { + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + try { + + Thread.sleep(20000); + + Bootstrap.setup(this); + + Bootstrap.dlopen("libjuh.so"); + + com.sun.star.uno.XComponentContext xContext = null; + + xContext = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext(); + + com.sun.star.lang.XMultiComponentFactory xMCF = + xContext.getServiceManager(); + + Object oDesktop = xMCF.createInstanceWithContext( + "com.sun.star.frame.Desktop", xContext); + + com.sun.star.frame.XComponentLoader xCompLoader = + (com.sun.star.frame.XComponentLoader) + UnoRuntime.queryInterface( + com.sun.star.frame.XComponentLoader.class, oDesktop); + + // Getting the given starting directory + String sUrl = "file:///assets/inputfile.doc"; + + // Loading the wanted document + com.sun.star.beans.PropertyValue propertyValues[] = + new com.sun.star.beans.PropertyValue[1]; + propertyValues[0] = new com.sun.star.beans.PropertyValue(); + propertyValues[0].Name = "Hidden"; + propertyValues[0].Value = new Boolean(true); + + Object oDoc = + xCompLoader.loadComponentFromURL + (sUrl, "_blank", 0, propertyValues); + } + catch (Exception e) { + e.printStackTrace(System.err); + System.exit(1); + } + } +} + +// vim:set shiftwidth=4 softtabstop=4 expandtab: