fwk147: Merge changes

This commit is contained in:
Carsten Driesner 2010-06-25 14:29:47 +02:00
commit f113398230
5 changed files with 69 additions and 10 deletions

View file

@ -75,7 +75,8 @@ class Desktop : public Application
BE_USERINSTALL_FAILED,
BE_LANGUAGE_MISSING,
BE_USERINSTALL_NOTENOUGHDISKSPACE,
BE_USERINSTALL_NOWRITEACCESS
BE_USERINSTALL_NOWRITEACCESS,
BE_OFFICECONFIG_BROKEN
};
enum BootstrapStatus
{

View file

@ -474,6 +474,8 @@ void Desktop::Init()
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" );
SetBootstrapStatus(BS_OK);
Sleep(10000);
// create service factory...
Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
if( rSMgr.is() )
@ -489,7 +491,12 @@ void Desktop::Init()
{
// prepare language
if ( !LanguageSelection::prepareLanguage() )
SetBootstrapError( BE_LANGUAGE_MISSING );
{
if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE )
SetBootstrapError( BE_LANGUAGE_MISSING );
else
SetBootstrapError( BE_OFFICECONFIG_BROKEN );
}
}
if ( GetBootstrapError() == BE_OK )
@ -870,6 +877,17 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError )
FatalError( aMessage);
}
else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN )
{
OUString aMessage;
OUStringBuffer aDiagnosticMessage( 100 );
OUString aErrorMsg;
aErrorMsg = GetMsgString( STR_CONFIG_ERR_ACCESS_GENERAL,
OUString( RTL_CONSTASCII_USTRINGPARAM( "A general error occurred while accessing your central configuration." )) );
aDiagnosticMessage.append( aErrorMsg );
aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() );
FatalError(aMessage);
}
else if ( aBootstrapError == BE_USERINSTALL_FAILED )
{
OUString aMessage;

View file

@ -64,10 +64,12 @@ namespace desktop {
static char const SOFFICE_BOOTSTRAP[] = "Bootstrap";
static char const SOFFICE_STARTLANG[] = "STARTLANG";
sal_Bool LanguageSelection::bFoundLanguage = sal_False;
OUString LanguageSelection::aFoundLanguage;
const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US");
LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK;
const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US");
static sal_Bool existsURL( OUString const& sURL )
{
@ -122,6 +124,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str)
bool LanguageSelection::prepareLanguage()
{
m_eStatus = LS_STATUS_OK;
OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
Reference< XLocalizable > theConfigProvider;
@ -131,7 +134,9 @@ bool LanguageSelection::prepareLanguage()
}
catch(const Exception&)
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
if(!theConfigProvider.is())
return false;
@ -149,6 +154,7 @@ bool LanguageSelection::prepareLanguage()
}
catch(const Exception&)
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
// #i32939# use system locale to set document default locale
@ -162,6 +168,7 @@ bool LanguageSelection::prepareLanguage()
}
catch (Exception&)
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
// get the selected UI language as string
@ -350,8 +357,10 @@ OUString LanguageSelection::getLanguageString()
aFoundLanguage = usFallbackLanguage;
return aFoundLanguage;
}
// fallback didn't work use first installed language
aUserLanguage = getFirstInstalledLanguage();
bFoundLanguage = sal_True;
aFoundLanguage = aUserLanguage;
return aFoundLanguage;
@ -455,7 +464,7 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx
// requested locale starts with the installed locale
// (i.e. installed locale has index 0 in requested locale)
bInstalled = sal_True;
usLocale = seqLanguages[i];
usLocale = seqLanguages[i];
break;
}
}
@ -484,10 +493,12 @@ OUString LanguageSelection::getUserLanguage()
}
catch ( NoSuchElementException const & )
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
catch ( WrappedTargetException const & )
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
}
@ -506,10 +517,12 @@ OUString LanguageSelection::getSystemLanguage()
}
catch ( NoSuchElementException const & )
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
catch ( WrappedTargetException const & )
{
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
}
@ -533,9 +546,13 @@ void LanguageSelection::resetUserLanguage()
{
OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
OSL_ENSURE(sal_False, aMsg.getStr());
m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
}
LanguageSelection::LanguageSelectionStatus LanguageSelection::getStatus()
{
return m_eStatus;
}
} // namespace desktop

View file

@ -40,10 +40,24 @@ namespace desktop
class LanguageSelection
{
public:
enum LanguageSelectionStatus
{
LS_STATUS_OK,
LS_STATUS_CANNOT_DETERMINE_LANGUAGE,
LS_STATUS_CONFIGURATIONACCESS_BROKEN
};
static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
static rtl::OUString getLanguageString();
static bool prepareLanguage();
static LanguageSelectionStatus getStatus();
private:
static const rtl::OUString usFallbackLanguage;
static rtl::OUString aFoundLanguage;
static sal_Bool bFoundLanguage;
static LanguageSelectionStatus m_eStatus;
static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False);
@ -55,11 +69,6 @@ private:
static rtl::OUString getSystemLanguage();
static void resetUserLanguage();
static void setDefaultLanguage(const rtl::OUString&);
public:
static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
static rtl::OUString getLanguageString();
static bool prepareLanguage();
};
} //namespace desktop

View file

@ -216,6 +216,13 @@ namespace sfx2
if ( e.Context == xHandler )
aIterator.remove();
}
catch( const RuntimeException& )
{
throw;
}
catch( const Exception& )
{
}
}
}
break;
@ -247,6 +254,13 @@ namespace sfx2
if ( e.Context == xHandler )
aIterator.remove();
}
catch( const RuntimeException& )
{
throw;
}
catch( const Exception& )
{
}
}
}
break;