From 138b9c36f7148680dd46fe71ec1aeb6b9013bb27 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 21 Mar 2011 17:42:51 +0000 Subject: misc fixes, and un-conditionally enable the splash reporting component Lots of re-work here; un-conditionally use the splash component to do more intelligent fast starting. Throw up the splash screen before we start doing 'pagein' work (to get better progress / launch feedback), and hide javaldx too. --- desktop/unx/splash/exports.map | 1 - desktop/unx/splash/makefile.mk | 20 ++-- desktop/unx/splash/services_unxsplash.cxx | 160 ------------------------------ desktop/unx/splash/unxsplash.cxx | 68 +++++++++---- desktop/unx/splash/unxsplash.hxx | 12 +-- 5 files changed, 62 insertions(+), 199 deletions(-) delete mode 100755 desktop/unx/splash/services_unxsplash.cxx (limited to 'desktop/unx/splash') diff --git a/desktop/unx/splash/exports.map b/desktop/unx/splash/exports.map index ba501f9ae076..218f0536d7e2 100755 --- a/desktop/unx/splash/exports.map +++ b/desktop/unx/splash/exports.map @@ -3,7 +3,6 @@ UDK_3_0_0 { GetVersionInfo; component_getImplementationEnvironment; component_getFactory; - component_writeInfo; local: *; diff --git a/desktop/unx/splash/makefile.mk b/desktop/unx/splash/makefile.mk index d182173de1ff..23a9d98ae5bb 100755 --- a/desktop/unx/splash/makefile.mk +++ b/desktop/unx/splash/makefile.mk @@ -36,17 +36,9 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -.IF "$(ENABLE_UNIX_QUICKSTARTER)"!="TRUE" - -dummy: - @echo "Unix quickstarter disabled" - -.ELSE - # --- Files -------------------------------------------------------- -SLOFILES = $(SLO)$/unxsplash.obj \ - $(SLO)$/services_unxsplash.obj +SLOFILES = $(SLO)$/unxsplash.obj SHL1DEPN= makefile.mk SHL1OBJS= $(SLOFILES) @@ -64,8 +56,14 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(SALLIB) -.ENDIF # ENABLE_UNIX_QUICKSTARTER - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/splash.component + +$(MISC)/splash.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + splash.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt splash.component diff --git a/desktop/unx/splash/services_unxsplash.cxx b/desktop/unx/splash/services_unxsplash.cxx deleted file mode 100755 index d370b452b4f3..000000000000 --- a/desktop/unx/splash/services_unxsplash.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * Copyright 2010, Novell Inc. - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - * Contributor(s): Jan Holesovsky - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include - -#include "unxsplash.hxx" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::registry; -using namespace ::desktop; - -using ::rtl::OUString; - -static const char* pServices[] = -{ - UnxSplashScreen::serviceName, - NULL -}; - -static const char* pImplementations[] = -{ - UnxSplashScreen::implementationName, - NULL -}; - -typedef Reference(* fProvider)( const Reference& ); - -static const fProvider pInstanceProviders[] = -{ - UnxSplashScreen::getInstance, - NULL -}; - - -static const char** pSupportedServices[] = -{ - UnxSplashScreen::interfaces, - NULL -}; - -static Sequence -getSupportedServiceNames( int p ) { - const char **names = pSupportedServices[p]; - Sequence aSeq; - for ( int i = 0; names[i] != NULL; i++ ) - { - aSeq.realloc( i+1 ); - aSeq[i] = OUString::createFromAscii( names[i] ); - } - return aSeq; -} - -extern "C" -{ -void SAL_CALL -component_getImplementationEnvironment( - const sal_Char** ppEnvironmentTypeName, - uno_Environment** /*ppEnvironment*/ ) -{ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; -} - -sal_Bool SAL_CALL -component_writeInfo( - void* pServiceManager, - void* pRegistryKey ) -{ - Reference xMan( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - Reference xKey( - reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - - // iterate over service names and register them... - OUString aImpl; - const char* pServiceName = NULL; - const char* pImplName = NULL; - for ( int i = 0; ( pServices[i] != NULL ) && ( pImplementations[i] != NULL ); i++ ) - { - pServiceName= pServices[i]; - pImplName = pImplementations[i]; - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM( "/" )) - + OUString::createFromAscii( pImplName ) - + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" )); - Reference xNewKey = xKey->createKey( aImpl ); - xNewKey->createKey( OUString::createFromAscii( pServiceName ) ); - } - return sal_True; -} - -void* SAL_CALL -component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/ ) -{ - // Set default return value for this operation - if it failed. - if ( pImplementationName && pServiceManager ) - { - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xServiceManager( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - - // search implementation - for ( int i = 0; ( pImplementations[i] != NULL ); i++ ) - { - if ( strcmp( pImplementations[i], pImplementationName ) == 0 ) - { - // found implementation - xFactory = Reference( cppu::createSingleFactory( - xServiceManager, OUString::createFromAscii( pImplementationName ), - pInstanceProviders[i], getSupportedServiceNames( i ) ) ); - if ( xFactory.is() ) - { - // Factory is valid - service was found. - xFactory->acquire(); - return xFactory.get(); - } - } - } - } - - return NULL; -} -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/unx/splash/unxsplash.cxx b/desktop/unx/splash/unxsplash.cxx index f51e22a7c13a..de703ba5c3de 100755 --- a/desktop/unx/splash/unxsplash.cxx +++ b/desktop/unx/splash/unxsplash.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -41,13 +42,13 @@ #define PIPE_ARG "--splash-pipe=" using namespace ::rtl; +using namespace ::com::sun::star; using namespace ::com::sun::star::registry; namespace desktop { - -UnxSplashScreen::UnxSplashScreen( const Reference< XMultiServiceFactory >& rSMgr ) - : m_rFactory( rSMgr ), + UnxSplashScreen::UnxSplashScreen( const Reference< uno::XComponentContext >& xCtx ) + : m_xCtx( xCtx ), m_pOutFd( NULL ) { } @@ -131,34 +132,65 @@ UnxSplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun:: } } } +} + +using namespace desktop; // get service instance... -UnxSplashScreen *UnxSplashScreen::m_pINSTANCE = NULL; -osl::Mutex UnxSplashScreen::m_aMutex; +static uno::Reference< uno::XInterface > m_xINSTANCE; -Reference< XInterface > UnxSplashScreen::getInstance( const Reference< XMultiServiceFactory >& rSMgr ) +uno::Reference< uno::XInterface > SAL_CALL UnxSplash_createInstance(const uno::Reference< uno::XComponentContext > & xCtx ) throw( uno::Exception ) { - if ( m_pINSTANCE == NULL ) + static osl::Mutex m_aMutex; + if ( !m_xINSTANCE.is() ) { osl::MutexGuard guard( m_aMutex ); - if ( m_pINSTANCE == NULL ) - return (XComponent*) new UnxSplashScreen( rSMgr ); + if ( !m_xINSTANCE.is() ) + m_xINSTANCE = (cppu::OWeakObject*) new UnxSplashScreen( xCtx ); } - return (XComponent*)NULL; + return m_xINSTANCE; +} + +OUString UnxSplash_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.comp.PipeSplashScreen" ) ); +} + +uno::Sequence< OUString > SAL_CALL UnxSplash_getSupportedServiceNames() throw() +{ + const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.PipeSplashScreen" ) ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; } -// static service info... -const char* UnxSplashScreen::interfaces[] = +::cppu::ImplementationEntry aEntries[] = { - "com.sun.star.task.XStartusIndicator", - "com.sun.star.lang.XInitialization", - NULL, + { + UnxSplash_createInstance, UnxSplash_getImplementationName, + UnxSplash_getSupportedServiceNames, + ::cppu::createSingleComponentFactory, + 0, 0 + }, + { 0, 0, 0, 0, 0, 0 } }; -const sal_Char *UnxSplashScreen::serviceName = "com.sun.star.office.PipeSplashScreen"; -const sal_Char *UnxSplashScreen::implementationName = "com.sun.star.office.comp.PipeSplashScreen"; -const sal_Char *UnxSplashScreen::supportedServiceNames[] = { "com.sun.star.office.PipeSplashScreen", NULL }; +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, + uno_Environment ** ) +{ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } + +SAL_DLLPUBLIC_EXPORT void* SAL_CALL +component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey ) +{ + return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, + pRegistryKey, aEntries ); } +} // extern "C" + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/unx/splash/unxsplash.hxx b/desktop/unx/splash/unxsplash.hxx index abe5a8cac2bd..b25e858d9bac 100755 --- a/desktop/unx/splash/unxsplash.hxx +++ b/desktop/unx/splash/unxsplash.hxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -54,24 +55,17 @@ private: UnxSplashScreen( void ); UnxSplashScreen operator =( const UnxSplashScreen& ); - UnxSplashScreen( const Reference< XMultiServiceFactory >& xFactory ); - virtual ~UnxSplashScreen(); static UnxSplashScreen *m_pINSTANCE; static osl::Mutex m_aMutex; - Reference< XMultiServiceFactory > m_rFactory; + Reference< XComponentContext > m_xCtx; FILE *m_pOutFd; public: - static const char* interfaces[]; - static const sal_Char *serviceName; - static const sal_Char *implementationName; - static const sal_Char *supportedServiceNames[]; - - static Reference< XInterface > getInstance( const Reference < XMultiServiceFactory >& xFactory ); + UnxSplashScreen( const Reference< XComponentContext >& xCtx ); // XStatusIndicator virtual void SAL_CALL start( const OUString& aText, sal_Int32 nRange ) throw ( RuntimeException ); -- cgit