[Libreoffice-commits] .: binfilter/bf_sch binfilter/inc
Joseph Powers
jpowers at kemper.freedesktop.org
Wed May 4 19:36:27 PDT 2011
binfilter/bf_sch/source/core/sch_chtmode1.cxx | 45 ++++++++++++--------------
binfilter/bf_sch/source/core/sch_chtmode3.cxx | 2 -
binfilter/inc/bf_sch/chtmodel.hxx | 13 ++++---
3 files changed, 29 insertions(+), 31 deletions(-)
New commits:
commit 1ae9721688ccf0e4d603914b1057421e53e7a349
Author: Joseph Powers <jpowers27 at cox.net>
Date: Wed May 4 19:36:14 2011 -0700
Convert "List* pDefaultColors" into a vector<>
diff --git a/binfilter/bf_sch/source/core/sch_chtmode1.cxx b/binfilter/bf_sch/source/core/sch_chtmode1.cxx
index d2bd5a5..b3464cf 100644
--- a/binfilter/bf_sch/source/core/sch_chtmode1.cxx
+++ b/binfilter/bf_sch/source/core/sch_chtmode1.cxx
@@ -511,7 +511,7 @@ namespace binfilter {
/*N*/ nRowListCnt = aRegressAttrList.size();
/*N*/
/*N*/ DBG_ASSERT( pDefaultColors, "invalid default colors" );
-/*N*/ sal_Int32 nNumDefCol = pDefaultColors->Count();
+/*N*/ size_t nNumDefCol = pDefaultColors->size();
/*N*/ DBG_ASSERT( nNumDefCol, "Empty Default Color List" );
/*N*/
/*N*/ if (nCnt != nRowListCnt)
@@ -537,8 +537,7 @@ namespace binfilter {
/*N*/ pRegressAttr->Put(XLineWidthItem(100));
/*N*/ if( nNumDefCol != 0 )
/*N*/ {
-/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors->
-/*N*/ GetObject(i % nNumDefCol);
+/*N*/ XColorEntry* pEntry = (*pDefaultColors)[ i % nNumDefCol ];
/*N*/ pRegressAttr->Put(XLineColorItem(pEntry->GetName(),
/*N*/ pEntry->GetColor()));
/*N*/ }
@@ -579,8 +578,7 @@ namespace binfilter {
/*N*/ pAverageAttr->Put(XLineWidthItem(0));
/*N*/ if( nNumDefCol != 0 )
/*N*/ {
-/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors->
-/*N*/ GetObject(i % nNumDefCol);
+/*N*/ XColorEntry* pEntry = (*pDefaultColors)[ i % nNumDefCol ];
/*N*/ pAverageAttr->Put(XLineColorItem(pEntry->GetName(),
/*N*/ pEntry->GetColor()));
/*N*/ }
@@ -742,14 +740,13 @@ namespace binfilter {
/*N*/
/*N*/ CHART_TRACE1( "ChartModel::SetDefAttrRow - Row #%ld", i );
/*N*/
-/*N*/ sal_Int32 nNumDefCol = pDefaultColors->Count();
+/*N*/ size_t nNumDefCol = pDefaultColors->size();
/*N*/ DBG_ASSERT( nNumDefCol, "invalid default colors" );
/*N*/
/*N*/ pDataRowAttr->Put(*pDummyAttr);
/*N*/ if( nNumDefCol != 0 )
/*N*/ {
-/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors->
-/*N*/ GetObject(i % nNumDefCol);
+/*N*/ XColorEntry* pEntry = (*pDefaultColors)[ i % nNumDefCol ];
/*N*/ pDataRowAttr->Put(XFillColorItem(pEntry->GetName(),
/*N*/ pEntry->GetColor()));
/*N*/
@@ -806,7 +803,7 @@ namespace binfilter {
/*N*/ void ChartModel::CreateDefaultColors ()
/*N*/ {
/*N*/ SchOptions* pOptions = SCH_MOD1()->GetSchOptions();
-/*N*/ long nCount;
+/*N*/ size_t nCount;
/*N*/ ColorData* pDefaultCol = NULL;
/*N*/
/*N*/ if( pOptions )
@@ -816,7 +813,7 @@ namespace binfilter {
/*N*/ pDefaultCol = new ColorData[ nCount ];
/*N*/ DBG_ASSERT( nCount == ROW_COLOR_COUNT, "Chart: dynamic default color array size not supported yet" );
/*N*/
-/*N*/ for( int i=0; i<nCount; i++ )
+/*N*/ for( size_t i=0; i<nCount; i++ )
/*N*/ {
/*N*/ pDefaultCol[ i ] = aDefCols.GetColorData( i );
/*N*/ }
@@ -841,13 +838,13 @@ namespace binfilter {
/*N*/ }
/*N*/
/*N*/ // create colors from table if they exist otherwise copy default colors
-/*N*/ pDefaultColors = new List;
+/*N*/ pDefaultColors = new XColorEntryList;
/*N*/ Color aCol;
/*N*/
-/*N*/ for( int i=0; i<nCount; i++ )
+/*N*/ for( size_t i = 0; i < nCount; i++ )
/*N*/ {
/*N*/ aCol.SetColor( pDefaultCol[ i ] );
-/*N*/ pDefaultColors->Insert( new XColorEntry( aCol, String() ), LIST_APPEND );
+/*N*/ pDefaultColors->push_back( new XColorEntry( aCol, String() ) );
/*N*/ }
/*N*/
/*N*/ delete[] pDefaultCol;
@@ -859,17 +856,17 @@ namespace binfilter {
|*
\************************************************************************/
-/*N*/ void ChartModel::DestroyDefaultColors ()
-/*N*/ {
-/*N*/ if (pDefaultColors)
-/*N*/ {
-/*N*/ while (pDefaultColors->Count())
-/*N*/ delete (XColorEntry*)pDefaultColors->Remove(pDefaultColors->Count() - 1);
-/*N*/ delete pDefaultColors;
-/*N*/ }
-/*N*/
-/*N*/ pDefaultColors = 0;
-/*N*/ }
+void ChartModel::DestroyDefaultColors ()
+{
+ if (pDefaultColors)
+ {
+ for( size_t i = 0, n = pDefaultColors->size(); i < n; ++i )
+ delete (*pDefaultColors)[ i ];
+ pDefaultColors->clear();
+ delete pDefaultColors;
+ }
+ pDefaultColors = 0;
+}
/*************************************************************************
|*
diff --git a/binfilter/bf_sch/source/core/sch_chtmode3.cxx b/binfilter/bf_sch/source/core/sch_chtmode3.cxx
index e196e33..23959c3 100644
--- a/binfilter/bf_sch/source/core/sch_chtmode3.cxx
+++ b/binfilter/bf_sch/source/core/sch_chtmode3.cxx
@@ -829,7 +829,7 @@ namespace binfilter {
/*N*/ if( ( nCol >= nPieCount ) &&
/*N*/ pDefaultColors )
/*N*/ {
-/*?*/ XColorEntry* pColEntry = SAL_STATIC_CAST( XColorEntry*, pDefaultColors->GetObject( nCol % pDefaultColors->Count()));
+/*?*/ XColorEntry* pColEntry = (*pDefaultColors)[ nCol % pDefaultColors->size() ];
/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor()));
/*N*/ }
/*N*/
diff --git a/binfilter/inc/bf_sch/chtmodel.hxx b/binfilter/inc/bf_sch/chtmodel.hxx
index d6b3fd6..83d9f2c 100644
--- a/binfilter/inc/bf_sch/chtmodel.hxx
+++ b/binfilter/inc/bf_sch/chtmodel.hxx
@@ -42,16 +42,16 @@
#include "bf_svx/obj3d.hxx"
#include "bf_svx/poly3d.hxx"
#include <bf_svx/viewpt3d.hxx>
-#include <vcl/field.hxx>
#include <bf_svx/svdtrans.hxx>
+#include <bf_svx/chrtitem.hxx>
+#include <bf_svx/svdoutl.hxx>
+#include <bf_svx/xtable.hxx>
+#include <bf_svx/svdotext.hxx>
+#include <vcl/field.hxx>
#include <tools/gen.hxx>
#include <tools/color.hxx>
-#include <tools/list.hxx>
-#include <bf_svx/chrtitem.hxx>
#include <tools/string.hxx>
-#include <bf_svx/svdoutl.hxx>
#include "adjust.hxx"
-#include <bf_svx/svdotext.hxx>
#include <bf_svx/svdobj.hxx>
#include <bf_svtools/itemset.hxx>
#include <bf_svx/svdobj.hxx>
@@ -92,6 +92,7 @@ class SchRectObj;
typedef ::std::vector< SfxItemSet* > ItemSetList;
typedef ::std::vector< E3dLabelObj* > DescrList;
+typedef ::std::vector< XColorEntry* > XColorEntryList;
#define VERTICAL_LINE aLine[0].Y() = rRect.Bottom(); aLine[1].Y() = rRect.Top();
#define HORIZONTAL_LINE aLine[0].X() = rRect.Left(); aLine[1].X() = rRect.Right();
@@ -737,7 +738,7 @@ private:
SvxChartStyle eOldChartStyle;
int eChartLinePoints[ LINE_POINT_COUNT ];
- List* pDefaultColors;
+ XColorEntryList* pDefaultColors;
BOOL bTextScalable;
BOOL bIsCopied;
More information about the Libreoffice-commits
mailing list