1*9e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0fc027SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0fc027SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0fc027SAndrew Rist  * distributed with this work for additional information
6*9e0fc027SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0fc027SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0fc027SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0fc027SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9e0fc027SAndrew Rist  *
11*9e0fc027SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9e0fc027SAndrew Rist  *
13*9e0fc027SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0fc027SAndrew Rist  * software distributed under the License is distributed on an
15*9e0fc027SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0fc027SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0fc027SAndrew Rist  * specific language governing permissions and limitations
18*9e0fc027SAndrew Rist  * under the License.
19*9e0fc027SAndrew Rist  *
20*9e0fc027SAndrew Rist  *************************************************************/
21*9e0fc027SAndrew Rist 
22*9e0fc027SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "elements.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // ---------------------------------------------------------------
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
CGMElements(CGM & rCGM)32cdf0e10cSrcweir CGMElements::CGMElements( CGM& rCGM ) :
33cdf0e10cSrcweir 	mpCGM ( &rCGM )
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	Init();
36cdf0e10cSrcweir };
37cdf0e10cSrcweir 
38cdf0e10cSrcweir // ---------------------------------------------------------------
39cdf0e10cSrcweir 
~CGMElements()40cdf0e10cSrcweir CGMElements::~CGMElements()
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	DeleteTable( aHatchTable );
43cdf0e10cSrcweir 	DeleteAllBundles( aLineList );
44cdf0e10cSrcweir 	DeleteAllBundles( aMarkerList );
45cdf0e10cSrcweir 	DeleteAllBundles( aEdgeList );
46cdf0e10cSrcweir 	DeleteAllBundles( aTextList );
47cdf0e10cSrcweir 	DeleteAllBundles( aFillList );
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir // ---------------------------------------------------------------
51cdf0e10cSrcweir 
operator =(CGMElements & rSource)52cdf0e10cSrcweir CGMElements& CGMElements::operator=( CGMElements& rSource )
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	sal_uInt32 nIndex;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	nVDCIntegerPrecision = rSource.nVDCIntegerPrecision;
57cdf0e10cSrcweir 	nIntegerPrecision = rSource.nIntegerPrecision;
58cdf0e10cSrcweir 	eRealPrecision = rSource.eRealPrecision;
59cdf0e10cSrcweir 	nRealSize = rSource.nRealSize;
60cdf0e10cSrcweir 	nIndexPrecision = rSource.nIndexPrecision;
61cdf0e10cSrcweir 	nColorPrecision = rSource.nColorPrecision;
62cdf0e10cSrcweir 	nColorIndexPrecision = rSource.nColorIndexPrecision;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	nMetaFileVersion = rSource.nMetaFileVersion;
65cdf0e10cSrcweir 	eScalingMode = rSource.eScalingMode;
66cdf0e10cSrcweir 	nScalingFactor = rSource.nScalingFactor;
67cdf0e10cSrcweir 	eVDCType = rSource.eVDCType;
68cdf0e10cSrcweir 	eVDCRealPrecision = rSource.eVDCRealPrecision;
69cdf0e10cSrcweir 	nVDCRealSize = rSource.nVDCRealSize;
70cdf0e10cSrcweir 	aVDCExtent = rSource.aVDCExtent;
71cdf0e10cSrcweir 	aVDCExtentMaximum = rSource.aVDCExtentMaximum;
72cdf0e10cSrcweir 	eDeviceViewPortMode = rSource.eDeviceViewPortMode;
73cdf0e10cSrcweir 	nDeviceViewPortScale = rSource.nDeviceViewPortScale;
74cdf0e10cSrcweir 	eDeviceViewPortMap = rSource.eDeviceViewPortMap;
75cdf0e10cSrcweir 	eDeviceViewPortMapH = rSource.eDeviceViewPortMapH;
76cdf0e10cSrcweir 	eDeviceViewPortMapV = rSource.eDeviceViewPortMapV;
77cdf0e10cSrcweir 	aDeviceViewPort = rSource.aDeviceViewPort;
78cdf0e10cSrcweir 	nMitreLimit = rSource.nMitreLimit;
79cdf0e10cSrcweir 	eClipIndicator = rSource.eClipIndicator;
80cdf0e10cSrcweir 	aClipRect = rSource.aClipRect;
81cdf0e10cSrcweir 	eColorSelectionMode = rSource.eColorSelectionMode;
82cdf0e10cSrcweir 	eColorModel = rSource.eColorModel;
83cdf0e10cSrcweir 	nColorMaximumIndex = rSource.nColorMaximumIndex;
84cdf0e10cSrcweir 	nLatestColorMaximumIndex = rSource.nLatestColorMaximumIndex;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	for ( nIndex = 1; nIndex < 256; nIndex++ )		// do not overwrite the background color
87cdf0e10cSrcweir 	{
88cdf0e10cSrcweir 		aColorTableEntryIs[ nIndex ] = rSource.aColorTableEntryIs[ nIndex ];
89cdf0e10cSrcweir 		aColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
90cdf0e10cSrcweir 		aLatestColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
91cdf0e10cSrcweir 	}
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	for ( nIndex = 0; nIndex < 8; nIndex++ )
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		nColorValueExtent[ nIndex ] = rSource.nColorValueExtent[ nIndex ];
96cdf0e10cSrcweir 	}
97cdf0e10cSrcweir 	nAspectSourceFlags = rSource.nAspectSourceFlags;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	CopyAllBundles( rSource.aLineList, aLineList );
100cdf0e10cSrcweir 	aLineBundle = rSource.aLineBundle;
101cdf0e10cSrcweir 	pLineBundle = (LineBundle*)GetBundle( aLineList, rSource.pLineBundle->GetIndex() );
102cdf0e10cSrcweir 	eLineWidthSpecMode = rSource.eLineWidthSpecMode;
103cdf0e10cSrcweir 	eLineCapType = rSource.eLineCapType;
104cdf0e10cSrcweir 	eLineJoinType = rSource.eLineJoinType;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	CopyAllBundles( rSource.aMarkerList, aMarkerList );
107cdf0e10cSrcweir 	aMarkerBundle = rSource.aMarkerBundle;
108cdf0e10cSrcweir 	pMarkerBundle = (MarkerBundle*)GetBundle( aMarkerList, rSource.pMarkerBundle->GetIndex() );
109cdf0e10cSrcweir 	eMarkerSizeSpecMode = rSource.eMarkerSizeSpecMode;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	CopyAllBundles( rSource.aEdgeList, aEdgeList );
112cdf0e10cSrcweir 	aEdgeBundle = rSource.aEdgeBundle;
113cdf0e10cSrcweir 	pEdgeBundle = (EdgeBundle*)GetBundle( aEdgeList, rSource.pEdgeBundle->GetIndex() );
114cdf0e10cSrcweir 	eEdgeVisibility = rSource.eEdgeVisibility;
115cdf0e10cSrcweir 	eEdgeWidthSpecMode = rSource.eEdgeWidthSpecMode;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	CopyAllBundles( rSource.aTextList, aTextList );
118cdf0e10cSrcweir 	aTextBundle = rSource.aTextBundle;
119cdf0e10cSrcweir 	pTextBundle = (TextBundle*)GetBundle( aTextList, rSource.pTextBundle->GetIndex() );
120cdf0e10cSrcweir 	nCharacterHeight = rSource.nCharacterHeight;
121cdf0e10cSrcweir 	nCharacterOrientation[ 0 ] = rSource.nCharacterOrientation[ 0 ];
122cdf0e10cSrcweir 	nCharacterOrientation[ 1 ] = rSource.nCharacterOrientation[ 1 ];
123cdf0e10cSrcweir 	nCharacterOrientation[ 2 ] = rSource.nCharacterOrientation[ 2 ];
124cdf0e10cSrcweir 	nCharacterOrientation[ 3 ] = rSource.nCharacterOrientation[ 3 ];
125cdf0e10cSrcweir 	eUnderlineMode = rSource.eUnderlineMode;
126cdf0e10cSrcweir 	nUnderlineColor = rSource.nUnderlineColor;
127cdf0e10cSrcweir 	eTextPath = rSource.eTextPath;
128cdf0e10cSrcweir 	eTextAlignmentH = rSource.eTextAlignmentH;
129cdf0e10cSrcweir 	eTextAlignmentV = rSource.eTextAlignmentV;
130cdf0e10cSrcweir 	nTextAlignmentHCont = rSource.nTextAlignmentHCont;
131cdf0e10cSrcweir 	nTextAlignmentVCont = rSource.nTextAlignmentVCont;
132cdf0e10cSrcweir 	nCharacterSetIndex = rSource.nCharacterSetIndex;
133cdf0e10cSrcweir 	nAlternateCharacterSetIndex = rSource.nAlternateCharacterSetIndex;
134cdf0e10cSrcweir 	aFontList = rSource.aFontList;
135cdf0e10cSrcweir 	eCharacterCodingA = rSource.eCharacterCodingA;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	CopyAllBundles( rSource.aFillList, aFillList );
138cdf0e10cSrcweir 	aFillBundle = rSource.aFillBundle;
139cdf0e10cSrcweir 	pFillBundle = (FillBundle*)GetBundle( aFillList, rSource.pFillBundle->GetIndex() );
140cdf0e10cSrcweir 	aFillRefPoint = rSource.aFillRefPoint;
141cdf0e10cSrcweir 	eTransparency = rSource.eTransparency;
142cdf0e10cSrcweir 	nAuxiliaryColor = rSource.nAuxiliaryColor;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	DeleteTable( aHatchTable );
145cdf0e10cSrcweir 	HatchEntry*	pSource = (HatchEntry*)rSource.aHatchTable.First();
146cdf0e10cSrcweir 	while ( pSource )
147cdf0e10cSrcweir 	{
148cdf0e10cSrcweir 		sal_uInt32	nKey = rSource.aHatchTable.GetKey( pSource );
149cdf0e10cSrcweir 		aHatchTable.Insert( nKey, new HatchEntry( *pSource ) );
150cdf0e10cSrcweir 		pSource = (HatchEntry*)rSource.aHatchTable.Next();
151cdf0e10cSrcweir 	}
152cdf0e10cSrcweir 	bSegmentCount = rSource.bSegmentCount;
153cdf0e10cSrcweir 	return (*this);
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir // ---------------------------------------------------------------
157cdf0e10cSrcweir 
Init()158cdf0e10cSrcweir void CGMElements::Init()
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	nIntegerPrecision = nIndexPrecision = 2;
162cdf0e10cSrcweir 	nRealSize = nVDCRealSize = 4;
163cdf0e10cSrcweir 	nColorIndexPrecision = 1;
164cdf0e10cSrcweir 	nColorPrecision = 1;
165cdf0e10cSrcweir 	nVDCIntegerPrecision = 2;
166cdf0e10cSrcweir 	eRealPrecision = eVDCRealPrecision = RP_FIXED;		//RP_FLOAT;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	nMetaFileVersion = 1;
169cdf0e10cSrcweir 	eScalingMode = SM_ABSTRACT;
170cdf0e10cSrcweir 	eVDCType = VDC_INTEGER;
171cdf0e10cSrcweir 	aVDCExtent.Left = aVDCExtent.Bottom = 0;
172cdf0e10cSrcweir //	aVDCExtent.Right = aVDCExtent.Top = 32767;
173cdf0e10cSrcweir 	aVDCExtent.Right = aVDCExtent.Top = 1.0;
174cdf0e10cSrcweir 	aVDCExtentMaximum.Left = aVDCExtentMaximum.Bottom = 0;
175cdf0e10cSrcweir //	aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 32767;
176cdf0e10cSrcweir 	aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 1.0;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 	eDeviceViewPortMode = DVPM_FRACTION;
179cdf0e10cSrcweir 	nDeviceViewPortScale = 1;
180cdf0e10cSrcweir 	eDeviceViewPortMap = DVPM_FORCED;
181cdf0e10cSrcweir 	eDeviceViewPortMapH = DVPMH_LEFT;
182cdf0e10cSrcweir 	eDeviceViewPortMapV = DVPMV_BOTTOM;
183cdf0e10cSrcweir 	aDeviceViewPort.Left = 0;
184cdf0e10cSrcweir 	aDeviceViewPort.Top = 1;
185cdf0e10cSrcweir 	aDeviceViewPort.Right = 0;
186cdf0e10cSrcweir 	aDeviceViewPort.Bottom = 1;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	nMitreLimit = 32767;
189cdf0e10cSrcweir 	eClipIndicator = CI_ON;
190cdf0e10cSrcweir 	aClipRect = aVDCExtent;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	eColorSelectionMode = CSM_INDEXED;
193cdf0e10cSrcweir 	eColorModel = CM_RGB;
194cdf0e10cSrcweir 	nColorMaximumIndex = 63;
195cdf0e10cSrcweir 	int i;
196cdf0e10cSrcweir 	for ( i = 0; i < 256; aColorTableEntryIs[ i++ ] = 0 ) ;
197cdf0e10cSrcweir 	aColorTable[ 0 ] = 0;
198cdf0e10cSrcweir 	for ( i = 1; i < 256; aColorTable[ i++ ] = 0xffffff ) ;
199cdf0e10cSrcweir 	nLatestColorMaximumIndex = 63;
200cdf0e10cSrcweir 	aLatestColorTable[ 0 ] = 0;
201cdf0e10cSrcweir 	for ( i = 1; i < 256; aLatestColorTable[ i++ ] = 0xffffff ) ;
202cdf0e10cSrcweir 	nColorValueExtent[ 0 ] = nColorValueExtent[ 1 ] = nColorValueExtent[ 2 ] = 0;
203cdf0e10cSrcweir 	nColorValueExtent[ 3 ] = nColorValueExtent[ 4 ] = nColorValueExtent[ 5 ] = 255;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	nAspectSourceFlags = 0;		// all flags are individual
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	eLineWidthSpecMode = SM_SCALED;			// line parameter
208cdf0e10cSrcweir 	eLineCapType = LCT_NONE;
209cdf0e10cSrcweir 	eLineJoinType = LJT_NONE;
210cdf0e10cSrcweir 	pLineBundle = &aLineBundle;					// line bundle parameter
211cdf0e10cSrcweir 	aLineBundle.SetIndex( 1 );
212cdf0e10cSrcweir 	aLineBundle.eLineType = LT_SOLID;
213cdf0e10cSrcweir 	aLineBundle.nLineWidth = 1;
214cdf0e10cSrcweir 	aLineBundle.SetColor( 0xffffff );
215cdf0e10cSrcweir 	InsertBundle( aLineList, aLineBundle );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	eMarkerSizeSpecMode = SM_SCALED;			// marker parameter
218cdf0e10cSrcweir 	pMarkerBundle = &aMarkerBundle;				// marker bundle parameter
219cdf0e10cSrcweir 	aMarkerBundle.SetIndex( 1 );
220cdf0e10cSrcweir 	aMarkerBundle.eMarkerType = MT_STAR;
221cdf0e10cSrcweir 	aMarkerBundle.nMarkerSize = 1;
222cdf0e10cSrcweir 	aMarkerBundle.SetColor( 0xffffff );
223cdf0e10cSrcweir 	InsertBundle( aMarkerList, aMarkerBundle );
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	eEdgeVisibility = EV_OFF;					// edge parameter
226cdf0e10cSrcweir 	eEdgeWidthSpecMode = SM_SCALED;
227cdf0e10cSrcweir 	pEdgeBundle = &aEdgeBundle;					// edge bundle parameter
228cdf0e10cSrcweir 	aEdgeBundle.SetIndex( 1 );
229cdf0e10cSrcweir 	aEdgeBundle.eEdgeType = ET_SOLID;
230cdf0e10cSrcweir 	aEdgeBundle.nEdgeWidth = 1;
231cdf0e10cSrcweir 	aEdgeBundle.SetColor( 0xffffff );
232cdf0e10cSrcweir 	InsertBundle( aEdgeList, aEdgeBundle );
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	nCharacterHeight = 327;						// text parameter
235cdf0e10cSrcweir 	nCharacterOrientation[0] = 0;
236cdf0e10cSrcweir 	nCharacterOrientation[1] = 1;
237cdf0e10cSrcweir 	nCharacterOrientation[2] = 1;
238cdf0e10cSrcweir 	nCharacterOrientation[3] = 0;
239cdf0e10cSrcweir 	eUnderlineMode = UM_OFF;
240cdf0e10cSrcweir 	nUnderlineColor = 0xffffff;
241cdf0e10cSrcweir 	eTextPath = TPR_RIGHT;
242cdf0e10cSrcweir 	eTextAlignmentH = TAH_NORMAL;
243cdf0e10cSrcweir 	eTextAlignmentV = TAV_NORMAL;
244cdf0e10cSrcweir 	nCharacterSetIndex = nAlternateCharacterSetIndex = 1;
245cdf0e10cSrcweir 	eCharacterCodingA = CCA_BASIC_7;
246cdf0e10cSrcweir 	pTextBundle = &aTextBundle;					// text bundle parameter
247cdf0e10cSrcweir 	aTextBundle.SetIndex( 1 );
248cdf0e10cSrcweir 	aTextBundle.nTextFontIndex = 1;
249cdf0e10cSrcweir 	aTextBundle.eTextPrecision = TPR_STRING;
250cdf0e10cSrcweir 	aTextBundle.nCharacterExpansion = 1;
251cdf0e10cSrcweir 	aTextBundle.nCharacterSpacing = 0;
252cdf0e10cSrcweir 	aTextBundle.SetColor( 0xffffff );
253cdf0e10cSrcweir 	InsertBundle( aTextList, aTextBundle );
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 	pFillBundle = &aFillBundle;					// fill bundle parameter
256cdf0e10cSrcweir 	aFillBundle.SetIndex( 1 );
257cdf0e10cSrcweir 	aFillBundle.eFillInteriorStyle = FIS_HOLLOW;
258cdf0e10cSrcweir 	aFillBundle.nFillHatchIndex = 1;
259cdf0e10cSrcweir 	aFillBundle.nFillPatternIndex = 1;
260cdf0e10cSrcweir 	aFillBundle.SetColor( 0xffffff );
261cdf0e10cSrcweir 	InsertBundle( aFillList, aFillBundle );
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	ImplInsertHatch( 0, 0, 0, 0 );
264cdf0e10cSrcweir 	ImplInsertHatch( 1, 0, 125, 0 );
265cdf0e10cSrcweir 	ImplInsertHatch( 2, 0, 125, 900 );
266cdf0e10cSrcweir 	ImplInsertHatch( 3, 0, 125, 450 );
267cdf0e10cSrcweir 	ImplInsertHatch( 4, 0, 125, 1350 );
268cdf0e10cSrcweir 	ImplInsertHatch( 5, 1, 125, 0 );
269cdf0e10cSrcweir 	ImplInsertHatch( 6, 1, 125, 450 );
270cdf0e10cSrcweir 	ImplInsertHatch( -1, 0, 75, 0 );
271cdf0e10cSrcweir 	ImplInsertHatch( -2, 0, 75, 900 );
272cdf0e10cSrcweir 	ImplInsertHatch( -3, 0, 75, 450 );
273cdf0e10cSrcweir 	ImplInsertHatch( -4, 0, 75, 1350 );
274cdf0e10cSrcweir 	ImplInsertHatch( -5, 1, 75, 0 );
275cdf0e10cSrcweir 	ImplInsertHatch( -6, 1, 75, 450 );
276cdf0e10cSrcweir 	ImplInsertHatch( -7, 2, 125, 0 );
277cdf0e10cSrcweir 	ImplInsertHatch( -8, 2, 125, 900 );
278cdf0e10cSrcweir 	ImplInsertHatch( -9, 2, 125, 450 );
279cdf0e10cSrcweir 	ImplInsertHatch( -10, 2, 125, 1350 );
280cdf0e10cSrcweir 	ImplInsertHatch( -11, 0, 40, 0 );
281cdf0e10cSrcweir 	ImplInsertHatch( -12, 0, 40, 900 );
282cdf0e10cSrcweir 	ImplInsertHatch( -13, 0, 40, 450 );
283cdf0e10cSrcweir 	ImplInsertHatch( -14, 0, 40, 1350 );
284cdf0e10cSrcweir 	ImplInsertHatch( -15, 1, 40, 0 );
285cdf0e10cSrcweir 	ImplInsertHatch( -16, 1, 40, 900 );
286cdf0e10cSrcweir 	ImplInsertHatch( -21, 0, 250, 0 );
287cdf0e10cSrcweir 	ImplInsertHatch( -22, 0, 250, 900 );
288cdf0e10cSrcweir 	ImplInsertHatch( -23, 0, 250, 450 );
289cdf0e10cSrcweir 	ImplInsertHatch( -24, 0, 250, 1350 );
290cdf0e10cSrcweir 	ImplInsertHatch( -25, 1, 250, 0 );
291cdf0e10cSrcweir 	ImplInsertHatch( -26, 1, 250, 450 );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	eTransparency = T_ON;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	nBackGroundColor = nAuxiliaryColor = 0;
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 	bSegmentCount = sal_False;
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir // ---------------------------------------------------------------
301cdf0e10cSrcweir 
ImplInsertHatch(sal_Int32 nKey,int nStyle,long nDistance,long nAngle)302cdf0e10cSrcweir void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, long nAngle )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir 	HatchEntry*		pHatchEntry;
305cdf0e10cSrcweir 	pHatchEntry = new HatchEntry;
306cdf0e10cSrcweir 	aHatchTable.Insert( (sal_uInt32)nKey, pHatchEntry );
307cdf0e10cSrcweir 	pHatchEntry->HatchStyle = nStyle;
308cdf0e10cSrcweir 	pHatchEntry->HatchDistance = nDistance;
309cdf0e10cSrcweir 	pHatchEntry->HatchAngle = nAngle;
310cdf0e10cSrcweir }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir // ---------------------------------------------------------------
313cdf0e10cSrcweir 
DeleteTable(Table & rTable)314cdf0e10cSrcweir void CGMElements::DeleteTable( Table& rTable )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir 	HatchEntry*	pPtr = (HatchEntry*)rTable.First();
317cdf0e10cSrcweir 	while ( pPtr )
318cdf0e10cSrcweir 	{
319cdf0e10cSrcweir 		delete pPtr;
320cdf0e10cSrcweir 		pPtr = (HatchEntry*)rTable.Next();
321cdf0e10cSrcweir 	}
322cdf0e10cSrcweir 	rTable.Clear();
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir // ---------------------------------------------------------------
326cdf0e10cSrcweir 
DeleteAllBundles(List & rList)327cdf0e10cSrcweir void CGMElements::DeleteAllBundles( List& rList )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	void* pPtr = rList.First();
330cdf0e10cSrcweir 	while( pPtr )
331cdf0e10cSrcweir 	{
332cdf0e10cSrcweir 		delete (Bundle*)pPtr;
333cdf0e10cSrcweir 		pPtr = rList.Next();
334cdf0e10cSrcweir 	}
335cdf0e10cSrcweir };
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 
338cdf0e10cSrcweir // ---------------------------------------------------------------
339cdf0e10cSrcweir 
CopyAllBundles(List & rSource,List & rDest)340cdf0e10cSrcweir void CGMElements::CopyAllBundles( List& rSource, List& rDest )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	DeleteAllBundles( rDest );
343cdf0e10cSrcweir 	rDest.Clear();
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	void* pPtr = rSource.First();
346cdf0e10cSrcweir 	while( pPtr )
347cdf0e10cSrcweir 	{
348cdf0e10cSrcweir 		Bundle*	pTempBundle = ( (Bundle*)pPtr)->Clone();
349cdf0e10cSrcweir 		rDest.Insert( pTempBundle, LIST_APPEND );
350cdf0e10cSrcweir 		pPtr = rSource.Next();
351cdf0e10cSrcweir 	}
352cdf0e10cSrcweir };
353cdf0e10cSrcweir 
354cdf0e10cSrcweir // ---------------------------------------------------------------
355cdf0e10cSrcweir 
GetBundleIndex(sal_uInt32 nIndex,List & rList,Bundle & rBundle)356cdf0e10cSrcweir Bundle* CGMElements::GetBundleIndex( sal_uInt32 nIndex, List& rList, Bundle& rBundle )
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	rBundle.SetIndex( nIndex );
359cdf0e10cSrcweir 	Bundle* pBundle = GetBundle( rList, nIndex );
360cdf0e10cSrcweir 	if ( !pBundle )
361cdf0e10cSrcweir 		pBundle = InsertBundle( rList, rBundle );
362cdf0e10cSrcweir 	return pBundle;
363cdf0e10cSrcweir }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir // ---------------------------------------------------------------
366cdf0e10cSrcweir 
GetBundle(List & rList,long nIndex)367cdf0e10cSrcweir Bundle* CGMElements::GetBundle( List& rList, long nIndex )
368cdf0e10cSrcweir {
369cdf0e10cSrcweir 	Bundle* pBundle = (Bundle*)rList.First();
370cdf0e10cSrcweir 	while( pBundle && ( pBundle->GetIndex() != nIndex ) )
371cdf0e10cSrcweir 	{
372cdf0e10cSrcweir 		pBundle = (Bundle*)rList.Next();
373cdf0e10cSrcweir 	}
374cdf0e10cSrcweir 	return pBundle;
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir // ---------------------------------------------------------------
378cdf0e10cSrcweir 
InsertBundle(List & rList,Bundle & rBundle)379cdf0e10cSrcweir Bundle* CGMElements::InsertBundle( List& rList, Bundle& rBundle )
380cdf0e10cSrcweir {
381cdf0e10cSrcweir 	Bundle* pBundle = GetBundle( rList, rBundle.GetIndex() );
382cdf0e10cSrcweir 	if ( pBundle )
383cdf0e10cSrcweir 	{
384cdf0e10cSrcweir 		rList.Remove( pBundle );
385cdf0e10cSrcweir 		delete pBundle;
386cdf0e10cSrcweir 	}
387cdf0e10cSrcweir 	pBundle = rBundle.Clone();
388cdf0e10cSrcweir 	rList.Insert( pBundle, LIST_APPEND );
389cdf0e10cSrcweir 	return pBundle;
390cdf0e10cSrcweir };
391cdf0e10cSrcweir 
392