[Libreoffice-commits] core.git: android/Bootstrap android/source desktop/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Wed Mar 14 14:25:44 UTC 2018


 android/Bootstrap/src/org/libreoffice/kit/Document.java          |   15 --
 android/source/res/drawable/ic_content_copy_black_24dp.xml       |    9 -
 android/source/res/drawable/ic_content_cut_black_24dp.xml        |    9 -
 android/source/res/drawable/ic_content_paste_black_24dp.xml      |    9 -
 android/source/res/menu/main.xml                                 |   29 ----
 android/source/res/values/strings.xml                            |    7 -
 android/source/src/java/org/libreoffice/InvalidationHandler.java |    3 
 android/source/src/java/org/libreoffice/LOKitTileProvider.java   |   21 ---
 android/source/src/java/org/libreoffice/TileProvider.java        |   13 -
 android/source/src/java/org/libreoffice/ToolbarController.java   |   70 ----------
 desktop/source/lib/lokandroid.cxx                                |   17 --
 11 files changed, 202 deletions(-)

New commits:
commit b203e78a69acf5d84cc245ce7232ffee4a6edcd4
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Wed Mar 14 15:24:14 2018 +0100

    Revert "tdf#96796 - Added clipboard actions for the Android Viewer"
    
    Breaks Android tinderbox
    
    This reverts commit 31e939c9f4b29fb2b2e63eb096450cf3da35d67f.
    
    Change-Id: Id565c9ef8330c0b3bce2c678facb7605dcf3e356

diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
index f0c5e7a6f99a..6a1f402970ea 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Document.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -232,21 +232,6 @@ public class Document {
     public native void setGraphicSelection(int type, int x, int y);
 
     /**
-     * Get selected text
-     * @param mimeType
-     * @return
-     */
-    public native String getTextSelection(String mimeType);
-
-    /**
-     * paste
-     * @param mimeType
-     * @param data
-     * @return
-     */
-    public native boolean paste(String mimeType, String data);
-
-    /**
      * Reset current (any kind of) selection.
      */
     public native void resetSelection();
diff --git a/android/source/res/drawable/ic_content_copy_black_24dp.xml b/android/source/res/drawable/ic_content_copy_black_24dp.xml
deleted file mode 100644
index 8a894a3bcd73..000000000000
--- a/android/source/res/drawable/ic_content_copy_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
-</vector>
diff --git a/android/source/res/drawable/ic_content_cut_black_24dp.xml b/android/source/res/drawable/ic_content_cut_black_24dp.xml
deleted file mode 100644
index 1c0f96a37b42..000000000000
--- a/android/source/res/drawable/ic_content_cut_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M9.64,7.64c0.23,-0.5 0.36,-1.05 0.36,-1.64 0,-2.21 -1.79,-4 -4,-4S2,3.79 2,6s1.79,4 4,4c0.59,0 1.14,-0.13 1.64,-0.36L10,12l-2.36,2.36C7.14,14.13 6.59,14 6,14c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4c0,-0.59 -0.13,-1.14 -0.36,-1.64L12,14l7,7h3v-1L9.64,7.64zM6,8c-1.1,0 -2,-0.89 -2,-2s0.9,-2 2,-2 2,0.89 2,2 -0.9,2 -2,2zM6,20c-1.1,0 -2,-0.89 -2,-2s0.9,-2 2,-2 2,0.89 2,2 -0.9,2 -2,2zM12,12.5c-0.28,0 -0.5,-0.22 -0.5,-0.5s0.22,-0.5 0.5,-0.5 0.5,0.22 0.5,0.5 -0.22,0.5 -0.5,0.5zM19,3l-6,6 2,2 7,-7L22,3z"/>
-</vector>
diff --git a/android/source/res/drawable/ic_content_paste_black_24dp.xml b/android/source/res/drawable/ic_content_paste_black_24dp.xml
deleted file mode 100644
index a902d9a856a0..000000000000
--- a/android/source/res/drawable/ic_content_paste_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
-</vector>
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index 7fba5f46e380..229c20aed68c 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -47,35 +47,6 @@
             android:enabled="false" />
     </group>
 
-    <group android:id="@+id/group_edit_clipboard"
-        android:visible="false"
-        tools:visible="true">
-
-        <item android:id="@+id/action_back"
-            android:title="@string/action_back"
-            app:showAsAction="always"
-            android:icon="@drawable/ic_arrow_back_black_24dp"
-            android:orderInCategory="1"/>
-
-        <item android:id="@+id/action_copy"
-            android:title="@string/action_copy"
-            app:showAsAction="always"
-            android:icon="@drawable/ic_content_copy_black_24dp"
-            android:orderInCategory="2"/>
-
-        <item android:id="@+id/action_cut"
-            android:title="@string/action_cut"
-            app:showAsAction="always"
-            android:icon="@drawable/ic_content_cut_black_24dp"
-            android:orderInCategory="3"/>
-
-        <item android:id="@+id/action_paste"
-            android:title="@string/action_paste"
-            app:showAsAction="always"
-            android:icon="@drawable/ic_content_paste_black_24dp"
-            android:orderInCategory="4"/>
-
-    </group>
 
     <item android:id="@+id/action_search"
         android:title="@string/action_search"
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 2a4ca0ab4e21..2e885fee5e1a 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -173,11 +173,4 @@
     <string name="compress_photo_no_compress">Don\'t Compress</string>
     <string name="compress_photo_title">Do you want to compress the photo?</string>
 
-    <!-- Clipboard Actions -->
-    <string name="action_copy">Copy</string>
-    <string name="action_paste">Paste</string>
-    <string name="action_cut">Cut</string>
-    <string name="action_back">Back</string>
-    <string name="action_text_copied">Text copied to the clipboard</string>
-
 </resources>
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index eb22f6c8f3d3..e411770976c9 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -452,7 +452,6 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes
             if (mContext.isSpreadsheet()) {
                 mDocumentOverlay.showHeaderSelection(null);
             }
-            mContext.getToolbarController().showHideClipboardCutAndCopy(false);
         } else {
             List<RectF> rectangles = convertPayloadToRectangles(payload);
             if (mState != OverlayState.SELECTION) {
@@ -463,8 +462,6 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes
             if (mContext.isSpreadsheet()) {
                 mDocumentOverlay.showHeaderSelection(rectangles.get(0));
             }
-            String selectedText = mContext.getTileProvider().getTextSelection("");
-            mContext.getToolbarController().showClipboardActions(selectedText);
         }
     }
 
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index 4a8720cb9d01..df5a7d780b78 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -604,27 +604,6 @@ class LOKitTileProvider implements TileProvider {
     }
 
     /**
-     * @param mimeType
-     * @return
-     */
-    @Override
-    public String getTextSelection(String mimeType) {
-        return mDocument.getTextSelection(mimeType);
-    }
-
-    /**
-     * paste
-     * @param mimeType
-     * @param data
-     * @return
-     */
-    @Override
-    public boolean paste(String mimeType, String data) {
-        return mDocument.paste(mimeType, data);
-    }
-
-
-    /**
      * @see org.libreoffice.TileProvider#setGraphicSelectionStart(android.graphics.PointF)
      */
     @Override
