Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > cd8ce32c919af60229fca1d7f792c60e > files > 55

openoffice.org-3.2.0-12.35.fc13.src.rpm

diff -ru svx.orig/source/unodraw/unoprov.cxx svx/source/unodraw/unoprov.cxx
--- svx.orig/source/unodraw/unoprov.cxx	2010-03-15 14:31:21.000000000 +0000
+++ svx/source/unodraw/unoprov.cxx	2010-03-15 15:17:05.000000000 +0000
@@ -1368,12 +1370,24 @@
 
 bool SvxUnoConvertResourceString( USHORT* pSourceResIds, USHORT* pDestResIds, int nCount, String& rString ) throw()
 {
-	int i = 0;
+    //We replace e.g. "Gray 10%" with the translation of Gray, but we shouldn't
+    //replace "Red Hat 1" with the translation of Red :-)
+    rtl::OUString sStr(rString);
+    const sal_Unicode *pStr = sStr.getStr();
+    sal_Int32 nLength = sStr.getLength();
+    while( nLength > 0 )
+    {
+        const sal_Unicode nChar = pStr[nLength-1];
+        if (nChar != '%' && (nChar < '0' || nChar > '9'))
+            break;
+        nLength--;
+    }
+    sStr = rtl::OUString(pStr, nLength).trim();
 
-	for( i = 0; i < nCount; i++ )
+	for(int i = 0; i < nCount; ++i )
 	{
 		String aStrDefName = SVX_RESSTR( pSourceResIds[i] );
-		if( rString.Search( aStrDefName ) == 0 )
+		if( sStr.equals( aStrDefName ) )
 		{
 			String aReplace = SVX_RESSTR( pDestResIds[i] );
 			rString.Replace( 0, aStrDefName.Len(), aReplace );