rpms/openoffice.org/devel openoffice.org-3.0.0.ooo87882.lingucomponent.systemdicts.patch, NONE, 1.1 openoffice.org.spec, 1.1465, 1.1466 openoffice.org-2.1.0.oooXXXXX.lingucomponent.systemdicts.patch, 1.4, NONE

Caolan McNamara (caolanm) fedora-extras-commits at redhat.com
Fri Apr 4 14:39:42 UTC 2008


Author: caolanm

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

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-3.0.0.ooo87882.lingucomponent.systemdicts.patch 
Removed Files:
	openoffice.org-2.1.0.oooXXXXX.lingucomponent.systemdicts.patch 
Log Message:
start upstreaming system dicts

openoffice.org-3.0.0.ooo87882.lingucomponent.systemdicts.patch:

--- NEW FILE openoffice.org-3.0.0.ooo87882.lingucomponent.systemdicts.patch ---
diff -ru lingucomponent/source/lingutil/lingutil.cxx lingucomponent/source/lingutil/lingutil.cxx
--- openoffice.org.orig/lingucomponent/source/lingutil/lingutil.cxx	2008-04-04 14:15:10.000000000 +0100
+++ openoffice.org/lingucomponent/source/lingutil/lingutil.cxx	2008-04-04 15:23:40.000000000 +0100
@@ -146,6 +146,9 @@
     
 	rtl::OUString aFormatName;
 	String aDicExtension;
+	rtl::OUString aSystemDir;
+	rtl::OUString aSystemPrefix;
+	rtl::OUString aSystemSuffix;
 	bool bSpell = false;
 	bool bHyph  = false;
 	bool bThes  = false;
@@ -153,18 +156,26 @@
 	{
 		aFormatName		= A2OU("DICT_SPELL");
 		aDicExtension	= String::CreateFromAscii( ".dic" );
+		aSystemDir 		= A2OU( "file:///usr/share/myspell" );
+		aSystemSuffix	= aDicExtension;
 		bSpell = true;
 	}
     else if (strcmp( pDicType, "HYPH" ) == 0)
 	{
 		aFormatName		= A2OU("DICT_HYPH");
 		aDicExtension	= String::CreateFromAscii( ".dic" );
+		aSystemDir 		= A2OU( "file:///usr/share/hyphen" );
+		aSystemPrefix	= A2OU( "hyph_" );
+		aSystemSuffix	= aDicExtension;
 		bHyph = true;
 	}
     else if (strcmp( pDicType, "THES" ) == 0)
 	{
 		aFormatName		= A2OU("DICT_THES");
 		aDicExtension	= String::CreateFromAscii( ".dat" );
+		aSystemDir 		= A2OU( "file:///usr/share/mythes" );
+		aSystemPrefix	= A2OU( "th_" );
+		aSystemSuffix	= A2OU( "_v2.dat" );
 		bThes = true;
 	}
 
@@ -173,7 +184,10 @@
 		return aRes;
 
     dictentry * pDict = NULL;  // shared dict entry pointer
-    std::set< dictentry *, lt_dictentry > aAvailableDics;
+
+	// set of languages to remember the language where it is already
+	// decided to make use of the dictionary.
+	std::set< LanguageType > aDicLangInUse;
 
 	const sal_Int16 USER_LAYER = 0;
     for (int k = 0;  k < 2;  ++k)
@@ -194,10 +208,6 @@
         DictMgr aDictMgr( aSysPathToFile.getStr(), pDicType );
         int nDicts = aDictMgr.get_list( &pDict );
 
-		// set of languages to remember the language where it is already
-		// decided to make use of the dictionary.
-		std::set< LanguageType > aDicLangInUse;
-
 		// Test for existence of the actual dictionary files
 		// and remember the ones we like to use...
 		for (int i = 0;  i < nDicts;  ++i)
@@ -248,6 +258,49 @@
 		}
     }    
 
