Kaydet (Commit) 8955af9b authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add API to check whether being used through LibreOfficeKit

LibreOffice code, when used in a program through LibreOfficeKit, needs to be
aware of that in certain crucial spots, to avoid behaviour and functionality
that makes no sense in a LibreOfficeKit scenario. As LibreOfficeKit uses a
normal LibreOffice installation to perform its job, this can't be a
compile-time choice. Also, none of the existing run-time "headlessness" modes
fully match what is needed.

Change-Id: Iaccf7f958c549f019b508854800519f54dcadb11
üst 2fc4a8c8
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <tools/errinf.hxx> #include <tools/errinf.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/lok.hxx>
#include <osl/process.h> #include <osl/process.h>
#include <osl/thread.h> #include <osl/thread.h>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
...@@ -852,6 +853,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) ...@@ -852,6 +853,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
if (bInitialized) if (bInitialized)
return 1; return 1;
osl::LibreOfficeKit::setActive();
OUString aAppPath; OUString aAppPath;
if (pAppPath) if (pAppPath)
{ {
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_OSL_LOK_HXX
#define INCLUDED_OSL_LOK_HXX
#ifdef LIBO_INTERNAL_ONLY
#include <sal/saldllapi.h>
namespace osl
{
namespace LibreOfficeKit
{
SAL_DLLPUBLIC void setActive();
SAL_DLLPUBLIC bool isActive();
}
}
#endif // LIBO_INTERNAL_ONLY
#endif // INCLUDED_OSL_LOK_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "osl/time.h" #include <osl/lok.hxx>
#include <osl/time.h>
/* /*
* mfe : maybe it would be wishful to include initialization * mfe : maybe it would be wishful to include initialization
...@@ -45,5 +46,22 @@ public: ...@@ -45,5 +46,22 @@ public:
static OGlobalTimer aGlobalTimer; static OGlobalTimer aGlobalTimer;
namespace LibreOfficeKit
{
static bool bActive(false);
void setActive()
{
bActive = true;
} }
bool isActive()
{
return bActive;
}
} // namespace LibreOfficeKit
} // namespace osl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -713,6 +713,11 @@ PRIVATE_textenc.1 { # LibreOffice 3.6 ...@@ -713,6 +713,11 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
_ZN3sal6detail7textenc37handleBadInputUnicodeToTextConversion*; _ZN3sal6detail7textenc37handleBadInputUnicodeToTextConversion*;
}; };
PRIVATE_4.5 { # LibreOffice 4.5
_ZN3osl14LibreOfficeKit8isActive*;
_ZN3osl14LibreOfficeKit9setActive*;
};
# Unique libstdc++ symbols: # Unique libstdc++ symbols:
GLIBCXX_3.4 { GLIBCXX_3.4 {
global: global:
......
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