diff --git a/android/source/src/java/org/libreoffice/TileProvider.java b/android/source/src/java/org/libreoffice/TileProvider.java
index 10d578337680..71c27146e6f1 100644
--- a/android/source/src/java/org/libreoffice/TileProvider.java
+++ b/android/source/src/java/org/libreoffice/TileProvider.java
@@ -136,19 +136,6 @@ public interface TileProvider {
     void setTextSelectionEnd(PointF documentCoordinate);
 
     /**
-     * get selected text
-     * @param mimeType
-     */
-    String getTextSelection(String mimeType);
-
-    /**
-     * copy
-     * @param mimeType
-     * @param data
-     * @return
-     */
-    boolean paste(String mimeType, String data);
-    /**
      * Send text selection reset coordinate.
      * @param documentCoordinate
      */
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 21e3e5ca7be2..87a84f0878d1 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -8,12 +8,8 @@
  */
 package org.libreoffice;
 
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
 import android.support.v7.widget.Toolbar;
 import android.util.Log;
-import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.widget.Toast;
@@ -29,9 +25,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
     private final Menu mMainMenu;
 
     private boolean isEditModeOn = false;
-    private String clipboardText = null;
-    ClipboardManager clipboardManager;
-    ClipData clipData;
 
     public ToolbarController(LibreOfficeMainActivity context, Toolbar toolbarTop) {
         mToolbarTop = toolbarTop;
@@ -42,7 +35,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
         switchToViewMode();
 
         mMainMenu = mToolbarTop.getMenu();
-        clipboardManager = (ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
     }
 
     public void disableMenuItem(final int menuItemId, final boolean disabled) {
@@ -86,48 +78,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
     }
 
     /**
-     * Show clipboard Actions on the toolbar
-     * */
-    void showClipboardActions(final String value){
-        LOKitShell.getMainHandler().post(new Runnable() {
-            @Override
-            public void run() {
-                if(value  != null){
-                    mMainMenu.setGroupVisible(R.id.group_edit_actions, false);
-                    mMainMenu.setGroupVisible(R.id.group_edit_clipboard, true);
-                    if(getEditModeStatus()){
-                        showHideClipboardCutAndCopy(true);
-                    } else {
-                        mMainMenu.findItem(R.id.action_cut).setVisible(false);
-                        mMainMenu.findItem(R.id.action_paste).setVisible(false);
-                    }
-                    clipboardText = value;
-                }
-            }
-        });
-    }
-
-    void hideClipboardActions(){
-        LOKitShell.getMainHandler().post(new Runnable() {
-            @Override
-            public void run() {
-                mMainMenu.setGroupVisible(R.id.group_edit_actions, getEditModeStatus());
-                mMainMenu.setGroupVisible(R.id.group_edit_clipboard, false);
-            }
-        });
-    }
-
-    void showHideClipboardCutAndCopy(final boolean option){
-        LOKitShell.getMainHandler().post(new Runnable() {
-            @Override
-            public void run() {
-                mMainMenu.findItem(R.id.action_copy).setVisible(option);
-                mMainMenu.findItem(R.id.action_cut).setVisible(option);
-            }
-        });
-    }
-
-    /**
      * Change the toolbar to view mode.
      */
     void switchToViewMode() {
@@ -191,26 +141,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
             case R.id.action_add_worksheet:
                 mContext.addPart();
                 return true;
-            case R.id.action_back:
-                hideClipboardActions();
-                return true;
-            case R.id.action_copy:
-                LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Copy"));
-                clipData = ClipData.newPlainText("clipboard data", clipboardText);
-                clipboardManager.setPrimaryClip(clipData);
-                Toast.makeText(mContext, mContext.getResources().getString(R.string.action_text_copied), Toast.LENGTH_SHORT).show();
-                return true;
-            case R.id.action_paste:
-                clipData = clipboardManager.getPrimaryClip();
-                ClipData.Item clipItem = clipData.getItemAt(0);
-                mContext.setDocumentChanged(true);
-                return mContext.getTileProvider().paste("text/plain;charset=utf-16", clipItem.getText().toString());
-            case R.id.action_cut:
-                clipData = ClipData.newPlainText("clipboard data", clipboardText);
-                clipboardManager.setPrimaryClip(clipData);
-                LOKitShell.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
-                mContext.setDocumentChanged(true);
-                return true;
         }
         return false;
     }
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index 43286a93aea0..b85619d3dad8 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -370,23 +370,6 @@ extern "C" SAL_JNI_EXPORT jstring JNICALL Java_org_libreoffice_kit_Document_getT
     return pEnv->NewStringUTF(pSelection);
 }
 
-extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_org_libreoffice_kit_Document_paste
-    (JNIEnv* pEnv, jobject aObject, jstring mimeType, jstring data)
-{
-    LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
-
-    const char* pMimeType = pEnv->GetStringUTFChars(mimeType, NULL);
-    const char* pData = pEnv->GetStringUTFChars(data, NULL);
-    const size_t nSize = pEnv->GetStringLength(data);
-
-    LibreOfficeKitDocumentClass* pcls = pDocument->pClass;
-    bool result = pcls->paste(pDocument, pMimeType, pData, nSize);
-    pEnv->ReleaseStringUTFChars(mimeType, pMimeType);
-    pEnv->ReleaseStringUTFChars(pData, data);
-
-    return result;
-}
-
 extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setGraphicSelection
     (JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y)
 {


More information about the Libreoffice-commits mailing list