android/source/AndroidManifest.xml                                       |    
2 
 android/source/src/java/org/libreoffice/LOKitTileProvider.java           |   
28 +-------
 android/source/src/java/org/libreoffice/ui/FileUtilities.java            |    
4 -
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java    |    
1 
 android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java |   
13 ---
 i18npool/inc/xdictionary.hxx                                             |    
6 +
 i18npool/source/breakiterator/xdictionary.cxx                            |   
34 ++++++----
 7 files changed, 41 insertions(+), 47 deletions(-)

New commits:
commit d4381fac951c51155764710b0791390aa780508f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 29 22:01:07 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    android: Show Impress icon for .pps files
    
    For some reason, that was commented out.
    Opening such a PowerPoint file worked just
    fine, and with this commit in place, the
    Impress icon is shown in the "Recent Files"
    view as well.
    
    Change-Id: I69bce54074c084928d9aa7b95f37145a9692b847
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133649
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit c50afd45d2f6a7c70bb3a7591747b162a2675311)

diff --git a/android/source/src/java/org/libreoffice/ui/FileUtilities.java 
b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
index 4675ca1d0709..52b92534947f 100644
--- a/android/source/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
@@ -63,7 +63,7 @@ public class FileUtilities {
         mExtnMap.put(".vsdx", DRAWING);
         mExtnMap.put(".pub", DRAWING);
         mExtnMap.put(".ppt",  IMPRESS);
-        // mExtnMap.put(".pps",  IMPRESS);
+        mExtnMap.put(".pps",  IMPRESS);
         mExtnMap.put(".xls",  CALC);
 
         // MS templates
commit 72341ab5042e76a7a2cea4844a269e5d9bf8631b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 29 21:55:54 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    tdf#111427 android: Enable support for .ppsx
    
    Opening the sample file of MIME type
    "application/vnd.openxmlformats-officedocument.presentationml.slideshow"
    attached to tdf#111427 worked fine now when testing in an x86_64 AVD
    with API level 31, so declare support for it.
    
    Change-Id: I67ace0fb6ee82c0a43624dc32671ba2d453e473c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133648
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 965205931162b7fcdc175672354103b40985c6ed)

diff --git a/android/source/AndroidManifest.xml 
b/android/source/AndroidManifest.xml
index 0af368c8460b..c50ad77ae71d 100644
--- a/android/source/AndroidManifest.xml
+++ b/android/source/AndroidManifest.xml
@@ -70,7 +70,7 @@
                 <!-- OOXML -->
                 <data 
android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
 />
                 <data 
android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation"
 />
-                <!-- Currently crashes. <data 
android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow"/>
 -->
+                <data 
android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow"
 />
                 <data 
android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
 />
 
                 <!-- OOXML templates -->
diff --git a/android/source/src/java/org/libreoffice/ui/FileUtilities.java 
b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
index 72da47b8cc3a..4675ca1d0709 100644
--- a/android/source/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
@@ -74,7 +74,7 @@ public class FileUtilities {
         // OOXML
         mExtnMap.put(".docx", DOC);
         mExtnMap.put(".pptx", IMPRESS);
-        // mExtnMap.put(".ppsx", IMPRESS);
+        mExtnMap.put(".ppsx", IMPRESS);
         mExtnMap.put(".xlsx", CALC);
 
         // OOXML templates
diff --git 
a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java 
b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 965639e6e2ba..e7b38b4cac86 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -103,6 +103,7 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
             "application/x-mspublisher",
             
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
             
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
+            
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
             
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
             
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
             
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
commit 2f77a1d315a4aace8aaa088ff499c13c4b4c5cec
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 29 15:23:41 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    tdf#148851 Unmap + close file again in xdictionary dtor
    
    The file opened and mapped to memory in
    the `xdictionary` ctor was never unmapped
    and closed again, resulting in a memory leak.
    
    For Android Viewer, this resulted in the app
    running out of memory after a while when
    scrolling up and down in the Chinese sample
    doc from tdf#148851.
    
    On Android, closing the file is actually the relevant part,
    because the content of files from `/assets` is automatically
    loaded into memory when the files are opened (s. the call to
    `openMemoryAsFile` in `openFilePath` in `sal/osl/unx/file.cxx`)
    and that memory is only freed when the file is closed
    again (s. `osl_closeFile`).
    
    When using the sample doc, the file in question
    was "file:///assets/share/dict_zh.data", which
    has a size of 2.2 MB and is therefore actually
    loaded into memory anew every time, since only
    files below 50 KiB are handled by the file cache
    introduced in
    
        commit 26a46c1143e34e361d76d6459535c2056c59de77
        Date:   Fri Dec 20 14:46:36 2019 +0000
    
            android: file-cache to improve performance.
    
    Fix the memory leak by unmapping and closing
    the file again in the dtor.
    
    Change-Id: I3388964877080d1f2b3cf2682a41549e0bfb850c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133581
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit d4370761421508522a29c5206aea6e538d71b342)

diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx
index cc7364bd14fc..f0861408bbd6 100644
--- a/i18npool/inc/xdictionary.hxx
+++ b/i18npool/inc/xdictionary.hxx
@@ -18,6 +18,7 @@
  */
 #pragma once
 
+#include <osl/file.h>
 #include <sal/types.h>
 
 #include <com/sun/star/i18n/Boundary.hpp>
@@ -63,6 +64,11 @@ private:
 
     css::i18n::Boundary boundary;
     bool japaneseWordBreak;
+#ifdef DICT_JA_ZH_IN_DATAFILE
+    oslFileHandle m_aFileHandle;
+    sal_uInt64 m_nFileSize;
+    char* m_pMapping;
+#endif
 
 public:
     xdictionary(const char *lang);
diff --git a/i18npool/source/breakiterator/xdictionary.cxx 
b/i18npool/source/breakiterator/xdictionary.cxx
index dd1f83f8baa7..6c326f69e48f 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -62,6 +62,11 @@ sal_Unicode* getDataArea_zh();
 
 xdictionary::xdictionary(const char *lang) :
     japaneseWordBreak( false )
+#ifdef DICT_JA_ZH_IN_DATAFILE
+    , m_aFileHandle(nullptr),
+    m_nFileSize(-1),
+    m_pMapping(nullptr)
+#endif
 {
 
 #ifdef DICT_JA_ZH_IN_DATAFILE
@@ -76,21 +81,18 @@ xdictionary::xdictionary(const char *lang) :
         else if( strcmp( lang, "zh" ) == 0 )
             sUrl += "zh.data";
 
-        oslFileHandle aFileHandle;
-        sal_uInt64 nFileSize;
-        char *pMapping;
-        if( osl_openFile( sUrl.pData, &aFileHandle, osl_File_OpenFlag_Read ) 
== osl_File_E_None &&
-            osl_getFileSize( aFileHandle, &nFileSize) == osl_File_E_None &&
-            osl_mapFile( aFileHandle, (void **) &pMapping, nFileSize, 0, 
osl_File_MapFlag_RandomAccess ) == osl_File_E_None )
+        if( osl_openFile( sUrl.pData, &m_aFileHandle, osl_File_OpenFlag_Read ) 
== osl_File_E_None &&
+            osl_getFileSize( m_aFileHandle, &m_nFileSize) == osl_File_E_None &&
+            osl_mapFile( m_aFileHandle, (void **) &m_pMapping, m_nFileSize, 0, 
osl_File_MapFlag_RandomAccess ) == osl_File_E_None )
         {
             // We have the offsets to the parts of the file at its end, see 
gendict.cxx
-            sal_Int64 *pEOF = (sal_Int64*)(pMapping + nFileSize);
+            sal_Int64 *pEOF = (sal_Int64*)(m_pMapping + m_nFileSize);
 
-            data.existMark = (sal_uInt8*) (pMapping + pEOF[-1]);
-            data.index2 = (sal_Int32*) (pMapping + pEOF[-2]);
-            data.index1 = (sal_Int16*) (pMapping + pEOF[-3]);
-            data.lenArray = (sal_Int32*) (pMapping + pEOF[-4]);
-            data.dataArea = (sal_Unicode*) (pMapping + pEOF[-5]);
+            data.existMark = (sal_uInt8*) (m_pMapping + pEOF[-1]);
+            data.index2 = (sal_Int32*) (m_pMapping + pEOF[-2]);
+            data.index1 = (sal_Int16*) (m_pMapping + pEOF[-3]);
+            data.lenArray = (sal_Int32*) (m_pMapping + pEOF[-4]);
+            data.dataArea = (sal_Unicode*) (m_pMapping + pEOF[-5]);
         }
     }
 
@@ -131,6 +133,14 @@ xdictionary::~xdictionary()
             delete [] i.wordboundary;
         }
     }
+#ifdef DICT_JA_ZH_IN_DATAFILE
+    if (m_aFileHandle) {
+        if (m_pMapping) {
+            osl_unmapMappedFile(m_aFileHandle, m_pMapping, m_nFileSize);
+        }
+        osl_closeFile(m_aFileHandle);
+    }
+#endif
 }
 
 namespace {
commit 302779352158b683bae983f461db334a6b32723e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 26 16:43:15 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    android: Slightly clean up style of LOKitTileProvider#resetParts
    
    * Reduce scope of the `parts` variable to the if block
    * add an emptly line before the next method
    
    Change-Id: I22389cb4c9307f6888c4ed836056caf23ce84da6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133450
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 5453f75a1e682992f3a725781bb563b8cc76cf1b)

diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java 
b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index fa22bc803c9a..0c7931763571 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -176,9 +176,9 @@ class LOKitTileProvider implements TileProvider {
     }
 
     public void resetParts(){
-        int parts = mDocument.getParts();
         mContext.getDocumentPartView().clear();
         if (mDocument.getDocumentType() != Document.DOCTYPE_TEXT) {
+            int parts = mDocument.getParts();
             for (int i = 0; i < parts; i++) {
                 String partName = mDocument.getPartName(i);
 
@@ -192,7 +192,9 @@ class LOKitTileProvider implements TileProvider {
                 mContext.getDocumentPartView().add(partView);
             }
         }
-    } public void renamePart(String partName) {
+    }
+
+    public void renamePart(String partName) {
         try{
             for(int i=0; i<mDocument.getParts(); i++){
                 
if(mContext.getDocumentPartView().get(i).partName.equals(partName)){
commit f18efbfabcf2f4526b14938c223a264a46a2a35f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 26 16:38:35 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    android: Reuse existing LOKitTileProvider#resetParts
    
    ... instead of duplicating what it does in
    `LOKitTileProvider#postLoad`.
    
    Change-Id: I0ed3d77d9f9651efec764eafeaa3f71576abcf6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133449
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit e996ad71582ecd4425a1ab0d0347cccf7c7724c2)

diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java 
b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index afce177f097e..fa22bc803c9a 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -120,25 +120,9 @@ class LOKitTileProvider implements TileProvider {
     private void postLoad() {
         mDocument.setMessageCallback(mMessageCallback);
 
-        int parts = mDocument.getParts();
-        Log.i(LOGTAG, "Document parts: " + parts);
-        mContext.getDocumentPartView().clear();
-
+        resetParts();
         // Writer documents always have one part, so hide the navigation 
drawer.
-        if (mDocument.getDocumentType() != Document.DOCTYPE_TEXT) {
-            for (int i = 0; i < parts; i++) {
-                String partName = mDocument.getPartName(i);
-                if (partName.isEmpty()) {
-                    partName = getGenericPartName(i);
-                }
-                Log.i(LOGTAG, "Document part " + i + " name:'" + partName + 
"'");
-
-                mDocument.setPart(i);
-                resetDocumentSize();
-                final DocumentPartView partView = new DocumentPartView(i, 
partName);
-                mContext.getDocumentPartView().add(partView);
-            }
-        } else {
+        if (mDocument.getDocumentType() == Document.DOCTYPE_TEXT) {
             mContext.disableNavigationDrawer();
             mContext.getToolbarController().hideItem(R.id.action_parts);
         }
commit 91499f186f2ecf16968ec57d0303841507cd2928
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 26 16:21:37 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:51 2022 +0200

    android: Leave part names starting with "Sheet" etc. intact
    
    It's unexpected that opening a Calc sheet with two tables
    called "Sheet foobar" and "Sheet 10" would result in the
    sheets showing up as "Sheet 1" and "Sheet 2" in the parts
    view instead of their real names.
    
    Therefore, leave the original names intact and show
    them instead of generating new generic names.
    
    The change to rename such sheets (and similar parts)
    has been added in
    
        commit 1239dce2595877ad64fd8c8fd927ea4285d69abe
        Date:   Thu Nov 1 22:03:31 2018 +0300
    
            [Pardus] language improvements on Android
    
            More hardcoded strings extrated to the resource file
            Few Turkish language improvements
            This patch is sponsored by ULAKBIM/Pardus project.
    
    where the intention seems to have been to have a
    localized name for the parts show up.
    That still happens when the part name is empty
    (s. lines above), but I think that explicit
    names should remain as they are, as e.g. also
    happens for Calc sheets in the desktop version of
    LibreOffice.
    
    Change-Id: I3073babf99a6b2309be2107141bba92236eba76d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133448
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 1b45a30ccd4726612420bd09318eeae2a72425be)

diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java 
b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index 579162931d3a..afce177f097e 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -130,8 +130,6 @@ class LOKitTileProvider implements TileProvider {
                 String partName = mDocument.getPartName(i);
                 if (partName.isEmpty()) {
                     partName = getGenericPartName(i);
-                }else if (partName.startsWith("Slide") || 
partName.startsWith("Sheet") || partName.startsWith("Part")) {
-                    partName = getGenericPartName(i);
                 }
                 Log.i(LOGTAG, "Document part " + i + " name:'" + partName + 
"'");
 
commit 1be4d5af4815fd4860eb794c5ae4981b55fc4e37
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 26 08:27:21 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:20 2022 +0200

    android: Use 'if' instead of switch-cases with just 1 case
    
    ... which IMHO makes this a bit more readable.
    
    Change-Id: Ica1d9416f711e75e6d6c23963ca64d13e08c138e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133428
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 6df639114da3fa98bd2fd749eca40d3c2190c018)

diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java 
b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
index c096332b2bcc..697980af397d 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -143,12 +143,9 @@ class JavaPanZoomController
 
     /** This function MUST be called on the UI thread */
     public boolean onMotionEvent(MotionEvent event) {
-        switch (event.getSource() & InputDevice.SOURCE_CLASS_MASK) {
-        case InputDevice.SOURCE_CLASS_POINTER:
-            switch (event.getAction() & MotionEvent.ACTION_MASK) {
-            case MotionEvent.ACTION_SCROLL: return handlePointerScroll(event);
-            }
-            break;
+        if ((event.getSource() & InputDevice.SOURCE_CLASS_MASK) == 
InputDevice.SOURCE_CLASS_POINTER
+                && (event.getAction() & MotionEvent.ACTION_MASK) == 
MotionEvent.ACTION_SCROLL) {
+            return handlePointerScroll(event);
         }
         return false;
     }
commit 24c38b5c2ab496972a9ab8e77672c3e6bb990108
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 26 08:22:00 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue May 3 21:23:14 2022 +0200

    android: Drop redundant check for SDK version <= 11
    
    minSdkVersion is 16.
    
    Change-Id: I1082cc5abd7ecc02211509e57fd41c97cf706e8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133427
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 052c8a4b1b3aaa472ca89f834572c293f7d9ead2)

diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java 
b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
index db2fcc03c5b3..c096332b2bcc 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -143,10 +143,6 @@ class JavaPanZoomController
 
     /** This function MUST be called on the UI thread */
     public boolean onMotionEvent(MotionEvent event) {
-        if (Build.VERSION.SDK_INT <= 11) {
-            return false;
-        }
-
         switch (event.getSource() & InputDevice.SOURCE_CLASS_MASK) {
         case InputDevice.SOURCE_CLASS_POINTER:
             switch (event.getAction() & MotionEvent.ACTION_MASK) {

Reply via email to