summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-05-07 16:05:48 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-05-15 09:37:37 +0100
commit2941e5b354080a8e744676d88ad2849306c3d229 (patch)
treee78e997bf389db6c323e7f062d10f4087dedeea4 /svx
parent4a816a816e8b4e213394898bd0e307dd90fcbb64 (diff)
start of dynamic gallery building.
Change-Id: I488def80e855624ffd85a0b6c4cc19819c39ed01
Diffstat (limited to 'svx')
-rw-r--r--svx/source/gengal/gengal.cxx61
-rwxr-xr-x[-rw-r--r--]svx/source/gengal/gengal.sh0
2 files changed, 36 insertions, 25 deletions
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index 204bbed77c1c..74434a0f78e3 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -41,7 +41,9 @@ typedef ::std::list<OUString> FileNameList;
class GalApp : public Application
{
+ bool mbInBuildTree;
public:
+ GalApp() : mbInBuildTree( false ) {}
virtual int Main();
protected:
@@ -141,6 +143,7 @@ static int PrintHelp()
fprintf( stdout, "\t\t\ttheme files.\n");
fprintf( stdout, " files\t\t\tlists files to be added to the gallery. Absolute paths\n");
fprintf( stdout, "\t\t\tare required.\n");
+ // --build-tree not documented - only useful during the build ...
return EXIT_SUCCESS;
}
@@ -154,37 +157,43 @@ static OUString Smartify( const OUString &rPath )
void GalApp::Init()
{
- if( getenv( "OOO_INSTALL_PREFIX" ) == NULL ) {
- OUString fileName = GetAppFileName();
- int lastSlash = fileName.lastIndexOf( '/' );
+ try {
+ if( !mbInBuildTree && getenv( "OOO_INSTALL_PREFIX" ) == NULL ) {
+ OUString fileName = GetAppFileName();
+ int lastSlash = fileName.lastIndexOf( '/' );
#ifdef WNT
// Don't know which directory separators GetAppFileName() returns on Windows.
// Be safe and take into consideration they might be backslashes.
- if( fileName.lastIndexOf( '\\' ) > lastSlash )
- lastSlash = fileName.lastIndexOf( '\\' );
+ if( fileName.lastIndexOf( '\\' ) > lastSlash )
+ lastSlash = fileName.lastIndexOf( '\\' );
#endif
- OUString baseBinDir = fileName.copy( 0, lastSlash );
- OUString installPrefix = baseBinDir + OUString::createFromAscii( "/../.." );
-
- OUString envVar( "OOO_INSTALL_PREFIX");
- osl_setEnvironment(envVar.pData, installPrefix.pData);
- }
- OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
-
- uno::Reference<uno::XComponentContext> xComponentContext
- = ::cppu::defaultBootstrap_InitialComponentContext();
- xMSF = uno::Reference<lang::XMultiServiceFactory>
- ( xComponentContext->getServiceManager(), uno::UNO_QUERY );
- if( !xMSF.is() )
- {
- fprintf( stderr, "Failed to bootstrap\n" );
+ OUString baseBinDir = fileName.copy( 0, lastSlash );
+ OUString installPrefix = baseBinDir + OUString::createFromAscii( "/../.." );
+
+ OUString envVar( "OOO_INSTALL_PREFIX");
+ osl_setEnvironment(envVar.pData, installPrefix.pData);
+ }
+ OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
+
+ uno::Reference<uno::XComponentContext> xComponentContext
+ = ::cppu::defaultBootstrap_InitialComponentContext();
+ xMSF = uno::Reference<lang::XMultiServiceFactory>
+ ( xComponentContext->getServiceManager(), uno::UNO_QUERY );
+ if( !xMSF.is() )
+ {
+ fprintf( stderr, "Failed to bootstrap\n" );
+ exit( 1 );
+ }
+ ::comphelper::setProcessServiceFactory( xMSF );
+
+ // For backwards compatibility, in case some code still uses plain
+ // createInstance w/o args directly to obtain an instance:
+ com::sun::star::ucb::UniversalContentBroker::create(xComponentContext);
+ } catch (const uno::Exception &e) {
+ fprintf( stderr, "Bootstrap exception '%s'\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
exit( 1 );
}
- ::comphelper::setProcessServiceFactory( xMSF );
-
- // For backwards compatibility, in case some code still uses plain
- // createInstance w/o args directly to obtain an instance:
- com::sun::star::ucb::UniversalContentBroker::create(xComponentContext);
}
int GalApp::Main()
@@ -202,6 +211,8 @@ int GalApp::Main()
continue;
else if ( aParam == "--help" || aParam == "-h" )
return PrintHelp();
+ else if ( aParam == "--build-tree" )
+ mbInBuildTree = true;
else if ( aParam == "--name" )
aName = GetCommandLineParam( ++i );
else if ( aParam == "--path" )
diff --git a/svx/source/gengal/gengal.sh b/svx/source/gengal/gengal.sh
index 0ac61cf819ee..0ac61cf819ee 100644..100755
--- a/svx/source/gengal/gengal.sh
+++ b/svx/source/gengal/gengal.sh