[Libreoffice-commits] core.git: Branch 'feature/owncloud-provider-for-android' - 113 commits - android/experimental basctl/source chart2/Library_chartcore.mk chart2/source comphelper/source configmgr/Module_configmgr.mk configmgr/qa configmgr/source configure.ac desktop/source download.lst editeng/source external/Module_external.mk external/owncloud-android-lib forms/source formula/source .git-hooks/commit-msg helpcontent2 i18npool/source icon-themes/tango icon-themes/tango_testing include/canvas include/comphelper include/jvmaccess include/sal include/tools include/unotools jvmaccess/source Makefile.fetch officecfg/registry opencl/source postprocess/CppunitTest_services.mk postprocess/qa RepositoryExternal.mk sal/osl sal/rtl sc/inc sc/source sd/source sd/uiconfig sfx2/source solenv/bin starmath/Library_sm.mk starmath/source svtools/source svx/source sw/inc sw/source tools/source ucb/source unotools/source vcl/generic vcl/inc vcl/source writerfilter/source xmloff/source xmlsecurity/source

Jacobo Aragunde Pérez jaragunde at igalia.com
Thu Feb 12 12:25:23 PST 2015


Rebased ref, commits from common ancestor:
commit e78ab7f9cbe6963708cc636e38946a20fce25858
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Feb 10 16:17:12 2015 +0000

    Android: improve error handling in ownCloud provider.
    
    This provider now throws exceptions with properly internationalized
    messages to be shown to the user.
    
    Change-Id: I0464bffe14cab24d50180cb5e2e62ce746bcba74

diff --git a/android/experimental/LOAndroid3/res/values/strings.xml b/android/experimental/LOAndroid3/res/values/strings.xml
index 336b19b..135e52d 100644
--- a/android/experimental/LOAndroid3/res/values/strings.xml
+++ b/android/experimental/LOAndroid3/res/values/strings.xml
@@ -36,6 +36,10 @@
     <string name="local_file_system">Local file system</string>
     <string name="owncloud">ownCloud</string>
 
+    <string name="owncloud_wrong_connection">Cannot connect to ownCloud server. Check your configuration.</string>
+    <string name="owncloud_unauthorized">Cannot log into ownCloud server. Check your configuration.</string>
+    <string name="owncloud_unspecified_error">Unspecified error connecting to ownCloud server. Check your configuration and/or try later.</string>
+
     <!-- Document provider settings -->
     <string name="storage_provider_settings">Storage provider settings</string>
     <string name="owncloud_settings">ownCloud settings</string>
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
index a8d1a06..ce10ab6 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
@@ -69,8 +69,7 @@ public class OwnCloudFile implements IFile {
             RemoteOperationResult result = refreshOperation.execute(provider
                     .getClient());
             if (!result.isSuccess()) {
-                throw new RuntimeException(result.getLogMessage(),
-                        result.getException());
+                throw provider.buildRuntimeExceptionForResultCode(result.getCode());
             }
             for (Object obj : result.getData()) {
                 RemoteFile child = (RemoteFile) obj;
@@ -104,7 +103,10 @@ public class OwnCloudFile implements IFile {
         File downFolder = provider.getCacheDir();
         DownloadRemoteFileOperation operation = new DownloadRemoteFileOperation(
                 file.getRemotePath(), downFolder.getAbsolutePath());
-        operation.execute(provider.getClient());
+        RemoteOperationResult result = operation.execute(provider.getClient());
+        if (!result.isSuccess()) {
+            throw provider.buildRuntimeExceptionForResultCode(result.getCode());
+        }
         return new File(downFolder.getAbsolutePath() + file.getRemotePath());
     }
 
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
index 827c0af..66e4633 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -18,6 +18,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientFactory;
 import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
 import com.owncloud.android.lib.resources.files.RemoteFile;
@@ -78,8 +79,7 @@ public class OwnCloudProvider implements IDocumentProvider,
                 uri.getPath());
         RemoteOperationResult result = refreshOperation.execute(client);
         if (!result.isSuccess()) {
-            throw new RuntimeException(result.getLogMessage(),
-                    result.getException());
+            throw buildRuntimeExceptionForResultCode(result.getCode());
         }
         if (result.getData().size() > 0) {
             return new OwnCloudFile(this, (RemoteFile) result.getData().get(0));
@@ -113,6 +113,29 @@ public class OwnCloudProvider implements IDocumentProvider,
     }
 
     /**
+     * Build the proper RuntimeException for some error result.
+     *
+     * @param code Result code got from some RemoteOperationResult.
+     * @return exception with the proper internationalized error message.
+     */
+    protected RuntimeException buildRuntimeExceptionForResultCode(ResultCode code) {
+        int errorMessage;
+        switch (code) {
+            case WRONG_CONNECTION:  // SocketException
+            case FILE_NOT_FOUND:    // HTTP 404
+                errorMessage = R.string.owncloud_wrong_connection;
+                break;
+            case UNAUTHORIZED:      // wrong user/pass
+                errorMessage = R.string.owncloud_unauthorized;
+                break;
+            default:
+                errorMessage = R.string.owncloud_unspecified_error;
+                break;
+        }
+        return new RuntimeException(context.getString(errorMessage));
+    }
+
+    /**
      * Deletes files and recursively deletes directories.
      *
      * @param file
commit 5f360b078a5b506a5df716d64afe4cb227fb45eb
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon Feb 9 20:20:11 2015 +0100

    Android: document providers listen to changes in preferences.
    
    With this patch, document providers are able to listen to changes in
    their preferences and update their internal state accordingly. Now
    ownCloud provider can see its server updated without restarting the
    application.
    
    Change-Id: I833c7ec9fc97be58bdc8ac2cbf4384a33c2b400e

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
index 3d462e6..612eaa6 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
@@ -9,11 +9,15 @@
 
 package org.libreoffice.storage;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import org.libreoffice.storage.local.LocalDocumentsDirectoryProvider;
 import org.libreoffice.storage.local.LocalDocumentsProvider;
 import org.libreoffice.storage.owncloud.OwnCloudProvider;
 
 import android.content.Context;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 
 /**
  * Keeps the instances of the available IDocumentProviders in the system.
@@ -103,4 +107,14 @@ public final class DocumentProviderFactory {
     public IDocumentProvider getDefaultProvider() {
         return providers[0];
     }
+
+    public Set<OnSharedPreferenceChangeListener> getChangeListeners() {
+        Set<OnSharedPreferenceChangeListener> listeners =
+                new HashSet<OnSharedPreferenceChangeListener>();
+        for (IDocumentProvider provider : providers) {
+            if (provider instanceof OnSharedPreferenceChangeListener)
+                listeners.add((OnSharedPreferenceChangeListener) provider);
+        }
+        return listeners;
+    }
 }
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
index d17fe51..e98534a 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
@@ -9,11 +9,15 @@
 
 package org.libreoffice.storage;
 
+import java.util.Set;
+
 import org.libreoffice.R;
 
 import android.app.Activity;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.os.Bundle;
 import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
 
 public class DocumentProviderSettingsActivity extends Activity {
 
@@ -21,6 +25,8 @@ public class DocumentProviderSettingsActivity extends Activity {
     public static final String KEY_PREF_OWNCLOUD_USER_NAME = "pref_user_name";
     public static final String KEY_PREF_OWNCLOUD_PASSWORD = "pref_password";
 
+    private Set<OnSharedPreferenceChangeListener> listeners;
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -30,6 +36,27 @@ public class DocumentProviderSettingsActivity extends Activity {
                 .replace(android.R.id.content, new SettingsFragment()).commit();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        listeners = DocumentProviderFactory.getInstance().getChangeListeners();
+        for (OnSharedPreferenceChangeListener listener : listeners) {
+            PreferenceManager.getDefaultSharedPreferences(this)
+                    .registerOnSharedPreferenceChangeListener(listener);
+        }
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+
+        for (OnSharedPreferenceChangeListener listener : listeners) {
+            PreferenceManager.getDefaultSharedPreferences(this)
+                    .unregisterOnSharedPreferenceChangeListener(listener);
+        }
+    }
+
     public static class SettingsFragment extends PreferenceFragment {
         @Override
         public void onCreate(Bundle savedInstanceState) {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
index a94e1ad..827c0af 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -10,6 +10,7 @@ import org.libreoffice.storage.IFile;
 
 import android.content.Context;
 import android.content.SharedPreferences;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.net.Uri;
 import android.preference.PreferenceManager;
 
@@ -24,8 +25,10 @@ import com.owncloud.android.lib.resources.files.RemoteFile;
 /**
  * Implementation of IDocumentProvider for ownCloud servers.
  */
-public class OwnCloudProvider implements IDocumentProvider {
+public class OwnCloudProvider implements IDocumentProvider,
+        OnSharedPreferenceChangeListener {
 
+    private Context context;
     private OwnCloudClient client;
     private File cacheDir;
 
@@ -34,6 +37,8 @@ public class OwnCloudProvider implements IDocumentProvider {
     private String password;
 
     public OwnCloudProvider(Context context) {
+        this.context = context;
+
         // read preferences
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
         serverUrl = preferences.getString(
@@ -43,11 +48,7 @@ public class OwnCloudProvider implements IDocumentProvider {
         password = preferences.getString(
                 DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_PASSWORD, "");
 
-        Uri serverUri = Uri.parse(serverUrl);
-        client = OwnCloudClientFactory.createOwnCloudClient(serverUri,
-                context, true);
-        client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
-                userName, password));
+        setupClient();
 
         // make sure cache directory exists, and clear it
         // TODO: probably we should do smarter cache management
@@ -58,6 +59,14 @@ public class OwnCloudProvider implements IDocumentProvider {
         cacheDir.mkdirs();
     }
 
+    private void setupClient() {
+        Uri serverUri = Uri.parse(serverUrl);
+        client = OwnCloudClientFactory.createOwnCloudClient(serverUri, context,
+                true);
+        client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
+                userName, password));
+    }
+
     @Override
     public IFile getRootDirectory() {
         return createFromUri(URI.create(FileUtils.PATH_SEPARATOR));
@@ -116,4 +125,25 @@ public class OwnCloudProvider implements IDocumentProvider {
         }
         file.delete();
     }
+
+    @Override
+    public void onSharedPreferenceChanged(SharedPreferences preferences,
+            String key) {
+        boolean changed = false;
+        if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_SERVER)) {
+            serverUrl = preferences.getString(key, "");
+            changed = true;
+        }
+        else if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_USER_NAME)) {
+            userName = preferences.getString(key, "");
+            changed = true;
+        }
+        else if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_PASSWORD)) {
+            password = preferences.getString(key, "");
+            changed = true;
+        }
+
+        if (changed)
+            setupClient();
+    }
 }
commit c8a04c1deb5fc0c4daa327bbb25ccc146768ebaf
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon Feb 9 14:10:29 2015 +0100

    Android: add menu entry for document provider settings
    
    Change-Id: Ic48275fe2e7d83fd5e77171f4f5740a527dec7e2

diff --git a/android/experimental/LOAndroid3/res/menu/view_menu.xml b/android/experimental/LOAndroid3/res/menu/view_menu.xml
index f316f5a..aff3709 100644
--- a/android/experimental/LOAndroid3/res/menu/view_menu.xml
+++ b/android/experimental/LOAndroid3/res/menu/view_menu.xml
@@ -11,6 +11,8 @@
           android:title="@string/menu_sort_az"/>
     <item android:id="@+id/menu_sort_modified"
           android:title="@string/menu_sort_modified"/>
+    <item android:id="@+id/menu_storage_preferences"
+          android:title="@string/storage_provider_settings"/>
     <item android:id="@+id/action_about"
           android:title="@string/action_about"
           android:orderInCategory="100"/>
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 0457723..2a4b69f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -13,6 +13,7 @@ import org.libreoffice.LibreOfficeMainActivity;
 import org.libreoffice.R;
 import org.libreoffice.LOAbout;
 import org.libreoffice.storage.DocumentProviderFactory;
+import org.libreoffice.storage.DocumentProviderSettingsActivity;
 import org.libreoffice.storage.IDocumentProvider;
 import org.libreoffice.storage.IFile;
 import org.libreoffice.storage.local.LocalDocumentsProvider;
@@ -444,6 +445,10 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
             case R.id.action_about:
                 showAbout();
                 return true;
+        case R.id.menu_storage_preferences:
+            startActivity(new Intent(this, DocumentProviderSettingsActivity.class));;
+            break;
+
             default:
                 return super.onOptionsItemSelected(item);
         }
commit 6096431edc4956344169a491ccb9b209785fca0e
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon Feb 9 14:04:59 2015 +0100

    Android: setup ownCloud provider with user-defined settings
    
    Change-Id: I4ad4dd12854ca9f332055a50131959f60f7da504

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
index bb04855..d17fe51 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
@@ -16,6 +16,11 @@ import android.os.Bundle;
 import android.preference.PreferenceFragment;
 
 public class DocumentProviderSettingsActivity extends Activity {
+
+    public static final String KEY_PREF_OWNCLOUD_SERVER = "pref_server_url";
+    public static final String KEY_PREF_OWNCLOUD_USER_NAME = "pref_user_name";
+    public static final String KEY_PREF_OWNCLOUD_PASSWORD = "pref_password";
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
index db2b698..a94e1ad 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -4,11 +4,14 @@ import java.io.File;
 import java.net.URI;
 
 import org.libreoffice.R;
+import org.libreoffice.storage.DocumentProviderSettingsActivity;
 import org.libreoffice.storage.IDocumentProvider;
 import org.libreoffice.storage.IFile;
 
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.net.Uri;
+import android.preference.PreferenceManager;
 
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientFactory;
@@ -26,12 +29,20 @@ public class OwnCloudProvider implements IDocumentProvider {
     private OwnCloudClient client;
     private File cacheDir;
 
-    // TODO: these must be configurable
-    final private String serverUrl = "http://10.0.2.2/owncloud"; //emulator host machine
-    final private String userName = "admin";
-    final private String password = "admin";
+    private String serverUrl;
+    private String userName;
+    private String password;
 
     public OwnCloudProvider(Context context) {
+        // read preferences
+        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+        serverUrl = preferences.getString(
+                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_SERVER, "");
+        userName = preferences.getString(
+                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_USER_NAME, "");
+        password = preferences.getString(
+                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_PASSWORD, "");
+
         Uri serverUri = Uri.parse(serverUrl);
         client = OwnCloudClientFactory.createOwnCloudClient(serverUri,
                 context, true);
commit 79e81792f25da7dfb53954afb6d8122a24be92e5
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon Feb 9 12:37:46 2015 +0100

    Android: settings activity for document providers
    
    Creates an activity to manage the settings of any document provider
    that needs them, and populated it with the settings required by the
    ownCloud implementation.
    
    The settings screen is not yet plugged to the document browser UI but
    can be launched with this command:
    
      adb shell am start -a android.intent.action.MAIN \
      -n org.libreoffice/.storage.DocumentProviderSettingsActivity
    
    Change-Id: I83cff641fa61078f2bddbb98262af989c06985a9

diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in
index cc61db5..fc6958b 100644
--- a/android/experimental/LOAndroid3/AndroidManifest.xml.in
+++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in
@@ -99,6 +99,14 @@
             </intent-filter>
         </activity>
 
+        <!-- Document Provider Settings Activity -->
+        <activity android:name=".storage.DocumentProviderSettingsActivity"
+                  android:label="@string/storage_provider_settings">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
     </application>
 
 </manifest>
diff --git a/android/experimental/LOAndroid3/res/values/strings.xml b/android/experimental/LOAndroid3/res/values/strings.xml
index 50cd31e..336b19b 100644
--- a/android/experimental/LOAndroid3/res/values/strings.xml
+++ b/android/experimental/LOAndroid3/res/values/strings.xml
@@ -36,4 +36,12 @@
     <string name="local_file_system">Local file system</string>
     <string name="owncloud">ownCloud</string>
 
+    <!-- Document provider settings -->
+    <string name="storage_provider_settings">Storage provider settings</string>
+    <string name="owncloud_settings">ownCloud settings</string>
+    <string name="server_url">Server URL</string>
+    <string name="server_url_and_port">URL and port of the ownCloud server.</string>
+    <string name="user_name">User name</string>
+    <string name="password">Password</string>
+
 </resources>
diff --git a/android/experimental/LOAndroid3/res/xml/documentprovider_preferences.xml b/android/experimental/LOAndroid3/res/xml/documentprovider_preferences.xml
new file mode 100644
index 0000000..a359d14
--- /dev/null
+++ b/android/experimental/LOAndroid3/res/xml/documentprovider_preferences.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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/.
+ -->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+    <PreferenceCategory
+        android:title="@string/owncloud_settings"
+        android:key="pref_key_owncloud_settings">
+        <EditTextPreference
+            android:key="pref_server_url"
+            android:title="@string/server_url"
+            android:summary="@string/server_url_and_port"
+            android:defaultValue="http://" />
+        <EditTextPreference
+            android:key="pref_user_name"
+            android:title="@string/user_name"
+            android:defaultValue="" />
+        <EditTextPreference
+            android:key="pref_password"
+            android:title="@string/password"
+            android:defaultValue="" />
+    </PreferenceCategory>
+</PreferenceScreen>
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
new file mode 100644
index 0000000..bb04855
--- /dev/null
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
@@ -0,0 +1,37 @@
+/* -*- 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/.
+ */
+
+package org.libreoffice.storage;
+
+import org.libreoffice.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+public class DocumentProviderSettingsActivity extends Activity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Display the fragment as the main content.
+        getFragmentManager().beginTransaction()
+                .replace(android.R.id.content, new SettingsFragment()).commit();
+    }
+
+    public static class SettingsFragment extends PreferenceFragment {
+        @Override
+        public void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            // Load the preferences from an XML resource
+            addPreferencesFromResource(R.xml.documentprovider_preferences);
+        }
+    }
+}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 9435c092..0457723 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -112,6 +112,8 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
         DocumentProviderFactory.initialize(this);
         documentProviderFactory = DocumentProviderFactory.getInstance();
 
+        PreferenceManager.setDefaultValues(this, R.xml.documentprovider_preferences, false);
+
         // init UI and populate with contents from the provider
         createUI();
         switchToDocumentProvider(documentProviderFactory.getDefaultProvider());
commit 433bec74b6f87022189a5d5c139d05041d6fe711
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Jan 27 12:44:42 2015 +0000

    Android: download documents from ownCloud.
    
    Documents are downloaded to the private cache directory of the app,
    and opened from there. That directory is cleared and created again
    every time the application starts up.
    
    Change-Id: I5c05c8ae750b6ced3b419c67d84063e8ee3d84aa

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
index 8e6d6cf..a8d1a06 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
@@ -10,6 +10,7 @@ import java.util.List;
 import org.libreoffice.storage.IFile;
 
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
 import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
 import com.owncloud.android.lib.resources.files.RemoteFile;
 
@@ -97,8 +98,14 @@ public class OwnCloudFile implements IFile {
 
     @Override
     public File getDocument() {
-        // TODO Auto-generated method stub
-        return null;
+        if (isDirectory()) {
+            return null;
+        }
+        File downFolder = provider.getCacheDir();
+        DownloadRemoteFileOperation operation = new DownloadRemoteFileOperation(
+                file.getRemotePath(), downFolder.getAbsolutePath());
+        operation.execute(provider.getClient());
+        return new File(downFolder.getAbsolutePath() + file.getRemotePath());
     }
 
     @Override
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
index 7bd78e3..db2b698 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -1,5 +1,6 @@
 package org.libreoffice.storage.owncloud;
 
+import java.io.File;
 import java.net.URI;
 
 import org.libreoffice.R;
@@ -23,6 +24,7 @@ import com.owncloud.android.lib.resources.files.RemoteFile;
 public class OwnCloudProvider implements IDocumentProvider {
 
     private OwnCloudClient client;
+    private File cacheDir;
 
     // TODO: these must be configurable
     final private String serverUrl = "http://10.0.2.2/owncloud"; //emulator host machine
@@ -36,6 +38,13 @@ public class OwnCloudProvider implements IDocumentProvider {
         client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
                 userName, password));
 
+        // make sure cache directory exists, and clear it
+        // TODO: probably we should do smarter cache management
+        cacheDir = new File(context.getCacheDir(), "ownCloud");
+        if (cacheDir.exists()) {
+            deleteRecursive(cacheDir);
+        }
+        cacheDir.mkdirs();
     }
 
     @Override
@@ -73,4 +82,27 @@ public class OwnCloudProvider implements IDocumentProvider {
         return client;
     }
 
+    /**
+     * Used by OwnCloudFiles to get the cache directory they should download
+     * files to.
+     *
+     * @return cache directory.
+     */
+    protected File getCacheDir() {
+        return cacheDir;
+    }
+
+    /**
+     * Deletes files and recursively deletes directories.
+     *
+     * @param file
+     *            File or directory to be deleted.
+     */
+    private void deleteRecursive(File file) {
+        if (file.isDirectory()) {
+            for (File child : file.listFiles())
+                deleteRecursive(child);
+        }
+        file.delete();
+    }
 }
commit 62a86610d59e22ad553aa5c5136a65d5d67da244
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Wed Jan 21 13:05:41 2015 +0000

    Android: initial implementation of ownCloud provider.
    
    This implementation can connect to a local server and browser its
    contents, but cannot download and open the documents yet.
    
    TODO:
    
    * Download and open documents.
    * UI to configure server, user and password.
    * Implement filtering to show only the documents of the desired type.
    * Improve error handling.
    
    Change-Id: I54a2e2e1d3e8ec8d824d75639e176ca452551f3e

diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in
index 244c6db..cc61db5 100644
--- a/android/experimental/LOAndroid3/AndroidManifest.xml.in
+++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in
@@ -9,6 +9,7 @@
     <uses-feature android:glEsVersion="0x00020000" android:required="true" />
     <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.INTERNET" />
 
     <application
         @ANDROID_DEBUGGABLE@
diff --git a/android/experimental/LOAndroid3/res/values/strings.xml b/android/experimental/LOAndroid3/res/values/strings.xml
index 5e5e80e..50cd31e 100644
--- a/android/experimental/LOAndroid3/res/values/strings.xml
+++ b/android/experimental/LOAndroid3/res/values/strings.xml
@@ -34,5 +34,6 @@
     <!-- Document provider names -->
     <string name="local_documents">Local documents</string>
     <string name="local_file_system">Local file system</string>
+    <string name="owncloud">ownCloud</string>
 
 </resources>
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
index 9aa1973..3d462e6 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/DocumentProviderFactory.java
@@ -11,6 +11,7 @@ package org.libreoffice.storage;
 
 import org.libreoffice.storage.local.LocalDocumentsDirectoryProvider;
 import org.libreoffice.storage.local.LocalDocumentsProvider;
+import org.libreoffice.storage.owncloud.OwnCloudProvider;
 
 import android.content.Context;
 
@@ -30,8 +31,7 @@ public final class DocumentProviderFactory {
      */
     private static DocumentProviderFactory instance = null;
 
-    private IDocumentProvider[] providers = {
-            new LocalDocumentsDirectoryProvider(), new LocalDocumentsProvider() };
+    private IDocumentProvider[] providers;
 
     private String[] providerNames;
 
@@ -52,6 +52,12 @@ public final class DocumentProviderFactory {
             instance = new DocumentProviderFactory();
 
             // initialize document providers list
+            instance.providers = new IDocumentProvider[3];
+            instance.providers[0] = new LocalDocumentsDirectoryProvider();
+            instance.providers[1] = new LocalDocumentsProvider();
+            instance.providers[2] = new OwnCloudProvider(context);
+
+            // initialize document provider names list
             instance.providerNames = new String[instance.providers.length];
             for (int i = 0; i < instance.providers.length; i++) {
                 instance.providerNames[i] = context.getString(instance
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
new file mode 100644
index 0000000..8e6d6cf
--- /dev/null
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
@@ -0,0 +1,113 @@
+package org.libreoffice.storage.owncloud;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.libreoffice.storage.IFile;
+
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
+import com.owncloud.android.lib.resources.files.RemoteFile;
+
+/**
+ * Implementation of IFile for ownCloud servers.
+ */
+public class OwnCloudFile implements IFile {
+
+    private OwnCloudProvider provider;
+    private RemoteFile file;
+
+    private String name;
+    private String parentPath;
+
+    protected OwnCloudFile(OwnCloudProvider provider, RemoteFile file) {
+        this.provider = provider;
+        this.file = file;
+
+        // get name and parent from path
+        File localFile = new File(file.getRemotePath());
+        this.name = localFile.getName();
+        this.parentPath = localFile.getParent();
+    }
+
+    @Override
+    public URI getUri() {
+        return URI.create(file.getRemotePath());
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public boolean isDirectory() {
+        return file.getMimeType().equals("DIR");
+    }
+
+    @Override
+    public long getSize() {
+        return file.getLength();
+    }
+
+    @Override
+    public Date getLastModified() {
+        return new Date(file.getModifiedTimestamp());
+    }
+
+    @Override
+    public List<IFile> listFiles() {
+        List<IFile> children = new ArrayList<IFile>();
+        if (isDirectory()) {
+            ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(
+                    file.getRemotePath());
+            RemoteOperationResult result = refreshOperation.execute(provider
+                    .getClient());
+            if (!result.isSuccess()) {
+                throw new RuntimeException(result.getLogMessage(),
+                        result.getException());
+            }
+            for (Object obj : result.getData()) {
+                RemoteFile child = (RemoteFile) obj;
+                if (!child.getRemotePath().equals(file.getRemotePath()))
+                    children.add(new OwnCloudFile(provider, child));
+            }
+        }
+        return children;
+    }
+
+    @Override
+    public List<IFile> listFiles(FileFilter filter) {
+        // TODO no filtering yet
+        return listFiles();
+    }
+
+    @Override
+    public IFile getParent() {
+        if (parentPath == null)
+            // this is the root node
+            return null;
+
+        return provider.createFromUri(URI.create(parentPath));
+    }
+
+    @Override
+    public File getDocument() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object)
+            return true;
+        if (!(object instanceof OwnCloudFile))
+            return false;
+        OwnCloudFile file = (OwnCloudFile) object;
+        return file.getUri().equals(getUri());
+    }
+}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
new file mode 100644
index 0000000..7bd78e3
--- /dev/null
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
@@ -0,0 +1,76 @@
+package org.libreoffice.storage.owncloud;
+
+import java.net.URI;
+
+import org.libreoffice.R;
+import org.libreoffice.storage.IDocumentProvider;
+import org.libreoffice.storage.IFile;
+
+import android.content.Context;
+import android.net.Uri;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.OwnCloudClientFactory;
+import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
+import com.owncloud.android.lib.resources.files.RemoteFile;
+
+/**
+ * Implementation of IDocumentProvider for ownCloud servers.
+ */
+public class OwnCloudProvider implements IDocumentProvider {
+
+    private OwnCloudClient client;
+
+    // TODO: these must be configurable
+    final private String serverUrl = "http://10.0.2.2/owncloud"; //emulator host machine
+    final private String userName = "admin";
+    final private String password = "admin";
+
+    public OwnCloudProvider(Context context) {
+        Uri serverUri = Uri.parse(serverUrl);
+        client = OwnCloudClientFactory.createOwnCloudClient(serverUri,
+                context, true);
+        client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
+                userName, password));
+
+    }
+
+    @Override
+    public IFile getRootDirectory() {
+        return createFromUri(URI.create(FileUtils.PATH_SEPARATOR));
+    }
+
+    @Override
+    public IFile createFromUri(URI uri) {
+        ReadRemoteFileOperation refreshOperation = new ReadRemoteFileOperation(
+                uri.getPath());
+        RemoteOperationResult result = refreshOperation.execute(client);
+        if (!result.isSuccess()) {
+            throw new RuntimeException(result.getLogMessage(),
+                    result.getException());
+        }
+        if (result.getData().size() > 0) {
+            return new OwnCloudFile(this, (RemoteFile) result.getData().get(0));
+        }
+        return null;
+    }
+
+    @Override
+    public int getNameResource() {
+        return R.string.owncloud;
+    }
+
+    /**
+     * Used by OwnCloudFiles to get a configured client to run their own
+     * operations.
+     *
+     * @return configured OwnCloudClient.
+     */
+    protected OwnCloudClient getClient() {
+        return client;
+    }
+
+}
commit 6e0b1e624a8722e4fce6720395774815f0b18cf3
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon Feb 2 19:49:37 2015 +0000

    Android: add ownCloud library to the build.
    
    Library code from https://github.com/owncloud/android-library
    
    This patch downloads, builds and installs the library from a tarball
    uploaded to http://dev-www.libreoffice.org/src/.
    
    WARNING: this patch should *not* be merged to master. The tarball
    contains some binary .jar files and that is not acceptable.
    
    Change-Id: I28afaea4dabe2dab869b53b1881f4d5a6522943f

diff --git a/Makefile.fetch b/Makefile.fetch
index 7aee66a..390d3d0 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -189,6 +189,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \
 		$(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \
 		$(call fetch_Optional,ORCUS,ORCUS_TARBALL) \
+		$(call fetch_Optional,OWNCLOUD_ANDROID_LIB,OWNCLOUD_ANDROID_LIB_TARBALL) \
 		$(call fetch_Optional,PAGEMAKER,PAGEMAKER_TARBALL) \
 		$(call fetch_Optional,POPPLER,POPPLER_TARBALL) \
 		$(call fetch_Optional,POSTGRESQL,POSTGRESQL_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9789959..cba2e63 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4018,4 +4018,20 @@ endef
 
 endif
 
+ifeq (OWNCLOUD_ANDROID_LIB,$(filter OWNCLOUD_ANDROID_LIB,$(BUILD_TYPE)))
+
+$(eval $(call gb_Helper_register_jars,OXT,\
+	owncloud-android-library \
+))
+
+define gb_Jar__use_owncloud_android_lib
+$(call gb_Jar_use_external_project,$(1),owncloud-android-lib)
+$(call gb_Jar_use_external_jar,$(1),$(call gb_UnpackedTarball_get_dir,owncloud-android-lib)/bin/owncloud-android-library.jar)
+endef
+define gb_ExternalProject__use_owncloud_android_lib
+$(call gb_ExternalProject_use_external_project,$(1),owncloud_android_lib)
+endef
+
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/android/experimental/LOAndroid3/Makefile b/android/experimental/LOAndroid3/Makefile
index c5c18c7..20674bb 100644
--- a/android/experimental/LOAndroid3/Makefile
+++ b/android/experimental/LOAndroid3/Makefile
@@ -33,6 +33,13 @@ build-ant: android_version_setup copy-stuff link-so properties
 	for F in unoil; do \
 	    $(call COPYJAR,$(INSTDIR)/$(LIBO_SHARE_JAVA_FOLDER)/$${F}.jar); \
 	done
+	#ownCloud lib dependencies
+	$(call COPYJAR,$(WORKDIR)/UnpackedTarball/owncloud_android_lib/bin/owncloud-android-library.jar)
+	for F in commons-httpclient-3.1 \
+		 jackrabbit-webdav-2.7.2 \
+		 slf4j-api-1.7.5; do \
+	    $(call COPYJAR,$(WORKDIR)/UnpackedTarball/owncloud_android_lib/libs/$${F}.jar); \
+	done
 #
 	unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) $(if $(ENABLE_RELEASE_BUILD),release,debug)
 
diff --git a/configure.ac b/configure.ac
index d4594e8..5416d70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -498,6 +498,9 @@ if test -n "$with_android_ndk"; then
             ;;
         esac
     fi
+
+    # remember to download the ownCloud Android library later
+    BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
 fi
 AC_SUBST(ANDROID_NDK_GDBSERVER)
 AC_SUBST(ANDROID_APP_ABI)
diff --git a/download.lst b/download.lst
index ef1af63..b94203c 100644
--- a/download.lst
+++ b/download.lst
@@ -118,6 +118,8 @@ export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
 export OPENSSL_MD5SUM := f7175c9cd3c39bb1907ac8bba9df8ed3
 export OPENSSL_TARBALL := openssl-1.0.1j.tar.gz
 export ORCUS_TARBALL := 7681383be6ce489d84c1c74f4e7f9643-liborcus-0.7.0.tar.bz2
+export OWNCLOUD_ANDROID_LIB_MD5SUM := 2ee09f67d3ea1a137c8d3e6ed60fed22
+export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4.tar.gz
 export PAGEMAKER_MD5SUM := 795cc7a59ace4db2b12586971d668671
 export PAGEMAKER_TARBALL := libpagemaker-0.0.2.tar.bz2
 export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 6d38fd5..8b4fb6c 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,OPENLDAP,openldap) \
 	$(call gb_Helper_optional,OPENSSL,openssl) \
 	$(call gb_Helper_optional,ORCUS,liborcus) \
+	$(call gb_Helper_optional,OWNCLOUD_ANDROID_LIB,owncloud-android-lib) \
 	$(call gb_Helper_optional,PAGEMAKER,libpagemaker) \
 	$(call gb_Helper_optional,POPPLER,poppler) \
 	$(call gb_Helper_optional,POSTGRESQL,postgresql) \
diff --git a/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk b/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk
new file mode 100644
index 0000000..21081c4
--- /dev/null
+++ b/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk
@@ -0,0 +1,24 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,owncloud_android_lib))
+
+$(eval $(call gb_ExternalProject_register_targets,owncloud_android_lib,\
+	build \
+))
+
+$(call gb_ExternalProject_get_state_target,owncloud_android_lib,build) :
+	$(call gb_ExternalProject_run,build,\
+	$(ICECREAM_RUN) "$(ANT)" \
+		-q \
+		-f build.xml \
+		release \
+	)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/owncloud-android-lib/Makefile b/external/owncloud-android-lib/Makefile
new file mode 100644
index 0000000..e4968cf
--- /dev/null
+++ b/external/owncloud-android-lib/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/owncloud-android-lib/Module_owncloud-android-lib.mk b/external/owncloud-android-lib/Module_owncloud-android-lib.mk
new file mode 100644
index 0000000..486ed40
--- /dev/null
+++ b/external/owncloud-android-lib/Module_owncloud-android-lib.mk
@@ -0,0 +1,17 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Module_Module,owncloud_android_lib))
+
+$(eval $(call gb_Module_add_targets,owncloud_android_lib, \
+	ExternalProject_owncloud_android_lib \
+	UnpackedTarball_owncloud_android_lib \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/owncloud-android-lib/README b/external/owncloud-android-lib/README
new file mode 100644
index 0000000..6435c9b
--- /dev/null
+++ b/external/owncloud-android-lib/README
@@ -0,0 +1,4 @@
+Library required to access ownCloud servers from Android.
+
+Code from https://github.com/owncloud/android-library, our tarball is the 0.9.4
+release sans the test and example projects.
diff --git a/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk b/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk
new file mode 100644
index 0000000..0866f6f
--- /dev/null
+++ b/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,owncloud_android_lib))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,owncloud_android_lib,$(OWNCLOUD_ANDROID_LIB_TARBALL)))
+
+# vim: set noet sw=4 ts=4:
commit 0f808374af3c71f45b60af3e4040c8e5f12955ac
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Feb 10 18:46:54 2015 +0100

    Android: get the file to share in a different thread.
    
    Share feature for cloud files will probably not work properly as it
    is, but with this patch we prevent a crash at least.
    
    Change-Id: I95176e9e855a37adf1d3c46edceb0dc6067d9884

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 065887a..9435c092 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -360,15 +360,42 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
     }
 
     private void share(int position) {
-        File file = filePaths.get(position).getDocument();
-        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
-        Uri uri = Uri.fromFile(file);
-        sharingIntent.setType(FileUtilities.getMimeType(file.getName()));
-        sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM, uri);
-        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
-                file.getName());
-        startActivity(Intent.createChooser(sharingIntent,
-                getString(R.string.share_via)));
+
+        new AsyncTask<IFile, Void, File>() {
+            @Override
+            protected File doInBackground(IFile... document) {
+                // this operation may imply network access and must be run in
+                // a different thread
+                try {
+                    return document[0].getDocument();
+                } catch (final RuntimeException e) {
+                    final Activity activity = LibreOfficeUIActivity.this;
+                    activity.runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            Toast.makeText(activity, e.getMessage(),
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+                    Log.e(tag, e.getMessage(), e.getCause());
+                    return null;
+                }
+            }
+
+            @Override
+            protected void onPostExecute(File file) {
+                if (file != null) {
+                    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
+                    Uri uri = Uri.fromFile(file);
+                    sharingIntent.setType(FileUtilities.getMimeType(file.getName()));
+                    sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM, uri);
+                    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
+                            file.getName());
+                    startActivity(Intent.createChooser(sharingIntent,
+                            getString(R.string.share_via)));
+                }
+            }
+        }.execute(filePaths.get(position));
     }
 
     @Override
