diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-09 11:33:25 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-06-11 13:44:55 +0100 |
commit | 9a1b2970ed83b7666957ca6d0394a75b5d0717fa (patch) | |
tree | 53c056fc2641b493f7d2fe7e93bc84b65e4c75b5 /desktop | |
parent | bb761be472ea9a590837dc6c1ca295387ac4c0b7 (diff) |
Move liblibreoffice into LibreOfficeKit.
Change-Id: Ib2754a77be470faaa6f9b27644a1d8dd082ed2b8
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/Library_libreoffice.mk | 32 | ||||
-rw-r--r-- | desktop/Module_desktop.mk | 6 | ||||
-rw-r--r-- | desktop/inc/liblibreoffice.h | 52 | ||||
-rw-r--r-- | desktop/inc/liblibreoffice.hxx | 97 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 2 | ||||
-rw-r--r-- | desktop/source/lib/shim.c | 67 |
6 files changed, 1 insertions, 255 deletions
diff --git a/desktop/Library_libreoffice.mk b/desktop/Library_libreoffice.mk deleted file mode 100644 index dbdf6acc3e7e..000000000000 --- a/desktop/Library_libreoffice.mk +++ /dev/null @@ -1,32 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_StaticLibrary_StaticLibrary,libreoffice)) - -$(eval $(call gb_StaticLibrary_set_include,libreoffice,\ - $$(INCLUDE) \ - -I$(SRCDIR)/desktop/inc \ -)) - -$(eval $(call gb_StaticLibrary_add_libs,libreoffice,\ - $(if $(filter $(OS),LINUX), \ - -ldl \ - -lpthread \ - ) \ -)) - -$(eval $(call gb_StaticLibrary_use_libraries,libreoffice,\ - $(gb_UWINAPI) \ -)) - -$(eval $(call gb_StaticLibrary_add_cobjects,libreoffice,\ - desktop/source/lib/shim \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk index 584b70d76fe7..cfaf0d93ecd9 100644 --- a/desktop/Module_desktop.mk +++ b/desktop/Module_desktop.mk @@ -29,12 +29,6 @@ $(eval $(call gb_Module_add_l10n_targets,desktop,\ UIConfig_deployment \ )) -ifeq ($(OS),LINUX) -$(eval $(call gb_Module_add_targets,desktop,\ - Library_libreoffice \ -)) -endif - ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,desktop,\ Executable_soffice_bin \ diff --git a/desktop/inc/liblibreoffice.h b/desktop/inc/liblibreoffice.h deleted file mode 100644 index 87111c43bc67..000000000000 --- a/desktop/inc/liblibreoffice.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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_DESKTOP_INC_LIBLIBREOFFICE_H -#define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct _LibreOffice LibreOffice; -typedef struct _LibreOfficeDocument LibreOfficeDocument; - -struct _LibreOffice -{ - int nSize; - - void (*destroy) (LibreOffice *pThis); - int (*initialize) (LibreOffice *pThis, const char *pInstallPath); - LibreOfficeDocument* (*documentLoad) (LibreOffice *pThis, const char *pURL); - char* (*getError) (LibreOffice *pThis); -}; - -struct _LibreOfficeDocument -{ - int nSize; - - void (*destroy) (LibreOfficeDocument* pThis); - int (*saveAs) (LibreOfficeDocument* pThis, - const char *pUrl, - const char *pFormat); - int (*saveAsWithOptions) (LibreOfficeDocument* pThis, - const char *pUrl, - const char *pFormat, - const char *pFilterOptions); -}; - -LibreOffice* lo_init (const char* pInstallPath); - -#ifdef __cplusplus -} -#endif - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/inc/liblibreoffice.hxx b/desktop/inc/liblibreoffice.hxx deleted file mode 100644 index 182e88f1c3c2..000000000000 --- a/desktop/inc/liblibreoffice.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- 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_DESKTOP_INC_LIBLIBREOFFICE_HXX -#define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_HXX - -#include "liblibreoffice.h" - -/* - * The reasons this C++ code is not as pretty as it could be are: - * a) provide a pure C API - that's useful for some people - * b) allow ABI stability - C++ vtables are not good for that. - * c) avoid C++ types as part of the API. - */ - -class LODocument -{ -private: - LibreOfficeDocument* mpDoc; - -public: - inline LODocument(LibreOfficeDocument* pDoc) : - mpDoc(pDoc) - {} - - inline ~LODocument() - { - mpDoc->destroy(mpDoc); - } - - // Save as the given format, if format is NULL sniff from ext'n - inline bool saveAs(const char* pUrl, const char* pFormat = NULL) - { - return mpDoc->saveAs(mpDoc, pUrl, pFormat); - } - - inline bool saveAsWithOptions(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL) - { - // available since LibreOffice 4.3 - if (!mpDoc->saveAsWithOptions) - return false; - - return mpDoc->saveAsWithOptions(mpDoc, pUrl, pFormat, pFilterOptions); - } -}; - -class LibLibreOffice -{ -private: - LibreOffice* mpThis; - -public: - inline LibLibreOffice(LibreOffice* pThis) : - mpThis(pThis) - {} - - inline ~LibLibreOffice() - { - mpThis->destroy(mpThis); - } - - inline bool initialize(const char* pInstallPath) - { - return mpThis->initialize(mpThis, pInstallPath); - } - - inline LODocument* documentLoad(const char* pUrl) - { - LibreOfficeDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); - if (pDoc == NULL) - return NULL; - return new LODocument(pDoc); - } - - // return the last error as a string, free me. - inline char* getError() - { - return mpThis->getError(mpThis); - } -}; - -inline LibLibreOffice* lo_cpp_init(const char* pInstallPath) -{ - LibreOffice* pThis = lo_init(pInstallPath); - if (pThis == NULL || pThis->nSize == 0) - return NULL; - return new LibLibreOffice(pThis); -} - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0fcbc5f464b9..bbcac7fef613 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -13,7 +13,7 @@ #include <string.h> #include <stdlib.h> -#include "liblibreoffice.h" +#include <LibreOfficeKit/LibreOfficeKit.h> #include <tools/errinf.hxx> #include <osl/file.hxx> diff --git a/desktop/source/lib/shim.c b/desktop/source/lib/shim.c deleted file mode 100644 index 7115c6e57299..000000000000 --- a/desktop/source/lib/shim.c +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- 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/. - */ - -#ifdef LINUX - -#include <stdio.h> -#include <string.h> - -#include <osl/module.h> -#include <sal/types.h> -#include <liblibreoffice.h> - -#include <dlfcn.h> -#ifdef AIX -# include <sys/ldr.h> -#endif - -#define TARGET_LIB SAL_MODULENAME( "sofficeapp" ) - -typedef LibreOffice *(HookFunction)(void); - -SAL_DLLPUBLIC_EXPORT LibreOffice *lo_init( const char *install_path ) -{ - char *imp_lib; - void *dlhandle; - HookFunction *pSym; - - if( !install_path ) - return NULL; - if( !( imp_lib = (char *) malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 ) ) ) - { - fprintf( stderr, "failed to open library : not enough memory\n"); - return NULL; - } - - strcpy( imp_lib, install_path ); - strcat( imp_lib, "/" ); - strcat( imp_lib, TARGET_LIB ); - - if( !( dlhandle = dlopen( imp_lib, RTLD_LAZY ) ) ) - { - fprintf( stderr, "failed to open library '%s'\n", imp_lib ); - free( imp_lib ); - return NULL; - } - - pSym = (HookFunction *) dlsym( dlhandle, "liblibreoffice_hook" ); - if( !pSym ) { - fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib ); - dlclose( dlhandle ); - free( imp_lib ); - return NULL; - } - - free( imp_lib ); - return pSym(); -} - -#endif // not LINUX => port me ! - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |