diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-02-21 01:55:38 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-22 05:52:26 +0100 |
commit | cf5fbc124e29fb558f423152fa6bd2237de43608 (patch) | |
tree | 503eb5cc21296fafb0a8cb6f360c4db9ea525387 /chart2 | |
parent | 02b73e7770868bd077c1916457e199f0e57b47ec (diff) |
try to limit the getPropertyValue calls
Change-Id: I70b7a3b5f508ecb89d4e4e43cc4297805e83c9f7
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/PropertyMapper.cxx | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index b4c276c17299..edd74c178453 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -80,19 +80,41 @@ void PropertyMapper::getValueMap( tPropertyNameMap::const_iterator aIt( rNameMap.begin() ); tPropertyNameMap::const_iterator aEnd( rNameMap.end() ); - for( ; aIt != aEnd; ++aIt ) + uno::Reference< beans::XMultiPropertySet > xMultiPropSet(xSourceProp, uno::UNO_QUERY); + if(xMultiPropSet.is()) { - OUString aTarget = aIt->first; - OUString aSource = aIt->second; - try + uno::Sequence< rtl::OUString > aPropSourceNames(rNameMap.size()); + uno::Sequence< rtl::OUString > aPropTargetNames(rNameMap.size()); + for(sal_Int32 i = 0; aIt != aEnd; ++aIt, ++i) { - uno::Any aAny( xSourceProp->getPropertyValue(aSource) ); - if( aAny.hasValue() ) - rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) ); + aPropSourceNames[i] = aIt->first; + aPropTargetNames[i] = aIt->second; } - catch( const uno::Exception& e ) + + uno::Sequence< uno::Any > xValues = xMultiPropSet->getPropertyValues(aPropSourceNames); + + for(sal_Int32 i = 0, n = rNameMap.size(); i < n; ++i) + { + if( xValues[i].hasValue() ) + rValueMap.insert( tPropertyNameValueMap::value_type( aPropTargetNames[i], xValues[i] ) ); + } + } + else + { + for( ; aIt != aEnd; ++aIt ) { - ASSERT_EXCEPTION( e ); + OUString aTarget = aIt->first; + OUString aSource = aIt->second; + try + { + uno::Any aAny( xSourceProp->getPropertyValue(aSource) ); + if( aAny.hasValue() ) + rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) ); + } + catch( const uno::Exception& e ) + { + ASSERT_EXCEPTION( e ); + } } } } |