commit 9e8fa856918e018f8bde4067fdbdbb37e2eaa288
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Feb 10 16:17:12 2015 +0000

    Android: improve error handling for document providers.
    
    Now some operations in document providers may throw a RuntimeException
    in case of error. The main activity is ready to catch them and show an
    error message.
    
    Change-Id: Iad7249dbdc06b2a0890d5435ad65284b728e9707

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IDocumentProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IDocumentProvider.java
index 191a143..bbfdecd 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IDocumentProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IDocumentProvider.java
@@ -21,6 +21,7 @@ public interface IDocumentProvider {
      * Provides the content root element for the Document Provider.
      *
      * @return Content root element.
+     * @throws RuntimeException in case of error.
      */
     IFile getRootDirectory();
 
@@ -31,6 +32,7 @@ public interface IDocumentProvider {
      *            URI pointing to some content object that has been previously
      *            retrieved with IFile.getUri().
      * @return IFile object pointing to the content represented by uri.
+     * @throws RuntimeException in case of error.
      */
     IFile createFromUri(URI uri);
 
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IFile.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IFile.java
index 5b71c09..8effd0f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IFile.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/storage/IFile.java
@@ -71,6 +71,7 @@ public interface IFile {
      *
      * @return list of files contained by this directory, or an empty list if
      *         this is not a directory.
+     * @throws RuntimeException in case of error.
      */
     List<IFile> listFiles();
 
@@ -82,6 +83,7 @@ public interface IFile {
      *            the filter to match names against.
      * @return filtered list of files contained by this directory, or an empty
      *         list if this is not a directory.
+     * @throws RuntimeException in case of error.
      */
     List<IFile> listFiles(FileFilter filter);
 
@@ -97,6 +99,7 @@ public interface IFile {
      * for a directory is not defined.
      *
      * @return local file containing the document wrapped by this object.
+     * @throws RuntimeException in case of error.
      */
     File getDocument();
 }
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 24cff82..065887a 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -64,6 +64,7 @@ import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.SpinnerAdapter;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -232,11 +233,24 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
                 // switch document provider:
                 // these operations may imply network access and must be run in
                 // a different thread
-                documentProvider = provider[0];
-                homeDirectory = documentProvider.getRootDirectory();
-                currentDirectory = homeDirectory;
-                filePaths = currentDirectory.listFiles(FileUtilities
-                        .getFileFilter(filterMode));
+                try {
+                    documentProvider = provider[0];
+                    homeDirectory = documentProvider.getRootDirectory();
+                    currentDirectory = homeDirectory;
+                    filePaths = currentDirectory.listFiles(FileUtilities
+                            .getFileFilter(filterMode));
+                }
+                catch (final RuntimeException e) {
+                    final Activity activity = LibreOfficeUIActivity.this;
+                    activity.runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            Toast.makeText(activity, e.getMessage(),
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+                    Log.e(tag, e.getMessage(), e.getCause());
+                }
                 return null;
             }
 
@@ -258,8 +272,21 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
                 // this operation may imply network access and must be run in
                 // a different thread
                 currentDirectory = dir[0];
-                filePaths = currentDirectory.listFiles(FileUtilities
-                        .getFileFilter(filterMode));
+                try {
+                    filePaths = currentDirectory.listFiles(FileUtilities
+                            .getFileFilter(filterMode));
+                }
+                catch (final RuntimeException e) {
+                    final Activity activity = LibreOfficeUIActivity.this;
+                    activity.runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            Toast.makeText(activity, e.getMessage(),
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+                    Log.e(tag, e.getMessage(), e.getCause());
+                }
                 return null;
             }
 
@@ -276,17 +303,33 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
             protected File doInBackground(IFile... document) {
                 // this operation may imply network access and must be run in
                 // a different thread
-                return document[0].getDocument();
+                try {
+                    return document[0].getDocument();
+                }
+                catch (final RuntimeException e) {
+                    final Activity activity = LibreOfficeUIActivity.this;
+                    activity.runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            Toast.makeText(activity, e.getMessage(),
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+                    Log.e(tag, e.getMessage(), e.getCause());
+                    return null;
+                }
             }
 
             @Override
             protected void onPostExecute(File file) {
-                Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
-                String packageName = getApplicationContext().getPackageName();
-                ComponentName componentName = new ComponentName(packageName,
-                        LibreOfficeMainActivity.class.getName());
-                i.setComponent(componentName);
-                startActivity(i);
+                if (file != null) {
+                    Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
+                    String packageName = getApplicationContext().getPackageName();
+                    ComponentName componentName = new ComponentName(packageName,
+                            LibreOfficeMainActivity.class.getName());
+                    i.setComponent(componentName);
+                    startActivity(i);
+                }
             }
         }.execute(document);
     }
commit 8c5e87852965715389d0bed87eefc663a149f052
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Feb 12 20:24:16 2015 +0100

    git hooks: reject suspicious fdo references
    
    Change-Id: If2302adb662bd2b0d32bacdf9cdc3c0278b86de8

diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg
index e3dfe69..37ddd1c 100755
--- a/.git-hooks/commit-msg
+++ b/.git-hooks/commit-msg
@@ -45,6 +45,13 @@ if [ "`head -n 1 $1 | wc -c`" -gt 79 ] ; then
     abort "$1" "The first line is too long, please try to fit into 79 characters."
 fi
 
+fdo_regex='fdo#[0-9]+'
+if egrep -q "$fdo_regex" $1; then
+    if [ "`head -n 1 $1 |egrep -o "$fdo_regex" |sed 's/fdo#//'`" -gt 88775 ]; then
+        abort "$1" "The first line contains a suspicious fdo# rereference, did you mean tdf#?"
+    fi
+fi
+
 # ...and that it does not continue on the second line
 if [ "`wc -l < $1`" -gt 1 -a -n "`head -n 2 $1 | tail -n 1 | sed 's/^#.*//'`" ] ; then
     abort "$1" "The second line is not empty - maybe the first line continues there?"
commit 5d388443b9809e73202ce551bcffa10d442094ca
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Feb 12 20:04:52 2015 +0100

    Blind attempt to fix the Windows build.
    
    Change-Id: Iac7b066e3af311f71bbcff7ac418fd3b5e94dff2

diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx
index a45dc90..ac7e239 100644
--- a/chart2/source/tools/CachedDataSequence.cxx
+++ b/chart2/source/tools/CachedDataSequence.cxx
@@ -398,7 +398,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_chart_CachedDataSequence_get_implementation(css::uno::XComponentContext *context,
         css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(new chart::CachedDataSequence(context));
+    return cppu::acquire(new ::chart::CachedDataSequence(context));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 944886f6d96843ca4f5833ecca48a693c81abc3b
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Thu Jan 15 10:35:32 2015 +0100

    fdo#87534 fix HYPERLINK behaviour when used in names
    
    When using HYPERLINK() in names, the hyperlink was set to disabled
    on copying token. After fix, behaviour is consistent.
    
    Note: reducing the fix to 1 line does not work, a set hyperlink
    is only to be copied when applicable.
    
    Change-Id: I27ad24ed8912afa548f08d249ad51d18a792c275
    Reviewed-on: https://gerrit.libreoffice.org/13920
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index acfdc09..07955f6 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1704,6 +1704,8 @@ void FormulaCompiler::PopTokenArray()
         else if ( !pArr->IsRecalcModeNormal() && p->pArr->IsRecalcModeNormal() )
             p->pArr->SetMaskedRecalcMode( pArr->GetRecalcMode() );
         p->pArr->SetCombinedBitsRecalcMode( pArr->GetRecalcMode() );
+        if ( pArr->IsHyperLink() )  // fdo 87534
+            p->pArr->SetHyperLink( true );
         if( p->bTemp )
             delete pArr;
         pArr = p->pArr;
commit c6b40488c07149a2fcc8023dce4e9efb9e2fdf89
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 12 17:35:17 2015 +0000

    Resolves: tdf#87663 update checker tries to add icon to toc preview toolbar
    
    i.e. CRASH when attempting to add ToC to document if the updatechecker fires
    while this dialog is activating/active because the preview has hidden menubars
    which have no associated window
    
    Change-Id: I45a254dba647910d7743f6d8173c2547dd82c791

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index d08c48a..5de3bb6 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2407,13 +2407,13 @@ void Menu::HighlightItem( sal_uInt16 nItemPos )
 }
 
 // - MenuBar -
-
 IMenuBarWindow* MenuBar::getMenuBarWindow()
 {
     // so far just a dynamic_cast, hopefully to be turned into something saner
     // at some stage
     IMenuBarWindow *pWin = dynamic_cast<IMenuBarWindow*>(pWindow);
-    assert(pWin);
+    //either there is no window (fdo#87663) or it is an IMenuBarWindow
+    assert(!pWindow || pWin);
     return pWin;
 }
 
@@ -2445,15 +2445,19 @@ MenuBar::~MenuBar()
 
 void MenuBar::ClosePopup(Menu *pMenu)
 {
-    getMenuBarWindow()->PopupClosed(pMenu);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    if (!pMenuWin)
+        return;
+    pMenuWin->PopupClosed(pMenu);
 }
 
 sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
 {
-    nFocusId = getMenuBarWindow()->GetFocusId();
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    nFocusId = pMenuWin ? pMenuWin->GetFocusId() : 0;
     if (nFocusId)
     {
-        getMenuBarWindow()->SetFocusId(0);
+        pMenuWin->SetFocusId(0);
         ImplGetSVData()->maWinData.mbNoDeactivate = false;
     }
 
@@ -2479,7 +2483,9 @@ void MenuBar::ShowButtons( bool bClose, bool bFloat, bool bHide )
         mbCloseBtnVisible = bClose;
         mbFloatBtnVisible = bFloat;
         mbHideBtnVisible = bHide;
-        getMenuBarWindow()->ShowButtons(bClose, bFloat, bHide);
+        IMenuBarWindow* pMenuWin = getMenuBarWindow();
+        if (pMenuWin)
+            pMenuWin->ShowButtons(bClose, bFloat, bHide);
     }
 }
 
@@ -2488,7 +2494,9 @@ void MenuBar::SetDisplayable( bool bDisplayable )
     if( bDisplayable != mbDisplayable )
     {
         mbDisplayable = bDisplayable;
-        getMenuBarWindow()->LayoutChanged();
+        IMenuBarWindow* pMenuWin = getMenuBarWindow();
+        if (pMenuWin)
+            pMenuWin->LayoutChanged();
     }
 }
 
@@ -2521,7 +2529,9 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete )
     vcl::Window *pWindow = pMenu->ImplGetWindow();
     if (pWindow && bDelete)
     {
-        pMenu->getMenuBarWindow()->KillActivePopup();
+        IMenuBarWindow* pMenuWin = pMenu->getMenuBarWindow();
+        if (pMenuWin)
+            pMenuWin->KillActivePopup();
         delete pWindow;
     }
     pMenu->pWindow = NULL;
