diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-03-16 19:01:31 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-03-16 19:01:31 +0000 |
commit | 44e008b01f72c3f02ab3328cdc44f987617f272b (patch) | |
tree | 77a3fd345db6b1965e2af144669343af752452d0 /vcl/source/app/i18nhelp.cxx | |
parent | 1c36c112707677fe89e427b3baf93c7c0b78d17d (diff) |
CWS-TOOLING: integrate CWS ooo31gsl4_DEV300
2009-03-11 16:07:53 +0100 gh r269340 : missed compile on bigendian system (OSL_BIGENDIAN defined)
2009-03-11 10:22:27 +0100 pl r269300 : #i100057# one more case
2009-03-10 15:10:01 +0100 pl r269274 : #i100057# filter formatting marks in vcl i18n helper
2009-03-10 13:31:01 +0100 gh r269269 : #i100044#remove BiDi markers before sending to VCLTestTool
2009-03-10 10:16:05 +0100 hdu r269248 : #i100057# fix casefolding::getNextChar() end-of-string behaviour
2009-03-10 09:51:36 +0100 hdu r269245 : #i100044# add TransliterationModules_IGNORE_FORMATTING option
2009-03-09 14:30:00 +0100 pl r269176 : #i99360# workaround XIfEvent never returning
Diffstat (limited to 'vcl/source/app/i18nhelp.cxx')
-rw-r--r-- | vcl/source/app/i18nhelp.cxx | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index 5b0d45773512..1622fe3e5bea 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -31,25 +31,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include "vcl/i18nhelp.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/i18n/TransliterationModules.hpp" +#include "unotools/localedatawrapper.hxx" +#include "unotools/transliterationwrapper.hxx" +#include "i18npool/mslangid.hxx" -#include <vcl/i18nhelp.hxx> - -/* -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - - -#include <comphelper/processfactory.hxx> -*/ - -// #include <cppuhelper/servicefactory.hxx> - - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/i18n/TransliterationModules.hpp> -#include <unotools/localedatawrapper.hxx> -#include <unotools/transliterationwrapper.hxx> -#include <i18npool/mslangid.hxx> +#include "rtl/ustrbuf.hxx" using namespace ::com::sun::star; @@ -104,6 +94,37 @@ const ::com::sun::star::lang::Locale& vcl::I18nHelper::getLocale() const return maLocale; } +inline bool is_formatting_mark( sal_Unicode c ) +{ + if( (c >= 0x200B) && (c <= 0x200F) ) // BiDi and zero-width-markers + return true; + if( (c >= 0x2028) && (c <= 0x202E) ) // BiDi and paragraph-markers + return true; + return false; +} + +/* #i100057# filter formatting marks out of strings before passing them to + the transliteration. The real solution would have been an additional TransliterationModule + to ignore these marks during transliteration; however changin the code in i18npool that actually + implements this could produce unwanted side effects. + + Of course this copying around is not really good, but looking at i18npool, one more time + will not hurt. +*/ +String vcl::I18nHelper::filterFormattingChars( const String& rStr ) +{ + sal_Int32 nUnicodes = rStr.Len(); + rtl::OUStringBuffer aBuf( nUnicodes ); + const sal_Unicode* pStr = rStr.GetBuffer(); + while( nUnicodes-- ) + { + if( ! is_formatting_mark( *pStr ) ) + aBuf.append( *pStr ); + pStr++; + } + return aBuf.makeStringAndClear(); +} + sal_Int32 vcl::I18nHelper::CompareString( const String& rStr1, const String& rStr2 ) const { ::osl::Guard< ::osl::Mutex > aGuard( ((vcl::I18nHelper*)this)->maMutex ); @@ -117,7 +138,10 @@ sal_Int32 vcl::I18nHelper::CompareString( const String& rStr1, const String& rSt ((vcl::I18nHelper*)this)->mpTransliterationWrapper = NULL; } - return ImplGetTransliterationWrapper().compareString( rStr1, rStr2 ); + + String aStr1( filterFormattingChars(rStr1) ); + String aStr2( filterFormattingChars(rStr2) ); + return ImplGetTransliterationWrapper().compareString( aStr1, aStr2 ); } sal_Bool vcl::I18nHelper::MatchString( const String& rStr1, const String& rStr2 ) const @@ -133,7 +157,9 @@ sal_Bool vcl::I18nHelper::MatchString( const String& rStr1, const String& rStr2 ((vcl::I18nHelper*)this)->mpTransliterationWrapper = NULL; } - return ImplGetTransliterationWrapper().isMatch( rStr1, rStr2 ); + String aStr1( filterFormattingChars(rStr1) ); + String aStr2( filterFormattingChars(rStr2) ); + return ImplGetTransliterationWrapper().isMatch( aStr1, aStr2 ); } sal_Bool vcl::I18nHelper::MatchMnemonic( const String& rString, sal_Unicode cMnemonicChar ) const |