chart2/source/controller/dialogs/DialogModel.cxx |   27 ++++++++++++-----------
 1 file changed, 15 insertions(+), 12 deletions(-)

New commits:
commit da866a12fac748991a25870bf2a36076a47f90b2
Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk>
Date:   Sun Jun 22 03:37:24 2014 +0200

    extract common code
    
    Change-Id: I9327f232f1edb9ef052eb7868ac60774f3b6e4cf
    Reviewed-on: https://gerrit.libreoffice.org/10072
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/chart2/source/controller/dialogs/DialogModel.cxx 
b/chart2/source/controller/dialogs/DialogModel.cxx
index e3f9384..4cab7d9 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 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to