[Libreoffice-commits] core.git: 2 commits - chart2/source oox/inc

Kohei Yoshida kohei.yoshida at collabora.com
Mon Jul 21 10:53:25 PDT 2014


 chart2/source/model/main/DataSeries.cxx   |   49 ++++++++++++++----------------
 oox/inc/drawingml/chart/seriescontext.hxx |    2 -
 2 files changed, 24 insertions(+), 27 deletions(-)

New commits:
commit 8952061d818f485d3343193a3729ef5eb1067d4d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Jul 21 13:38:10 2014 -0400

    Most certainly meant to be plural.
    
    Change-Id: I3772091c77307892b13d75cc6a5a191ec07c7bf5

diff --git a/oox/inc/drawingml/chart/seriescontext.hxx b/oox/inc/drawingml/chart/seriescontext.hxx
index 5f34ecf..98583ae 100644
--- a/oox/inc/drawingml/chart/seriescontext.hxx
+++ b/oox/inc/drawingml/chart/seriescontext.hxx
@@ -46,7 +46,7 @@ public:
 
 struct DataLabelsModel;
 
-/** Handler for a chart data point label context (c:dLbl element).
+/** Handler for a chart data point label context (c:dLbls element).
  */
 class DataLabelsContext : public ContextBase< DataLabelsModel >
 {
commit 38272ba9157c35d882642634c4bf9da7007802cd
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Jul 21 12:12:24 2014 -0400

    Scope reduction by throwing early.
    
    Change-Id: Ic0b7b69b8c4e57064b31ef62ddceaf6094ca9991

diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index f97f310..3189100 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -335,41 +335,38 @@ Reference< beans::XPropertySet >
 
     ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aValuesSeries(
         DataSeriesHelper::getAllDataSequencesByRole( aSequences , "values", true ) );
-    if( !aValuesSeries.empty() )
+
+    if (aValuesSeries.empty())
+        throw lang::IndexOutOfBoundsException();
+
+    Reference< chart2::data::XDataSequence > xSeq( aValuesSeries.front()->getValues() );
+    if( 0 <= nIndex && nIndex < xSeq->getData().getLength() )
     {
-        Reference< chart2::data::XDataSequence > xSeq( aValuesSeries.front()->getValues() );
-        if( 0 <= nIndex && nIndex < xSeq->getData().getLength() )
         {
+            MutexGuard aGuard( GetMutex() );
+            tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ) );
+            if( aIt != m_aAttributedDataPoints.end() )
+                xResult = (*aIt).second;
+        }
+        if( !xResult.is() )
+        {
+            Reference< beans::XPropertySet > xParentProperties;
+            Reference< util::XModifyListener > xModifyEventForwarder;
             {
                 MutexGuard aGuard( GetMutex() );
-                tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ) );
-                if( aIt != m_aAttributedDataPoints.end() )
-                    xResult = (*aIt).second;
+                xParentProperties = this;
+                xModifyEventForwarder = m_xModifyEventForwarder;
             }
-            if( !xResult.is() )
-            {
-                Reference< beans::XPropertySet > xParentProperties;
-                Reference< util::XModifyListener > xModifyEventForwarder;
-                {
-                    MutexGuard aGuard( GetMutex() );
-                    xParentProperties = this;
-                    xModifyEventForwarder = m_xModifyEventForwarder;
-                }
 
-                // create a new XPropertySet for this data point
-                xResult.set( new DataPoint( xParentProperties ) );
-                {
-                    MutexGuard aGuard( GetMutex() );
-                    m_aAttributedDataPoints[ nIndex ] = xResult;
-                }
-                ModifyListenerHelper::addListener( xResult, xModifyEventForwarder );
+            // create a new XPropertySet for this data point
+            xResult.set( new DataPoint( xParentProperties ) );
+            {
+                MutexGuard aGuard( GetMutex() );
+                m_aAttributedDataPoints[ nIndex ] = xResult;
             }
+            ModifyListenerHelper::addListener( xResult, xModifyEventForwarder );
         }
     }
-    else
-    {
-        throw lang::IndexOutOfBoundsException();
-    }
 
     return xResult;
 }


More information about the Libreoffice-commits mailing list