Kaydet (Commit) 64cba6e5 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert tools/table.hxx to std::map in CGMElements class

üst f1bd21bd
......@@ -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
{
......
......@@ -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;
}
// ---------------------------------------------------------------
......
......@@ -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& );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment