summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
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:04 +0200
commit5de22d1e559cd0f1f5fa4e247f0ce153710fbeab (patch)
treecc66f4a16c0060868d37590593c77dda43db2d08 /desktop/source/lib/init.cxx
parent64c61aeb6be78bcfe458e72054bcea4792eb40e0 (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/+/132948 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'desktop/source/lib/init.cxx')
-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 33b763b3a1cb..442297d5d348 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4113,6 +4113,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(pValue), "");
+ OutputDevice::ImplRefreshAllFontData(true);
+ }
}
static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished)
@@ -6476,7 +6483,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
@@ -6760,11 +6771,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);
@@ -6785,6 +6797,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;