@@ -2538,29 +2548,34 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
 
     // check for enabled, if this method is called from another window...
     vcl::Window* pWin = ImplGetWindow();
-    if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled()  && ! pWin->IsInModalMode() )
-        bDone = getMenuBarWindow()->HandleKeyEvent( rKEvent, bFromMenu );
+    if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled()  && !pWin->IsInModalMode())
+    {
+        IMenuBarWindow* pMenuWin = getMenuBarWindow();
+        bDone = pMenuWin ? pMenuWin->HandleKeyEvent(rKEvent, bFromMenu) : false;
+    }
     return bDone;
 }
 
 void MenuBar::SelectItem(sal_uInt16 nId)
 {
-    IMenuBarWindow* pMenuWin = getMenuBarWindow();
-
     if (pWindow)
     {
         pWindow->GrabFocus();
         nId = GetItemPos( nId );
 
-        // #99705# popup the selected menu
-        pMenuWin->SetAutoPopup( true );
-        if (ITEMPOS_INVALID != pMenuWin->GetHighlightedItem())
+        IMenuBarWindow* pMenuWin = getMenuBarWindow();
+        if (pMenuWin)
         {
-            pMenuWin->KillActivePopup();
-            pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, false );
+            // #99705# popup the selected menu
+            pMenuWin->SetAutoPopup( true );
+            if (ITEMPOS_INVALID != pMenuWin->GetHighlightedItem())
+            {
+                pMenuWin->KillActivePopup();
+                pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, false );
+            }
+            if (nId != ITEMPOS_INVALID)
+                pMenuWin->ChangeHighlightItem( nId, false );
         }
-        if (nId != ITEMPOS_INVALID)
-            pMenuWin->ChangeHighlightItem( nId, false );
     }
 }
 
@@ -2638,27 +2653,36 @@ bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId )
 
 sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const OUString& i_rToolTip, sal_uInt16 i_nPos )
 {
-    return getMenuBarWindow()->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip, i_nPos);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip, i_nPos) : 0;
 }
 
 void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& rLink )
 {
-    getMenuBarWindow()->SetMenuBarButtonHighlightHdl(nId, rLink);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    if (!pMenuWin)
+        return;
+    pMenuWin->SetMenuBarButtonHighlightHdl(nId, rLink);
 }
 
 Rectangle MenuBar::GetMenuBarButtonRectPixel( sal_uInt16 nId )
 {
-    return getMenuBarWindow()->GetMenuBarButtonRectPixel(nId);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    return pMenuWin ? pMenuWin->GetMenuBarButtonRectPixel(nId) : Rectangle();
 }
 
 void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
 {
-    getMenuBarWindow()->RemoveMenuBarButton(nId);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    if (!pMenuWin)
+        return;
+    pMenuWin->RemoveMenuBarButton(nId);
 }
 
 bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId )
 {
-    return getMenuBarWindow()->HandleMenuButtonEvent(i_nButtonId);
+    IMenuBarWindow* pMenuWin = getMenuBarWindow();
+    return pMenuWin ? pMenuWin->HandleMenuButtonEvent(i_nButtonId) : false;
 }
 
 // bool PopupMenu::bAnyPopupInExecute = false;
commit 917bd2350cfb0e697595cdb7bd61fdfd00b9faa3
Author: Ursache Vladimir <ursache at collabora.co.uk>
Date:   Thu Feb 12 03:47:36 2015 +0200

    Use constructors for services from chartcore.component.
    
    Change-Id: I72227b45f305734060a669275044f6f9c8859bc5

diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 3440653..c65f262 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -138,7 +138,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
     chart2/source/model/main/Legend \
     chart2/source/model/main/PageBackground \
     chart2/source/model/main/PolarCoordinateSystem \
-    chart2/source/model/main/_serviceregistration_model \
     chart2/source/model/main/StockBar \
     chart2/source/model/main/Title \
     chart2/source/model/main/UndoManager \
@@ -169,7 +168,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
     chart2/source/model/template/PieChartTypeTemplate \
     chart2/source/model/template/ScatterChartType \
     chart2/source/model/template/ScatterChartTypeTemplate \
-    chart2/source/model/template/_serviceregistration_charttypes \
     chart2/source/model/template/StockChartTypeTemplate \
     chart2/source/model/template/StockDataInterpreter \
     chart2/source/model/template/XYDataInterpreter \
@@ -232,7 +230,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
     chart2/source/tools/ResourceManager \
     chart2/source/tools/Scaling \
     chart2/source/tools/SceneProperties \
-    chart2/source/tools/_serviceregistration_tools \
     chart2/source/tools/StatisticsHelper \
     chart2/source/tools/ThreeDHelper \
     chart2/source/tools/TitleHelper \
diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component
index 4029670..726274a 100644
--- a/chart2/source/chartcore.component
+++ b/chart2/source/chartcore.component
@@ -18,166 +18,205 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="chartcore" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.chart2.ExponentialScaling">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.chart2.ExponentialScaling"
+    constructor="com_sun_star_chart2_ExponentialScaling_get_implementation">
     <service name="com.sun.star.chart2.ExponentialScaling"/>
   </implementation>
-  <implementation name="com.sun.star.chart2.LinearScaling">
+  <implementation name="com.sun.star.chart2.LinearScaling"
+    constructor="com_sun_star_chart2_LinearScaling_get_implementation">
     <service name="com.sun.star.chart2.LinearScaling"/>
   </implementation>
-  <implementation name="com.sun.star.chart2.LogarithmicScaling">
+  <implementation name="com.sun.star.chart2.LogarithmicScaling"
+    constructor="com_sun_star_chart2_LogarithmicScaling_get_implementation">
     <service name="com.sun.star.chart2.LogarithmicScaling"/>
   </implementation>
-  <implementation name="com.sun.star.chart2.PowerScaling">
+  <implementation name="com.sun.star.chart2.PowerScaling"
+    constructor="com_sun_star_chart2_PowerScaling_get_implementation">
     <service name="com.sun.star.chart2.PowerScaling"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.CachedDataSequence">
+  <implementation name="com.sun.star.comp.chart.CachedDataSequence"
+    constructor="com_sun_star_comp_chart_CachedDataSequence_get_implementation">
     <service name="com.sun.star.chart2.data.DataSequence"/>
     <service name="com.sun.star.chart2.data.NumericalDataSequence"/>
     <service name="com.sun.star.chart2.data.TextualDataSequence"/>
     <service name="com.sun.star.comp.chart.CachedDataSequence"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.DataSource">
+  <implementation name="com.sun.star.comp.chart.DataSource"
+    constructor="com_sun_star_comp_chart_DataSource_get_implementation">
     <service name="com.sun.star.chart2.data.DataSource"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.InternalDataProvider">
+  <implementation name="com.sun.star.comp.chart.InternalDataProvider"
+    constructor="com_sun_star_comp_chart_InternalDataProvider_get_implementation">
     <service name="com.sun.star.chart2.data.DataProvider"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.ConfigDefaultColorScheme">
+  <implementation name="com.sun.star.comp.chart2.ConfigDefaultColorScheme"
+    constructor="com_sun_star_comp_chart2_ConfigDefaultColorScheme_get_implementation">
     <service name="com.sun.star.chart2.ColorScheme"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.ErrorBar">
+  <implementation name="com.sun.star.comp.chart2.ErrorBar"
+    constructor="com_sun_star_comp_chart2_ErrorBar_get_implementation">
     <service name="com.sun.star.chart2.ErrorBar"/>
     <service name="com.sun.star.comp.chart2.ErrorBar"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.ExponentialRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.ExponentialRegressionCurve"
+    constructor="com_sun_star_comp_chart2_ExponentialRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.ExponentialRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.LabeledDataSequence">
+  <implementation name="com.sun.star.comp.chart2.LabeledDataSequence"
+    constructor="com_sun_star_comp_chart2_LabeledDataSequence_get_implementation">
     <service name="com.sun.star.chart2.data.LabeledDataSequence"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.LinearRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.LinearRegressionCurve"
+    constructor="com_sun_star_comp_chart2_LinearRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.LinearRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.LogarithmicRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.LogarithmicRegressionCurve"
+    constructor="com_sun_star_comp_chart2_LogarithmicRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.LogarithmicRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.MeanValueRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.MeanValueRegressionCurve"
+    constructor="com_sun_star_comp_chart2_MeanValueRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.MeanValueRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.PotentialRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.PotentialRegressionCurve"
+    constructor="com_sun_star_comp_chart2_PotentialRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.PotentialRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.PolynomialRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.PolynomialRegressionCurve"
+    constructor="com_sun_star_comp_chart2_PolynomialRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.PolynomialRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.MovingAverageRegressionCurve">
+  <implementation name="com.sun.star.comp.chart2.MovingAverageRegressionCurve"
+    constructor="com_sun_star_comp_chart2_MovingAverageRegressionCurve_get_implementation">
     <service name="com.sun.star.chart2.MovingAverageRegressionCurve"/>
     <service name="com.sun.star.chart2.RegressionCurve"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.RegressionEquation">
+  <implementation name="com.sun.star.comp.chart2.RegressionEquation"
+    constructor="com_sun_star_comp_chart2_RegressionEquation_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.RegressionEquation"/>
     <service name="com.sun.star.drawing.FillProperties"/>
     <service name="com.sun.star.drawing.LineProperties"/>
     <service name="com.sun.star.style.CharacterProperties"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.AreaChartType">
+  <implementation name="com.sun.star.comp.chart.AreaChartType"
+    constructor="com_sun_star_comp_chart_AreaChartType_get_implementation">
     <service name="com.sun.star.chart2.AreaChartType"/>
     <service name="com.sun.star.chart2.ChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.BarChartType">
+  <implementation name="com.sun.star.comp.chart.BarChartType"
+    constructor="com_sun_star_comp_chart_BarChartType_get_implementation">
     <service name="com.sun.star.chart2.BarChartType"/>
     <service name="com.sun.star.chart2.ChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.BubbleChartType">
+  <implementation name="com.sun.star.comp.chart.BubbleChartType"
+    constructor="com_sun_star_comp_chart_BubbleChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.BubbleChartType"/>
     <service name="com.sun.star.chart2.ChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.GL3DBarChartType">
+  <implementation name="com.sun.star.comp.chart.GL3DBarChartType"
+    constructor="com_sun_star_comp_chart_GL3DBarChartType_get_implementation">
     <service name="com.sun.star.chart2.GL3DBarChartType"/>
     <service name="com.sun.star.chart2.ChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.CandleStickChartType">
+  <implementation name="com.sun.star.comp.chart.CandleStickChartType"
+    constructor="com_sun_star_comp_chart_CandleStickChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.CandleStickChartType"/>
     <service name="com.sun.star.chart2.ChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.ChartTypeManager">
+  <implementation name="com.sun.star.comp.chart.ChartTypeManager"
+    constructor="com_sun_star_comp_chart_ChartTypeManager_get_implementation">
     <service name="com.sun.star.chart2.ChartTypeManager"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.ColumnChartType">
+  <implementation name="com.sun.star.comp.chart.ColumnChartType"
+    constructor="com_sun_star_comp_chart_ColumnChartType_get_implementation">
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.ColumnChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.DataSeries">
+  <implementation name="com.sun.star.comp.chart.DataSeries"
+    constructor="com_sun_star_comp_chart_DataSeries_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.DataPointProperties"/>
     <service name="com.sun.star.chart2.DataSeries"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.FilledNetChartType">
+  <implementation name="com.sun.star.comp.chart.FilledNetChartType"
+    constructor="com_sun_star_comp_chart_FilledNetChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.FilledNetChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.FormattedString">
+  <implementation name="com.sun.star.comp.chart.FormattedString"
+    constructor="com_sun_star_comp_chart_FormattedString_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.FormattedString"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.LineChartType">
+  <implementation name="com.sun.star.comp.chart.LineChartType"
+    constructor="com_sun_star_comp_chart_LineChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.LineChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.NetChartType">
+  <implementation name="com.sun.star.comp.chart.NetChartType"
+    constructor="com_sun_star_comp_chart_NetChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.NetChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.PieChartType">
+  <implementation name="com.sun.star.comp.chart.PieChartType"
+    constructor="com_sun_star_comp_chart_PieChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.PieChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart.ScatterChartType">
+  <implementation name="com.sun.star.comp.chart.ScatterChartType"
+    constructor="com_sun_star_comp_chart_ScatterChartType_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.ChartType"/>
     <service name="com.sun.star.chart2.ScatterChartType"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.Axis">
+  <implementation name="com.sun.star.comp.chart2.Axis"
+    constructor="com_sun_star_comp_chart2_Axis_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.Axis"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem2d">
+  <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem2d"
+    constructor="com_sun_star_comp_chart2_CartesianCoordinateSystem2d_get_implementation">
     <service name="com.sun.star.chart2.CartesianCoordinateSystem2d"/>
     <service name="com.sun.star.chart2.CoordinateSystems.Cartesian"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem3d">
+  <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem3d"
+    constructor="com_sun_star_comp_chart2_CartesianCoordinateSystem3d_get_implementation">
     <service name="com.sun.star.chart2.CartesianCoordinateSystem3d"/>
     <service name="com.sun.star.chart2.CoordinateSystems.Cartesian"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.ChartModel">
