[Libreoffice-commits] core.git: comphelper/source desktop/source include/comphelper

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 29 10:22:40 UTC 2019


 comphelper/source/misc/lok.cxx |   12 ++++++++++++
 desktop/source/lib/init.cxx    |   12 ++++++++++++
 include/comphelper/lok.hxx     |    6 ++++++
 3 files changed, 30 insertions(+)

New commits:
commit 4e144c1ab2ae7ef0a7928f7d4685aabe8e6b9c18
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Mon Jul 29 20:27:24 2019 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Aug 29 12:21:59 2019 +0200

    lok: Add isMobile() method
    
    [ Miklos: this allows core to e.g. serve tunelled dialogs with more or
    less compact layouts, depending on if the client is mobile or not. ]
    
    Change-Id: I3559bee84e6ef6f757809617e303aa090698ce5d
    Reviewed-on: https://gerrit.libreoffice.org/78261
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index c06d7e87d9b8..0969b5399bd4 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -21,6 +21,8 @@ namespace LibreOfficeKit
 
 static bool g_bActive(false);
 
+static bool g_bMobile(false);
+
 static bool g_bPartInInvalidation(false);
 
 static bool g_bTiledPainting(false);
@@ -52,6 +54,16 @@ bool isActive()
     return g_bActive;
 }
 
+void setMobile(bool bIsMobile)
+{
+    g_bMobile = bIsMobile;
+}
+
+bool isMobile()
+{
+    return g_bMobile;
+}
+
 void setPartInInvalidation(bool bPartInInvalidation)
 {
     g_bPartInInvalidation = bPartInInvalidation;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7c8b742dfb78..3c81ae6b400d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3211,6 +3211,18 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
     if (nView < 0)
         return;
 
+    // Set/unset mobile view for LOK
+    if (gImpl && aCommand == ".uno:LOKSetMobile")
+    {
+        comphelper::LibreOfficeKit::setMobile();
+        return;
+    }
+    else if (gImpl && aCommand == ".uno:LOKUnSetMobile")
+    {
+        comphelper::LibreOfficeKit::setMobile(false);
+        return;
+    }
+
     // handle potential interaction
     if (gImpl && aCommand == ".uno:Save")
     {
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index aaa3b48e6ae0..3ced9d7b8905 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -29,6 +29,9 @@ namespace LibreOfficeKit
 
 COMPHELPER_DLLPUBLIC void setActive(bool bActive = true);
 
+// Set LOK view to mobile
+COMPHELPER_DLLPUBLIC void setMobile(bool bIsMobile = true);
+
 enum class statusIndicatorCallbackType { Start, SetValue, Finish };
 
 COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data, statusIndicatorCallbackType type, int percent), void *data);
@@ -39,6 +42,9 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data
 // Check whether the code is running as invoked through LibreOfficeKit.
 COMPHELPER_DLLPUBLIC bool isActive();
 
+// Check whether we are serving to a mobile view/device
+COMPHELPER_DLLPUBLIC bool isMobile();
+
 /// Shift the coordinates before rendering each bitmap.
 /// Used by Calc to render each tile separately.
 /// This should be unnecessary (and removed) once Calc


More information about the Libreoffice-commits mailing list