summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-07-31 17:04:38 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-08-29 16:38:36 +0200
commitf8b2a27365b858ab5653edad75fd089b39d016d8 (patch)
treeb703217b2c858e4baeb3e71538e2a4a9f50fdda8 /comphelper
parente56d143c36af028825a8e824201a3aa193862af4 (diff)
LOK: per-view support for isMobile()
embeddedobj/source/commonembedding/embedobj.cxx will have a follow-up patch, which also removes the -1 case. It is left out because it has many call-sites, and inheritance/override relations. Change-Id: Iaf00530916f3772f7aec151cbd358f255b7aab24 Reviewed-on: https://gerrit.libreoffice.org/78272 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/lok.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 0969b5399bd4..253d94500f13 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -12,6 +12,7 @@
#include <sal/log.hxx>
#include <iostream>
+#include <map>
namespace comphelper
{
@@ -21,8 +22,6 @@ namespace LibreOfficeKit
static bool g_bActive(false);
-static bool g_bMobile(false);
-
static bool g_bPartInInvalidation(false);
static bool g_bTiledPainting(false);
@@ -44,6 +43,9 @@ static LanguageTag g_aLanguageTag("en-US", true);
/// Scaling of the cairo or CoreGraphics canvas painting for HiDPI or zooming in Calc.
static double g_fDPIScale(1.0);
+/// List of <viewid, bMobile> pairs
+static std::map<int, bool> g_vIsViewMobile;
+
void setActive(bool bActive)
{
g_bActive = bActive;
@@ -54,14 +56,24 @@ bool isActive()
return g_bActive;
}
-void setMobile(bool bIsMobile)
+void setMobile(int nViewId, bool bMobile)
{
- g_bMobile = bIsMobile;
+ if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
+ g_vIsViewMobile[nViewId] = bMobile;
+ else
+ g_vIsViewMobile.insert(std::make_pair(nViewId, bMobile));
}
-bool isMobile()
+bool isMobile(int nViewId)
{
- return g_bMobile;
+ // No view given, so act as a global var
+ if (nViewId == -1)
+ return g_vIsViewMobile.size() > 0;
+
+ if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
+ return g_vIsViewMobile[nViewId];
+ else
+ return false;
}
void setPartInInvalidation(bool bPartInInvalidation)