[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/source

2013-03-07 Thread Michael Meeks
 desktop/source/lib/init.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit e1aefb4d5c2de12ec37e6172733379a8209511a8
Author: Michael Meeks michael.me...@suse.com
Date:   Thu Mar 7 13:43:21 2013 +

liblibo: loads a document, then exits - funky.

Change-Id: I2520e3223e9cb30627ec5691bd5c54ac67c3159e

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fc25403..c26c995 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -91,6 +91,16 @@ initialize_uno( const rtl::OUString aAppURL )
 {
 rtl::Bootstrap::setIniFilename( aAppURL + /fundamentalrc );
 
+OUString aValue;
+rtl::Bootstrap::set( CONFIGURATION_LAYERS,
+ xcsxcu:${BRAND_BASE_DIR}/share/registry 
+ res:${BRAND_BASE_DIR}/share/registry 
+//   
bundledext:${${BRAND_BASE_DIR}/program/unorc:BUNDLED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini
  );
+//   
sharedext:${${BRAND_BASE_DIR}/program/unorc:SHARED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini
 
+//   
userext:${${BRAND_BASE_DIR}/program/unorc:UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini
 
+// 
user:${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/registrymodifications.xcu
+ );
+
 xContext = cppu::defaultBootstrap_InitialComponentContext();
 fprintf( stderr, Uno initialized %d\n, xContext.is() );
 xFactory = xContext-getServiceManager();
@@ -98,8 +108,8 @@ initialize_uno( const rtl::OUString aAppURL )
 comphelper::setProcessServiceFactory(xSFactory);
 
 // set UserInstallation to user profile dir in test/user-template
-rtl::Bootstrap aDefaultVars;
-aDefaultVars.set(rtl::OUString(UserInstallation), aAppURL + 
../registry );
+//rtl::Bootstrap aDefaultVars;
+//aDefaultVars.set(rtl::OUString(UserInstallation), aAppURL + 
../registry );
 // configmgr setup ?
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/source smoketest/libtest.cxx vcl/inc vcl/source vcl/unx

2013-03-07 Thread Michael Meeks
 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 +

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 )
 

[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/source

2013-03-06 Thread Michael Meeks
 desktop/source/lib/init.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit e4a160d1a72e8652e204bb45a488ba6ace8f8039
Author: Michael Meeks michael.me...@suse.com
Date:   Wed Mar 6 19:02:14 2013 +

liblibo: get fundamentalrc setup right - bootstrapping a little further.

Change-Id: I42d5ff32c2a3b721689676f5295e148c3364518d

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index de5788d..fc25403 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -87,8 +87,10 @@ aBasicErrorFunc( const OUString rErr, const OUString 
rAction )
 }
 
 static void
-initialize_uno( const rtl::OUString aUserProfileURL )
+initialize_uno( const rtl::OUString aAppURL )
 {
+rtl::Bootstrap::setIniFilename( aAppURL + /fundamentalrc );
+
 xContext = cppu::defaultBootstrap_InitialComponentContext();
 fprintf( stderr, Uno initialized %d\n, xContext.is() );
 xFactory = xContext-getServiceManager();
@@ -97,7 +99,8 @@ initialize_uno( const rtl::OUString aUserProfileURL )
 
 // set UserInstallation to user profile dir in test/user-template
 rtl::Bootstrap aDefaultVars;
-aDefaultVars.set(rtl::OUString(UserInstallation), aUserProfileURL );
+aDefaultVars.set(rtl::OUString(UserInstallation), aAppURL + 
../registry );
+// configmgr setup ?
 }
 
 bool
@@ -117,7 +120,7 @@ LibLibreOffice_Impl::initialize( const char *app_path )
 return false;
 
 try {
-initialize_uno( aAppURL + ../registry );
+initialize_uno( aAppURL );
 force_c_locale();
 InitVCL();
 if (Application::IsHeadlessModeRequested())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/source

2013-03-05 Thread Michael Meeks
 desktop/source/lib/init.cxx |   90 
 1 file changed, 82 insertions(+), 8 deletions(-)

New commits:
commit 7f141a511f5e25be12a8df416980ef0ad8d5641a
Author: Michael Meeks michael.me...@suse.com
Date:   Tue Mar 5 13:30:51 2013 +

liblibo: start of initial bootstrapping.

Change-Id: I929888b1f4ebacff348a55afa3c992a9c9e9e9a2

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d3c2e98..cd8ce9f 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.
  *
@@ -8,8 +8,31 @@
  */
 
 #include stdio.h
+
 #include liblibreoffice.h
+#include tools/errinf.hxx
+#include rtl/strbuf.hxx
+#include rtl/bootstrap.hxx
+#include cppuhelper/bootstrap.hxx
+#include comphelper/processfactory.hxx
+
+#include com/sun/star/lang/Locale.hpp
+#include com/sun/star/lang/XComponent.hpp
+#include com/sun/star/lang/XMultiServiceFactory.hpp
+#include com/sun/star/ucb/XContentProvider.hpp
+#include com/sun/star/ucb/XUniversalContentBroker.hpp
+
+#include vcl/svapp.hxx
+#include tools/resmgr.hxx
+#include vcl/graphicfilter.hxx
+#include unotools/syslocaleoptions.hxx
 
+using namespace ::com::sun::star;
+
+// Wonder global state ...
+static uno::Referencecss::uno::XComponentContext xContext;
+static uno::Referencecss::lang::XMultiServiceFactory xSFactory;
+static uno::Referencecss::lang::XMultiComponentFactory xFactory;
 
 void lo_error_free( LOError * )
 {
@@ -17,24 +40,75 @@ void lo_error_free( LOError * )
 
 LOError *lo_error_new( int, const char * )
 {
-  return NULL;
+return NULL;
 }
 
 LODocument *
-lo_document_load (const char *, LOError ** )
+lo_document_load( const char *, LOError ** )
 {
-  return NULL;
+return NULL;
 }
 
 loboolean
-lo_document_save (const char *, LOError ** )
+lo_document_save( const char *, LOError ** )
 {
-  return 1;
+return 1;
 }
 
-void lo_initialize(const char *)
+static void
+force_c_locale( void )
 {
-  fprintf (stderr, do nothing yet);
+// force locale (and resource files loaded) to en-US
+css::lang::Locale aLocale( en, US, );
+ResMgr::SetDefaultLocale( aLocale );
+SvtSysLocaleOptions aLocalOptions;
+OUString aLangISO( en-US );
+aLocalOptions.SetLocaleConfigString( aLangISO );
+aLocalOptions.SetUILocaleConfigString( aLangISO );
+}
+
+static void
+aBasicErrorFunc( const OUString rErr, const OUString rAction )
+{
+OStringBuffer aErr( Unexpected dialog:  );
+aErr.append( OUStringToOString( rAction, RTL_TEXTENCODING_ASCII_US ) );
+aErr.append(  Error:  );
+aErr.append( OUStringToOString( rErr, RTL_TEXTENCODING_ASCII_US ) );
+fprintf( stderr, Unexpected basic error dialog '%s'\n, aErr.getStr() );
+}
+
+static void
+initialize_uno( void )
+{
+// set UserInstallation to user profile dir in test/user-template
+rtl::Bootstrap aDefaultVars;
+// madness ...
+fprintf(stderr, trying to bootstrap with no user install !\n);
+/*rtl::OUString sUserInstallURL = m_aSolverRootURL + 
rtl::OUString(/unittest);
+  aDefaultVars.set(rtl::OUString(UserInstallation), sUserInstallURL); */
+
+xContext = comphelper::getProcessComponentContext();
+xFactory = xContext-getServiceManager();
+xSFactory = uno::Referencelang::XMultiServiceFactory(xFactory, 
uno::UNO_QUERY_THROW);
+}
+
+void lo_initialize( const char * )
+{
+try {
+initialize_uno();
+force_c_locale();
+InitVCL();
+if (Application::IsHeadlessModeRequested())
+Application::EnableHeadlessMode(true);
+
+ErrorHandler::RegisterDisplay( aBasicErrorFunc );
+
+fprintf (stderr, do nothing yet);
+} catch (css::uno::Exception  e) {
+fprintf( stderr, bootstrapping exception '%s'\n,
+ OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 
).getStr() );
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/source

2013-03-05 Thread Michael Meeks
 desktop/source/lib/init.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 4fa2dc9a253d15d4503e0f9403f2fdac126e8b42
Author: Michael Meeks michael.me...@suse.com
Date:   Tue Mar 5 16:52:39 2013 +

liblibo: better init code.

Change-Id: I8757739960cb1c764a5a66bd67d34731e3dfbf31

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ce7632f..de5788d 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.
  *
@@ -89,13 +89,15 @@ 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::Referencelang::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::Referencelang::XMultiServiceFactory(xFactory, 
uno::UNO_QUERY_THROW);
 }
 
 bool
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits