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