summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-06-22 03:37:24 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-06-22 05:05:00 +0200
commit086d93f130c9e53d77ed25098cfefaabe5c108e2 (patch)
tree97c9ccbad02f980694445c4e13c1948adae65a87
parenta1d2c88124058a98b25d725927462ee734f71d85 (diff)
extract common code
Change-Id: I9327f232f1edb9ef052eb7868ac60774f3b6e4cf
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx27
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 )