Blame SOURCES/0148-comphelper-add-LibreOfficeKit-set-isViewCallback.patch

f325b2
From a5cddfd6432264a781e5418f970da6553db6a57d Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Thu, 17 Sep 2015 10:59:13 +0200
f325b2
Subject: [PATCH 148/398] comphelper: add LibreOfficeKit::set/isViewCallback()
f325b2
f325b2
Change-Id: Iad0b2ee419327daf478f3ddda2378effe0184067
f325b2
(cherry picked from commit 1704221067e2bc6ba26eaa83573d29964b413a34)
f325b2
---
f325b2
 comphelper/source/misc/lok.cxx | 12 ++++++++++++
f325b2
 desktop/source/lib/init.cxx    |  4 ++++
f325b2
 include/comphelper/lok.hxx     |  5 +++++
f325b2
 3 files changed, 21 insertions(+)
f325b2
f325b2
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
f325b2
index a6abd2a65486..279ec65c600c 100644
f325b2
--- a/comphelper/source/misc/lok.cxx
f325b2
+++ b/comphelper/source/misc/lok.cxx
f325b2
@@ -17,6 +17,8 @@ namespace LibreOfficeKit
f325b2
 
f325b2
 static bool g_bActive(false);
f325b2
 
f325b2
+static bool g_bViewCallback(false);
f325b2
+
f325b2
 void setActive(bool bActive)
f325b2
 {
f325b2
     g_bActive = bActive;
f325b2
@@ -27,6 +29,16 @@ bool isActive()
f325b2
     return g_bActive;
f325b2
 }
f325b2
 
f325b2
+void setViewCallback(bool bViewCallback)
f325b2
+{
f325b2
+    g_bViewCallback = bViewCallback;
f325b2
+}
f325b2
+
f325b2
+bool isViewCallback()
f325b2
+{
f325b2
+    return g_bViewCallback;
f325b2
+}
f325b2
+
f325b2
 static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr);
f325b2
 static void *pStatusIndicatorCallbackData(nullptr);
f325b2
 
f325b2
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
f325b2
index 617c94638cde..52a78e228a32 100644
f325b2
--- a/desktop/source/lib/init.cxx
f325b2
+++ b/desktop/source/lib/init.cxx
f325b2
@@ -1192,6 +1192,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
f325b2
         return 1;
f325b2
 
f325b2
     comphelper::LibreOfficeKit::setActive();
f325b2
+
f325b2
+    static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
f325b2
+    comphelper::LibreOfficeKit::setViewCallback(bViewCallback);
f325b2
+
f325b2
     comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
f325b2
 
f325b2
     if (pUserProfilePath)
f325b2
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
f325b2
index 79fa115e6585..2cc38c60e455 100644
f325b2
--- a/include/comphelper/lok.hxx
f325b2
+++ b/include/comphelper/lok.hxx
f325b2
@@ -36,6 +36,11 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data
f325b2
 // Check whether the code is running as invoked through LibreOfficeKit.
f325b2
 COMPHELPER_DLLPUBLIC bool isActive();
f325b2
 
f325b2
+/// Check whether clients register a callback for each view.
f325b2
+COMPHELPER_DLLPUBLIC bool isViewCallback();
f325b2
+/// Set whether clients register a callback for each view.
f325b2
+COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback);
f325b2
+
f325b2
 // Status indicator handling. Even if in theory there could be several status indicators active at
f325b2
 // the same time, in practice there is only one at a time, so we don't handle any identification of
f325b2
 // status indicator in this API.
f325b2
-- 
f325b2
2.12.0
f325b2