diff options
-rw-r--r-- | desktop/inc/liblibreoffice.hxx | 5 | ||||
-rw-r--r-- | desktop/inc/liblibreoffice_impl.hxx | 7 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 17 | ||||
-rw-r--r-- | desktop/source/lib/shim.cxx | 3 | ||||
-rw-r--r-- | smoketest/CppunitTest_liblibreoffice.mk | 17 | ||||
-rw-r--r-- | smoketest/libtest.cxx | 6 |
6 files changed, 23 insertions, 32 deletions
diff --git a/desktop/inc/liblibreoffice.hxx b/desktop/inc/liblibreoffice.hxx index 74f6769944e4..48c0a24edbc0 100644 --- a/desktop/inc/liblibreoffice.hxx +++ b/desktop/inc/liblibreoffice.hxx @@ -10,16 +10,15 @@ #ifndef _LIBLIBREOFFICE_HXX #define _LIBLIBREOFFICE_HXX -typedef int loboolean; typedef struct _LODocument LODocument; class LibLibreOffice { public: - virtual loboolean initialize (const char *installPath) = 0; + virtual bool initialize (const char *installPath) = 0; virtual LODocument *documentLoad (const char *url) = 0; - virtual loboolean documentSave (const char *url) = 0; + virtual bool documentSave (const char *url) = 0; virtual ~LibLibreOffice () {}; }; diff --git a/desktop/inc/liblibreoffice_impl.hxx b/desktop/inc/liblibreoffice_impl.hxx index d7686eb1dbdf..3f7783ec4d67 100644 --- a/desktop/inc/liblibreoffice_impl.hxx +++ b/desktop/inc/liblibreoffice_impl.hxx @@ -12,16 +12,13 @@ #include "liblibreoffice.hxx" -typedef int loboolean; -typedef struct _LODocument LODocument; - class LibLibreOffice_Impl : public LibLibreOffice { public: - virtual loboolean initialize (const char *installPath); + virtual bool initialize (const char *installPath); virtual LODocument *documentLoad (const char *url); - virtual loboolean documentSave (const char *url); + virtual bool documentSave (const char *url); virtual ~LibLibreOffice_Impl (); }; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4b47ac6a498a..0628b7f8f7e3 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -42,7 +42,7 @@ LibLibreOffice_Impl::documentLoad( const char *docUrl ) return NULL; } -loboolean +bool LibLibreOffice_Impl::documentSave( const char * ) { return 1; @@ -73,16 +73,18 @@ aBasicErrorFunc( const OUString &rErr, const OUString &rAction ) static void initialize_uno( const rtl::OUString &aUserProfileURL ) { + xContext = cppu::defaultBootstrap_InitialComponentContext(); + fprintf( stderr, "Uno initialized %d\n", xContext.is() ); + xFactory = xContext->getServiceManager(); + xSFactory = uno::Reference<lang::XMultiServiceFactory>(xFactory, uno::UNO_QUERY_THROW); + comphelper::setProcessServiceFactory(xSFactory); + // set UserInstallation to user profile dir in test/user-template rtl::Bootstrap aDefaultVars; aDefaultVars.set(rtl::OUString("UserInstallation"), aUserProfileURL ); - - xContext = comphelper::getProcessComponentContext(); - xFactory = xContext->getServiceManager(); - xSFactory = uno::Reference<lang::XMultiServiceFactory>(xFactory, uno::UNO_QUERY_THROW); } -loboolean +bool LibLibreOffice_Impl::initialize( const char *app_path ) { static bool bInitialized = false; @@ -122,6 +124,7 @@ extern "C" { LibLibreOffice *liblibreoffice_hook(void) { + fprintf( stderr, "create libreoffice object\n" ); return new LibLibreOffice_Impl(); } diff --git a/desktop/source/lib/shim.cxx b/desktop/source/lib/shim.cxx index 4c8e61d93a27..546d0da99ff0 100644 --- a/desktop/source/lib/shim.cxx +++ b/desktop/source/lib/shim.cxx @@ -41,13 +41,14 @@ SAL_DLLPUBLIC_EXPORT LibLibreOffice *lo_init( const char *install_path ) fprintf( stderr, "failed to open library '%s'\n", imp_lib ); return NULL; } - free( imp_lib ); HookFunction *pSym = (HookFunction *) dlsym( dlhandle, "liblibreoffice_hook" ); if( !pSym ) { fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib ); return NULL; } + + free( imp_lib ); return pSym(); } diff --git a/smoketest/CppunitTest_liblibreoffice.mk b/smoketest/CppunitTest_liblibreoffice.mk index 2cd345633d33..8755fe8a286d 100644 --- a/smoketest/CppunitTest_liblibreoffice.mk +++ b/smoketest/CppunitTest_liblibreoffice.mk @@ -15,29 +15,16 @@ $(eval $(call gb_CppunitTest_add_exception_objects,liblibreoffice,\ smoketest/libtest \ )) -$(eval $(call gb_CppunitTest_use_external,liblibreoffice,boost_headers)) - -$(eval $(call gb_CppunitTest_use_api,liblibreoffice,\ - offapi \ - udkapi \ -)) - $(eval $(call gb_CppunitTest_use_libraries,liblibreoffice,\ - cppu \ - cppuhelper \ libreoffice \ - sal \ - unotest \ )) ifeq ($(OS),MACOSX) -liblibreoffice_SOFFICE_INST := path:$(DEVINSTALLDIR)/opt/LibreOffice.app/Contents/MacOS +liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/LibreOffice.app/Contents/MacOS else -liblibreoffice_SOFFICE_INST := path:$(DEVINSTALLDIR)/opt/program +liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/program endif -$(eval $(call gb_CppunitTest_use_ure,liblibreoffice)) - $(eval $(call gb_CppunitTest_add_arguments,liblibreoffice,\ -env:arg-soffice=$(liblibreoffice_SOFFICE_INST) \ )) diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index 36c3a0c1e070..cc71d0814f80 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -46,7 +46,11 @@ void Test::test() rtl::Bootstrap::get( rtl::OUString( "arg-soffice" ), aArgSoffice ); OString aInstall = OUStringToOString( aArgSoffice, RTL_TEXTENCODING_UTF8 ); fprintf( stderr, "liblibreoffice test: '%s'\n", aInstall.getStr() ); - assert (lo_init( aInstall.getStr() )); + LibLibreOffice *pOffice = lo_init( aInstall.getStr() ); + CPPUNIT_ASSERT( pOffice != NULL ); + + bool bInited = pOffice->initialize( aInstall.getStr() ); + CPPUNIT_ASSERT( bInited ); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); |