Kaydet (Commit) 17042210 authored tarafından Miklos Vajna's avatar Miklos Vajna

comphelper: add LibreOfficeKit::set/isViewCallback()

Change-Id: Iad0b2ee419327daf478f3ddda2378effe0184067
üst c74ccac7
...@@ -17,6 +17,8 @@ namespace LibreOfficeKit ...@@ -17,6 +17,8 @@ namespace LibreOfficeKit
static bool g_bActive(false); static bool g_bActive(false);
static bool g_bViewCallback(false);
void setActive(bool bActive) void setActive(bool bActive)
{ {
g_bActive = bActive; g_bActive = bActive;
...@@ -27,6 +29,16 @@ bool isActive() ...@@ -27,6 +29,16 @@ bool isActive()
return g_bActive; return g_bActive;
} }
void setViewCallback(bool bViewCallback)
{
g_bViewCallback = bViewCallback;
}
bool isViewCallback()
{
return g_bViewCallback;
}
static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr); static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr);
static void *pStatusIndicatorCallbackData(nullptr); static void *pStatusIndicatorCallbackData(nullptr);
......
...@@ -1189,6 +1189,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1189,6 +1189,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
return 1; return 1;
comphelper::LibreOfficeKit::setActive(); comphelper::LibreOfficeKit::setActive();
static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
comphelper::LibreOfficeKit::setViewCallback(bViewCallback);
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib); comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
if (pUserProfilePath) if (pUserProfilePath)
......
...@@ -36,6 +36,11 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data ...@@ -36,6 +36,11 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data
// Check whether the code is running as invoked through LibreOfficeKit. // Check whether the code is running as invoked through LibreOfficeKit.
COMPHELPER_DLLPUBLIC bool isActive(); COMPHELPER_DLLPUBLIC bool isActive();
/// Check whether clients register a callback for each view.
COMPHELPER_DLLPUBLIC bool isViewCallback();
/// Set whether clients register a callback for each view.
COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback);
// Status indicator handling. Even if in theory there could be several status indicators active at // Status indicator handling. Even if in theory there could be several status indicators active at
// the same time, in practice there is only one at a time, so we don't handle any identification of // the same time, in practice there is only one at a time, so we don't handle any identification of
// status indicator in this API. // status indicator in this API.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment