RepositoryModule_host.mk | 1 desktop/Library_libreoffice.mk | 32 --------- desktop/Module_desktop.mk | 6 - desktop/inc/liblibreoffice.h | 52 --------------- desktop/inc/liblibreoffice.hxx | 97 ---------------------------- desktop/source/lib/init.cxx | 42 ++++++------ desktop/source/lib/shim.c | 67 ------------------- include/LibreOfficeKit/LibreOfficeKit.h | 52 +++++++++++++++ include/LibreOfficeKit/LibreOfficeKit.hxx | 101 ++++++++++++++++++++++++++++++ libreofficekit/Library_libreofficekit.mk | 31 +++++++++ libreofficekit/Makefile | 14 ++++ libreofficekit/Module_libreofficekit.mk | 18 +++++ libreofficekit/source/shim.c | 67 +++++++++++++++++++ smoketest/Executable_libtest.mk | 3 smoketest/libtest.cxx | 8 +- 15 files changed, 311 insertions(+), 280 deletions(-)
New commits: commit 80f5fc4e6a50581e0ec55cd51bbe0821102d864b Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Tue Jun 10 11:42:13 2014 +0100 Upgrade LibreOfficeKit C++ API. Change-Id: If263b8fc748f67a1ed423c0f3f7cd465cf533993 diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index de8224c..c3da497 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -18,18 +18,20 @@ * b) allow ABI stability - C++ vtables are not good for that. * c) avoid C++ types as part of the API. */ +namespace lok +{ -class LODocument +class Document { private: LibreOfficeKitDocument* mpDoc; public: - inline LODocument(LibreOfficeKitDocument* pDoc) : + inline Document(LibreOfficeKitDocument* pDoc) : mpDoc(pDoc) {} - inline ~LODocument() + inline ~Document() { mpDoc->destroy(mpDoc); } @@ -50,17 +52,17 @@ public: } }; -class LibLibreOffice +class Office { private: LibreOfficeKit* mpThis; public: - inline LibLibreOffice(LibreOfficeKit* pThis) : + inline Office(LibreOfficeKit* pThis) : mpThis(pThis) {} - inline ~LibLibreOffice() + inline ~Office() { mpThis->destroy(mpThis); } @@ -70,12 +72,12 @@ public: return mpThis->initialize(mpThis, pInstallPath); } - inline LODocument* documentLoad(const char* pUrl) + inline Document* documentLoad(const char* pUrl) { LibreOfficeKitDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); if (pDoc == NULL) return NULL; - return new LODocument(pDoc); + return new Document(pDoc); } // return the last error as a string, free me. @@ -85,12 +87,14 @@ public: } }; -inline LibLibreOffice* lo_cpp_init(const char* pInstallPath) +} + +inline ::lok::Office* lo_cpp_init(const char* pInstallPath) { LibreOfficeKit* pThis = lok_init(pInstallPath); if (pThis == NULL || pThis->nSize == 0) return NULL; - return new LibLibreOffice(pThis); + return new ::lok::Office(pThis); } #endif diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index ca1f89c..c6211a9 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -15,6 +15,8 @@ #include <sys/time.h> #include <LibreOfficeKit/LibreOfficeKit.hxx> +using namespace ::lok; + long getTimeMS() { struct timeval t; @@ -44,7 +46,7 @@ int main (int argc, char **argv) return 1; } - LibLibreOffice *pOffice = lo_cpp_init( argv[1] ); + Office *pOffice = lo_cpp_init( argv[1] ); if( !pOffice ) { fprintf( stderr, "Failed to initialize\n" ); @@ -63,7 +65,7 @@ int main (int argc, char **argv) start = end; fprintf( stderr, "start to load document '%s'\n", argv[2] ); - LODocument *pDocument = pOffice->documentLoad( argv[2] ); + Document *pDocument = pOffice->documentLoad( argv[2] ); if( !pDocument ) { char *pError = pOffice->getError(); commit f646e8c8e275dd984ad8aa8592228a89998abf79 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Tue Jun 10 11:31:51 2014 +0100 Rename C api of LibreOfficeKit. However for the sake of ABI compatibility we can't change liblibreoffice_hook. Change-Id: I0e921efeeab40ef1b53a67c0e7a89d4c75ced831 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bbcac7f..512cfb3 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -144,18 +144,18 @@ static OUString getAbsoluteURL(const char* pURL) extern "C" { -static void doc_destroy(LibreOfficeDocument* pThis); -static int doc_saveAs(LibreOfficeDocument* pThis, const char* pUrl, const char* pFormat); -static int doc_saveAsWithOptions(LibreOfficeDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions); +static void doc_destroy(LibreOfficeKitDocument* pThis); +static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat); +static int doc_saveAsWithOptions(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions); -struct LibLODocument_Impl : public _LibreOfficeDocument +struct LibLODocument_Impl : public _LibreOfficeKitDocument { uno::Reference<css::lang::XComponent> mxComponent; LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent( xComponent ) { - nSize = sizeof(LibreOffice); + nSize = sizeof(LibreOfficeKit); destroy = doc_destroy; saveAs = doc_saveAs; @@ -168,24 +168,24 @@ struct LibLODocument_Impl : public _LibreOfficeDocument } }; -static void doc_destroy(LibreOfficeDocument *pThis) +static void doc_destroy(LibreOfficeKitDocument *pThis) { LibLODocument_Impl *pDocument = static_cast<LibLODocument_Impl*>(pThis); delete pDocument; } -static void lo_destroy (LibreOffice* pThis); -static int lo_initialize (LibreOffice* pThis, const char* pInstallPath); -static LibreOfficeDocument* lo_documentLoad (LibreOffice* pThis, const char* pURL); -static char * lo_getError (LibreOffice* pThis); +static void lo_destroy (LibreOfficeKit* pThis); +static int lo_initialize (LibreOfficeKit* pThis, const char* pInstallPath); +static LibreOfficeKitDocument* lo_documentLoad (LibreOfficeKit* pThis, const char* pURL); +static char * lo_getError (LibreOfficeKit* pThis); -struct LibLibreOffice_Impl : public _LibreOffice +struct LibLibreOffice_Impl : public _LibreOfficeKit { OUString maLastExceptionMsg; LibLibreOffice_Impl() { - nSize = sizeof(LibreOfficeDocument); + nSize = sizeof(LibreOfficeKitDocument); destroy = lo_destroy; initialize = lo_initialize; @@ -199,7 +199,7 @@ static uno::Reference<css::uno::XComponentContext> xContext; static uno::Reference<css::lang::XMultiServiceFactory> xSFactory; static uno::Reference<css::lang::XMultiComponentFactory> xFactory; -static LibreOfficeDocument* lo_documentLoad(LibreOffice* pThis, const char* pURL) +static LibreOfficeKitDocument* lo_documentLoad(LibreOfficeKit* pThis, const char* pURL) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); @@ -230,12 +230,12 @@ static LibreOfficeDocument* lo_documentLoad(LibreOffice* pThis, const char* pURL return NULL; } -static int doc_saveAs(LibreOfficeDocument* pThis, const char* sUrl, const char* pFormat) +static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat) { return doc_saveAsWithOptions(pThis, sUrl, pFormat, NULL); } -static int doc_saveAsWithOptions(LibreOfficeDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) +static int doc_saveAsWithOptions(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -321,7 +321,7 @@ static int doc_saveAsWithOptions(LibreOfficeDocument* pThis, const char* sUrl, c return false; } -static char* lo_getError (LibreOffice *pThis) +static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); OString aString = OUStringToOString(pLib->maLastExceptionMsg, RTL_TEXTENCODING_UTF8); @@ -376,7 +376,7 @@ static void initialize_uno(const OUString &aAppURL) // configmgr setup ? } -static int lo_initialize(LibreOffice* pThis, const char* pAppPath) +static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) { (void) pThis; @@ -416,17 +416,17 @@ static int lo_initialize(LibreOffice* pThis, const char* pAppPath) return bInitialized; } -SAL_DLLPUBLIC_EXPORT LibreOffice *liblibreoffice_hook(void) +SAL_DLLPUBLIC_EXPORT LibreOfficeKit *liblibreoffice_hook(void) { if (!gImpl) { fprintf(stderr, "create libreoffice object\n"); gImpl = new LibLibreOffice_Impl(); } - return static_cast<LibreOffice*>(gImpl); + return static_cast<LibreOfficeKit*>(gImpl); } -static void lo_destroy(LibreOffice *pThis) +static void lo_destroy(LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); delete pLib; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 9176eba..97acbab 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -15,34 +15,34 @@ extern "C" { #endif -typedef struct _LibreOffice LibreOffice; -typedef struct _LibreOfficeDocument LibreOfficeDocument; +typedef struct _LibreOfficeKit LibreOfficeKit; +typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument; -struct _LibreOffice +struct _LibreOfficeKit { int nSize; - void (*destroy) (LibreOffice *pThis); - int (*initialize) (LibreOffice *pThis, const char *pInstallPath); - LibreOfficeDocument* (*documentLoad) (LibreOffice *pThis, const char *pURL); - char* (*getError) (LibreOffice *pThis); + void (*destroy) (LibreOfficeKit *pThis); + int (*initialize) (LibreOfficeKit *pThis, const char *pInstallPath); + LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit *pThis, const char *pURL); + char* (*getError) (LibreOfficeKit *pThis); }; -struct _LibreOfficeDocument +struct _LibreOfficeKitDocument { int nSize; - void (*destroy) (LibreOfficeDocument* pThis); - int (*saveAs) (LibreOfficeDocument* pThis, + void (*destroy) (LibreOfficeKitDocument* pThis); + int (*saveAs) (LibreOfficeKitDocument* pThis, const char *pUrl, const char *pFormat); - int (*saveAsWithOptions) (LibreOfficeDocument* pThis, + int (*saveAsWithOptions) (LibreOfficeKitDocument* pThis, const char *pUrl, const char *pFormat, const char *pFilterOptions); }; -LibreOffice* lo_init (const char* pInstallPath); +LibreOfficeKit* lok_init (const char* pInstallPath); #ifdef __cplusplus } diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index d689e4b..de8224c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -22,10 +22,10 @@ class LODocument { private: - LibreOfficeDocument* mpDoc; + LibreOfficeKitDocument* mpDoc; public: - inline LODocument(LibreOfficeDocument* pDoc) : + inline LODocument(LibreOfficeKitDocument* pDoc) : mpDoc(pDoc) {} @@ -53,10 +53,10 @@ public: class LibLibreOffice { private: - LibreOffice* mpThis; + LibreOfficeKit* mpThis; public: - inline LibLibreOffice(LibreOffice* pThis) : + inline LibLibreOffice(LibreOfficeKit* pThis) : mpThis(pThis) {} @@ -72,7 +72,7 @@ public: inline LODocument* documentLoad(const char* pUrl) { - LibreOfficeDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); + LibreOfficeKitDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); if (pDoc == NULL) return NULL; return new LODocument(pDoc); @@ -87,7 +87,7 @@ public: inline LibLibreOffice* lo_cpp_init(const char* pInstallPath) { - LibreOffice* pThis = lo_init(pInstallPath); + LibreOfficeKit* pThis = lok_init(pInstallPath); if (pThis == NULL || pThis->nSize == 0) return NULL; return new LibLibreOffice(pThis); diff --git a/libreofficekit/source/shim.c b/libreofficekit/source/shim.c index e863dd5..325695f 100644 --- a/libreofficekit/source/shim.c +++ b/libreofficekit/source/shim.c @@ -23,9 +23,9 @@ #define TARGET_LIB SAL_MODULENAME( "sofficeapp" ) -typedef LibreOffice *(HookFunction)(void); +typedef LibreOfficeKit *(HookFunction)(void); -SAL_DLLPUBLIC_EXPORT LibreOffice *lo_init( const char *install_path ) +SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path ) { char *imp_lib; void *dlhandle; commit 7d210d6b32dc28bb2725983ffb66d8f153299c01 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Mon Jun 9 11:33:25 2014 +0100 Move liblibreoffice into LibreOfficeKit. Conflicts: include/LibreOfficeKit/LibreOfficeKit.hxx Change-Id: Ib2754a77be470faaa6f9b27644a1d8dd082ed2b8 diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index bc456b9..86ddf1f 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -69,6 +69,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ jvmaccess \ jvmfwk \ librelogo \ + libreofficekit \ lingucomponent \ linguistic \ lotuswordpro \ diff --git a/desktop/Library_libreoffice.mk b/desktop/Library_libreoffice.mk deleted file mode 100644 index dbdf6ac..0000000 --- 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 584b70d..cfaf0d9 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/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0fcbc5f..bbcac7f 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/inc/liblibreoffice.h b/include/LibreOfficeKit/LibreOfficeKit.h similarity index 93% rename from desktop/inc/liblibreoffice.h rename to include/LibreOfficeKit/LibreOfficeKit.h index 87111c4..9176eba 100644 --- a/desktop/inc/liblibreoffice.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -7,8 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_H -#define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_H +#ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H +#define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H #ifdef __cplusplus extern "C" diff --git a/desktop/inc/liblibreoffice.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx similarity index 94% rename from desktop/inc/liblibreoffice.hxx rename to include/LibreOfficeKit/LibreOfficeKit.hxx index 3afdc4b..d689e4b 100644 --- a/desktop/inc/liblibreoffice.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -7,10 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_HXX -#define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_HXX +#ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_HXX +#define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_HXX -#include <liblibreoffice.h> +#include "LibreOfficeKit.h" /* * The reasons this C++ code is not as pretty as it could be are: diff --git a/libreofficekit/Library_libreofficekit.mk b/libreofficekit/Library_libreofficekit.mk new file mode 100644 index 0000000..b0699ff --- /dev/null +++ b/libreofficekit/Library_libreofficekit.mk @@ -0,0 +1,31 @@ +# -*- 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,libreofficekit)) + +$(eval $(call gb_StaticLibrary_set_include,libreofficekit,\ + $$(INCLUDE) \ +)) + +$(eval $(call gb_StaticLibrary_add_libs,libreofficekit,\ + $(if $(filter $(OS),LINUX), \ + -ldl \ + -lpthread \ + ) \ +)) + +$(eval $(call gb_StaticLibrary_use_libraries,libreofficekit,\ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_StaticLibrary_add_cobjects,libreofficekit,\ + libreofficekit/source/shim \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/libreofficekit/Makefile b/libreofficekit/Makefile new file mode 100644 index 0000000..0997e62 --- /dev/null +++ b/libreofficekit/Makefile @@ -0,0 +1,14 @@ +# -*- 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/. +# + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk new file mode 100644 index 0000000..d78a9c3 --- /dev/null +++ b/libreofficekit/Module_libreofficekit.mk @@ -0,0 +1,18 @@ +# -*- 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_Module_Module,libreofficekit)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Module_add_targets,libreofficekit,\ + Library_libreofficekit \ +)) +endif + +# vim: set ts=4 sw=4 et: diff --git a/desktop/source/lib/shim.c b/libreofficekit/source/shim.c similarity index 97% rename from desktop/source/lib/shim.c rename to libreofficekit/source/shim.c index 7115c6e..e863dd5 100644 --- a/desktop/source/lib/shim.c +++ b/libreofficekit/source/shim.c @@ -14,7 +14,7 @@ #include <osl/module.h> #include <sal/types.h> -#include <liblibreoffice.h> +#include <LibreOfficeKit/LibreOfficeKit.h> #include <dlfcn.h> #ifdef AIX diff --git a/smoketest/Executable_libtest.mk b/smoketest/Executable_libtest.mk index 9f965b6..881e604 100644 --- a/smoketest/Executable_libtest.mk +++ b/smoketest/Executable_libtest.mk @@ -11,7 +11,6 @@ $(eval $(call gb_Executable_Executable,libtest)) $(eval $(call gb_Executable_set_include,libtest,\ $$(INCLUDE) \ - -I$(SRCDIR)/desktop/inc \ )) $(eval $(call gb_Executable_use_libraries,libtest,\ @@ -19,7 +18,7 @@ $(eval $(call gb_Executable_use_libraries,libtest,\ )) $(eval $(call gb_Executable_use_static_libraries,libtest,\ - libreoffice \ + libreofficekit \ )) $(eval $(call gb_Executable_add_libs,libtest,\ diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index e1e7970..ca1f89c 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -13,7 +13,7 @@ #include <assert.h> #include <math.h> #include <sys/time.h> -#include <liblibreoffice.hxx> +#include <LibreOfficeKit/LibreOfficeKit.hxx> long getTimeMS() { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits