Kaydet (Commit) fbe74692 authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS tbe18 (1.8.20); FILE MERGED

2005/02/16 14:32:35 tbe 1.8.20.1: #i37061# Localized shortcuts are broken
üst 60e94289
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: presethandler.cxx,v $ * $RCSfile: presethandler.cxx,v $
* *
* $Revision: 1.8 $ * $Revision: 1.9 $
* *
* last change: $Author: rt $ $Date: 2005-02-02 13:52:44 $ * last change: $Author: vg $ $Date: 2005-02-24 17:11:12 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -467,12 +467,22 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType ...@@ -467,12 +467,22 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
(eConfigType != E_DOCUMENT ) // no localization in document mode! (eConfigType != E_DOCUMENT ) // no localization in document mode!
) )
{ {
// use different start pathes ... because called method uses it as an in/out parameter! // First try to find the right localized set inside share layer.
::rtl::OUString sLocalizedSharePath(sRelPath); // Fallbacks are allowed there.
::rtl::OUString sLocalizedUserPath (sRelPath); ::comphelper::Locale aShareLocale = aLocale ;
::rtl::OUString sLocalizedSharePath(sRelPath);
xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aLocale); sal_Bool bAllowFallbacks = sal_True;
xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath , eUserMode , sal_False, aLocale); xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aShareLocale, bAllowFallbacks);
// The try to locate the right sub dir inside user layer ... without using fallbacks!
// Normaly the corresponding sub dir should be created matching the specified locale.
// Because we allow creation of storages inside user layer by default.
::comphelper::Locale aUserLocale = aLocale ;
::rtl::OUString sLocalizedUserPath(sRelPath) ;
bAllowFallbacks = sal_False;
xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath, eUserMode , sal_False, aUserLocale, bAllowFallbacks);
// TODO ... may be we need one relpath value for every supported config layer .-)
sRelPath = sLocalizedUserPath; sRelPath = sLocalizedUserPath;
} }
...@@ -812,14 +822,48 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring ...@@ -812,14 +822,48 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
} }
//----------------------------------------------- //-----------------------------------------------
css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPathIgnoringErrors( ::rtl::OUString& sPath , ::std::vector< ::rtl::OUString >::const_iterator PresetHandler::impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
sal_Int32 eMode , ::comphelper::Locale& aLocale ,
sal_Bool bShare , sal_Bool bAllowFallbacks )
const ::comphelper::Locale& aLocale) {
::std::vector< ::rtl::OUString >::const_iterator pFound = lLocalizedValues.end();
if (bAllowFallbacks)
{
pFound = ::comphelper::Locale::getFallback(lLocalizedValues, aLocale.toISO());
}
else
{
for ( pFound = lLocalizedValues.begin();
pFound != lLocalizedValues.end() ;
++pFound )
{
const ::rtl::OUString& sCheckISO = *pFound;
::comphelper::Locale aCheckLocale(sCheckISO);
if (aCheckLocale.equals(aLocale))
break;
}
}
// if we found a valid locale ... take it over to our in/out parameter aLocale
if (pFound != lLocalizedValues.end())
{
const ::rtl::OUString& sISOLocale = *pFound;
aLocale.fromISO(sISOLocale);
}
return pFound;
}
//-----------------------------------------------
css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
::comphelper::Locale& aLocale ,
sal_Bool bAllowFallback)
{ {
css::uno::Reference< css::embed::XStorage > xPath = impl_openPathIgnoringErrors(sPath, eMode, bShare); css::uno::Reference< css::embed::XStorage > xPath = impl_openPathIgnoringErrors(sPath, eMode, bShare);
::std::vector< ::rtl::OUString > lSubFolders = impl_getSubFolderNames(xPath); ::std::vector< ::rtl::OUString > lSubFolders = impl_getSubFolderNames(xPath);
::std::vector< ::rtl::OUString >::const_iterator pLocaleFolder = ::comphelper::Locale::getFallback(lSubFolders, aLocale.toISO()); ::std::vector< ::rtl::OUString >::const_iterator pLocaleFolder = impl_findMatchingLocalizedValue(lSubFolders, aLocale, bAllowFallback);
// no fallback ... creation not allowed => no storage // no fallback ... creation not allowed => no storage
if ( if (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment