diff options
author | Carsten Driesner <cd@openoffice.org> | 2002-11-01 08:50:03 +0000 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2002-11-01 08:50:03 +0000 |
commit | 9b90482741f22d9264334c982a694a457bb55804 (patch) | |
tree | a8720132132c593723bdddbddc4d3fcc7974cf9f /desktop | |
parent | 54901db94d49c158667c5916c75cbae2247f6375 (diff) |
#102708# Remove BUILD_SOSL and source restructuring
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/inc/app.hxx | 107 | ||||
-rw-r--r-- | desktop/prj/build.lst | 3 | ||||
-rw-r--r-- | desktop/source/app/checkinstall.cxx | 158 | ||||
-rw-r--r-- | desktop/source/app/checkinstall.hxx | 80 | ||||
-rw-r--r-- | desktop/source/so_comp/evaluation.cxx | 371 | ||||
-rw-r--r-- | desktop/source/so_comp/evaluation.hxx | 131 | ||||
-rw-r--r-- | desktop/source/so_comp/makefile.mk | 107 |
7 files changed, 917 insertions, 40 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index cf99725e2650..097eb58e1e46 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -2,9 +2,9 @@ * * $RCSfile: app.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: lo $ $Date: 2002-10-22 15:14:00 $ + * last change: $Author: cd $ $Date: 2002-11-01 09:49:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,8 +59,12 @@ * ************************************************************************/ -#ifndef _DESK_APP_HXX -#define _DESK_APP_HXX +#ifndef _DESKTOP_APP_HXX_ +#define _DESKTOP_APP_HXX_ + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif #ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> @@ -72,11 +76,17 @@ #include <unotools/bootstrap.hxx> #endif +namespace desktop +{ + /*-------------------------------------------------------------------- Description: Application-class --------------------------------------------------------------------*/ class IntroWindow_Impl; -class Desktop : public Application //public SfxApplicationClass +class OOfficeAcceptorThread; +class PluginAcceptThread; +class CommandLineArgs; +class Desktop : public Application { public: enum BootstrapError @@ -87,64 +97,83 @@ class Desktop : public Application //public SfxApplicationClass BE_PATHINFO_MISSING }; - Desktop(); - virtual void Main( ); - virtual void Init(); - virtual void DeInit(); - virtual BOOL QueryExit(); - virtual USHORT Exception(USHORT nError); - virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ); - virtual void AppEvent( const ApplicationEvent& rAppEvent ); + Desktop(); + ~Desktop(); + virtual void Main( ); + virtual void Init(); + virtual void DeInit(); + virtual BOOL QueryExit(); + virtual USHORT Exception(USHORT nError); + virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ); + virtual void AppEvent( const ApplicationEvent& rAppEvent ); DECL_LINK( OpenClients_Impl, void* ); - static void OpenClients(); - static void OpenDefault(); - static void HandleAppEvent( const ApplicationEvent& rAppEvent ); - static ResMgr* GetDesktopResManager(); + static void OpenClients(); + static void OpenDefault(); + static void HandleAppEvent( const ApplicationEvent& rAppEvent ); + static ResMgr* GetDesktopResManager(); + static CommandLineArgs* GetCommandLineArgs(); - void HandleBootstrapErrors( BootstrapError ); - void SetBootstrapError( BootstrapError nError ) + void HandleBootstrapErrors( BootstrapError ); + void SetBootstrapError( BootstrapError nError ) { if ( m_aBootstrapError == BE_OK ) m_aBootstrapError = nError; } private: -#ifndef BUILD_SOSL - sal_Bool TabRegDialog(String); -#endif BUILD_SOSL - void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg ); - void StartSetup( const ::rtl::OUString& aParameters ); + // Bootstrap methods + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager(); + + void RegisterServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr ); + void DeregisterServices(); + + void DestroyApplicationServiceManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr ); + + void CreateTemporaryDirectory(); + void RemoveTemporaryDirectory(); + + sal_Bool InitializeInstallation( const rtl::OUString& rAppFilename ); + sal_Bool InitializeConfiguration(); + sal_Bool InitializeQuickstartMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + sal_Bool InitializePluginMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + + void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg ); + void StartSetup( const ::rtl::OUString& aParameters ); // Get a resource message string securely e.g. if resource cannot be retrieved return aFaultBackMsg - ::rtl::OUString GetMsgString( USHORT nId, const ::rtl::OUString& aFaultBackMsg ); + ::rtl::OUString GetMsgString( USHORT nId, const ::rtl::OUString& aFaultBackMsg ); // Create a error message depending on bootstrap failure code and an optional file url - ::rtl::OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode, - const ::rtl::OUString& aFileURL ); + ::rtl::OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode, + const ::rtl::OUString& aFileURL ); - void OpenStartupScreen(); - void CloseStartupScreen(); - void EnableOleAutomation(); + void OpenStartupScreen(); + void CloseStartupScreen(); + void EnableOleAutomation(); DECL_LINK( AsyncInitFirstRun, void* ); /** checks if the office is run the first time <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the respective flag in the configuration is reset.</p> */ - void CheckFirstRun( ); + void CheckFirstRun( ); /// does initializations which are necessary for the first run of the office - void DoFirstRunInitializations(); + void DoFirstRunInitializations(); - sal_Bool m_bMinimized; - sal_Bool m_bInvisible; - USHORT m_nAppEvents; - IntroWindow_Impl* m_pIntro; - BootstrapError m_aBootstrapError; + sal_Bool m_bMinimized; + sal_Bool m_bInvisible; + USHORT m_nAppEvents; + IntroWindow_Impl* m_pIntro; + BootstrapError m_aBootstrapError; - static ResMgr* pResMgr; + static ResMgr* pResMgr; + static PluginAcceptThread* pPluginAcceptThread; + static OOfficeAcceptorThread* pOfficeAcceptThread; }; -#endif // DESK_APP_HXX_ +} + +#endif // _DESKTOP_APP_HXX_ diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index 3444fd2b78c4..7dfb86dbfe44 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -6,7 +6,8 @@ dt desktop\jobs get - all dt_jobs NULL dt desktop\res get - all dt_res NULL dt desktop\source\app nmake - all dt_app NULL dt desktop\source\offwrp nmake - all dt_offwrp NULL +dt desktop\source\so_comp nmake - all dt_so_comp NULL dt desktop\win32\source nmake - w dt_wrapper NULL dt desktop\source\javaldx nmake - u dt_javaldx NULL dt desktop\source\pkgchk nmake - all dt_pkgchk NULL -dt desktop\util nmake - all dt_util dt_app dt_offwrp dt_wrapper.w NULL +dt desktop\util nmake - all dt_util dt_app dt_offwrp dt_so_comp dt_wrapper.w NULL diff --git a/desktop/source/app/checkinstall.cxx b/desktop/source/app/checkinstall.cxx new file mode 100644 index 000000000000..c3642b60092f --- /dev/null +++ b/desktop/source/app/checkinstall.cxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: checkinstall.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cd $ $Date: 2002-11-01 09:47:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "checkinstall.hxx" + +#ifndef _COM_SUN_STAR_BEANS_XEXACTNAME_HPP_ +#include <com/sun/star/beans/XExactName.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_ +#include <com/sun/star/beans/XMaterialHolder.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif +#ifndef _SV_MSGBOX_HXX +#include <vcl/msgbox.hxx> +#endif + +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; + +namespace desktop +{ + +sal_Bool CheckInstallation( OUString& rTitle ) +{ + Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); + Reference< XExactName > xExactName( xSMgr->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.desktop.Evaluation" ))), + UNO_QUERY ); + if ( xExactName.is() ) + { + try + { + rTitle = xExactName->getExactName( rTitle ); + Reference< XMaterialHolder > xMaterialHolder( xExactName, UNO_QUERY ); + if ( xMaterialHolder.is() ) + { + com::sun::star::util::Date aExpirationDate; + Any a = xMaterialHolder->getMaterial(); + if ( a >>= aExpirationDate ) + { + Date aToday; + Date aTimeBombDate( aExpirationDate.Day, aExpirationDate.Month, aExpirationDate.Year ); + if ( aToday > aTimeBombDate ) + { + InfoBox aInfoBox( NULL, String::CreateFromAscii( "This version has expired" ) ); + aInfoBox.Execute(); + return sal_False; + } + } + + return sal_True; + } + else + { + InfoBox aInfoBox( NULL, rTitle ); + aInfoBox.Execute(); + return sal_False; + } + } + catch ( RuntimeException& ) + { + // Evaluation version expired! + return sal_False; + } + } + else + { + Reference< com::sun::star::container::XContentEnumerationAccess > rContent( xSMgr , UNO_QUERY ); + if( rContent.is() ) + { + OUString sEvalService = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Evaluation" ) ); + Reference < com::sun::star::container::XEnumeration > rEnum = rContent->createContentEnumeration( sEvalService ); + if ( rEnum.is() ) + { + InfoBox aInfoBox( NULL, rTitle ); + aInfoBox.Execute(); + return sal_False; + } + } + } + + return sal_True; +} + +} // namespace desktop diff --git a/desktop/source/app/checkinstall.hxx b/desktop/source/app/checkinstall.hxx new file mode 100644 index 000000000000..c95ed0fa4448 --- /dev/null +++ b/desktop/source/app/checkinstall.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * $RCSfile: checkinstall.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cd $ $Date: 2002-11-01 09:47:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DESKTOP_CHECKINSTALL_HXX_ +#define _DESKTOP_CHECKINSTALL_HXX_ + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + + +namespace desktop +{ + +sal_Bool CheckInstallation( rtl::OUString& rTitle ); + +} + +#endif // _DESKTOP_CHECKINSTALL_HXX_ diff --git a/desktop/source/so_comp/evaluation.cxx b/desktop/source/so_comp/evaluation.cxx new file mode 100644 index 000000000000..c7b81b3a2bcb --- /dev/null +++ b/desktop/source/so_comp/evaluation.cxx @@ -0,0 +1,371 @@ +/************************************************************************* + * + * $RCSfile: evaluation.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cd $ $Date: 2002-11-01 09:43:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "evaluation.hxx" + +#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ +#include <com/sun/star/beans/NamedValue.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif +#ifndef _UNO_ENVIRONMENT_H_ +#include <uno/environment.h> +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _UTL_CONFIGMGR_HXX_ +#include <unotools/configmgr.hxx> +#endif +#ifndef _SV_MSGBOX_HXX +#include <vcl/msgbox.hxx> +#endif + +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; + +static SOEvaluation* pSOEval=0; +static const char* pSupportedServices[] = +{ + "com.sun.star.beans.XExactName", + "com.sun.star.beans.XMaterialHolder", + "com.sun.star.lang.XComponent", + "com.sun.star.lang.XServiceInfo", +}; + +OUString SOEvaluation::GetImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.Evaluation" )); +} + +Sequence< OUString > SOEvaluation::GetSupportedServiceNames() +{ + sal_Int32 nSize = sizeof( pSupportedServices ) / sizeof( const char *); + Sequence< OUString > aResult( nSize ); + + for( sal_Int32 i = 0; i < nSize; i++ ) + aResult[i] = OUString::createFromAscii( pSupportedServices[i] ); + return aResult; +} + +Reference< XInterface > SAL_CALL SOEvaluation_CreateInstance( const Reference< XMultiServiceFactory >& rSMgr ) +{ + static osl::Mutex aMutex; + + if ( pSOEval == 0 ) + { + osl::MutexGuard guard( aMutex ); + if ( pSOEval == 0 ) + return (XComponent*) ( new SOEvaluation( rSMgr ) ); + } + + return (XComponent*)0; +} + +SOEvaluation::SOEvaluation( const Reference< XMultiServiceFactory >& xFactory ) : + m_aListeners( m_aMutex ), + m_xServiceManager( xFactory ) +{ +} + +SOEvaluation::~SOEvaluation() +{ +} + +// XComponent +void SAL_CALL SOEvaluation::dispose() throw ( RuntimeException ) +{ + EventObject aObject; + aObject.Source = (XComponent*)this; + m_aListeners.disposeAndClear( aObject ); +} + +void SAL_CALL SOEvaluation::addEventListener( const Reference< XEventListener > & aListener) throw ( RuntimeException ) +{ + m_aListeners.addInterface( aListener ); +} + +void SAL_CALL SOEvaluation::removeEventListener( const Reference< XEventListener > & aListener ) throw ( RuntimeException ) +{ + m_aListeners.removeInterface( aListener ); +} + +// XExactName +rtl::OUString SAL_CALL SOEvaluation::getExactName( const rtl::OUString& rApproximateName ) throw ( RuntimeException ) +{ + // get the tabreg service for an evaluation version + // without this service office shouldn't run at all + OUString aTitle = rApproximateName; + OUString aEval; + sal_Bool bExpired = sal_True; + Reference < XMaterialHolder > xHolder( m_xServiceManager->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.tab.tabreg" ) ) ), UNO_QUERY ); + if ( xHolder.is() ) + { + // get a sequence of strings for the defined locales + // a registered version doesn't provide data + bExpired = sal_False; + Any aData = xHolder->getMaterial(); + Sequence < NamedValue > aSeq; + if ( aData >>= aSeq ) + { + // this is an evaluation version, because it provides "material" + bExpired = sal_True; + + // determine current locale + ::rtl::OUString aLocale; + ::rtl::OUString aTmp; + Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); + aRet >>= aLocale; + + sal_Int32 nCount = aSeq.getLength(); + if ( nCount ) + { + // first entry is for expiry + const NamedValue& rValue = aSeq[0]; + if ( rValue.Name.equalsAscii("expired") ) + rValue.Value >>= bExpired; + } + + // find string for matching locale + sal_Int32 n; + for ( n=0; n<nCount; n++ ) + { + const NamedValue& rValue = aSeq[n]; + if ( rValue.Name == aLocale ) + { + rValue.Value >>= aTmp; + aEval = aTmp; + break; + } + } + + if ( n == nCount ) + { + // try matching only first part of locale, if tab service provides it + ::rtl::OUString aShortLocale; + sal_Int32 nPos = aLocale.indexOf('_'); + if ( nPos > 0 ) + { + aShortLocale = aLocale.copy( 0, nPos ); + for ( n=0; n<nCount; n++ ) + { + const NamedValue& rValue = aSeq[n]; + if ( rValue.Name == aShortLocale ) + { + rValue.Value >>= aTmp; + aEval = aTmp; + break; + } + } + } + } + + if ( n == nCount ) + { + // current locale is unknown for service, use default english + sal_Int32 nCount = aSeq.getLength(); + for ( n=0; n<nCount; n++ ) + { + const NamedValue& rValue = aSeq[n]; + if ( rValue.Name.equalsAscii("en") ) + { + rValue.Value >>= aTmp; + aEval = aTmp; + break; + } + } + + if ( n == nCount ) + // strange version, no english string + bExpired = sal_True; + } + } + } + + if ( aEval.getLength() ) + { + OUStringBuffer aBuf( aTitle.getLength() + aEval.getLength() + 1 ); + + aBuf.append( aTitle ); + const sal_Unicode* pStr = aTitle.getStr(); + if ( pStr[ aTitle.getLength()-1 ] != (sal_Unicode)' ' ) + aBuf.appendAscii( " " ); + aBuf.append( aEval ); + aTitle = aBuf.makeStringAndClear(); + } + + if ( bExpired ) + { + InfoBox aBox( NULL, aTitle ); + aBox.Execute(); + throw RuntimeException(); + } + + return aTitle; +} + +// XMaterialHolder +Any SAL_CALL SOEvaluation::getMaterial() throw( RuntimeException ) +{ + // Time bomb implementation. Return empty Any to do nothing or + // provide a com::sun::star::util::Date with the time bomb date. + Any a; +/* + // Code for providing time bomb date! + com::sun::star::util::Date aDate( 31, 03, 2003 ); + a <<= aDate; +*/ + return a; +} + +// XServiceInfo +::rtl::OUString SAL_CALL SOEvaluation::getImplementationName() +throw ( RuntimeException ) +{ + return SOEvaluation::GetImplementationName(); +} + +sal_Bool SAL_CALL SOEvaluation::supportsService( const ::rtl::OUString& rServiceName ) +throw ( RuntimeException ) +{ + sal_Int32 nSize = sizeof( pSupportedServices ) / sizeof( const char *); + + for( sal_Int32 i = 0; i < nSize; i++ ) + if ( rServiceName.equalsAscii( pSupportedServices[i] )) + return sal_True; + return sal_False; +} + +Sequence< ::rtl::OUString > SAL_CALL SOEvaluation::getSupportedServiceNames() +throw ( RuntimeException ) +{ + return SOEvaluation::GetSupportedServiceNames(); +} + +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 ) ) ; + + // Eigentliche Implementierung und ihre Services registrieren + ::rtl::OUString aTempStr; + + ::rtl::OUString aImpl( RTL_CONSTASCII_USTRINGPARAM("/") ); + aImpl += SOEvaluation::GetImplementationName(); + aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); + Reference< XRegistryKey > xNewKey = xKey->createKey( aImpl ); + xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.office.Evaluation") ); + + 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. + void* pReturn = NULL ; + if ( pImplementationName && pServiceManager ) + { + // Define variables which are used in following macros. + Reference< XSingleServiceFactory > xFactory ; + Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + + if ( SOEvaluation::GetImplementationName().compareToAscii( pImplementationName ) == COMPARE_EQUAL ) + { + xFactory = Reference< XSingleServiceFactory >( cppu::createSingleFactory( xServiceManager, SOEvaluation::GetImplementationName(), + SOEvaluation_CreateInstance, SOEvaluation::GetSupportedServiceNames() ) ); + } + + // Factory is valid - service was found. + if ( xFactory.is() ) + { + xFactory->acquire(); + pReturn = xFactory.get(); + } + } + + // Return with result of this operation. + return pReturn ; +} + +} // extern "C" diff --git a/desktop/source/so_comp/evaluation.hxx b/desktop/source/so_comp/evaluation.hxx new file mode 100644 index 000000000000..6c849d497e20 --- /dev/null +++ b/desktop/source/so_comp/evaluation.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: evaluation.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cd $ $Date: 2002-11-01 09:43:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SOCOMP_EVALUATION_HXX_ +#define _SOCOMP_EVALUATION_HXX_ + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ +#include <com/sun/star/uno/Exception.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_ +#include <com/sun/star/lang/XEventListener.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XEXACTNAME_HPP_ +#include <com/sun/star/beans/XExactName.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_ +#include <com/sun/star/beans/XMaterialHolder.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE4_HXX_ +#include <cppuhelper/implbase4.hxx> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <osl/mutex.hxx> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; + +class SOEvaluation : public ::cppu::WeakImplHelper4< XExactName, XMaterialHolder, XComponent, XServiceInfo > +{ + ::osl::Mutex m_aMutex; + ::cppu::OInterfaceContainerHelper m_aListeners; + Reference< XMultiServiceFactory > m_xServiceManager; + +public: + SOEvaluation( const Reference < XMultiServiceFactory >& xFactory ); + virtual ~SOEvaluation(); + + static Reference< XSingleServiceFactory > GetSOEvaluationFactory( Reference< XMultiServiceFactory > & xSMgr ); + static ::rtl::OUString GetImplementationName(); + static Sequence< rtl::OUString > GetSupportedServiceNames(); + + // XComponent + virtual void SAL_CALL dispose() throw ( RuntimeException ); + virtual void SAL_CALL addEventListener( const Reference< XEventListener > & aListener) throw ( RuntimeException ); + virtual void SAL_CALL removeEventListener(const Reference< XEventListener > & aListener) throw ( RuntimeException ); + + // XExactName + virtual rtl::OUString SAL_CALL getExactName( const rtl::OUString& rApproximateName ) throw ( RuntimeException ); + + // XMaterialHolder + virtual Any SAL_CALL getMaterial() throw ( RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw ( RuntimeException ); + virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( RuntimeException ); +}; + +#endif // _SOCOMP_EVALUATION_HXX_ diff --git a/desktop/source/so_comp/makefile.mk b/desktop/source/so_comp/makefile.mk new file mode 100644 index 000000000000..10e4c54e4b83 --- /dev/null +++ b/desktop/source/so_comp/makefile.mk @@ -0,0 +1,107 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: cd $ $Date: 2002-11-01 09:43:29 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source 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.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=evaluation +TARGET=eval +LIBTARGET=NO +AUTOSEG=true +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(UPD)minor.mk +RSCUPDVER=$(RSCREVISION)(SV$(UPD)$(UPDMINOR)) + +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/evaluation.obj + +SHL1OBJS= $(SLOFILES) +SHL1TARGET= $(TARGET) + +SHL1IMPLIB= ievl +SHL1STDLIBS= \ + $(SALLIB) \ + $(UNOLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) \ + $(TOOLSLIB) \ + $(VCLLIB) + +SHL1DEPN= makefile.mk +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ------------------------------------------------------ + +.IF "$(depend)" != "" +SRCFILES=$(SRC1FILES) +.ENDIF + +.INCLUDE : target.mk |