rpms/openoffice.org/devel openoffice.org-1.9.87.rh151357.setlangtolocale.patch, 1.18, 1.19 openoffice.org.spec, 1.1221, 1.1222

Caolan McNamara (caolanm) fedora-extras-commits at redhat.com
Thu Jun 28 14:04:35 UTC 2007


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10930

Modified Files:
	openoffice.org-1.9.87.rh151357.setlangtolocale.patch 
	openoffice.org.spec 
Log Message:
update setlangtolocale for prettier fonts when appropiate langpack is missing

openoffice.org-1.9.87.rh151357.setlangtolocale.patch:

Index: openoffice.org-1.9.87.rh151357.setlangtolocale.patch
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org-1.9.87.rh151357.setlangtolocale.patch,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- openoffice.org-1.9.87.rh151357.setlangtolocale.patch	4 Nov 2006 12:11:28 -0000	1.18
+++ openoffice.org-1.9.87.rh151357.setlangtolocale.patch	28 Jun 2007 14:04:29 -0000	1.19
@@ -114,128 +114,6 @@
  #ifdef WNT
      aLicensePath = 
          aBaseInstallPath + OUString::createFromAscii(szLicensePath)
-Index: source/services/substitutepathvars.cxx
-===================================================================
-RCS file: /cvs/framework/framework/source/services/substitutepathvars.cxx,v
-retrieving revision 1.10
-diff -u -p -r1.10 substitutepathvars.cxx
---- openoffice.org.orig/framework/source/services/substitutepathvars.cxx	13 Jan 2005 19:14:36 -0000	1.10
-+++ openoffice.org/framework/source/services/substitutepathvars.cxx	29 Jun 2005 10:45:59 -0000
-@@ -125,6 +125,14 @@
- #include <rtl/ustrbuf.hxx>
- #endif
- 
-+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#endif
-+
-+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
-+#include <comphelper/processfactory.hxx>
-+#endif
-+
- //_________________________________________________________________________________________________________________
- //	Defines
- //_________________________________________________________________________________________________________________
-@@ -1190,6 +1198,88 @@
- 	return rtl::OUString();
- }
- 
-+using rtl::OUString;
-+using rtl::OString;
-+
-+Reference< XNameAccess > getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate)
-+{
-+    Reference< XNameAccess > xNameAccess;
-+    try{
-+        OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
-+        OUString sAccessSrvc;
-+        if (bUpdate)
-+            sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
-+        else
-+            sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
-+
-+        OUString sConfigURL = OUString::createFromAscii(pPath);
-+
-+        // get configuration provider
-+        Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
-+        if (theMSF.is()) {
-+            Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
-+                theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW );
-+
-+            // access the provider
-+            Sequence< Any > theArgs(1);
-+            theArgs[ 0 ] <<= sConfigURL;
-+            xNameAccess = Reference< XNameAccess > (
-+                theConfigProvider->createInstanceWithArguments(
-+                    sAccessSrvc, theArgs ), UNO_QUERY_THROW );
-+        }
-+    } catch (com::sun::star::uno::Exception& e)
-+    {
-+        OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
-+        OSL_ENSURE(sal_False, aMsg.getStr());
-+    }
-+    return xNameAccess;
-+}
-+
-+void getInstallMapping(OUString& usLocale)
-+{
-+    Sequence< OUString > seqLanguages;
-+    Reference< XNameAccess > xAccess = 
-+		getConfigAccess(
-+			"org.openoffice.Setup/Office/InstalledLocales", sal_False);    
-+    if (xAccess.is())
-+    	seqLanguages = xAccess->getElementNames();
-+
-+    for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
-+    {
-+        if (usLocale.equals(seqLanguages[i]))
-+			return;
-+    }
-+
-+    // try fallback locales
-+    if (usLocale.equalsAscii("zh-HK")) 
-+	{
-+		OUString sTemp = OUString::createFromAscii("zh-TW");
-+    	for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
-+    	{
-+        	if (sTemp.equals(seqLanguages[i]))
-+			{
-+                usLocale = sTemp;
-+				return;
-+			}
-+    	}
-+	}
-+
-+    // no exact match was found, well try to find a substitute
-+    OUString aInstalledLocale;
-+    for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
-+    {
-+        if (usLocale.indexOf(seqLanguages[i]) == 0)
-+        {
-+            // requested locale starts with the installed locale
-+            // (i.e. installed locale has index 0 in requested locale)
-+            usLocale = seqLanguages[i];
-+	    return;
-+            break;
-+        }
-+    }
-+    usLocale = OUString::createFromAscii("en-US");
-+}
-+
- void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariables& aPreDefPathVariables )
- {
- 	utl::ConfigManager* pCfgMgr = utl::ConfigManager::GetConfigManager();
-@@ -1253,7 +1343,10 @@
- 	Any aLocale = utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( utl::ConfigManager::LOCALE );
- 	rtl::OUString aLocaleStr;
- 	if ( aLocale >>= aLocaleStr )
-+	{
-+		getInstallMapping(aLocaleStr);
- 		aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr );
-+	}
- 	else
- 	{
- 		LOG_ERROR( "SubstitutePathVariables::SetPredefinedPathVariables", "Wrong Any type for language!" );
 Index: util/makefile.mk
 ===================================================================
 RCS file: /cvs/framework/framework/util/makefile.mk,v
@@ -782,3 +660,184 @@
  
  				next;	# removing this file from list, if sourcepath is empty
  			}
+Index: inc/unotools/localedatawrapper.hxx
+===================================================================
+RCS file: /cvs/util/unotools/inc/unotools/localedatawrapper.hxx,v
+retrieving revision 1.28.38.1
+diff -u -r1.28.38.1 localedatawrapper.hxx
+--- openoffice.org.orig/unotools/inc/unotools/localedatawrapper.hxx	19 Jan 2007 15:29:43 -0000	1.28.38.1
++++ openoffice.org/unotools/inc/unotools/localedatawrapper.hxx	28 Jun 2007 13:55:45 -0000
+@@ -363,5 +363,7 @@
+     static  void                evaluateLocaleDataChecking();
+ };
+ 
++UNOTOOLS_DLLPUBLIC void getInstallMapping(rtl::OUString& usLocale);
++
+ 
+ #endif // _UNOTOOLS_LOCALEDATAWRAPPER_HXX
+Index: source/i18n/localedatawrapper.cxx
+===================================================================
+RCS file: /cvs/util/unotools/source/i18n/localedatawrapper.cxx,v
+retrieving revision 1.36.16.1
+diff -u -r1.36.16.1 localedatawrapper.cxx
+--- openoffice.org.orig/unotools/source/i18n/localedatawrapper.cxx	19 Jan 2007 15:30:09 -0000	1.36.16.1
++++ openoffice.org/unotools/source/i18n/localedatawrapper.cxx	28 Jun 2007 13:55:46 -0000
+@@ -1989,3 +1989,96 @@
+     else
+         OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
++
++#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
++#include <com/sun/star/container/XNameAccess.hpp>
++#endif
++
++#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
++#include <comphelper/processfactory.hxx>
++#endif
++
++using rtl::OUString;
++using rtl::OString;
++using namespace com::sun::star::uno;
++using namespace com::sun::star::container;
++using namespace com::sun::star::lang;
++
++Reference< XNameAccess > getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate)
++{
++    Reference< XNameAccess > xNameAccess;
++    try{
++        OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
++        OUString sAccessSrvc;
++        if (bUpdate)
++            sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
++        else
++            sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
++
++        OUString sConfigURL = OUString::createFromAscii(pPath);
++
++        // get configuration provider
++        Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
++        if (theMSF.is()) {
++            Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
++                theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW );
++
++            // access the provider
++            Sequence< Any > theArgs(1);
++            theArgs[ 0 ] <<= sConfigURL;
++            xNameAccess = Reference< XNameAccess > (
++                theConfigProvider->createInstanceWithArguments(
++                    sAccessSrvc, theArgs ), UNO_QUERY_THROW );
++        }
++    } catch (com::sun::star::uno::Exception& e)
++    {
++        OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
++        OSL_ENSURE(sal_False, aMsg.getStr());
++    }
++    return xNameAccess;
++}
++
++void getInstallMapping(OUString& usLocale)
++{
++    Sequence< OUString > seqLanguages;
++    Reference< XNameAccess > xAccess = 
++               getConfigAccess(
++                       "org.openoffice.Setup/Office/InstalledLocales", sal_False);    
++    if (xAccess.is())
++       seqLanguages = xAccess->getElementNames();
++
++    for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
++    {
++        if (usLocale.equals(seqLanguages[i]))
++                       return;
++    }
++
++    // try fallback locales
++    if (usLocale.equalsAscii("zh-HK")) 
++       {
++               OUString sTemp = OUString::createFromAscii("zh-TW");
++       for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
++       {
++               if (sTemp.equals(seqLanguages[i]))
++                       {
++                usLocale = sTemp;
++                               return;
++                       }
++       }
++       }
++
++    // no exact match was found, well try to find a substitute
++    OUString aInstalledLocale;
++    for (sal_Int32 i=0; i<seqLanguages.getLength(); i++)
++    {
++        if (usLocale.indexOf(seqLanguages[i]) == 0)
++        {
++            // requested locale starts with the installed locale
++            // (i.e. installed locale has index 0 in requested locale)
++            usLocale = seqLanguages[i];
++           return;
++            break;
++        }
++    }
++    usLocale = OUString::createFromAscii("en-US");
++}
+Index: source/services/substitutepathvars.cxx
+===================================================================
+RCS file: /cvs/framework/framework/source/services/substitutepathvars.cxx,v
+retrieving revision 1.17
+diff -u -r1.17 substitutepathvars.cxx
+--- openoffice.org.orig/framework/source/services/substitutepathvars.cxx	16 Sep 2006 14:12:15 -0000	1.17
++++ openoffice.org/framework/source/services/substitutepathvars.cxx	28 Jun 2007 13:59:22 -0000
+@@ -129,7 +129,7 @@
+ #endif
+ 
+ #include <comphelper/configurationhelper.hxx>
+-
++#include <unotools/localedatawrapper.hxx>
+ //_________________________________________________________________________________________________________________
+ //	Defines
+ //_________________________________________________________________________________________________________________
+@@ -1264,7 +1264,10 @@
+ 	Any aLocale = utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( utl::ConfigManager::LOCALE );
+ 	rtl::OUString aLocaleStr;
+ 	if ( aLocale >>= aLocaleStr )
++	{
++		getInstallMapping(aLocaleStr);
+ 		aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr );
++	}
+ 	else
+ 	{
+ 		LOG_ERROR( "SubstitutePathVariables::SetPredefinedPathVariables", "Wrong Any type for language!" );
+Index: unx/gtk/gdi/salnativewidgets-gtk.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx,v
+retrieving revision 1.35.34.1
+diff -u -r1.35.34.1 salnativewidgets-gtk.cxx
+--- openoffice.org.orig/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx	24 Jan 2007 13:35:35 -0000	1.35.34.1
++++ openoffice.org/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx	28 Jun 2007 14:02:41 -0000
+@@ -57,6 +57,7 @@
+ #include <saldisp.hxx>
+ #endif
+ 
++#include <unotools/localedatawrapper.hxx>
+ 
+ // initialize statics
+ BOOL GtkSalGraphics::bThemeChanged = TRUE;
+@@ -3103,7 +3104,18 @@
+ #endif
+ 
+     // match font to e.g. resolve "Sans"
+-    psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILocale() );
++    com::sun::star::lang::Locale aLocale = rSettings.GetUILocale();
++    rtl::OUString sUILocale(aLocale.Language);
++    if (aLocale.Country.getLength())
++        sUILocale = sUILocale + '-' + aLocale.Country;
++    getInstallMapping(sUILocale);
++    sal_Int32 nIndex = 0;
++    aLocale.Language = sUILocale.getToken( 0, sal_Unicode('-'), nIndex );
++    if( nIndex != -1 )
++        aLocale.Country = sUILocale.getToken( 0, sal_Unicode('-'), nIndex );
++    else
++        aLocale.Country = OUString();
++    psp::PrintFontManager::get().matchFont( aInfo, aLocale );
+ 
+ #if OSL_DEBUG_LEVEL > 1
+     fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.1221
retrieving revision 1.1222
diff -u -r1.1221 -r1.1222
--- openoffice.org.spec	27 Jun 2007 08:51:15 -0000	1.1221
+++ openoffice.org.spec	28 Jun 2007 14:04:29 -0000	1.1222
@@ -1,6 +1,6 @@
 %define oootag OOF680
 %define ooomilestone 18
-%define rh_rpm_release 4
+%define rh_rpm_release 5
 
 # undef to get english only and no-langpacks for a faster smoketest build
 %define langpacks 1
@@ -2684,8 +2684,9 @@
 %{instdir}/share/registry/modules/org/openoffice/Office/Scripting/Scripting-python.xcu
 
 %changelog
-* Wed Jun 27 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.2.1-18.5
+* Wed Jun 27 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.2.1-18.5.UNRELEASED
 - Resolves: rhbz#245729 openoffice.org-2.2.1.ooo78921.sw.embedded.patch
+- update setlangtolocale for prettier fonts when appropiate langpack is missing
 
 * Tue Jun 26 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.2.1-18.4
 - require new hunspell-ar for arabic langpack




More information about the fedora-extras-commits mailing list