View | Details | Raw Unified | Return to issue 66426
Collapse All | Expand All

(-)desktop/source/splash/makefile.mk (+2 lines)
Lines 47-52 ENABLE_EXCEPTIONS=TRUE Link Here
47
47
48
# --- Files --------------------------------------------------------
48
# --- Files --------------------------------------------------------
49
49
50
CFLAGS += -DINTRO_BITMAP_NAMES=\"$(INTRO_BITMAP_NAMES)\"
51
50
SLOFILES =	$(SLO)$/splash.obj \
52
SLOFILES =	$(SLO)$/splash.obj \
51
            $(SLO)$/firststart.obj \
53
            $(SLO)$/firststart.obj \
52
            $(SLO)$/services_spl.obj
54
            $(SLO)$/services_spl.obj
(-)desktop/source/splash/splash.cxx (-38 / +55 lines)
Lines 374-379 void SplashScreen::loadConfig() Link Here
374
    }
374
    }
375
}
375
}
376
376
377
bool impl_loadBitmap( const rtl::OUString &rBmpFileName, const rtl::OUString &rExecutePath, Bitmap &rIntroBmp )
378
{
379
    if ( rBmpFileName.getLength() == 0 )
380
        return false;
381
382
    // First, try to use custom bitmap data.
383
    rtl::OUString value;
384
    rtl::Bootstrap::get(
385
            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomDataUrl" ) ), value );
386
    if ( value.getLength() > 0 )
387
    {
388
        if ( value[ value.getLength() - 1 ] != sal_Unicode( '/' ) )
389
            value += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program" ) );
390
        else
391
            value += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "program" ) );
392
393
        INetURLObject aObj( value, INET_PROT_FILE );
394
        aObj.insertName( rBmpFileName );
395
396
        SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
397
        if ( !aStrm.GetError() )
398
        {
399
            // Default case, we load the intro bitmap from a seperate file
400
            // (e.g. staroffice_intro.bmp or starsuite_intro.bmp)
401
            aStrm >> rIntroBmp;
402
            return true;
403
        }
404
    }
405
406
    // Then, try to use bitmap located in the same directory as the executable.
407
    INetURLObject aObj( rExecutePath, INET_PROT_FILE );
408
    aObj.insertName( rBmpFileName );
409
410
    SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
411
    if ( !aStrm.GetError() )
412
    {
413
        // Default case, we load the intro bitmap from a seperate file
414
        // (e.g. staroffice_intro.bmp or starsuite_intro.bmp)
415
        aStrm >> rIntroBmp;
416
        return true;
417
    }
418
419
    return false;
420
}
421
377
void SplashScreen::initBitmap()
422
void SplashScreen::initBitmap()
378
{
423
{
379
    rtl::OUString aLogo( RTL_CONSTASCII_USTRINGPARAM( "1" ) );
424
    rtl::OUString aLogo( RTL_CONSTASCII_USTRINGPARAM( "1" ) );
Lines 382-430 void SplashScreen::initBitmap() Link Here
382
427
383
	if ( bShowLogo )
428
	if ( bShowLogo )
384
	{
429
	{
385
		xub_StrLen nIndex = 0;
386
        String aBmpFileName( UniString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp")) );
387
388
        bool haveBitmap = false;
430
        bool haveBitmap = false;
431
        rtl::OUString aIntros( RTL_CONSTASCII_USTRINGPARAM( INTRO_BITMAP_NAMES ) );
389
432
390
        // First, try to use custom bitmap data.
433
        // Try all bitmaps in INTRO_BITMAP_NAMES
391
        rtl::OUString value;
434
        sal_Int32 nIndex = 0;
392
        rtl::Bootstrap::get(
435
        do {
393
            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomDataUrl" ) ), value );
436
            haveBitmap = impl_loadBitmap( aIntros.getToken( 0, ',', nIndex ),
394
        if ( value.getLength() > 0 )
437
                                          _sExecutePath, _aIntroBmp );
395
        {
438
        } while ( !haveBitmap && ( nIndex >= 0 ) );
396
            if ( value[ value.getLength() - 1 ] != sal_Unicode( '/' ) )
397
                value += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program" ) );
398
            else
399
                value += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "program" ) );
400
401
            INetURLObject aObj( value, INET_PROT_FILE );
402
            aObj.insertName( aBmpFileName );
403
404
            SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
405
            if ( !aStrm.GetError() )
406
            {
407
                // Default case, we load the intro bitmap from a seperate file
408
                // (e.g. staroffice_intro.bmp or starsuite_intro.bmp)
409
                aStrm >> _aIntroBmp;
410
                haveBitmap = true;
411
            }
412
        }
413
439
414
        // Then, try to use bitmap located in the same directory as the executable.
440
        // Failed?  Try intro.bmp...
415
        if ( !haveBitmap )
441
        if ( !haveBitmap )
416
        {
442
        {
417
            INetURLObject aObj( _sExecutePath, INET_PROT_FILE );
443
            haveBitmap = impl_loadBitmap( rtl::OUString::createFromAscii( "intro.bmp" ),
418
            aObj.insertName( aBmpFileName );
444
                                          _sExecutePath, _aIntroBmp );
419
420
            SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
421
            if ( !aStrm.GetError() )
422
            {
423
                // Default case, we load the intro bitmap from a seperate file
424
                // (e.g. staroffice_intro.bmp or starsuite_intro.bmp)
425
                aStrm >> _aIntroBmp;
426
                haveBitmap = true;
427
            }
428
        }
445
        }
429
446
430
        if ( !haveBitmap )
447
        if ( !haveBitmap )

Return to issue 66426