[Libreoffice-commits] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Mar 1 16:56:27 PST 2011
sc/source/filter/excel/xichart.cxx | 23 ++++++++++++-----------
sc/source/filter/inc/xichart.hxx | 2 +-
2 files changed, 13 insertions(+), 12 deletions(-)
New commits:
commit 2d23676462775b1991dadc59c6b13da5ab5cee9f
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Mar 1 19:53:55 2011 -0500
Replaced another use of ScfRefMap with ptr_map.
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index cebd20e..cd75fa8 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 ee664c8..655cbed 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.
More information about the Libreoffice-commits
mailing list