summaryrefslogtreecommitdiff
path: root/desktop/unx/splash
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-10-12 15:32:09 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-10-12 15:40:42 +0100
commite9fe1e24fbe38a8056f0ed65a1f35f199a8a3869 (patch)
tree0c48f10dc073b739efde020c7f960b7c772f722d /desktop/unx/splash
parent20658054d8bd6380b4b175b552ccc1480c49d01c (diff)
Implement unix quick-starter
Kendy's standalone unix-quick-starter, with tweaks to make it conditionally compiled, and load png images with the new branding layout from Michael. Fixes to the soffice shell-script to not run pagein for a 2nd start
Diffstat (limited to 'desktop/unx/splash')
-rw-r--r--desktop/unx/splash/exports.map10
-rw-r--r--desktop/unx/splash/makefile.mk72
-rw-r--r--desktop/unx/splash/services_unxsplash.cxx156
-rw-r--r--desktop/unx/splash/unxsplash.cxx173
-rw-r--r--desktop/unx/splash/unxsplash.hxx90
5 files changed, 501 insertions, 0 deletions
diff --git a/desktop/unx/splash/exports.map b/desktop/unx/splash/exports.map
new file mode 100644
index 000000000000..ba501f9ae076
--- /dev/null
+++ b/desktop/unx/splash/exports.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ GetVersionInfo;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ component_writeInfo;
+
+ local:
+ *;
+};
diff --git a/desktop/unx/splash/makefile.mk b/desktop/unx/splash/makefile.mk
new file mode 100644
index 000000000000..7466a6d143c5
--- /dev/null
+++ b/desktop/unx/splash/makefile.mk
@@ -0,0 +1,72 @@
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Novell, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s): Jan Holesovsky <kendy@novell.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#
+PRJ=..$/..
+
+PRJNAME=desktop
+TARGET=spl_unx
+LIBTARGET=NO
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_UNIX_QUICKSTARTER)"!="TRUE"
+
+dummy:
+ @echo "Unix quickstarter disabled"
+
+.ELSE
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = $(SLO)$/unxsplash.obj \
+ $(SLO)$/services_unxsplash.obj
+
+SHL1DEPN= makefile.mk
+SHL1OBJS= $(SLOFILES)
+
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1IMPLIB=i$(TARGET)
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+SHL1STDLIBS= \
+ $(VOSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+.ENDIF # ENABLE_UNIX_QUICKSTARTER
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/desktop/unx/splash/services_unxsplash.cxx b/desktop/unx/splash/services_unxsplash.cxx
new file mode 100644
index 000000000000..03715cc2f88b
--- /dev/null
+++ b/desktop/unx/splash/services_unxsplash.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ * Contributor(s): Jan Holesovsky <kendy@novell.com>
+ *
+ ************************************************************************/
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <uno/environment.h>
+#include <cppuhelper/factory.hxx>
+#include <unotools/configmgr.hxx>
+
+#include <string.h>
+
+#include "unxsplash.hxx"
+
+using namespace rtl;
+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;
+
+static const char* pServices[] =
+{
+ UnxSplashScreen::serviceName,
+ NULL
+};
+
+static const char* pImplementations[] =
+{
+ UnxSplashScreen::implementationName,
+ NULL
+};
+
+typedef Reference<XInterface>(* fProvider)( const Reference<XMultiServiceFactory>& );
+
+static const fProvider pInstanceProviders[] =
+{
+ UnxSplashScreen::getInstance,
+ NULL
+};
+
+
+static const char** pSupportedServices[] =
+{
+ UnxSplashScreen::interfaces,
+ NULL
+};
+
+static Sequence<OUString>
+getSupportedServiceNames( int p ) {
+ const char **names = pSupportedServices[p];
+ Sequence<OUString> 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<XMultiServiceFactory> xMan(
+ reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+ Reference<XRegistryKey> 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::createFromAscii( "/" )
+ + OUString::createFromAscii( pImplName )
+ + OUString::createFromAscii( "/UNO/SERVICES" );
+ Reference<XRegistryKey> 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<XSingleServiceFactory>( 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"
diff --git a/desktop/unx/splash/unxsplash.cxx b/desktop/unx/splash/unxsplash.cxx
new file mode 100644
index 000000000000..edb3603d8c39
--- /dev/null
+++ b/desktop/unx/splash/unxsplash.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ * Contributor(s): Jan Holesovsky <kendy@novell.com>
+ *
+ ************************************************************************/
+#include "unxsplash.hxx"
+#include <stdio.h>
+#include <unotools/bootstrap.hxx>
+#include <vos/process.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/stream.hxx>
+#include <sfx2/sfx.hrc>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <rtl/logfile.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+#define PIPE_ARG "-splash-pipe="
+
+using namespace ::rtl;
+using namespace ::com::sun::star::registry;
+
+namespace desktop
+{
+
+UnxSplashScreen::UnxSplashScreen( const Reference< XMultiServiceFactory >& rSMgr )
+ : m_rFactory( rSMgr ),
+ m_pOutFd( NULL )
+{
+}
+
+UnxSplashScreen::~UnxSplashScreen()
+{
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "UnxSplashScreen::~UnxSplashScreen()\n" );
+#endif
+
+ if ( m_pOutFd )
+ {
+ fclose( m_pOutFd );
+ m_pOutFd = NULL;
+ }
+}
+
+void SAL_CALL UnxSplashScreen::start( const OUString& /*aText*/, sal_Int32 /*nRange*/ )
+ throw ( RuntimeException )
+{
+}
+
+void SAL_CALL UnxSplashScreen::end()
+ throw ( RuntimeException )
+{
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "UnxSplashScreen::end()\n" );
+#endif
+
+ fprintf( m_pOutFd, "end\n" );
+ fflush( m_pOutFd );
+}
+
+void SAL_CALL UnxSplashScreen::reset()
+ throw ( RuntimeException )
+{
+ // TODO?
+}
+
+void SAL_CALL UnxSplashScreen::setText( const OUString& /*aText*/ )
+ throw ( RuntimeException )
+{
+ // TODO?
+}
+
+void SAL_CALL UnxSplashScreen::setValue( sal_Int32 nValue )
+ throw ( RuntimeException )
+{
+ if ( m_pOutFd )
+ {
+ fprintf( m_pOutFd, "%d%%\n", nValue );
+ fflush( m_pOutFd );
+ }
+}
+
+// XInitialize
+void SAL_CALL
+UnxSplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& aArguments )
+ throw ( RuntimeException )
+{
+ ::vos::OStartupInfo aInfo;
+ for ( sal_uInt32 i = 0; i < aInfo.getCommandArgCount(); i++ )
+ {
+ rtl::OUString aArg;
+ if ( aInfo.getCommandArg( i, aArg ) )
+ break;
+ if ( aArg.matchIgnoreAsciiCaseAsciiL( PIPE_ARG, sizeof( PIPE_ARG ) - 1, 0 ) )
+ {
+ OUString aNum = aArg.copy( sizeof( PIPE_ARG ) - 1 );
+ int fd = aNum.toInt32();
+ m_pOutFd = fdopen( fd, "w" );
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "Got argument '-splash-pipe=%d ('%s') (%p)\n",
+ fd, (const sal_Char *)rtl::OUStringToOString( aNum, RTL_TEXTENCODING_UTF8 ),
+ m_pOutFd );
+#endif
+ }
+ }
+}
+
+// get service instance...
+UnxSplashScreen *UnxSplashScreen::m_pINSTANCE = NULL;
+osl::Mutex UnxSplashScreen::m_aMutex;
+
+Reference< XInterface > UnxSplashScreen::getInstance( const Reference< XMultiServiceFactory >& rSMgr )
+{
+ if ( m_pINSTANCE == NULL )
+ {
+ osl::MutexGuard guard( m_aMutex );
+ if ( m_pINSTANCE == NULL )
+ return (XComponent*) new UnxSplashScreen( rSMgr );
+ }
+
+ return (XComponent*)NULL;
+}
+
+// static service info...
+const char* UnxSplashScreen::interfaces[] =
+{
+ "com.sun.star.task.XStartusIndicator",
+ "com.sun.star.lang.XInitialization",
+ NULL,
+};
+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 };
+
+OUString UnxSplashScreen::impl_getImplementationName()
+{
+ return OUString::createFromAscii( implementationName );
+}
+
+Sequence<OUString> UnxSplashScreen::impl_getSupportedServiceNames()
+{
+ Sequence<OUString> aSequence;
+ for ( int i = 0; supportedServiceNames[i] != NULL; i++ )
+ {
+ aSequence.realloc( i+1 );
+ aSequence[i] = OUString::createFromAscii( supportedServiceNames[i] );
+ }
+ return aSequence;
+}
+
+}
diff --git a/desktop/unx/splash/unxsplash.hxx b/desktop/unx/splash/unxsplash.hxx
new file mode 100644
index 000000000000..0914ccce2791
--- /dev/null
+++ b/desktop/unx/splash/unxsplash.hxx
@@ -0,0 +1,90 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Novell, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jan Holesovsky <kendy@novell.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <stdio.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <osl/mutex.hxx>
+#include <rtl/bootstrap.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::task;
+
+namespace desktop {
+
+class UnxSplashScreen : public ::cppu::WeakImplHelper2< XStatusIndicator, XInitialization >
+{
+private:
+ // don't allow anybody but ourselves to create instances of this class
+ UnxSplashScreen( const UnxSplashScreen& );
+ 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;
+
+ 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 );
+
+ // static service info
+ static OUString impl_getImplementationName();
+ static Sequence<OUString> impl_getSupportedServiceNames();
+
+ // XStatusIndicator
+ virtual void SAL_CALL start( const OUString& aText, sal_Int32 nRange ) throw ( RuntimeException );
+ virtual void SAL_CALL end() throw ( RuntimeException );
+ virtual void SAL_CALL reset() throw ( RuntimeException );
+ virtual void SAL_CALL setText( const OUString& aText ) throw ( RuntimeException );
+ virtual void SAL_CALL setValue( sal_Int32 nValue ) throw ( RuntimeException );
+
+ // XInitialize
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& aArguments ) throw ( RuntimeException );
+};
+
+}