[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp loolwsd/Unit.hpp
Michael Meeks
michael.meeks at collabora.com
Mon May 2 08:40:17 UTC 2016
loolwsd/LOOLKit.cpp | 15 +++++++++++----
loolwsd/Unit.hpp | 6 ++++++
2 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit 6b88e97b630f6d0c490f8af87054e8aab90f4d77
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sun May 1 09:04:19 2016 +0100
Add unit test hook for libreofficekit.
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 14b2a85..a0b32cd 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -975,11 +975,18 @@ void lokit_main(const std::string& childRoot,
instdir_path = "/" + loTemplate + "/program";
}
- LibreOfficeKit* loKit = lok_init_2(instdir_path.c_str(), "file:///user");
- if (loKit == nullptr)
+ LibreOfficeKit* loKit;
{
- Log::error("LibreOfficeKit initialization failed. Exiting.");
- std::_Exit(Application::EXIT_SOFTWARE);
+ const char *instdir = instdir_path.c_str();
+ const char *userdir = "file:///user";
+ loKit = UnitKit::get().lok_init(instdir, userdir);
+ if (!loKit)
+ loKit = lok_init_2(instdir, userdir);
+ if (loKit == nullptr)
+ {
+ Log::error("LibreOfficeKit initialization failed. Exiting.");
+ std::_Exit(Application::EXIT_SOFTWARE);
+ }
}
Log::info("Process is ready.");
diff --git a/loolwsd/Unit.hpp b/loolwsd/Unit.hpp
index 6dc3045..dcdd36c 100644
--- a/loolwsd/Unit.hpp
+++ b/loolwsd/Unit.hpp
@@ -40,6 +40,7 @@ class StorageBase;
typedef UnitBase *(CreateUnitHooksFunction)();
extern "C" { UnitBase *unit_create_wsd(void); }
extern "C" { UnitBase *unit_create_kit(void); }
+extern "C" { typedef struct _LibreOfficeKit LibreOfficeKit; }
/// Derive your WSD unit test / hooks from me.
class UnitBase
@@ -186,6 +187,11 @@ public:
virtual bool filterKitMessage(const std::shared_ptr<Poco::Net::WebSocket> & /* ws */,
std::string &/* message */)
{ return false; }
+
+ /// Allow a custom LibreOfficeKit wrapper
+ virtual LibreOfficeKit *lok_init(const char * /* instdir */,
+ const char * /* userdir */)
+ { return NULL; }
};
#endif
More information about the Libreoffice-commits
mailing list