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

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Dec 8 13:21:18 PST 2010


 sc/source/filter/excel/xichart.cxx |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

New commits:
commit bc8e160caf6b3c5cd894463de66de2b85b46b45d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Dec 8 16:20:54 2010 -0500

    Nuke more operator[] usage with std::map.

diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 20c68e5..35de87d 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -3692,11 +3692,13 @@ void XclImpChChart::ReadChDataFormat( XclImpStream& rStrm )
     xDataFmt->ReadRecordGroup( rStrm );
     if( xDataFmt->GetPointPos().mnSeriesIdx <= EXC_CHSERIES_MAXSERIES )
     {
-        XclImpChDataFormatRef& rxMapFmt = maDataFmts[ xDataFmt->GetPointPos() ];
+        const XclChDataPointPos& rPos = xDataFmt->GetPointPos();
+        if (maDataFmts.find(rPos) == maDataFmts.end())
+            // No element exists for this data point.  Insert it.
+            maDataFmts.insert(XclImpChDataFormatMap::value_type(rPos, xDataFmt));
+
         /*  Do not overwrite existing data format group, Excel always uses the
             first data format group occuring in any CHSERIES group. */
-        if( !rxMapFmt )
-            rxMapFmt = xDataFmt;
     }
 }
 
commit 52badc1805546470ba04ad55da4f2330d306fa36
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Dec 8 16:00:04 2010 -0500

    More operator[] usage removal with std::map.

diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 15e6a9f..20c68e5 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -3356,7 +3356,8 @@ void XclImpChAxesSet::Finalize()
             XclImpChTypeGroupRef xTypeGroup = aIt->second;
             xTypeGroup->Finalize();
             if( xTypeGroup->IsValidGroup() )
-                aValidGroups[ aIt->first ] = xTypeGroup;
+                aValidGroups.insert(
+                    XclImpChTypeGroupMap::value_type(aIt->first, xTypeGroup));
         }
         maTypeGroups.swap( aValidGroups );
     }
@@ -3493,7 +3494,14 @@ void XclImpChAxesSet::ReadChTypeGroup( XclImpStream& rStrm )
 {
     XclImpChTypeGroupRef xTypeGroup( new XclImpChTypeGroup( GetChRoot() ) );
     xTypeGroup->ReadRecordGroup( rStrm );
-    maTypeGroups[ xTypeGroup->GetGroupIdx() ] = xTypeGroup;
+    sal_uInt16 nGroupIdx = xTypeGroup->GetGroupIdx();
+    XclImpChTypeGroupMap::iterator itr = maTypeGroups.find(nGroupIdx);
+    if (itr != maTypeGroups.end())
+        // Remove existing element before inserting a new one.
+        maTypeGroups.erase(itr);
+
+    maTypeGroups.insert(
+        XclImpChTypeGroupMap::value_type(nGroupIdx, xTypeGroup));
 }
 
 Reference< XCoordinateSystem > XclImpChAxesSet::CreateCoordSystem( Reference< XDiagram > xDiagram ) const


More information about the Libreoffice-commits mailing list