diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-03-05 16:40:01 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-03-12 15:35:34 +0000 |
commit | af969873cb01e44aacfa34623ce1f0d51a62c895 (patch) | |
tree | 56436156bed18c9cc678687a29f6b5cdd5b5e495 /desktop | |
parent | 07352f07ce40ef40e9b73fd05aa4f9c5eac38290 (diff) |
liblibo: better init code.
Change-Id: I8757739960cb1c764a5a66bd67d34731e3dfbf31
Diffstat (limited to 'desktop')
-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 |
4 files changed, 16 insertions, 16 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(); } |