xref: /aoo4110/main/vcl/source/gdi/metaact.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_vcl.hxx"
24 
25 #define ENABLE_BYTESTRING_STREAM_OPERATORS
26 
27 #include <algorithm>
28 #include <string.h>
29 #include <tools/stream.hxx>
30 #include <tools/vcompat.hxx>
31 #include <vcl/outdev.hxx>
32 #include <vcl/salbtype.hxx>
33 #include <vcl/metaact.hxx>
34 #include <vcl/graphictools.hxx>
35 #include <basegfx/matrix/b2dhommatrixtools.hxx>
36 #include <vcl/dibtools.hxx>
37 
38 // ========================================================================
39 
ImplScalePoint(Point & rPt,double fScaleX,double fScaleY)40 inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
41 {
42 	rPt.X() = FRound( fScaleX * rPt.X() );
43 	rPt.Y() = FRound( fScaleY * rPt.Y() );
44 }
45 
46 // ------------------------------------------------------------------------
47 
ImplScaleRect(Rectangle & rRect,double fScaleX,double fScaleY)48 inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY )
49 {
50 	Point aTL( rRect.TopLeft() );
51 	Point aBR( rRect.BottomRight() );
52 
53 	ImplScalePoint( aTL, fScaleX, fScaleY );
54 	ImplScalePoint( aBR, fScaleX, fScaleY );
55 
56 	rRect = Rectangle( aTL, aBR );
57     rRect.Justify();
58 }
59 
60 // ------------------------------------------------------------------------
61 
ImplScalePoly(Polygon & rPoly,double fScaleX,double fScaleY)62 inline void ImplScalePoly( Polygon& rPoly, double fScaleX, double fScaleY )
63 {
64 	for( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
65 		ImplScalePoint( rPoly[ i ], fScaleX, fScaleY );
66 }
67 
68 // ------------------------------------------------------------------------
69 
ImplScaleLineInfo(LineInfo & rLineInfo,double fScaleX,double fScaleY)70 inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScaleY )
71 {
72 	if( !rLineInfo.IsDefault() )
73 	{
74 		const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
75 
76 		rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) );
77 		rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) );
78 		rLineInfo.SetDotLen( FRound( fScale * rLineInfo.GetDotLen() ) );
79 		rLineInfo.SetDistance( FRound( fScale * rLineInfo.GetDistance() ) );
80 	}
81 }
82 
83 // ========================================================================
84 
85 #define COMPAT( _def_rIStm ) VersionCompat aCompat( ( _def_rIStm ), STREAM_READ );
86 #define COMPAT_VERSION() aCompat.GetVersion()
87 #define WRITE_BASE_COMPAT( _def_rOStm, _def_nVer, _pWriteData ) 		\
88 	MetaAction::Write( ( _def_rOStm ), _pWriteData );					\
89 	VersionCompat aCompat( ( _def_rOStm ), STREAM_WRITE, ( _def_nVer ) );
90 
91 // ========================================================================
92 
MetaAction()93 MetaAction::MetaAction() :
94 	mnRefCount( 1 ),
95 	mnType( META_NULL_ACTION )
96 {
97 }
98 
99 // ------------------------------------------------------------------------
100 
MetaAction(sal_uInt16 nType)101 MetaAction::MetaAction( sal_uInt16 nType ) :
102 	mnRefCount( 1 ),
103 	mnType( nType )
104 {
105 }
106 
107 // ------------------------------------------------------------------------
108 
~MetaAction()109 MetaAction::~MetaAction()
110 {
111 }
112 
113 // ------------------------------------------------------------------------
114 
Execute(OutputDevice *)115 void MetaAction::Execute( OutputDevice* )
116 {
117 }
118 
119 // ------------------------------------------------------------------------
120 
Clone()121 MetaAction* MetaAction::Clone()
122 {
123 	return new MetaAction;
124 }
125 
126 // ------------------------------------------------------------------------
127 
Move(long,long)128 void MetaAction::Move( long, long )
129 {
130 }
131 
132 // ------------------------------------------------------------------------
133 
Scale(double,double)134 void MetaAction::Scale( double, double )
135 {
136 }
137 
138 // ------------------------------------------------------------------------
139 
Compare(const MetaAction &) const140 sal_Bool MetaAction::Compare( const MetaAction& ) const
141 {
142 	return sal_True;
143 }
144 
145 // ------------------------------------------------------------------------
146 
IsEqual(const MetaAction & rMetaAction) const147 sal_Bool MetaAction::IsEqual( const MetaAction& rMetaAction ) const
148 {
149 	if ( mnType != rMetaAction.mnType )
150 		return sal_False;
151 	else
152 		return Compare( rMetaAction );
153 }
154 
155 // ------------------------------------------------------------------------
156 
Write(SvStream & rOStm,ImplMetaWriteData *)157 void MetaAction::Write( SvStream& rOStm, ImplMetaWriteData* )
158 {
159 	rOStm << mnType;
160 }
161 
162 // ------------------------------------------------------------------------
163 
Read(SvStream & rIStm,ImplMetaReadData *)164 void MetaAction::Read( SvStream& rIStm, ImplMetaReadData* )
165 {
166 	rIStm >> mnType;
167 }
168 
169 // ------------------------------------------------------------------------
170 
ReadMetaAction(SvStream & rIStm,ImplMetaReadData * pData)171 MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData )
172 {
173 	MetaAction* pAction = NULL;
174 	sal_uInt16		nType;
175 
176 	rIStm >> nType;
177 
178 	switch( nType )
179 	{
180 		case( META_NULL_ACTION ): pAction = new MetaAction; break;
181 		case( META_PIXEL_ACTION ): pAction = new MetaPixelAction; break;
182 		case( META_POINT_ACTION ): pAction = new MetaPointAction; break;
183 		case( META_LINE_ACTION ): pAction = new MetaLineAction; break;
184 		case( META_RECT_ACTION ): pAction = new MetaRectAction; break;
185 		case( META_ROUNDRECT_ACTION ): pAction = new MetaRoundRectAction; break;
186 		case( META_ELLIPSE_ACTION ): pAction = new MetaEllipseAction; break;
187 		case( META_ARC_ACTION ): pAction = new MetaArcAction; break;
188 		case( META_PIE_ACTION ): pAction = new MetaPieAction; break;
189 		case( META_CHORD_ACTION ): pAction = new MetaChordAction; break;
190 		case( META_POLYLINE_ACTION ): pAction = new MetaPolyLineAction; break;
191 		case( META_POLYGON_ACTION ): pAction = new MetaPolygonAction; break;
192 		case( META_POLYPOLYGON_ACTION ): pAction = new MetaPolyPolygonAction; break;
193 		case( META_TEXT_ACTION ): pAction = new MetaTextAction; break;
194 		case( META_TEXTARRAY_ACTION ): pAction = new MetaTextArrayAction; break;
195 		case( META_STRETCHTEXT_ACTION ): pAction = new MetaStretchTextAction; break;
196 		case( META_TEXTRECT_ACTION ): pAction = new MetaTextRectAction; break;
197 		case( META_TEXTLINE_ACTION ): pAction = new MetaTextLineAction; break;
198 		case( META_BMP_ACTION ): pAction = new MetaBmpAction; break;
199 		case( META_BMPSCALE_ACTION ): pAction = new MetaBmpScaleAction; break;
200 		case( META_BMPSCALEPART_ACTION ): pAction = new MetaBmpScalePartAction; break;
201 		case( META_BMPEX_ACTION ): pAction = new MetaBmpExAction; break;
202 		case( META_BMPEXSCALE_ACTION ): pAction = new MetaBmpExScaleAction; break;
203 		case( META_BMPEXSCALEPART_ACTION ): pAction = new MetaBmpExScalePartAction; break;
204 		case( META_MASK_ACTION ): pAction = new MetaMaskAction; break;
205 		case( META_MASKSCALE_ACTION ): pAction = new MetaMaskScaleAction; break;
206 		case( META_MASKSCALEPART_ACTION ): pAction = new MetaMaskScalePartAction; break;
207 		case( META_GRADIENT_ACTION ): pAction = new MetaGradientAction; break;
208 		case( META_GRADIENTEX_ACTION ): pAction = new MetaGradientExAction; break;
209 		case( META_HATCH_ACTION ): pAction = new MetaHatchAction; break;
210 		case( META_WALLPAPER_ACTION ): pAction = new MetaWallpaperAction; break;
211 		case( META_CLIPREGION_ACTION ): pAction = new MetaClipRegionAction; break;
212 		case( META_ISECTRECTCLIPREGION_ACTION ): pAction = new MetaISectRectClipRegionAction; break;
213 		case( META_ISECTREGIONCLIPREGION_ACTION ): pAction = new MetaISectRegionClipRegionAction; break;
214 		case( META_MOVECLIPREGION_ACTION ): pAction = new MetaMoveClipRegionAction; break;
215 		case( META_LINECOLOR_ACTION ): pAction = new MetaLineColorAction; break;
216 		case( META_FILLCOLOR_ACTION ): pAction = new MetaFillColorAction; break;
217 		case( META_TEXTCOLOR_ACTION ): pAction = new MetaTextColorAction; break;
218 		case( META_TEXTFILLCOLOR_ACTION ): pAction = new MetaTextFillColorAction; break;
219 		case( META_TEXTLINECOLOR_ACTION ): pAction = new MetaTextLineColorAction; break;
220 		case( META_OVERLINECOLOR_ACTION ): pAction = new MetaOverlineColorAction; break;
221 		case( META_TEXTALIGN_ACTION ): pAction = new MetaTextAlignAction; break;
222 		case( META_MAPMODE_ACTION ): pAction = new MetaMapModeAction; break;
223 		case( META_FONT_ACTION ): pAction = new MetaFontAction; break;
224 		case( META_PUSH_ACTION ): pAction = new MetaPushAction; break;
225 		case( META_POP_ACTION ): pAction = new MetaPopAction; break;
226 		case( META_RASTEROP_ACTION ): pAction = new MetaRasterOpAction; break;
227 		case( META_TRANSPARENT_ACTION ): pAction = new MetaTransparentAction; break;
228 		case( META_FLOATTRANSPARENT_ACTION ): pAction = new MetaFloatTransparentAction; break;
229 		case( META_EPS_ACTION ): pAction = new MetaEPSAction; break;
230 		case( META_REFPOINT_ACTION ): pAction = new MetaRefPointAction; break;
231 		case( META_COMMENT_ACTION ): pAction = new MetaCommentAction; break;
232 		case( META_LAYOUTMODE_ACTION ): pAction = new MetaLayoutModeAction; break;
233 		case( META_TEXTLANGUAGE_ACTION ): pAction = new MetaTextLanguageAction; break;
234 
235 		default:
236 		{
237 			// Action ueberlesen durch Kombination Ctor/Dtor,
238 			// new/delete, weil Compiler sonst vielleicht wegoptimieren
239 			delete ( new VersionCompat( rIStm, STREAM_READ ) );
240 		}
241 		break;
242 	}
243 
244 	if( pAction )
245 		pAction->Read( rIStm, pData );
246 
247 	return pAction;
248 }
249 
250 // ========================================================================
251 
IMPL_META_ACTION(Pixel,META_PIXEL_ACTION)252 IMPL_META_ACTION( Pixel, META_PIXEL_ACTION )
253 
254 // ------------------------------------------------------------------------
255 
256 MetaPixelAction::MetaPixelAction( const Point& rPt, const Color& rColor ) :
257 	MetaAction	( META_PIXEL_ACTION ),
258 	maPt		( rPt ),
259 	maColor 	( rColor )
260 {
261 }
262 
263 // ------------------------------------------------------------------------
264 
Execute(OutputDevice * pOut)265 void MetaPixelAction::Execute( OutputDevice* pOut )
266 {
267 	pOut->DrawPixel( maPt, maColor );
268 }
269 
270 // ------------------------------------------------------------------------
271 
Clone()272 MetaAction* MetaPixelAction::Clone()
273 {
274 	MetaAction* pClone = (MetaAction*) new MetaPixelAction( *this );
275 	pClone->ResetRefCount();
276 	return pClone;
277 }
278 
279 // ------------------------------------------------------------------------
280 
Move(long nHorzMove,long nVertMove)281 void MetaPixelAction::Move( long nHorzMove, long nVertMove )
282 {
283 	maPt.Move( nHorzMove, nVertMove );
284 }
285 
286 // ------------------------------------------------------------------------
287 
Scale(double fScaleX,double fScaleY)288 void MetaPixelAction::Scale( double fScaleX, double fScaleY )
289 {
290 	ImplScalePoint( maPt, fScaleX, fScaleY );
291 }
292 
293 // ------------------------------------------------------------------------
294 
Compare(const MetaAction & rMetaAction) const295 sal_Bool MetaPixelAction::Compare( const MetaAction& rMetaAction ) const
296 {
297 	return ( maPt == ((MetaPixelAction&)rMetaAction).maPt ) &&
298 		   ( maColor == ((MetaPixelAction&)rMetaAction).maColor );
299 }
300 
301 // ------------------------------------------------------------------------
302 
Write(SvStream & rOStm,ImplMetaWriteData * pData)303 void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
304 {
305 	WRITE_BASE_COMPAT( rOStm, 1, pData );
306 	rOStm << maPt;
307 	maColor.Write( rOStm, sal_True );
308 }
309 
310 // ------------------------------------------------------------------------
311 
Read(SvStream & rIStm,ImplMetaReadData *)312 void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* )
313 {
314 	COMPAT( rIStm );
315 	rIStm >> maPt;
316 	maColor.Read( rIStm, sal_True );
317 }
318 
319 // ========================================================================
320 
IMPL_META_ACTION(Point,META_POINT_ACTION)321 IMPL_META_ACTION( Point, META_POINT_ACTION )
322 
323 // ------------------------------------------------------------------------
324 
325 MetaPointAction::MetaPointAction( const Point& rPt ) :
326 	MetaAction	( META_POINT_ACTION ),
327 	maPt		( rPt )
328 {
329 }
330 
331 // ------------------------------------------------------------------------
332 
Execute(OutputDevice * pOut)333 void MetaPointAction::Execute( OutputDevice* pOut )
334 {
335 	pOut->DrawPixel( maPt );
336 }
337 
338 // ------------------------------------------------------------------------
339 
Clone()340 MetaAction* MetaPointAction::Clone()
341 {
342 	MetaAction* pClone = (MetaAction*) new MetaPointAction( *this );
343 	pClone->ResetRefCount();
344 	return pClone;
345 }
346 
347 // ------------------------------------------------------------------------
348 
Move(long nHorzMove,long nVertMove)349 void MetaPointAction::Move( long nHorzMove, long nVertMove )
350 {
351 	maPt.Move( nHorzMove, nVertMove );
352 }
353 
354 // ------------------------------------------------------------------------
355 
Scale(double fScaleX,double fScaleY)356 void MetaPointAction::Scale( double fScaleX, double fScaleY )
357 {
358 	ImplScalePoint( maPt, fScaleX, fScaleY );
359 }
360 
361 // ------------------------------------------------------------------------
362 
Compare(const MetaAction & rMetaAction) const363 sal_Bool MetaPointAction::Compare( const MetaAction& rMetaAction ) const
364 {
365 	return maPt == ((MetaPointAction&)rMetaAction).maPt;
366 }
367 
368 // ------------------------------------------------------------------------
369 
Write(SvStream & rOStm,ImplMetaWriteData * pData)370 void MetaPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
371 {
372 	WRITE_BASE_COMPAT( rOStm, 1, pData );
373 	rOStm << maPt;
374 }
375 
376 // ------------------------------------------------------------------------
377 
Read(SvStream & rIStm,ImplMetaReadData *)378 void MetaPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
379 {
380 	COMPAT( rIStm );
381 	rIStm >> maPt;
382 }
383 
384 // ========================================================================
385 
IMPL_META_ACTION(Line,META_LINE_ACTION)386 IMPL_META_ACTION( Line, META_LINE_ACTION )
387 
388 // ------------------------------------------------------------------------
389 
390 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd ) :
391 	MetaAction	( META_LINE_ACTION ),
392 	maStartPt	( rStart ),
393 	maEndPt 	( rEnd )
394 {
395 }
396 
397 // ------------------------------------------------------------------------
398 
MetaLineAction(const Point & rStart,const Point & rEnd,const LineInfo & rLineInfo)399 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd,
400 								const LineInfo& rLineInfo ) :
401 	MetaAction	( META_LINE_ACTION ),
402 	maLineInfo	( rLineInfo ),
403 	maStartPt	( rStart ),
404 	maEndPt 	( rEnd )
405 {
406 }
407 
408 // ------------------------------------------------------------------------
409 
Execute(OutputDevice * pOut)410 void MetaLineAction::Execute( OutputDevice* pOut )
411 {
412 	if( maLineInfo.IsDefault() )
413 		pOut->DrawLine( maStartPt, maEndPt );
414 	else
415 		pOut->DrawLine( maStartPt, maEndPt, maLineInfo );
416 }
417 
418 // ------------------------------------------------------------------------
419 
Clone()420 MetaAction* MetaLineAction::Clone()
421 {
422 	MetaAction* pClone = (MetaAction*) new MetaLineAction( *this );
423 	pClone->ResetRefCount();
424 	return pClone;
425 }
426 
427 // ------------------------------------------------------------------------
428 
Move(long nHorzMove,long nVertMove)429 void MetaLineAction::Move( long nHorzMove, long nVertMove )
430 {
431 	maStartPt.Move( nHorzMove, nVertMove );
432 	maEndPt.Move( nHorzMove, nVertMove );
433 }
434 
435 // ------------------------------------------------------------------------
436 
Scale(double fScaleX,double fScaleY)437 void MetaLineAction::Scale( double fScaleX, double fScaleY )
438 {
439 	ImplScalePoint( maStartPt, fScaleX, fScaleY );
440 	ImplScalePoint( maEndPt, fScaleX, fScaleY );
441 	ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
442 }
443 
444 // ------------------------------------------------------------------------
445 
Compare(const MetaAction & rMetaAction) const446 sal_Bool MetaLineAction::Compare( const MetaAction& rMetaAction ) const
447 {
448 	return ( maLineInfo == ((MetaLineAction&)rMetaAction).maLineInfo ) &&
449 	       ( maStartPt == ((MetaLineAction&)rMetaAction).maStartPt ) &&
450 		   ( maEndPt == ((MetaLineAction&)rMetaAction).maEndPt );
451 }
452 
453 // ------------------------------------------------------------------------
454 
Write(SvStream & rOStm,ImplMetaWriteData * pData)455 void MetaLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
456 {
457 	WRITE_BASE_COMPAT( rOStm, 2, pData );
458 
459 	rOStm << maStartPt << maEndPt;	// Version 1
460 	rOStm << maLineInfo;			// Version 2
461 }
462 
463 // ------------------------------------------------------------------------
464 
Read(SvStream & rIStm,ImplMetaReadData *)465 void MetaLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
466 {
467 	COMPAT( rIStm );
468 
469 	// Version 1
470 	rIStm >> maStartPt >> maEndPt;
471 
472 	// Version 2
473 	if( aCompat.GetVersion() >= 2 )
474 	{
475 		rIStm >> maLineInfo;
476 	}
477 }
478 
479 // ========================================================================
480 
IMPL_META_ACTION(Rect,META_RECT_ACTION)481 IMPL_META_ACTION( Rect, META_RECT_ACTION )
482 
483 // ------------------------------------------------------------------------
484 
485 MetaRectAction::MetaRectAction( const Rectangle& rRect ) :
486 	MetaAction	( META_RECT_ACTION ),
487 	maRect		( rRect )
488 {
489 }
490 
491 // ------------------------------------------------------------------------
492 
Execute(OutputDevice * pOut)493 void MetaRectAction::Execute( OutputDevice* pOut )
494 {
495 	pOut->DrawRect( maRect );
496 }
497 
498 // ------------------------------------------------------------------------
499 
Clone()500 MetaAction* MetaRectAction::Clone()
501 {
502 	MetaAction* pClone = (MetaAction*) new MetaRectAction( *this );
503 	pClone->ResetRefCount();
504 	return pClone;
505 }
506 
507 // ------------------------------------------------------------------------
508 
Move(long nHorzMove,long nVertMove)509 void MetaRectAction::Move( long nHorzMove, long nVertMove )
510 {
511 	maRect.Move( nHorzMove, nVertMove );
512 }
513 
514 // ------------------------------------------------------------------------
515 
Scale(double fScaleX,double fScaleY)516 void MetaRectAction::Scale( double fScaleX, double fScaleY )
517 {
518 	ImplScaleRect( maRect, fScaleX, fScaleY );
519 }
520 
521 // ------------------------------------------------------------------------
522 
Compare(const MetaAction & rMetaAction) const523 sal_Bool MetaRectAction::Compare( const MetaAction& rMetaAction ) const
524 {
525 	return maRect == ((MetaRectAction&)rMetaAction).maRect;
526 }
527 
528 // ------------------------------------------------------------------------
529 
Write(SvStream & rOStm,ImplMetaWriteData * pData)530 void MetaRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
531 {
532 	WRITE_BASE_COMPAT( rOStm, 1, pData );
533 	rOStm << maRect;
534 }
535 
536 // ------------------------------------------------------------------------
537 
Read(SvStream & rIStm,ImplMetaReadData *)538 void MetaRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
539 {
540 	COMPAT( rIStm );
541 	rIStm >> maRect;
542 }
543 
544 // ========================================================================
545 
IMPL_META_ACTION(RoundRect,META_ROUNDRECT_ACTION)546 IMPL_META_ACTION( RoundRect, META_ROUNDRECT_ACTION )
547 
548 // ------------------------------------------------------------------------
549 
550 MetaRoundRectAction::MetaRoundRectAction( const Rectangle& rRect,
551 										  sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) :
552 	MetaAction	( META_ROUNDRECT_ACTION ),
553 	maRect		( rRect ),
554 	mnHorzRound ( nHorzRound ),
555 	mnVertRound ( nVertRound )
556 {
557 }
558 
559 // ------------------------------------------------------------------------
560 
Execute(OutputDevice * pOut)561 void MetaRoundRectAction::Execute( OutputDevice* pOut )
562 {
563 	pOut->DrawRect( maRect, mnHorzRound, mnVertRound );
564 }
565 
566 // ------------------------------------------------------------------------
567 
Clone()568 MetaAction* MetaRoundRectAction::Clone()
569 {
570 	MetaAction* pClone = (MetaAction*) new MetaRoundRectAction( *this );
571 	pClone->ResetRefCount();
572 	return pClone;
573 }
574 
575 // ------------------------------------------------------------------------
576 
Move(long nHorzMove,long nVertMove)577 void MetaRoundRectAction::Move( long nHorzMove, long nVertMove )
578 {
579 	maRect.Move( nHorzMove, nVertMove );
580 }
581 
582 // ------------------------------------------------------------------------
583 
Scale(double fScaleX,double fScaleY)584 void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
585 {
586 	ImplScaleRect( maRect, fScaleX, fScaleY );
587 	mnHorzRound = FRound( mnHorzRound * fabs(fScaleX) );
588 	mnVertRound = FRound( mnVertRound * fabs(fScaleY) );
589 }
590 
591 // ------------------------------------------------------------------------
592 
Compare(const MetaAction & rMetaAction) const593 sal_Bool MetaRoundRectAction::Compare( const MetaAction& rMetaAction ) const
594 {
595 	return ( maRect == ((MetaRoundRectAction&)rMetaAction).maRect ) &&
596 		   ( mnHorzRound == ((MetaRoundRectAction&)rMetaAction).mnHorzRound ) &&
597 		   ( mnVertRound == ((MetaRoundRectAction&)rMetaAction).mnVertRound );
598 }
599 
600 // ------------------------------------------------------------------------
601 
Write(SvStream & rOStm,ImplMetaWriteData * pData)602 void MetaRoundRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
603 {
604 	WRITE_BASE_COMPAT( rOStm, 1, pData );
605 	rOStm << maRect << mnHorzRound << mnVertRound;
606 }
607 
608 // ------------------------------------------------------------------------
609 
Read(SvStream & rIStm,ImplMetaReadData *)610 void MetaRoundRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
611 {
612 	COMPAT( rIStm );
613 	rIStm >> maRect >> mnHorzRound >> mnVertRound;
614 }
615 
616 // ========================================================================
617 
IMPL_META_ACTION(Ellipse,META_ELLIPSE_ACTION)618 IMPL_META_ACTION( Ellipse, META_ELLIPSE_ACTION )
619 
620 // ------------------------------------------------------------------------
621 
622 MetaEllipseAction::MetaEllipseAction( const Rectangle& rRect ) :
623 	MetaAction	( META_ELLIPSE_ACTION ),
624 	maRect		( rRect )
625 {
626 }
627 
628 // ------------------------------------------------------------------------
629 
Execute(OutputDevice * pOut)630 void MetaEllipseAction::Execute( OutputDevice* pOut )
631 {
632 	pOut->DrawEllipse( maRect );
633 }
634 
635 // ------------------------------------------------------------------------
636 
Clone()637 MetaAction* MetaEllipseAction::Clone()
638 {
639 	MetaAction* pClone = (MetaAction*) new MetaEllipseAction( *this );
640 	pClone->ResetRefCount();
641 	return pClone;
642 }
643 
644 // ------------------------------------------------------------------------
645 
Move(long nHorzMove,long nVertMove)646 void MetaEllipseAction::Move( long nHorzMove, long nVertMove )
647 {
648 	maRect.Move( nHorzMove, nVertMove );
649 }
650 
651 // ------------------------------------------------------------------------
652 
Scale(double fScaleX,double fScaleY)653 void MetaEllipseAction::Scale( double fScaleX, double fScaleY )
654 {
655 	ImplScaleRect( maRect, fScaleX, fScaleY );
656 }
657 
658 // ------------------------------------------------------------------------
659 
Compare(const MetaAction & rMetaAction) const660 sal_Bool MetaEllipseAction::Compare( const MetaAction& rMetaAction ) const
661 {
662 	return maRect == ((MetaEllipseAction&)rMetaAction).maRect;
663 }
664 
665 // ------------------------------------------------------------------------
666 
Write(SvStream & rOStm,ImplMetaWriteData * pData)667 void MetaEllipseAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
668 {
669 	WRITE_BASE_COMPAT( rOStm, 1, pData );
670 	rOStm << maRect;
671 }
672 
673 // ------------------------------------------------------------------------
674 
Read(SvStream & rIStm,ImplMetaReadData *)675 void MetaEllipseAction::Read( SvStream& rIStm, ImplMetaReadData* )
676 {
677 	COMPAT( rIStm );
678 	rIStm >> maRect;
679 }
680 
681 // ========================================================================
682 
IMPL_META_ACTION(Arc,META_ARC_ACTION)683 IMPL_META_ACTION( Arc, META_ARC_ACTION )
684 
685 // ------------------------------------------------------------------------
686 
687 MetaArcAction::MetaArcAction( const Rectangle& rRect,
688 							  const Point& rStart, const Point& rEnd ) :
689 	MetaAction	( META_ARC_ACTION ),
690 	maRect		( rRect ),
691 	maStartPt	( rStart ),
692 	maEndPt 	( rEnd )
693 {
694 }
695 
696 // ------------------------------------------------------------------------
697 
Execute(OutputDevice * pOut)698 void MetaArcAction::Execute( OutputDevice* pOut )
699 {
700 	pOut->DrawArc( maRect, maStartPt, maEndPt );
701 }
702 
703 // ------------------------------------------------------------------------
704 
Clone()705 MetaAction* MetaArcAction::Clone()
706 {
707 	MetaAction* pClone = (MetaAction*) new MetaArcAction( *this );
708 	pClone->ResetRefCount();
709 	return pClone;
710 }
711 
712 // ------------------------------------------------------------------------
713 
Move(long nHorzMove,long nVertMove)714 void MetaArcAction::Move( long nHorzMove, long nVertMove )
715 {
716 	maRect.Move(  nHorzMove, nVertMove );
717 	maStartPt.Move(  nHorzMove, nVertMove );
718 	maEndPt.Move(  nHorzMove, nVertMove );
719 }
720 
721 // ------------------------------------------------------------------------
722 
Scale(double fScaleX,double fScaleY)723 void MetaArcAction::Scale( double fScaleX, double fScaleY )
724 {
725 	ImplScaleRect( maRect, fScaleX, fScaleY );
726 	ImplScalePoint( maStartPt, fScaleX, fScaleY );
727 	ImplScalePoint( maEndPt, fScaleX, fScaleY );
728 }
729 
730 // ------------------------------------------------------------------------
731 
Compare(const MetaAction & rMetaAction) const732 sal_Bool MetaArcAction::Compare( const MetaAction& rMetaAction ) const
733 {
734 	return ( maRect == ((MetaArcAction&)rMetaAction).maRect ) &&
735 		   ( maStartPt == ((MetaArcAction&)rMetaAction).maStartPt ) &&
736 		   ( maEndPt == ((MetaArcAction&)rMetaAction).maEndPt );
737 }
738 
739 // ------------------------------------------------------------------------
740 
Write(SvStream & rOStm,ImplMetaWriteData * pData)741 void MetaArcAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
742 {
743 	WRITE_BASE_COMPAT( rOStm, 1, pData );
744 	rOStm << maRect << maStartPt << maEndPt;
745 }
746 
747 // ------------------------------------------------------------------------
748 
Read(SvStream & rIStm,ImplMetaReadData *)749 void MetaArcAction::Read( SvStream& rIStm, ImplMetaReadData* )
750 {
751 	COMPAT( rIStm );
752 	rIStm >> maRect >> maStartPt >> maEndPt;
753 }
754 
755 // ========================================================================
756 
IMPL_META_ACTION(Pie,META_PIE_ACTION)757 IMPL_META_ACTION( Pie, META_PIE_ACTION )
758 
759 // ------------------------------------------------------------------------
760 
761 MetaPieAction::MetaPieAction( const Rectangle& rRect,
762 							  const Point& rStart, const Point& rEnd ) :
763 	MetaAction	( META_PIE_ACTION ),
764 	maRect		( rRect ),
765 	maStartPt	( rStart ),
766 	maEndPt 	( rEnd )
767 {
768 }
769 
770 // ------------------------------------------------------------------------
771 
Execute(OutputDevice * pOut)772 void MetaPieAction::Execute( OutputDevice* pOut )
773 {
774 	pOut->DrawPie( maRect, maStartPt, maEndPt );
775 }
776 
777 // ------------------------------------------------------------------------
778 
Clone()779 MetaAction* MetaPieAction::Clone()
780 {
781 	MetaAction* pClone = (MetaAction*) new MetaPieAction( *this );
782 	pClone->ResetRefCount();
783 	return pClone;
784 }
785 
786 // ------------------------------------------------------------------------
787 
Move(long nHorzMove,long nVertMove)788 void MetaPieAction::Move( long nHorzMove, long nVertMove )
789 {
790 	maRect.Move(  nHorzMove, nVertMove );
791 	maStartPt.Move(  nHorzMove, nVertMove );
792 	maEndPt.Move(  nHorzMove, nVertMove );
793 }
794 
795 // ------------------------------------------------------------------------
796 
Scale(double fScaleX,double fScaleY)797 void MetaPieAction::Scale( double fScaleX, double fScaleY )
798 {
799 	ImplScaleRect( maRect, fScaleX, fScaleY );
800 	ImplScalePoint( maStartPt, fScaleX, fScaleY );
801 	ImplScalePoint( maEndPt, fScaleX, fScaleY );
802 }
803 
804 // ------------------------------------------------------------------------
805 
Compare(const MetaAction & rMetaAction) const806 sal_Bool MetaPieAction::Compare( const MetaAction& rMetaAction ) const
807 {
808 	return ( maRect == ((MetaPieAction&)rMetaAction).maRect ) &&
809 		   ( maStartPt == ((MetaPieAction&)rMetaAction).maStartPt ) &&
810 		   ( maEndPt == ((MetaPieAction&)rMetaAction).maEndPt );
811 }
812 
813 // ------------------------------------------------------------------------
814 
Write(SvStream & rOStm,ImplMetaWriteData * pData)815 void MetaPieAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
816 {
817 	WRITE_BASE_COMPAT( rOStm, 1, pData );
818 	rOStm << maRect << maStartPt << maEndPt;
819 }
820 
821 // ------------------------------------------------------------------------
822 
Read(SvStream & rIStm,ImplMetaReadData *)823 void MetaPieAction::Read( SvStream& rIStm, ImplMetaReadData* )
824 {
825 	COMPAT( rIStm );
826 	rIStm >> maRect >> maStartPt >> maEndPt;
827 }
828 
829 // ========================================================================
830 
IMPL_META_ACTION(Chord,META_CHORD_ACTION)831 IMPL_META_ACTION( Chord, META_CHORD_ACTION )
832 
833 // ------------------------------------------------------------------------
834 
835 MetaChordAction::MetaChordAction( const Rectangle& rRect,
836 								  const Point& rStart, const Point& rEnd ) :
837 	MetaAction	( META_CHORD_ACTION ),
838 	maRect		( rRect ),
839 	maStartPt	( rStart ),
840 	maEndPt 	( rEnd )
841 {
842 }
843 
844 // ------------------------------------------------------------------------
845 
Execute(OutputDevice * pOut)846 void MetaChordAction::Execute( OutputDevice* pOut )
847 {
848 	pOut->DrawChord( maRect, maStartPt, maEndPt );
849 }
850 
851 // ------------------------------------------------------------------------
852 
Clone()853 MetaAction* MetaChordAction::Clone()
854 {
855 	MetaAction* pClone = (MetaAction*) new MetaChordAction( *this );
856 	pClone->ResetRefCount();
857 	return pClone;
858 }
859 
860 // ------------------------------------------------------------------------
861 
Move(long nHorzMove,long nVertMove)862 void MetaChordAction::Move( long nHorzMove, long nVertMove )
863 {
864 	maRect.Move(  nHorzMove, nVertMove );
865 	maStartPt.Move(  nHorzMove, nVertMove );
866 	maEndPt.Move(  nHorzMove, nVertMove );
867 }
868 
869 // ------------------------------------------------------------------------
870 
Scale(double fScaleX,double fScaleY)871 void MetaChordAction::Scale( double fScaleX, double fScaleY )
872 {
873 	ImplScaleRect( maRect, fScaleX, fScaleY );
874 	ImplScalePoint( maStartPt, fScaleX, fScaleY );
875 	ImplScalePoint( maEndPt, fScaleX, fScaleY );
876 }
877 
878 // ------------------------------------------------------------------------
879 
Compare(const MetaAction & rMetaAction) const880 sal_Bool MetaChordAction::Compare( const MetaAction& rMetaAction ) const
881 {
882 	return ( maRect == ((MetaChordAction&)rMetaAction).maRect ) &&
883 		   ( maStartPt == ((MetaChordAction&)rMetaAction).maStartPt ) &&
884 		   ( maEndPt == ((MetaChordAction&)rMetaAction).maEndPt );
885 }
886 
887 // ------------------------------------------------------------------------
888 
Write(SvStream & rOStm,ImplMetaWriteData * pData)889 void MetaChordAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
890 {
891 	WRITE_BASE_COMPAT( rOStm, 1, pData );
892 	rOStm << maRect << maStartPt << maEndPt;
893 }
894 
895 // ------------------------------------------------------------------------
896 
Read(SvStream & rIStm,ImplMetaReadData *)897 void MetaChordAction::Read( SvStream& rIStm, ImplMetaReadData* )
898 {
899 	COMPAT( rIStm );
900 	rIStm >> maRect >> maStartPt >> maEndPt;
901 }
902 
903 // ========================================================================
904 
IMPL_META_ACTION(PolyLine,META_POLYLINE_ACTION)905 IMPL_META_ACTION( PolyLine, META_POLYLINE_ACTION )
906 
907 // ------------------------------------------------------------------------
908 
909 MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly ) :
910 	MetaAction	( META_POLYLINE_ACTION ),
911 	maPoly		( rPoly )
912 {
913 }
914 
915 // ------------------------------------------------------------------------
916 
MetaPolyLineAction(const Polygon & rPoly,const LineInfo & rLineInfo)917 MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly, const LineInfo& rLineInfo ) :
918 	MetaAction	( META_POLYLINE_ACTION ),
919 	maLineInfo	( rLineInfo ),
920 	maPoly		( rPoly )
921 {
922 }
923 
924 // ------------------------------------------------------------------------
925 
Execute(OutputDevice * pOut)926 void MetaPolyLineAction::Execute( OutputDevice* pOut )
927 {
928 	if( maLineInfo.IsDefault() )
929 		pOut->DrawPolyLine( maPoly );
930 	else
931 		pOut->DrawPolyLine( maPoly, maLineInfo );
932 }
933 
934 // ------------------------------------------------------------------------
935 
Clone()936 MetaAction* MetaPolyLineAction::Clone()
937 {
938 	MetaAction* pClone = (MetaAction*) new MetaPolyLineAction( *this );
939 	pClone->ResetRefCount();
940 	return pClone;
941 }
942 
943 // ------------------------------------------------------------------------
944 
Move(long nHorzMove,long nVertMove)945 void MetaPolyLineAction::Move( long nHorzMove, long nVertMove )
946 {
947 	maPoly.Move( nHorzMove, nVertMove );
948 }
949 
950 // ------------------------------------------------------------------------
951 
Scale(double fScaleX,double fScaleY)952 void MetaPolyLineAction::Scale( double fScaleX, double fScaleY )
953 {
954 	ImplScalePoly( maPoly, fScaleX, fScaleY );
955 	ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
956 }
957 
958 // ------------------------------------------------------------------------
959 
Compare(const MetaAction & rMetaAction) const960 sal_Bool MetaPolyLineAction::Compare( const MetaAction& rMetaAction ) const
961 {
962 	sal_Bool bIsEqual = sal_True;;
963 	if ( maLineInfo != ((MetaPolyLineAction&)rMetaAction).maLineInfo )
964 		bIsEqual = sal_False;
965 	else
966 		bIsEqual = maPoly.IsEqual(((MetaPolyLineAction&)rMetaAction).maPoly );
967 	return bIsEqual;
968 
969 }
970 
971 // ------------------------------------------------------------------------
972 
Write(SvStream & rOStm,ImplMetaWriteData * pData)973 void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
974 {
975 	WRITE_BASE_COMPAT( rOStm, 3, pData );
976 
977 	Polygon aSimplePoly;
978 	maPoly.AdaptiveSubdivide( aSimplePoly );
979 
980 	rOStm << aSimplePoly;								// Version 1
981 	rOStm << maLineInfo;								// Version 2
982 
983 	sal_uInt8 bHasPolyFlags = maPoly.HasFlags();		// Version 3
984 	rOStm << bHasPolyFlags;
985 	if ( bHasPolyFlags )
986 		maPoly.Write( rOStm );
987 }
988 
989 // ------------------------------------------------------------------------
990 
Read(SvStream & rIStm,ImplMetaReadData *)991 void MetaPolyLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
992 {
993 	COMPAT( rIStm );
994 
995 	// Version 1
996 	rIStm >> maPoly;
997 
998 	// Version 2
999 	if( aCompat.GetVersion() >= 2 )
1000 		rIStm >> maLineInfo;
1001 	if ( aCompat.GetVersion() >= 3 )
1002 	{
1003 		sal_uInt8 bHasPolyFlags;
1004 		rIStm >> bHasPolyFlags;
1005 		if ( bHasPolyFlags )
1006 			maPoly.Read( rIStm );
1007 	}
1008 }
1009 
1010 // ========================================================================
1011 
IMPL_META_ACTION(Polygon,META_POLYGON_ACTION)1012 IMPL_META_ACTION( Polygon, META_POLYGON_ACTION )
1013 
1014 // ------------------------------------------------------------------------
1015 
1016 MetaPolygonAction::MetaPolygonAction( const Polygon& rPoly ) :
1017 	MetaAction	( META_POLYGON_ACTION ),
1018 	maPoly		( rPoly )
1019 {
1020 }
1021 
1022 // ------------------------------------------------------------------------
1023 
Execute(OutputDevice * pOut)1024 void MetaPolygonAction::Execute( OutputDevice* pOut )
1025 {
1026 	pOut->DrawPolygon( maPoly );
1027 }
1028 
1029 // ------------------------------------------------------------------------
1030 
Clone()1031 MetaAction* MetaPolygonAction::Clone()
1032 {
1033 	MetaAction* pClone = (MetaAction*) new MetaPolygonAction( *this );
1034 	pClone->ResetRefCount();
1035 	return pClone;
1036 }
1037 
1038 // ------------------------------------------------------------------------
1039 
Move(long nHorzMove,long nVertMove)1040 void MetaPolygonAction::Move( long nHorzMove, long nVertMove )
1041 {
1042 	maPoly.Move( nHorzMove, nVertMove );
1043 }
1044 
1045 // ------------------------------------------------------------------------
1046 
Scale(double fScaleX,double fScaleY)1047 void MetaPolygonAction::Scale( double fScaleX, double fScaleY )
1048 {
1049 	ImplScalePoly( maPoly, fScaleX, fScaleY );
1050 }
1051 
1052 // ------------------------------------------------------------------------
1053 
Compare(const MetaAction & rMetaAction) const1054 sal_Bool MetaPolygonAction::Compare( const MetaAction& rMetaAction ) const
1055 {
1056 	return maPoly.IsEqual(((MetaPolygonAction&)rMetaAction).maPoly );
1057 }
1058 
1059 // ------------------------------------------------------------------------
1060 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1061 void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1062 {
1063 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1064 
1065 	Polygon aSimplePoly;							// Version 1
1066 	maPoly.AdaptiveSubdivide( aSimplePoly );
1067 	rOStm << aSimplePoly;
1068 
1069 	sal_uInt8 bHasPolyFlags = maPoly.HasFlags();	// Version 2
1070 	rOStm << bHasPolyFlags;
1071 	if ( bHasPolyFlags )
1072 		maPoly.Write( rOStm );
1073 }
1074 
1075 // ------------------------------------------------------------------------
1076 
Read(SvStream & rIStm,ImplMetaReadData *)1077 void MetaPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
1078 {
1079 	COMPAT( rIStm );
1080 
1081 	rIStm >> maPoly;					// Version 1
1082 
1083 	if( aCompat.GetVersion() >= 2 )		// Version 2
1084 	{
1085 		sal_uInt8 bHasPolyFlags;
1086 		rIStm >> bHasPolyFlags;
1087 		if ( bHasPolyFlags )
1088 			maPoly.Read( rIStm );
1089 	}
1090 }
1091 
1092 // ========================================================================
1093 
IMPL_META_ACTION(PolyPolygon,META_POLYPOLYGON_ACTION)1094 IMPL_META_ACTION( PolyPolygon, META_POLYPOLYGON_ACTION )
1095 
1096 // ------------------------------------------------------------------------
1097 
1098 MetaPolyPolygonAction::MetaPolyPolygonAction( const PolyPolygon& rPolyPoly ) :
1099 	MetaAction	( META_POLYPOLYGON_ACTION ),
1100 	maPolyPoly	( rPolyPoly )
1101 {
1102 }
1103 
1104 // ------------------------------------------------------------------------
1105 
Execute(OutputDevice * pOut)1106 void MetaPolyPolygonAction::Execute( OutputDevice* pOut )
1107 {
1108 	pOut->DrawPolyPolygon( maPolyPoly );
1109 }
1110 
1111 // ------------------------------------------------------------------------
1112 
Clone()1113 MetaAction* MetaPolyPolygonAction::Clone()
1114 {
1115 	MetaAction* pClone = (MetaAction*) new MetaPolyPolygonAction( *this );
1116 	pClone->ResetRefCount();
1117 	return pClone;
1118 }
1119 
1120 // ------------------------------------------------------------------------
1121 
Move(long nHorzMove,long nVertMove)1122 void MetaPolyPolygonAction::Move( long nHorzMove, long nVertMove )
1123 {
1124 	maPolyPoly.Move( nHorzMove, nVertMove );
1125 }
1126 
1127 // ------------------------------------------------------------------------
1128 
Scale(double fScaleX,double fScaleY)1129 void MetaPolyPolygonAction::Scale( double fScaleX, double fScaleY )
1130 {
1131 	for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
1132 		ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
1133 }
1134 
1135 // ------------------------------------------------------------------------
1136 
Compare(const MetaAction & rMetaAction) const1137 sal_Bool MetaPolyPolygonAction::Compare( const MetaAction& rMetaAction ) const
1138 {
1139 	return maPolyPoly.IsEqual(((MetaPolyPolygonAction&)rMetaAction).maPolyPoly );
1140 }
1141 
1142 // ------------------------------------------------------------------------
1143 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1144 void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1145 {
1146 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1147 
1148 	sal_uInt16 nNumberOfComplexPolygons = 0;
1149 	sal_uInt16 i, nPolyCount = maPolyPoly.Count();
1150 
1151 	Polygon aSimplePoly;								// Version 1
1152 	rOStm << nPolyCount;
1153 	for ( i = 0; i < nPolyCount; i++ )
1154 	{
1155 		const Polygon& rPoly = maPolyPoly.GetObject( i );
1156 		if ( rPoly.HasFlags() )
1157 			nNumberOfComplexPolygons++;
1158 		rPoly.AdaptiveSubdivide( aSimplePoly );
1159 		rOStm << aSimplePoly;
1160 	}
1161 
1162 	rOStm << nNumberOfComplexPolygons;					// Version 2
1163 	for ( i = 0; nNumberOfComplexPolygons && ( i < nPolyCount ); i++ )
1164 	{
1165 		const Polygon& rPoly = maPolyPoly.GetObject( i );
1166 		if ( rPoly.HasFlags() )
1167 		{
1168 			rOStm << i;
1169 			rPoly.Write( rOStm );
1170 
1171 			nNumberOfComplexPolygons--;
1172 		}
1173 	}
1174 }
1175 
1176 // ------------------------------------------------------------------------
1177 
Read(SvStream & rIStm,ImplMetaReadData *)1178 void MetaPolyPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
1179 {
1180 	COMPAT( rIStm );
1181 	rIStm >> maPolyPoly;				// Version 1
1182 
1183 	if ( aCompat.GetVersion() >= 2 )	// Version 2
1184 	{
1185 		sal_uInt16 i, nIndex, nNumberOfComplexPolygons;
1186 		rIStm >> nNumberOfComplexPolygons;
1187 		for ( i = 0; i < nNumberOfComplexPolygons; i++ )
1188 		{
1189 			rIStm >> nIndex;
1190 			Polygon aPoly;
1191 			aPoly.Read( rIStm );
1192 			maPolyPoly.Replace( aPoly, nIndex );
1193 		}
1194 	}
1195 }
1196 
1197 // ========================================================================
1198 
IMPL_META_ACTION(Text,META_TEXT_ACTION)1199 IMPL_META_ACTION( Text, META_TEXT_ACTION )
1200 
1201 // ------------------------------------------------------------------------
1202 
1203 MetaTextAction::MetaTextAction( const Point& rPt, const XubString& rStr,
1204 								sal_uInt16 nIndex, sal_uInt16 nLen ) :
1205 	MetaAction	( META_TEXT_ACTION ),
1206 	maPt		( rPt ),
1207 	maStr		( rStr ),
1208 	mnIndex 	( nIndex ),
1209 	mnLen		( nLen )
1210 {
1211 }
1212 
1213 // ------------------------------------------------------------------------
1214 
Execute(OutputDevice * pOut)1215 void MetaTextAction::Execute( OutputDevice* pOut )
1216 {
1217 	pOut->DrawText( maPt, maStr, mnIndex, mnLen );
1218 }
1219 
1220 // ------------------------------------------------------------------------
1221 
Clone()1222 MetaAction* MetaTextAction::Clone()
1223 {
1224 	MetaAction* pClone = (MetaAction*) new MetaTextAction( *this );
1225 	pClone->ResetRefCount();
1226 	return pClone;
1227 }
1228 
1229 // ------------------------------------------------------------------------
1230 
Move(long nHorzMove,long nVertMove)1231 void MetaTextAction::Move( long nHorzMove, long nVertMove )
1232 {
1233 	maPt.Move( nHorzMove, nVertMove );
1234 }
1235 
1236 // ------------------------------------------------------------------------
1237 
Scale(double fScaleX,double fScaleY)1238 void MetaTextAction::Scale( double fScaleX, double fScaleY )
1239 {
1240 	ImplScalePoint( maPt, fScaleX, fScaleY );
1241 }
1242 
1243 // ------------------------------------------------------------------------
1244 
Compare(const MetaAction & rMetaAction) const1245 sal_Bool MetaTextAction::Compare( const MetaAction& rMetaAction ) const
1246 {
1247 	return ( maPt == ((MetaTextAction&)rMetaAction).maPt ) &&
1248 		   ( maStr == ((MetaTextAction&)rMetaAction).maStr ) &&
1249 		   ( mnIndex == ((MetaTextAction&)rMetaAction).mnIndex ) &&
1250 		   ( mnLen == ((MetaTextAction&)rMetaAction).mnLen );
1251 }
1252 
1253 // ------------------------------------------------------------------------
1254 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1255 void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1256 {
1257 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1258 	rOStm	<< maPt;
1259 	rOStm.WriteByteString( maStr, pData->meActualCharSet );
1260 	rOStm	<< mnIndex;
1261 	rOStm	<< mnLen;
1262 
1263 	sal_uInt16 i, nLen = maStr.Len();							// version 2
1264 	rOStm << nLen;
1265 	for ( i = 0; i < nLen; i++ )
1266 	{
1267 		sal_Unicode nUni = maStr.GetChar( i );
1268 		rOStm << nUni;
1269 	}
1270 }
1271 
1272 // ------------------------------------------------------------------------
1273 
Read(SvStream & rIStm,ImplMetaReadData * pData)1274 void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
1275 {
1276 	COMPAT( rIStm );
1277 	rIStm	>> maPt;
1278 	rIStm.ReadByteString( maStr, pData->meActualCharSet );
1279 	rIStm	>> mnIndex;
1280 	rIStm	>> mnLen;
1281 
1282 	if ( aCompat.GetVersion() >= 2 )							// Version 2
1283 	{
1284 		sal_uInt16 nLen;
1285 		rIStm >> nLen;
1286 		sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
1287 		while ( nLen-- )
1288 			rIStm >> *pBuffer++;
1289 	}
1290 }
1291 
1292 // ========================================================================
1293 
MetaTextArrayAction()1294 MetaTextArrayAction::MetaTextArrayAction() :
1295 	MetaAction	( META_TEXTARRAY_ACTION ),
1296 	mpDXAry 	( NULL ),
1297 	mnIndex 	( 0 ),
1298 	mnLen		( 0 )
1299 {
1300 }
1301 
1302 // ------------------------------------------------------------------------
1303 
MetaTextArrayAction(const MetaTextArrayAction & rAction)1304 MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) :
1305 	MetaAction	( META_TEXTARRAY_ACTION ),
1306 	maStartPt	( rAction.maStartPt ),
1307 	maStr		( rAction.maStr ),
1308 	mnIndex 	( rAction.mnIndex ),
1309 	mnLen		( rAction.mnLen )
1310 {
1311 	if( rAction.mpDXAry )
1312 	{
1313 		const sal_uLong nAryLen = mnLen;
1314 
1315 		mpDXAry = new sal_Int32[ nAryLen ];
1316 		memcpy( mpDXAry, rAction.mpDXAry, nAryLen * sizeof( sal_Int32 ) );
1317 	}
1318 	else
1319 		mpDXAry = NULL;
1320 }
1321 
1322 // ------------------------------------------------------------------------
1323 
MetaTextArrayAction(const Point & rStartPt,const XubString & rStr,const sal_Int32 * pDXAry,sal_uInt16 nIndex,sal_uInt16 nLen)1324 MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
1325 										  const XubString& rStr,
1326 										  const sal_Int32* pDXAry,
1327 										  sal_uInt16 nIndex,
1328 										  sal_uInt16 nLen ) :
1329 	MetaAction	( META_TEXTARRAY_ACTION ),
1330 	maStartPt	( rStartPt ),
1331 	maStr		( rStr ),
1332 	mnIndex 	( nIndex ),
1333 	mnLen		( ( nLen == STRING_LEN ) ? rStr.Len() : nLen )
1334 {
1335     const sal_uLong nAryLen = pDXAry ? mnLen : 0;
1336 
1337 	if( nAryLen )
1338 	{
1339 		mpDXAry = new sal_Int32[ nAryLen ];
1340 		memcpy( mpDXAry, pDXAry, nAryLen * sizeof( sal_Int32 ) );
1341 	}
1342 	else
1343 		mpDXAry = NULL;
1344 }
1345 
1346 // ------------------------------------------------------------------------
1347 
~MetaTextArrayAction()1348 MetaTextArrayAction::~MetaTextArrayAction()
1349 {
1350 	delete[] mpDXAry;
1351 }
1352 
1353 // ------------------------------------------------------------------------
1354 
Execute(OutputDevice * pOut)1355 void MetaTextArrayAction::Execute( OutputDevice* pOut )
1356 {
1357 	pOut->DrawTextArray( maStartPt, maStr, mpDXAry, mnIndex, mnLen );
1358 }
1359 
1360 // ------------------------------------------------------------------------
1361 
Clone()1362 MetaAction* MetaTextArrayAction::Clone()
1363 {
1364 	MetaAction* pClone = (MetaAction*) new MetaTextArrayAction( *this );
1365 	pClone->ResetRefCount();
1366 	return pClone;
1367 }
1368 
1369 // ------------------------------------------------------------------------
1370 
Move(long nHorzMove,long nVertMove)1371 void MetaTextArrayAction::Move( long nHorzMove, long nVertMove )
1372 {
1373 	maStartPt.Move( nHorzMove, nVertMove );
1374 }
1375 
1376 // ------------------------------------------------------------------------
1377 
Scale(double fScaleX,double fScaleY)1378 void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
1379 {
1380 	ImplScalePoint( maStartPt, fScaleX, fScaleY );
1381 
1382 	if ( mpDXAry && mnLen )
1383 	{
1384 		for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
1385 			mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) );
1386 	}
1387 }
1388 
1389 // ------------------------------------------------------------------------
1390 
Compare(const MetaAction & rMetaAction) const1391 sal_Bool MetaTextArrayAction::Compare( const MetaAction& rMetaAction ) const
1392 {
1393 	return ( maStartPt == ((MetaTextArrayAction&)rMetaAction).maStartPt ) &&
1394 		   ( maStr == ((MetaTextArrayAction&)rMetaAction).maStr ) &&
1395 		   ( mnIndex == ((MetaTextArrayAction&)rMetaAction).mnIndex ) &&
1396 		   ( mnLen == ((MetaTextArrayAction&)rMetaAction).mnLen ) &&
1397 		   ( memcmp( mpDXAry, ((MetaTextArrayAction&)rMetaAction).mpDXAry, mnLen ) == 0 );
1398 }
1399 
1400 // ------------------------------------------------------------------------
1401 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1402 void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1403 {
1404     const sal_uInt32 nAryLen = mpDXAry ? mnLen : 0;
1405 
1406 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1407 	rOStm	<< maStartPt;
1408 	rOStm.WriteByteString( maStr, pData->meActualCharSet );
1409 	rOStm	<< mnIndex;
1410 	rOStm	<< mnLen;
1411 	rOStm	<< nAryLen;
1412 
1413 	for( sal_uLong i = 0UL; i < nAryLen; i++ )
1414 		rOStm << mpDXAry[ i ];
1415 
1416 	sal_uInt16 j, nLen = maStr.Len();							// version 2
1417 	rOStm << nLen;
1418 	for ( j = 0; j < nLen; j++ )
1419 	{
1420 		sal_Unicode nUni = maStr.GetChar( j );
1421 		rOStm << nUni;
1422 	}
1423 }
1424 
1425 // ------------------------------------------------------------------------
1426 
Read(SvStream & rIStm,ImplMetaReadData * pData)1427 void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
1428 {
1429 	sal_uInt32 nAryLen;
1430 
1431 	delete[] mpDXAry;
1432 
1433 	COMPAT( rIStm );
1434 	rIStm	>> maStartPt;
1435 	rIStm.ReadByteString( maStr, pData->meActualCharSet );
1436 	rIStm	>> mnIndex;
1437 	rIStm	>> mnLen;
1438 	rIStm	>> nAryLen;
1439 
1440 	if ( mnIndex + mnLen > maStr.Len() )
1441 	{
1442 		mnIndex = 0;
1443 		mpDXAry = 0;
1444 		return;
1445 	}
1446 
1447 	if( nAryLen )
1448 	{
1449         // #i9762#, #106172# Ensure that DX array is at least mnLen entries long
1450 		if ( mnLen >= nAryLen )
1451 		{
1452 			mpDXAry = new (std::nothrow)sal_Int32[ mnLen ];
1453 			if ( mpDXAry )
1454 			{
1455 	       		sal_uLong i;
1456 				for( i = 0UL; i < nAryLen; i++ )
1457 					rIStm >> mpDXAry[ i ];
1458 
1459 				// #106172# setup remainder
1460 				for( ; i < mnLen; i++ )
1461 					mpDXAry[ i ] = 0;
1462 			}
1463 		}
1464 		else
1465 		{
1466 			mpDXAry = NULL;
1467 			return;
1468 		}
1469 	}
1470 	else
1471 		mpDXAry = NULL;
1472 
1473 	if ( aCompat.GetVersion() >= 2 )							// Version 2
1474 	{
1475 		sal_uInt16 nLen;
1476 		rIStm >> nLen;
1477 		sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
1478 		while ( nLen-- )
1479 			rIStm >> *pBuffer++;
1480 
1481 		if ( mnIndex + mnLen > maStr.Len() )
1482 		{
1483 			mnIndex = 0;
1484 			delete[] mpDXAry, mpDXAry = NULL;
1485 		}
1486 	}
1487 }
1488 
1489 // ========================================================================
1490 
IMPL_META_ACTION(StretchText,META_STRETCHTEXT_ACTION)1491 IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION )
1492 
1493 // ------------------------------------------------------------------------
1494 
1495 MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
1496 											  const XubString& rStr,
1497 											  sal_uInt16 nIndex, sal_uInt16 nLen ) :
1498 	MetaAction	( META_STRETCHTEXT_ACTION ),
1499 	maPt		( rPt ),
1500 	maStr		( rStr ),
1501 	mnWidth 	( nWidth ),
1502 	mnIndex 	( nIndex ),
1503 	mnLen		( nLen )
1504 {
1505 }
1506 
1507 // ------------------------------------------------------------------------
1508 
Execute(OutputDevice * pOut)1509 void MetaStretchTextAction::Execute( OutputDevice* pOut )
1510 {
1511 	pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
1512 }
1513 
1514 // ------------------------------------------------------------------------
1515 
Clone()1516 MetaAction* MetaStretchTextAction::Clone()
1517 {
1518 	MetaAction* pClone = (MetaAction*) new MetaStretchTextAction( *this );
1519 	pClone->ResetRefCount();
1520 	return pClone;
1521 }
1522 
1523 // ------------------------------------------------------------------------
1524 
Move(long nHorzMove,long nVertMove)1525 void MetaStretchTextAction::Move( long nHorzMove, long nVertMove )
1526 {
1527 	maPt.Move( nHorzMove, nVertMove );
1528 }
1529 
1530 // ------------------------------------------------------------------------
1531 
Scale(double fScaleX,double fScaleY)1532 void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
1533 {
1534 	ImplScalePoint( maPt, fScaleX, fScaleY );
1535 	mnWidth = (sal_uLong)FRound( mnWidth * fabs(fScaleX) );
1536 }
1537 
1538 // ------------------------------------------------------------------------
1539 
Compare(const MetaAction & rMetaAction) const1540 sal_Bool MetaStretchTextAction::Compare( const MetaAction& rMetaAction ) const
1541 {
1542 	return ( maPt == ((MetaStretchTextAction&)rMetaAction).maPt ) &&
1543 		   ( maStr == ((MetaStretchTextAction&)rMetaAction).maStr ) &&
1544 		   ( mnWidth == ((MetaStretchTextAction&)rMetaAction).mnWidth ) &&
1545 		   ( mnIndex == ((MetaStretchTextAction&)rMetaAction).mnIndex ) &&
1546 		   ( mnLen == ((MetaStretchTextAction&)rMetaAction).mnLen );
1547 }
1548 
1549 // ------------------------------------------------------------------------
1550 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1551 void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1552 {
1553 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1554 	rOStm	<< maPt;
1555 	rOStm.WriteByteString( maStr, pData->meActualCharSet );
1556 	rOStm	<< mnWidth;
1557 	rOStm	<< mnIndex;
1558 	rOStm	<< mnLen;
1559 
1560 	sal_uInt16 i, nLen = maStr.Len();							// version 2
1561 	rOStm << nLen;
1562 	for ( i = 0; i < nLen; i++ )
1563 	{
1564 		sal_Unicode nUni = maStr.GetChar( i );
1565 		rOStm << nUni;
1566 	}
1567 }
1568 
1569 // ------------------------------------------------------------------------
1570 
Read(SvStream & rIStm,ImplMetaReadData * pData)1571 void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
1572 {
1573 	COMPAT( rIStm );
1574 	rIStm	>> maPt;
1575 	rIStm.ReadByteString( maStr, pData->meActualCharSet );
1576 	rIStm	>> mnWidth;
1577 	rIStm	>> mnIndex;
1578 	rIStm	>> mnLen;
1579 
1580 	if ( aCompat.GetVersion() >= 2 )							// Version 2
1581 	{
1582 		sal_uInt16 nLen;
1583 		rIStm >> nLen;
1584 		sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
1585 		while ( nLen-- )
1586 			rIStm >> *pBuffer++;
1587 	}
1588 }
1589 
1590 // ========================================================================
1591 
IMPL_META_ACTION(TextRect,META_TEXTRECT_ACTION)1592 IMPL_META_ACTION( TextRect, META_TEXTRECT_ACTION )
1593 
1594 // ------------------------------------------------------------------------
1595 
1596 MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect,
1597 										const XubString& rStr, sal_uInt16 nStyle ) :
1598 	MetaAction	( META_TEXTRECT_ACTION ),
1599 	maRect		( rRect ),
1600 	maStr		( rStr ),
1601 	mnStyle 	( nStyle )
1602 {
1603 }
1604 
1605 // ------------------------------------------------------------------------
1606 
Execute(OutputDevice * pOut)1607 void MetaTextRectAction::Execute( OutputDevice* pOut )
1608 {
1609 	pOut->DrawText( maRect, maStr, mnStyle );
1610 }
1611 
1612 // ------------------------------------------------------------------------
1613 
Clone()1614 MetaAction* MetaTextRectAction::Clone()
1615 {
1616 	MetaAction* pClone = (MetaAction*) new MetaTextRectAction( *this );
1617 	pClone->ResetRefCount();
1618 	return pClone;
1619 }
1620 
1621 // ------------------------------------------------------------------------
1622 
Move(long nHorzMove,long nVertMove)1623 void MetaTextRectAction::Move( long nHorzMove, long nVertMove )
1624 {
1625 	maRect.Move( nHorzMove, nVertMove );
1626 }
1627 
1628 // ------------------------------------------------------------------------
1629 
Scale(double fScaleX,double fScaleY)1630 void MetaTextRectAction::Scale( double fScaleX, double fScaleY )
1631 {
1632 	ImplScaleRect( maRect, fScaleX, fScaleY );
1633 }
1634 
1635 // ------------------------------------------------------------------------
1636 
Compare(const MetaAction & rMetaAction) const1637 sal_Bool MetaTextRectAction::Compare( const MetaAction& rMetaAction ) const
1638 {
1639 	return ( maRect == ((MetaTextRectAction&)rMetaAction).maRect ) &&
1640 		   ( maStr == ((MetaTextRectAction&)rMetaAction).maStr ) &&
1641 		   ( mnStyle == ((MetaTextRectAction&)rMetaAction).mnStyle );
1642 }
1643 
1644 // ------------------------------------------------------------------------
1645 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1646 void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1647 {
1648 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1649 	rOStm	<< maRect;
1650 	rOStm.WriteByteString( maStr, pData->meActualCharSet );
1651 	rOStm	<< mnStyle;
1652 
1653 	sal_uInt16 i, nLen = maStr.Len();							// version 2
1654 	rOStm << nLen;
1655 	for ( i = 0; i < nLen; i++ )
1656 	{
1657 		sal_Unicode nUni = maStr.GetChar( i );
1658 		rOStm << nUni;
1659 	}
1660 }
1661 
1662 // ------------------------------------------------------------------------
1663 
Read(SvStream & rIStm,ImplMetaReadData * pData)1664 void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
1665 {
1666 	COMPAT( rIStm );
1667 	rIStm	>> maRect;
1668 	rIStm.ReadByteString( maStr, pData->meActualCharSet );
1669 	rIStm	>> mnStyle;
1670 
1671 	if ( aCompat.GetVersion() >= 2 )							// Version 2
1672 	{
1673 		sal_uInt16 nLen;
1674 		rIStm >> nLen;
1675 		sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
1676 		while ( nLen-- )
1677 			rIStm >> *pBuffer++;
1678 	}
1679 }
1680 
1681 // ========================================================================
1682 
IMPL_META_ACTION(TextLine,META_TEXTLINE_ACTION)1683 IMPL_META_ACTION( TextLine, META_TEXTLINE_ACTION )
1684 
1685 // ------------------------------------------------------------------------
1686 
1687 MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth,
1688 										FontStrikeout eStrikeout,
1689 										FontUnderline eUnderline,
1690 										FontUnderline eOverline ) :
1691 	MetaAction	( META_TEXTLINE_ACTION ),
1692 	maPos		( rPos ),
1693 	mnWidth 	( nWidth ),
1694 	meStrikeout ( eStrikeout ),
1695 	meUnderline ( eUnderline ),
1696 	meOverline  ( eOverline )
1697 {
1698 }
1699 
1700 // ------------------------------------------------------------------------
1701 
Execute(OutputDevice * pOut)1702 void MetaTextLineAction::Execute( OutputDevice* pOut )
1703 {
1704 	pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline );
1705 }
1706 
1707 // ------------------------------------------------------------------------
1708 
Clone()1709 MetaAction* MetaTextLineAction::Clone()
1710 {
1711 	MetaAction* pClone = (MetaAction*)new MetaTextLineAction( *this );
1712 	pClone->ResetRefCount();
1713 	return pClone;
1714 }
1715 
1716 // ------------------------------------------------------------------------
1717 
Move(long nHorzMove,long nVertMove)1718 void MetaTextLineAction::Move( long nHorzMove, long nVertMove )
1719 {
1720 	maPos.Move( nHorzMove, nVertMove );
1721 }
1722 
1723 // ------------------------------------------------------------------------
1724 
Scale(double fScaleX,double fScaleY)1725 void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
1726 {
1727 	ImplScalePoint( maPos, fScaleX, fScaleY );
1728 	mnWidth = FRound( mnWidth * fabs(fScaleX) );
1729 }
1730 
1731 // ------------------------------------------------------------------------
1732 
Compare(const MetaAction & rMetaAction) const1733 sal_Bool MetaTextLineAction::Compare( const MetaAction& rMetaAction ) const
1734 {
1735 	return ( maPos == ((MetaTextLineAction&)rMetaAction).maPos ) &&
1736 		   ( mnWidth == ((MetaTextLineAction&)rMetaAction).mnWidth ) &&
1737 		   ( meStrikeout == ((MetaTextLineAction&)rMetaAction).meStrikeout ) &&
1738 		   ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline ) &&
1739 		   ( meOverline  == ((MetaTextLineAction&)rMetaAction).meOverline );
1740 }
1741 
1742 // ------------------------------------------------------------------------
1743 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1744 void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1745 {
1746 	WRITE_BASE_COMPAT( rOStm, 2, pData );
1747 
1748 	rOStm << maPos;
1749 	rOStm << mnWidth;
1750 	rOStm << static_cast<sal_uInt32>(meStrikeout);
1751 	rOStm << static_cast<sal_uInt32>(meUnderline);
1752     // new in version 2
1753 	rOStm << static_cast<sal_uInt32>(meOverline);
1754 }
1755 
1756 // ------------------------------------------------------------------------
1757 
Read(SvStream & rIStm,ImplMetaReadData *)1758 void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
1759 {
1760 	COMPAT( rIStm );
1761 
1762 	sal_uInt32 nTemp;
1763 	rIStm >> maPos;
1764 	rIStm >> mnWidth;
1765 	rIStm >> nTemp;
1766 	meStrikeout = (FontStrikeout)nTemp;
1767 	rIStm >> nTemp;
1768 	meUnderline = (FontUnderline)nTemp;
1769     if ( aCompat.GetVersion() >= 2 ) {
1770         rIStm >> nTemp;
1771         meUnderline = (FontUnderline)nTemp;
1772     }
1773 }
1774 
1775 // ========================================================================
1776 
IMPL_META_ACTION(Bmp,META_BMP_ACTION)1777 IMPL_META_ACTION( Bmp, META_BMP_ACTION )
1778 
1779 // ------------------------------------------------------------------------
1780 
1781 MetaBmpAction::MetaBmpAction( const Point& rPt, const Bitmap& rBmp ) :
1782 	MetaAction	( META_BMP_ACTION ),
1783 	maBmp		( rBmp ),
1784 	maPt		( rPt )
1785 {
1786 }
1787 
1788 // ------------------------------------------------------------------------
1789 
Execute(OutputDevice * pOut)1790 void MetaBmpAction::Execute( OutputDevice* pOut )
1791 {
1792 	pOut->DrawBitmap( maPt, maBmp );
1793 }
1794 
1795 // ------------------------------------------------------------------------
1796 
Clone()1797 MetaAction* MetaBmpAction::Clone()
1798 {
1799 	MetaAction* pClone = (MetaAction*) new MetaBmpAction( *this );
1800 	pClone->ResetRefCount();
1801 	return pClone;
1802 }
1803 
1804 // ------------------------------------------------------------------------
1805 
Move(long nHorzMove,long nVertMove)1806 void MetaBmpAction::Move( long nHorzMove, long nVertMove )
1807 {
1808 	maPt.Move( nHorzMove, nVertMove );
1809 }
1810 
1811 // ------------------------------------------------------------------------
1812 
Scale(double fScaleX,double fScaleY)1813 void MetaBmpAction::Scale( double fScaleX, double fScaleY )
1814 {
1815 	ImplScalePoint( maPt, fScaleX, fScaleY );
1816 }
1817 
1818 // ------------------------------------------------------------------------
1819 
Compare(const MetaAction & rMetaAction) const1820 sal_Bool MetaBmpAction::Compare( const MetaAction& rMetaAction ) const
1821 {
1822 	return maBmp.IsEqual(((MetaBmpAction&)rMetaAction).maBmp ) &&
1823 		   ( maPt == ((MetaBmpAction&)rMetaAction).maPt );
1824 }
1825 
1826 // ------------------------------------------------------------------------
1827 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1828 void MetaBmpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1829 {
1830 	if( !!maBmp )
1831 	{
1832 		WRITE_BASE_COMPAT( rOStm, 1, pData );
1833         WriteDIB(maBmp, rOStm, false, true);
1834 		rOStm << maPt;
1835 	}
1836 }
1837 
1838 // ------------------------------------------------------------------------
1839 
Read(SvStream & rIStm,ImplMetaReadData *)1840 void MetaBmpAction::Read( SvStream& rIStm, ImplMetaReadData* )
1841 {
1842 	COMPAT( rIStm );
1843     ReadDIB(maBmp, rIStm, true);
1844 	rIStm >> maPt;
1845 }
1846 
1847 // ========================================================================
1848 
IMPL_META_ACTION(BmpScale,META_BMPSCALE_ACTION)1849 IMPL_META_ACTION( BmpScale, META_BMPSCALE_ACTION )
1850 
1851 // ------------------------------------------------------------------------
1852 
1853 MetaBmpScaleAction::MetaBmpScaleAction( const Point& rPt, const Size& rSz,
1854 										const Bitmap& rBmp ) :
1855 	MetaAction	( META_BMPSCALE_ACTION ),
1856 	maBmp		( rBmp ),
1857 	maPt		( rPt ),
1858 	maSz		( rSz )
1859 {
1860 }
1861 
1862 // ------------------------------------------------------------------------
1863 
Execute(OutputDevice * pOut)1864 void MetaBmpScaleAction::Execute( OutputDevice* pOut )
1865 {
1866 	pOut->DrawBitmap( maPt, maSz, maBmp );
1867 }
1868 
1869 // ------------------------------------------------------------------------
1870 
Clone()1871 MetaAction* MetaBmpScaleAction::Clone()
1872 {
1873 	MetaAction* pClone = (MetaAction*) new MetaBmpScaleAction( *this );
1874 	pClone->ResetRefCount();
1875 	return pClone;
1876 }
1877 
1878 // ------------------------------------------------------------------------
1879 
Move(long nHorzMove,long nVertMove)1880 void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove )
1881 {
1882 	maPt.Move( nHorzMove, nVertMove );
1883 }
1884 
1885 // ------------------------------------------------------------------------
1886 
Scale(double fScaleX,double fScaleY)1887 void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY )
1888 {
1889     Rectangle aRectangle(maPt, maSz);
1890 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
1891     maPt = aRectangle.TopLeft();
1892     maSz = aRectangle.GetSize();
1893 }
1894 
1895 // ------------------------------------------------------------------------
1896 
Compare(const MetaAction & rMetaAction) const1897 sal_Bool MetaBmpScaleAction::Compare( const MetaAction& rMetaAction ) const
1898 {
1899 	return ( maBmp.IsEqual(((MetaBmpScaleAction&)rMetaAction).maBmp )) &&
1900 		   ( maPt == ((MetaBmpScaleAction&)rMetaAction).maPt ) &&
1901 		   ( maSz == ((MetaBmpScaleAction&)rMetaAction).maSz );
1902 }
1903 
1904 // ------------------------------------------------------------------------
1905 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1906 void MetaBmpScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1907 {
1908 	if( !!maBmp )
1909 	{
1910 		WRITE_BASE_COMPAT( rOStm, 1, pData );
1911         WriteDIB(maBmp, rOStm, false, true);
1912 		rOStm << maPt << maSz;
1913 	}
1914 }
1915 
1916 // ------------------------------------------------------------------------
1917 
Read(SvStream & rIStm,ImplMetaReadData *)1918 void MetaBmpScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
1919 {
1920 	COMPAT( rIStm );
1921     ReadDIB(maBmp, rIStm, true);
1922 	rIStm >> maPt >> maSz;
1923 }
1924 
1925 // ========================================================================
1926 
IMPL_META_ACTION(BmpScalePart,META_BMPSCALEPART_ACTION)1927 IMPL_META_ACTION( BmpScalePart, META_BMPSCALEPART_ACTION )
1928 
1929 // ------------------------------------------------------------------------
1930 
1931 MetaBmpScalePartAction::MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz,
1932 												const Point& rSrcPt, const Size& rSrcSz,
1933 												const Bitmap& rBmp ) :
1934 	MetaAction	( META_BMPSCALEPART_ACTION ),
1935 	maBmp		( rBmp ),
1936 	maDstPt 	( rDstPt ),
1937 	maDstSz 	( rDstSz ),
1938 	maSrcPt 	( rSrcPt ),
1939 	maSrcSz 	( rSrcSz )
1940 {
1941 }
1942 
1943 // ------------------------------------------------------------------------
1944 
Execute(OutputDevice * pOut)1945 void MetaBmpScalePartAction::Execute( OutputDevice* pOut )
1946 {
1947 	pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
1948 }
1949 
1950 // ------------------------------------------------------------------------
1951 
Clone()1952 MetaAction* MetaBmpScalePartAction::Clone()
1953 {
1954 	MetaAction* pClone = (MetaAction*) new MetaBmpScalePartAction( *this );
1955 	pClone->ResetRefCount();
1956 	return pClone;
1957 }
1958 
1959 // ------------------------------------------------------------------------
1960 
Move(long nHorzMove,long nVertMove)1961 void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove )
1962 {
1963 	maDstPt.Move( nHorzMove, nVertMove );
1964 }
1965 
1966 // ------------------------------------------------------------------------
1967 
Scale(double fScaleX,double fScaleY)1968 void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY )
1969 {
1970     Rectangle aRectangle(maDstPt, maDstSz);
1971 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
1972     maDstPt = aRectangle.TopLeft();
1973     maDstSz = aRectangle.GetSize();
1974 }
1975 
1976 // ------------------------------------------------------------------------
1977 
Compare(const MetaAction & rMetaAction) const1978 sal_Bool MetaBmpScalePartAction::Compare( const MetaAction& rMetaAction ) const
1979 {
1980 	return ( maBmp.IsEqual(((MetaBmpScalePartAction&)rMetaAction).maBmp )) &&
1981 		   ( maDstPt == ((MetaBmpScalePartAction&)rMetaAction).maDstPt ) &&
1982 		   ( maDstSz == ((MetaBmpScalePartAction&)rMetaAction).maDstSz ) &&
1983 		   ( maSrcPt == ((MetaBmpScalePartAction&)rMetaAction).maSrcPt ) &&
1984 		   ( maSrcSz == ((MetaBmpScalePartAction&)rMetaAction).maSrcSz );
1985 }
1986 
1987 // ------------------------------------------------------------------------
1988 
Write(SvStream & rOStm,ImplMetaWriteData * pData)1989 void MetaBmpScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
1990 {
1991 	if( !!maBmp )
1992 	{
1993 		WRITE_BASE_COMPAT( rOStm, 1, pData );
1994         WriteDIB(maBmp, rOStm, false, true);
1995 		rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz;
1996 	}
1997 }
1998 
1999 // ------------------------------------------------------------------------
2000 
Read(SvStream & rIStm,ImplMetaReadData *)2001 void MetaBmpScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
2002 {
2003 	COMPAT( rIStm );
2004     ReadDIB(maBmp, rIStm, true);
2005 	rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
2006 }
2007 
2008 // ========================================================================
2009 
IMPL_META_ACTION(BmpEx,META_BMPEX_ACTION)2010 IMPL_META_ACTION( BmpEx, META_BMPEX_ACTION )
2011 
2012 // ------------------------------------------------------------------------
2013 
2014 MetaBmpExAction::MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ) :
2015 	MetaAction	( META_BMPEX_ACTION ),
2016 	maBmpEx 	( rBmpEx ),
2017 	maPt		( rPt )
2018 {
2019 }
2020 
2021 // ------------------------------------------------------------------------
2022 
Execute(OutputDevice * pOut)2023 void MetaBmpExAction::Execute( OutputDevice* pOut )
2024 {
2025 	pOut->DrawBitmapEx( maPt, maBmpEx );
2026 }
2027 
2028 // ------------------------------------------------------------------------
2029 
Clone()2030 MetaAction* MetaBmpExAction::Clone()
2031 {
2032 	MetaBmpExAction* pClone = new MetaBmpExAction( *this );
2033 	pClone->ResetRefCount();
2034 	return pClone;
2035 }
2036 
2037 // ------------------------------------------------------------------------
2038 
Move(long nHorzMove,long nVertMove)2039 void MetaBmpExAction::Move( long nHorzMove, long nVertMove )
2040 {
2041 	maPt.Move( nHorzMove, nVertMove );
2042 }
2043 
2044 // ------------------------------------------------------------------------
2045 
Scale(double fScaleX,double fScaleY)2046 void MetaBmpExAction::Scale( double fScaleX, double fScaleY )
2047 {
2048 	ImplScalePoint( maPt, fScaleX, fScaleY );
2049 }
2050 
2051 // ------------------------------------------------------------------------
2052 
Compare(const MetaAction & rMetaAction) const2053 sal_Bool MetaBmpExAction::Compare( const MetaAction& rMetaAction ) const
2054 {
2055 	return ( maBmpEx.IsEqual(((MetaBmpExAction&)rMetaAction).maBmpEx )) &&
2056 		   ( maPt == ((MetaBmpExAction&)rMetaAction).maPt );
2057 }
2058 
2059 // ------------------------------------------------------------------------
2060 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2061 void MetaBmpExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2062 {
2063 	if( !!maBmpEx.GetBitmap() )
2064 	{
2065 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2066         WriteDIBBitmapEx(maBmpEx, rOStm);
2067 		rOStm << maPt;
2068 	}
2069 }
2070 
2071 // ------------------------------------------------------------------------
2072 
Read(SvStream & rIStm,ImplMetaReadData *)2073 void MetaBmpExAction::Read( SvStream& rIStm, ImplMetaReadData* )
2074 {
2075 	COMPAT( rIStm );
2076     ReadDIBBitmapEx(maBmpEx, rIStm);
2077 	rIStm >> maPt;
2078 }
2079 
2080 // ========================================================================
2081 
IMPL_META_ACTION(BmpExScale,META_BMPEXSCALE_ACTION)2082 IMPL_META_ACTION( BmpExScale, META_BMPEXSCALE_ACTION )
2083 
2084 // ------------------------------------------------------------------------
2085 
2086 MetaBmpExScaleAction::MetaBmpExScaleAction( const Point& rPt, const Size& rSz,
2087 											const BitmapEx& rBmpEx ) :
2088 	MetaAction	( META_BMPEXSCALE_ACTION ),
2089 	maBmpEx 	( rBmpEx ),
2090 	maPt		( rPt ),
2091 	maSz		( rSz )
2092 {
2093 }
2094 
2095 // ------------------------------------------------------------------------
2096 
Execute(OutputDevice * pOut)2097 void MetaBmpExScaleAction::Execute( OutputDevice* pOut )
2098 {
2099 	pOut->DrawBitmapEx( maPt, maSz, maBmpEx );
2100 }
2101 
2102 // ------------------------------------------------------------------------
2103 
Clone()2104 MetaAction* MetaBmpExScaleAction::Clone()
2105 {
2106 	MetaAction* pClone = (MetaAction*) new MetaBmpExScaleAction( *this );
2107 	pClone->ResetRefCount();
2108 	return pClone;
2109 }
2110 
2111 // ------------------------------------------------------------------------
2112 
Move(long nHorzMove,long nVertMove)2113 void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove )
2114 {
2115 	maPt.Move( nHorzMove, nVertMove );
2116 }
2117 
2118 // ------------------------------------------------------------------------
2119 
Scale(double fScaleX,double fScaleY)2120 void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY )
2121 {
2122     Rectangle aRectangle(maPt, maSz);
2123 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
2124     maPt = aRectangle.TopLeft();
2125     maSz = aRectangle.GetSize();
2126 }
2127 
2128 // ------------------------------------------------------------------------
2129 
Compare(const MetaAction & rMetaAction) const2130 sal_Bool MetaBmpExScaleAction::Compare( const MetaAction& rMetaAction ) const
2131 {
2132 	return ( maBmpEx.IsEqual(((MetaBmpExScaleAction&)rMetaAction).maBmpEx )) &&
2133 		   ( maPt == ((MetaBmpExScaleAction&)rMetaAction).maPt ) &&
2134 		   ( maSz == ((MetaBmpExScaleAction&)rMetaAction).maSz );
2135 }
2136 
2137 // ------------------------------------------------------------------------
2138 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2139 void MetaBmpExScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2140 {
2141 	if( !!maBmpEx.GetBitmap() )
2142 	{
2143 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2144         WriteDIBBitmapEx(maBmpEx, rOStm);
2145 		rOStm << maPt << maSz;
2146 	}
2147 }
2148 
2149 // ------------------------------------------------------------------------
2150 
Read(SvStream & rIStm,ImplMetaReadData *)2151 void MetaBmpExScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
2152 {
2153 	COMPAT( rIStm );
2154     ReadDIBBitmapEx(maBmpEx, rIStm);
2155 	rIStm >> maPt >> maSz;
2156 }
2157 
2158 // ========================================================================
2159 
IMPL_META_ACTION(BmpExScalePart,META_BMPEXSCALEPART_ACTION)2160 IMPL_META_ACTION( BmpExScalePart, META_BMPEXSCALEPART_ACTION )
2161 
2162 // ------------------------------------------------------------------------
2163 
2164 MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz,
2165 													const Point& rSrcPt, const Size& rSrcSz,
2166 													const BitmapEx& rBmpEx ) :
2167 	MetaAction	( META_BMPEXSCALEPART_ACTION ),
2168 	maBmpEx 	( rBmpEx ),
2169 	maDstPt 	( rDstPt ),
2170 	maDstSz 	( rDstSz ),
2171 	maSrcPt 	( rSrcPt ),
2172 	maSrcSz 	( rSrcSz )
2173 {
2174 }
2175 
2176 // ------------------------------------------------------------------------
2177 
Execute(OutputDevice * pOut)2178 void MetaBmpExScalePartAction::Execute( OutputDevice* pOut )
2179 {
2180 	pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
2181 }
2182 
2183 // ------------------------------------------------------------------------
2184 
Clone()2185 MetaAction* MetaBmpExScalePartAction::Clone()
2186 {
2187 	MetaAction* pClone = (MetaAction*) new MetaBmpExScalePartAction( *this );
2188 	pClone->ResetRefCount();
2189 	return pClone;
2190 }
2191 
2192 // ------------------------------------------------------------------------
2193 
Move(long nHorzMove,long nVertMove)2194 void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove )
2195 {
2196 	maDstPt.Move( nHorzMove, nVertMove );
2197 }
2198 
2199 // ------------------------------------------------------------------------
2200 
Scale(double fScaleX,double fScaleY)2201 void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY )
2202 {
2203     Rectangle aRectangle(maDstPt, maDstSz);
2204 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
2205     maDstPt = aRectangle.TopLeft();
2206     maDstSz = aRectangle.GetSize();
2207 }
2208 
2209 // ------------------------------------------------------------------------
2210 
Compare(const MetaAction & rMetaAction) const2211 sal_Bool MetaBmpExScalePartAction::Compare( const MetaAction& rMetaAction ) const
2212 {
2213 	return ( maBmpEx.IsEqual(((MetaBmpExScalePartAction&)rMetaAction).maBmpEx )) &&
2214 		   ( maDstPt == ((MetaBmpExScalePartAction&)rMetaAction).maDstPt ) &&
2215 		   ( maDstSz == ((MetaBmpExScalePartAction&)rMetaAction).maDstSz ) &&
2216 		   ( maSrcPt == ((MetaBmpExScalePartAction&)rMetaAction).maSrcPt ) &&
2217 		   ( maSrcSz == ((MetaBmpExScalePartAction&)rMetaAction).maSrcSz );
2218 }
2219 
2220 // ------------------------------------------------------------------------
2221 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2222 void MetaBmpExScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2223 {
2224 	if( !!maBmpEx.GetBitmap() )
2225 	{
2226 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2227         WriteDIBBitmapEx(maBmpEx, rOStm);
2228 		rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz;
2229 	}
2230 }
2231 
2232 // ------------------------------------------------------------------------
2233 
Read(SvStream & rIStm,ImplMetaReadData *)2234 void MetaBmpExScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
2235 {
2236 	COMPAT( rIStm );
2237     ReadDIBBitmapEx(maBmpEx, rIStm);
2238 	rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
2239 }
2240 
2241 // ========================================================================
2242 
IMPL_META_ACTION(Mask,META_MASK_ACTION)2243 IMPL_META_ACTION( Mask, META_MASK_ACTION )
2244 
2245 // ------------------------------------------------------------------------
2246 
2247 MetaMaskAction::MetaMaskAction( const Point& rPt,
2248 								const Bitmap& rBmp,
2249 								const Color& rColor ) :
2250 	MetaAction	( META_MASK_ACTION ),
2251 	maBmp		( rBmp ),
2252 	maColor 	( rColor ),
2253 	maPt		( rPt )
2254 {
2255 }
2256 
2257 // ------------------------------------------------------------------------
2258 
Execute(OutputDevice * pOut)2259 void MetaMaskAction::Execute( OutputDevice* pOut )
2260 {
2261 	pOut->DrawMask( maPt, maBmp, maColor );
2262 }
2263 
2264 // ------------------------------------------------------------------------
2265 
Clone()2266 MetaAction* MetaMaskAction::Clone()
2267 {
2268 	MetaAction* pClone = (MetaAction*) new MetaMaskAction( *this );
2269 	pClone->ResetRefCount();
2270 	return pClone;
2271 }
2272 
2273 // ------------------------------------------------------------------------
2274 
Move(long nHorzMove,long nVertMove)2275 void MetaMaskAction::Move( long nHorzMove, long nVertMove )
2276 {
2277 	maPt.Move( nHorzMove, nVertMove );
2278 }
2279 
2280 // ------------------------------------------------------------------------
2281 
Scale(double fScaleX,double fScaleY)2282 void MetaMaskAction::Scale( double fScaleX, double fScaleY )
2283 {
2284 	ImplScalePoint( maPt, fScaleX, fScaleY );
2285 }
2286 
2287 // ------------------------------------------------------------------------
2288 
Compare(const MetaAction & rMetaAction) const2289 sal_Bool MetaMaskAction::Compare( const MetaAction& rMetaAction ) const
2290 {
2291 	return ( maBmp.IsEqual(((MetaMaskAction&)rMetaAction).maBmp )) &&
2292 		   ( maColor == ((MetaMaskAction&)rMetaAction).maColor ) &&
2293 		   ( maPt == ((MetaMaskAction&)rMetaAction).maPt );
2294 }
2295 
2296 // ------------------------------------------------------------------------
2297 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2298 void MetaMaskAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2299 {
2300 	if( !!maBmp )
2301 	{
2302 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2303         WriteDIB(maBmp, rOStm, false, true);
2304 		rOStm << maPt;
2305 	}
2306 }
2307 
2308 // ------------------------------------------------------------------------
2309 
Read(SvStream & rIStm,ImplMetaReadData *)2310 void MetaMaskAction::Read( SvStream& rIStm, ImplMetaReadData* )
2311 {
2312 	COMPAT( rIStm );
2313     ReadDIB(maBmp, rIStm, true);
2314 	rIStm >> maPt;
2315 }
2316 
2317 // ========================================================================
2318 
IMPL_META_ACTION(MaskScale,META_MASKSCALE_ACTION)2319 IMPL_META_ACTION( MaskScale, META_MASKSCALE_ACTION )
2320 
2321 // ------------------------------------------------------------------------
2322 
2323 MetaMaskScaleAction::MetaMaskScaleAction( const Point& rPt, const Size& rSz,
2324 										  const Bitmap& rBmp,
2325 										  const Color& rColor ) :
2326 	MetaAction	( META_MASKSCALE_ACTION ),
2327 	maBmp		( rBmp ),
2328 	maColor 	( rColor ),
2329 	maPt		( rPt ),
2330 	maSz		( rSz )
2331 {
2332 }
2333 
2334 // ------------------------------------------------------------------------
2335 
Execute(OutputDevice * pOut)2336 void MetaMaskScaleAction::Execute( OutputDevice* pOut )
2337 {
2338 	pOut->DrawMask( maPt, maSz, maBmp, maColor );
2339 }
2340 
2341 // ------------------------------------------------------------------------
2342 
Clone()2343 MetaAction* MetaMaskScaleAction::Clone()
2344 {
2345 	MetaAction* pClone = (MetaAction*) new MetaMaskScaleAction( *this );
2346 	pClone->ResetRefCount();
2347 	return pClone;
2348 }
2349 
2350 // ------------------------------------------------------------------------
2351 
Move(long nHorzMove,long nVertMove)2352 void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove )
2353 {
2354 	maPt.Move( nHorzMove, nVertMove );
2355 }
2356 
2357 // ------------------------------------------------------------------------
2358 
Scale(double fScaleX,double fScaleY)2359 void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY )
2360 {
2361     Rectangle aRectangle(maPt, maSz);
2362 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
2363     maPt = aRectangle.TopLeft();
2364     maSz = aRectangle.GetSize();
2365 }
2366 
2367 // ------------------------------------------------------------------------
2368 
Compare(const MetaAction & rMetaAction) const2369 sal_Bool MetaMaskScaleAction::Compare( const MetaAction& rMetaAction ) const
2370 {
2371 	return ( maBmp.IsEqual(((MetaMaskScaleAction&)rMetaAction).maBmp )) &&
2372 		   ( maColor == ((MetaMaskScaleAction&)rMetaAction).maColor ) &&
2373 		   ( maPt == ((MetaMaskScaleAction&)rMetaAction).maPt ) &&
2374 		   ( maSz == ((MetaMaskScaleAction&)rMetaAction).maSz );
2375 }
2376 
2377 // ------------------------------------------------------------------------
2378 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2379 void MetaMaskScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2380 {
2381 	if( !!maBmp )
2382 	{
2383 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2384         WriteDIB(maBmp, rOStm, false, true);
2385 		rOStm << maPt << maSz;
2386 	}
2387 }
2388 
2389 // ------------------------------------------------------------------------
2390 
Read(SvStream & rIStm,ImplMetaReadData *)2391 void MetaMaskScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
2392 {
2393 	COMPAT( rIStm );
2394     ReadDIB(maBmp, rIStm, true);
2395 	rIStm >> maPt >> maSz;
2396 }
2397 
2398 // ========================================================================
2399 
IMPL_META_ACTION(MaskScalePart,META_MASKSCALEPART_ACTION)2400 IMPL_META_ACTION( MaskScalePart, META_MASKSCALEPART_ACTION )
2401 
2402 // ------------------------------------------------------------------------
2403 
2404 MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz,
2405 												  const Point& rSrcPt, const Size& rSrcSz,
2406 												  const Bitmap& rBmp,
2407 												  const Color& rColor ) :
2408 	MetaAction	( META_MASKSCALEPART_ACTION ),
2409 	maBmp		( rBmp ),
2410 	maColor 	( rColor ),
2411 	maDstPt 	( rDstPt ),
2412 	maDstSz 	( rDstSz ),
2413 	maSrcPt 	( rSrcPt ),
2414 	maSrcSz 	( rSrcSz )
2415 {
2416 }
2417 
2418 // ------------------------------------------------------------------------
2419 
Execute(OutputDevice * pOut)2420 void MetaMaskScalePartAction::Execute( OutputDevice* pOut )
2421 {
2422 	pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor );
2423 }
2424 
2425 // ------------------------------------------------------------------------
2426 
Clone()2427 MetaAction* MetaMaskScalePartAction::Clone()
2428 {
2429 	MetaAction* pClone = (MetaAction*) new MetaMaskScalePartAction( *this );
2430 	pClone->ResetRefCount();
2431 	return pClone;
2432 }
2433 
2434 // ------------------------------------------------------------------------
2435 
Move(long nHorzMove,long nVertMove)2436 void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove )
2437 {
2438 	maDstPt.Move( nHorzMove, nVertMove );
2439 }
2440 
2441 // ------------------------------------------------------------------------
2442 
Scale(double fScaleX,double fScaleY)2443 void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY )
2444 {
2445     Rectangle aRectangle(maDstPt, maDstSz);
2446 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
2447     maDstPt = aRectangle.TopLeft();
2448     maDstSz = aRectangle.GetSize();
2449 }
2450 
2451 // ------------------------------------------------------------------------
2452 
Compare(const MetaAction & rMetaAction) const2453 sal_Bool MetaMaskScalePartAction::Compare( const MetaAction& rMetaAction ) const
2454 {
2455 	return ( maBmp.IsEqual(((MetaMaskScalePartAction&)rMetaAction).maBmp )) &&
2456 		   ( maColor == ((MetaMaskScalePartAction&)rMetaAction).maColor ) &&
2457 		   ( maDstPt == ((MetaMaskScalePartAction&)rMetaAction).maDstPt ) &&
2458 		   ( maDstSz == ((MetaMaskScalePartAction&)rMetaAction).maDstSz ) &&
2459 		   ( maSrcPt == ((MetaMaskScalePartAction&)rMetaAction).maSrcPt ) &&
2460 		   ( maSrcSz == ((MetaMaskScalePartAction&)rMetaAction).maSrcSz );
2461 }
2462 
2463 // ------------------------------------------------------------------------
2464 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2465 void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2466 {
2467 	if( !!maBmp )
2468 	{
2469 		WRITE_BASE_COMPAT( rOStm, 1, pData );
2470         WriteDIB(maBmp, rOStm, false, true);
2471 		maColor.Write( rOStm, sal_True );
2472 		rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz;
2473 	}
2474 }
2475 
2476 // ------------------------------------------------------------------------
2477 
Read(SvStream & rIStm,ImplMetaReadData *)2478 void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
2479 {
2480 	COMPAT( rIStm );
2481     ReadDIB(maBmp, rIStm, true);
2482 	maColor.Read( rIStm, sal_True );
2483 	rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
2484 }
2485 
2486 // ========================================================================
2487 
IMPL_META_ACTION(Gradient,META_GRADIENT_ACTION)2488 IMPL_META_ACTION( Gradient, META_GRADIENT_ACTION )
2489 
2490 // ------------------------------------------------------------------------
2491 
2492 MetaGradientAction::MetaGradientAction( const Rectangle& rRect, const Gradient& rGradient ) :
2493 	MetaAction	( META_GRADIENT_ACTION ),
2494 	maRect		( rRect ),
2495 	maGradient	( rGradient )
2496 {
2497 }
2498 
2499 // ------------------------------------------------------------------------
2500 
Execute(OutputDevice * pOut)2501 void MetaGradientAction::Execute( OutputDevice* pOut )
2502 {
2503 	pOut->DrawGradient( maRect, maGradient );
2504 }
2505 
2506 // ------------------------------------------------------------------------
2507 
Clone()2508 MetaAction* MetaGradientAction::Clone()
2509 {
2510 	MetaAction* pClone = (MetaAction*) new MetaGradientAction( *this );
2511 	pClone->ResetRefCount();
2512 	return pClone;
2513 }
2514 
2515 // ------------------------------------------------------------------------
2516 
Move(long nHorzMove,long nVertMove)2517 void MetaGradientAction::Move( long nHorzMove, long nVertMove )
2518 {
2519 	maRect.Move( nHorzMove, nVertMove );
2520 }
2521 
2522 // ------------------------------------------------------------------------
2523 
Scale(double fScaleX,double fScaleY)2524 void MetaGradientAction::Scale( double fScaleX, double fScaleY )
2525 {
2526 	ImplScaleRect( maRect, fScaleX, fScaleY );
2527 }
2528 
2529 // ------------------------------------------------------------------------
2530 
Compare(const MetaAction & rMetaAction) const2531 sal_Bool MetaGradientAction::Compare( const MetaAction& rMetaAction ) const
2532 {
2533 	return ( maRect == ((MetaGradientAction&)rMetaAction).maRect ) &&
2534 		   ( maGradient == ((MetaGradientAction&)rMetaAction).maGradient );
2535 }
2536 
2537 // ------------------------------------------------------------------------
2538 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2539 void MetaGradientAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2540 {
2541 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2542 	rOStm << maRect << maGradient;
2543 }
2544 
2545 // ------------------------------------------------------------------------
2546 
Read(SvStream & rIStm,ImplMetaReadData *)2547 void MetaGradientAction::Read( SvStream& rIStm, ImplMetaReadData* )
2548 {
2549 	COMPAT( rIStm );
2550 	rIStm >> maRect >> maGradient;
2551 }
2552 
2553 // ========================================================================
2554 
MetaGradientExAction()2555 MetaGradientExAction::MetaGradientExAction() :
2556 	MetaAction	( META_GRADIENTEX_ACTION )
2557 {
2558 }
2559 
2560 // ------------------------------------------------------------------------
2561 
MetaGradientExAction(const PolyPolygon & rPolyPoly,const Gradient & rGradient)2562 MetaGradientExAction::MetaGradientExAction( const PolyPolygon& rPolyPoly, const Gradient& rGradient ) :
2563 	MetaAction	( META_GRADIENTEX_ACTION ),
2564 	maPolyPoly	( rPolyPoly ),
2565 	maGradient	( rGradient )
2566 {
2567 }
2568 
2569 // ------------------------------------------------------------------------
2570 
~MetaGradientExAction()2571 MetaGradientExAction::~MetaGradientExAction()
2572 {
2573 }
2574 
2575 // ------------------------------------------------------------------------
2576 
Execute(OutputDevice * pOut)2577 void MetaGradientExAction::Execute( OutputDevice* pOut )
2578 {
2579 	if( pOut->GetConnectMetaFile() )
2580     {
2581         Duplicate();
2582 		pOut->GetConnectMetaFile()->AddAction( this );
2583     }
2584 }
2585 
2586 // ------------------------------------------------------------------------
2587 
Clone()2588 MetaAction* MetaGradientExAction::Clone()
2589 {
2590 	MetaAction* pClone = (MetaAction*) new MetaGradientExAction( *this );
2591 	pClone->ResetRefCount();
2592 	return pClone;
2593 }
2594 
2595 // ------------------------------------------------------------------------
2596 
Move(long nHorzMove,long nVertMove)2597 void MetaGradientExAction::Move( long nHorzMove, long nVertMove )
2598 {
2599 	maPolyPoly.Move( nHorzMove, nVertMove );
2600 }
2601 
2602 // ------------------------------------------------------------------------
2603 
Scale(double fScaleX,double fScaleY)2604 void MetaGradientExAction::Scale( double fScaleX, double fScaleY )
2605 {
2606 	for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
2607 		ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
2608 }
2609 
2610 // ------------------------------------------------------------------------
2611 
Compare(const MetaAction & rMetaAction) const2612 sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const
2613 {
2614 	return ( maPolyPoly == ((MetaGradientExAction&)rMetaAction).maPolyPoly ) &&
2615 		   ( maGradient == ((MetaGradientExAction&)rMetaAction).maGradient );
2616 }
2617 
2618 // ------------------------------------------------------------------------
2619 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2620 void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2621 {
2622 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2623 
2624     // #i105373# see comment at MetaTransparentAction::Write
2625     PolyPolygon aNoCurvePolyPolygon;
2626     maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
2627 
2628     rOStm << aNoCurvePolyPolygon;
2629     rOStm << maGradient;
2630 }
2631 
2632 // ------------------------------------------------------------------------
2633 
Read(SvStream & rIStm,ImplMetaReadData *)2634 void MetaGradientExAction::Read( SvStream& rIStm, ImplMetaReadData* )
2635 {
2636 	COMPAT( rIStm );
2637 	rIStm >> maPolyPoly >> maGradient;
2638 }
2639 
2640 // ========================================================================
2641 
IMPL_META_ACTION(Hatch,META_HATCH_ACTION)2642 IMPL_META_ACTION( Hatch, META_HATCH_ACTION )
2643 
2644 // ------------------------------------------------------------------------
2645 
2646 MetaHatchAction::MetaHatchAction( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) :
2647 	MetaAction	( META_HATCH_ACTION ),
2648 	maPolyPoly	( rPolyPoly ),
2649 	maHatch 	( rHatch )
2650 {
2651 }
2652 
2653 // ------------------------------------------------------------------------
2654 
Execute(OutputDevice * pOut)2655 void MetaHatchAction::Execute( OutputDevice* pOut )
2656 {
2657 	pOut->DrawHatch( maPolyPoly, maHatch );
2658 }
2659 
2660 // ------------------------------------------------------------------------
2661 
Clone()2662 MetaAction* MetaHatchAction::Clone()
2663 {
2664 	MetaAction* pClone = (MetaAction*) new MetaHatchAction( *this );
2665 	pClone->ResetRefCount();
2666 	return pClone;
2667 }
2668 
2669 // ------------------------------------------------------------------------
2670 
Move(long nHorzMove,long nVertMove)2671 void MetaHatchAction::Move( long nHorzMove, long nVertMove )
2672 {
2673 	maPolyPoly.Move( nHorzMove, nVertMove );
2674 }
2675 
2676 // ------------------------------------------------------------------------
2677 
Scale(double fScaleX,double fScaleY)2678 void MetaHatchAction::Scale( double fScaleX, double fScaleY )
2679 {
2680 	for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
2681 		ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
2682 }
2683 
2684 // ------------------------------------------------------------------------
2685 
Compare(const MetaAction & rMetaAction) const2686 sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const
2687 {
2688 	return ( maPolyPoly == ((MetaHatchAction&)rMetaAction).maPolyPoly ) &&
2689 		   ( maHatch == ((MetaHatchAction&)rMetaAction).maHatch );
2690 }
2691 
2692 // ------------------------------------------------------------------------
2693 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2694 void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2695 {
2696 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2697 
2698     // #i105373# see comment at MetaTransparentAction::Write
2699     PolyPolygon aNoCurvePolyPolygon;
2700     maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
2701 
2702     rOStm << aNoCurvePolyPolygon;
2703     rOStm << maHatch;
2704 }
2705 
2706 // ------------------------------------------------------------------------
2707 
Read(SvStream & rIStm,ImplMetaReadData *)2708 void MetaHatchAction::Read( SvStream& rIStm, ImplMetaReadData* )
2709 {
2710 	COMPAT( rIStm );
2711 	rIStm >> maPolyPoly >> maHatch;
2712 }
2713 
2714 // ========================================================================
2715 
IMPL_META_ACTION(Wallpaper,META_WALLPAPER_ACTION)2716 IMPL_META_ACTION( Wallpaper, META_WALLPAPER_ACTION )
2717 
2718 // ------------------------------------------------------------------------
2719 
2720 MetaWallpaperAction::MetaWallpaperAction( const Rectangle& rRect,
2721 										  const Wallpaper& rPaper ) :
2722 	MetaAction	( META_WALLPAPER_ACTION ),
2723 	maRect		( rRect ),
2724 	maWallpaper ( rPaper )
2725 {
2726 }
2727 
2728 // ------------------------------------------------------------------------
2729 
Execute(OutputDevice * pOut)2730 void MetaWallpaperAction::Execute( OutputDevice* pOut )
2731 {
2732 	pOut->DrawWallpaper( maRect, maWallpaper );
2733 }
2734 
2735 // ------------------------------------------------------------------------
2736 
Clone()2737 MetaAction* MetaWallpaperAction::Clone()
2738 {
2739 	MetaAction* pClone = (MetaAction*) new MetaWallpaperAction( *this );
2740 	pClone->ResetRefCount();
2741 	return pClone;
2742 }
2743 
2744 // ------------------------------------------------------------------------
2745 
Move(long nHorzMove,long nVertMove)2746 void MetaWallpaperAction::Move( long nHorzMove, long nVertMove )
2747 {
2748 	maRect.Move( nHorzMove, nVertMove );
2749 }
2750 
2751 // ------------------------------------------------------------------------
2752 
Scale(double fScaleX,double fScaleY)2753 void MetaWallpaperAction::Scale( double fScaleX, double fScaleY )
2754 {
2755 	ImplScaleRect( maRect, fScaleX, fScaleY );
2756 }
2757 
2758 // ------------------------------------------------------------------------
2759 
Compare(const MetaAction & rMetaAction) const2760 sal_Bool MetaWallpaperAction::Compare( const MetaAction& rMetaAction ) const
2761 {
2762 	return ( maRect == ((MetaWallpaperAction&)rMetaAction).maRect ) &&
2763 		   ( maWallpaper == ((MetaWallpaperAction&)rMetaAction).maWallpaper );
2764 }
2765 
2766 // ------------------------------------------------------------------------
2767 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2768 void MetaWallpaperAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2769 {
2770 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2771 	rOStm << maWallpaper;
2772 }
2773 
2774 // ------------------------------------------------------------------------
2775 
Read(SvStream & rIStm,ImplMetaReadData *)2776 void MetaWallpaperAction::Read( SvStream& rIStm, ImplMetaReadData* )
2777 {
2778 	COMPAT( rIStm );
2779 	rIStm >> maWallpaper;
2780 }
2781 
2782 // ========================================================================
2783 
IMPL_META_ACTION(ClipRegion,META_CLIPREGION_ACTION)2784 IMPL_META_ACTION( ClipRegion, META_CLIPREGION_ACTION )
2785 
2786 // ------------------------------------------------------------------------
2787 
2788 MetaClipRegionAction::MetaClipRegionAction( const Region& rRegion, sal_Bool bClip ) :
2789 	MetaAction	( META_CLIPREGION_ACTION ),
2790 	maRegion	( rRegion ),
2791 	mbClip		( bClip )
2792 {
2793 }
2794 
2795 // ------------------------------------------------------------------------
2796 
Execute(OutputDevice * pOut)2797 void MetaClipRegionAction::Execute( OutputDevice* pOut )
2798 {
2799 	if( mbClip )
2800 		pOut->SetClipRegion( maRegion );
2801 	else
2802 		pOut->SetClipRegion();
2803 }
2804 
2805 // ------------------------------------------------------------------------
2806 
Clone()2807 MetaAction* MetaClipRegionAction::Clone()
2808 {
2809 	MetaAction* pClone = (MetaAction*) new MetaClipRegionAction( *this );
2810 	pClone->ResetRefCount();
2811 	return pClone;
2812 }
2813 
2814 // ------------------------------------------------------------------------
2815 
Move(long nHorzMove,long nVertMove)2816 void MetaClipRegionAction::Move( long nHorzMove, long nVertMove )
2817 {
2818 	maRegion.Move( nHorzMove, nVertMove );
2819 }
2820 
2821 // ------------------------------------------------------------------------
2822 
Scale(double fScaleX,double fScaleY)2823 void MetaClipRegionAction::Scale( double fScaleX, double fScaleY )
2824 {
2825 	maRegion.Scale( fScaleX, fScaleY );
2826 }
2827 
2828 // ------------------------------------------------------------------------
2829 
Compare(const MetaAction & rMetaAction) const2830 sal_Bool MetaClipRegionAction::Compare( const MetaAction& rMetaAction ) const
2831 {
2832 	return ( maRegion == ((MetaClipRegionAction&)rMetaAction).maRegion ) &&
2833 		   ( mbClip == ((MetaClipRegionAction&)rMetaAction).mbClip );
2834 }
2835 
2836 // ------------------------------------------------------------------------
2837 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2838 void MetaClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2839 {
2840 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2841 	rOStm << maRegion << mbClip;
2842 }
2843 
2844 // ------------------------------------------------------------------------
2845 
Read(SvStream & rIStm,ImplMetaReadData *)2846 void MetaClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
2847 {
2848 	COMPAT( rIStm );
2849 	rIStm >> maRegion >> mbClip;
2850 }
2851 
2852 // ========================================================================
2853 
IMPL_META_ACTION(ISectRectClipRegion,META_ISECTRECTCLIPREGION_ACTION)2854 IMPL_META_ACTION( ISectRectClipRegion, META_ISECTRECTCLIPREGION_ACTION )
2855 
2856 // ------------------------------------------------------------------------
2857 
2858 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const Rectangle& rRect ) :
2859 	MetaAction	( META_ISECTRECTCLIPREGION_ACTION ),
2860 	maRect		( rRect )
2861 {
2862 }
2863 
2864 // ------------------------------------------------------------------------
2865 
Execute(OutputDevice * pOut)2866 void MetaISectRectClipRegionAction::Execute( OutputDevice* pOut )
2867 {
2868 	pOut->IntersectClipRegion( maRect );
2869 }
2870 
2871 // ------------------------------------------------------------------------
2872 
Clone()2873 MetaAction* MetaISectRectClipRegionAction::Clone()
2874 {
2875 	MetaAction* pClone = (MetaAction*) new MetaISectRectClipRegionAction( *this );
2876 	pClone->ResetRefCount();
2877 	return pClone;
2878 }
2879 
2880 // ------------------------------------------------------------------------
2881 
Move(long nHorzMove,long nVertMove)2882 void MetaISectRectClipRegionAction::Move( long nHorzMove, long nVertMove )
2883 {
2884 	maRect.Move( nHorzMove, nVertMove );
2885 }
2886 
2887 // ------------------------------------------------------------------------
2888 
Scale(double fScaleX,double fScaleY)2889 void MetaISectRectClipRegionAction::Scale( double fScaleX, double fScaleY )
2890 {
2891 	ImplScaleRect( maRect, fScaleX, fScaleY );
2892 }
2893 
2894 // ------------------------------------------------------------------------
2895 
Compare(const MetaAction & rMetaAction) const2896 sal_Bool MetaISectRectClipRegionAction::Compare( const MetaAction& rMetaAction ) const
2897 {
2898 	return maRect == ((MetaISectRectClipRegionAction&)rMetaAction).maRect;
2899 }
2900 
2901 // ------------------------------------------------------------------------
2902 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2903 void MetaISectRectClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2904 {
2905 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2906 	rOStm << maRect;
2907 }
2908 
2909 // ------------------------------------------------------------------------
2910 
Read(SvStream & rIStm,ImplMetaReadData *)2911 void MetaISectRectClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
2912 {
2913 	COMPAT( rIStm );
2914 	rIStm >> maRect;
2915 }
2916 
2917 // ========================================================================
2918 
IMPL_META_ACTION(ISectRegionClipRegion,META_ISECTREGIONCLIPREGION_ACTION)2919 IMPL_META_ACTION( ISectRegionClipRegion, META_ISECTREGIONCLIPREGION_ACTION )
2920 
2921 // ------------------------------------------------------------------------
2922 
2923 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( const Region& rRegion ) :
2924 	MetaAction	( META_ISECTREGIONCLIPREGION_ACTION ),
2925 	maRegion	( rRegion )
2926 {
2927 }
2928 
2929 // ------------------------------------------------------------------------
2930 
Execute(OutputDevice * pOut)2931 void MetaISectRegionClipRegionAction::Execute( OutputDevice* pOut )
2932 {
2933 	pOut->IntersectClipRegion( maRegion );
2934 }
2935 
2936 // ------------------------------------------------------------------------
2937 
Clone()2938 MetaAction* MetaISectRegionClipRegionAction::Clone()
2939 {
2940 	MetaAction* pClone = (MetaAction*) new MetaISectRegionClipRegionAction( *this );
2941 	pClone->ResetRefCount();
2942 	return pClone;
2943 }
2944 
2945 // ------------------------------------------------------------------------
2946 
Move(long nHorzMove,long nVertMove)2947 void MetaISectRegionClipRegionAction::Move( long nHorzMove, long nVertMove )
2948 {
2949 	maRegion.Move( nHorzMove, nVertMove );
2950 }
2951 
2952 // ------------------------------------------------------------------------
2953 
Scale(double fScaleX,double fScaleY)2954 void MetaISectRegionClipRegionAction::Scale( double fScaleX, double fScaleY )
2955 {
2956 	maRegion.Scale( fScaleX, fScaleY );
2957 }
2958 
2959 // ------------------------------------------------------------------------
2960 
Compare(const MetaAction & rMetaAction) const2961 sal_Bool MetaISectRegionClipRegionAction::Compare( const MetaAction& rMetaAction ) const
2962 {
2963 	return maRegion == ((MetaISectRegionClipRegionAction&)rMetaAction).maRegion;
2964 }
2965 
2966 // ------------------------------------------------------------------------
2967 
Write(SvStream & rOStm,ImplMetaWriteData * pData)2968 void MetaISectRegionClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
2969 {
2970 	WRITE_BASE_COMPAT( rOStm, 1, pData );
2971 	rOStm << maRegion;
2972 }
2973 
2974 // ------------------------------------------------------------------------
2975 
Read(SvStream & rIStm,ImplMetaReadData *)2976 void MetaISectRegionClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
2977 {
2978 	COMPAT( rIStm );
2979 	rIStm >> maRegion;
2980 }
2981 
2982 // ========================================================================
2983 
IMPL_META_ACTION(MoveClipRegion,META_MOVECLIPREGION_ACTION)2984 IMPL_META_ACTION( MoveClipRegion, META_MOVECLIPREGION_ACTION )
2985 
2986 // ------------------------------------------------------------------------
2987 
2988 MetaMoveClipRegionAction::MetaMoveClipRegionAction( long nHorzMove, long nVertMove ) :
2989 	MetaAction	( META_MOVECLIPREGION_ACTION ),
2990 	mnHorzMove	( nHorzMove ),
2991 	mnVertMove	( nVertMove )
2992 {
2993 }
2994 
2995 // ------------------------------------------------------------------------
2996 
Execute(OutputDevice * pOut)2997 void MetaMoveClipRegionAction::Execute( OutputDevice* pOut )
2998 {
2999 	pOut->MoveClipRegion( mnHorzMove, mnVertMove );
3000 }
3001 
3002 // ------------------------------------------------------------------------
3003 
Clone()3004 MetaAction* MetaMoveClipRegionAction::Clone()
3005 {
3006 	MetaAction* pClone = (MetaAction*) new MetaMoveClipRegionAction( *this );
3007 	pClone->ResetRefCount();
3008 	return pClone;
3009 }
3010 
3011 // ------------------------------------------------------------------------
3012 
Scale(double fScaleX,double fScaleY)3013 void MetaMoveClipRegionAction::Scale( double fScaleX, double fScaleY )
3014 {
3015 	mnHorzMove = FRound( mnHorzMove * fScaleX );
3016 	mnVertMove = FRound( mnVertMove * fScaleY );
3017 }
3018 
3019 // ------------------------------------------------------------------------
3020 
Compare(const MetaAction & rMetaAction) const3021 sal_Bool MetaMoveClipRegionAction::Compare( const MetaAction& rMetaAction ) const
3022 {
3023 	return ( mnHorzMove == ((MetaMoveClipRegionAction&)rMetaAction).mnHorzMove ) &&
3024 		   ( mnVertMove == ((MetaMoveClipRegionAction&)rMetaAction).mnVertMove );
3025 }
3026 
3027 // ------------------------------------------------------------------------
3028 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3029 void MetaMoveClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3030 {
3031 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3032 	rOStm << mnHorzMove << mnVertMove;
3033 }
3034 
3035 // ------------------------------------------------------------------------
3036 
Read(SvStream & rIStm,ImplMetaReadData *)3037 void MetaMoveClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
3038 {
3039 	COMPAT( rIStm );
3040 	rIStm >> mnHorzMove >> mnVertMove;
3041 }
3042 
3043 // ========================================================================
3044 
IMPL_META_ACTION(LineColor,META_LINECOLOR_ACTION)3045 IMPL_META_ACTION( LineColor, META_LINECOLOR_ACTION )
3046 
3047 // ------------------------------------------------------------------------
3048 
3049 MetaLineColorAction::MetaLineColorAction( const Color& rColor, sal_Bool bSet ) :
3050 	MetaAction	( META_LINECOLOR_ACTION ),
3051 	maColor 	( rColor ),
3052 	mbSet		( bSet )
3053 {
3054 }
3055 
3056 // ------------------------------------------------------------------------
3057 
Execute(OutputDevice * pOut)3058 void MetaLineColorAction::Execute( OutputDevice* pOut )
3059 {
3060 	if( mbSet )
3061 		pOut->SetLineColor( maColor );
3062 	else
3063 		pOut->SetLineColor();
3064 }
3065 
3066 // ------------------------------------------------------------------------
3067 
Clone()3068 MetaAction* MetaLineColorAction::Clone()
3069 {
3070 	MetaAction* pClone = (MetaAction*) new MetaLineColorAction( *this );
3071 	pClone->ResetRefCount();
3072 	return pClone;
3073 }
3074 
3075 // ------------------------------------------------------------------------
3076 
Compare(const MetaAction & rMetaAction) const3077 sal_Bool MetaLineColorAction::Compare( const MetaAction& rMetaAction ) const
3078 {
3079 	return ( maColor == ((MetaLineColorAction&)rMetaAction).maColor ) &&
3080 		   ( mbSet == ((MetaLineColorAction&)rMetaAction).mbSet );
3081 }
3082 
3083 // ------------------------------------------------------------------------
3084 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3085 void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3086 {
3087 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3088 	maColor.Write( rOStm, sal_True );
3089 	rOStm << mbSet;
3090 }
3091 
3092 // ------------------------------------------------------------------------
3093 
Read(SvStream & rIStm,ImplMetaReadData *)3094 void MetaLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3095 {
3096 	COMPAT( rIStm );
3097 	maColor.Read( rIStm, sal_True );
3098 	rIStm >> mbSet;
3099 }
3100 
3101 // ========================================================================
3102 
IMPL_META_ACTION(FillColor,META_FILLCOLOR_ACTION)3103 IMPL_META_ACTION( FillColor, META_FILLCOLOR_ACTION )
3104 
3105 // ------------------------------------------------------------------------
3106 
3107 MetaFillColorAction::MetaFillColorAction( const Color& rColor, sal_Bool bSet ) :
3108 	MetaAction	( META_FILLCOLOR_ACTION ),
3109 	maColor 	( rColor ),
3110 	mbSet		( bSet )
3111 {
3112 }
3113 
3114 // ------------------------------------------------------------------------
3115 
Execute(OutputDevice * pOut)3116 void MetaFillColorAction::Execute( OutputDevice* pOut )
3117 {
3118 	if( mbSet )
3119 		pOut->SetFillColor( maColor );
3120 	else
3121 		pOut->SetFillColor();
3122 }
3123 
3124 // ------------------------------------------------------------------------
3125 
Clone()3126 MetaAction* MetaFillColorAction::Clone()
3127 {
3128 	MetaAction* pClone = (MetaAction*) new MetaFillColorAction( *this );
3129 	pClone->ResetRefCount();
3130 	return pClone;
3131 }
3132 
3133 // ------------------------------------------------------------------------
3134 
Compare(const MetaAction & rMetaAction) const3135 sal_Bool MetaFillColorAction::Compare( const MetaAction& rMetaAction ) const
3136 {
3137 	return ( maColor == ((MetaFillColorAction&)rMetaAction).maColor ) &&
3138 		   ( mbSet == ((MetaFillColorAction&)rMetaAction).mbSet );
3139 }
3140 
3141 // ------------------------------------------------------------------------
3142 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3143 void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3144 {
3145 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3146 	maColor.Write( rOStm, sal_True );
3147 	rOStm << mbSet;
3148 }
3149 
3150 // ------------------------------------------------------------------------
3151 
Read(SvStream & rIStm,ImplMetaReadData *)3152 void MetaFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3153 {
3154 	COMPAT( rIStm );
3155 	maColor.Read( rIStm, sal_True );
3156 	rIStm >> mbSet;
3157 }
3158 
3159 // ========================================================================
3160 
IMPL_META_ACTION(TextColor,META_TEXTCOLOR_ACTION)3161 IMPL_META_ACTION( TextColor, META_TEXTCOLOR_ACTION )
3162 
3163 // ------------------------------------------------------------------------
3164 
3165 MetaTextColorAction::MetaTextColorAction( const Color& rColor ) :
3166 	MetaAction	( META_TEXTCOLOR_ACTION ),
3167 	maColor 	( rColor )
3168 {
3169 }
3170 
3171 // ------------------------------------------------------------------------
3172 
Execute(OutputDevice * pOut)3173 void MetaTextColorAction::Execute( OutputDevice* pOut )
3174 {
3175 	pOut->SetTextColor( maColor );
3176 }
3177 
3178 // ------------------------------------------------------------------------
3179 
Clone()3180 MetaAction* MetaTextColorAction::Clone()
3181 {
3182 	MetaAction* pClone = (MetaAction*) new MetaTextColorAction( *this );
3183 	pClone->ResetRefCount();
3184 	return pClone;
3185 }
3186 
3187 // ------------------------------------------------------------------------
3188 
Compare(const MetaAction & rMetaAction) const3189 sal_Bool MetaTextColorAction::Compare( const MetaAction& rMetaAction ) const
3190 {
3191 	return maColor == ((MetaTextColorAction&)rMetaAction).maColor;
3192 }
3193 
3194 // ------------------------------------------------------------------------
3195 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3196 void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3197 {
3198 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3199 	maColor.Write( rOStm, sal_True );
3200 }
3201 
3202 // ------------------------------------------------------------------------
3203 
Read(SvStream & rIStm,ImplMetaReadData *)3204 void MetaTextColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3205 {
3206 	COMPAT( rIStm );
3207 	maColor.Read( rIStm, sal_True );
3208 }
3209 
3210 // ========================================================================
3211 
IMPL_META_ACTION(TextFillColor,META_TEXTFILLCOLOR_ACTION)3212 IMPL_META_ACTION( TextFillColor, META_TEXTFILLCOLOR_ACTION )
3213 
3214 // ------------------------------------------------------------------------
3215 
3216 MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, sal_Bool bSet ) :
3217 	MetaAction	( META_TEXTFILLCOLOR_ACTION ),
3218 	maColor 	( rColor ),
3219 	mbSet		( bSet )
3220 {
3221 }
3222 
3223 // ------------------------------------------------------------------------
3224 
Execute(OutputDevice * pOut)3225 void MetaTextFillColorAction::Execute( OutputDevice* pOut )
3226 {
3227 	if( mbSet )
3228 		pOut->SetTextFillColor( maColor );
3229 	else
3230 		pOut->SetTextFillColor();
3231 }
3232 
3233 // ------------------------------------------------------------------------
3234 
Clone()3235 MetaAction* MetaTextFillColorAction::Clone()
3236 {
3237 	MetaAction* pClone = (MetaAction*) new MetaTextFillColorAction( *this );
3238 	pClone->ResetRefCount();
3239 	return pClone;
3240 }
3241 
3242 // ------------------------------------------------------------------------
3243 
Compare(const MetaAction & rMetaAction) const3244 sal_Bool MetaTextFillColorAction::Compare( const MetaAction& rMetaAction ) const
3245 {
3246 	return ( maColor == ((MetaTextFillColorAction&)rMetaAction).maColor ) &&
3247 		   ( mbSet == ((MetaTextFillColorAction&)rMetaAction).mbSet );
3248 }
3249 
3250 // ------------------------------------------------------------------------
3251 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3252 void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3253 {
3254 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3255 	maColor.Write( rOStm, sal_True );
3256 	rOStm << mbSet;
3257 }
3258 
3259 // ------------------------------------------------------------------------
3260 
Read(SvStream & rIStm,ImplMetaReadData *)3261 void MetaTextFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3262 {
3263 	COMPAT( rIStm );
3264 	maColor.Read( rIStm, sal_True );
3265 	rIStm >> mbSet;
3266 }
3267 
3268 // ========================================================================
3269 
IMPL_META_ACTION(TextLineColor,META_TEXTLINECOLOR_ACTION)3270 IMPL_META_ACTION( TextLineColor, META_TEXTLINECOLOR_ACTION )
3271 
3272 // ------------------------------------------------------------------------
3273 
3274 MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, sal_Bool bSet ) :
3275 	MetaAction	( META_TEXTLINECOLOR_ACTION ),
3276 	maColor 	( rColor ),
3277 	mbSet		( bSet )
3278 {
3279 }
3280 
3281 // ------------------------------------------------------------------------
3282 
Execute(OutputDevice * pOut)3283 void MetaTextLineColorAction::Execute( OutputDevice* pOut )
3284 {
3285 	if( mbSet )
3286 		pOut->SetTextLineColor( maColor );
3287 	else
3288 		pOut->SetTextLineColor();
3289 }
3290 
3291 // ------------------------------------------------------------------------
3292 
Clone()3293 MetaAction* MetaTextLineColorAction::Clone()
3294 {
3295 	MetaAction* pClone = (MetaAction*) new MetaTextLineColorAction( *this );
3296 	pClone->ResetRefCount();
3297 	return pClone;
3298 }
3299 
3300 // ------------------------------------------------------------------------
3301 
Compare(const MetaAction & rMetaAction) const3302 sal_Bool MetaTextLineColorAction::Compare( const MetaAction& rMetaAction ) const
3303 {
3304 	return ( maColor == ((MetaTextLineColorAction&)rMetaAction).maColor ) &&
3305 		   ( mbSet == ((MetaTextLineColorAction&)rMetaAction).mbSet );
3306 }
3307 
3308 // ------------------------------------------------------------------------
3309 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3310 void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3311 {
3312 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3313 	maColor.Write( rOStm, sal_True );
3314 	rOStm << mbSet;
3315 }
3316 
3317 // ------------------------------------------------------------------------
3318 
Read(SvStream & rIStm,ImplMetaReadData *)3319 void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3320 {
3321 	COMPAT( rIStm );
3322 	maColor.Read( rIStm, sal_True );
3323 	rIStm >> mbSet;
3324 }
3325 
3326 // ========================================================================
3327 
IMPL_META_ACTION(OverlineColor,META_OVERLINECOLOR_ACTION)3328 IMPL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION )
3329 
3330 // ------------------------------------------------------------------------
3331 
3332 MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, sal_Bool bSet ) :
3333 	MetaAction	( META_OVERLINECOLOR_ACTION ),
3334 	maColor 	( rColor ),
3335 	mbSet		( bSet )
3336 {
3337 }
3338 
3339 // ------------------------------------------------------------------------
3340 
Execute(OutputDevice * pOut)3341 void MetaOverlineColorAction::Execute( OutputDevice* pOut )
3342 {
3343 	if( mbSet )
3344 		pOut->SetOverlineColor( maColor );
3345 	else
3346 		pOut->SetOverlineColor();
3347 }
3348 
3349 // ------------------------------------------------------------------------
3350 
Clone()3351 MetaAction* MetaOverlineColorAction::Clone()
3352 {
3353 	MetaAction* pClone = (MetaAction*) new MetaOverlineColorAction( *this );
3354 	pClone->ResetRefCount();
3355 	return pClone;
3356 }
3357 
3358 // ------------------------------------------------------------------------
3359 
Compare(const MetaAction & rMetaAction) const3360 sal_Bool MetaOverlineColorAction::Compare( const MetaAction& rMetaAction ) const
3361 {
3362 	return ( maColor == ((MetaOverlineColorAction&)rMetaAction).maColor ) &&
3363 		   ( mbSet == ((MetaOverlineColorAction&)rMetaAction).mbSet );
3364 }
3365 
3366 // ------------------------------------------------------------------------
3367 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3368 void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3369 {
3370 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3371 	maColor.Write( rOStm, sal_True );
3372 	rOStm << mbSet;
3373 }
3374 
3375 // ------------------------------------------------------------------------
3376 
Read(SvStream & rIStm,ImplMetaReadData *)3377 void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
3378 {
3379 	COMPAT( rIStm );
3380 	maColor.Read( rIStm, sal_True );
3381 	rIStm >> mbSet;
3382 }
3383 
3384 // ========================================================================
3385 
IMPL_META_ACTION(TextAlign,META_TEXTALIGN_ACTION)3386 IMPL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION )
3387 
3388 // ------------------------------------------------------------------------
3389 
3390 MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign ) :
3391 	MetaAction	( META_TEXTALIGN_ACTION ),
3392 	maAlign 	( aAlign )
3393 {
3394 }
3395 
3396 // ------------------------------------------------------------------------
3397 
Execute(OutputDevice * pOut)3398 void MetaTextAlignAction::Execute( OutputDevice* pOut )
3399 {
3400 	pOut->SetTextAlign( maAlign );
3401 }
3402 
3403 // ------------------------------------------------------------------------
3404 
Clone()3405 MetaAction* MetaTextAlignAction::Clone()
3406 {
3407 	MetaAction* pClone = (MetaAction*) new MetaTextAlignAction( *this );
3408 	pClone->ResetRefCount();
3409 	return pClone;
3410 }
3411 
3412 // ------------------------------------------------------------------------
3413 
Compare(const MetaAction & rMetaAction) const3414 sal_Bool MetaTextAlignAction::Compare( const MetaAction& rMetaAction ) const
3415 {
3416 	return maAlign == ((MetaTextAlignAction&)rMetaAction).maAlign;
3417 }
3418 
3419 // ------------------------------------------------------------------------
3420 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3421 void MetaTextAlignAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3422 {
3423 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3424 	rOStm << (sal_uInt16) maAlign;
3425 }
3426 
3427 // ------------------------------------------------------------------------
3428 
Read(SvStream & rIStm,ImplMetaReadData *)3429 void MetaTextAlignAction::Read( SvStream& rIStm, ImplMetaReadData* )
3430 {
3431 	sal_uInt16 nTmp16;
3432 
3433 	COMPAT( rIStm );
3434 	rIStm >> nTmp16; maAlign = (TextAlign) nTmp16;
3435 }
3436 
3437 // ========================================================================
3438 
IMPL_META_ACTION(MapMode,META_MAPMODE_ACTION)3439 IMPL_META_ACTION( MapMode, META_MAPMODE_ACTION )
3440 
3441 // ------------------------------------------------------------------------
3442 
3443 MetaMapModeAction::MetaMapModeAction( const MapMode& rMapMode ) :
3444 	MetaAction	( META_MAPMODE_ACTION ),
3445 	maMapMode	( rMapMode )
3446 {
3447 }
3448 
3449 // ------------------------------------------------------------------------
3450 
Execute(OutputDevice * pOut)3451 void MetaMapModeAction::Execute( OutputDevice* pOut )
3452 {
3453 	pOut->SetMapMode( maMapMode );
3454 }
3455 
3456 // ------------------------------------------------------------------------
3457 
Clone()3458 MetaAction* MetaMapModeAction::Clone()
3459 {
3460 	MetaAction* pClone = (MetaAction*) new MetaMapModeAction( *this );
3461 	pClone->ResetRefCount();
3462 	return pClone;
3463 }
3464 
3465 // ------------------------------------------------------------------------
3466 
Scale(double fScaleX,double fScaleY)3467 void MetaMapModeAction::Scale( double fScaleX, double fScaleY )
3468 {
3469 	Point aPoint( maMapMode.GetOrigin() );
3470 
3471 	ImplScalePoint( aPoint, fScaleX, fScaleY );
3472 	maMapMode.SetOrigin( aPoint );
3473 }
3474 
3475 // ------------------------------------------------------------------------
3476 
Compare(const MetaAction & rMetaAction) const3477 sal_Bool MetaMapModeAction::Compare( const MetaAction& rMetaAction ) const
3478 {
3479 	return maMapMode == ((MetaMapModeAction&)rMetaAction).maMapMode;
3480 }
3481 
3482 // ------------------------------------------------------------------------
3483 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3484 void MetaMapModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3485 {
3486 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3487 	rOStm << maMapMode;
3488 }
3489 
3490 // ------------------------------------------------------------------------
3491 
Read(SvStream & rIStm,ImplMetaReadData *)3492 void MetaMapModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
3493 {
3494 	COMPAT( rIStm );
3495 	rIStm >> maMapMode;
3496 }
3497 
3498 // ========================================================================
3499 
IMPL_META_ACTION(Font,META_FONT_ACTION)3500 IMPL_META_ACTION( Font, META_FONT_ACTION )
3501 
3502 // ------------------------------------------------------------------------
3503 
3504 MetaFontAction::MetaFontAction( const Font& rFont ) :
3505 	MetaAction	( META_FONT_ACTION ),
3506 	maFont		( rFont )
3507 {
3508     // #96876: because RTL_TEXTENCODING_SYMBOL is often set at the StarSymbol font,
3509     // we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems
3510     // to be the right way; changing the textencoding at other sources
3511     // is too dangerous at the moment
3512     if( ( ( maFont.GetName().SearchAscii( "StarSymbol" ) != STRING_NOTFOUND )
3513        || ( maFont.GetName().SearchAscii( "OpenSymbol" ) != STRING_NOTFOUND ) )
3514      && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
3515     {
3516         maFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
3517     }
3518 }
3519 
3520 // ------------------------------------------------------------------------
3521 
Execute(OutputDevice * pOut)3522 void MetaFontAction::Execute( OutputDevice* pOut )
3523 {
3524 	pOut->SetFont( maFont );
3525 }
3526 
3527 // ------------------------------------------------------------------------
3528 
Clone()3529 MetaAction* MetaFontAction::Clone()
3530 {
3531 	MetaAction* pClone = (MetaAction*) new MetaFontAction( *this );
3532 	pClone->ResetRefCount();
3533 	return pClone;
3534 }
3535 
3536 // ------------------------------------------------------------------------
3537 
Scale(double fScaleX,double fScaleY)3538 void MetaFontAction::Scale( double fScaleX, double fScaleY )
3539 {
3540 	const Size aSize(
3541         FRound(maFont.GetSize().Width() * fabs(fScaleX)),
3542         FRound(maFont.GetSize().Height() * fabs(fScaleY)));
3543 	maFont.SetSize( aSize );
3544 }
3545 
3546 // ------------------------------------------------------------------------
3547 
Compare(const MetaAction & rMetaAction) const3548 sal_Bool MetaFontAction::Compare( const MetaAction& rMetaAction ) const
3549 {
3550 	return maFont == ((MetaFontAction&)rMetaAction).maFont;
3551 }
3552 
3553 // ------------------------------------------------------------------------
3554 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3555 void MetaFontAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3556 {
3557 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3558 	rOStm << maFont;
3559 	pData->meActualCharSet = maFont.GetCharSet();
3560 	if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
3561 		pData->meActualCharSet = gsl_getSystemTextEncoding();
3562 }
3563 
3564 // ------------------------------------------------------------------------
3565 
Read(SvStream & rIStm,ImplMetaReadData * pData)3566 void MetaFontAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
3567 {
3568 	COMPAT( rIStm );
3569 	rIStm >> maFont;
3570 	pData->meActualCharSet = maFont.GetCharSet();
3571 	if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
3572 		pData->meActualCharSet = gsl_getSystemTextEncoding();
3573 }
3574 
3575 // ========================================================================
3576 
IMPL_META_ACTION(Push,META_PUSH_ACTION)3577 IMPL_META_ACTION( Push, META_PUSH_ACTION )
3578 
3579 // ------------------------------------------------------------------------
3580 
3581 MetaPushAction::MetaPushAction( sal_uInt16 nFlags ) :
3582 	MetaAction	( META_PUSH_ACTION ),
3583 	mnFlags 	( nFlags )
3584 {
3585 }
3586 
3587 // ------------------------------------------------------------------------
3588 
Execute(OutputDevice * pOut)3589 void MetaPushAction::Execute( OutputDevice* pOut )
3590 {
3591 	pOut->Push( mnFlags );
3592 }
3593 
3594 // ------------------------------------------------------------------------
3595 
Clone()3596 MetaAction* MetaPushAction::Clone()
3597 {
3598 	MetaAction* pClone = (MetaAction*) new MetaPushAction( *this );
3599 	pClone->ResetRefCount();
3600 	return pClone;
3601 }
3602 
3603 // ------------------------------------------------------------------------
3604 
Compare(const MetaAction & rMetaAction) const3605 sal_Bool MetaPushAction::Compare( const MetaAction& rMetaAction ) const
3606 {
3607 	return mnFlags == ((MetaPushAction&)rMetaAction).mnFlags;
3608 }
3609 
3610 // ------------------------------------------------------------------------
3611 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3612 void MetaPushAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3613 {
3614 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3615 	rOStm << mnFlags;
3616 }
3617 
3618 // ------------------------------------------------------------------------
3619 
Read(SvStream & rIStm,ImplMetaReadData *)3620 void MetaPushAction::Read( SvStream& rIStm, ImplMetaReadData* )
3621 {
3622 	COMPAT( rIStm );
3623 	rIStm >> mnFlags;
3624 }
3625 
3626 // ========================================================================
3627 
IMPL_META_ACTION(Pop,META_POP_ACTION)3628 IMPL_META_ACTION( Pop, META_POP_ACTION )
3629 
3630 // ------------------------------------------------------------------------
3631 
3632 void MetaPopAction::Execute( OutputDevice* pOut )
3633 {
3634 	pOut->Pop();
3635 }
3636 
3637 // ------------------------------------------------------------------------
3638 
Clone()3639 MetaAction* MetaPopAction::Clone()
3640 {
3641 	MetaAction* pClone = (MetaAction*) new MetaPopAction( *this );
3642 	pClone->ResetRefCount();
3643 	return pClone;
3644 }
3645 
3646 // ------------------------------------------------------------------------
3647 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3648 void MetaPopAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3649 {
3650 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3651 }
3652 
3653 // ------------------------------------------------------------------------
3654 
Read(SvStream & rIStm,ImplMetaReadData *)3655 void MetaPopAction::Read( SvStream& rIStm, ImplMetaReadData* )
3656 {
3657 	COMPAT( rIStm );
3658 }
3659 
3660 // ========================================================================
3661 
IMPL_META_ACTION(RasterOp,META_RASTEROP_ACTION)3662 IMPL_META_ACTION( RasterOp, META_RASTEROP_ACTION )
3663 
3664 // ------------------------------------------------------------------------
3665 
3666 MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp ) :
3667 	MetaAction	( META_RASTEROP_ACTION ),
3668 	meRasterOp	( eRasterOp )
3669 {
3670 }
3671 
3672 // ------------------------------------------------------------------------
3673 
Execute(OutputDevice * pOut)3674 void MetaRasterOpAction::Execute( OutputDevice* pOut )
3675 {
3676 	pOut->SetRasterOp( meRasterOp );
3677 }
3678 
3679 // ------------------------------------------------------------------------
3680 
Clone()3681 MetaAction* MetaRasterOpAction::Clone()
3682 {
3683 	MetaAction* pClone = (MetaAction*) new MetaRasterOpAction( *this );
3684 	pClone->ResetRefCount();
3685 	return pClone;
3686 }
3687 
3688 // ------------------------------------------------------------------------
3689 
Compare(const MetaAction & rMetaAction) const3690 sal_Bool MetaRasterOpAction::Compare( const MetaAction& rMetaAction ) const
3691 {
3692 	return meRasterOp == ((MetaRasterOpAction&)rMetaAction).meRasterOp;
3693 }
3694 
3695 // ------------------------------------------------------------------------
3696 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3697 void MetaRasterOpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3698 {
3699 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3700 	rOStm << (sal_uInt16) meRasterOp;
3701 }
3702 
3703 // ------------------------------------------------------------------------
3704 
Read(SvStream & rIStm,ImplMetaReadData *)3705 void MetaRasterOpAction::Read( SvStream& rIStm, ImplMetaReadData* )
3706 {
3707 	sal_uInt16 nTmp16;
3708 
3709 	COMPAT( rIStm );
3710 	rIStm >> nTmp16; meRasterOp = (RasterOp) nTmp16;
3711 }
3712 
3713 // ========================================================================
3714 
IMPL_META_ACTION(Transparent,META_TRANSPARENT_ACTION)3715 IMPL_META_ACTION( Transparent, META_TRANSPARENT_ACTION )
3716 
3717 // ------------------------------------------------------------------------
3718 
3719 MetaTransparentAction::MetaTransparentAction( const PolyPolygon& rPolyPoly, sal_uInt16 nTransPercent ) :
3720 	MetaAction		( META_TRANSPARENT_ACTION ),
3721 	maPolyPoly		( rPolyPoly ),
3722 	mnTransPercent	( nTransPercent )
3723 {
3724 }
3725 
3726 // ------------------------------------------------------------------------
3727 
Execute(OutputDevice * pOut)3728 void MetaTransparentAction::Execute( OutputDevice* pOut )
3729 {
3730 	pOut->DrawTransparent( maPolyPoly, mnTransPercent );
3731 }
3732 
3733 // ------------------------------------------------------------------------
3734 
Clone()3735 MetaAction* MetaTransparentAction::Clone()
3736 {
3737 	MetaAction* pClone = (MetaAction*) new MetaTransparentAction( *this );
3738 	pClone->ResetRefCount();
3739 	return pClone;
3740 }
3741 
3742 // ------------------------------------------------------------------------
3743 
Move(long nHorzMove,long nVertMove)3744 void MetaTransparentAction::Move( long nHorzMove, long nVertMove )
3745 {
3746 	maPolyPoly.Move( nHorzMove, nVertMove );
3747 }
3748 
3749 // ------------------------------------------------------------------------
3750 
Scale(double fScaleX,double fScaleY)3751 void MetaTransparentAction::Scale( double fScaleX, double fScaleY )
3752 {
3753 	for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
3754 		ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
3755 }
3756 
3757 // ------------------------------------------------------------------------
3758 
Compare(const MetaAction & rMetaAction) const3759 sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const
3760 {
3761 	return ( maPolyPoly == ((MetaTransparentAction&)rMetaAction).maPolyPoly ) &&
3762 		   ( mnTransPercent == ((MetaTransparentAction&)rMetaAction).mnTransPercent );
3763 }
3764 
3765 // ------------------------------------------------------------------------
3766 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3767 void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3768 {
3769 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3770 
3771     // #i105373# The PolyPolygon in this action may be a curve; this
3772     // was ignored until now what is an error. To make older office
3773     // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
3774     // to the PolyPoylgon.
3775     // The alternative would be to really write the curve information
3776     // like in MetaPolyPolygonAction::Write (where someone extended it
3777     // correctly, but not here :-( ).
3778     // The golden solution would be to combine both, but i think it's
3779     // not necessary; a good subdivision will be sufficient.
3780     PolyPolygon aNoCurvePolyPolygon;
3781     maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
3782 
3783     rOStm << aNoCurvePolyPolygon;
3784 	rOStm << mnTransPercent;
3785 }
3786 
3787 // ------------------------------------------------------------------------
3788 
Read(SvStream & rIStm,ImplMetaReadData *)3789 void MetaTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
3790 {
3791 	COMPAT( rIStm );
3792 	rIStm >> maPolyPoly;
3793 	rIStm >> mnTransPercent;
3794 }
3795 
3796 // ========================================================================
3797 
IMPL_META_ACTION(FloatTransparent,META_FLOATTRANSPARENT_ACTION)3798 IMPL_META_ACTION( FloatTransparent, META_FLOATTRANSPARENT_ACTION )
3799 
3800 // ------------------------------------------------------------------------
3801 
3802 MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos,
3803 														const Size& rSize, const Gradient& rGradient ) :
3804 	MetaAction		( META_FLOATTRANSPARENT_ACTION ),
3805 	maMtf			( rMtf ),
3806 	maPoint 		( rPos ),
3807 	maSize			( rSize ),
3808 	maGradient		( rGradient )
3809 {
3810 }
3811 
3812 // ------------------------------------------------------------------------
3813 
Execute(OutputDevice * pOut)3814 void MetaFloatTransparentAction::Execute( OutputDevice* pOut )
3815 {
3816 	pOut->DrawTransparent( maMtf, maPoint, maSize, maGradient );
3817 }
3818 
3819 // ------------------------------------------------------------------------
3820 
Clone()3821 MetaAction* MetaFloatTransparentAction::Clone()
3822 {
3823 	MetaAction* pClone = (MetaAction*) new MetaFloatTransparentAction( *this );
3824 	pClone->ResetRefCount();
3825 	return pClone;
3826 }
3827 
3828 // ------------------------------------------------------------------------
3829 
Move(long nHorzMove,long nVertMove)3830 void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
3831 {
3832 	maPoint.Move( nHorzMove, nVertMove );
3833 }
3834 
3835 // ------------------------------------------------------------------------
3836 
Scale(double fScaleX,double fScaleY)3837 void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
3838 {
3839     Rectangle aRectangle(maPoint, maSize);
3840 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
3841     maPoint = aRectangle.TopLeft();
3842     maSize = aRectangle.GetSize();
3843 }
3844 
3845 // ------------------------------------------------------------------------
3846 
Compare(const MetaAction & rMetaAction) const3847 sal_Bool MetaFloatTransparentAction::Compare( const MetaAction& rMetaAction ) const
3848 {
3849 	return ( maMtf == ((MetaFloatTransparentAction&)rMetaAction).maMtf ) &&
3850 		   ( maPoint == ((MetaFloatTransparentAction&)rMetaAction).maPoint ) &&
3851 		   ( maSize == ((MetaFloatTransparentAction&)rMetaAction).maSize ) &&
3852 		   ( maGradient == ((MetaFloatTransparentAction&)rMetaAction).maGradient );
3853 }
3854 
3855 // ------------------------------------------------------------------------
3856 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3857 void MetaFloatTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3858 {
3859 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3860 
3861 	maMtf.Write( rOStm );
3862 	rOStm << maPoint << maSize << maGradient;
3863 }
3864 
3865 // ------------------------------------------------------------------------
3866 
Read(SvStream & rIStm,ImplMetaReadData *)3867 void MetaFloatTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
3868 {
3869 	COMPAT( rIStm );
3870 	rIStm >> maMtf >> maPoint >> maSize >> maGradient;
3871 }
3872 
3873 // ========================================================================
3874 
IMPL_META_ACTION(EPS,META_EPS_ACTION)3875 IMPL_META_ACTION( EPS, META_EPS_ACTION )
3876 
3877 // ------------------------------------------------------------------------
3878 
3879 MetaEPSAction::MetaEPSAction( const Point& rPoint, const Size& rSize,
3880 							  const GfxLink& rGfxLink, const GDIMetaFile& rSubst ) :
3881 	MetaAction	( META_EPS_ACTION ),
3882 	maGfxLink	( rGfxLink ),
3883 	maSubst 	( rSubst ),
3884 	maPoint 	( rPoint ),
3885 	maSize		( rSize )
3886 {
3887 }
3888 
3889 // ------------------------------------------------------------------------
3890 
Execute(OutputDevice * pOut)3891 void MetaEPSAction::Execute( OutputDevice* pOut )
3892 {
3893 	pOut->DrawEPS( maPoint, maSize, maGfxLink, &maSubst );
3894 }
3895 
3896 // ------------------------------------------------------------------------
3897 
Clone()3898 MetaAction* MetaEPSAction::Clone()
3899 {
3900 	MetaAction* pClone = (MetaAction*) new MetaEPSAction( *this );
3901 	pClone->ResetRefCount();
3902 	return pClone;
3903 }
3904 
3905 // ------------------------------------------------------------------------
3906 
Move(long nHorzMove,long nVertMove)3907 void MetaEPSAction::Move( long nHorzMove, long nVertMove )
3908 {
3909 	maPoint.Move( nHorzMove, nVertMove );
3910 }
3911 
3912 // ------------------------------------------------------------------------
3913 
Scale(double fScaleX,double fScaleY)3914 void MetaEPSAction::Scale( double fScaleX, double fScaleY )
3915 {
3916     Rectangle aRectangle(maPoint, maSize);
3917 	ImplScaleRect( aRectangle, fScaleX, fScaleY );
3918     maPoint = aRectangle.TopLeft();
3919     maSize = aRectangle.GetSize();
3920 }
3921 
3922 // ------------------------------------------------------------------------
3923 
Compare(const MetaAction & rMetaAction) const3924 sal_Bool MetaEPSAction::Compare( const MetaAction& rMetaAction ) const
3925 {
3926 	return ( maGfxLink.IsEqual(((MetaEPSAction&)rMetaAction).maGfxLink )) &&
3927 		   ( maSubst == ((MetaEPSAction&)rMetaAction).maSubst ) &&
3928 		   ( maPoint == ((MetaEPSAction&)rMetaAction).maPoint ) &&
3929 		   ( maSize == ((MetaEPSAction&)rMetaAction).maSize );
3930 }
3931 
3932 // ------------------------------------------------------------------------
3933 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3934 void MetaEPSAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3935 {
3936 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3937 	rOStm << maGfxLink;
3938 	rOStm << maPoint;
3939 	rOStm << maSize;
3940 	maSubst.Write( rOStm );
3941 }
3942 
3943 // ------------------------------------------------------------------------
3944 
Read(SvStream & rIStm,ImplMetaReadData *)3945 void MetaEPSAction::Read( SvStream& rIStm, ImplMetaReadData* )
3946 {
3947 	COMPAT( rIStm );
3948 	rIStm >> maGfxLink;
3949 	rIStm >> maPoint;
3950 	rIStm >> maSize;
3951 	rIStm >> maSubst;
3952 }
3953 
3954 // ========================================================================
3955 
IMPL_META_ACTION(RefPoint,META_REFPOINT_ACTION)3956 IMPL_META_ACTION( RefPoint, META_REFPOINT_ACTION )
3957 
3958 // ------------------------------------------------------------------------
3959 
3960 MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, sal_Bool bSet ) :
3961 	MetaAction	( META_REFPOINT_ACTION ),
3962 	maRefPoint	( rRefPoint ),
3963 	mbSet		( bSet )
3964 {
3965 }
3966 
3967 // ------------------------------------------------------------------------
3968 
Execute(OutputDevice * pOut)3969 void MetaRefPointAction::Execute( OutputDevice* pOut )
3970 {
3971 	if( mbSet )
3972 		pOut->SetRefPoint( maRefPoint );
3973 	else
3974 		pOut->SetRefPoint();
3975 }
3976 
3977 // ------------------------------------------------------------------------
3978 
Clone()3979 MetaAction* MetaRefPointAction::Clone()
3980 {
3981 	MetaAction* pClone = (MetaAction*) new MetaRefPointAction( *this );
3982 	pClone->ResetRefCount();
3983 	return pClone;
3984 }
3985 
3986 // ------------------------------------------------------------------------
3987 
Compare(const MetaAction & rMetaAction) const3988 sal_Bool MetaRefPointAction::Compare( const MetaAction& rMetaAction ) const
3989 {
3990 	return ( maRefPoint == ((MetaRefPointAction&)rMetaAction).maRefPoint ) &&
3991 		   ( mbSet == ((MetaRefPointAction&)rMetaAction).mbSet );
3992 }
3993 
3994 // ------------------------------------------------------------------------
3995 
Write(SvStream & rOStm,ImplMetaWriteData * pData)3996 void MetaRefPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
3997 {
3998 	WRITE_BASE_COMPAT( rOStm, 1, pData );
3999 	rOStm << maRefPoint << mbSet;
4000 }
4001 
4002 // ------------------------------------------------------------------------
4003 
Read(SvStream & rIStm,ImplMetaReadData *)4004 void MetaRefPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
4005 {
4006 	COMPAT( rIStm );
4007 	rIStm >> maRefPoint >> mbSet;
4008 }
4009 
4010 // ========================================================================
4011 
MetaCommentAction(sal_Int32 nValue)4012 MetaCommentAction::MetaCommentAction( sal_Int32 nValue ) :
4013 	MetaAction	( META_COMMENT_ACTION ),
4014 	mnValue 	( nValue )
4015 {
4016 	ImplInitDynamicData( NULL, 0UL );
4017 }
4018 
4019 // ------------------------------------------------------------------------
4020 
MetaCommentAction(const MetaCommentAction & rAct)4021 MetaCommentAction::MetaCommentAction( const MetaCommentAction& rAct ) :
4022 	MetaAction	( META_COMMENT_ACTION ),
4023 	maComment	( rAct.maComment ),
4024 	mnValue 	( rAct.mnValue )
4025 {
4026 	ImplInitDynamicData( rAct.mpData, rAct.mnDataSize );
4027 }
4028 
4029 // ------------------------------------------------------------------------
4030 
MetaCommentAction(const ByteString & rComment,sal_Int32 nValue,const sal_uInt8 * pData,sal_uInt32 nDataSize)4031 MetaCommentAction::MetaCommentAction( const ByteString& rComment, sal_Int32 nValue, const sal_uInt8* pData, sal_uInt32 nDataSize ) :
4032 	MetaAction	( META_COMMENT_ACTION ),
4033 	maComment	( rComment ),
4034 	mnValue 	( nValue )
4035 {
4036 	ImplInitDynamicData( pData, nDataSize );
4037 }
4038 
4039 // ------------------------------------------------------------------------
4040 
MetaCommentAction(const sal_uInt8 * pData,sal_uInt32 nDataSize)4041 MetaCommentAction::MetaCommentAction( const sal_uInt8* pData, sal_uInt32 nDataSize ) :
4042 	MetaAction	( META_COMMENT_ACTION ),
4043 	mnValue 	( 0L )
4044 {
4045 	ImplInitDynamicData( pData, nDataSize );
4046 }
4047 
4048 // ------------------------------------------------------------------------
4049 
~MetaCommentAction()4050 MetaCommentAction::~MetaCommentAction()
4051 {
4052 	if ( mpData )
4053 		delete[] mpData;
4054 }
4055 
4056 // ------------------------------------------------------------------------
4057 
ImplInitDynamicData(const sal_uInt8 * pData,sal_uInt32 nDataSize)4058 void MetaCommentAction::ImplInitDynamicData( const sal_uInt8* pData, sal_uInt32 nDataSize )
4059 {
4060 	if ( nDataSize && pData )
4061 	{
4062 		mnDataSize = nDataSize, mpData = new sal_uInt8[ mnDataSize ];
4063 		memcpy( mpData, pData, mnDataSize );
4064 	}
4065 	else
4066 	{
4067 		mnDataSize = 0;
4068 		mpData = NULL;
4069 	}
4070 }
4071 
4072 // ------------------------------------------------------------------------
4073 
Execute(OutputDevice * pOut)4074 void MetaCommentAction::Execute( OutputDevice* pOut )
4075 {
4076 	if ( pOut->GetConnectMetaFile() )
4077     {
4078         Duplicate();
4079 		pOut->GetConnectMetaFile()->AddAction( this );
4080     }
4081 }
4082 
4083 // ------------------------------------------------------------------------
4084 
Clone()4085 MetaAction* MetaCommentAction::Clone()
4086 {
4087 	MetaAction* pClone = (MetaAction*) new MetaCommentAction( *this );
4088 	pClone->ResetRefCount();
4089 	return pClone;
4090 }
4091 
Move(long nXMove,long nYMove)4092 void MetaCommentAction::Move( long nXMove, long nYMove )
4093 {
4094 	if ( nXMove || nYMove )
4095 	{
4096 		if ( mnDataSize && mpData )
4097 		{
4098 			sal_Bool bPathStroke = maComment.Equals( "XPATHSTROKE_SEQ_BEGIN" );
4099 			if ( bPathStroke || maComment.Equals( "XPATHFILL_SEQ_BEGIN" ) )
4100 			{
4101 				SvMemoryStream	aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
4102 				SvMemoryStream	aDest;
4103 				if ( bPathStroke )
4104 				{
4105 					SvtGraphicStroke aStroke;
4106 					aMemStm >> aStroke;
4107 
4108                     Polygon aPath;
4109 					aStroke.getPath( aPath );
4110 					aPath.Move( nXMove, nYMove );
4111 					aStroke.setPath( aPath );
4112 
4113                     PolyPolygon aStartArrow;
4114                     aStroke.getStartArrow(aStartArrow);
4115                     aStartArrow.Move(nXMove, nYMove);
4116                     aStroke.setStartArrow(aStartArrow);
4117 
4118                     PolyPolygon aEndArrow;
4119                     aStroke.getEndArrow(aEndArrow);
4120                     aEndArrow.Move(nXMove, nYMove);
4121                     aStroke.setEndArrow(aEndArrow);
4122 
4123 					aDest << aStroke;
4124 				}
4125 				else
4126 				{
4127 					SvtGraphicFill aFill;
4128 					aMemStm >> aFill;
4129 
4130                     PolyPolygon aPath;
4131 					aFill.getPath( aPath );
4132 					aPath.Move( nXMove, nYMove );
4133 					aFill.setPath( aPath );
4134 
4135 					aDest << aFill;
4136 				}
4137 				delete[] mpData;
4138 				ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
4139 			}
4140 		}
4141 	}
4142 }
4143 
4144 // ------------------------------------------------------------------------
4145 // SJ: 25.07.06 #i56656# we are not able to mirrorcertain kind of
4146 // comments properly, especially the XPATHSTROKE and XPATHFILL lead to
4147 // problems, so it is better to remove these comments when mirroring
Scale(double fXScale,double fYScale)4148 void MetaCommentAction::Scale( double fXScale, double fYScale )
4149 {
4150 	if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
4151 	{
4152 		if ( mnDataSize && mpData )
4153 		{
4154 			sal_Bool bPathStroke = maComment.Equals( "XPATHSTROKE_SEQ_BEGIN" );
4155 			if ( bPathStroke || maComment.Equals( "XPATHFILL_SEQ_BEGIN" ) )
4156 			{
4157 				SvMemoryStream	aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
4158 				SvMemoryStream	aDest;
4159 				if ( bPathStroke )
4160 				{
4161 					SvtGraphicStroke aStroke;
4162 					aMemStm >> aStroke;
4163 					Polygon aPath;
4164 					aStroke.getPath( aPath );
4165 					aPath.Scale( fXScale, fYScale );
4166 					aStroke.setPath( aPath );
4167 					aDest << aStroke;
4168 				}
4169 				else
4170 				{
4171 					SvtGraphicFill aFill;
4172 					aMemStm >> aFill;
4173 					PolyPolygon aPath;
4174 					aFill.getPath( aPath );
4175 					aPath.Scale( fXScale, fYScale );
4176 					aFill.setPath( aPath );
4177 					aDest << aFill;
4178 				}
4179 				delete[] mpData;
4180 				ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
4181 			}
4182 		}
4183 	}
4184 }
4185 
4186 // ------------------------------------------------------------------------
4187 
Compare(const MetaAction & rMetaAction) const4188 sal_Bool MetaCommentAction::Compare( const MetaAction& rMetaAction ) const
4189 {
4190 	return ( maComment == ((MetaCommentAction&)rMetaAction).maComment ) &&
4191 		   ( mnValue == ((MetaCommentAction&)rMetaAction).mnValue ) &&
4192 		   ( mnDataSize == ((MetaCommentAction&)rMetaAction).mnDataSize ) &&
4193 		   ( memcmp( mpData, ((MetaCommentAction&)rMetaAction).mpData, mnDataSize ) == 0 );
4194 }
4195 
4196 // ------------------------------------------------------------------------
4197 
Write(SvStream & rOStm,ImplMetaWriteData * pData)4198 void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
4199 {
4200 	WRITE_BASE_COMPAT( rOStm, 1, pData );
4201 	rOStm << maComment << mnValue << mnDataSize;
4202 
4203 	if ( mnDataSize )
4204 		rOStm.Write( mpData, mnDataSize );
4205 }
4206 
4207 // ------------------------------------------------------------------------
4208 
Read(SvStream & rIStm,ImplMetaReadData *)4209 void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
4210 {
4211 	COMPAT( rIStm );
4212 	rIStm >> maComment >> mnValue >> mnDataSize;
4213 
4214 	if( mpData )
4215 		delete[] mpData;
4216 
4217 	if( mnDataSize )
4218 	{
4219 		mpData = new sal_uInt8[ mnDataSize ];
4220 		rIStm.Read( mpData, mnDataSize );
4221 	}
4222 	else
4223 		mpData = NULL;
4224 }
4225 
4226 // ========================================================================
4227 
IMPL_META_ACTION(LayoutMode,META_LAYOUTMODE_ACTION)4228 IMPL_META_ACTION( LayoutMode, META_LAYOUTMODE_ACTION )
4229 
4230 // ------------------------------------------------------------------------
4231 
4232 MetaLayoutModeAction::MetaLayoutModeAction( sal_uInt32 nLayoutMode ) :
4233 	MetaAction	( META_LAYOUTMODE_ACTION ),
4234 	mnLayoutMode( nLayoutMode )
4235 {
4236 }
4237 
4238 // ------------------------------------------------------------------------
4239 
Execute(OutputDevice * pOut)4240 void MetaLayoutModeAction::Execute( OutputDevice* pOut )
4241 {
4242 	pOut->SetLayoutMode( mnLayoutMode );
4243 }
4244 
4245 // ------------------------------------------------------------------------
4246 
Clone()4247 MetaAction* MetaLayoutModeAction::Clone()
4248 {
4249 	MetaAction* pClone = (MetaAction*) new MetaLayoutModeAction( *this );
4250 	pClone->ResetRefCount();
4251 	return pClone;
4252 }
4253 
4254 // ------------------------------------------------------------------------
4255 
Compare(const MetaAction & rMetaAction) const4256 sal_Bool MetaLayoutModeAction::Compare( const MetaAction& rMetaAction ) const
4257 {
4258 	return mnLayoutMode == ((MetaLayoutModeAction&)rMetaAction).mnLayoutMode;
4259 }
4260 
4261 // ------------------------------------------------------------------------
4262 
Write(SvStream & rOStm,ImplMetaWriteData * pData)4263 void MetaLayoutModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
4264 {
4265 	WRITE_BASE_COMPAT( rOStm, 1, pData );
4266 	rOStm << mnLayoutMode;
4267 }
4268 
4269 // ------------------------------------------------------------------------
4270 
Read(SvStream & rIStm,ImplMetaReadData *)4271 void MetaLayoutModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
4272 {
4273 	COMPAT( rIStm );
4274 	rIStm >> mnLayoutMode;
4275 }
4276 
4277 // ========================================================================
4278 
IMPL_META_ACTION(TextLanguage,META_TEXTLANGUAGE_ACTION)4279 IMPL_META_ACTION( TextLanguage, META_TEXTLANGUAGE_ACTION )
4280 
4281 // ------------------------------------------------------------------------
4282 
4283 MetaTextLanguageAction::MetaTextLanguageAction( LanguageType eTextLanguage ) :
4284 	MetaAction	( META_TEXTLANGUAGE_ACTION ),
4285 	meTextLanguage( eTextLanguage )
4286 {
4287 }
4288 
4289 // ------------------------------------------------------------------------
4290 
Execute(OutputDevice * pOut)4291 void MetaTextLanguageAction::Execute( OutputDevice* pOut )
4292 {
4293 	pOut->SetDigitLanguage( meTextLanguage );
4294 }
4295 
4296 // ------------------------------------------------------------------------
4297 
Clone()4298 MetaAction* MetaTextLanguageAction::Clone()
4299 {
4300 	MetaAction* pClone = (MetaAction*) new MetaTextLanguageAction( *this );
4301 	pClone->ResetRefCount();
4302 	return pClone;
4303 }
4304 
4305 // ------------------------------------------------------------------------
4306 
Compare(const MetaAction & rMetaAction) const4307 sal_Bool MetaTextLanguageAction::Compare( const MetaAction& rMetaAction ) const
4308 {
4309 	return meTextLanguage == ((MetaTextLanguageAction&)rMetaAction).meTextLanguage;
4310 }
4311 
4312 // ------------------------------------------------------------------------
4313 
Write(SvStream & rOStm,ImplMetaWriteData * pData)4314 void MetaTextLanguageAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
4315 {
4316 	WRITE_BASE_COMPAT( rOStm, 1, pData );
4317 	rOStm << meTextLanguage;
4318 }
4319 
4320 // ------------------------------------------------------------------------
4321 
Read(SvStream & rIStm,ImplMetaReadData *)4322 void MetaTextLanguageAction::Read( SvStream& rIStm, ImplMetaReadData* )
4323 {
4324 	COMPAT( rIStm );
4325 	rIStm >> meTextLanguage;
4326 }
4327 
4328 // eof
4329