[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Mar 1 15:37:57 PST 2011


 sc/source/filter/excel/xechart.cxx |   22 +++++++++++++---------
 sc/source/filter/inc/xechart.hxx   |    3 ++-
 2 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit a2de3f3de0b61f290418dc4e93a9626822474d6d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 18:35:29 2011 -0500

    Replace use of ScfRefMap with boost::ptr_map.

diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 83f215c..db14db2 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -149,6 +149,16 @@ void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef xRec, sal_uInt16 nRecId
     }
 }
 
+template<typename ValueType, typename KeyType>
+void lclSaveRecord(XclExpStream& rStrm, ValueType* pRec, sal_uInt16 nRecId, KeyType nValue)
+{
+    if (pRec)
+    {
+        XclExpValueRecord<KeyType>(nRecId, nValue).Save(rStrm);
+        pRec->Save(rStrm);
+    }
+}
+
 void lclWriteChFrBlockRecord( XclExpStream& rStrm, const XclChFrBlock& rFrBlock, bool bBegin )
 {
     sal_uInt16 nRecId = bBegin ? EXC_ID_CHFRBLOCKBEGIN : EXC_ID_CHFRBLOCKEND;
@@ -2413,14 +2423,7 @@ void XclExpChTypeGroup::ConvertSeries(
                 if (bConnectBars && (maTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR))
                 {
                     sal_uInt16 nKey = EXC_CHCHARTLINE_CONNECT;
-                    XclExpChLineFormatRef p(new XclExpChLineFormat(GetChRoot()));
-                    XclExpChLineFormatMap::iterator itr = maChartLines.lower_bound(nKey);
-                    if (itr != maChartLines.end() && !(maChartLines.key_comp()(nKey, itr->first)))
-                        // Overwrite the existing element.
-                        itr->second = p;
-                    else
-                        // Insert new element.
-                        maChartLines.insert(itr, XclExpChLineFormatMap::value_type(nKey, p));
+                    maChartLines.insert(nKey, new XclExpChLineFormat(GetChRoot()));
                 }
             }
             else
@@ -2512,7 +2515,8 @@ void XclExpChTypeGroup::CreateAllStockSeries(
         ScfPropertySet aSeriesProp( xDataSeries );
         XclExpChLineFormatRef xLineFmt( new XclExpChLineFormat( GetChRoot() ) );
         xLineFmt->Convert( GetChRoot(), aSeriesProp, EXC_CHOBJTYPE_HILOLINE );
-        maChartLines[ EXC_CHCHARTLINE_HILO ] = xLineFmt;
+        sal_uInt16 nKey = EXC_CHCHARTLINE_HILO;
+        maChartLines.insert(nKey, new XclExpChLineFormat(GetChRoot()));
     }
     // dropbars
     if( bHasOpen && bHasClose )
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index 86c75ce..ddad026 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -37,6 +37,7 @@
 #include "xeroot.hxx"
 #include "xestring.hxx"
 #include <boost/shared_ptr.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
 
 class Size;
 
@@ -987,7 +988,7 @@ private:
 
 private:
     typedef XclExpRecordList< XclExpChSeries >          XclExpChSeriesList;
-    typedef ScfRefMap< sal_uInt16, XclExpChLineFormat > XclExpChLineFormatMap;
+    typedef ::boost::ptr_map<sal_uInt16, XclExpChLineFormat> XclExpChLineFormatMap;
 
     XclChTypeGroup      maData;             /// Contents of the CHTYPEGROUP record.
     XclExpChType        maType;             /// Chart type (e.g. CHBAR, CHLINE, ...).


More information about the Libreoffice-commits mailing list