summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-05-06 16:00:35 +0300
committerTor Lillqvist <tml@collabora.com>2015-05-06 17:55:58 +0300
commit44724236a014072a5a5012a9e77fb9d2a903fe1d (patch)
tree07a97faf485c6de8ddf9af6e5e261ac0d3201efb
parent7d8b03256e851f2436c05a56df5f3f61c957ff70 (diff)
Add support for progress bar callbacks to LibreOfficeKit clients
The comphelper::LibreOfficeKit bits. Also will need additions to the libsofficeapp bits in desktop and then to the StatusIndicator implementation in framework. Change-Id: I15c2505bbf6439c07d1956685d0a6d2a22aefc58
-rw-r--r--comphelper/source/misc/lok.cxx27
-rw-r--r--include/comphelper/lok.hxx10
2 files changed, 37 insertions, 0 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 71bc922c5d5f..fc8a09d054e9 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -27,6 +27,33 @@ bool isActive()
return bActive;
}
+static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr);
+static void *pStatusIndicatorCallbackData(nullptr);
+
+void setStatusIndicatorCallback(void (*callback)(void *data, statusIndicatorCallbackType type, int percent), void *data)
+{
+ pStatusIndicatorCallback = callback;
+ pStatusIndicatorCallbackData = data;
+}
+
+void statusIndicatorStart()
+{
+ if (pStatusIndicatorCallback)
+ pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Start, 0);
+}
+
+void statusIndicatorSetValue(int percent)
+{
+ if (pStatusIndicatorCallback)
+ pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::SetValue, percent);
+}
+
+void statusIndicatorFinish()
+{
+ if (pStatusIndicatorCallback)
+ pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Finish, 0);
+}
+
} // namespace LibreOfficeKit
} // namespace comphelper
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 8ddfb5a84fde..ba4745c8e61b 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -22,6 +22,16 @@ COMPHELPER_DLLPUBLIC void setActive();
COMPHELPER_DLLPUBLIC bool isActive();
+enum class statusIndicatorCallbackType { Start, SetValue, Finish };
+
+COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data, statusIndicatorCallbackType type, int percent), void *data);
+
+COMPHELPER_DLLPUBLIC void statusIndicatorStart();
+
+COMPHELPER_DLLPUBLIC void statusIndicatorSetValue(int percent);
+
+COMPHELPER_DLLPUBLIC void statusIndicatorFinish();
+
}
}