android/source/src/java/org/libreoffice/FontController.java    |   37 
++--------
 android/source/src/java/org/libreoffice/LOKitTileProvider.java |    1 
 sw/inc/swmodule.hxx                                            |    8 +-
 3 files changed, 14 insertions(+), 32 deletions(-)

New commits:
commit 6bab5485913ca99feb00855a20171a8a770f0469
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed May 22 13:50:24 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu May 23 15:53:26 2024 +0200

    android: Use "compact_fonts" LibreOfficeKit option
    
    For Android Viewer, set the "compact_fonts" LibreOfficeKit
    option via environment variable `SAL_LOK_OPTIONS` introduced in
    
        Change-Id: I3dc9f5de876def6e4afc09a43105b1740f7c621f
        Author: Michael Meeks <michael.me...@collabora.com>
        Date:   Fri May 17 21:25:29 2024 +0100
    
            lok: stop amazing waste of repeated font sizes in each font element.
    
    and adjust the handling in `FontController` to process
    the flat lists for font names and sizes that is reported
    with that options set, rather than processing
    font sizes for each individual font.
    
    (See also discussion in original Gerrit change
    for the distro/collabora/co-24.04 branch: [1].).
    
    [1] https://gerrit.libreoffice.org/c/core/+/167799
    
    Change-Id: I85734c1876d152f4f95f9182629affd6b250fdbc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167963
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/android/source/src/java/org/libreoffice/FontController.java 
b/android/source/src/java/org/libreoffice/FontController.java
index 72f35d8b42d8..211b9d6c8b56 100644
--- a/android/source/src/java/org/libreoffice/FontController.java
+++ b/android/source/src/java/org/libreoffice/FontController.java
@@ -19,8 +19,6 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
 
 public class FontController implements AdapterView.OnItemSelectedListener {
 
@@ -32,7 +30,6 @@ public class FontController implements 
AdapterView.OnItemSelectedListener {
     private final LibreOfficeMainActivity mActivity;
     private final ArrayList<String> mFontList = new ArrayList<>();
     private final ArrayList<String> mFontSizes = new ArrayList<>();
-    private final HashMap<String, ArrayList<String>> mAllFontSizes = new 
HashMap<>();
 
     private String mCurrentFontSelected = null;
     private String mCurrentFontSizeSelected = null;
@@ -210,21 +207,17 @@ public class FontController implements 
AdapterView.OnItemSelectedListener {
 
     public void parseJson(String json) {
         mFontList.clear();
-        mAllFontSizes.clear();
+        mFontSizes.clear();
         try {
             JSONObject jObject = new JSONObject(json);
-            JSONObject jObject2 = jObject.getJSONObject("commandValues");
-            Iterator<String> keys = jObject2.keys();
-            ArrayList<String> fontSizes;
-            while (keys.hasNext()) {
-                String key = keys.next();
-                mFontList.add(key);
-                JSONArray array = jObject2.getJSONArray(key);
-                fontSizes = new ArrayList<>();
-                for (int i = 0; i < array.length(); i++) {
-                    fontSizes.add(array.getString(i));
-                }
-                mAllFontSizes.put(key, fontSizes);
+            final JSONArray fontNameArray = jObject.getJSONArray("FontNames");
+            for (int i = 0; i < fontNameArray.length(); i++) {
+                mFontList.add(fontNameArray.getString(i));
+            }
+
+            final JSONArray fontSizeArray = jObject.getJSONArray("FontSizes");
+            for (int i = 0; i < fontSizeArray.length(); i++) {
+                mFontSizes.add(fontSizeArray.getString(i));
             }
         } catch (JSONException e) {
             e.printStackTrace();
@@ -405,18 +398,6 @@ public class FontController implements 
AdapterView.OnItemSelectedListener {
             mCurrentFontSelected = fontName;
             spinner.setSelection(position,false);
         }
-
-        resetFontSizes(fontName);
-    }
-
-    private void resetFontSizes(String fontName) {
-        if (mAllFontSizes.get(fontName) != null) {
-            mFontSizes.clear();
-            mFontSizes.addAll(mAllFontSizes.get(fontName));
-            Spinner spinner = mActivity.findViewById(R.id.font_size_spinner);
-            ArrayAdapter<?> arrayAdapter = 
(ArrayAdapter<?>)spinner.getAdapter();
-            arrayAdapter.notifyDataSetChanged();
-        }
     }
 
     public void selectFontSize(final String fontSize) {
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java 
b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index 5d1cf12209dc..c8a055206dd0 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -64,6 +64,7 @@ class LOKitTileProvider implements TileProvider {
         mMessageCallback = messageCallback;
 
         LibreOfficeKit.putenv("SAL_LOG=+WARN+INFO");
+        LibreOfficeKit.putenv("SAL_LOK_OPTIONS=compact_fonts");
         LibreOfficeKit.init(mContext);
 
         mOffice = new Office(LibreOfficeKit.getLibreOfficeKitHandle());
commit 693b21954581c608b7ef456c799ecbd3f46b9918
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon May 20 14:22:40 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 23 15:53:15 2024 +0200

    use SAL_RET_MAYBENULL in GetActiveWrtShell(), GetActiveView()...
    
    ... GetFirstView() and GetNextView()
    
    after 25b38765d6e500af196ce312a3e1d819c6a7d09c
    "check GetActiveWrtShell() and CheckAndGetWrtShell()"
    and 74f398bb58510087cc4a11bb2253715771a2c6b2
    "sw: check GetActiveView()"
    
    Change-Id: I0840309a28e2fb54a5abd386ceeddb21006d9368
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167866
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index 2e5687171955..cfaef237b2c3 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -176,8 +176,8 @@ public:
     SvtUserOptions&     GetUserOptions();
 
     // Iterate over views.
-    static SwView*      GetFirstView();
-    static SwView*      GetNextView(SwView const *);
+    SAL_RET_MAYBENULL static SwView*      GetFirstView();
+    SAL_RET_MAYBENULL static SwView*      GetNextView(SwView const *);
 
     bool IsEmbeddedLoadSave() const         { return m_bEmbeddedLoadSave; }
     void SetEmbeddedLoadSave( bool bFlag )  { m_bEmbeddedLoadSave = bFlag; }
@@ -251,8 +251,8 @@ public:
 
 #define SW_MOD() ( 
static_cast<SwModule*>(SfxApplication::GetModule(SfxToolsModule::Writer)))
 
-SW_DLLPUBLIC SwView*    GetActiveView();
-SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
+SAL_RET_MAYBENULL SW_DLLPUBLIC SwView*    GetActiveView();
+SAL_RET_MAYBENULL SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
 
 namespace sw
 {

Reply via email to