diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-06-25 14:39:46 +0200 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-06-25 14:39:46 +0200 |
commit | bc9a2076300859ea109ec02329bfde4ea2920ecc (patch) | |
tree | 3302de621788fb5a4d5c9cb6351cc3d08418943a /toolkit | |
parent | 92e466460bd66156679acd32a4eec2697a013559 (diff) |
unoawt2: #i112683 localize string list
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b79fee56e3d8..625ae4e4616b 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/awt/ImageScaleMode.hpp> #include <com/sun/star/awt/XItemList.hpp> #include <comphelper/componentcontext.hxx> @@ -2163,11 +2164,29 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw pListBox->Clear(); + uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); + bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ); + uno::Reference< resource::XStringResourceResolver > xStringResourceResolver; + if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) ) + { + xStringResourceResolver.set( + xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ), + uno::UNO_QUERY + ); + } + + Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW ); uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems(); for ( sal_Int32 i=0; i<aItems.getLength(); ++i ) { - pListBox->InsertEntry( aItems[i].First, lcl_getImageFromURL( aItems[i].Second ) ); + ::rtl::OUString aLocalizationKey( aItems[i].First ); + if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' ) + { + aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 )); + } + pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) ); } } |