[Libreoffice-commits] .: 2 commits - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Dec 8 12:49:43 PST 2010


 sc/source/filter/excel/xichart.cxx |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 9fcede94160a82507beaec16a8c7405c9c117fe3
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Dec 8 15:48:59 2010 -0500

    Remove use of operator[] once again.

diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index a47bd25..15e6a9f 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2702,17 +2702,17 @@ Reference< XLabeledDataSequence > XclImpChTypeGroup::CreateCategSequence() const
 
 void XclImpChTypeGroup::ReadChDropBar( XclImpStream& rStrm )
 {
-    sal_uInt16 nDropBar = EXC_CHDROPBAR_NONE;
-    if( !maDropBars.has( EXC_CHDROPBAR_UP ) )
-        nDropBar = EXC_CHDROPBAR_UP;
-    else if( !maDropBars.has( EXC_CHDROPBAR_DOWN ) )
-        nDropBar = EXC_CHDROPBAR_DOWN;
-
-    if( nDropBar != EXC_CHDROPBAR_NONE )
+    if (maDropBars.find(EXC_CHDROPBAR_UP) == maDropBars.end())
+    {
+        XclImpChDropBarRef p(new XclImpChDropBar(EXC_CHDROPBAR_UP));
+        p->ReadRecordGroup(rStrm);
+        maDropBars.insert(XclImpChDropBarMap::value_type(EXC_CHDROPBAR_UP, p));
+    }
+    else if(maDropBars.find(EXC_CHDROPBAR_DOWN) == maDropBars.end())
     {
-        XclImpChDropBarRef xDropBar( new XclImpChDropBar( nDropBar ) );
-        xDropBar->ReadRecordGroup( rStrm );
-        maDropBars[ nDropBar ] = xDropBar;
+        XclImpChDropBarRef p(new XclImpChDropBar(EXC_CHDROPBAR_DOWN));
+        p->ReadRecordGroup(rStrm);
+        maDropBars.insert(XclImpChDropBarMap::value_type(EXC_CHDROPBAR_DOWN, p));
     }
 }
 
commit f19bf80dd1d553d942a6f292c4d3535f2c1addb1
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Dec 8 15:30:53 2010 -0500

    Another removal of use of operator[] with std::map.

diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index e047a31..a47bd25 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2011,7 +2011,13 @@ void XclImpChSeries::ReadChSerErrorBar( XclImpStream& rStrm )
 {
     XclImpChSerErrorBarRef xErrorBar( new XclImpChSerErrorBar( GetChRoot() ) );
     xErrorBar->ReadChSerErrorBar( rStrm );
-    maErrorBars[ xErrorBar->GetBarType() ] = xErrorBar;
+    sal_uInt8 nBarType = xErrorBar->GetBarType();
+    XclImpChSerErrorBarMap::iterator itr = maErrorBars.find(nBarType);
+    if (itr != maErrorBars.end())
+        // Remove existing element.
+        maErrorBars.erase(itr);
+
+    maErrorBars.insert(XclImpChSerErrorBarMap::value_type(nBarType, xErrorBar));
 }
 
 XclImpChDataFormatRef XclImpChSeries::CreateDataFormat( sal_uInt16 nPointIdx, sal_uInt16 nFormatIdx )


More information about the Libreoffice-commits mailing list