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