diff options
author | Mathias Bauer <mba@openoffice.org> | 2001-11-09 15:17:35 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2001-11-09 15:17:35 +0000 |
commit | 80957f50f623b23f3afd1f5cb36a780119978b7a (patch) | |
tree | 3f61c58029c44d9de84aba87a51efb021f92fa02 /desktop | |
parent | c0b894256dba94b88fe7c034c4894b2a1a82ceb3 (diff) |
#93613#: evaluation version
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 78 |
1 files changed, 69 insertions, 9 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 61c6f2f335d5..3fc452ae0b9a 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2,9 +2,9 @@ * * $RCSfile: app.cxx,v $ * - * $Revision: 1.59 $ + * $Revision: 1.60 $ * - * last change: $Author: mba $ $Date: 2001-11-06 15:05:19 $ + * last change: $Author: mba $ $Date: 2001-11-09 16:17:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,9 @@ #include "desktopresid.hxx" #include "dispatchwatcher.hxx" +#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ +#include <com/sun/star/beans/NamedValue.hpp> +#endif #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ #include <com/sun/star/frame/XStorable.hpp> #endif @@ -138,6 +141,8 @@ #include <com/sun/star/configuration/InstallationIncompleteException.hpp> #endif +#include <com/sun/star/beans/XMaterialHolder.hpp> + #ifndef _SOLAR_H #include <tools/solar.h> #endif @@ -432,12 +437,12 @@ void PreloadConfigTrees() } } +static String aBrandName; +static String aVersion; +static String aExtension; + void ReplaceStringHookProc( UniString& rStr ) { - static String aBrandName; - static String aVersion; - static String aExtension; - static int nAll = 0, nPro = 0; if ( !aBrandName.Len() ) @@ -451,9 +456,12 @@ void ReplaceStringHookProc( UniString& rStr ) aRet >>= aTmp; aVersion = aTmp; - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTEXTENSION ); - aRet >>= aTmp; - aExtension = aTmp; + if ( !aExtension.Len() ) + { + aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTEXTENSION ); + aRet >>= aTmp; + aExtension = aTmp; + } } nAll++; @@ -1105,6 +1113,58 @@ void Desktop::Main() // ---- Startup screen ---- OpenStartupScreen(); +#ifndef BUILD_SOSL + // get the tabreg service to determine the product extension string for an evaluation version + Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); + Reference < XMaterialHolder > xHolder( xSMgr->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 + Any aData = xHolder->getMaterial(); + Sequence < NamedValue > aSeq; + if ( aData >>= aSeq ) + { + // determine current locale + Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); + ::rtl::OUString aTmp; + aRet >>= aTmp; + + // only first part of locale must match + ::rtl::OUString aLocale; + sal_Int32 nPos = aTmp.indexOf('_'); + if ( nPos > 0 ) + aLocale = aTmp.copy( 0, nPos ); + else + aLocale = aTmp; + + // find string for matching locale + sal_Int32 nCount = aSeq.getLength(); + for ( sal_Int32 n=0; n<nCount; n++ ) + { + const NamedValue& rValue = aSeq[n]; + if ( rValue.Name == aLocale ) + { + rValue.Value >>= aTmp; + aExtension = aTmp; + break; + } + } + + if ( n == nCount ) + // current locale is unknown for service, use default + aExtension = DEFINE_CONST_UNICODE("Evaluation Version"); + } + } + else + { + // library missing + aExtension = DEFINE_CONST_UNICODE("Evaluation Version"); + //StartSetup( DEFINE_CONST_UNICODE("-repair") ); + //_exit(666); + } +#endif ResMgr::SetReadStringHook( ReplaceStringHookProc ); SetAppName( DEFINE_CONST_UNICODE("soffice") ); |