xref: /AOO41X/main/vcl/source/gdi/cvtsvm.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_vcl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #define ENABLE_BYTESTRING_STREAM_OPERATORS
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <algorithm>
34*cdf0e10cSrcweir #include <string.h>
35*cdf0e10cSrcweir #include <tools/stack.hxx>
36*cdf0e10cSrcweir #include <tools/debug.hxx>
37*cdf0e10cSrcweir #include <tools/stream.hxx>
38*cdf0e10cSrcweir #include <vcl/virdev.hxx>
39*cdf0e10cSrcweir #include <vcl/graph.hxx>
40*cdf0e10cSrcweir #include <vcl/lineinfo.hxx>
41*cdf0e10cSrcweir #include <vcl/salbtype.hxx>
42*cdf0e10cSrcweir #include <vcl/cvtsvm.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir // -----------
45*cdf0e10cSrcweir // - Defines -
46*cdf0e10cSrcweir // -----------
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #define CVTSVM_WRITE_SUBACTIONCOUNT 1
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir // -----------
51*cdf0e10cSrcweir // - Inlines -
52*cdf0e10cSrcweir // -----------
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir void ImplReadRect( SvStream& rIStm, Rectangle& rRect )
55*cdf0e10cSrcweir {
56*cdf0e10cSrcweir 	Point aTL;
57*cdf0e10cSrcweir 	Point aBR;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	rIStm >> aTL;
60*cdf0e10cSrcweir 	rIStm >> aBR;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	rRect = Rectangle( aTL, aBR );
63*cdf0e10cSrcweir }
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir // ------------------------------------------------------------------------
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir void ImplWriteRect( SvStream& rOStm, const Rectangle& rRect )
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 	rOStm << rRect.TopLeft();
70*cdf0e10cSrcweir 	rOStm << rRect.BottomRight();
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir // ------------------------------------------------------------------------
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir void ImplReadPoly( SvStream& rIStm, Polygon& rPoly )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 	sal_Int32	nSize;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	rIStm >> nSize;
80*cdf0e10cSrcweir 	rPoly = Polygon( (sal_uInt16) nSize );
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i < (sal_uInt16) nSize; i++ )
83*cdf0e10cSrcweir 		rIStm >> rPoly[ i ];
84*cdf0e10cSrcweir }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir // ------------------------------------------------------------------------
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly )
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir 	Polygon aPoly;
91*cdf0e10cSrcweir 	sal_Int32	nPolyCount;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	rIStm >> nPolyCount;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i < (sal_uInt16) nPolyCount; i++ )
96*cdf0e10cSrcweir 	{
97*cdf0e10cSrcweir 		ImplReadPoly( rIStm, aPoly );
98*cdf0e10cSrcweir 		rPolyPoly.Insert( aPoly );
99*cdf0e10cSrcweir 	}
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir // ------------------------------------------------------------------------
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly )
105*cdf0e10cSrcweir {
106*cdf0e10cSrcweir 	const sal_uInt16	nPoly = rPolyPoly.Count();
107*cdf0e10cSrcweir 	sal_uInt16			nPoints = 0;
108*cdf0e10cSrcweir 	sal_uInt16			n;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	for( n = 0; n < nPoly; n++ )
111*cdf0e10cSrcweir 		nPoints = sal::static_int_cast<sal_uInt16>(nPoints + rPolyPoly[ n ].GetSize());
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_POLYPOLYGON_ACTION;
114*cdf0e10cSrcweir 	rOStm << (sal_Int32) ( 8 + ( nPoly << 2 ) + ( nPoints << 3 ) );
115*cdf0e10cSrcweir 	rOStm << (sal_Int32) nPoly;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	for( n = 0; n < nPoly; n++ )
118*cdf0e10cSrcweir 	{
119*cdf0e10cSrcweir         // #i102224# Here the evtl. curved nature of Polygon was
120*cdf0e10cSrcweir         // ignored (for all those Years). Adapted to at least write
121*cdf0e10cSrcweir         // a polygon representing the curve as good as possible
122*cdf0e10cSrcweir  	    Polygon aSimplePoly;
123*cdf0e10cSrcweir  	    rPolyPoly[n].AdaptiveSubdivide(aSimplePoly);
124*cdf0e10cSrcweir  		const sal_uInt16 nSize(aSimplePoly.GetSize());
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 		rOStm << (sal_Int32) nSize;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 		for( sal_uInt16 j = 0; j < nSize; j++ )
129*cdf0e10cSrcweir 			rOStm << aSimplePoly[ j ];
130*cdf0e10cSrcweir 	}
131*cdf0e10cSrcweir }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir // ------------------------------------------------------------------------
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir void ImplReadColor( SvStream& rIStm, Color& rColor )
136*cdf0e10cSrcweir {
137*cdf0e10cSrcweir 	sal_Int16 nVal;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	rIStm >> nVal; rColor.SetRed( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
140*cdf0e10cSrcweir 	rIStm >> nVal; rColor.SetGreen( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
141*cdf0e10cSrcweir 	rIStm >> nVal; rColor.SetBlue( sal::static_int_cast<sal_uInt8>((sal_uInt16)nVal >> 8) );
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir // ------------------------------------------------------------------------
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir void ImplWriteColor( SvStream& rOStm, const Color& rColor )
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir 	sal_Int16 nVal;
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	nVal = ( (sal_Int16) rColor.GetRed() << 8 ) | rColor.GetRed();
151*cdf0e10cSrcweir 	rOStm << nVal;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	nVal = ( (sal_Int16) rColor.GetGreen() << 8 ) | rColor.GetGreen();
154*cdf0e10cSrcweir 	rOStm << nVal;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	nVal = ( (sal_Int16) rColor.GetBlue() << 8 ) | rColor.GetBlue();
157*cdf0e10cSrcweir 	rOStm << nVal;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir // ------------------------------------------------------------------------
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir 	Point	aOrg;
165*cdf0e10cSrcweir 	sal_Int32	nXNum;
166*cdf0e10cSrcweir 	sal_Int32	nXDenom;
167*cdf0e10cSrcweir 	sal_Int32	nYNum;
168*cdf0e10cSrcweir 	sal_Int32	nYDenom;
169*cdf0e10cSrcweir 	sal_Int16	nUnit;
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	rIStm >> nUnit >> aOrg >> nXNum >> nXDenom >> nYNum >> nYDenom;
172*cdf0e10cSrcweir 	rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir // ------------------------------------------------------------------------
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir 	rOStm << (sal_Int16) rMapMode.GetMapUnit();
180*cdf0e10cSrcweir 	rOStm << rMapMode.GetOrigin();
181*cdf0e10cSrcweir 	rOStm << (sal_Int32) rMapMode.GetScaleX().GetNumerator();
182*cdf0e10cSrcweir 	rOStm << (sal_Int32) rMapMode.GetScaleX().GetDenominator();
183*cdf0e10cSrcweir 	rOStm << (sal_Int32) rMapMode.GetScaleY().GetNumerator();
184*cdf0e10cSrcweir 	rOStm << (sal_Int32) rMapMode.GetScaleY().GetDenominator();
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir // ------------------------------------------------------------------------
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir void ImplWritePushAction( SvStream& rOStm )
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_PUSH_ACTION;
192*cdf0e10cSrcweir 	rOStm << (sal_Int32) 4;
193*cdf0e10cSrcweir }
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir // ------------------------------------------------------------------------
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir void ImplWritePopAction( SvStream& rOStm )
198*cdf0e10cSrcweir {
199*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_POP_ACTION;
200*cdf0e10cSrcweir 	rOStm << (sal_Int32) 4;
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir // ------------------------------------------------------------------------
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle, sal_Int32 nWidth = 0L )
206*cdf0e10cSrcweir {
207*cdf0e10cSrcweir 	if( rColor.GetTransparency() > 127 )
208*cdf0e10cSrcweir 		nStyle = 0;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_PEN_ACTION;
211*cdf0e10cSrcweir 	rOStm << (sal_Int32) 16;
212*cdf0e10cSrcweir 	ImplWriteColor( rOStm, rColor );
213*cdf0e10cSrcweir 	rOStm << nWidth;
214*cdf0e10cSrcweir 	rOStm << nStyle;
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir // ------------------------------------------------------------------------
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle )
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_FILLBRUSH_ACTION;
222*cdf0e10cSrcweir 	rOStm << (sal_Int32) 20;
223*cdf0e10cSrcweir 	ImplWriteColor( rOStm, rColor );
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 	if( rColor.GetTransparency() > 127 )
226*cdf0e10cSrcweir 		nStyle = 0;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	if( nStyle > 1 )
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		ImplWriteColor( rOStm, COL_WHITE );
231*cdf0e10cSrcweir 		rOStm << nStyle;
232*cdf0e10cSrcweir 		rOStm << (sal_Int16) 1;
233*cdf0e10cSrcweir 	}
234*cdf0e10cSrcweir 	else
235*cdf0e10cSrcweir 	{
236*cdf0e10cSrcweir 		ImplWriteColor( rOStm, COL_BLACK );
237*cdf0e10cSrcweir 		rOStm << nStyle;
238*cdf0e10cSrcweir 		rOStm << (sal_Int16) 0;
239*cdf0e10cSrcweir 	}
240*cdf0e10cSrcweir }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir // ------------------------------------------------------------------------
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir void ImplWriteFont( SvStream& rOStm, const Font& rFont,
245*cdf0e10cSrcweir 					rtl_TextEncoding& rActualCharSet )
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	char	aName[32];
248*cdf0e10cSrcweir 	short	nWeight;
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	ByteString aByteName( rFont.GetName(), rOStm.GetStreamCharSet() );
251*cdf0e10cSrcweir 	strncpy( aName, aByteName.GetBuffer(), 32 );
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	switch ( rFont.GetWeight() )
254*cdf0e10cSrcweir 	{
255*cdf0e10cSrcweir 		case WEIGHT_THIN:
256*cdf0e10cSrcweir 		case WEIGHT_ULTRALIGHT:
257*cdf0e10cSrcweir 		case WEIGHT_LIGHT:
258*cdf0e10cSrcweir 			nWeight = 1;
259*cdf0e10cSrcweir 		break;
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 		case WEIGHT_NORMAL:
262*cdf0e10cSrcweir 		case WEIGHT_MEDIUM:
263*cdf0e10cSrcweir 			nWeight = 2;
264*cdf0e10cSrcweir 		break;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 		case WEIGHT_BOLD:
267*cdf0e10cSrcweir 		case WEIGHT_ULTRABOLD:
268*cdf0e10cSrcweir 		case WEIGHT_BLACK:
269*cdf0e10cSrcweir 			nWeight = 3;
270*cdf0e10cSrcweir 		break;
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 		default:
273*cdf0e10cSrcweir 			nWeight = 0;
274*cdf0e10cSrcweir 		break;
275*cdf0e10cSrcweir 	}
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_FONT_ACTION;
278*cdf0e10cSrcweir 	rOStm << (sal_Int32) 78;
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	rActualCharSet = GetStoreCharSet( rFont.GetCharSet() );
281*cdf0e10cSrcweir 	ImplWriteColor( rOStm, rFont.GetColor() );
282*cdf0e10cSrcweir 	ImplWriteColor( rOStm, rFont.GetFillColor() );
283*cdf0e10cSrcweir 	rOStm.Write( aName, 32 );
284*cdf0e10cSrcweir 	rOStm << rFont.GetSize();
285*cdf0e10cSrcweir 	rOStm << (sal_Int16) 0; // no character orientation anymore
286*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetOrientation();
287*cdf0e10cSrcweir 	rOStm << (sal_Int16) rActualCharSet;
288*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetFamily();
289*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetPitch();
290*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetAlign();
291*cdf0e10cSrcweir 	rOStm << (sal_Int16) nWeight;
292*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetUnderline();
293*cdf0e10cSrcweir 	rOStm << (sal_Int16) rFont.GetStrikeout();
294*cdf0e10cSrcweir 	rOStm << (sal_Bool) ( rFont.GetItalic() != ITALIC_NONE );
295*cdf0e10cSrcweir 	rOStm << rFont.IsOutline();
296*cdf0e10cSrcweir 	rOStm << rFont.IsShadow();
297*cdf0e10cSrcweir 	rOStm << rFont.IsTransparent();
298*cdf0e10cSrcweir 	if ( rActualCharSet == RTL_TEXTENCODING_DONTKNOW )
299*cdf0e10cSrcweir 		rActualCharSet = gsl_getSystemTextEncoding();
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir // ------------------------------------------------------------------------
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir void ImplWriteRasterOpAction( SvStream& rOStm, sal_Int16 nRasterOp )
305*cdf0e10cSrcweir {
306*cdf0e10cSrcweir 	rOStm << (sal_Int16) GDI_RASTEROP_ACTION << (sal_Int32) 6 << nRasterOp;
307*cdf0e10cSrcweir }
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir // ------------------------------------------------------------------------
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir sal_Bool ImplWriteUnicodeComment( SvStream& rOStm, const String& rString )
312*cdf0e10cSrcweir {
313*cdf0e10cSrcweir 	xub_StrLen i, nStringLen = rString.Len();
314*cdf0e10cSrcweir 	if ( nStringLen )
315*cdf0e10cSrcweir 	{
316*cdf0e10cSrcweir 		sal_uInt32	nSize = ( nStringLen << 1 ) + 4;
317*cdf0e10cSrcweir 		sal_uInt16	nType = GDI_UNICODE_COMMENT;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 		rOStm << nType << nSize;
320*cdf0e10cSrcweir 		for ( i = 0; i < nStringLen; i++ )
321*cdf0e10cSrcweir 		{
322*cdf0e10cSrcweir 			sal_Unicode nUni = rString.GetChar( i );
323*cdf0e10cSrcweir 			rOStm << nUni;
324*cdf0e10cSrcweir 		}
325*cdf0e10cSrcweir 	}
326*cdf0e10cSrcweir 	return nStringLen != 0;
327*cdf0e10cSrcweir }
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir // ------------------------------------------------------------------------
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, String& rString )
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir 	sal_uInt32 nOld = rIStm.Tell();
334*cdf0e10cSrcweir 	if ( nStrmPos )
335*cdf0e10cSrcweir 	{
336*cdf0e10cSrcweir 		sal_uInt16	nType;
337*cdf0e10cSrcweir 		sal_uInt32	nActionSize;
338*cdf0e10cSrcweir         xub_StrLen  nStringLen;
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 		rIStm.Seek( nStrmPos );
341*cdf0e10cSrcweir 		rIStm	>> nType
342*cdf0e10cSrcweir 				>> nActionSize;
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 		nStringLen = sal::static_int_cast<xub_StrLen>(( nActionSize - 4 ) >> 1);
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 		if ( nStringLen && ( nType == GDI_UNICODE_COMMENT ) )
347*cdf0e10cSrcweir 		{
348*cdf0e10cSrcweir 			sal_Unicode* pBuffer = rString.AllocBuffer( nStringLen );
349*cdf0e10cSrcweir 			while ( nStringLen-- )
350*cdf0e10cSrcweir 				rIStm >> *pBuffer++;
351*cdf0e10cSrcweir 		}
352*cdf0e10cSrcweir 	}
353*cdf0e10cSrcweir 	rIStm.Seek( nOld );
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir // ------------------------------------------------------------------------
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir void ImplSkipActions( SvStream& rIStm, sal_uLong nSkipCount )
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir 	sal_Int32 nActionSize;
361*cdf0e10cSrcweir 	sal_Int16 nType;
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	for( sal_uLong i = 0UL; i < nSkipCount; i++ )
364*cdf0e10cSrcweir 	{
365*cdf0e10cSrcweir 		rIStm >> nType >> nActionSize;
366*cdf0e10cSrcweir 		rIStm.SeekRel( nActionSize - 4L );
367*cdf0e10cSrcweir 	}
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir // ------------------------------------------------------------------------
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPolyPolygon, bool bOnlyWhenCurve)
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir 	const sal_uInt16 nPolygonCount(rPolyPolygon.Count());
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	if(nPolygonCount)
377*cdf0e10cSrcweir 	{
378*cdf0e10cSrcweir 		sal_uInt32 nAllPolygonCount(0);
379*cdf0e10cSrcweir 		sal_uInt32 nAllPointCount(0);
380*cdf0e10cSrcweir 		sal_uInt32 nAllFlagCount(0);
381*cdf0e10cSrcweir 		sal_uInt16 a(0);
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 		for(a = 0; a < nPolygonCount; a++)
384*cdf0e10cSrcweir 		{
385*cdf0e10cSrcweir 		    const Polygon& rCandidate = rPolyPolygon.GetObject(a);
386*cdf0e10cSrcweir 		    const sal_uInt16 nPointCount(rCandidate.GetSize());
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 			if(nPointCount)
389*cdf0e10cSrcweir 			{
390*cdf0e10cSrcweir 				nAllPolygonCount++;
391*cdf0e10cSrcweir 				nAllPointCount += nPointCount;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 				if(rCandidate.HasFlags())
394*cdf0e10cSrcweir 				{
395*cdf0e10cSrcweir 					nAllFlagCount += nPointCount;
396*cdf0e10cSrcweir 				}
397*cdf0e10cSrcweir 			}
398*cdf0e10cSrcweir 		}
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 		if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount))
401*cdf0e10cSrcweir 		{
402*cdf0e10cSrcweir 			rOStm << (sal_Int16) GDI_EXTENDEDPOLYGON_ACTION;
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 			const sal_Int32 nActionSize(
405*cdf0e10cSrcweir 				4 +							// Action size
406*cdf0e10cSrcweir 				2 +							// PolygonCount
407*cdf0e10cSrcweir 				(nAllPolygonCount * 2) +	// Points per polygon
408*cdf0e10cSrcweir 				(nAllPointCount << 3) +		// Points themselves
409*cdf0e10cSrcweir 				nAllPolygonCount +			// Bool if (when poly has points) it has flags, too
410*cdf0e10cSrcweir 				nAllFlagCount);				// Flags themselves
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 			rOStm << nActionSize;
413*cdf0e10cSrcweir 			rOStm << (sal_uInt16)nAllPolygonCount;
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 			for(a = 0; a < nPolygonCount; a++)
416*cdf0e10cSrcweir 			{
417*cdf0e10cSrcweir 				const Polygon& rCandidate = rPolyPolygon.GetObject(a);
418*cdf0e10cSrcweir 				const sal_uInt16 nPointCount(rCandidate.GetSize());
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 				if(nPointCount)
421*cdf0e10cSrcweir 				{
422*cdf0e10cSrcweir 					rOStm << nPointCount;
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 					for(sal_uInt16 b(0); b < nPointCount; b++)
425*cdf0e10cSrcweir 					{
426*cdf0e10cSrcweir 						rOStm << rCandidate[b];
427*cdf0e10cSrcweir 					}
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 					if(rCandidate.HasFlags())
430*cdf0e10cSrcweir 					{
431*cdf0e10cSrcweir 						rOStm << (sal_uInt8)true;
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir 						for(sal_uInt16 c(0); c < nPointCount; c++)
434*cdf0e10cSrcweir 						{
435*cdf0e10cSrcweir 							rOStm << (sal_uInt8)rCandidate.GetFlags(c);
436*cdf0e10cSrcweir 						}
437*cdf0e10cSrcweir 					}
438*cdf0e10cSrcweir 					else
439*cdf0e10cSrcweir 					{
440*cdf0e10cSrcweir 						rOStm << (sal_uInt8)false;
441*cdf0e10cSrcweir 					}
442*cdf0e10cSrcweir 				}
443*cdf0e10cSrcweir 			}
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir 			return true;
446*cdf0e10cSrcweir 		}
447*cdf0e10cSrcweir 	}
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 	return false;
450*cdf0e10cSrcweir }
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir // ------------------------------------------------------------------------
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly)
455*cdf0e10cSrcweir {
456*cdf0e10cSrcweir 	rPolyPoly.Clear();
457*cdf0e10cSrcweir 	sal_uInt16 nPolygonCount(0);
458*cdf0e10cSrcweir 	rIStm >> nPolygonCount;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 	for(sal_uInt16 a(0); a < nPolygonCount; a++)
461*cdf0e10cSrcweir 	{
462*cdf0e10cSrcweir 		sal_uInt16 nPointCount(0);
463*cdf0e10cSrcweir 		rIStm >> nPointCount;
464*cdf0e10cSrcweir 		Polygon aCandidate(nPointCount);
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 		if(nPointCount)
467*cdf0e10cSrcweir 		{
468*cdf0e10cSrcweir 			for(sal_uInt16 b(0); b < nPointCount; b++)
469*cdf0e10cSrcweir 			{
470*cdf0e10cSrcweir 				rIStm >> aCandidate[b];
471*cdf0e10cSrcweir 			}
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 			sal_uInt8 bHasFlags(false);
474*cdf0e10cSrcweir 			rIStm >> bHasFlags;
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 			if(bHasFlags)
477*cdf0e10cSrcweir 			{
478*cdf0e10cSrcweir 				sal_uInt8 aPolyFlags(0);
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 				for(sal_uInt16 c(0); c < nPointCount; c++)
481*cdf0e10cSrcweir 				{
482*cdf0e10cSrcweir 					rIStm >> aPolyFlags;
483*cdf0e10cSrcweir 					aCandidate.SetFlags(c, (PolyFlags)aPolyFlags);
484*cdf0e10cSrcweir 				}
485*cdf0e10cSrcweir 			}
486*cdf0e10cSrcweir 		}
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 		rPolyPoly.Insert(aCandidate);
489*cdf0e10cSrcweir 	}
490*cdf0e10cSrcweir }
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir // ----------------
493*cdf0e10cSrcweir // - SVMConverter -
494*cdf0e10cSrcweir // ----------------
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, sal_uLong nConvertMode )
497*cdf0e10cSrcweir {
498*cdf0e10cSrcweir 	if( !rStm.GetError() )
499*cdf0e10cSrcweir 	{
500*cdf0e10cSrcweir 		if( CONVERT_FROM_SVM1 == nConvertMode )
501*cdf0e10cSrcweir 			ImplConvertFromSVM1( rStm, rMtf );
502*cdf0e10cSrcweir 		else if( CONVERT_TO_SVM1 == nConvertMode )
503*cdf0e10cSrcweir 			ImplConvertToSVM1( rStm, rMtf );
504*cdf0e10cSrcweir 	}
505*cdf0e10cSrcweir }
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir // ------------------------------------------------------------------------
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
510*cdf0e10cSrcweir {
511*cdf0e10cSrcweir 	const sal_uLong			nPos = rIStm.Tell();
512*cdf0e10cSrcweir 	const sal_uInt16		nOldFormat = rIStm.GetNumberFormatInt();
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir 	rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir 	char	aCode[ 5 ];
517*cdf0e10cSrcweir 	Size	aPrefSz;
518*cdf0e10cSrcweir 	sal_Int16	nSize;
519*cdf0e10cSrcweir 	sal_Int16	nVersion;
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 	// read header
522*cdf0e10cSrcweir 	rIStm.Read( (char*) &aCode, sizeof( aCode ) );	// Kennung
523*cdf0e10cSrcweir 	rIStm >> nSize; 								// Size
524*cdf0e10cSrcweir 	rIStm >> nVersion;								// Version
525*cdf0e10cSrcweir 	rIStm >> aPrefSz.Width();						// PrefSize.Width()
526*cdf0e10cSrcweir 	rIStm >> aPrefSz.Height();						// PrefSize.Height()
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	// check header-magic and version
529*cdf0e10cSrcweir 	if( rIStm.GetError()
530*cdf0e10cSrcweir         || ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 )
531*cdf0e10cSrcweir         || ( nVersion != 200 ) )
532*cdf0e10cSrcweir 	{
533*cdf0e10cSrcweir 		rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
534*cdf0e10cSrcweir 		rIStm.SetNumberFormatInt( nOldFormat );
535*cdf0e10cSrcweir 		rIStm.Seek( nPos );
536*cdf0e10cSrcweir 		return;
537*cdf0e10cSrcweir 	}
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir 	LineInfo			aLineInfo( LINE_NONE, 0 );
540*cdf0e10cSrcweir 	Stack				aLIStack;
541*cdf0e10cSrcweir     VirtualDevice		aFontVDev;
542*cdf0e10cSrcweir 	rtl_TextEncoding	eActualCharSet = gsl_getSystemTextEncoding();
543*cdf0e10cSrcweir 	sal_Bool				bFatLine = sal_False;
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 	// TODO: fix reindentation below if you can accept being blamed by the SCM
546*cdf0e10cSrcweir         MapMode     aMapMode;
547*cdf0e10cSrcweir 		Polygon 	aActionPoly;
548*cdf0e10cSrcweir 		Rectangle	aRect;
549*cdf0e10cSrcweir 		Point		aPt, aPt1;
550*cdf0e10cSrcweir 		Size		aSz;
551*cdf0e10cSrcweir 		Color		aActionColor;
552*cdf0e10cSrcweir 		sal_Int32		nTmp, nTmp1, nActionSize;
553*cdf0e10cSrcweir         sal_Int32	    nActions;
554*cdf0e10cSrcweir 		sal_Int16		nType;
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir 		sal_uInt32	nUnicodeCommentStreamPos = 0;
557*cdf0e10cSrcweir 		sal_Int32	    nUnicodeCommentActionNumber = 0;
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir         ImplReadMapMode( rIStm, aMapMode ); 			// MapMode
560*cdf0e10cSrcweir         rIStm >> nActions;								// Action count
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 		rMtf.SetPrefSize( aPrefSz );
563*cdf0e10cSrcweir 		rMtf.SetPrefMapMode( aMapMode );
564*cdf0e10cSrcweir 		sal_uInt32 nLastPolygonAction(0);
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 		for( sal_Int32 i = 0L; i < nActions; i++ )
567*cdf0e10cSrcweir 		{
568*cdf0e10cSrcweir 			rIStm >> nType;
569*cdf0e10cSrcweir 			sal_Int32 nActBegin = rIStm.Tell();
570*cdf0e10cSrcweir 			rIStm >> nActionSize;
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir 			DBG_ASSERT( ( nType <= 33 ) || ( nType >= 1024 ), "Unknown GDIMetaAction while converting!" );
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir 			switch( nType )
575*cdf0e10cSrcweir 			{
576*cdf0e10cSrcweir 				case( GDI_PIXEL_ACTION ):
577*cdf0e10cSrcweir 				{
578*cdf0e10cSrcweir 					rIStm >> aPt;
579*cdf0e10cSrcweir 					ImplReadColor( rIStm, aActionColor );
580*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPixelAction( aPt, aActionColor ) );
581*cdf0e10cSrcweir 				}
582*cdf0e10cSrcweir 				break;
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir 				case( GDI_POINT_ACTION ):
585*cdf0e10cSrcweir 				{
586*cdf0e10cSrcweir 					rIStm >> aPt;
587*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPointAction( aPt ) );
588*cdf0e10cSrcweir 				}
589*cdf0e10cSrcweir 				break;
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir 				case( GDI_LINE_ACTION ):
592*cdf0e10cSrcweir 				{
593*cdf0e10cSrcweir 					rIStm >> aPt >> aPt1;
594*cdf0e10cSrcweir 					rMtf.AddAction( new MetaLineAction( aPt, aPt1, aLineInfo ) );
595*cdf0e10cSrcweir 				}
596*cdf0e10cSrcweir 				break;
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir 				case (GDI_LINEJOIN_ACTION) :
599*cdf0e10cSrcweir 				{
600*cdf0e10cSrcweir 					sal_Int16 nLineJoin(0);
601*cdf0e10cSrcweir 					rIStm >> nLineJoin;
602*cdf0e10cSrcweir 					aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin);
603*cdf0e10cSrcweir 				}
604*cdf0e10cSrcweir 				break;
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir 				case (GDI_LINEDASHDOT_ACTION) :
607*cdf0e10cSrcweir 				{
608*cdf0e10cSrcweir 					sal_Int16 a(0);
609*cdf0e10cSrcweir 					sal_Int32 b(0);
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 					rIStm >> a; aLineInfo.SetDashCount(a);
612*cdf0e10cSrcweir 					rIStm >> b; aLineInfo.SetDashLen(b);
613*cdf0e10cSrcweir 					rIStm >> a; aLineInfo.SetDotCount(a);
614*cdf0e10cSrcweir 					rIStm >> b; aLineInfo.SetDotLen(b);
615*cdf0e10cSrcweir 					rIStm >> b; aLineInfo.SetDistance(b);
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 					if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen())
618*cdf0e10cSrcweir 						|| (aLineInfo.GetDotCount() && aLineInfo.GetDotLen()))
619*cdf0e10cSrcweir 						&& aLineInfo.GetDistance())
620*cdf0e10cSrcweir 					{
621*cdf0e10cSrcweir 						aLineInfo.SetStyle(LINE_DASH);
622*cdf0e10cSrcweir 					}
623*cdf0e10cSrcweir 				}
624*cdf0e10cSrcweir 				break;
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 				case (GDI_EXTENDEDPOLYGON_ACTION) :
627*cdf0e10cSrcweir 				{
628*cdf0e10cSrcweir 					// read the PolyPolygon in every case
629*cdf0e10cSrcweir 					PolyPolygon aInputPolyPolygon;
630*cdf0e10cSrcweir 					ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon);
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir 					// now check if it can be set somewhere
633*cdf0e10cSrcweir 					if(nLastPolygonAction < rMtf.GetActionCount())
634*cdf0e10cSrcweir 					{
635*cdf0e10cSrcweir 						MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction));
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 						if(pPolyLineAction)
638*cdf0e10cSrcweir 						{
639*cdf0e10cSrcweir 							// replace MetaPolyLineAction when we have a single polygon. Do not rely on the
640*cdf0e10cSrcweir 							// same point count; the originally written GDI_POLYLINE_ACTION may have been
641*cdf0e10cSrcweir 							// Subdivided for better quality for older usages
642*cdf0e10cSrcweir 							if(1 == aInputPolyPolygon.Count())
643*cdf0e10cSrcweir 							{
644*cdf0e10cSrcweir 								rMtf.ReplaceAction(
645*cdf0e10cSrcweir 									new MetaPolyLineAction(
646*cdf0e10cSrcweir 										aInputPolyPolygon.GetObject(0),
647*cdf0e10cSrcweir 										pPolyLineAction->GetLineInfo()),
648*cdf0e10cSrcweir 									nLastPolygonAction);
649*cdf0e10cSrcweir 								pPolyLineAction->Delete();
650*cdf0e10cSrcweir 							}
651*cdf0e10cSrcweir 						}
652*cdf0e10cSrcweir 						else
653*cdf0e10cSrcweir 						{
654*cdf0e10cSrcweir 							MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 							if(pPolyPolygonAction)
657*cdf0e10cSrcweir 							{
658*cdf0e10cSrcweir 								// replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the
659*cdf0e10cSrcweir 								// same sub-polygon count
660*cdf0e10cSrcweir 								if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count())
661*cdf0e10cSrcweir 								{
662*cdf0e10cSrcweir 									rMtf.ReplaceAction(
663*cdf0e10cSrcweir 										new MetaPolyPolygonAction(
664*cdf0e10cSrcweir 											aInputPolyPolygon),
665*cdf0e10cSrcweir 										nLastPolygonAction);
666*cdf0e10cSrcweir 									pPolyPolygonAction->Delete();
667*cdf0e10cSrcweir 								}
668*cdf0e10cSrcweir 							}
669*cdf0e10cSrcweir 							else
670*cdf0e10cSrcweir 							{
671*cdf0e10cSrcweir 								MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir 								if(pPolygonAction)
674*cdf0e10cSrcweir 								{
675*cdf0e10cSrcweir 									// replace MetaPolygonAction
676*cdf0e10cSrcweir 									if(1 == aInputPolyPolygon.Count())
677*cdf0e10cSrcweir 									{
678*cdf0e10cSrcweir 										rMtf.ReplaceAction(
679*cdf0e10cSrcweir 											new MetaPolygonAction(
680*cdf0e10cSrcweir 												aInputPolyPolygon.GetObject(0)),
681*cdf0e10cSrcweir 											nLastPolygonAction);
682*cdf0e10cSrcweir 										pPolygonAction->Delete();
683*cdf0e10cSrcweir 									}
684*cdf0e10cSrcweir 								}
685*cdf0e10cSrcweir 							}
686*cdf0e10cSrcweir 						}
687*cdf0e10cSrcweir 					}
688*cdf0e10cSrcweir 				}
689*cdf0e10cSrcweir 				break;
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir 				case( GDI_RECT_ACTION ):
692*cdf0e10cSrcweir 				{
693*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
694*cdf0e10cSrcweir 					rIStm >> nTmp >> nTmp1;
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 					if( nTmp || nTmp1 )
697*cdf0e10cSrcweir 						rMtf.AddAction( new MetaRoundRectAction( aRect, nTmp, nTmp1 ) );
698*cdf0e10cSrcweir 					else
699*cdf0e10cSrcweir 					{
700*cdf0e10cSrcweir 						rMtf.AddAction( new MetaRectAction( aRect ) );
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir 						if( bFatLine )
703*cdf0e10cSrcweir 							rMtf.AddAction( new MetaPolyLineAction( aRect, aLineInfo ) );
704*cdf0e10cSrcweir 					}
705*cdf0e10cSrcweir 				}
706*cdf0e10cSrcweir 				break;
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 				case( GDI_ELLIPSE_ACTION ):
709*cdf0e10cSrcweir 				{
710*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir 					if( bFatLine )
713*cdf0e10cSrcweir 					{
714*cdf0e10cSrcweir 						const Polygon aPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
717*cdf0e10cSrcweir 						rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
718*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolygonAction( aPoly ) );
719*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPopAction() );
720*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
721*cdf0e10cSrcweir 					}
722*cdf0e10cSrcweir 					else
723*cdf0e10cSrcweir 						rMtf.AddAction( new MetaEllipseAction( aRect ) );
724*cdf0e10cSrcweir 				}
725*cdf0e10cSrcweir 				break;
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir 				case( GDI_ARC_ACTION ):
728*cdf0e10cSrcweir 				{
729*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
730*cdf0e10cSrcweir 					rIStm >> aPt >> aPt1;
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir 					if( bFatLine )
733*cdf0e10cSrcweir 					{
734*cdf0e10cSrcweir 						const Polygon aPoly( aRect, aPt, aPt1, POLY_ARC );
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
737*cdf0e10cSrcweir 						rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
738*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolygonAction( aPoly ) );
739*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPopAction() );
740*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
741*cdf0e10cSrcweir 					}
742*cdf0e10cSrcweir 					else
743*cdf0e10cSrcweir 						rMtf.AddAction( new MetaArcAction( aRect, aPt, aPt1 ) );
744*cdf0e10cSrcweir 				}
745*cdf0e10cSrcweir 				break;
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir 				case( GDI_PIE_ACTION ):
748*cdf0e10cSrcweir 				{
749*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
750*cdf0e10cSrcweir 					rIStm >> aPt >> aPt1;
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir 					if( bFatLine )
753*cdf0e10cSrcweir 					{
754*cdf0e10cSrcweir 						const Polygon aPoly( aRect, aPt, aPt1, POLY_PIE );
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
757*cdf0e10cSrcweir 						rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
758*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolygonAction( aPoly ) );
759*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPopAction() );
760*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
761*cdf0e10cSrcweir 					}
762*cdf0e10cSrcweir 					else
763*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPieAction( aRect, aPt, aPt1 ) );
764*cdf0e10cSrcweir 				}
765*cdf0e10cSrcweir 				break;
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 				case( GDI_INVERTRECT_ACTION ):
768*cdf0e10cSrcweir 				case( GDI_HIGHLIGHTRECT_ACTION ):
769*cdf0e10cSrcweir 				{
770*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
771*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPushAction( PUSH_RASTEROP ) );
772*cdf0e10cSrcweir 					rMtf.AddAction( new MetaRasterOpAction( ROP_INVERT ) );
773*cdf0e10cSrcweir 					rMtf.AddAction( new MetaRectAction( aRect ) );
774*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPopAction() );
775*cdf0e10cSrcweir 				}
776*cdf0e10cSrcweir 				break;
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir 				case( GDI_POLYLINE_ACTION ):
779*cdf0e10cSrcweir 				{
780*cdf0e10cSrcweir 					ImplReadPoly( rIStm, aActionPoly );
781*cdf0e10cSrcweir 					nLastPolygonAction = rMtf.GetActionCount();
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir 					if( bFatLine )
784*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
785*cdf0e10cSrcweir 					else
786*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aActionPoly ) );
787*cdf0e10cSrcweir 				}
788*cdf0e10cSrcweir 				break;
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir 				case( GDI_POLYGON_ACTION ):
791*cdf0e10cSrcweir 				{
792*cdf0e10cSrcweir 					ImplReadPoly( rIStm, aActionPoly );
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir 					if( bFatLine )
795*cdf0e10cSrcweir 					{
796*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
797*cdf0e10cSrcweir 						rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
798*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
799*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPopAction() );
800*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
801*cdf0e10cSrcweir 					}
802*cdf0e10cSrcweir 					else
803*cdf0e10cSrcweir 					{
804*cdf0e10cSrcweir 						nLastPolygonAction = rMtf.GetActionCount();
805*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
806*cdf0e10cSrcweir 					}
807*cdf0e10cSrcweir 				}
808*cdf0e10cSrcweir 				break;
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir 				case( GDI_POLYPOLYGON_ACTION ):
811*cdf0e10cSrcweir 				{
812*cdf0e10cSrcweir 					PolyPolygon aPolyPoly;
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 					ImplReadPolyPoly( rIStm, aPolyPoly );
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 					if( bFatLine )
817*cdf0e10cSrcweir 					{
818*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
819*cdf0e10cSrcweir 						rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, sal_False ) );
820*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
821*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPopAction() );
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir 						for( sal_uInt16 nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ )
824*cdf0e10cSrcweir 							rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) );
825*cdf0e10cSrcweir 					}
826*cdf0e10cSrcweir 					else
827*cdf0e10cSrcweir 					{
828*cdf0e10cSrcweir 						nLastPolygonAction = rMtf.GetActionCount();
829*cdf0e10cSrcweir 						rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
830*cdf0e10cSrcweir 					}
831*cdf0e10cSrcweir 				}
832*cdf0e10cSrcweir 				break;
833*cdf0e10cSrcweir 
834*cdf0e10cSrcweir 				case( GDI_FONT_ACTION ):
835*cdf0e10cSrcweir 				{
836*cdf0e10cSrcweir 					Font	aFont;
837*cdf0e10cSrcweir 					char	aName[ 32 ];
838*cdf0e10cSrcweir 					sal_Int32	nWidth, nHeight;
839*cdf0e10cSrcweir 					sal_Int16	nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout;
840*cdf0e10cSrcweir 					sal_Int16	nCharOrient, nLineOrient;
841*cdf0e10cSrcweir 					sal_Bool	bItalic, bOutline, bShadow, bTransparent;
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir 					ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor );
844*cdf0e10cSrcweir 					ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor );
845*cdf0e10cSrcweir 					rIStm.Read( aName, 32 );
846*cdf0e10cSrcweir 					aFont.SetName( UniString( aName, rIStm.GetStreamCharSet() ) );
847*cdf0e10cSrcweir 					rIStm >> nWidth >> nHeight;
848*cdf0e10cSrcweir 					rIStm >> nCharOrient >> nLineOrient;
849*cdf0e10cSrcweir 					rIStm >> nCharSet >> nFamily >> nPitch >> nAlign >> nWeight >> nUnderline >> nStrikeout;
850*cdf0e10cSrcweir 					rIStm >> bItalic >> bOutline >> bShadow >> bTransparent;
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir 					aFont.SetSize( Size( nWidth, nHeight ) );
853*cdf0e10cSrcweir 					aFont.SetCharSet( (CharSet) nCharSet );
854*cdf0e10cSrcweir 					aFont.SetFamily( (FontFamily) nFamily );
855*cdf0e10cSrcweir 					aFont.SetPitch( (FontPitch) nPitch );
856*cdf0e10cSrcweir 					aFont.SetAlign( (FontAlign) nAlign );
857*cdf0e10cSrcweir 					aFont.SetWeight( ( nWeight == 1 ) ? WEIGHT_LIGHT : ( nWeight == 2 ) ? WEIGHT_NORMAL :
858*cdf0e10cSrcweir 									 ( nWeight == 3 ) ? WEIGHT_BOLD : WEIGHT_DONTKNOW );
859*cdf0e10cSrcweir 					aFont.SetUnderline( (FontUnderline) nUnderline );
860*cdf0e10cSrcweir 					aFont.SetStrikeout( (FontStrikeout) nStrikeout );
861*cdf0e10cSrcweir 					aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE );
862*cdf0e10cSrcweir 					aFont.SetOutline( bOutline );
863*cdf0e10cSrcweir 					aFont.SetShadow( bShadow );
864*cdf0e10cSrcweir 					aFont.SetOrientation( nLineOrient );
865*cdf0e10cSrcweir 					aFont.SetTransparent( bTransparent );
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 					eActualCharSet = aFont.GetCharSet();
868*cdf0e10cSrcweir 					if ( eActualCharSet == RTL_TEXTENCODING_DONTKNOW )
869*cdf0e10cSrcweir 						eActualCharSet = gsl_getSystemTextEncoding();
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir                     rMtf.AddAction( new MetaFontAction( aFont ) );
872*cdf0e10cSrcweir                     rMtf.AddAction( new MetaTextAlignAction( aFont.GetAlign() ) );
873*cdf0e10cSrcweir                     rMtf.AddAction( new MetaTextColorAction( aFont.GetColor() ) );
874*cdf0e10cSrcweir                     rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
875*cdf0e10cSrcweir 
876*cdf0e10cSrcweir                     // #106172# Track font relevant data in shadow VDev
877*cdf0e10cSrcweir                     aFontVDev.SetFont( aFont );
878*cdf0e10cSrcweir 				}
879*cdf0e10cSrcweir 				break;
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir 				case( GDI_TEXT_ACTION ):
882*cdf0e10cSrcweir 				{
883*cdf0e10cSrcweir 					ByteString	aByteStr;
884*cdf0e10cSrcweir 					sal_Int32		nIndex, nLen;
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 					rIStm >> aPt >> nIndex >> nLen >> nTmp;
887*cdf0e10cSrcweir 					if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
888*cdf0e10cSrcweir                                         {
889*cdf0e10cSrcweir 						rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
890*cdf0e10cSrcweir 						UniString aStr( aByteStr, eActualCharSet );
891*cdf0e10cSrcweir 						if ( nUnicodeCommentActionNumber == i )
892*cdf0e10cSrcweir 							ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
893*cdf0e10cSrcweir 						rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
894*cdf0e10cSrcweir 					}
895*cdf0e10cSrcweir                 			rIStm.Seek( nActBegin + nActionSize );
896*cdf0e10cSrcweir 				}
897*cdf0e10cSrcweir 				break;
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir 				case( GDI_TEXTARRAY_ACTION ):
900*cdf0e10cSrcweir 				{
901*cdf0e10cSrcweir 					ByteString	aByteStr;
902*cdf0e10cSrcweir 					sal_Int32*	pDXAry = NULL;
903*cdf0e10cSrcweir 					sal_Int32		nIndex, nLen, nAryLen;
904*cdf0e10cSrcweir 
905*cdf0e10cSrcweir 					rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
906*cdf0e10cSrcweir 					if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
907*cdf0e10cSrcweir 					{
908*cdf0e10cSrcweir 						rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
909*cdf0e10cSrcweir 						UniString aStr( aByteStr, eActualCharSet );
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 						if( nAryLen > 0L )
912*cdf0e10cSrcweir 						{
913*cdf0e10cSrcweir 							sal_Int32 nStrLen( aStr.Len() );
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 							pDXAry = new sal_Int32[ Max( nAryLen, nStrLen ) ];
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 							for( long j = 0L; j < nAryLen; j++ )
918*cdf0e10cSrcweir 								rIStm >> nTmp, pDXAry[ j ] = nTmp;
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir 							// #106172# Add last DX array elem, if missing
921*cdf0e10cSrcweir 							if( nAryLen != nStrLen )
922*cdf0e10cSrcweir 							{
923*cdf0e10cSrcweir 								if( nAryLen+1 == nStrLen )
924*cdf0e10cSrcweir 								{
925*cdf0e10cSrcweir 									sal_Int32* pTmpAry = new sal_Int32[nStrLen];
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 									aFontVDev.GetTextArray( aStr, pTmpAry, (sal_uInt16) nIndex, (sal_uInt16) nLen );
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir 									// now, the difference between the
930*cdf0e10cSrcweir 									// last and the second last DX array
931*cdf0e10cSrcweir 									// is the advancement for the last
932*cdf0e10cSrcweir 									// glyph. Thus, to complete our meta
933*cdf0e10cSrcweir 									// action's DX array, just add that
934*cdf0e10cSrcweir 									// difference to last elem and store
935*cdf0e10cSrcweir 									// in very last.
936*cdf0e10cSrcweir 									if( nStrLen > 1 )
937*cdf0e10cSrcweir 										pDXAry[ nStrLen-1 ] = pDXAry[ nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
938*cdf0e10cSrcweir 									else
939*cdf0e10cSrcweir 										pDXAry[ nStrLen-1 ] = pTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir 									delete[] pTmpAry;
942*cdf0e10cSrcweir 								}
943*cdf0e10cSrcweir 	#ifdef DBG_UTIL
944*cdf0e10cSrcweir 								else
945*cdf0e10cSrcweir 									DBG_ERROR("More than one DX array element missing on SVM import");
946*cdf0e10cSrcweir 	#endif
947*cdf0e10cSrcweir 							}
948*cdf0e10cSrcweir 						}
949*cdf0e10cSrcweir 						if ( nUnicodeCommentActionNumber == i )
950*cdf0e10cSrcweir 							ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
951*cdf0e10cSrcweir 						rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir 						if( pDXAry )
954*cdf0e10cSrcweir 							delete[] pDXAry;
955*cdf0e10cSrcweir 					}
956*cdf0e10cSrcweir                 			rIStm.Seek( nActBegin + nActionSize );
957*cdf0e10cSrcweir 				}
958*cdf0e10cSrcweir 				break;
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir 				case( GDI_STRETCHTEXT_ACTION ):
961*cdf0e10cSrcweir 				{
962*cdf0e10cSrcweir 					ByteString	aByteStr;
963*cdf0e10cSrcweir 					sal_Int32		nIndex, nLen, nWidth;
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 					rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
966*cdf0e10cSrcweir 					if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
967*cdf0e10cSrcweir 					{
968*cdf0e10cSrcweir 						rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
969*cdf0e10cSrcweir 						UniString aStr( aByteStr, eActualCharSet );
970*cdf0e10cSrcweir 						if ( nUnicodeCommentActionNumber == i )
971*cdf0e10cSrcweir 							ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
972*cdf0e10cSrcweir 						rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
973*cdf0e10cSrcweir 					}
974*cdf0e10cSrcweir                                         rIStm.Seek( nActBegin + nActionSize );
975*cdf0e10cSrcweir 				}
976*cdf0e10cSrcweir 				break;
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir 				case( GDI_BITMAP_ACTION ):
979*cdf0e10cSrcweir 				{
980*cdf0e10cSrcweir 					Bitmap aBmp;
981*cdf0e10cSrcweir 
982*cdf0e10cSrcweir 					rIStm >> aPt >> aBmp;
983*cdf0e10cSrcweir 					rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
984*cdf0e10cSrcweir 				}
985*cdf0e10cSrcweir 				break;
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir 				case( GDI_BITMAPSCALE_ACTION ):
988*cdf0e10cSrcweir 				{
989*cdf0e10cSrcweir 					Bitmap aBmp;
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir 					rIStm >> aPt >> aSz >> aBmp;
992*cdf0e10cSrcweir 					rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
993*cdf0e10cSrcweir 				}
994*cdf0e10cSrcweir 				break;
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir 				case( GDI_BITMAPSCALEPART_ACTION ):
997*cdf0e10cSrcweir 				{
998*cdf0e10cSrcweir 					Bitmap	aBmp;
999*cdf0e10cSrcweir 					Size	aSz2;
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir 					rIStm >> aPt >> aSz >> aPt1 >> aSz2 >> aBmp;
1002*cdf0e10cSrcweir 					rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
1003*cdf0e10cSrcweir 				}
1004*cdf0e10cSrcweir 				break;
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir 				case( GDI_PEN_ACTION ):
1007*cdf0e10cSrcweir 				{
1008*cdf0e10cSrcweir 					sal_Int32 nPenWidth;
1009*cdf0e10cSrcweir 					sal_Int16 nPenStyle;
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir 					ImplReadColor( rIStm, aActionColor );
1012*cdf0e10cSrcweir 					rIStm >> nPenWidth >> nPenStyle;
1013*cdf0e10cSrcweir 
1014*cdf0e10cSrcweir 					aLineInfo.SetStyle( nPenStyle ? LINE_SOLID : LINE_NONE );
1015*cdf0e10cSrcweir 					aLineInfo.SetWidth( nPenWidth );
1016*cdf0e10cSrcweir 					bFatLine = nPenStyle && !aLineInfo.IsDefault();
1017*cdf0e10cSrcweir 
1018*cdf0e10cSrcweir 					rMtf.AddAction( new MetaLineColorAction( aActionColor, nPenStyle != 0 ) );
1019*cdf0e10cSrcweir 				}
1020*cdf0e10cSrcweir 				break;
1021*cdf0e10cSrcweir 
1022*cdf0e10cSrcweir 				case( GDI_FILLBRUSH_ACTION ):
1023*cdf0e10cSrcweir 				{
1024*cdf0e10cSrcweir 					sal_Int16 nBrushStyle;
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir 					ImplReadColor( rIStm, aActionColor );
1027*cdf0e10cSrcweir 					rIStm.SeekRel( 6L );
1028*cdf0e10cSrcweir 					rIStm >> nBrushStyle;
1029*cdf0e10cSrcweir 					rMtf.AddAction( new MetaFillColorAction( aActionColor, nBrushStyle != 0 ) );
1030*cdf0e10cSrcweir 					rIStm.SeekRel( 2L );
1031*cdf0e10cSrcweir 				}
1032*cdf0e10cSrcweir 				break;
1033*cdf0e10cSrcweir 
1034*cdf0e10cSrcweir 				case( GDI_MAPMODE_ACTION ):
1035*cdf0e10cSrcweir 				{
1036*cdf0e10cSrcweir 					ImplReadMapMode( rIStm, aMapMode );
1037*cdf0e10cSrcweir 					rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
1038*cdf0e10cSrcweir 
1039*cdf0e10cSrcweir                     // #106172# Track font relevant data in shadow VDev
1040*cdf0e10cSrcweir                     aFontVDev.SetMapMode( aMapMode );
1041*cdf0e10cSrcweir 				}
1042*cdf0e10cSrcweir 				break;
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir 				case( GDI_CLIPREGION_ACTION ):
1045*cdf0e10cSrcweir 				{
1046*cdf0e10cSrcweir 					Region	aRegion;
1047*cdf0e10cSrcweir 					sal_Int16	nRegType;
1048*cdf0e10cSrcweir 					sal_Int16	bIntersect;
1049*cdf0e10cSrcweir 					sal_Bool	bClip = sal_False;
1050*cdf0e10cSrcweir 
1051*cdf0e10cSrcweir 					rIStm >> nRegType >> bIntersect;
1052*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
1053*cdf0e10cSrcweir 
1054*cdf0e10cSrcweir 					switch( nRegType )
1055*cdf0e10cSrcweir 					{
1056*cdf0e10cSrcweir 						case( 0 ):
1057*cdf0e10cSrcweir 						break;
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir 						case( 1 ):
1060*cdf0e10cSrcweir 						{
1061*cdf0e10cSrcweir 							Rectangle aRegRect;
1062*cdf0e10cSrcweir 
1063*cdf0e10cSrcweir 							ImplReadRect( rIStm, aRegRect );
1064*cdf0e10cSrcweir 							aRegion = Region( aRegRect );
1065*cdf0e10cSrcweir 							bClip = sal_True;
1066*cdf0e10cSrcweir 						}
1067*cdf0e10cSrcweir 						break;
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir 						case( 2 ):
1070*cdf0e10cSrcweir 						{
1071*cdf0e10cSrcweir 							ImplReadPoly( rIStm, aActionPoly );
1072*cdf0e10cSrcweir 							aRegion = Region( aActionPoly );
1073*cdf0e10cSrcweir 							bClip = sal_True;
1074*cdf0e10cSrcweir 						}
1075*cdf0e10cSrcweir 						break;
1076*cdf0e10cSrcweir 
1077*cdf0e10cSrcweir 						case( 3 ):
1078*cdf0e10cSrcweir 						{
1079*cdf0e10cSrcweir 							PolyPolygon aPolyPoly;
1080*cdf0e10cSrcweir 							sal_Int32		nPolyCount;
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir 							rIStm >> nPolyCount;
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 							for( sal_uInt16 j = 0; j < (sal_uInt16) nPolyCount; j++ )
1085*cdf0e10cSrcweir 							{
1086*cdf0e10cSrcweir 								ImplReadPoly( rIStm, aActionPoly );
1087*cdf0e10cSrcweir 								aPolyPoly.Insert( aActionPoly );
1088*cdf0e10cSrcweir 							}
1089*cdf0e10cSrcweir 
1090*cdf0e10cSrcweir 							aRegion = Region( aPolyPoly );
1091*cdf0e10cSrcweir 							bClip = sal_True;
1092*cdf0e10cSrcweir 						}
1093*cdf0e10cSrcweir 						break;
1094*cdf0e10cSrcweir 					}
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir 					if( bIntersect )
1097*cdf0e10cSrcweir 						aRegion.Intersect( aRect );
1098*cdf0e10cSrcweir 
1099*cdf0e10cSrcweir 					rMtf.AddAction( new MetaClipRegionAction( aRegion, bClip ) );
1100*cdf0e10cSrcweir 				}
1101*cdf0e10cSrcweir 				break;
1102*cdf0e10cSrcweir 
1103*cdf0e10cSrcweir 				case( GDI_MOVECLIPREGION_ACTION ):
1104*cdf0e10cSrcweir 				{
1105*cdf0e10cSrcweir 					rIStm >> nTmp >> nTmp1;
1106*cdf0e10cSrcweir 					rMtf.AddAction( new MetaMoveClipRegionAction( nTmp, nTmp1 ) );
1107*cdf0e10cSrcweir 				}
1108*cdf0e10cSrcweir 				break;
1109*cdf0e10cSrcweir 
1110*cdf0e10cSrcweir 				case( GDI_ISECTCLIPREGION_ACTION ):
1111*cdf0e10cSrcweir 				{
1112*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
1113*cdf0e10cSrcweir 					rMtf.AddAction( new MetaISectRectClipRegionAction( aRect ) );
1114*cdf0e10cSrcweir 				}
1115*cdf0e10cSrcweir 				break;
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir 				case( GDI_RASTEROP_ACTION ):
1118*cdf0e10cSrcweir 				{
1119*cdf0e10cSrcweir 					RasterOp	eRasterOp;
1120*cdf0e10cSrcweir 					sal_Int16		nRasterOp;
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir 					rIStm >> nRasterOp;
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir 					switch( nRasterOp )
1125*cdf0e10cSrcweir 					{
1126*cdf0e10cSrcweir 						case( 1 ):
1127*cdf0e10cSrcweir 							eRasterOp = ROP_INVERT;
1128*cdf0e10cSrcweir 						break;
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir 						case( 4 ):
1131*cdf0e10cSrcweir 						case( 5 ):
1132*cdf0e10cSrcweir 							eRasterOp = ROP_XOR;
1133*cdf0e10cSrcweir 						break;
1134*cdf0e10cSrcweir 
1135*cdf0e10cSrcweir 						default:
1136*cdf0e10cSrcweir 							eRasterOp = ROP_OVERPAINT;
1137*cdf0e10cSrcweir 						break;
1138*cdf0e10cSrcweir 					}
1139*cdf0e10cSrcweir 
1140*cdf0e10cSrcweir 					rMtf.AddAction( new MetaRasterOpAction( eRasterOp ) );
1141*cdf0e10cSrcweir 				}
1142*cdf0e10cSrcweir 				break;
1143*cdf0e10cSrcweir 
1144*cdf0e10cSrcweir 				case( GDI_PUSH_ACTION ):
1145*cdf0e10cSrcweir 				{
1146*cdf0e10cSrcweir 					aLIStack.Push( new LineInfo( aLineInfo ) );
1147*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPushAction( PUSH_ALL ) );
1148*cdf0e10cSrcweir 
1149*cdf0e10cSrcweir                     // #106172# Track font relevant data in shadow VDev
1150*cdf0e10cSrcweir                     aFontVDev.Push();
1151*cdf0e10cSrcweir 				}
1152*cdf0e10cSrcweir 				break;
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir 				case( GDI_POP_ACTION ):
1155*cdf0e10cSrcweir 				{
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir 					LineInfo* pLineInfo = (LineInfo*) aLIStack.Pop();
1158*cdf0e10cSrcweir 
1159*cdf0e10cSrcweir 					// restore line info
1160*cdf0e10cSrcweir 					if( pLineInfo )
1161*cdf0e10cSrcweir 					{
1162*cdf0e10cSrcweir 						aLineInfo = *pLineInfo;
1163*cdf0e10cSrcweir 						delete pLineInfo;
1164*cdf0e10cSrcweir 						bFatLine = ( LINE_NONE != aLineInfo.GetStyle() ) && !aLineInfo.IsDefault();
1165*cdf0e10cSrcweir 					}
1166*cdf0e10cSrcweir 
1167*cdf0e10cSrcweir 					rMtf.AddAction( new MetaPopAction() );
1168*cdf0e10cSrcweir 
1169*cdf0e10cSrcweir                     // #106172# Track font relevant data in shadow VDev
1170*cdf0e10cSrcweir                     aFontVDev.Pop();
1171*cdf0e10cSrcweir 				}
1172*cdf0e10cSrcweir 				break;
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir 				case( GDI_GRADIENT_ACTION ):
1175*cdf0e10cSrcweir 				{
1176*cdf0e10cSrcweir 					Color	aStartCol;
1177*cdf0e10cSrcweir 					Color	aEndCol;
1178*cdf0e10cSrcweir 					sal_Int16	nStyle;
1179*cdf0e10cSrcweir 					sal_Int16	nAngle;
1180*cdf0e10cSrcweir 					sal_Int16	nBorder;
1181*cdf0e10cSrcweir 					sal_Int16	nOfsX;
1182*cdf0e10cSrcweir 					sal_Int16	nOfsY;
1183*cdf0e10cSrcweir 					sal_Int16	nIntensityStart;
1184*cdf0e10cSrcweir 					sal_Int16	nIntensityEnd;
1185*cdf0e10cSrcweir 
1186*cdf0e10cSrcweir 					ImplReadRect( rIStm, aRect );
1187*cdf0e10cSrcweir 					rIStm >> nStyle;
1188*cdf0e10cSrcweir 					ImplReadColor( rIStm, aStartCol );
1189*cdf0e10cSrcweir 					ImplReadColor( rIStm, aEndCol );
1190*cdf0e10cSrcweir 					rIStm >> nAngle >> nBorder >> nOfsX >> nOfsY >> nIntensityStart >> nIntensityEnd;
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir 					Gradient aGrad( (GradientStyle) nStyle, aStartCol, aEndCol );
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir 					aGrad.SetAngle( nAngle );
1195*cdf0e10cSrcweir 					aGrad.SetBorder( nBorder );
1196*cdf0e10cSrcweir 					aGrad.SetOfsX( nOfsX );
1197*cdf0e10cSrcweir 					aGrad.SetOfsY( nOfsY );
1198*cdf0e10cSrcweir 					aGrad.SetStartIntensity( nIntensityStart );
1199*cdf0e10cSrcweir 					aGrad.SetEndIntensity( nIntensityEnd );
1200*cdf0e10cSrcweir 					rMtf.AddAction( new MetaGradientAction( aRect, aGrad ) );
1201*cdf0e10cSrcweir 				}
1202*cdf0e10cSrcweir 				break;
1203*cdf0e10cSrcweir 
1204*cdf0e10cSrcweir 				case( GDI_TRANSPARENT_COMMENT ):
1205*cdf0e10cSrcweir 				{
1206*cdf0e10cSrcweir 					PolyPolygon aPolyPoly;
1207*cdf0e10cSrcweir 					sal_Int32		nFollowingActionCount;
1208*cdf0e10cSrcweir 					sal_Int16		nTrans;
1209*cdf0e10cSrcweir 
1210*cdf0e10cSrcweir 					rIStm >> aPolyPoly >> nTrans >> nFollowingActionCount;
1211*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1212*cdf0e10cSrcweir 					rMtf.AddAction( new MetaTransparentAction( aPolyPoly, nTrans ) );
1213*cdf0e10cSrcweir 
1214*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1215*cdf0e10cSrcweir 					i += nFollowingActionCount;
1216*cdf0e10cSrcweir #endif
1217*cdf0e10cSrcweir 				}
1218*cdf0e10cSrcweir 				break;
1219*cdf0e10cSrcweir 
1220*cdf0e10cSrcweir 				case( GDI_FLOATTRANSPARENT_COMMENT ):
1221*cdf0e10cSrcweir 				{
1222*cdf0e10cSrcweir 					GDIMetaFile aMtf;
1223*cdf0e10cSrcweir 					Point		aPos;
1224*cdf0e10cSrcweir 					Size		aSize;
1225*cdf0e10cSrcweir 					Gradient	aGradient;
1226*cdf0e10cSrcweir 					sal_Int32		nFollowingActionCount;
1227*cdf0e10cSrcweir 
1228*cdf0e10cSrcweir 					rIStm >> aMtf >> aPos >> aSize >> aGradient >> nFollowingActionCount;
1229*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1230*cdf0e10cSrcweir 					rMtf.AddAction( new MetaFloatTransparentAction( aMtf, aPos, aSize, aGradient ) );
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1233*cdf0e10cSrcweir 					i += nFollowingActionCount;
1234*cdf0e10cSrcweir #endif
1235*cdf0e10cSrcweir 				}
1236*cdf0e10cSrcweir 				break;
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir 				case( GDI_HATCH_COMMENT ):
1239*cdf0e10cSrcweir 				{
1240*cdf0e10cSrcweir 					PolyPolygon aPolyPoly;
1241*cdf0e10cSrcweir 					Hatch		aHatch;
1242*cdf0e10cSrcweir 					sal_Int32		nFollowingActionCount;
1243*cdf0e10cSrcweir 
1244*cdf0e10cSrcweir 					rIStm >> aPolyPoly >> aHatch >> nFollowingActionCount;
1245*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1246*cdf0e10cSrcweir 					rMtf.AddAction( new MetaHatchAction( aPolyPoly, aHatch ) );
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1249*cdf0e10cSrcweir 					i += nFollowingActionCount;
1250*cdf0e10cSrcweir #endif
1251*cdf0e10cSrcweir 				}
1252*cdf0e10cSrcweir 				break;
1253*cdf0e10cSrcweir 
1254*cdf0e10cSrcweir 				case( GDI_REFPOINT_COMMENT ):
1255*cdf0e10cSrcweir 				{
1256*cdf0e10cSrcweir 					Point	aRefPoint;
1257*cdf0e10cSrcweir 					sal_Bool	bSet;
1258*cdf0e10cSrcweir 					sal_Int32	nFollowingActionCount;
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir 					rIStm >> aRefPoint >> bSet >> nFollowingActionCount;
1261*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1262*cdf0e10cSrcweir 					rMtf.AddAction( new MetaRefPointAction( aRefPoint, bSet ) );
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1265*cdf0e10cSrcweir 					i += nFollowingActionCount;
1266*cdf0e10cSrcweir #endif
1267*cdf0e10cSrcweir 
1268*cdf0e10cSrcweir                     // #106172# Track font relevant data in shadow VDev
1269*cdf0e10cSrcweir                     if( bSet )
1270*cdf0e10cSrcweir                         aFontVDev.SetRefPoint( aRefPoint );
1271*cdf0e10cSrcweir                     else
1272*cdf0e10cSrcweir                         aFontVDev.SetRefPoint();
1273*cdf0e10cSrcweir 				}
1274*cdf0e10cSrcweir 				break;
1275*cdf0e10cSrcweir 
1276*cdf0e10cSrcweir 				case( GDI_TEXTLINECOLOR_COMMENT ):
1277*cdf0e10cSrcweir 				{
1278*cdf0e10cSrcweir 					Color	aColor;
1279*cdf0e10cSrcweir 					sal_Bool	bSet;
1280*cdf0e10cSrcweir 					sal_Int32	nFollowingActionCount;
1281*cdf0e10cSrcweir 
1282*cdf0e10cSrcweir 					rIStm >> aColor >> bSet >> nFollowingActionCount;
1283*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1284*cdf0e10cSrcweir 					rMtf.AddAction( new MetaTextLineColorAction( aColor, bSet ) );
1285*cdf0e10cSrcweir 
1286*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1287*cdf0e10cSrcweir 					i += nFollowingActionCount;
1288*cdf0e10cSrcweir #endif
1289*cdf0e10cSrcweir 				}
1290*cdf0e10cSrcweir 				break;
1291*cdf0e10cSrcweir 
1292*cdf0e10cSrcweir 				case( GDI_TEXTLINE_COMMENT ):
1293*cdf0e10cSrcweir 				{
1294*cdf0e10cSrcweir 					Point	aStartPt;
1295*cdf0e10cSrcweir 					long	nWidth;
1296*cdf0e10cSrcweir 					sal_uInt32 nStrikeout;
1297*cdf0e10cSrcweir 					sal_uInt32 nUnderline;
1298*cdf0e10cSrcweir 					sal_Int32	nFollowingActionCount;
1299*cdf0e10cSrcweir 
1300*cdf0e10cSrcweir 					rIStm >> aStartPt >> nWidth >> nStrikeout >> nUnderline >> nFollowingActionCount;
1301*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1302*cdf0e10cSrcweir 					rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
1303*cdf0e10cSrcweir 															(FontStrikeout) nStrikeout,
1304*cdf0e10cSrcweir 															(FontUnderline) nUnderline,
1305*cdf0e10cSrcweir                                                             UNDERLINE_NONE ) );
1306*cdf0e10cSrcweir 
1307*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1308*cdf0e10cSrcweir 					i += nFollowingActionCount;
1309*cdf0e10cSrcweir #endif
1310*cdf0e10cSrcweir 				}
1311*cdf0e10cSrcweir 				break;
1312*cdf0e10cSrcweir 
1313*cdf0e10cSrcweir 				case( GDI_GRADIENTEX_COMMENT ):
1314*cdf0e10cSrcweir 				{
1315*cdf0e10cSrcweir 					PolyPolygon aPolyPoly;
1316*cdf0e10cSrcweir 					Gradient	aGradient;
1317*cdf0e10cSrcweir 					sal_Int32		nFollowingActionCount;
1318*cdf0e10cSrcweir 
1319*cdf0e10cSrcweir 					rIStm >> aPolyPoly >> aGradient >> nFollowingActionCount;
1320*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1321*cdf0e10cSrcweir 					rMtf.AddAction( new MetaGradientExAction( aPolyPoly, aGradient ) );
1322*cdf0e10cSrcweir 
1323*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1324*cdf0e10cSrcweir 					i += nFollowingActionCount;
1325*cdf0e10cSrcweir #endif
1326*cdf0e10cSrcweir 				}
1327*cdf0e10cSrcweir 				break;
1328*cdf0e10cSrcweir 
1329*cdf0e10cSrcweir 				case( GDI_COMMENT_COMMENT ):
1330*cdf0e10cSrcweir 				{
1331*cdf0e10cSrcweir 					ByteString	aComment;
1332*cdf0e10cSrcweir 					sal_Int32	nValue;
1333*cdf0e10cSrcweir 					sal_uInt32	nDataSize;
1334*cdf0e10cSrcweir 					sal_uInt8*		pData;
1335*cdf0e10cSrcweir 					sal_Int32		nFollowingActionCount;
1336*cdf0e10cSrcweir 
1337*cdf0e10cSrcweir 					rIStm >> aComment >> nValue >> nDataSize;
1338*cdf0e10cSrcweir 
1339*cdf0e10cSrcweir 					if( nDataSize )
1340*cdf0e10cSrcweir 					{
1341*cdf0e10cSrcweir 						pData = new sal_uInt8[ nDataSize ];
1342*cdf0e10cSrcweir 						rIStm.Read( pData, nDataSize );
1343*cdf0e10cSrcweir 					}
1344*cdf0e10cSrcweir 					else
1345*cdf0e10cSrcweir 						pData = NULL;
1346*cdf0e10cSrcweir 
1347*cdf0e10cSrcweir 					rIStm >> nFollowingActionCount;
1348*cdf0e10cSrcweir 					ImplSkipActions( rIStm, nFollowingActionCount );
1349*cdf0e10cSrcweir 					rMtf.AddAction( new MetaCommentAction( aComment, nValue, pData, nDataSize ) );
1350*cdf0e10cSrcweir 
1351*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
1352*cdf0e10cSrcweir 					i += nFollowingActionCount;
1353*cdf0e10cSrcweir #endif
1354*cdf0e10cSrcweir 				}
1355*cdf0e10cSrcweir 				break;
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir 				case ( GDI_UNICODE_COMMENT ):
1358*cdf0e10cSrcweir 				{
1359*cdf0e10cSrcweir 					nUnicodeCommentActionNumber = i + 1;
1360*cdf0e10cSrcweir 					nUnicodeCommentStreamPos = rIStm.Tell() - 6;
1361*cdf0e10cSrcweir 					rIStm.SeekRel( nActionSize - 4 );
1362*cdf0e10cSrcweir 				}
1363*cdf0e10cSrcweir 				break;
1364*cdf0e10cSrcweir 
1365*cdf0e10cSrcweir 				default:
1366*cdf0e10cSrcweir 					rIStm.SeekRel( nActionSize - 4L );
1367*cdf0e10cSrcweir 				break;
1368*cdf0e10cSrcweir 			}
1369*cdf0e10cSrcweir                 }
1370*cdf0e10cSrcweir 
1371*cdf0e10cSrcweir 		// cleanup push-pop stack if neccessary
1372*cdf0e10cSrcweir 		for( void* pLineInfo = aLIStack.Pop(); pLineInfo; pLineInfo = aLIStack.Pop() )
1373*cdf0e10cSrcweir 			delete (LineInfo*) pLineInfo;
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir 	rIStm.SetNumberFormatInt( nOldFormat );
1376*cdf0e10cSrcweir }
1377*cdf0e10cSrcweir 
1378*cdf0e10cSrcweir // ------------------------------------------------------------------------
1379*cdf0e10cSrcweir 
1380*cdf0e10cSrcweir void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
1381*cdf0e10cSrcweir {
1382*cdf0e10cSrcweir 	sal_uLong				nPos;
1383*cdf0e10cSrcweir 	sal_uLong				nCountPos;
1384*cdf0e10cSrcweir 	Font				aSaveFont;
1385*cdf0e10cSrcweir 	const sal_uInt16		nOldFormat = rOStm.GetNumberFormatInt();
1386*cdf0e10cSrcweir 	rtl_TextEncoding	eActualCharSet = gsl_getSystemTextEncoding();
1387*cdf0e10cSrcweir 	const Size			aPrefSize( rMtf.GetPrefSize() );
1388*cdf0e10cSrcweir 	sal_Bool				bRop_0_1 = sal_False;
1389*cdf0e10cSrcweir 	VirtualDevice		aSaveVDev;
1390*cdf0e10cSrcweir 	Color				aLineCol( COL_BLACK );
1391*cdf0e10cSrcweir 	Stack				aLineColStack;
1392*cdf0e10cSrcweir 
1393*cdf0e10cSrcweir 	rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir 	//MagicCode schreiben
1396*cdf0e10cSrcweir 	rOStm << "SVGDI";                                   // Kennung
1397*cdf0e10cSrcweir 	nPos = rOStm.Tell();
1398*cdf0e10cSrcweir 	rOStm << (sal_Int16) 42;								// HeaderSize
1399*cdf0e10cSrcweir 	rOStm << (sal_Int16) 200;								// VERSION
1400*cdf0e10cSrcweir 	rOStm << (sal_Int32) aPrefSize.Width();
1401*cdf0e10cSrcweir 	rOStm << (sal_Int32) aPrefSize.Height();
1402*cdf0e10cSrcweir 	ImplWriteMapMode( rOStm, rMtf.GetPrefMapMode() );
1403*cdf0e10cSrcweir 
1404*cdf0e10cSrcweir 	// ActionCount wird spaeter geschrieben
1405*cdf0e10cSrcweir 	nCountPos = rOStm.Tell();
1406*cdf0e10cSrcweir 	rOStm.SeekRel( 4L );
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir 	const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet );
1409*cdf0e10cSrcweir 	const sal_uLong nActPos = rOStm.Tell();
1410*cdf0e10cSrcweir 
1411*cdf0e10cSrcweir 	rOStm.Seek( nCountPos );
1412*cdf0e10cSrcweir 	rOStm << nActCount;
1413*cdf0e10cSrcweir 	rOStm.Seek( nActPos );
1414*cdf0e10cSrcweir 	rOStm.SetNumberFormatInt( nOldFormat );
1415*cdf0e10cSrcweir 
1416*cdf0e10cSrcweir 	// cleanup push-pop stack if neccessary
1417*cdf0e10cSrcweir 	for( void* pCol = aLineColStack.Pop(); pCol; pCol = aLineColStack.Pop() )
1418*cdf0e10cSrcweir 		delete (Color*) pCol;
1419*cdf0e10cSrcweir }
1420*cdf0e10cSrcweir 
1421*cdf0e10cSrcweir // ------------------------------------------------------------------------
1422*cdf0e10cSrcweir 
1423*cdf0e10cSrcweir sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
1424*cdf0e10cSrcweir 									  VirtualDevice& rSaveVDev, sal_Bool& rRop_0_1,
1425*cdf0e10cSrcweir 									  Color& rLineCol, Stack& rLineColStack,
1426*cdf0e10cSrcweir 									  rtl_TextEncoding& rActualCharSet )
1427*cdf0e10cSrcweir {
1428*cdf0e10cSrcweir 	sal_uLong nCount = 0;
1429*cdf0e10cSrcweir 	for( sal_uLong i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ )
1430*cdf0e10cSrcweir 	{
1431*cdf0e10cSrcweir 		const MetaAction* pAction = rMtf.GetAction( i );
1432*cdf0e10cSrcweir 
1433*cdf0e10cSrcweir 		switch( pAction->GetType() )
1434*cdf0e10cSrcweir 		{
1435*cdf0e10cSrcweir 			case( META_PIXEL_ACTION ):
1436*cdf0e10cSrcweir 			{
1437*cdf0e10cSrcweir 				MetaPixelAction* pAct = (MetaPixelAction*) pAction;
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_PIXEL_ACTION;
1440*cdf0e10cSrcweir 				rOStm << (sal_Int32) 18;
1441*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1442*cdf0e10cSrcweir 				ImplWriteColor( rOStm, pAct->GetColor() );
1443*cdf0e10cSrcweir 				nCount++;
1444*cdf0e10cSrcweir 			}
1445*cdf0e10cSrcweir 			break;
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir 			case( META_POINT_ACTION ):
1448*cdf0e10cSrcweir 			{
1449*cdf0e10cSrcweir 				MetaPointAction* pAct = (MetaPointAction*) pAction;
1450*cdf0e10cSrcweir 
1451*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_POINT_ACTION;
1452*cdf0e10cSrcweir 				rOStm << (sal_Int32) 12;
1453*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1454*cdf0e10cSrcweir 				nCount++;
1455*cdf0e10cSrcweir 			}
1456*cdf0e10cSrcweir 			break;
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir 			case( META_LINE_ACTION ):
1459*cdf0e10cSrcweir 			{
1460*cdf0e10cSrcweir 				MetaLineAction* pAct = (MetaLineAction*) pAction;
1461*cdf0e10cSrcweir 				const LineInfo& rInfo = pAct->GetLineInfo();
1462*cdf0e10cSrcweir 				const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
1463*cdf0e10cSrcweir 				const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
1464*cdf0e10cSrcweir 				const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
1465*cdf0e10cSrcweir 
1466*cdf0e10cSrcweir 				if( bFatLine )
1467*cdf0e10cSrcweir 				{
1468*cdf0e10cSrcweir 					ImplWritePushAction( rOStm );
1469*cdf0e10cSrcweir 					ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
1470*cdf0e10cSrcweir 
1471*cdf0e10cSrcweir 					if(bLineJoin)
1472*cdf0e10cSrcweir 					{
1473*cdf0e10cSrcweir 						rOStm << (sal_Int16) GDI_LINEJOIN_ACTION;
1474*cdf0e10cSrcweir 						rOStm << (sal_Int32) 6;
1475*cdf0e10cSrcweir 						rOStm << (sal_Int16) rInfo.GetLineJoin();
1476*cdf0e10cSrcweir 					}
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir 					if(bLineDashDot)
1479*cdf0e10cSrcweir 					{
1480*cdf0e10cSrcweir 						rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION;
1481*cdf0e10cSrcweir 						rOStm << (sal_Int32) 4 + 16;
1482*cdf0e10cSrcweir 						rOStm << (sal_Int16)rInfo.GetDashCount();
1483*cdf0e10cSrcweir 						rOStm << (sal_Int32)rInfo.GetDashLen();
1484*cdf0e10cSrcweir 						rOStm << (sal_Int16)rInfo.GetDotCount();
1485*cdf0e10cSrcweir 						rOStm << (sal_Int32)rInfo.GetDotLen();
1486*cdf0e10cSrcweir 						rOStm << (sal_Int32)rInfo.GetDistance();
1487*cdf0e10cSrcweir 					}
1488*cdf0e10cSrcweir 				}
1489*cdf0e10cSrcweir 
1490*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_LINE_ACTION;
1491*cdf0e10cSrcweir 				rOStm << (sal_Int32) 20;
1492*cdf0e10cSrcweir 				rOStm << pAct->GetStartPoint();
1493*cdf0e10cSrcweir 				rOStm << pAct->GetEndPoint();
1494*cdf0e10cSrcweir 				nCount++;
1495*cdf0e10cSrcweir 
1496*cdf0e10cSrcweir 				if( bFatLine )
1497*cdf0e10cSrcweir 				{
1498*cdf0e10cSrcweir 					ImplWritePopAction( rOStm );
1499*cdf0e10cSrcweir 					nCount += 3;
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir 					if(bLineJoin)
1502*cdf0e10cSrcweir 					{
1503*cdf0e10cSrcweir 						nCount += 1;
1504*cdf0e10cSrcweir 					}
1505*cdf0e10cSrcweir 
1506*cdf0e10cSrcweir 					if(bLineDashDot)
1507*cdf0e10cSrcweir 					{
1508*cdf0e10cSrcweir 						nCount += 1;
1509*cdf0e10cSrcweir 					}
1510*cdf0e10cSrcweir 				}
1511*cdf0e10cSrcweir 			}
1512*cdf0e10cSrcweir 			break;
1513*cdf0e10cSrcweir 
1514*cdf0e10cSrcweir 			case( META_RECT_ACTION ):
1515*cdf0e10cSrcweir 			{
1516*cdf0e10cSrcweir 				MetaRectAction* pAct = (MetaRectAction*) pAction;
1517*cdf0e10cSrcweir 
1518*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_RECT_ACTION;
1519*cdf0e10cSrcweir 				rOStm << (sal_Int32) 28;
1520*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1521*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0;
1522*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0;
1523*cdf0e10cSrcweir 				nCount++;
1524*cdf0e10cSrcweir 			}
1525*cdf0e10cSrcweir 			break;
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir 			case( META_ROUNDRECT_ACTION ):
1528*cdf0e10cSrcweir 			{
1529*cdf0e10cSrcweir 				MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction;
1530*cdf0e10cSrcweir 
1531*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_RECT_ACTION;
1532*cdf0e10cSrcweir 				rOStm << (sal_Int32) 28;
1533*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1534*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetHorzRound();
1535*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetVertRound();
1536*cdf0e10cSrcweir 				nCount++;
1537*cdf0e10cSrcweir 			}
1538*cdf0e10cSrcweir 			break;
1539*cdf0e10cSrcweir 
1540*cdf0e10cSrcweir 			case( META_ELLIPSE_ACTION ):
1541*cdf0e10cSrcweir 			{
1542*cdf0e10cSrcweir 				MetaEllipseAction* pAct = (MetaEllipseAction*) pAction;
1543*cdf0e10cSrcweir 
1544*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_ELLIPSE_ACTION;
1545*cdf0e10cSrcweir 				rOStm << (sal_Int32) 20;
1546*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1547*cdf0e10cSrcweir 				nCount++;
1548*cdf0e10cSrcweir 			}
1549*cdf0e10cSrcweir 			break;
1550*cdf0e10cSrcweir 
1551*cdf0e10cSrcweir 			case( META_ARC_ACTION ):
1552*cdf0e10cSrcweir 			{
1553*cdf0e10cSrcweir 				MetaArcAction* pAct = (MetaArcAction*) pAction;
1554*cdf0e10cSrcweir 
1555*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_ARC_ACTION;
1556*cdf0e10cSrcweir 				rOStm << (sal_Int32) 36;
1557*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1558*cdf0e10cSrcweir 				rOStm << pAct->GetStartPoint();
1559*cdf0e10cSrcweir 				rOStm << pAct->GetEndPoint();
1560*cdf0e10cSrcweir 				nCount++;
1561*cdf0e10cSrcweir 			}
1562*cdf0e10cSrcweir 			break;
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir 			case( META_PIE_ACTION ):
1565*cdf0e10cSrcweir 			{
1566*cdf0e10cSrcweir 				MetaPieAction* pAct = (MetaPieAction*) pAction;
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_PIE_ACTION;
1569*cdf0e10cSrcweir 				rOStm << (sal_Int32) 36;
1570*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1571*cdf0e10cSrcweir 				rOStm << pAct->GetStartPoint();
1572*cdf0e10cSrcweir 				rOStm << pAct->GetEndPoint();
1573*cdf0e10cSrcweir 				nCount++;
1574*cdf0e10cSrcweir 			}
1575*cdf0e10cSrcweir 			break;
1576*cdf0e10cSrcweir 
1577*cdf0e10cSrcweir 			case( META_CHORD_ACTION ):
1578*cdf0e10cSrcweir 			{
1579*cdf0e10cSrcweir 				MetaChordAction*	pAct = (MetaChordAction*) pAction;
1580*cdf0e10cSrcweir 				Polygon 			aChordPoly( pAct->GetRect(), pAct->GetStartPoint(),
1581*cdf0e10cSrcweir 												pAct->GetEndPoint(), POLY_CHORD );
1582*cdf0e10cSrcweir 				const sal_uInt16		nPoints = aChordPoly.GetSize();
1583*cdf0e10cSrcweir 
1584*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_POLYGON_ACTION;
1585*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
1586*cdf0e10cSrcweir 				rOStm << (sal_Int32) nPoints;
1587*cdf0e10cSrcweir 
1588*cdf0e10cSrcweir 				for( sal_uInt16 n = 0; n < nPoints; n++ )
1589*cdf0e10cSrcweir 					rOStm << aChordPoly[ n ];
1590*cdf0e10cSrcweir 				nCount++;
1591*cdf0e10cSrcweir 			}
1592*cdf0e10cSrcweir 			break;
1593*cdf0e10cSrcweir 
1594*cdf0e10cSrcweir 			case( META_POLYLINE_ACTION ):
1595*cdf0e10cSrcweir 			{
1596*cdf0e10cSrcweir                 // #i102224#
1597*cdf0e10cSrcweir 				MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction;
1598*cdf0e10cSrcweir                 // #i102224# Here the evtl. curved nature of Polygon was
1599*cdf0e10cSrcweir                 // ignored (for all those Years). Adapted to at least write
1600*cdf0e10cSrcweir                 // a polygon representing the curve as good as possible
1601*cdf0e10cSrcweir  	            Polygon aSimplePoly;
1602*cdf0e10cSrcweir  	            pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
1603*cdf0e10cSrcweir                 const LineInfo& rInfo = pAct->GetLineInfo();
1604*cdf0e10cSrcweir  				const sal_uInt16 nPoints(aSimplePoly.GetSize());
1605*cdf0e10cSrcweir 				const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
1606*cdf0e10cSrcweir 				const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
1607*cdf0e10cSrcweir 				const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir 				if( bFatLine )
1610*cdf0e10cSrcweir 				{
1611*cdf0e10cSrcweir 					ImplWritePushAction( rOStm );
1612*cdf0e10cSrcweir 					ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
1613*cdf0e10cSrcweir 
1614*cdf0e10cSrcweir 					if(bLineJoin)
1615*cdf0e10cSrcweir 					{
1616*cdf0e10cSrcweir 						rOStm << (sal_Int16) GDI_LINEJOIN_ACTION;
1617*cdf0e10cSrcweir 						rOStm << (sal_Int32) 6;
1618*cdf0e10cSrcweir 						rOStm << (sal_Int16) rInfo.GetLineJoin();
1619*cdf0e10cSrcweir 					}
1620*cdf0e10cSrcweir 				}
1621*cdf0e10cSrcweir 
1622*cdf0e10cSrcweir 				if(bLineDashDot)
1623*cdf0e10cSrcweir 				{
1624*cdf0e10cSrcweir 					rOStm << (sal_Int16) GDI_LINEDASHDOT_ACTION;
1625*cdf0e10cSrcweir 					rOStm << (sal_Int32) 4 + 16;
1626*cdf0e10cSrcweir 					rOStm << (sal_Int16)rInfo.GetDashCount();
1627*cdf0e10cSrcweir 					rOStm << (sal_Int32)rInfo.GetDashLen();
1628*cdf0e10cSrcweir 					rOStm << (sal_Int16)rInfo.GetDotCount();
1629*cdf0e10cSrcweir 					rOStm << (sal_Int32)rInfo.GetDotLen();
1630*cdf0e10cSrcweir 					rOStm << (sal_Int32)rInfo.GetDistance();
1631*cdf0e10cSrcweir 				}
1632*cdf0e10cSrcweir 
1633*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_POLYLINE_ACTION;
1634*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
1635*cdf0e10cSrcweir 				rOStm << (sal_Int32) nPoints;
1636*cdf0e10cSrcweir 
1637*cdf0e10cSrcweir 				for( sal_uInt16 n = 0; n < nPoints; n++ )
1638*cdf0e10cSrcweir 				{
1639*cdf0e10cSrcweir 					rOStm << aSimplePoly[ n ];
1640*cdf0e10cSrcweir 				}
1641*cdf0e10cSrcweir 
1642*cdf0e10cSrcweir 				nCount++;
1643*cdf0e10cSrcweir 
1644*cdf0e10cSrcweir 				const PolyPolygon aPolyPolygon(pAct->GetPolygon());
1645*cdf0e10cSrcweir 				if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
1646*cdf0e10cSrcweir 				{
1647*cdf0e10cSrcweir 					nCount++;
1648*cdf0e10cSrcweir 				}
1649*cdf0e10cSrcweir 
1650*cdf0e10cSrcweir 				if( bFatLine )
1651*cdf0e10cSrcweir 				{
1652*cdf0e10cSrcweir 					ImplWritePopAction( rOStm );
1653*cdf0e10cSrcweir 					nCount += 3;
1654*cdf0e10cSrcweir 
1655*cdf0e10cSrcweir 					if(bLineJoin)
1656*cdf0e10cSrcweir 					{
1657*cdf0e10cSrcweir 						nCount += 1;
1658*cdf0e10cSrcweir 					}
1659*cdf0e10cSrcweir 				}
1660*cdf0e10cSrcweir 
1661*cdf0e10cSrcweir 				if(bLineDashDot)
1662*cdf0e10cSrcweir 				{
1663*cdf0e10cSrcweir 					nCount += 1;
1664*cdf0e10cSrcweir 				}
1665*cdf0e10cSrcweir 			}
1666*cdf0e10cSrcweir 			break;
1667*cdf0e10cSrcweir 
1668*cdf0e10cSrcweir 			case( META_POLYGON_ACTION ):
1669*cdf0e10cSrcweir 			{
1670*cdf0e10cSrcweir 				MetaPolygonAction* pAct = (MetaPolygonAction*)pAction;
1671*cdf0e10cSrcweir                 // #i102224# Here the evtl. curved nature of Polygon was
1672*cdf0e10cSrcweir                 // ignored (for all those Years). Adapted to at least write
1673*cdf0e10cSrcweir                 // a polygon representing the curve as good as possible
1674*cdf0e10cSrcweir  	            Polygon aSimplePoly;
1675*cdf0e10cSrcweir  	            pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
1676*cdf0e10cSrcweir                 const sal_uInt16 nPoints(aSimplePoly.GetSize());
1677*cdf0e10cSrcweir 
1678*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_POLYGON_ACTION;
1679*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 8 + ( nPoints << 3 ) );
1680*cdf0e10cSrcweir 				rOStm << (sal_Int32) nPoints;
1681*cdf0e10cSrcweir 
1682*cdf0e10cSrcweir 				for( sal_uInt16 n = 0; n < nPoints; n++ )
1683*cdf0e10cSrcweir 					rOStm << aSimplePoly[ n ];
1684*cdf0e10cSrcweir 
1685*cdf0e10cSrcweir 				nCount++;
1686*cdf0e10cSrcweir 
1687*cdf0e10cSrcweir 				const PolyPolygon aPolyPolygon(pAct->GetPolygon());
1688*cdf0e10cSrcweir 				if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
1689*cdf0e10cSrcweir 				{
1690*cdf0e10cSrcweir 					nCount++;
1691*cdf0e10cSrcweir 				}
1692*cdf0e10cSrcweir 			}
1693*cdf0e10cSrcweir 			break;
1694*cdf0e10cSrcweir 
1695*cdf0e10cSrcweir 			case( META_POLYPOLYGON_ACTION ):
1696*cdf0e10cSrcweir 			{
1697*cdf0e10cSrcweir 				MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction;
1698*cdf0e10cSrcweir 				ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() );
1699*cdf0e10cSrcweir 				nCount++;
1700*cdf0e10cSrcweir 
1701*cdf0e10cSrcweir 				if(ImplWriteExtendedPolyPolygonAction(rOStm, pAct->GetPolyPolygon(), true))
1702*cdf0e10cSrcweir 				{
1703*cdf0e10cSrcweir 					nCount++;
1704*cdf0e10cSrcweir 				}
1705*cdf0e10cSrcweir 			}
1706*cdf0e10cSrcweir 			break;
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir 			case( META_TEXT_ACTION ):
1709*cdf0e10cSrcweir 			{
1710*cdf0e10cSrcweir 				MetaTextAction* pAct = (MetaTextAction*) pAction;
1711*cdf0e10cSrcweir 				String			aUniText( pAct->GetText() );
1712*cdf0e10cSrcweir 				ByteString		aText( aUniText, rActualCharSet );
1713*cdf0e10cSrcweir 				const sal_uLong 	nStrLen = aText.Len();
1714*cdf0e10cSrcweir 
1715*cdf0e10cSrcweir 				if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
1716*cdf0e10cSrcweir 					nCount++;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_TEXT_ACTION;
1719*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 24 + ( nStrLen + 1 ) );
1720*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1721*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetIndex();
1722*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetLen();
1723*cdf0e10cSrcweir 				rOStm << (sal_Int32) nStrLen;
1724*cdf0e10cSrcweir 				rOStm.Write( aText.GetBuffer(), nStrLen + 1 );
1725*cdf0e10cSrcweir 				nCount++;
1726*cdf0e10cSrcweir 			}
1727*cdf0e10cSrcweir 			break;
1728*cdf0e10cSrcweir 
1729*cdf0e10cSrcweir 			case( META_TEXTARRAY_ACTION ):
1730*cdf0e10cSrcweir 			{
1731*cdf0e10cSrcweir 				MetaTextArrayAction*	pAct = (MetaTextArrayAction*)pAction;
1732*cdf0e10cSrcweir 				ByteString				aText( pAct->GetText(), rActualCharSet );
1733*cdf0e10cSrcweir 				String					aUniText( pAct->GetText(), pAct->GetIndex(), pAct->GetLen() );
1734*cdf0e10cSrcweir 				sal_uLong					nAryLen;
1735*cdf0e10cSrcweir 				sal_uLong					nLen = pAct->GetLen();
1736*cdf0e10cSrcweir 				const sal_uLong 			nTextLen = aText.Len();
1737*cdf0e10cSrcweir 				sal_Int32*				pDXArray = pAct->GetDXArray();
1738*cdf0e10cSrcweir 
1739*cdf0e10cSrcweir 				if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
1740*cdf0e10cSrcweir 					nCount++;
1741*cdf0e10cSrcweir 
1742*cdf0e10cSrcweir 				if( ( nLen + pAct->GetIndex() ) > nTextLen )
1743*cdf0e10cSrcweir 				{
1744*cdf0e10cSrcweir 					if( pAct->GetIndex() <= nTextLen )
1745*cdf0e10cSrcweir 						nLen = nTextLen - pAct->GetIndex();
1746*cdf0e10cSrcweir 					else
1747*cdf0e10cSrcweir 						nLen = 0UL;
1748*cdf0e10cSrcweir 				}
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir 				if( !pDXArray || !nLen )
1751*cdf0e10cSrcweir 					nAryLen = 0;
1752*cdf0e10cSrcweir 				else
1753*cdf0e10cSrcweir 					nAryLen = nLen;	// #105987# Write out all of DX array
1754*cdf0e10cSrcweir 
1755*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_TEXTARRAY_ACTION;
1756*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) );
1757*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1758*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0;
1759*cdf0e10cSrcweir 				rOStm << (sal_Int32) nLen;
1760*cdf0e10cSrcweir 				rOStm << (sal_Int32) nLen;
1761*cdf0e10cSrcweir 				rOStm << (sal_Int32) nAryLen;
1762*cdf0e10cSrcweir 				rOStm.Write( aText.GetBuffer()+pAct->GetIndex(), nLen + 1 );
1763*cdf0e10cSrcweir 
1764*cdf0e10cSrcweir 				for( sal_uLong n = 0UL ; n < nAryLen; n++ )
1765*cdf0e10cSrcweir 					rOStm << (sal_Int32) pDXArray[ n ];
1766*cdf0e10cSrcweir 
1767*cdf0e10cSrcweir 				nCount++;
1768*cdf0e10cSrcweir 			}
1769*cdf0e10cSrcweir 			break;
1770*cdf0e10cSrcweir 
1771*cdf0e10cSrcweir 			case( META_STRETCHTEXT_ACTION ):
1772*cdf0e10cSrcweir 			{
1773*cdf0e10cSrcweir 				MetaStretchTextAction*	pAct = (MetaStretchTextAction*) pAction;
1774*cdf0e10cSrcweir 				String					aUniText( pAct->GetText() );
1775*cdf0e10cSrcweir 				ByteString				aText( aUniText, rActualCharSet );
1776*cdf0e10cSrcweir 				const sal_uLong 			nStrLen = aText.Len();
1777*cdf0e10cSrcweir 
1778*cdf0e10cSrcweir 				if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
1779*cdf0e10cSrcweir 					nCount++;
1780*cdf0e10cSrcweir 
1781*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_STRETCHTEXT_ACTION;
1782*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( 28 + ( nStrLen + 1 ) );
1783*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1784*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetIndex();
1785*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetLen();
1786*cdf0e10cSrcweir 				rOStm << (sal_Int32) nStrLen;
1787*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetWidth();
1788*cdf0e10cSrcweir 				rOStm.Write( aText.GetBuffer(), nStrLen + 1 );
1789*cdf0e10cSrcweir 				nCount++;
1790*cdf0e10cSrcweir 			}
1791*cdf0e10cSrcweir 			break;
1792*cdf0e10cSrcweir 
1793*cdf0e10cSrcweir 			case( META_BMP_ACTION ):
1794*cdf0e10cSrcweir 			{
1795*cdf0e10cSrcweir 				MetaBmpAction* pAct = (MetaBmpAction*) pAction;
1796*cdf0e10cSrcweir 
1797*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAP_ACTION;
1798*cdf0e10cSrcweir 				rOStm << (sal_Int32) 12;
1799*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1800*cdf0e10cSrcweir 				rOStm << pAct->GetBitmap();
1801*cdf0e10cSrcweir 				nCount++;
1802*cdf0e10cSrcweir 			}
1803*cdf0e10cSrcweir 			break;
1804*cdf0e10cSrcweir 
1805*cdf0e10cSrcweir 			case( META_BMPSCALE_ACTION ):
1806*cdf0e10cSrcweir 			{
1807*cdf0e10cSrcweir 				MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
1808*cdf0e10cSrcweir 
1809*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION;
1810*cdf0e10cSrcweir 				rOStm << (sal_Int32) 20;
1811*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1812*cdf0e10cSrcweir 				rOStm << pAct->GetSize();
1813*cdf0e10cSrcweir 				rOStm << pAct->GetBitmap();
1814*cdf0e10cSrcweir 				nCount++;
1815*cdf0e10cSrcweir 			}
1816*cdf0e10cSrcweir 			break;
1817*cdf0e10cSrcweir 
1818*cdf0e10cSrcweir 			case( META_BMPSCALEPART_ACTION ):
1819*cdf0e10cSrcweir 			{
1820*cdf0e10cSrcweir 				MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
1821*cdf0e10cSrcweir 
1822*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION;
1823*cdf0e10cSrcweir 				rOStm << (sal_Int32) 36;
1824*cdf0e10cSrcweir 				rOStm << pAct->GetDestPoint();
1825*cdf0e10cSrcweir 				rOStm << pAct->GetDestSize();
1826*cdf0e10cSrcweir 				rOStm << pAct->GetSrcPoint();
1827*cdf0e10cSrcweir 				rOStm << pAct->GetSrcSize();
1828*cdf0e10cSrcweir 				rOStm << pAct->GetBitmap();
1829*cdf0e10cSrcweir 				nCount++;
1830*cdf0e10cSrcweir 			}
1831*cdf0e10cSrcweir 			break;
1832*cdf0e10cSrcweir 
1833*cdf0e10cSrcweir 			case( META_BMPEX_ACTION ):
1834*cdf0e10cSrcweir 			{
1835*cdf0e10cSrcweir 				MetaBmpExAction*	pAct = (MetaBmpExAction*) pAction;
1836*cdf0e10cSrcweir 				const Bitmap		aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
1837*cdf0e10cSrcweir 
1838*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAP_ACTION;
1839*cdf0e10cSrcweir 				rOStm << (sal_Int32) 12;
1840*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1841*cdf0e10cSrcweir 				rOStm << aBmp;
1842*cdf0e10cSrcweir 				nCount++;
1843*cdf0e10cSrcweir 			}
1844*cdf0e10cSrcweir 			break;
1845*cdf0e10cSrcweir 
1846*cdf0e10cSrcweir 			case( META_BMPEXSCALE_ACTION ):
1847*cdf0e10cSrcweir 			{
1848*cdf0e10cSrcweir 				MetaBmpExScaleAction*	pAct = (MetaBmpExScaleAction*) pAction;
1849*cdf0e10cSrcweir 				const Bitmap			aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
1850*cdf0e10cSrcweir 
1851*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAPSCALE_ACTION;
1852*cdf0e10cSrcweir 				rOStm << (sal_Int32) 20;
1853*cdf0e10cSrcweir 				rOStm << pAct->GetPoint();
1854*cdf0e10cSrcweir 				rOStm << pAct->GetSize();
1855*cdf0e10cSrcweir 				rOStm << aBmp;
1856*cdf0e10cSrcweir 				nCount++;
1857*cdf0e10cSrcweir 			}
1858*cdf0e10cSrcweir 			break;
1859*cdf0e10cSrcweir 
1860*cdf0e10cSrcweir 			case( META_BMPEXSCALEPART_ACTION ):
1861*cdf0e10cSrcweir 			{
1862*cdf0e10cSrcweir 				MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
1863*cdf0e10cSrcweir 				const Bitmap			aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
1864*cdf0e10cSrcweir 
1865*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_BITMAPSCALEPART_ACTION;
1866*cdf0e10cSrcweir 				rOStm << (sal_Int32) 36;
1867*cdf0e10cSrcweir 				rOStm << pAct->GetDestPoint();
1868*cdf0e10cSrcweir 				rOStm << pAct->GetDestSize();
1869*cdf0e10cSrcweir 				rOStm << pAct->GetSrcPoint();
1870*cdf0e10cSrcweir 				rOStm << pAct->GetSrcSize();
1871*cdf0e10cSrcweir 				rOStm << aBmp;
1872*cdf0e10cSrcweir 				nCount++;
1873*cdf0e10cSrcweir 			}
1874*cdf0e10cSrcweir 			break;
1875*cdf0e10cSrcweir 
1876*cdf0e10cSrcweir 			case( META_GRADIENT_ACTION ):
1877*cdf0e10cSrcweir 			{
1878*cdf0e10cSrcweir 				MetaGradientAction* pAct = (MetaGradientAction*) pAction;
1879*cdf0e10cSrcweir 				const Gradient& 	rGrad = pAct->GetGradient();
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_GRADIENT_ACTION;
1882*cdf0e10cSrcweir 				rOStm << (sal_Int32) 46;
1883*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1884*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetStyle();
1885*cdf0e10cSrcweir 				ImplWriteColor( rOStm, rGrad.GetStartColor() );
1886*cdf0e10cSrcweir 				ImplWriteColor( rOStm, rGrad.GetEndColor() );
1887*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetAngle();
1888*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetBorder();
1889*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetOfsX();
1890*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetOfsY();
1891*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetStartIntensity();
1892*cdf0e10cSrcweir 				rOStm << (sal_Int16) rGrad.GetEndIntensity();
1893*cdf0e10cSrcweir 				nCount++;
1894*cdf0e10cSrcweir 			}
1895*cdf0e10cSrcweir 			break;
1896*cdf0e10cSrcweir 
1897*cdf0e10cSrcweir 			case( META_GRADIENTEX_ACTION ):
1898*cdf0e10cSrcweir 			{
1899*cdf0e10cSrcweir 				const MetaGradientExAction* pA = (MetaGradientExAction*) pAction;
1900*cdf0e10cSrcweir 				sal_uLong						nOldPos, nNewPos;
1901*cdf0e10cSrcweir 
1902*cdf0e10cSrcweir 				// write RefPoint comment
1903*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_GRADIENTEX_COMMENT;
1904*cdf0e10cSrcweir 
1905*cdf0e10cSrcweir 				// we'll write the ActionSize later
1906*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
1907*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
1908*cdf0e10cSrcweir 
1909*cdf0e10cSrcweir 				// write data
1910*cdf0e10cSrcweir 				rOStm << pA->GetPolyPolygon() << pA->GetGradient();
1911*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0; // number of actions that follow this comment
1912*cdf0e10cSrcweir 
1913*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
1914*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
1915*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
1916*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
1917*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
1918*cdf0e10cSrcweir 
1919*cdf0e10cSrcweir 				nCount++;
1920*cdf0e10cSrcweir 			}
1921*cdf0e10cSrcweir 			break;
1922*cdf0e10cSrcweir 
1923*cdf0e10cSrcweir 			case( META_WALLPAPER_ACTION ):
1924*cdf0e10cSrcweir 			{
1925*cdf0e10cSrcweir 				MetaWallpaperAction*	pAct = (MetaWallpaperAction*) pAction;
1926*cdf0e10cSrcweir 				const Color&			rColor = pAct->GetWallpaper().GetColor();
1927*cdf0e10cSrcweir 
1928*cdf0e10cSrcweir 				ImplWritePushAction( rOStm );
1929*cdf0e10cSrcweir 				ImplWriteLineColor( rOStm, rColor, 1 );
1930*cdf0e10cSrcweir 				ImplWriteFillColor( rOStm, rColor, 1 );
1931*cdf0e10cSrcweir 
1932*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_RECT_ACTION;
1933*cdf0e10cSrcweir 				rOStm << (sal_Int32) 28;
1934*cdf0e10cSrcweir 				ImplWriteRect( rOStm, pAct->GetRect() );
1935*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0;
1936*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0;
1937*cdf0e10cSrcweir 
1938*cdf0e10cSrcweir 				ImplWritePopAction( rOStm );
1939*cdf0e10cSrcweir 				nCount += 5;
1940*cdf0e10cSrcweir 			}
1941*cdf0e10cSrcweir 			break;
1942*cdf0e10cSrcweir 
1943*cdf0e10cSrcweir 			case( META_CLIPREGION_ACTION ):
1944*cdf0e10cSrcweir 			{
1945*cdf0e10cSrcweir 				MetaClipRegionAction*	pAct = (MetaClipRegionAction*) pAction;
1946*cdf0e10cSrcweir 				const Region&			rRegion = pAct->GetRegion();
1947*cdf0e10cSrcweir 				Rectangle				aClipRect;
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_CLIPREGION_ACTION;
1950*cdf0e10cSrcweir 				rOStm << (sal_Int32) 24;
1951*cdf0e10cSrcweir 
1952*cdf0e10cSrcweir 				if( pAct->IsClipping() )
1953*cdf0e10cSrcweir 				{
1954*cdf0e10cSrcweir 					aClipRect = rRegion.GetBoundRect();
1955*cdf0e10cSrcweir 					rOStm << (sal_Int16) 1;
1956*cdf0e10cSrcweir 				}
1957*cdf0e10cSrcweir 				else
1958*cdf0e10cSrcweir 					rOStm << (sal_Int16) 0;
1959*cdf0e10cSrcweir 
1960*cdf0e10cSrcweir 				rOStm << (sal_Int16) 0;
1961*cdf0e10cSrcweir 				ImplWriteRect( rOStm, aClipRect );
1962*cdf0e10cSrcweir 
1963*cdf0e10cSrcweir 				if( pAct->IsClipping() )
1964*cdf0e10cSrcweir 					ImplWriteRect( rOStm, aClipRect );
1965*cdf0e10cSrcweir 
1966*cdf0e10cSrcweir 				nCount++;
1967*cdf0e10cSrcweir 			}
1968*cdf0e10cSrcweir 			break;
1969*cdf0e10cSrcweir 
1970*cdf0e10cSrcweir 			case( META_ISECTRECTCLIPREGION_ACTION ):
1971*cdf0e10cSrcweir 			{
1972*cdf0e10cSrcweir 				MetaISectRectClipRegionAction* pAct = (MetaISectRectClipRegionAction*) pAction;
1973*cdf0e10cSrcweir 
1974*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_ISECTCLIPREGION_ACTION;
1975*cdf0e10cSrcweir 				rOStm << (sal_Int32) 20;
1976*cdf0e10cSrcweir 				rOStm << pAct->GetRect();
1977*cdf0e10cSrcweir 				nCount++;
1978*cdf0e10cSrcweir 			}
1979*cdf0e10cSrcweir 			break;
1980*cdf0e10cSrcweir 
1981*cdf0e10cSrcweir 			case( META_MOVECLIPREGION_ACTION ):
1982*cdf0e10cSrcweir 			{
1983*cdf0e10cSrcweir 				MetaMoveClipRegionAction* pAct = (MetaMoveClipRegionAction*) pAction;
1984*cdf0e10cSrcweir 
1985*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_MOVECLIPREGION_ACTION;
1986*cdf0e10cSrcweir 				rOStm << (sal_Int32) 12;
1987*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetHorzMove();
1988*cdf0e10cSrcweir 				rOStm << (sal_Int32) pAct->GetVertMove();
1989*cdf0e10cSrcweir 				nCount++;
1990*cdf0e10cSrcweir 			}
1991*cdf0e10cSrcweir 			break;
1992*cdf0e10cSrcweir 
1993*cdf0e10cSrcweir 			case( META_LINECOLOR_ACTION ):
1994*cdf0e10cSrcweir 			{
1995*cdf0e10cSrcweir 				MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
1996*cdf0e10cSrcweir 				ImplWriteLineColor( rOStm, rLineCol = pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
1997*cdf0e10cSrcweir 				nCount++;
1998*cdf0e10cSrcweir 			}
1999*cdf0e10cSrcweir 			break;
2000*cdf0e10cSrcweir 
2001*cdf0e10cSrcweir 			case( META_FILLCOLOR_ACTION ):
2002*cdf0e10cSrcweir 			{
2003*cdf0e10cSrcweir 				MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
2004*cdf0e10cSrcweir 				ImplWriteFillColor( rOStm, pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
2005*cdf0e10cSrcweir 				nCount++;
2006*cdf0e10cSrcweir 			}
2007*cdf0e10cSrcweir 			break;
2008*cdf0e10cSrcweir 
2009*cdf0e10cSrcweir 			case( META_FONT_ACTION ):
2010*cdf0e10cSrcweir 			{
2011*cdf0e10cSrcweir 				rSaveVDev.SetFont( ( (MetaFontAction*) pAction )->GetFont() );
2012*cdf0e10cSrcweir 				ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
2013*cdf0e10cSrcweir 				nCount++;
2014*cdf0e10cSrcweir 			}
2015*cdf0e10cSrcweir 			break;
2016*cdf0e10cSrcweir 
2017*cdf0e10cSrcweir 			case( META_TEXTCOLOR_ACTION ):
2018*cdf0e10cSrcweir 			{
2019*cdf0e10cSrcweir 				Font aSaveFont( rSaveVDev.GetFont() );
2020*cdf0e10cSrcweir 
2021*cdf0e10cSrcweir 				aSaveFont.SetColor( ( (MetaTextColorAction*) pAction )->GetColor() );
2022*cdf0e10cSrcweir 				rSaveVDev.SetFont( aSaveFont );
2023*cdf0e10cSrcweir 				ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
2024*cdf0e10cSrcweir 				nCount++;
2025*cdf0e10cSrcweir 			}
2026*cdf0e10cSrcweir 			break;
2027*cdf0e10cSrcweir 
2028*cdf0e10cSrcweir 			case( META_TEXTFILLCOLOR_ACTION ):
2029*cdf0e10cSrcweir 			{
2030*cdf0e10cSrcweir 				MetaTextFillColorAction*	pAct = (MetaTextFillColorAction*) pAction;
2031*cdf0e10cSrcweir 				Font						aSaveFont( rSaveVDev.GetFont() );
2032*cdf0e10cSrcweir 
2033*cdf0e10cSrcweir 				if( pAct->IsSetting() )
2034*cdf0e10cSrcweir 					aSaveFont.SetFillColor( pAct->GetColor() );
2035*cdf0e10cSrcweir 				else
2036*cdf0e10cSrcweir 					aSaveFont.SetFillColor( Color( COL_TRANSPARENT ) );
2037*cdf0e10cSrcweir 
2038*cdf0e10cSrcweir 				rSaveVDev.SetFont( aSaveFont );
2039*cdf0e10cSrcweir 				ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
2040*cdf0e10cSrcweir 				nCount++;
2041*cdf0e10cSrcweir 			}
2042*cdf0e10cSrcweir 			break;
2043*cdf0e10cSrcweir 
2044*cdf0e10cSrcweir 			case( META_TEXTALIGN_ACTION ):
2045*cdf0e10cSrcweir 			{
2046*cdf0e10cSrcweir 				Font aSaveFont( rSaveVDev.GetFont() );
2047*cdf0e10cSrcweir 
2048*cdf0e10cSrcweir 				aSaveFont.SetAlign( ( (MetaTextAlignAction*) pAction )->GetTextAlign() );
2049*cdf0e10cSrcweir 				rSaveVDev.SetFont( aSaveFont );
2050*cdf0e10cSrcweir 				ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
2051*cdf0e10cSrcweir 				nCount++;
2052*cdf0e10cSrcweir 			}
2053*cdf0e10cSrcweir 			break;
2054*cdf0e10cSrcweir 
2055*cdf0e10cSrcweir 			case( META_MAPMODE_ACTION ):
2056*cdf0e10cSrcweir 			{
2057*cdf0e10cSrcweir 				MetaMapModeAction* pAct = (MetaMapModeAction*) pAction;
2058*cdf0e10cSrcweir 
2059*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_MAPMODE_ACTION;
2060*cdf0e10cSrcweir 				rOStm << (sal_Int32) 30;
2061*cdf0e10cSrcweir 				ImplWriteMapMode( rOStm, pAct->GetMapMode() );
2062*cdf0e10cSrcweir 				nCount++;
2063*cdf0e10cSrcweir 			}
2064*cdf0e10cSrcweir 			break;
2065*cdf0e10cSrcweir 
2066*cdf0e10cSrcweir 			case( META_PUSH_ACTION ):
2067*cdf0e10cSrcweir 			{
2068*cdf0e10cSrcweir 				ImplWritePushAction( rOStm );
2069*cdf0e10cSrcweir 				rLineColStack.Push( new Color( rLineCol ) );
2070*cdf0e10cSrcweir 				rSaveVDev.Push();
2071*cdf0e10cSrcweir 				nCount++;
2072*cdf0e10cSrcweir 			}
2073*cdf0e10cSrcweir 			break;
2074*cdf0e10cSrcweir 
2075*cdf0e10cSrcweir 			case( META_POP_ACTION ):
2076*cdf0e10cSrcweir 			{
2077*cdf0e10cSrcweir 				Color* pCol = (Color*) rLineColStack.Pop();
2078*cdf0e10cSrcweir 
2079*cdf0e10cSrcweir 				if( pCol )
2080*cdf0e10cSrcweir 				{
2081*cdf0e10cSrcweir 					rLineCol = *pCol;
2082*cdf0e10cSrcweir 					delete pCol;
2083*cdf0e10cSrcweir 				}
2084*cdf0e10cSrcweir 
2085*cdf0e10cSrcweir 				ImplWritePopAction( rOStm );
2086*cdf0e10cSrcweir 				rSaveVDev.Pop();
2087*cdf0e10cSrcweir 				nCount++;
2088*cdf0e10cSrcweir 			}
2089*cdf0e10cSrcweir 			break;
2090*cdf0e10cSrcweir 
2091*cdf0e10cSrcweir 			case( META_RASTEROP_ACTION ):
2092*cdf0e10cSrcweir 			{
2093*cdf0e10cSrcweir 				MetaRasterOpAction* pAct = (MetaRasterOpAction*) pAction;
2094*cdf0e10cSrcweir 
2095*cdf0e10cSrcweir 				if( ( pAct->GetRasterOp() != ROP_0 ) && ( pAct->GetRasterOp() != ROP_1 ) )
2096*cdf0e10cSrcweir 				{
2097*cdf0e10cSrcweir 					sal_Int16 nRasterOp;
2098*cdf0e10cSrcweir 
2099*cdf0e10cSrcweir 					// Falls vorher ROP_0/1 gesetzt war, alten
2100*cdf0e10cSrcweir 					// Zustand durch Pop erst wieder herstellen
2101*cdf0e10cSrcweir 					if( rRop_0_1 )
2102*cdf0e10cSrcweir 					{
2103*cdf0e10cSrcweir 						ImplWritePopAction( rOStm );
2104*cdf0e10cSrcweir 						rSaveVDev.Pop();
2105*cdf0e10cSrcweir 						rRop_0_1 = sal_False;
2106*cdf0e10cSrcweir 						nCount++;
2107*cdf0e10cSrcweir 					}
2108*cdf0e10cSrcweir 
2109*cdf0e10cSrcweir 					switch( pAct->GetRasterOp() )
2110*cdf0e10cSrcweir 					{
2111*cdf0e10cSrcweir 						case( ROP_OVERPAINT ) : nRasterOp = 0; break;
2112*cdf0e10cSrcweir 						case( ROP_XOR ) :		nRasterOp = 4; break;
2113*cdf0e10cSrcweir 						case( ROP_INVERT ): 	nRasterOp = 1; break;
2114*cdf0e10cSrcweir 						default:				nRasterOp = 0; break;
2115*cdf0e10cSrcweir 					}
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir 					ImplWriteRasterOpAction( rOStm, nRasterOp );
2118*cdf0e10cSrcweir 					nCount++;
2119*cdf0e10cSrcweir 				}
2120*cdf0e10cSrcweir 				else
2121*cdf0e10cSrcweir 				{
2122*cdf0e10cSrcweir 					ImplWritePushAction( rOStm );
2123*cdf0e10cSrcweir 					rSaveVDev.Push();
2124*cdf0e10cSrcweir 
2125*cdf0e10cSrcweir 					if( pAct->GetRasterOp() == ROP_0 )
2126*cdf0e10cSrcweir 					{
2127*cdf0e10cSrcweir 						ImplWriteLineColor( rOStm, COL_BLACK, 1 );
2128*cdf0e10cSrcweir 						ImplWriteFillColor( rOStm, COL_BLACK, 1 );
2129*cdf0e10cSrcweir 					}
2130*cdf0e10cSrcweir 					else
2131*cdf0e10cSrcweir 					{
2132*cdf0e10cSrcweir 						ImplWriteLineColor( rOStm, COL_WHITE, 1 );
2133*cdf0e10cSrcweir 						ImplWriteFillColor( rOStm, COL_WHITE, 1 );
2134*cdf0e10cSrcweir 					}
2135*cdf0e10cSrcweir 
2136*cdf0e10cSrcweir 					ImplWriteRasterOpAction( rOStm, 0 );
2137*cdf0e10cSrcweir 					rRop_0_1 = sal_True;
2138*cdf0e10cSrcweir 					nCount += 4;
2139*cdf0e10cSrcweir 				}
2140*cdf0e10cSrcweir 			}
2141*cdf0e10cSrcweir 			break;
2142*cdf0e10cSrcweir 
2143*cdf0e10cSrcweir 			case( META_TRANSPARENT_ACTION ):
2144*cdf0e10cSrcweir 			{
2145*cdf0e10cSrcweir 				const PolyPolygon&	rPolyPoly = ( (MetaTransparentAction*) pAction )->GetPolyPolygon();
2146*cdf0e10cSrcweir 				const sal_Int16 		nTrans = ( (MetaTransparentAction*) pAction )->GetTransparence();
2147*cdf0e10cSrcweir 				const sal_Int16 		nBrushStyle = ( nTrans < 38 ) ? 8 : ( nTrans < 63 ) ? 9 : 10;
2148*cdf0e10cSrcweir 				sal_uLong				nOldPos, nNewPos;
2149*cdf0e10cSrcweir 
2150*cdf0e10cSrcweir 				// write transparence comment
2151*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_TRANSPARENT_COMMENT;
2152*cdf0e10cSrcweir 
2153*cdf0e10cSrcweir 				// we'll write the ActionSize later
2154*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2155*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2156*cdf0e10cSrcweir 
2157*cdf0e10cSrcweir 				// write comment data
2158*cdf0e10cSrcweir 				rOStm << rPolyPoly;
2159*cdf0e10cSrcweir 				rOStm << nTrans;
2160*cdf0e10cSrcweir 				rOStm << (sal_Int32) 15; // number of actions that follow this comment
2161*cdf0e10cSrcweir 
2162*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2163*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2164*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2165*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
2166*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
2167*cdf0e10cSrcweir 
2168*cdf0e10cSrcweir 				{
2169*cdf0e10cSrcweir 					// write actions for transparence
2170*cdf0e10cSrcweir 					ImplWritePushAction( rOStm );
2171*cdf0e10cSrcweir 					{
2172*cdf0e10cSrcweir 						ImplWriteRasterOpAction( rOStm, 4 );
2173*cdf0e10cSrcweir 						ImplWritePolyPolyAction( rOStm, rPolyPoly );
2174*cdf0e10cSrcweir 
2175*cdf0e10cSrcweir 						ImplWritePushAction( rOStm );
2176*cdf0e10cSrcweir 						{
2177*cdf0e10cSrcweir 							ImplWriteRasterOpAction( rOStm, 2 );
2178*cdf0e10cSrcweir 							ImplWriteFillColor( rOStm, COL_BLACK, nBrushStyle );
2179*cdf0e10cSrcweir 							ImplWritePolyPolyAction( rOStm, rPolyPoly );
2180*cdf0e10cSrcweir 						}
2181*cdf0e10cSrcweir 						ImplWritePopAction( rOStm );
2182*cdf0e10cSrcweir 
2183*cdf0e10cSrcweir 						ImplWriteRasterOpAction( rOStm, 4 );
2184*cdf0e10cSrcweir 						ImplWritePolyPolyAction( rOStm, rPolyPoly );
2185*cdf0e10cSrcweir 					}
2186*cdf0e10cSrcweir 					ImplWritePopAction( rOStm );
2187*cdf0e10cSrcweir 
2188*cdf0e10cSrcweir 					ImplWritePushAction( rOStm );
2189*cdf0e10cSrcweir 					{
2190*cdf0e10cSrcweir 						ImplWriteFillColor( rOStm, Color(), 0 );
2191*cdf0e10cSrcweir 						ImplWritePolyPolyAction( rOStm, rPolyPoly );
2192*cdf0e10cSrcweir 					}
2193*cdf0e10cSrcweir 					ImplWritePopAction( rOStm );
2194*cdf0e10cSrcweir 
2195*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
2196*cdf0e10cSrcweir 					nCount += 15;
2197*cdf0e10cSrcweir #endif
2198*cdf0e10cSrcweir 				}
2199*cdf0e10cSrcweir 
2200*cdf0e10cSrcweir 				nCount++;
2201*cdf0e10cSrcweir 			}
2202*cdf0e10cSrcweir 			break;
2203*cdf0e10cSrcweir 
2204*cdf0e10cSrcweir 			case( META_FLOATTRANSPARENT_ACTION ):
2205*cdf0e10cSrcweir 			{
2206*cdf0e10cSrcweir 				const MetaFloatTransparentAction*	pA = (MetaFloatTransparentAction*) pAction;
2207*cdf0e10cSrcweir 				const GDIMetaFile&					rTransMtf = pA->GetGDIMetaFile();
2208*cdf0e10cSrcweir 				const Point&						rPos = pA->GetPoint();
2209*cdf0e10cSrcweir 				const Size& 						rSize = pA->GetSize();
2210*cdf0e10cSrcweir 				const Gradient& 					rGradient = pA->GetGradient();
2211*cdf0e10cSrcweir 				sal_uLong								nOldPos, nNewPos;
2212*cdf0e10cSrcweir 
2213*cdf0e10cSrcweir 				// write RefPoint comment
2214*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_FLOATTRANSPARENT_COMMENT;
2215*cdf0e10cSrcweir 
2216*cdf0e10cSrcweir 				// we'll write the ActionSize later
2217*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2218*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2219*cdf0e10cSrcweir 
2220*cdf0e10cSrcweir 				// write comment data
2221*cdf0e10cSrcweir 				rOStm << rTransMtf << rPos << rSize << rGradient;
2222*cdf0e10cSrcweir 
2223*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2224*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2225*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2226*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 );
2227*cdf0e10cSrcweir 				rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
2228*cdf0e10cSrcweir 
2229*cdf0e10cSrcweir 				{
2230*cdf0e10cSrcweir 					// write actions for float transparence
2231*cdf0e10cSrcweir 					sal_uLong			nAddCount;
2232*cdf0e10cSrcweir 					GDIMetaFile 	aMtf( rTransMtf );
2233*cdf0e10cSrcweir 					const Size		aSrcSize( rTransMtf.GetPrefSize() );
2234*cdf0e10cSrcweir 					Point			aSrcPt( rTransMtf.GetPrefMapMode().GetOrigin() );
2235*cdf0e10cSrcweir 					const double	fScaleX = aSrcSize.Width() ? (double) rSize.Width() / aSrcSize.Width() : 1.0;
2236*cdf0e10cSrcweir 					const double	fScaleY = aSrcSize.Height() ? (double) rSize.Height() / aSrcSize.Height() : 1.0;
2237*cdf0e10cSrcweir 					long			nMoveX, nMoveY;
2238*cdf0e10cSrcweir 
2239*cdf0e10cSrcweir 					if( fScaleX != 1.0 || fScaleY != 1.0 )
2240*cdf0e10cSrcweir 					{
2241*cdf0e10cSrcweir 						aMtf.Scale( fScaleX, fScaleY );
2242*cdf0e10cSrcweir 						aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
2243*cdf0e10cSrcweir 					}
2244*cdf0e10cSrcweir 
2245*cdf0e10cSrcweir 					nMoveX = rPos.X() - aSrcPt.X(), nMoveY = rPos.Y() - aSrcPt.Y();
2246*cdf0e10cSrcweir 
2247*cdf0e10cSrcweir 					if( nMoveX || nMoveY )
2248*cdf0e10cSrcweir 						aMtf.Move( nMoveX, nMoveY );
2249*cdf0e10cSrcweir 
2250*cdf0e10cSrcweir 					nAddCount = ImplWriteActions( rOStm, aMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
2251*cdf0e10cSrcweir 					nNewPos = rOStm.Tell();
2252*cdf0e10cSrcweir 					rOStm.Seek( nOldPos );
2253*cdf0e10cSrcweir 					rOStm << (sal_Int32) nAddCount;
2254*cdf0e10cSrcweir 					rOStm.Seek( nNewPos );
2255*cdf0e10cSrcweir 
2256*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
2257*cdf0e10cSrcweir 					nCount += nAddCount;
2258*cdf0e10cSrcweir #endif
2259*cdf0e10cSrcweir 				}
2260*cdf0e10cSrcweir 
2261*cdf0e10cSrcweir 				nCount++;
2262*cdf0e10cSrcweir 			}
2263*cdf0e10cSrcweir 			break;
2264*cdf0e10cSrcweir 
2265*cdf0e10cSrcweir 			case( META_HATCH_ACTION ):
2266*cdf0e10cSrcweir 			{
2267*cdf0e10cSrcweir 				const MetaHatchAction*	pA = (MetaHatchAction*) pAction;
2268*cdf0e10cSrcweir 				const PolyPolygon&		rPolyPoly = pA->GetPolyPolygon();
2269*cdf0e10cSrcweir 				const Hatch&			rHatch = pA->GetHatch();
2270*cdf0e10cSrcweir 				sal_uLong					nOldPos, nNewPos, nAddCount;
2271*cdf0e10cSrcweir 
2272*cdf0e10cSrcweir 				// write hatch comment
2273*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_HATCH_COMMENT;
2274*cdf0e10cSrcweir 
2275*cdf0e10cSrcweir 				// we'll write the ActionSize later
2276*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2277*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2278*cdf0e10cSrcweir 
2279*cdf0e10cSrcweir 				// write comment data
2280*cdf0e10cSrcweir 				rOStm << rPolyPoly;
2281*cdf0e10cSrcweir 				rOStm << rHatch;
2282*cdf0e10cSrcweir 
2283*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2284*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2285*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2286*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos + 4 );
2287*cdf0e10cSrcweir 				rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
2288*cdf0e10cSrcweir 
2289*cdf0e10cSrcweir 				{
2290*cdf0e10cSrcweir 					// write actions for hatch
2291*cdf0e10cSrcweir 					VirtualDevice	aVDev;
2292*cdf0e10cSrcweir 					GDIMetaFile 	aTmpMtf;
2293*cdf0e10cSrcweir 
2294*cdf0e10cSrcweir 					aVDev.AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
2295*cdf0e10cSrcweir 					nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
2296*cdf0e10cSrcweir 					nNewPos = rOStm.Tell();
2297*cdf0e10cSrcweir 					rOStm.Seek( nOldPos );
2298*cdf0e10cSrcweir 					rOStm << (sal_Int32) nAddCount;
2299*cdf0e10cSrcweir 					rOStm.Seek( nNewPos );
2300*cdf0e10cSrcweir 
2301*cdf0e10cSrcweir #ifdef CVTSVM_WRITE_SUBACTIONCOUNT
2302*cdf0e10cSrcweir 					nCount += nAddCount;
2303*cdf0e10cSrcweir #endif
2304*cdf0e10cSrcweir 				}
2305*cdf0e10cSrcweir 
2306*cdf0e10cSrcweir 				nCount++;
2307*cdf0e10cSrcweir 			}
2308*cdf0e10cSrcweir 			break;
2309*cdf0e10cSrcweir 
2310*cdf0e10cSrcweir 			case( META_REFPOINT_ACTION ):
2311*cdf0e10cSrcweir 			{
2312*cdf0e10cSrcweir 				const MetaRefPointAction*	pA = (MetaRefPointAction*) pAction;
2313*cdf0e10cSrcweir 				const Point&				rRefPoint = pA->GetRefPoint();
2314*cdf0e10cSrcweir 				const sal_Bool					bSet = pA->IsSetting();
2315*cdf0e10cSrcweir 				sal_uLong						nOldPos, nNewPos;
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir 				// write RefPoint comment
2318*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_REFPOINT_COMMENT;
2319*cdf0e10cSrcweir 
2320*cdf0e10cSrcweir 				// we'll write the ActionSize later
2321*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2322*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2323*cdf0e10cSrcweir 
2324*cdf0e10cSrcweir 				// write data
2325*cdf0e10cSrcweir 				rOStm << rRefPoint << bSet;
2326*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0; // number of actions that follow this comment
2327*cdf0e10cSrcweir 
2328*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2329*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2330*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2331*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
2332*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
2333*cdf0e10cSrcweir 
2334*cdf0e10cSrcweir 				nCount++;
2335*cdf0e10cSrcweir 			}
2336*cdf0e10cSrcweir 			break;
2337*cdf0e10cSrcweir 
2338*cdf0e10cSrcweir 			case( META_TEXTLINECOLOR_ACTION ):
2339*cdf0e10cSrcweir 			{
2340*cdf0e10cSrcweir 				const MetaTextLineColorAction*	pA = (MetaTextLineColorAction*) pAction;
2341*cdf0e10cSrcweir 				const Color&					rColor = pA->GetColor();
2342*cdf0e10cSrcweir 				const sal_Bool						bSet = pA->IsSetting();
2343*cdf0e10cSrcweir 				sal_uLong							nOldPos, nNewPos;
2344*cdf0e10cSrcweir 
2345*cdf0e10cSrcweir 				// write RefPoint comment
2346*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_TEXTLINECOLOR_COMMENT;
2347*cdf0e10cSrcweir 
2348*cdf0e10cSrcweir 				// we'll write the ActionSize later
2349*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2350*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2351*cdf0e10cSrcweir 
2352*cdf0e10cSrcweir 				// write data
2353*cdf0e10cSrcweir 				rOStm << rColor << bSet;
2354*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0; // number of actions that follow this comment
2355*cdf0e10cSrcweir 
2356*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2357*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2358*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2359*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
2360*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
2361*cdf0e10cSrcweir 
2362*cdf0e10cSrcweir 				nCount++;
2363*cdf0e10cSrcweir 			}
2364*cdf0e10cSrcweir 			break;
2365*cdf0e10cSrcweir 
2366*cdf0e10cSrcweir #if 0
2367*cdf0e10cSrcweir 			case( META_OVERLINECOLOR_ACTION ):
2368*cdf0e10cSrcweir 			break;
2369*cdf0e10cSrcweir #endif
2370*cdf0e10cSrcweir 
2371*cdf0e10cSrcweir 			case( META_TEXTLINE_ACTION ):
2372*cdf0e10cSrcweir 			{
2373*cdf0e10cSrcweir 				const MetaTextLineAction*	pA = (MetaTextLineAction*) pAction;
2374*cdf0e10cSrcweir 				const Point&				rStartPt = pA->GetStartPoint();
2375*cdf0e10cSrcweir 				const long					nWidth = pA->GetWidth();
2376*cdf0e10cSrcweir 				const FontStrikeout 		eStrikeout = pA->GetStrikeout();
2377*cdf0e10cSrcweir 				const FontUnderline 		eUnderline = pA->GetUnderline();
2378*cdf0e10cSrcweir 				sal_uLong						nOldPos, nNewPos;
2379*cdf0e10cSrcweir 
2380*cdf0e10cSrcweir 				// write RefPoint comment
2381*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_TEXTLINE_COMMENT;
2382*cdf0e10cSrcweir 
2383*cdf0e10cSrcweir 				// we'll write the ActionSize later
2384*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2385*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2386*cdf0e10cSrcweir 
2387*cdf0e10cSrcweir 				// write data
2388*cdf0e10cSrcweir 				rOStm << rStartPt << nWidth <<
2389*cdf0e10cSrcweir 					static_cast<sal_uInt32>(eStrikeout) <<
2390*cdf0e10cSrcweir 					static_cast<sal_uInt32>(eUnderline);
2391*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0; // number of actions that follow this comment
2392*cdf0e10cSrcweir 
2393*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2394*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2395*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2396*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
2397*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
2398*cdf0e10cSrcweir 
2399*cdf0e10cSrcweir 				nCount++;
2400*cdf0e10cSrcweir 			}
2401*cdf0e10cSrcweir 			break;
2402*cdf0e10cSrcweir 
2403*cdf0e10cSrcweir 			case( META_EPS_ACTION ):
2404*cdf0e10cSrcweir 			break;
2405*cdf0e10cSrcweir 
2406*cdf0e10cSrcweir 			case( META_COMMENT_ACTION ):
2407*cdf0e10cSrcweir 			{
2408*cdf0e10cSrcweir 				const MetaCommentAction*	pA = (MetaCommentAction*) pAction;
2409*cdf0e10cSrcweir 				const sal_uInt32 			nDataSize = pA->GetDataSize();
2410*cdf0e10cSrcweir 				sal_uLong						nOldPos, nNewPos;
2411*cdf0e10cSrcweir 
2412*cdf0e10cSrcweir 				// write RefPoint comment
2413*cdf0e10cSrcweir 				rOStm << (sal_Int16) GDI_COMMENT_COMMENT;
2414*cdf0e10cSrcweir 
2415*cdf0e10cSrcweir 				// we'll write the ActionSize later
2416*cdf0e10cSrcweir 				nOldPos = rOStm.Tell();
2417*cdf0e10cSrcweir 				rOStm.SeekRel( 4 );
2418*cdf0e10cSrcweir 
2419*cdf0e10cSrcweir 				// write data
2420*cdf0e10cSrcweir 				rOStm << pA->GetComment() << pA->GetValue() << nDataSize;
2421*cdf0e10cSrcweir 
2422*cdf0e10cSrcweir 				if( nDataSize )
2423*cdf0e10cSrcweir 					rOStm.Write( pA->GetData(), nDataSize );
2424*cdf0e10cSrcweir 
2425*cdf0e10cSrcweir 				rOStm << (sal_Int32) 0; // number of actions that follow this comment
2426*cdf0e10cSrcweir 
2427*cdf0e10cSrcweir 				// calculate and write ActionSize of comment
2428*cdf0e10cSrcweir 				nNewPos = rOStm.Tell();
2429*cdf0e10cSrcweir 				rOStm.Seek( nOldPos );
2430*cdf0e10cSrcweir 				rOStm << (sal_Int32) ( nNewPos - nOldPos );
2431*cdf0e10cSrcweir 				rOStm.Seek( nNewPos );
2432*cdf0e10cSrcweir 
2433*cdf0e10cSrcweir 				nCount++;
2434*cdf0e10cSrcweir 			}
2435*cdf0e10cSrcweir 			break;
2436*cdf0e10cSrcweir 
2437*cdf0e10cSrcweir #ifdef DBG_UTIL
2438*cdf0e10cSrcweir 			default:
2439*cdf0e10cSrcweir 			{
2440*cdf0e10cSrcweir 				ByteString aStr( "Missing implementation for Action#: " );
2441*cdf0e10cSrcweir 				aStr += ByteString::CreateFromInt32( pAction->GetType() );
2442*cdf0e10cSrcweir 				aStr += '!';
2443*cdf0e10cSrcweir 				DBG_ERROR( aStr.GetBuffer() );
2444*cdf0e10cSrcweir 			}
2445*cdf0e10cSrcweir 			break;
2446*cdf0e10cSrcweir #endif
2447*cdf0e10cSrcweir 
2448*cdf0e10cSrcweir /*
2449*cdf0e10cSrcweir 			case( META_TEXTRECT_ACTION ):
2450*cdf0e10cSrcweir 			{
2451*cdf0e10cSrcweir 				MetaTextRectAction* pAct = (MetaTextRectAction*) pAction;
2452*cdf0e10cSrcweir 
2453*cdf0e10cSrcweir 				rOStm << ;
2454*cdf0e10cSrcweir 				rOStm << ;
2455*cdf0e10cSrcweir 
2456*cdf0e10cSrcweir 				nCount++;
2457*cdf0e10cSrcweir 			}
2458*cdf0e10cSrcweir 			break;
2459*cdf0e10cSrcweir */
2460*cdf0e10cSrcweir 
2461*cdf0e10cSrcweir /*
2462*cdf0e10cSrcweir 			case( META_MASK_ACTION ):
2463*cdf0e10cSrcweir 			{
2464*cdf0e10cSrcweir 				MetaMaskAction* pAct = (MetaMaskAction*) pAction;
2465*cdf0e10cSrcweir 
2466*cdf0e10cSrcweir 				rOStm << ;
2467*cdf0e10cSrcweir 				rOStm << ;
2468*cdf0e10cSrcweir 
2469*cdf0e10cSrcweir 				nCount++;
2470*cdf0e10cSrcweir 			}
2471*cdf0e10cSrcweir 			break;
2472*cdf0e10cSrcweir */
2473*cdf0e10cSrcweir 
2474*cdf0e10cSrcweir /*
2475*cdf0e10cSrcweir 			case( META_MASKSCALE_ACTION ):
2476*cdf0e10cSrcweir 			{
2477*cdf0e10cSrcweir 				MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction;
2478*cdf0e10cSrcweir 
2479*cdf0e10cSrcweir 				rOStm << ;
2480*cdf0e10cSrcweir 				rOStm << ;
2481*cdf0e10cSrcweir 
2482*cdf0e10cSrcweir 				nCount++;
2483*cdf0e10cSrcweir 			}
2484*cdf0e10cSrcweir 			break;
2485*cdf0e10cSrcweir */
2486*cdf0e10cSrcweir 
2487*cdf0e10cSrcweir /*
2488*cdf0e10cSrcweir 			case( META_MASKSCALEPART_ACTION ):
2489*cdf0e10cSrcweir 			{
2490*cdf0e10cSrcweir 				MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
2491*cdf0e10cSrcweir 
2492*cdf0e10cSrcweir 				rOStm << ;
2493*cdf0e10cSrcweir 				rOStm << ;
2494*cdf0e10cSrcweir 
2495*cdf0e10cSrcweir 				nCount++;
2496*cdf0e10cSrcweir 			}
2497*cdf0e10cSrcweir 			break;
2498*cdf0e10cSrcweir */
2499*cdf0e10cSrcweir 
2500*cdf0e10cSrcweir /*
2501*cdf0e10cSrcweir 			case( META_ISECTREGIONCLIPREGION_ACTION ):
2502*cdf0e10cSrcweir 			{
2503*cdf0e10cSrcweir 				MetaISectRegionClipRegionAction* pAct = (MetaISectRegionClipRegionAction*) pAction;
2504*cdf0e10cSrcweir 
2505*cdf0e10cSrcweir 				rOStm << ;
2506*cdf0e10cSrcweir 				rOStm << ;
2507*cdf0e10cSrcweir 
2508*cdf0e10cSrcweir 				nCount++;
2509*cdf0e10cSrcweir 			}
2510*cdf0e10cSrcweir 			break;
2511*cdf0e10cSrcweir */
2512*cdf0e10cSrcweir 		}
2513*cdf0e10cSrcweir 	}
2514*cdf0e10cSrcweir 
2515*cdf0e10cSrcweir 	return nCount;
2516*cdf0e10cSrcweir }
2517