+  <implementation name="com.sun.star.comp.chart2.ChartModel"
+    constructor="com_sun_star_comp_chart2_ChartModel_get_implementation">
     <service name="com.sun.star.chart.ChartDocument"/>
     <service name="com.sun.star.chart2.ChartDocument"/>
     <service name="com.sun.star.document.OfficeDocument"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.Diagram">
+  <implementation name="com.sun.star.comp.chart2.Diagram"
+    constructor="com_sun_star_comp_chart2_Diagram_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.Diagram"/>
     <service name="com.sun.star.layout.LayoutElement"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.GridProperties">
+  <implementation name="com.sun.star.comp.chart2.GridProperties"
+    constructor="com_sun_star_comp_chart2_GridProperties_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.GridProperties"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.Legend">
+  <implementation name="com.sun.star.comp.chart2.Legend"
+    constructor="com_sun_star_comp_chart2_Legend_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.Legend"/>
     <service name="com.sun.star.drawing.FillProperties"/>
@@ -185,29 +224,35 @@
     <service name="com.sun.star.layout.LayoutElement"/>
     <service name="com.sun.star.style.CharacterProperties"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.PageBackground">
+  <implementation name="com.sun.star.comp.chart2.PageBackground"
+    constructor="com_sun_star_comp_chart2_PageBackground_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.PageBackground"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem2d">
+  <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem2d"
+    constructor="com_sun_star_comp_chart2_PolarCoordinateSystem2d_get_implementation">
     <service name="com.sun.star.chart2.CoordinateSystems.Polar"/>
     <service name="com.sun.star.chart2.PolarCoordinateSystem2d"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem3d">
+  <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem3d"
+    constructor="com_sun_star_comp_chart2_PolarCoordinateSystem3d_get_implementation">
     <service name="com.sun.star.chart2.CoordinateSystems.Polar"/>
     <service name="com.sun.star.chart2.PolarCoordinateSystem3d"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.Title">
+  <implementation name="com.sun.star.comp.chart2.Title"
+    constructor="com_sun_star_comp_chart2_Title_get_implementation">
     <service name="com.sun.star.beans.PropertySet"/>
     <service name="com.sun.star.chart2.Title"/>
     <service name="com.sun.star.layout.LayoutElement"/>
     <service name="com.sun.star.style.ParagraphProperties"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.XMLFilter">
+  <implementation name="com.sun.star.comp.chart2.XMLFilter"
+    constructor="com_sun_star_comp_chart2_XMLFilter_get_implementation">
     <service name="com.sun.star.document.ExportFilter"/>
     <service name="com.sun.star.document.ImportFilter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.chart2.report.XMLFilter">
+  <implementation name="com.sun.star.comp.chart2.report.XMLFilter"
+    constructor="com_sun_star_comp_chart2_XMLFilter_get_implementation">
     <service name="com.sun.star.document.ExportFilter"/>
     <service name="com.sun.star.document.ImportFilter"/>
   </implementation>
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index cd5dac4..cbce9a3 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -814,4 +814,11 @@ OUString XMLReportFilterHelper::getMediaType(bool )
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_XMLFilter_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::XMLFilter(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index 428e75a..663fd40 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -663,4 +663,11 @@ css::uno::Sequence< OUString > SAL_CALL Axis::getSupportedServiceNames()
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_Axis_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::Axis(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/CartesianCoordinateSystem.cxx b/chart2/source/model/main/CartesianCoordinateSystem.cxx
index 47b7b0c..5d44bf1 100644
--- a/chart2/source/model/main/CartesianCoordinateSystem.cxx
+++ b/chart2/source/model/main/CartesianCoordinateSystem.cxx
@@ -200,4 +200,18 @@ css::uno::Sequence< OUString > SAL_CALL CartesianCoordinateSystem3d::getSupporte
 
 }  // namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_CartesianCoordinateSystem2d_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::CartesianCoordinateSystem2d(context));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_CartesianCoordinateSystem3d_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::CartesianCoordinateSystem3d(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 4dddbdf..80b5494 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1461,4 +1461,11 @@ void ChartModel::update()
 
 }  // namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_ChartModel_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::ChartModel(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 393c279..3cf89fa 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -602,4 +602,11 @@ css::uno::Sequence< OUString > SAL_CALL DataSeries::getSupportedServiceNames()
 
 }  // namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart_DataSeries_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::DataSeries(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index a016570..a11cf12 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -771,4 +771,11 @@ css::uno::Sequence< OUString > SAL_CALL Diagram::getSupportedServiceNames()
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_Diagram_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::Diagram(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index 8ecfb02..e4d9c50 100644
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -266,4 +266,11 @@ css::uno::Sequence< OUString > SAL_CALL FormattedString::getSupportedServiceName
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart_FormattedString_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::FormattedString(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
index ce6a950..a5a0118 100644
--- a/chart2/source/model/main/GridProperties.cxx
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -275,4 +275,11 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridProperties, GridProperties_Base, ::propert
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_GridProperties_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::GridProperties(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index 164612e..37c457a 100644
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -333,4 +333,11 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( Legend, Legend_Base, ::property::OPropertySet
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_Legend_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::Legend(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
index e2c7661..0cd7544 100644
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -253,4 +253,11 @@ IMPLEMENT_FORWARD_XINTERFACE2( PageBackground, PageBackground_Base, ::property::
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_PageBackground_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::PageBackground(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/PolarCoordinateSystem.cxx b/chart2/source/model/main/PolarCoordinateSystem.cxx
index ca75de5..fe6e8c9 100644
--- a/chart2/source/model/main/PolarCoordinateSystem.cxx
+++ b/chart2/source/model/main/PolarCoordinateSystem.cxx
@@ -200,4 +200,18 @@ css::uno::Sequence< OUString > SAL_CALL PolarCoordinateSystem3d::getSupportedSer
 
 }  // namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_PolarCoordinateSystem2d_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::PolarCoordinateSystem2d(context));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_PolarCoordinateSystem3d_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::PolarCoordinateSystem3d(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
index 2a9b1ca..1111d93 100644
--- a/chart2/source/model/main/Title.cxx
+++ b/chart2/source/model/main/Title.cxx
@@ -406,4 +406,11 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( Title, Title_Base, ::property::OPropertySet )
 
 } //  namespace chart
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_chart2_Title_get_implementation(css::uno::XComponentContext *context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ::chart::Title(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/_serviceregistration_model.cxx b/chart2/source/model/main/_serviceregistration_model.cxx
deleted file mode 100644
index 0245532..0000000
--- a/chart2/source/model/main/_serviceregistration_model.cxx
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you 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 .
- */
-
-#include <cppuhelper/implementationentry.hxx>
-#include "ChartModel.hxx"
-
-#include "Diagram.hxx"
-#include "Legend.hxx"
-#include "Axis.hxx"
-#include "GridProperties.hxx"
-#include "Title.hxx"
-#include "FormattedString.hxx"
-#include "PageBackground.hxx"
-#include "DataSeries.hxx"
-#include "PolarCoordinateSystem.hxx"
-#include "CartesianCoordinateSystem.hxx"
-
-#include "ChartTypeManager.hxx"
-#include "XMLFilter.hxx"
-
-#include "_serviceregistration_charttypes.hxx"
-#include "charttoolsdllapi.hxx"
-
-static const struct ::cppu::ImplementationEntry g_entries_chart2_model[] =
-{
-    {
-          ::chart::ChartModel::create
-        , ::chart::ChartModel::getImplementationName_Static
-        , ::chart::ChartModel::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-    ,{
-          ::chart::Diagram::create
-        , ::chart::Diagram::getImplementationName_Static
-        , ::chart::Diagram::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-    ,{
-          ::chart::Legend::create
-        , ::chart::Legend::getImplementationName_Static
-        , ::chart::Legend::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-    ,{
-          ::chart::Axis::create
-        , ::chart::Axis::getImplementationName_Static
-        , ::chart::Axis::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-    ,{
-          ::chart::GridProperties::create
-        , ::chart::GridProperties::getImplementationName_Static
-        , ::chart::GridProperties::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-    ,{
-          ::chart::Title::create
-        , ::chart::Title::getImplementationName_Static
-        , ::chart::Title::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-
-    ,{
-          ::chart::FormattedString::create
-        , ::chart::FormattedString::getImplementationName_Static
-        , ::chart::FormattedString::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-
-    ,{
-          ::chart::ChartTypeManager::create
-        , ::chart::ChartTypeManager::getImplementationName_Static
-        , ::chart::ChartTypeManager::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-     ,{
-          ::chart::PageBackground::create
-        , ::chart::PageBackground::getImplementationName_Static
-        , ::chart::PageBackground::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }
-     ,{
-          ::chart::DataSeries::create
-        , ::chart::DataSeries::getImplementationName_Static
-        , ::chart::DataSeries::getSupportedServiceNames_Static
-        , ::cppu::createSingleComponentFactory
-        , 0
-        , 0
-    }

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list