diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-06-22 03:37:24 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-07-11 15:29:12 +0000 |
commit | da866a12fac748991a25870bf2a36076a47f90b2 (patch) | |
tree | 377b4478bc79621b41c750b57a4ddbcfdbdc9cba /chart2 | |
parent | 589b256452e729e05d9610f10fb2408810e56eb6 (diff) |
extract common code
Change-Id: I9327f232f1edb9ef052eb7868ac60774f3b6e4cf
Reviewed-on: https://gerrit.libreoffice.org/10072
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/dialogs/DialogModel.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index e3f9384c90b4..4cab7d99eb48 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -468,6 +468,19 @@ Reference< data::XDataProvider > DialogModel::getDataProvider() const return aResult; } +namespace { + +void addMissingRoles(DialogModel::tRolesWithRanges& rResult, const uno::Sequence<OUString>& rRoles) +{ + for(sal_Int32 i = 0, n = rRoles.getLength(); i < n; ++i) + { + if(rResult.find(rRoles[i]) == rResult.end()) + rResult.insert(DialogModel::tRolesWithRanges::value_type(rRoles[i], OUString())); + } +} + +} + DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges( const Reference< XDataSeries > & xSeries, const OUString & aRoleOfSequenceForLabel, @@ -484,21 +497,11 @@ DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges( { // add missing mandatory roles Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles()); - OUString aEmptyString; - sal_Int32 nI = 0; - for( nI=0; nI < aRoles.getLength(); ++nI ) - { - if( aResult.find( aRoles[nI] ) == aResult.end() ) - aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString )); - } + addMissingRoles(aResult, aRoles); // add missing optional roles aRoles = xChartType->getSupportedOptionalRoles(); - for( nI=0; nI < aRoles.getLength(); ++nI ) - { - if( aResult.find( aRoles[nI] ) == aResult.end() ) - aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString )); - } + addMissingRoles(aResult, aRoles); } } catch( const uno::Exception & ex ) |