From 0df48990763fd7bae00a586d0c34526fe13aadd1 Mon Sep 17 00:00:00 2001 From: iha/tbe Date: Fri, 27 Jul 2012 17:26:37 +0200 Subject: sds chart binfilter import --- binfilter/bf_sch/source/core/sch_chtmode3.cxx | 43 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'binfilter/bf_sch/source/core/sch_chtmode3.cxx') diff --git a/binfilter/bf_sch/source/core/sch_chtmode3.cxx b/binfilter/bf_sch/source/core/sch_chtmode3.cxx index beda65ca6..3df2d181d 100644 --- a/binfilter/bf_sch/source/core/sch_chtmode3.cxx +++ b/binfilter/bf_sch/source/core/sch_chtmode3.cxx @@ -67,6 +67,9 @@ #include "chaxis.hxx" +#include +#include + namespace binfilter { /************************************************************************* @@ -270,20 +273,17 @@ namespace binfilter { /*N*/ const SfxItemSet& ChartModel::GetDataRowAttr( long nRow ) const /*N*/ { -/*N*/ if( nRow < (long)aDataRowAttrList.size() ) +/*N*/ if( nRow>=0 && nRow < (long)aDataRowAttrList.size() ) /*N*/ { /*N*/ SfxItemSet* pSet = aDataRowAttrList[ nRow ]; /*N*/ DBG_ASSERT( pSet, "Invalid ItemSet" ); -/*N*/ return *pSet; -/*N*/ } -/*N*/ else -/*N*/ { -/*N*/ OSL_FAIL( "Requested data row attribute is unavailable" ); -/*N*/ -/*N*/ // return something -/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" ); -/*?*/ return *pChartAttr; + if( pSet ) +/*N*/ return *pSet; /*N*/ } +/*N*/ OSL_FAIL( "Requested data row attribute is unavailable" ); +/*N*/ // return something +/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" ); +/*?*/ return *pChartAttr; /*N*/ } /************************************************************************* @@ -675,11 +675,25 @@ namespace binfilter { /*N*/ ? &aSwitchDataPointAttrList /*N*/ : &aDataPointAttrList; /*N*/ -/*N*/ SfxItemSet* pItemSet = (*pAttrList)[ nCol * GetRowCount() + nRow ]; + if( nCol < 0 || nRow < 0 ) + return; + const long nRowCount = GetRowCount(); + const long nColCount = GetColCount(); + if( nColCount <= 0 || nRowCount <= 0 ) + return; + if( nCol >= nColCount || nRow >= nRowCount ) + return; + if( nCol > ::std::numeric_limits::max()/nRowCount ) //sal_uIntPtr is the type of the index parameter for method pAttrList->GetObject + return; + if( nRowCount*nCol > ::std::numeric_limits::max() - nRow ) + return; + sal_uIntPtr nIndex = static_cast(nCol) * nRowCount + nRow; + +/*N*/ SfxItemSet* pItemSet = (*pAttrList)[ nCol * GetRowCount() + nRow ]; /*N*/ if (pItemSet == NULL) /*N*/ { /*N*/ pItemSet = new SfxItemSet(*pItemPool, nRowWhichPairs); -/*N*/ (*pAttrList)[nCol * GetRowCount() + nRow] = pItemSet; +/*N*/ (*pAttrList)[nIndex] = pItemSet; /*N*/ } /*N*/ if(!bMerge) /*?*/ pItemSet->ClearItem(); @@ -774,10 +788,11 @@ namespace binfilter { /*N*/ SfxItemSet aAttr( GetDataRowAttr( nCol % nPieCount )); /*N*/ /*N*/ if( ( nCol >= nPieCount ) && -/*N*/ pDefaultColors ) +/*N*/ pDefaultColors && pDefaultColors->size()>0 ) /*N*/ { /*?*/ XColorEntry* pColEntry = (*pDefaultColors)[ nCol % pDefaultColors->size() ]; -/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor())); + if( pColEntry ) +/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor())); /*N*/ } /*N*/ /*N*/ // add description attributes of series -- cgit