summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-07-31 17:04:38 +0300
committerAndras Timar <andras.timar@collabora.com>2019-09-03 21:43:21 +0200
commit9389bdcd6e796f4f4f9044fa7f905699eb8c9ab3 (patch)
treec254b856639ea9583b7d80dd33d686eae8a71257 /comphelper
parent58644008d6c1ce9c4c1c1f33740871103225d759 (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. (cherry picked from commit f8b2a27365b858ab5653edad75fd089b39d016d8) Conflicts: comphelper/source/misc/lok.cxx sc/source/ui/condformat/condformatdlg.cxx sc/source/ui/condformat/condformatdlgentry.cxx Change-Id: Iaf00530916f3772f7aec151cbd358f255b7aab24 Reviewed-on: https://gerrit.libreoffice.org/78309 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
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 a5d9689137d0..8862568608a8 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -13,6 +13,7 @@
#include <iostream>
#include <sstream>
+#include <map>
namespace comphelper
{
@@ -22,8 +23,6 @@ namespace LibreOfficeKit
static bool g_bActive(false);
-static bool g_bMobile(false);
-
static bool g_bPartInInvalidation(false);
static bool g_bTiledPainting(false);
@@ -45,6 +44,9 @@ static LanguageTag g_aLanguageTag("en-US", true);
/// Scaling of the cairo or CoreGraphics canvas painting for hi-dpi 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;
@@ -55,14 +57,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)