summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-03-01 19:53:55 -0500
committerKohei Yoshida <kyoshida@novell.com>2011-03-01 19:53:55 -0500
commit070a499b5ccfc0858f11124d6a79b07fe56199b1 (patch)
tree0217e53781dc1da01d2db8847d0015ea3fdaf91c /sc
parentdac3d1311bbaf75f1d182d59522768e0a67aae95 (diff)
Replaced another use of ScfRefMap with ptr_map.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xichart.cxx23
-rw-r--r--sc/source/filter/inc/xichart.hxx2
2 files changed, 13 insertions, 12 deletions
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 05b3ba559dc5..833048c8a4bf 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -137,6 +137,7 @@ using ::formula::FormulaToken;
using ::formula::StackVar;
using ::boost::shared_ptr;
using ::std::pair;
+using ::std::auto_ptr;
namespace cssc = ::com::sun::star::chart;
namespace cssc2 = ::com::sun::star::chart2;
@@ -2009,16 +2010,10 @@ void XclImpChSeries::ReadChSerTrendLine( XclImpStream& rStrm )
void XclImpChSeries::ReadChSerErrorBar( XclImpStream& rStrm )
{
- XclImpChSerErrorBarRef xErrorBar( new XclImpChSerErrorBar( GetChRoot() ) );
- xErrorBar->ReadChSerErrorBar( rStrm );
- sal_uInt8 nBarType = xErrorBar->GetBarType();
- XclImpChSerErrorBarMap::iterator itr = maErrorBars.lower_bound(nBarType);
- if (itr != maErrorBars.end() && !maErrorBars.key_comp()(nBarType, itr->first))
- // Overwrite the existing element.
- itr->second = xErrorBar;
- else
- maErrorBars.insert(
- itr, XclImpChSerErrorBarMap::value_type(nBarType, xErrorBar));
+ auto_ptr<XclImpChSerErrorBar> pErrorBar(new XclImpChSerErrorBar(GetChRoot()));
+ pErrorBar->ReadChSerErrorBar(rStrm);
+ sal_uInt8 nBarType = pErrorBar->GetBarType();
+ maErrorBars.insert(nBarType, pErrorBar);
}
XclImpChDataFormatRef XclImpChSeries::CreateDataFormat( sal_uInt16 nPointIdx, sal_uInt16 nFormatIdx )
@@ -2086,7 +2081,13 @@ void XclImpChSeries::ConvertTrendLines( Reference< XDataSeries > xDataSeries ) c
Reference< XPropertySet > XclImpChSeries::CreateErrorBar( sal_uInt8 nPosBarId, sal_uInt8 nNegBarId ) const
{
- return XclImpChSerErrorBar::CreateErrorBar( maErrorBars.get( nPosBarId ).get(), maErrorBars.get( nNegBarId ).get() );
+ XclImpChSerErrorBarMap::const_iterator itrPosBar = maErrorBars.find(nPosBarId);
+ XclImpChSerErrorBarMap::const_iterator itrNegBar = maErrorBars.find(nNegBarId);
+ XclImpChSerErrorBarMap::const_iterator itrEnd = maErrorBars.end();
+ if (itrPosBar == itrEnd || itrNegBar == itrEnd)
+ return Reference<XPropertySet>();
+
+ return XclImpChSerErrorBar::CreateErrorBar(itrPosBar->second, itrNegBar->second);
}
// Chart type groups ==========================================================
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index c731ba48e16f..7a12b07b7431 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -873,7 +873,7 @@ private:
typedef ScfRefMap< sal_uInt16, XclImpChDataFormat > XclImpChDataFormatMap;
typedef ScfRefMap< sal_uInt16, XclImpChText > XclImpChTextMap;
typedef ::std::list< XclImpChSerTrendLineRef > XclImpChSerTrendLineList;
- typedef ScfRefMap< sal_uInt8, XclImpChSerErrorBar > XclImpChSerErrorBarMap;
+ typedef ::boost::ptr_map<sal_uInt8, XclImpChSerErrorBar> XclImpChSerErrorBarMap;
XclChSeries maData; /// Contents of the CHSERIES record.
XclImpChSourceLinkRef mxValueLink; /// Link data for series values.