Kaydet (Commit) cf5fbc12 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

try to limit the getPropertyValue calls

Change-Id: I70b7a3b5f508ecb89d4e4e43cc4297805e83c9f7
üst 02b73e77
......@@ -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 );
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment