desktop/source/lib/init.cxx | 8 +++++--- smoketest/libtest.cxx | 9 +++++++++ vcl/inc/vcl/svapp.hxx | 5 ++--- vcl/source/app/svapp.cxx | 2 +- vcl/unx/generic/plugadapt/salplug.cxx | 30 +++++++++++------------------- 5 files changed, 28 insertions(+), 26 deletions(-)
New commits: commit 38512f608684b8fc726f056fc10783e9cdd61727 Author: Michael Meeks <michael.me...@suse.com> Date: Thu Mar 7 20:14:37 2013 +0000 liblibo: more debugging, and make it headless. Change-Id: If214690bd752a7ffafcfdc3f108130b7782f9bec diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c26c995..06f5eac 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -132,13 +132,15 @@ LibLibreOffice_Impl::initialize( const char *app_path ) try { initialize_uno( aAppURL ); force_c_locale(); + + // Force headless + rtl::Bootstrap::set( "SAL_USE_VCLPLUGIN", "svp" ); InitVCL(); - if (Application::IsHeadlessModeRequested()) - Application::EnableHeadlessMode(true); + Application::EnableHeadlessMode(true); ErrorHandler::RegisterDisplay( aBasicErrorFunc ); - fprintf (stderr, "do nothing yet"); + fprintf( stderr, "initialized\n" ); bInitialized = true; } catch (css::uno::Exception & e) { fprintf( stderr, "bootstrapping exception '%s'\n", diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index 86e2abc..f3d207f 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <stdio.h> #include <assert.h> #include <liblibreoffice.hxx> @@ -19,10 +20,18 @@ int main (int argc, char **argv) return -1; // This separate init is lame I think. if( !pOffice->initialize( argv[1] ) ) + { + fprintf( stderr, "failed to initialize\n" ); return -1; + } + fprintf( stderr, "start to load document '%s'\n", argv[2] ); LODocument *pDocument = pOffice->documentLoad( argv[2] ); if( !pDocument ) + { + fprintf( stderr, "failed to load document '%s'\n", argv[2] ); return -1; + } + fprintf( stderr, "all tests passed." ); return 0; } diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index e3e0779..159ed14 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -334,9 +334,8 @@ public: static const Link& GetFilterHdl(); static void EnableHeadlessMode( bool dialogsAreFatal ); - static sal_Bool IsHeadlessModeEnabled(); - - static bool IsHeadlessModeRequested(); + static sal_Bool IsHeadlessModeEnabled(); + static bool IsHeadlessModeRequested(); ///< check command line arguments for --headless static void ShowNativeErrorBox(const String& sTitle , diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 90166eb..bcb8774 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1754,7 +1754,7 @@ bool Application::IsHeadlessModeRequested() for (sal_uInt32 i = 0; i < n; ++i) { rtl::OUString arg; rtl_getAppCommandArg(i, &arg.pData); - if ( arg == "--headless" ) { + if ( arg == "--headless" || arg == "-headless" ) { return true; } } diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 87a5c05..a8809e4 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -21,6 +21,7 @@ #include "osl/process.h" #include "rtl/ustrbuf.hxx" +#include "rtl/bootstrap.hxx" #include "salinst.hxx" #include "generic/gensys.h" @@ -199,31 +200,22 @@ static SalInstance* autodetect_plugin() return pInst; } -static SalInstance* check_headless_plugin() -{ - int nParams = osl_getCommandArgCount(); - OUString aParam; - for( int i = 0; i < nParams; i++ ) - { - osl_getCommandArg( i, &aParam.pData ); - if( aParam == "-headless" || aParam == "--headless" ) - { - return tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "svp" ) ) ); - } - } - return NULL; -} - SalInstance *CreateSalInstance() { - SalInstance* pInst = NULL; + SalInstance *pInst = NULL; + OUString aUsePlugin; static const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" ); + if( pUsePlugin ) + aUsePlugin = OUString::createFromAscii( pUsePlugin ); + else + rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin ); - pInst = check_headless_plugin(); + if( Application::IsHeadlessModeRequested() ) + aUsePlugin = "svp"; - if( !pInst && pUsePlugin && *pUsePlugin ) - pInst = tryInstance( OUString::createFromAscii( pUsePlugin ), true ); + if( !aUsePlugin.isEmpty() ) + pInst = tryInstance( aUsePlugin ); if( ! pInst ) pInst = autodetect_plugin(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits