diff options
author | Noel Grandin <noel@peralex.com> | 2012-03-09 14:06:18 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-03-13 23:19:54 +0100 |
commit | 64cba6e58263e906aba6a110937f362d1e31ebe5 (patch) | |
tree | 00b2bb116416fc29aeabf656cfecb8e2a3df62b8 /filter | |
parent | f1bd21bdbb07879f9337d2da2ef1a02792a76369 (diff) |
Convert tools/table.hxx to std::map in CGMElements class
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/icgm/actimpr.cxx | 10 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/elements.cxx | 33 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/elements.hxx | 7 |
3 files changed, 14 insertions, 36 deletions
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx index 381135ea0abc..39454513ed2d 100644 --- a/filter/source/graphicfilter/icgm/actimpr.cxx +++ b/filter/source/graphicfilter/icgm/actimpr.cxx @@ -337,17 +337,17 @@ void CGMImpressOutAct::ImplSetFillBundle() aHatch.Color = nFillColor; else aHatch.Color = nFillColor; - HatchEntry* pHatchEntry = (HatchEntry*)mpCGM->pElement->aHatchTable.Get( nHatchIndex ); - if ( pHatchEntry ) + if ( mpCGM->pElement->maHatchMap.find( nHatchIndex ) != mpCGM->pElement->maHatchMap.end() ) { - switch ( pHatchEntry->HatchStyle ) + HatchEntry& rHatchEntry = mpCGM->pElement->maHatchMap[ nHatchIndex ]; + switch ( rHatchEntry.HatchStyle ) { case 0 : aHatch.Style = drawing::HatchStyle_SINGLE; break; case 1 : aHatch.Style = drawing::HatchStyle_DOUBLE; break; case 2 : aHatch.Style = drawing::HatchStyle_TRIPLE; break; } - aHatch.Distance = pHatchEntry->HatchDistance; - aHatch.Angle = pHatchEntry->HatchAngle; + aHatch.Distance = rHatchEntry.HatchDistance; + aHatch.Angle = rHatchEntry.HatchAngle; } else { diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx index 9bf4b85d0adf..a3f5892171d8 100644 --- a/filter/source/graphicfilter/icgm/elements.cxx +++ b/filter/source/graphicfilter/icgm/elements.cxx @@ -42,7 +42,6 @@ CGMElements::CGMElements( CGM& rCGM ) : CGMElements::~CGMElements() { - DeleteTable( aHatchTable ); DeleteAllBundles( aLineList ); DeleteAllBundles( aMarkerList ); DeleteAllBundles( aEdgeList ); @@ -144,14 +143,7 @@ CGMElements& CGMElements::operator=( CGMElements& rSource ) eTransparency = rSource.eTransparency; nAuxiliaryColor = rSource.nAuxiliaryColor; - DeleteTable( aHatchTable ); - HatchEntry* pSource = (HatchEntry*)rSource.aHatchTable.First(); - while ( pSource ) - { - sal_uInt32 nKey = rSource.aHatchTable.GetKey( pSource ); - aHatchTable.Insert( nKey, new HatchEntry( *pSource ) ); - pSource = (HatchEntry*)rSource.aHatchTable.Next(); - } + maHatchMap = rSource.maHatchMap; bSegmentCount = rSource.bSegmentCount; return (*this); } @@ -304,25 +296,10 @@ void CGMElements::Init() void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, long nAngle ) { - HatchEntry* pHatchEntry; - pHatchEntry = new HatchEntry; - aHatchTable.Insert( (sal_uInt32)nKey, pHatchEntry ); - pHatchEntry->HatchStyle = nStyle; - pHatchEntry->HatchDistance = nDistance; - pHatchEntry->HatchAngle = nAngle; -} - -// --------------------------------------------------------------- - -void CGMElements::DeleteTable( Table& rTable ) -{ - HatchEntry* pPtr = (HatchEntry*)rTable.First(); - while ( pPtr ) - { - delete pPtr; - pPtr = (HatchEntry*)rTable.Next(); - } - rTable.Clear(); + HatchEntry& rEntry = maHatchMap[nKey]; + rEntry.HatchStyle = nStyle; + rEntry.HatchDistance = nDistance; + rEntry.HatchAngle = nAngle; } // --------------------------------------------------------------- diff --git a/filter/source/graphicfilter/icgm/elements.hxx b/filter/source/graphicfilter/icgm/elements.hxx index c378ac5abe92..3969601b1968 100644 --- a/filter/source/graphicfilter/icgm/elements.hxx +++ b/filter/source/graphicfilter/icgm/elements.hxx @@ -29,12 +29,14 @@ #define CGM_ELEMENTS_HXX_ #include "main.hxx" -#include <tools/table.hxx> +#include "cgmtypes.hxx" #include <vector> +#include <map> #define nBackGroundColor aColorTable[ 0 ] typedef ::std::vector< Bundle* > BundleList; +typedef ::std::map<sal_uInt32, HatchEntry> HatchMap; class CGMElements { @@ -124,7 +126,7 @@ class CGMElements FillBundle aFillBundle; BundleList aFillList; FloatPoint aFillRefPoint; - Table aHatchTable; + HatchMap maHatchMap; Transparency eTransparency; @@ -137,7 +139,6 @@ class CGMElements ~CGMElements(); CGMElements& operator=( CGMElements& ); void Init(); - void DeleteTable( Table& ); Bundle* GetBundleIndex( long nIndex, BundleList&, Bundle& ); Bundle* GetBundle( BundleList& rList, long nIndex ); Bundle* InsertBundle( BundleList&, Bundle& ); |