[ooo-build-commit] .: svx/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Sep 30 08:33:32 PDT 2010
svx/source/unodraw/unoprov.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 98e58d030037891e5f1596b449a3c385370381af
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 30 16:33:23 2010 +0100
#i110142# make search/replace of colour names with translations safer
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 91e3b9e..e69d6d2 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -1295,12 +1295,24 @@ static USHORT __READONLY_DATA SvxUnoColorNameResId[] =
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 );
More information about the ooo-build-commit
mailing list