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

Mert Tümer merttumer7 at gmail.com
Tue Jan 30 01:16:34 UTC 2018


 android/source/res/menu/main.xml                                     |    5 +++
 android/source/res/values/strings.xml                                |    1 
 android/source/src/java/org/libreoffice/LOKitTileProvider.java       |   14 ++++++++++
 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java |    6 ++++
 android/source/src/java/org/libreoffice/ToolbarController.java       |    3 ++
 5 files changed, 29 insertions(+)

New commits:
commit 976b48e9e7777e03e7bd36e0f99a8752aa06a337
Author: Mert Tümer <merttumer7 at gmail.com>
Date:   Wed Jan 24 15:22:22 2018 +0300

    [Pardus] tdf#112482 ability to add slides to impress
    
    This patch is sponsored by ULAKBIM/PARDUS project.
    Signed-off-by: Mert Tümer <merttumer7 at gmail.com>
    
    Change-Id: I3c8b55d032604b30117573ac447776a1a0e5205f
    Reviewed-on: https://gerrit.libreoffice.org/48500
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index 9a4384af6fd5..432c374b3997 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -35,6 +35,11 @@
         <item android:id="@+id/action_save"
             android:title="@string/action_save"
             android:orderInCategory="100" />
+
+        <item android:id="@+id/action_add_slide"
+            android:title="@string/action_add_slide"
+            android:orderInCategory="100"
+            android:enabled="false" />
     </group>
 
 
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 5d7eca869a39..052389847f7c 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -136,6 +136,7 @@
 
     <!-- Presentation Mode Strings -->
     <string name="action_presentation">Slide show</string>
+    <string name="action_add_slide">Add Slide</string>
     <string name="alert_copy_svg_slide_show_to_clipboard">Your Android device doesn\'t support in-app svg slideshow. We copied the slideshow link to clipboard. Please press home button, open a modern web browser, paste in the address bar, and go.</string>
     <string name="alert_copy_svg_slide_show_to_clipboard_dismiss">OK</string>
     <string name="slideshow_action_back">Back</string>
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index a68f65221795..e7b80782f0b8 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -114,6 +114,7 @@ class LOKitTileProvider implements TileProvider {
 
         if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION) {
             mContext.getToolbarController().disableMenuItem(R.id.action_presentation, false);
+            mContext.getToolbarController().disableMenuItem(R.id.action_add_slide, false);
         }
 
         // Writer documents always have one part, so hide the navigation drawer.
@@ -160,6 +161,19 @@ class LOKitTileProvider implements TileProvider {
         });
     }
 
+    public void addPart(){
+        int parts = mDocument.getParts();
+        LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:InsertPage"));
+        String partName = mDocument.getPartName(parts);
+        if (partName.isEmpty()) {
+            partName = getGenericPartName(parts);
+        }
+        mDocument.setPart(parts);
+        resetDocumentSize();
+        final DocumentPartView partView = new DocumentPartView(parts, partName);
+        mContext.getDocumentPartView().add(partView);
+    }
+
     @Override
     public void saveDocumentAs(String filePath, String format) {
         final String newFilePath = "file://" + filePath;
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 0b3f8b8e0e06..91722fa98d35 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -685,6 +685,12 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
         aboutDialogFragment.show(getSupportFragmentManager(), "AboutDialogFragment");
     }
 
+    public void addSlide(){
+        mTileProvider.addPart();
+        mDocumentPartViewListAdapter.notifyDataSetChanged();
+        setDocumentChanged(true);
+    }
+
     public void showSettings() {
         startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
     }
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 9ef994d271a9..b8faae379f83 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -135,6 +135,9 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
             case R.id.action_presentation:
                 mContext.preparePresentation();
                 return true;
+            case R.id.action_add_slide:
+                mContext.addSlide();
+                return true;
         }
         return false;
     }


More information about the Libreoffice-commits mailing list