summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-07-29 20:27:24 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-08-29 12:21:59 +0200
commit4e144c1ab2ae7ef0a7928f7d4685aabe8e6b9c18 (patch)
treee6d1beabcddb02980d6a3f7525ac7527be5bdfb6
parentc8737dcf827cf47f233d3e8ad39a6348c3e36d10 (diff)
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@collabora.com> Tested-by: Jenkins
-rw-r--r--comphelper/source/misc/lok.cxx12
-rw-r--r--desktop/source/lib/init.cxx12
-rw-r--r--include/comphelper/lok.hxx6
3 files changed, 30 insertions, 0 deletions
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