desktop/inc/liblibreoffice.hxx | 5 ++--- desktop/inc/liblibreoffice_impl.hxx | 7 ++----- desktop/source/lib/init.cxx | 22 +++++++++++++++++++--- desktop/source/lib/shim.cxx | 3 ++- smoketest/CppunitTest_liblibreoffice.mk | 17 ++--------------- smoketest/libtest.cxx | 6 +++++- 6 files changed, 32 insertions(+), 28 deletions(-)
New commits: commit 94a2596446bfdd9bddc3590b6e81c0e9052b7325 Author: Jack Leigh <[email protected]> Date: Tue Mar 5 14:29:26 2013 +0000 liblibo: create XComponent for doc Change-Id: Ie07ac4a3e89a9a82a107612b81be18d3826c49e1 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index eb85bcb..ce7632f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -13,11 +13,14 @@ #include <tools/errinf.hxx> #include <osl/file.hxx> +#include <osl/process.h> #include <rtl/strbuf.hxx> #include <rtl/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -39,6 +42,19 @@ static uno::Reference<css::lang::XMultiComponentFactory> xFactory; LODocument * LibLibreOffice_Impl::documentLoad( const char *docUrl ) { + OUString sUrl = OUString::createFromAscii (docUrl); + OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl; + + uno::Reference < css::frame::XDesktop2 > xComponentLoader = + css::frame::Desktop::create(xContext); + + osl_getProcessWorkingDir(&sWorkingDir.pData); + osl::FileBase::getFileURLFromSystemPath(sUrl, sDocPathUrl); + osl::FileBase::getAbsoluteFileURL(sWorkingDir, sDocPathUrl, sAbsoluteDocUrl); + + uno::Reference < css::lang::XComponent > xComponent = xComponentLoader->loadComponentFromURL( + sAbsoluteDocUrl, OUString("_blank"), 0, + uno::Sequence < css::beans::PropertyValue >()); return NULL; } @@ -131,4 +147,3 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl () } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - commit 0dce100c3b4255a959dc3ad957b86956a5bf22ce Author: Michael Meeks <[email protected]> Date: Tue Mar 5 16:40:01 2013 +0000 liblibo: misc. cleanup Change-Id: I40fc77f2a7a0fd01d3cec94a8b630dddc4637baf diff --git a/desktop/inc/liblibreoffice.hxx b/desktop/inc/liblibreoffice.hxx index 74f6769..48c0a24 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 d7686eb..3f7783e 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 4b47ac6..eb85bcb 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -42,7 +42,7 @@ LibLibreOffice_Impl::documentLoad( const char *docUrl ) return NULL; } -loboolean +bool LibLibreOffice_Impl::documentSave( const char * ) { return 1; @@ -82,7 +82,7 @@ initialize_uno( const rtl::OUString &aUserProfileURL ) 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 +122,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 4c8e61d..546d0da 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 2cd3456..8755fe8 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 36c3a0c..cc71d08 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); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
