summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2022-03-09 11:33:16 +0200
committerTor Lillqvist <tml@collabora.com>2022-04-13 12:54:33 +0200
commitcef57d2bfa19d249e1c1721f32640f955a137955 (patch)
tree711037ceb57708b02f924d4476b3a9d4b0343869 /desktop
parenta0b053dbd7ce2d0d3713e750ad20c0a12bfd8c88 (diff)
Handle "addfont" from Collabora Online
We use the AddTempDevFont() API to add a new font. Sadly there is no corresponding way to remove such a temporarily added font. Change-Id: I6fe61919daa5af29e964cec1caf7293aefa8ea4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131250 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3e4265969053..8f991c37f818 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4161,6 +4161,13 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c
else
sal_detail_set_log_selector(pCurrentSalLogOverride);
}
+ else if (strcmp(pOption, "addfont") == 0)
+ {
+ OutputDevice *pDevice = Application::GetDefaultDevice();
+ OutputDevice::ImplClearAllFontData(true);
+ pDevice->AddTempDevFont(OUString::fromUtf8(OString(pValue)), "");
+ OutputDevice::ImplRefreshAllFontData(true);
+ }
}
static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished)
@@ -6528,7 +6535,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// What stage are we at ?
if (pThis == nullptr)
+ {
eStage = PRE_INIT;
+ SAL_INFO("lok", "Create libreoffice object");
+ gImpl = new LibLibreOffice_Impl();
+ }
else if (bPreInited)
eStage = SECOND_INIT;
else
@@ -6815,11 +6826,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
SAL_JNI_EXPORT
LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_url)
{
- if (!gImpl)
+ static bool alreadyCalled = false;
+
+ if (!alreadyCalled)
{
- SAL_INFO("lok", "Create libreoffice object");
+ alreadyCalled = true;
- gImpl = new LibLibreOffice_Impl();
if (!lo_initialize(gImpl, install_path, user_profile_url))
{
lo_destroy(gImpl);
@@ -6840,6 +6852,15 @@ int lok_preinit(const char* install_path, const char* user_profile_url)
return lo_initialize(nullptr, install_path, user_profile_url);
}
+SAL_JNI_EXPORT
+int lok_preinit_2(const char* install_path, const char* user_profile_url, LibLibreOffice_Impl** kit)
+{
+ int result = lo_initialize(nullptr, install_path, user_profile_url);
+ if (kit != nullptr)
+ *kit = gImpl;
+ return result;
+}
+
static void lo_destroy(LibreOfficeKit* pThis)
{
SolarMutexClearableGuard aGuard;