+    osl::Directory aSystemDicts(aSystemDir);
+    if (aSystemDicts.open() == osl::FileBase::E_None)
+    {
+        osl::DirectoryItem aItem;
+        osl::FileStatus aFileStatus(FileStatusMask_FileURL);
+        while (aSystemDicts.getNextItem(aItem) == osl::FileBase::E_None)
+        {
+            aItem.getFileStatus(aFileStatus);
+            rtl::OUString sPath = aFileStatus.getFileURL();
+            if (sPath.lastIndexOf(aSystemSuffix) == sPath.getLength()-aSystemSuffix.getLength())
+            {
+                sal_Int32 nStartIndex = sPath.lastIndexOf(sal_Unicode('/')) + 1;
+				if (!sPath.match(aSystemPrefix, nStartIndex))
+					continue;
+                sal_Int32 nIndex = nStartIndex + aSystemPrefix.getLength();
+                rtl::OUString sLang = sPath.getToken( 0, '_', nIndex );
+                rtl::OUString sRegion = sPath.copy( nIndex, sPath.getLength() - nIndex - aSystemSuffix.getLength());
+				if (!sLang.getLength() || !sRegion.getLength())
+					continue;
+
+				// Thus we first get the language of the dictionary
+				LanguageType nLang = MsLangId::convertIsoNamesToLanguage(
+    	            sLang, sRegion );
+		
+				if (aDicLangInUse.count( nLang ) == 0)
+				{
+					// remember the new language in use
+					aDicLangInUse.insert( nLang );
+
+					// add the dictionary to the resulting vector
+					SvtLinguConfigDictionaryEntry aDicEntry;
+					aDicEntry.aLocations.realloc(1);
+					aDicEntry.aLocaleNames.realloc(1);
+					rtl::OUString aLocaleName( MsLangId::convertLanguageToIsoString( nLang ) );
+	                aDicEntry.aLocations[0]   = sPath;
+					aDicEntry.aFormatName	  = aFormatName;
+					aDicEntry.aLocaleNames[0] = aLocaleName;
+					aRes.push_back( aDicEntry );
+				}
+            }
+        }
+	}
+
     return aRes;
 }    
 


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.1465
retrieving revision 1.1466
diff -u -r1.1465 -r1.1466
--- openoffice.org.spec	4 Apr 2008 14:29:04 -0000	1.1465
+++ openoffice.org.spec	4 Apr 2008 14:38:50 -0000	1.1466
@@ -97,7 +97,7 @@
 Patch24: openoffice.org.2.0.4.ooo80412.i18npool.extendgrapheme.patch
 Patch25: openoffice.org-2.1.0.ooo65491.psprint.enablenups.patch
 Patch26: openoffice.org-2.0.3.rh127576.gtkunixprintdialog.localize
-Patch27: openoffice.org-2.1.0.oooXXXXX.lingucomponent.systemdicts.patch
+Patch27: openoffice.org-3.0.0.ooo87882.lingucomponent.systemdicts.patch
 Patch28: openoffice.org-2.1.0.rh217269.officecfg.nosequencecheck.patch
 Patch29: workspace.tl37.patch
 Patch30: openoffice.org-2.1.0.ooo73201.sw.a11yloadcrash.patch
@@ -1079,7 +1079,7 @@
 %patch24 -p1 -b .ooo80412.i18npool.extendgrapheme.patch
 %patch25 -p1 -b .ooo65491.psprint.enablenups.patch
 cat %{PATCH26} >> svtools/source/dialogs/localize.sdf
-%patch27 -p1 -b .oooXXXXX.lingucomponent.systemdicts.patch
+%patch27 -p1 -b .ooo87882.lingucomponent.systemdicts.patch
 %patch28 -p1 -b .rh217269.officecfg.nosequencecheck.patch
 %patch29 -p1 -b .tl37.patch
 %patch30 -p1 -b .ooo73201.sw.a11yloadcrash.patch


--- openoffice.org-2.1.0.oooXXXXX.lingucomponent.systemdicts.patch DELETED ---




More information about the fedora-extras-commits mailing list