1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: metaact.cxx,v $
10 * $Revision: 1.21.134.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #define ENABLE_BYTESTRING_STREAM_OPERATORS
38 #include <tools/stream.hxx>
39 #include <tools/vcompat.hxx>
40 #include <vcl/outdev.hxx>
41 #include <vcl/salbtype.hxx>
42 #include <vcl/metaact.hxx>
43 #include <vcl/graphictools.hxx>
45 // ========================================================================
47 inline void ImplScalePoint( Point
& rPt
, double fScaleX
, double fScaleY
)
49 rPt
.X() = FRound( fScaleX
* rPt
.X() );
50 rPt
.Y() = FRound( fScaleY
* rPt
.Y() );
53 // ------------------------------------------------------------------------
55 inline void ImplScaleSize( Size
& rSz
, double fScaleX
, double fScaleY
)
57 rSz
.Width() = FRound( fScaleX
* rSz
.Width() );
58 rSz
.Height() = FRound( fScaleY
* rSz
.Height() );
61 // ------------------------------------------------------------------------
63 inline void ImplScaleRect( Rectangle
& rRect
, double fScaleX
, double fScaleY
)
65 Point
aTL( rRect
.TopLeft() );
66 Point
aBR( rRect
.BottomRight() );
68 ImplScalePoint( aTL
, fScaleX
, fScaleY
);
69 ImplScalePoint( aBR
, fScaleX
, fScaleY
);
71 rRect
= Rectangle( aTL
, aBR
);
74 // ------------------------------------------------------------------------
76 inline void ImplScalePoly( Polygon
& rPoly
, double fScaleX
, double fScaleY
)
78 for( USHORT i
= 0, nCount
= rPoly
.GetSize(); i
< nCount
; i
++ )
79 ImplScalePoint( rPoly
[ i
], fScaleX
, fScaleY
);
82 // ------------------------------------------------------------------------
84 inline void ImplScaleLineInfo( LineInfo
& rLineInfo
, double fScaleX
, double fScaleY
)
86 if( !rLineInfo
.IsDefault() )
88 const double fScale
= ( fScaleX
+ fScaleY
) * 0.5;
90 rLineInfo
.SetWidth( FRound( fScale
* rLineInfo
.GetWidth() ) );
91 rLineInfo
.SetDashLen( FRound( fScale
* rLineInfo
.GetDashLen() ) );
92 rLineInfo
.SetDotLen( FRound( fScale
* rLineInfo
.GetDotLen() ) );
93 rLineInfo
.SetDistance( FRound( fScale
* rLineInfo
.GetDistance() ) );
97 // ========================================================================
99 #define COMPAT( _def_rIStm ) VersionCompat aCompat( ( _def_rIStm ), STREAM_READ );
100 #define COMPAT_VERSION() aCompat.GetVersion()
101 #define WRITE_BASE_COMPAT( _def_rOStm, _def_nVer, _pWriteData ) \
102 MetaAction::Write( ( _def_rOStm ), _pWriteData ); \
103 VersionCompat aCompat( ( _def_rOStm ), STREAM_WRITE, ( _def_nVer ) );
105 // ========================================================================
107 MetaAction::MetaAction() :
109 mnType( META_NULL_ACTION
)
113 // ------------------------------------------------------------------------
115 MetaAction::MetaAction( USHORT nType
) :
121 // ------------------------------------------------------------------------
123 MetaAction::~MetaAction()
127 // ------------------------------------------------------------------------
129 void MetaAction::Execute( OutputDevice
* )
133 // ------------------------------------------------------------------------
135 MetaAction
* MetaAction::Clone()
137 return new MetaAction
;
140 // ------------------------------------------------------------------------
142 void MetaAction::Move( long, long )
146 // ------------------------------------------------------------------------
148 void MetaAction::Scale( double, double )
152 // ------------------------------------------------------------------------
154 sal_Bool
MetaAction::Compare( const MetaAction
& ) const
159 // ------------------------------------------------------------------------
161 sal_Bool
MetaAction::IsEqual( const MetaAction
& rMetaAction
) const
163 if ( mnType
!= rMetaAction
.mnType
)
166 return Compare( rMetaAction
);
169 // ------------------------------------------------------------------------
171 void MetaAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* )
176 // ------------------------------------------------------------------------
178 void MetaAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
183 // ------------------------------------------------------------------------
185 MetaAction
* MetaAction::ReadMetaAction( SvStream
& rIStm
, ImplMetaReadData
* pData
)
187 MetaAction
* pAction
= NULL
;
194 case( META_NULL_ACTION
): pAction
= new MetaAction
; break;
195 case( META_PIXEL_ACTION
): pAction
= new MetaPixelAction
; break;
196 case( META_POINT_ACTION
): pAction
= new MetaPointAction
; break;
197 case( META_LINE_ACTION
): pAction
= new MetaLineAction
; break;
198 case( META_RECT_ACTION
): pAction
= new MetaRectAction
; break;
199 case( META_ROUNDRECT_ACTION
): pAction
= new MetaRoundRectAction
; break;
200 case( META_ELLIPSE_ACTION
): pAction
= new MetaEllipseAction
; break;
201 case( META_ARC_ACTION
): pAction
= new MetaArcAction
; break;
202 case( META_PIE_ACTION
): pAction
= new MetaPieAction
; break;
203 case( META_CHORD_ACTION
): pAction
= new MetaChordAction
; break;
204 case( META_POLYLINE_ACTION
): pAction
= new MetaPolyLineAction
; break;
205 case( META_POLYGON_ACTION
): pAction
= new MetaPolygonAction
; break;
206 case( META_POLYPOLYGON_ACTION
): pAction
= new MetaPolyPolygonAction
; break;
207 case( META_TEXT_ACTION
): pAction
= new MetaTextAction
; break;
208 case( META_TEXTARRAY_ACTION
): pAction
= new MetaTextArrayAction
; break;
209 case( META_STRETCHTEXT_ACTION
): pAction
= new MetaStretchTextAction
; break;
210 case( META_TEXTRECT_ACTION
): pAction
= new MetaTextRectAction
; break;
211 case( META_TEXTLINE_ACTION
): pAction
= new MetaTextLineAction
; break;
212 case( META_BMP_ACTION
): pAction
= new MetaBmpAction
; break;
213 case( META_BMPSCALE_ACTION
): pAction
= new MetaBmpScaleAction
; break;
214 case( META_BMPSCALEPART_ACTION
): pAction
= new MetaBmpScalePartAction
; break;
215 case( META_BMPEX_ACTION
): pAction
= new MetaBmpExAction
; break;
216 case( META_BMPEXSCALE_ACTION
): pAction
= new MetaBmpExScaleAction
; break;
217 case( META_BMPEXSCALEPART_ACTION
): pAction
= new MetaBmpExScalePartAction
; break;
218 case( META_MASK_ACTION
): pAction
= new MetaMaskAction
; break;
219 case( META_MASKSCALE_ACTION
): pAction
= new MetaMaskScaleAction
; break;
220 case( META_MASKSCALEPART_ACTION
): pAction
= new MetaMaskScalePartAction
; break;
221 case( META_GRADIENT_ACTION
): pAction
= new MetaGradientAction
; break;
222 case( META_GRADIENTEX_ACTION
): pAction
= new MetaGradientExAction
; break;
223 case( META_HATCH_ACTION
): pAction
= new MetaHatchAction
; break;
224 case( META_WALLPAPER_ACTION
): pAction
= new MetaWallpaperAction
; break;
225 case( META_CLIPREGION_ACTION
): pAction
= new MetaClipRegionAction
; break;
226 case( META_ISECTRECTCLIPREGION_ACTION
): pAction
= new MetaISectRectClipRegionAction
; break;
227 case( META_ISECTREGIONCLIPREGION_ACTION
): pAction
= new MetaISectRegionClipRegionAction
; break;
228 case( META_MOVECLIPREGION_ACTION
): pAction
= new MetaMoveClipRegionAction
; break;
229 case( META_LINECOLOR_ACTION
): pAction
= new MetaLineColorAction
; break;
230 case( META_FILLCOLOR_ACTION
): pAction
= new MetaFillColorAction
; break;
231 case( META_TEXTCOLOR_ACTION
): pAction
= new MetaTextColorAction
; break;
232 case( META_TEXTFILLCOLOR_ACTION
): pAction
= new MetaTextFillColorAction
; break;
233 case( META_TEXTLINECOLOR_ACTION
): pAction
= new MetaTextLineColorAction
; break;
234 case( META_OVERLINECOLOR_ACTION
): pAction
= new MetaOverlineColorAction
; break;
235 case( META_TEXTALIGN_ACTION
): pAction
= new MetaTextAlignAction
; break;
236 case( META_MAPMODE_ACTION
): pAction
= new MetaMapModeAction
; break;
237 case( META_FONT_ACTION
): pAction
= new MetaFontAction
; break;
238 case( META_PUSH_ACTION
): pAction
= new MetaPushAction
; break;
239 case( META_POP_ACTION
): pAction
= new MetaPopAction
; break;
240 case( META_RASTEROP_ACTION
): pAction
= new MetaRasterOpAction
; break;
241 case( META_TRANSPARENT_ACTION
): pAction
= new MetaTransparentAction
; break;
242 case( META_FLOATTRANSPARENT_ACTION
): pAction
= new MetaFloatTransparentAction
; break;
243 case( META_EPS_ACTION
): pAction
= new MetaEPSAction
; break;
244 case( META_REFPOINT_ACTION
): pAction
= new MetaRefPointAction
; break;
245 case( META_COMMENT_ACTION
): pAction
= new MetaCommentAction
; break;
246 case( META_LAYOUTMODE_ACTION
): pAction
= new MetaLayoutModeAction
; break;
247 case( META_TEXTLANGUAGE_ACTION
): pAction
= new MetaTextLanguageAction
; break;
251 // Action ueberlesen durch Kombination Ctor/Dtor,
252 // new/delete, weil Compiler sonst vielleicht wegoptimieren
253 delete ( new VersionCompat( rIStm
, STREAM_READ
) );
259 pAction
->Read( rIStm
, pData
);
264 // ========================================================================
266 IMPL_META_ACTION( Pixel
, META_PIXEL_ACTION
)
268 // ------------------------------------------------------------------------
270 MetaPixelAction::MetaPixelAction( const Point
& rPt
, const Color
& rColor
) :
271 MetaAction ( META_PIXEL_ACTION
),
277 // ------------------------------------------------------------------------
279 void MetaPixelAction::Execute( OutputDevice
* pOut
)
281 pOut
->DrawPixel( maPt
, maColor
);
284 // ------------------------------------------------------------------------
286 MetaAction
* MetaPixelAction::Clone()
288 MetaAction
* pClone
= (MetaAction
*) new MetaPixelAction( *this );
289 pClone
->ResetRefCount();
293 // ------------------------------------------------------------------------
295 void MetaPixelAction::Move( long nHorzMove
, long nVertMove
)
297 maPt
.Move( nHorzMove
, nVertMove
);
300 // ------------------------------------------------------------------------
302 void MetaPixelAction::Scale( double fScaleX
, double fScaleY
)
304 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
307 // ------------------------------------------------------------------------
309 sal_Bool
MetaPixelAction::Compare( const MetaAction
& rMetaAction
) const
311 return ( maPt
== ((MetaPixelAction
&)rMetaAction
).maPt
) &&
312 ( maColor
== ((MetaPixelAction
&)rMetaAction
).maColor
);
315 // ------------------------------------------------------------------------
317 void MetaPixelAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
319 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
321 maColor
.Write( rOStm
, TRUE
);
324 // ------------------------------------------------------------------------
326 void MetaPixelAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
330 maColor
.Read( rIStm
, TRUE
);
333 // ========================================================================
335 IMPL_META_ACTION( Point
, META_POINT_ACTION
)
337 // ------------------------------------------------------------------------
339 MetaPointAction::MetaPointAction( const Point
& rPt
) :
340 MetaAction ( META_POINT_ACTION
),
345 // ------------------------------------------------------------------------
347 void MetaPointAction::Execute( OutputDevice
* pOut
)
349 pOut
->DrawPixel( maPt
);
352 // ------------------------------------------------------------------------
354 MetaAction
* MetaPointAction::Clone()
356 MetaAction
* pClone
= (MetaAction
*) new MetaPointAction( *this );
357 pClone
->ResetRefCount();
361 // ------------------------------------------------------------------------
363 void MetaPointAction::Move( long nHorzMove
, long nVertMove
)
365 maPt
.Move( nHorzMove
, nVertMove
);
368 // ------------------------------------------------------------------------
370 void MetaPointAction::Scale( double fScaleX
, double fScaleY
)
372 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
375 // ------------------------------------------------------------------------
377 sal_Bool
MetaPointAction::Compare( const MetaAction
& rMetaAction
) const
379 return maPt
== ((MetaPointAction
&)rMetaAction
).maPt
;
382 // ------------------------------------------------------------------------
384 void MetaPointAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
386 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
390 // ------------------------------------------------------------------------
392 void MetaPointAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
398 // ========================================================================
400 IMPL_META_ACTION( Line
, META_LINE_ACTION
)
402 // ------------------------------------------------------------------------
404 MetaLineAction::MetaLineAction( const Point
& rStart
, const Point
& rEnd
) :
405 MetaAction ( META_LINE_ACTION
),
406 maStartPt ( rStart
),
411 // ------------------------------------------------------------------------
413 MetaLineAction::MetaLineAction( const Point
& rStart
, const Point
& rEnd
,
414 const LineInfo
& rLineInfo
) :
415 MetaAction ( META_LINE_ACTION
),
416 maLineInfo ( rLineInfo
),
417 maStartPt ( rStart
),
422 // ------------------------------------------------------------------------
424 void MetaLineAction::Execute( OutputDevice
* pOut
)
426 if( maLineInfo
.IsDefault() )
427 pOut
->DrawLine( maStartPt
, maEndPt
);
429 pOut
->DrawLine( maStartPt
, maEndPt
, maLineInfo
);
432 // ------------------------------------------------------------------------
434 MetaAction
* MetaLineAction::Clone()
436 MetaAction
* pClone
= (MetaAction
*) new MetaLineAction( *this );
437 pClone
->ResetRefCount();
441 // ------------------------------------------------------------------------
443 void MetaLineAction::Move( long nHorzMove
, long nVertMove
)
445 maStartPt
.Move( nHorzMove
, nVertMove
);
446 maEndPt
.Move( nHorzMove
, nVertMove
);
449 // ------------------------------------------------------------------------
451 void MetaLineAction::Scale( double fScaleX
, double fScaleY
)
453 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
454 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
455 ImplScaleLineInfo( maLineInfo
, fScaleX
, fScaleY
);
458 // ------------------------------------------------------------------------
460 sal_Bool
MetaLineAction::Compare( const MetaAction
& rMetaAction
) const
462 return ( maLineInfo
== ((MetaLineAction
&)rMetaAction
).maLineInfo
) &&
463 ( maStartPt
== ((MetaLineAction
&)rMetaAction
).maStartPt
) &&
464 ( maEndPt
== ((MetaLineAction
&)rMetaAction
).maEndPt
);
467 // ------------------------------------------------------------------------
469 void MetaLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
471 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
473 rOStm
<< maStartPt
<< maEndPt
; // Version 1
474 rOStm
<< maLineInfo
; // Version 2
477 // ------------------------------------------------------------------------
479 void MetaLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
484 rIStm
>> maStartPt
>> maEndPt
;
487 if( aCompat
.GetVersion() >= 2 )
493 // ========================================================================
495 IMPL_META_ACTION( Rect
, META_RECT_ACTION
)
497 // ------------------------------------------------------------------------
499 MetaRectAction::MetaRectAction( const Rectangle
& rRect
) :
500 MetaAction ( META_RECT_ACTION
),
505 // ------------------------------------------------------------------------
507 void MetaRectAction::Execute( OutputDevice
* pOut
)
509 pOut
->DrawRect( maRect
);
512 // ------------------------------------------------------------------------
514 MetaAction
* MetaRectAction::Clone()
516 MetaAction
* pClone
= (MetaAction
*) new MetaRectAction( *this );
517 pClone
->ResetRefCount();
521 // ------------------------------------------------------------------------
523 void MetaRectAction::Move( long nHorzMove
, long nVertMove
)
525 maRect
.Move( nHorzMove
, nVertMove
);
528 // ------------------------------------------------------------------------
530 void MetaRectAction::Scale( double fScaleX
, double fScaleY
)
532 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
535 // ------------------------------------------------------------------------
537 sal_Bool
MetaRectAction::Compare( const MetaAction
& rMetaAction
) const
539 return maRect
== ((MetaRectAction
&)rMetaAction
).maRect
;
542 // ------------------------------------------------------------------------
544 void MetaRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
546 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
550 // ------------------------------------------------------------------------
552 void MetaRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
558 // ========================================================================
560 IMPL_META_ACTION( RoundRect
, META_ROUNDRECT_ACTION
)
562 // ------------------------------------------------------------------------
564 MetaRoundRectAction::MetaRoundRectAction( const Rectangle
& rRect
,
565 sal_uInt32 nHorzRound
, sal_uInt32 nVertRound
) :
566 MetaAction ( META_ROUNDRECT_ACTION
),
568 mnHorzRound ( nHorzRound
),
569 mnVertRound ( nVertRound
)
573 // ------------------------------------------------------------------------
575 void MetaRoundRectAction::Execute( OutputDevice
* pOut
)
577 pOut
->DrawRect( maRect
, mnHorzRound
, mnVertRound
);
580 // ------------------------------------------------------------------------
582 MetaAction
* MetaRoundRectAction::Clone()
584 MetaAction
* pClone
= (MetaAction
*) new MetaRoundRectAction( *this );
585 pClone
->ResetRefCount();
589 // ------------------------------------------------------------------------
591 void MetaRoundRectAction::Move( long nHorzMove
, long nVertMove
)
593 maRect
.Move( nHorzMove
, nVertMove
);
596 // ------------------------------------------------------------------------
598 void MetaRoundRectAction::Scale( double fScaleX
, double fScaleY
)
600 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
601 mnHorzRound
= FRound( mnHorzRound
* fScaleX
);
602 mnVertRound
= FRound( mnVertRound
* fScaleY
);
605 // ------------------------------------------------------------------------
607 sal_Bool
MetaRoundRectAction::Compare( const MetaAction
& rMetaAction
) const
609 return ( maRect
== ((MetaRoundRectAction
&)rMetaAction
).maRect
) &&
610 ( mnHorzRound
== ((MetaRoundRectAction
&)rMetaAction
).mnHorzRound
) &&
611 ( mnVertRound
== ((MetaRoundRectAction
&)rMetaAction
).mnVertRound
);
614 // ------------------------------------------------------------------------
616 void MetaRoundRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
618 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
619 rOStm
<< maRect
<< mnHorzRound
<< mnVertRound
;
622 // ------------------------------------------------------------------------
624 void MetaRoundRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
627 rIStm
>> maRect
>> mnHorzRound
>> mnVertRound
;
630 // ========================================================================
632 IMPL_META_ACTION( Ellipse
, META_ELLIPSE_ACTION
)
634 // ------------------------------------------------------------------------
636 MetaEllipseAction::MetaEllipseAction( const Rectangle
& rRect
) :
637 MetaAction ( META_ELLIPSE_ACTION
),
642 // ------------------------------------------------------------------------
644 void MetaEllipseAction::Execute( OutputDevice
* pOut
)
646 pOut
->DrawEllipse( maRect
);
649 // ------------------------------------------------------------------------
651 MetaAction
* MetaEllipseAction::Clone()
653 MetaAction
* pClone
= (MetaAction
*) new MetaEllipseAction( *this );
654 pClone
->ResetRefCount();
658 // ------------------------------------------------------------------------
660 void MetaEllipseAction::Move( long nHorzMove
, long nVertMove
)
662 maRect
.Move( nHorzMove
, nVertMove
);
665 // ------------------------------------------------------------------------
667 void MetaEllipseAction::Scale( double fScaleX
, double fScaleY
)
669 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
672 // ------------------------------------------------------------------------
674 sal_Bool
MetaEllipseAction::Compare( const MetaAction
& rMetaAction
) const
676 return maRect
== ((MetaEllipseAction
&)rMetaAction
).maRect
;
679 // ------------------------------------------------------------------------
681 void MetaEllipseAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
683 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
687 // ------------------------------------------------------------------------
689 void MetaEllipseAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
695 // ========================================================================
697 IMPL_META_ACTION( Arc
, META_ARC_ACTION
)
699 // ------------------------------------------------------------------------
701 MetaArcAction::MetaArcAction( const Rectangle
& rRect
,
702 const Point
& rStart
, const Point
& rEnd
) :
703 MetaAction ( META_ARC_ACTION
),
705 maStartPt ( rStart
),
710 // ------------------------------------------------------------------------
712 void MetaArcAction::Execute( OutputDevice
* pOut
)
714 pOut
->DrawArc( maRect
, maStartPt
, maEndPt
);
717 // ------------------------------------------------------------------------
719 MetaAction
* MetaArcAction::Clone()
721 MetaAction
* pClone
= (MetaAction
*) new MetaArcAction( *this );
722 pClone
->ResetRefCount();
726 // ------------------------------------------------------------------------
728 void MetaArcAction::Move( long nHorzMove
, long nVertMove
)
730 maRect
.Move( nHorzMove
, nVertMove
);
731 maStartPt
.Move( nHorzMove
, nVertMove
);
732 maEndPt
.Move( nHorzMove
, nVertMove
);
735 // ------------------------------------------------------------------------
737 void MetaArcAction::Scale( double fScaleX
, double fScaleY
)
739 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
740 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
741 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
744 // ------------------------------------------------------------------------
746 sal_Bool
MetaArcAction::Compare( const MetaAction
& rMetaAction
) const
748 return ( maRect
== ((MetaArcAction
&)rMetaAction
).maRect
) &&
749 ( maStartPt
== ((MetaArcAction
&)rMetaAction
).maStartPt
) &&
750 ( maEndPt
== ((MetaArcAction
&)rMetaAction
).maEndPt
);
753 // ------------------------------------------------------------------------
755 void MetaArcAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
757 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
758 rOStm
<< maRect
<< maStartPt
<< maEndPt
;
761 // ------------------------------------------------------------------------
763 void MetaArcAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
766 rIStm
>> maRect
>> maStartPt
>> maEndPt
;
769 // ========================================================================
771 IMPL_META_ACTION( Pie
, META_PIE_ACTION
)
773 // ------------------------------------------------------------------------
775 MetaPieAction::MetaPieAction( const Rectangle
& rRect
,
776 const Point
& rStart
, const Point
& rEnd
) :
777 MetaAction ( META_PIE_ACTION
),
779 maStartPt ( rStart
),
784 // ------------------------------------------------------------------------
786 void MetaPieAction::Execute( OutputDevice
* pOut
)
788 pOut
->DrawPie( maRect
, maStartPt
, maEndPt
);
791 // ------------------------------------------------------------------------
793 MetaAction
* MetaPieAction::Clone()
795 MetaAction
* pClone
= (MetaAction
*) new MetaPieAction( *this );
796 pClone
->ResetRefCount();
800 // ------------------------------------------------------------------------
802 void MetaPieAction::Move( long nHorzMove
, long nVertMove
)
804 maRect
.Move( nHorzMove
, nVertMove
);
805 maStartPt
.Move( nHorzMove
, nVertMove
);
806 maEndPt
.Move( nHorzMove
, nVertMove
);
809 // ------------------------------------------------------------------------
811 void MetaPieAction::Scale( double fScaleX
, double fScaleY
)
813 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
814 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
815 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
818 // ------------------------------------------------------------------------
820 sal_Bool
MetaPieAction::Compare( const MetaAction
& rMetaAction
) const
822 return ( maRect
== ((MetaPieAction
&)rMetaAction
).maRect
) &&
823 ( maStartPt
== ((MetaPieAction
&)rMetaAction
).maStartPt
) &&
824 ( maEndPt
== ((MetaPieAction
&)rMetaAction
).maEndPt
);
827 // ------------------------------------------------------------------------
829 void MetaPieAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
831 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
832 rOStm
<< maRect
<< maStartPt
<< maEndPt
;
835 // ------------------------------------------------------------------------
837 void MetaPieAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
840 rIStm
>> maRect
>> maStartPt
>> maEndPt
;
843 // ========================================================================
845 IMPL_META_ACTION( Chord
, META_CHORD_ACTION
)
847 // ------------------------------------------------------------------------
849 MetaChordAction::MetaChordAction( const Rectangle
& rRect
,
850 const Point
& rStart
, const Point
& rEnd
) :
851 MetaAction ( META_CHORD_ACTION
),
853 maStartPt ( rStart
),
858 // ------------------------------------------------------------------------
860 void MetaChordAction::Execute( OutputDevice
* pOut
)
862 pOut
->DrawChord( maRect
, maStartPt
, maEndPt
);
865 // ------------------------------------------------------------------------
867 MetaAction
* MetaChordAction::Clone()
869 MetaAction
* pClone
= (MetaAction
*) new MetaChordAction( *this );
870 pClone
->ResetRefCount();
874 // ------------------------------------------------------------------------
876 void MetaChordAction::Move( long nHorzMove
, long nVertMove
)
878 maRect
.Move( nHorzMove
, nVertMove
);
879 maStartPt
.Move( nHorzMove
, nVertMove
);
880 maEndPt
.Move( nHorzMove
, nVertMove
);
883 // ------------------------------------------------------------------------
885 void MetaChordAction::Scale( double fScaleX
, double fScaleY
)
887 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
888 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
889 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
892 // ------------------------------------------------------------------------
894 sal_Bool
MetaChordAction::Compare( const MetaAction
& rMetaAction
) const
896 return ( maRect
== ((MetaChordAction
&)rMetaAction
).maRect
) &&
897 ( maStartPt
== ((MetaChordAction
&)rMetaAction
).maStartPt
) &&
898 ( maEndPt
== ((MetaChordAction
&)rMetaAction
).maEndPt
);
901 // ------------------------------------------------------------------------
903 void MetaChordAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
905 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
906 rOStm
<< maRect
<< maStartPt
<< maEndPt
;
909 // ------------------------------------------------------------------------
911 void MetaChordAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
914 rIStm
>> maRect
>> maStartPt
>> maEndPt
;
917 // ========================================================================
919 IMPL_META_ACTION( PolyLine
, META_POLYLINE_ACTION
)
921 // ------------------------------------------------------------------------
923 MetaPolyLineAction::MetaPolyLineAction( const Polygon
& rPoly
) :
924 MetaAction ( META_POLYLINE_ACTION
),
929 // ------------------------------------------------------------------------
931 MetaPolyLineAction::MetaPolyLineAction( const Polygon
& rPoly
, const LineInfo
& rLineInfo
) :
932 MetaAction ( META_POLYLINE_ACTION
),
933 maLineInfo ( rLineInfo
),
938 // ------------------------------------------------------------------------
940 void MetaPolyLineAction::Execute( OutputDevice
* pOut
)
942 if( maLineInfo
.IsDefault() )
943 pOut
->DrawPolyLine( maPoly
);
945 pOut
->DrawPolyLine( maPoly
, maLineInfo
);
948 // ------------------------------------------------------------------------
950 MetaAction
* MetaPolyLineAction::Clone()
952 MetaAction
* pClone
= (MetaAction
*) new MetaPolyLineAction( *this );
953 pClone
->ResetRefCount();
957 // ------------------------------------------------------------------------
959 void MetaPolyLineAction::Move( long nHorzMove
, long nVertMove
)
961 maPoly
.Move( nHorzMove
, nVertMove
);
964 // ------------------------------------------------------------------------
966 void MetaPolyLineAction::Scale( double fScaleX
, double fScaleY
)
968 ImplScalePoly( maPoly
, fScaleX
, fScaleY
);
969 ImplScaleLineInfo( maLineInfo
, fScaleX
, fScaleY
);
972 // ------------------------------------------------------------------------
974 sal_Bool
MetaPolyLineAction::Compare( const MetaAction
& rMetaAction
) const
976 sal_Bool bIsEqual
= sal_True
;;
977 if ( maLineInfo
!= ((MetaPolyLineAction
&)rMetaAction
).maLineInfo
)
978 bIsEqual
= sal_False
;
980 bIsEqual
= maPoly
.IsEqual(((MetaPolyLineAction
&)rMetaAction
).maPoly
);
985 // ------------------------------------------------------------------------
987 void MetaPolyLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
989 WRITE_BASE_COMPAT( rOStm
, 3, pData
);
992 maPoly
.GetSimple( aSimplePoly
);
994 rOStm
<< aSimplePoly
; // Version 1
995 rOStm
<< maLineInfo
; // Version 2
997 sal_uInt8 bHasPolyFlags
= maPoly
.HasFlags(); // Version 3
998 rOStm
<< bHasPolyFlags
;
1000 maPoly
.Write( rOStm
);
1003 // ------------------------------------------------------------------------
1005 void MetaPolyLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1013 if( aCompat
.GetVersion() >= 2 )
1014 rIStm
>> maLineInfo
;
1015 if ( aCompat
.GetVersion() >= 3 )
1017 sal_uInt8 bHasPolyFlags
;
1018 rIStm
>> bHasPolyFlags
;
1019 if ( bHasPolyFlags
)
1020 maPoly
.Read( rIStm
);
1024 // ========================================================================
1026 IMPL_META_ACTION( Polygon
, META_POLYGON_ACTION
)
1028 // ------------------------------------------------------------------------
1030 MetaPolygonAction::MetaPolygonAction( const Polygon
& rPoly
) :
1031 MetaAction ( META_POLYGON_ACTION
),
1036 // ------------------------------------------------------------------------
1038 void MetaPolygonAction::Execute( OutputDevice
* pOut
)
1040 pOut
->DrawPolygon( maPoly
);
1043 // ------------------------------------------------------------------------
1045 MetaAction
* MetaPolygonAction::Clone()
1047 MetaAction
* pClone
= (MetaAction
*) new MetaPolygonAction( *this );
1048 pClone
->ResetRefCount();
1052 // ------------------------------------------------------------------------
1054 void MetaPolygonAction::Move( long nHorzMove
, long nVertMove
)
1056 maPoly
.Move( nHorzMove
, nVertMove
);
1059 // ------------------------------------------------------------------------
1061 void MetaPolygonAction::Scale( double fScaleX
, double fScaleY
)
1063 ImplScalePoly( maPoly
, fScaleX
, fScaleY
);
1066 // ------------------------------------------------------------------------
1068 sal_Bool
MetaPolygonAction::Compare( const MetaAction
& rMetaAction
) const
1070 return maPoly
.IsEqual(((MetaPolygonAction
&)rMetaAction
).maPoly
);
1073 // ------------------------------------------------------------------------
1075 void MetaPolygonAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1077 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1079 Polygon aSimplePoly
; // Version 1
1080 maPoly
.GetSimple( aSimplePoly
);
1081 rOStm
<< aSimplePoly
;
1083 sal_uInt8 bHasPolyFlags
= maPoly
.HasFlags(); // Version 2
1084 rOStm
<< bHasPolyFlags
;
1085 if ( bHasPolyFlags
)
1086 maPoly
.Write( rOStm
);
1089 // ------------------------------------------------------------------------
1091 void MetaPolygonAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1095 rIStm
>> maPoly
; // Version 1
1097 if( aCompat
.GetVersion() >= 2 ) // Version 2
1099 sal_uInt8 bHasPolyFlags
;
1100 rIStm
>> bHasPolyFlags
;
1101 if ( bHasPolyFlags
)
1102 maPoly
.Read( rIStm
);
1106 // ========================================================================
1108 IMPL_META_ACTION( PolyPolygon
, META_POLYPOLYGON_ACTION
)
1110 // ------------------------------------------------------------------------
1112 MetaPolyPolygonAction::MetaPolyPolygonAction( const PolyPolygon
& rPolyPoly
) :
1113 MetaAction ( META_POLYPOLYGON_ACTION
),
1114 maPolyPoly ( rPolyPoly
)
1118 // ------------------------------------------------------------------------
1120 void MetaPolyPolygonAction::Execute( OutputDevice
* pOut
)
1122 pOut
->DrawPolyPolygon( maPolyPoly
);
1125 // ------------------------------------------------------------------------
1127 MetaAction
* MetaPolyPolygonAction::Clone()
1129 MetaAction
* pClone
= (MetaAction
*) new MetaPolyPolygonAction( *this );
1130 pClone
->ResetRefCount();
1134 // ------------------------------------------------------------------------
1136 void MetaPolyPolygonAction::Move( long nHorzMove
, long nVertMove
)
1138 maPolyPoly
.Move( nHorzMove
, nVertMove
);
1141 // ------------------------------------------------------------------------
1143 void MetaPolyPolygonAction::Scale( double fScaleX
, double fScaleY
)
1145 for( USHORT i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
1146 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
1149 // ------------------------------------------------------------------------
1151 sal_Bool
MetaPolyPolygonAction::Compare( const MetaAction
& rMetaAction
) const
1153 return maPolyPoly
.IsEqual(((MetaPolyPolygonAction
&)rMetaAction
).maPolyPoly
);
1156 // ------------------------------------------------------------------------
1158 void MetaPolyPolygonAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1160 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1162 sal_uInt16 nNumberOfComplexPolygons
= 0;
1163 sal_uInt16 i
, nPolyCount
= maPolyPoly
.Count();
1165 Polygon aSimplePoly
; // Version 1
1166 rOStm
<< nPolyCount
;
1167 for ( i
= 0; i
< nPolyCount
; i
++ )
1169 const Polygon
& rPoly
= maPolyPoly
.GetObject( i
);
1170 if ( rPoly
.HasFlags() )
1171 nNumberOfComplexPolygons
++;
1172 rPoly
.GetSimple( aSimplePoly
);
1173 rOStm
<< aSimplePoly
;
1176 rOStm
<< nNumberOfComplexPolygons
; // Version 2
1177 for ( i
= 0; nNumberOfComplexPolygons
&& ( i
< nPolyCount
); i
++ )
1179 const Polygon
& rPoly
= maPolyPoly
.GetObject( i
);
1180 if ( rPoly
.HasFlags() )
1183 rPoly
.Write( rOStm
);
1185 nNumberOfComplexPolygons
--;
1190 // ------------------------------------------------------------------------
1192 void MetaPolyPolygonAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1195 rIStm
>> maPolyPoly
; // Version 1
1197 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1199 sal_uInt16 i
, nIndex
, nNumberOfComplexPolygons
;
1200 rIStm
>> nNumberOfComplexPolygons
;
1201 for ( i
= 0; i
< nNumberOfComplexPolygons
; i
++ )
1205 aPoly
.Read( rIStm
);
1206 maPolyPoly
.Replace( aPoly
, nIndex
);
1211 // ========================================================================
1213 IMPL_META_ACTION( Text
, META_TEXT_ACTION
)
1215 // ------------------------------------------------------------------------
1217 MetaTextAction::MetaTextAction( const Point
& rPt
, const XubString
& rStr
,
1218 USHORT nIndex
, USHORT nLen
) :
1219 MetaAction ( META_TEXT_ACTION
),
1227 // ------------------------------------------------------------------------
1229 void MetaTextAction::Execute( OutputDevice
* pOut
)
1231 pOut
->DrawText( maPt
, maStr
, mnIndex
, mnLen
);
1234 // ------------------------------------------------------------------------
1236 MetaAction
* MetaTextAction::Clone()
1238 MetaAction
* pClone
= (MetaAction
*) new MetaTextAction( *this );
1239 pClone
->ResetRefCount();
1243 // ------------------------------------------------------------------------
1245 void MetaTextAction::Move( long nHorzMove
, long nVertMove
)
1247 maPt
.Move( nHorzMove
, nVertMove
);
1250 // ------------------------------------------------------------------------
1252 void MetaTextAction::Scale( double fScaleX
, double fScaleY
)
1254 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1257 // ------------------------------------------------------------------------
1259 sal_Bool
MetaTextAction::Compare( const MetaAction
& rMetaAction
) const
1261 return ( maPt
== ((MetaTextAction
&)rMetaAction
).maPt
) &&
1262 ( maStr
== ((MetaTextAction
&)rMetaAction
).maStr
) &&
1263 ( mnIndex
== ((MetaTextAction
&)rMetaAction
).mnIndex
) &&
1264 ( mnLen
== ((MetaTextAction
&)rMetaAction
).mnLen
);
1267 // ------------------------------------------------------------------------
1269 void MetaTextAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1271 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1273 rOStm
.WriteByteString( maStr
, pData
->meActualCharSet
);
1277 sal_uInt16 i
, nLen
= maStr
.Len(); // version 2
1279 for ( i
= 0; i
< nLen
; i
++ )
1281 sal_Unicode nUni
= maStr
.GetChar( i
);
1286 // ------------------------------------------------------------------------
1288 void MetaTextAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1292 rIStm
.ReadByteString( maStr
, pData
->meActualCharSet
);
1296 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1300 sal_Unicode
* pBuffer
= maStr
.AllocBuffer( nLen
);
1302 rIStm
>> *pBuffer
++;
1306 // ========================================================================
1308 MetaTextArrayAction::MetaTextArrayAction() :
1309 MetaAction ( META_TEXTARRAY_ACTION
),
1316 // ------------------------------------------------------------------------
1318 MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction
& rAction
) :
1319 MetaAction ( META_TEXTARRAY_ACTION
),
1320 maStartPt ( rAction
.maStartPt
),
1321 maStr ( rAction
.maStr
),
1322 mnIndex ( rAction
.mnIndex
),
1323 mnLen ( rAction
.mnLen
)
1325 if( rAction
.mpDXAry
)
1327 const ULONG nAryLen
= mnLen
;
1329 mpDXAry
= new sal_Int32
[ nAryLen
];
1330 memcpy( mpDXAry
, rAction
.mpDXAry
, nAryLen
* sizeof( sal_Int32
) );
1336 // ------------------------------------------------------------------------
1338 MetaTextArrayAction::MetaTextArrayAction( const Point
& rStartPt
,
1339 const XubString
& rStr
,
1340 const sal_Int32
* pDXAry
,
1343 MetaAction ( META_TEXTARRAY_ACTION
),
1344 maStartPt ( rStartPt
),
1347 mnLen ( ( nLen
== STRING_LEN
) ? rStr
.Len() : nLen
)
1349 const ULONG nAryLen
= pDXAry
? mnLen
: 0;
1353 mpDXAry
= new sal_Int32
[ nAryLen
];
1354 memcpy( mpDXAry
, pDXAry
, nAryLen
* sizeof( sal_Int32
) );
1360 // ------------------------------------------------------------------------
1362 MetaTextArrayAction::~MetaTextArrayAction()
1367 // ------------------------------------------------------------------------
1369 void MetaTextArrayAction::Execute( OutputDevice
* pOut
)
1371 pOut
->DrawTextArray( maStartPt
, maStr
, mpDXAry
, mnIndex
, mnLen
);
1374 // ------------------------------------------------------------------------
1376 MetaAction
* MetaTextArrayAction::Clone()
1378 MetaAction
* pClone
= (MetaAction
*) new MetaTextArrayAction( *this );
1379 pClone
->ResetRefCount();
1383 // ------------------------------------------------------------------------
1385 void MetaTextArrayAction::Move( long nHorzMove
, long nVertMove
)
1387 maStartPt
.Move( nHorzMove
, nVertMove
);
1390 // ------------------------------------------------------------------------
1392 void MetaTextArrayAction::Scale( double fScaleX
, double fScaleY
)
1394 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
1396 if ( mpDXAry
&& mnLen
)
1398 for ( USHORT i
= 0, nCount
= mnLen
; i
< nCount
; i
++ )
1399 mpDXAry
[ i
] = FRound( mpDXAry
[ i
] * fScaleX
);
1403 // ------------------------------------------------------------------------
1405 sal_Bool
MetaTextArrayAction::Compare( const MetaAction
& rMetaAction
) const
1407 return ( maStartPt
== ((MetaTextArrayAction
&)rMetaAction
).maStartPt
) &&
1408 ( maStr
== ((MetaTextArrayAction
&)rMetaAction
).maStr
) &&
1409 ( mnIndex
== ((MetaTextArrayAction
&)rMetaAction
).mnIndex
) &&
1410 ( mnLen
== ((MetaTextArrayAction
&)rMetaAction
).mnLen
) &&
1411 ( memcmp( mpDXAry
, ((MetaTextArrayAction
&)rMetaAction
).mpDXAry
, mnLen
) == 0 );
1414 // ------------------------------------------------------------------------
1416 void MetaTextArrayAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1418 const sal_uInt32 nAryLen
= mpDXAry
? mnLen
: 0;
1420 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1422 rOStm
.WriteByteString( maStr
, pData
->meActualCharSet
);
1427 for( ULONG i
= 0UL; i
< nAryLen
; i
++ )
1428 rOStm
<< mpDXAry
[ i
];
1430 sal_uInt16 j
, nLen
= maStr
.Len(); // version 2
1432 for ( j
= 0; j
< nLen
; j
++ )
1434 sal_Unicode nUni
= maStr
.GetChar( j
);
1439 // ------------------------------------------------------------------------
1441 void MetaTextArrayAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1449 rIStm
.ReadByteString( maStr
, pData
->meActualCharSet
);
1456 // #i9762#, #106172# Ensure that DX array is at least mnLen entries long
1457 const ULONG
nIntAryLen( Max(nAryLen
, static_cast<sal_uInt32
>(mnLen
)) );
1458 mpDXAry
= new sal_Int32
[ nIntAryLen
];
1461 for( i
= 0UL; i
< nAryLen
; i
++ )
1462 rIStm
>> mpDXAry
[ i
];
1464 // #106172# setup remainder
1465 for( ; i
< nIntAryLen
; i
++ )
1471 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1475 sal_Unicode
* pBuffer
= maStr
.AllocBuffer( nLen
);
1477 rIStm
>> *pBuffer
++;
1481 // ========================================================================
1483 IMPL_META_ACTION( StretchText
, META_STRETCHTEXT_ACTION
)
1485 // ------------------------------------------------------------------------
1487 MetaStretchTextAction::MetaStretchTextAction( const Point
& rPt
, sal_uInt32 nWidth
,
1488 const XubString
& rStr
,
1489 USHORT nIndex
, USHORT nLen
) :
1490 MetaAction ( META_STRETCHTEXT_ACTION
),
1499 // ------------------------------------------------------------------------
1501 void MetaStretchTextAction::Execute( OutputDevice
* pOut
)
1503 pOut
->DrawStretchText( maPt
, mnWidth
, maStr
, mnIndex
, mnLen
);
1506 // ------------------------------------------------------------------------
1508 MetaAction
* MetaStretchTextAction::Clone()
1510 MetaAction
* pClone
= (MetaAction
*) new MetaStretchTextAction( *this );
1511 pClone
->ResetRefCount();
1515 // ------------------------------------------------------------------------
1517 void MetaStretchTextAction::Move( long nHorzMove
, long nVertMove
)
1519 maPt
.Move( nHorzMove
, nVertMove
);
1522 // ------------------------------------------------------------------------
1524 void MetaStretchTextAction::Scale( double fScaleX
, double fScaleY
)
1526 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1527 mnWidth
= (ULONG
)FRound( mnWidth
* fScaleX
);
1530 // ------------------------------------------------------------------------
1532 sal_Bool
MetaStretchTextAction::Compare( const MetaAction
& rMetaAction
) const
1534 return ( maPt
== ((MetaStretchTextAction
&)rMetaAction
).maPt
) &&
1535 ( maStr
== ((MetaStretchTextAction
&)rMetaAction
).maStr
) &&
1536 ( mnWidth
== ((MetaStretchTextAction
&)rMetaAction
).mnWidth
) &&
1537 ( mnIndex
== ((MetaStretchTextAction
&)rMetaAction
).mnIndex
) &&
1538 ( mnLen
== ((MetaStretchTextAction
&)rMetaAction
).mnLen
);
1541 // ------------------------------------------------------------------------
1543 void MetaStretchTextAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1545 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1547 rOStm
.WriteByteString( maStr
, pData
->meActualCharSet
);
1552 sal_uInt16 i
, nLen
= maStr
.Len(); // version 2
1554 for ( i
= 0; i
< nLen
; i
++ )
1556 sal_Unicode nUni
= maStr
.GetChar( i
);
1561 // ------------------------------------------------------------------------
1563 void MetaStretchTextAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1567 rIStm
.ReadByteString( maStr
, pData
->meActualCharSet
);
1572 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1576 sal_Unicode
* pBuffer
= maStr
.AllocBuffer( nLen
);
1578 rIStm
>> *pBuffer
++;
1582 // ========================================================================
1584 IMPL_META_ACTION( TextRect
, META_TEXTRECT_ACTION
)
1586 // ------------------------------------------------------------------------
1588 MetaTextRectAction::MetaTextRectAction( const Rectangle
& rRect
,
1589 const XubString
& rStr
, USHORT nStyle
) :
1590 MetaAction ( META_TEXTRECT_ACTION
),
1597 // ------------------------------------------------------------------------
1599 void MetaTextRectAction::Execute( OutputDevice
* pOut
)
1601 pOut
->DrawText( maRect
, maStr
, mnStyle
);
1604 // ------------------------------------------------------------------------
1606 MetaAction
* MetaTextRectAction::Clone()
1608 MetaAction
* pClone
= (MetaAction
*) new MetaTextRectAction( *this );
1609 pClone
->ResetRefCount();
1613 // ------------------------------------------------------------------------
1615 void MetaTextRectAction::Move( long nHorzMove
, long nVertMove
)
1617 maRect
.Move( nHorzMove
, nVertMove
);
1620 // ------------------------------------------------------------------------
1622 void MetaTextRectAction::Scale( double fScaleX
, double fScaleY
)
1624 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
1627 // ------------------------------------------------------------------------
1629 sal_Bool
MetaTextRectAction::Compare( const MetaAction
& rMetaAction
) const
1631 return ( maRect
== ((MetaTextRectAction
&)rMetaAction
).maRect
) &&
1632 ( maStr
== ((MetaTextRectAction
&)rMetaAction
).maStr
) &&
1633 ( mnStyle
== ((MetaTextRectAction
&)rMetaAction
).mnStyle
);
1636 // ------------------------------------------------------------------------
1638 void MetaTextRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1640 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1642 rOStm
.WriteByteString( maStr
, pData
->meActualCharSet
);
1645 sal_uInt16 i
, nLen
= maStr
.Len(); // version 2
1647 for ( i
= 0; i
< nLen
; i
++ )
1649 sal_Unicode nUni
= maStr
.GetChar( i
);
1654 // ------------------------------------------------------------------------
1656 void MetaTextRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1660 rIStm
.ReadByteString( maStr
, pData
->meActualCharSet
);
1663 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1667 sal_Unicode
* pBuffer
= maStr
.AllocBuffer( nLen
);
1669 rIStm
>> *pBuffer
++;
1673 // ========================================================================
1675 IMPL_META_ACTION( TextLine
, META_TEXTLINE_ACTION
)
1677 // ------------------------------------------------------------------------
1679 MetaTextLineAction::MetaTextLineAction( const Point
& rPos
, long nWidth
,
1680 FontStrikeout eStrikeout
,
1681 FontUnderline eUnderline
,
1682 FontUnderline eOverline
) :
1683 MetaAction ( META_TEXTLINE_ACTION
),
1686 meStrikeout ( eStrikeout
),
1687 meUnderline ( eUnderline
),
1688 meOverline ( eOverline
)
1692 // ------------------------------------------------------------------------
1694 void MetaTextLineAction::Execute( OutputDevice
* pOut
)
1696 pOut
->DrawTextLine( maPos
, mnWidth
, meStrikeout
, meUnderline
, meOverline
);
1699 // ------------------------------------------------------------------------
1701 MetaAction
* MetaTextLineAction::Clone()
1703 MetaAction
* pClone
= (MetaAction
*)new MetaTextLineAction( *this );
1704 pClone
->ResetRefCount();
1708 // ------------------------------------------------------------------------
1710 void MetaTextLineAction::Move( long nHorzMove
, long nVertMove
)
1712 maPos
.Move( nHorzMove
, nVertMove
);
1715 // ------------------------------------------------------------------------
1717 void MetaTextLineAction::Scale( double fScaleX
, double fScaleY
)
1719 ImplScalePoint( maPos
, fScaleX
, fScaleY
);
1720 mnWidth
= FRound( mnWidth
* fScaleX
);
1723 // ------------------------------------------------------------------------
1725 sal_Bool
MetaTextLineAction::Compare( const MetaAction
& rMetaAction
) const
1727 return ( maPos
== ((MetaTextLineAction
&)rMetaAction
).maPos
) &&
1728 ( mnWidth
== ((MetaTextLineAction
&)rMetaAction
).mnWidth
) &&
1729 ( meStrikeout
== ((MetaTextLineAction
&)rMetaAction
).meStrikeout
) &&
1730 ( meUnderline
== ((MetaTextLineAction
&)rMetaAction
).meUnderline
) &&
1731 ( meOverline
== ((MetaTextLineAction
&)rMetaAction
).meOverline
);
1734 // ------------------------------------------------------------------------
1736 void MetaTextLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1738 WRITE_BASE_COMPAT( rOStm
, 2, pData
);
1742 rOStm
<< static_cast<sal_uInt32
>(meStrikeout
);
1743 rOStm
<< static_cast<sal_uInt32
>(meUnderline
);
1745 rOStm
<< static_cast<sal_uInt32
>(meOverline
);
1748 // ------------------------------------------------------------------------
1750 void MetaTextLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1758 meStrikeout
= (FontStrikeout
)nTemp
;
1760 meUnderline
= (FontUnderline
)nTemp
;
1761 if ( aCompat
.GetVersion() >= 2 ) {
1763 meUnderline
= (FontUnderline
)nTemp
;
1767 // ========================================================================
1769 IMPL_META_ACTION( Bmp
, META_BMP_ACTION
)
1771 // ------------------------------------------------------------------------
1773 MetaBmpAction::MetaBmpAction( const Point
& rPt
, const Bitmap
& rBmp
) :
1774 MetaAction ( META_BMP_ACTION
),
1780 // ------------------------------------------------------------------------
1782 void MetaBmpAction::Execute( OutputDevice
* pOut
)
1784 pOut
->DrawBitmap( maPt
, maBmp
);
1787 // ------------------------------------------------------------------------
1789 MetaAction
* MetaBmpAction::Clone()
1791 MetaAction
* pClone
= (MetaAction
*) new MetaBmpAction( *this );
1792 pClone
->ResetRefCount();
1796 // ------------------------------------------------------------------------
1798 void MetaBmpAction::Move( long nHorzMove
, long nVertMove
)
1800 maPt
.Move( nHorzMove
, nVertMove
);
1803 // ------------------------------------------------------------------------
1805 void MetaBmpAction::Scale( double fScaleX
, double fScaleY
)
1807 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1810 // ------------------------------------------------------------------------
1812 sal_Bool
MetaBmpAction::Compare( const MetaAction
& rMetaAction
) const
1814 return maBmp
.IsEqual(((MetaBmpAction
&)rMetaAction
).maBmp
) &&
1815 ( maPt
== ((MetaBmpAction
&)rMetaAction
).maPt
);
1818 // ------------------------------------------------------------------------
1820 void MetaBmpAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1824 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
1825 rOStm
<< maBmp
<< maPt
;
1829 // ------------------------------------------------------------------------
1831 void MetaBmpAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1834 rIStm
>> maBmp
>> maPt
;
1837 // ========================================================================
1839 IMPL_META_ACTION( BmpScale
, META_BMPSCALE_ACTION
)
1841 // ------------------------------------------------------------------------
1843 MetaBmpScaleAction::MetaBmpScaleAction( const Point
& rPt
, const Size
& rSz
,
1844 const Bitmap
& rBmp
) :
1845 MetaAction ( META_BMPSCALE_ACTION
),
1852 // ------------------------------------------------------------------------
1854 void MetaBmpScaleAction::Execute( OutputDevice
* pOut
)
1856 pOut
->DrawBitmap( maPt
, maSz
, maBmp
);
1859 // ------------------------------------------------------------------------
1861 MetaAction
* MetaBmpScaleAction::Clone()
1863 MetaAction
* pClone
= (MetaAction
*) new MetaBmpScaleAction( *this );
1864 pClone
->ResetRefCount();
1868 // ------------------------------------------------------------------------
1870 void MetaBmpScaleAction::Move( long nHorzMove
, long nVertMove
)
1872 maPt
.Move( nHorzMove
, nVertMove
);
1875 // ------------------------------------------------------------------------
1877 void MetaBmpScaleAction::Scale( double fScaleX
, double fScaleY
)
1879 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1880 ImplScaleSize( maSz
, fScaleX
, fScaleY
);
1883 // ------------------------------------------------------------------------
1885 sal_Bool
MetaBmpScaleAction::Compare( const MetaAction
& rMetaAction
) const
1887 return ( maBmp
.IsEqual(((MetaBmpScaleAction
&)rMetaAction
).maBmp
)) &&
1888 ( maPt
== ((MetaBmpScaleAction
&)rMetaAction
).maPt
) &&
1889 ( maSz
== ((MetaBmpScaleAction
&)rMetaAction
).maSz
);
1892 // ------------------------------------------------------------------------
1894 void MetaBmpScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1898 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
1899 rOStm
<< maBmp
<< maPt
<< maSz
;
1903 // ------------------------------------------------------------------------
1905 void MetaBmpScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1908 rIStm
>> maBmp
>> maPt
>> maSz
;
1911 // ========================================================================
1913 IMPL_META_ACTION( BmpScalePart
, META_BMPSCALEPART_ACTION
)
1915 // ------------------------------------------------------------------------
1917 MetaBmpScalePartAction::MetaBmpScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
1918 const Point
& rSrcPt
, const Size
& rSrcSz
,
1919 const Bitmap
& rBmp
) :
1920 MetaAction ( META_BMPSCALEPART_ACTION
),
1929 // ------------------------------------------------------------------------
1931 void MetaBmpScalePartAction::Execute( OutputDevice
* pOut
)
1933 pOut
->DrawBitmap( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmp
);
1936 // ------------------------------------------------------------------------
1938 MetaAction
* MetaBmpScalePartAction::Clone()
1940 MetaAction
* pClone
= (MetaAction
*) new MetaBmpScalePartAction( *this );
1941 pClone
->ResetRefCount();
1945 // ------------------------------------------------------------------------
1947 void MetaBmpScalePartAction::Move( long nHorzMove
, long nVertMove
)
1949 maDstPt
.Move( nHorzMove
, nVertMove
);
1952 // ------------------------------------------------------------------------
1954 void MetaBmpScalePartAction::Scale( double fScaleX
, double fScaleY
)
1956 ImplScalePoint( maDstPt
, fScaleX
, fScaleY
);
1957 ImplScaleSize( maDstSz
, fScaleX
, fScaleY
);
1960 // ------------------------------------------------------------------------
1962 sal_Bool
MetaBmpScalePartAction::Compare( const MetaAction
& rMetaAction
) const
1964 return ( maBmp
.IsEqual(((MetaBmpScalePartAction
&)rMetaAction
).maBmp
)) &&
1965 ( maDstPt
== ((MetaBmpScalePartAction
&)rMetaAction
).maDstPt
) &&
1966 ( maDstSz
== ((MetaBmpScalePartAction
&)rMetaAction
).maDstSz
) &&
1967 ( maSrcPt
== ((MetaBmpScalePartAction
&)rMetaAction
).maSrcPt
) &&
1968 ( maSrcSz
== ((MetaBmpScalePartAction
&)rMetaAction
).maSrcSz
);
1971 // ------------------------------------------------------------------------
1973 void MetaBmpScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1977 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
1978 rOStm
<< maBmp
<< maDstPt
<< maDstSz
<< maSrcPt
<< maSrcSz
;
1982 // ------------------------------------------------------------------------
1984 void MetaBmpScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1987 rIStm
>> maBmp
>> maDstPt
>> maDstSz
>> maSrcPt
>> maSrcSz
;
1990 // ========================================================================
1992 IMPL_META_ACTION( BmpEx
, META_BMPEX_ACTION
)
1994 // ------------------------------------------------------------------------
1996 MetaBmpExAction::MetaBmpExAction( const Point
& rPt
, const BitmapEx
& rBmpEx
) :
1997 MetaAction ( META_BMPEX_ACTION
),
2003 // ------------------------------------------------------------------------
2005 void MetaBmpExAction::Execute( OutputDevice
* pOut
)
2007 pOut
->DrawBitmapEx( maPt
, maBmpEx
);
2010 // ------------------------------------------------------------------------
2012 MetaAction
* MetaBmpExAction::Clone()
2014 MetaAction
* pClone
= (MetaAction
*) new MetaBmpExAction( *this );
2015 pClone
->ResetRefCount();
2019 // ------------------------------------------------------------------------
2021 void MetaBmpExAction::Move( long nHorzMove
, long nVertMove
)
2023 maPt
.Move( nHorzMove
, nVertMove
);
2026 // ------------------------------------------------------------------------
2028 void MetaBmpExAction::Scale( double fScaleX
, double fScaleY
)
2030 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
2033 // ------------------------------------------------------------------------
2035 sal_Bool
MetaBmpExAction::Compare( const MetaAction
& rMetaAction
) const
2037 return ( maBmpEx
.IsEqual(((MetaBmpExAction
&)rMetaAction
).maBmpEx
)) &&
2038 ( maPt
== ((MetaBmpExAction
&)rMetaAction
).maPt
);
2041 // ------------------------------------------------------------------------
2043 void MetaBmpExAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2045 if( !!maBmpEx
.GetBitmap() )
2047 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2048 rOStm
<< maBmpEx
<< maPt
;
2052 // ------------------------------------------------------------------------
2054 void MetaBmpExAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2057 rIStm
>> maBmpEx
>> maPt
;
2060 // ========================================================================
2062 IMPL_META_ACTION( BmpExScale
, META_BMPEXSCALE_ACTION
)
2064 // ------------------------------------------------------------------------
2066 MetaBmpExScaleAction::MetaBmpExScaleAction( const Point
& rPt
, const Size
& rSz
,
2067 const BitmapEx
& rBmpEx
) :
2068 MetaAction ( META_BMPEXSCALE_ACTION
),
2075 // ------------------------------------------------------------------------
2077 void MetaBmpExScaleAction::Execute( OutputDevice
* pOut
)
2079 pOut
->DrawBitmapEx( maPt
, maSz
, maBmpEx
);
2082 // ------------------------------------------------------------------------
2084 MetaAction
* MetaBmpExScaleAction::Clone()
2086 MetaAction
* pClone
= (MetaAction
*) new MetaBmpExScaleAction( *this );
2087 pClone
->ResetRefCount();
2091 // ------------------------------------------------------------------------
2093 void MetaBmpExScaleAction::Move( long nHorzMove
, long nVertMove
)
2095 maPt
.Move( nHorzMove
, nVertMove
);
2098 // ------------------------------------------------------------------------
2100 void MetaBmpExScaleAction::Scale( double fScaleX
, double fScaleY
)
2102 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
2103 ImplScaleSize( maSz
, fScaleX
, fScaleY
);
2106 // ------------------------------------------------------------------------
2108 sal_Bool
MetaBmpExScaleAction::Compare( const MetaAction
& rMetaAction
) const
2110 return ( maBmpEx
.IsEqual(((MetaBmpExScaleAction
&)rMetaAction
).maBmpEx
)) &&
2111 ( maPt
== ((MetaBmpExScaleAction
&)rMetaAction
).maPt
) &&
2112 ( maSz
== ((MetaBmpExScaleAction
&)rMetaAction
).maSz
);
2115 // ------------------------------------------------------------------------
2117 void MetaBmpExScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2119 if( !!maBmpEx
.GetBitmap() )
2121 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2122 rOStm
<< maBmpEx
<< maPt
<< maSz
;
2126 // ------------------------------------------------------------------------
2128 void MetaBmpExScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2131 rIStm
>> maBmpEx
>> maPt
>> maSz
;
2134 // ========================================================================
2136 IMPL_META_ACTION( BmpExScalePart
, META_BMPEXSCALEPART_ACTION
)
2138 // ------------------------------------------------------------------------
2140 MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
2141 const Point
& rSrcPt
, const Size
& rSrcSz
,
2142 const BitmapEx
& rBmpEx
) :
2143 MetaAction ( META_BMPEXSCALEPART_ACTION
),
2152 // ------------------------------------------------------------------------
2154 void MetaBmpExScalePartAction::Execute( OutputDevice
* pOut
)
2156 pOut
->DrawBitmapEx( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmpEx
);
2159 // ------------------------------------------------------------------------
2161 MetaAction
* MetaBmpExScalePartAction::Clone()
2163 MetaAction
* pClone
= (MetaAction
*) new MetaBmpExScalePartAction( *this );
2164 pClone
->ResetRefCount();
2168 // ------------------------------------------------------------------------
2170 void MetaBmpExScalePartAction::Move( long nHorzMove
, long nVertMove
)
2172 maDstPt
.Move( nHorzMove
, nVertMove
);
2175 // ------------------------------------------------------------------------
2177 void MetaBmpExScalePartAction::Scale( double fScaleX
, double fScaleY
)
2179 ImplScalePoint( maDstPt
, fScaleX
, fScaleY
);
2180 ImplScaleSize( maDstSz
, fScaleX
, fScaleY
);
2183 // ------------------------------------------------------------------------
2185 sal_Bool
MetaBmpExScalePartAction::Compare( const MetaAction
& rMetaAction
) const
2187 return ( maBmpEx
.IsEqual(((MetaBmpExScalePartAction
&)rMetaAction
).maBmpEx
)) &&
2188 ( maDstPt
== ((MetaBmpExScalePartAction
&)rMetaAction
).maDstPt
) &&
2189 ( maDstSz
== ((MetaBmpExScalePartAction
&)rMetaAction
).maDstSz
) &&
2190 ( maSrcPt
== ((MetaBmpExScalePartAction
&)rMetaAction
).maSrcPt
) &&
2191 ( maSrcSz
== ((MetaBmpExScalePartAction
&)rMetaAction
).maSrcSz
);
2194 // ------------------------------------------------------------------------
2196 void MetaBmpExScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2198 if( !!maBmpEx
.GetBitmap() )
2200 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2201 rOStm
<< maBmpEx
<< maDstPt
<< maDstSz
<< maSrcPt
<< maSrcSz
;
2205 // ------------------------------------------------------------------------
2207 void MetaBmpExScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2210 rIStm
>> maBmpEx
>> maDstPt
>> maDstSz
>> maSrcPt
>> maSrcSz
;
2213 // ========================================================================
2215 IMPL_META_ACTION( Mask
, META_MASK_ACTION
)
2217 // ------------------------------------------------------------------------
2219 MetaMaskAction::MetaMaskAction( const Point
& rPt
,
2221 const Color
& rColor
) :
2222 MetaAction ( META_MASK_ACTION
),
2229 // ------------------------------------------------------------------------
2231 void MetaMaskAction::Execute( OutputDevice
* pOut
)
2233 pOut
->DrawMask( maPt
, maBmp
, maColor
);
2236 // ------------------------------------------------------------------------
2238 MetaAction
* MetaMaskAction::Clone()
2240 MetaAction
* pClone
= (MetaAction
*) new MetaMaskAction( *this );
2241 pClone
->ResetRefCount();
2245 // ------------------------------------------------------------------------
2247 void MetaMaskAction::Move( long nHorzMove
, long nVertMove
)
2249 maPt
.Move( nHorzMove
, nVertMove
);
2252 // ------------------------------------------------------------------------
2254 void MetaMaskAction::Scale( double fScaleX
, double fScaleY
)
2256 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
2259 // ------------------------------------------------------------------------
2261 sal_Bool
MetaMaskAction::Compare( const MetaAction
& rMetaAction
) const
2263 return ( maBmp
.IsEqual(((MetaMaskAction
&)rMetaAction
).maBmp
)) &&
2264 ( maColor
== ((MetaMaskAction
&)rMetaAction
).maColor
) &&
2265 ( maPt
== ((MetaMaskAction
&)rMetaAction
).maPt
);
2268 // ------------------------------------------------------------------------
2270 void MetaMaskAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2274 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2275 rOStm
<< maBmp
<< maPt
;
2279 // ------------------------------------------------------------------------
2281 void MetaMaskAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2284 rIStm
>> maBmp
>> maPt
;
2287 // ========================================================================
2289 IMPL_META_ACTION( MaskScale
, META_MASKSCALE_ACTION
)
2291 // ------------------------------------------------------------------------
2293 MetaMaskScaleAction::MetaMaskScaleAction( const Point
& rPt
, const Size
& rSz
,
2295 const Color
& rColor
) :
2296 MetaAction ( META_MASKSCALE_ACTION
),
2304 // ------------------------------------------------------------------------
2306 void MetaMaskScaleAction::Execute( OutputDevice
* pOut
)
2308 pOut
->DrawMask( maPt
, maSz
, maBmp
, maColor
);
2311 // ------------------------------------------------------------------------
2313 MetaAction
* MetaMaskScaleAction::Clone()
2315 MetaAction
* pClone
= (MetaAction
*) new MetaMaskScaleAction( *this );
2316 pClone
->ResetRefCount();
2320 // ------------------------------------------------------------------------
2322 void MetaMaskScaleAction::Move( long nHorzMove
, long nVertMove
)
2324 maPt
.Move( nHorzMove
, nVertMove
);
2327 // ------------------------------------------------------------------------
2329 void MetaMaskScaleAction::Scale( double fScaleX
, double fScaleY
)
2331 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
2332 ImplScaleSize( maSz
, fScaleX
, fScaleY
);
2335 // ------------------------------------------------------------------------
2337 sal_Bool
MetaMaskScaleAction::Compare( const MetaAction
& rMetaAction
) const
2339 return ( maBmp
.IsEqual(((MetaMaskScaleAction
&)rMetaAction
).maBmp
)) &&
2340 ( maColor
== ((MetaMaskScaleAction
&)rMetaAction
).maColor
) &&
2341 ( maPt
== ((MetaMaskScaleAction
&)rMetaAction
).maPt
) &&
2342 ( maSz
== ((MetaMaskScaleAction
&)rMetaAction
).maSz
);
2345 // ------------------------------------------------------------------------
2347 void MetaMaskScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2351 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2352 rOStm
<< maBmp
<< maPt
<< maSz
;
2356 // ------------------------------------------------------------------------
2358 void MetaMaskScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2361 rIStm
>> maBmp
>> maPt
>> maSz
;
2364 // ========================================================================
2366 IMPL_META_ACTION( MaskScalePart
, META_MASKSCALEPART_ACTION
)
2368 // ------------------------------------------------------------------------
2370 MetaMaskScalePartAction::MetaMaskScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
2371 const Point
& rSrcPt
, const Size
& rSrcSz
,
2373 const Color
& rColor
) :
2374 MetaAction ( META_MASKSCALEPART_ACTION
),
2384 // ------------------------------------------------------------------------
2386 void MetaMaskScalePartAction::Execute( OutputDevice
* pOut
)
2388 pOut
->DrawMask( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmp
, maColor
);
2391 // ------------------------------------------------------------------------
2393 MetaAction
* MetaMaskScalePartAction::Clone()
2395 MetaAction
* pClone
= (MetaAction
*) new MetaMaskScalePartAction( *this );
2396 pClone
->ResetRefCount();
2400 // ------------------------------------------------------------------------
2402 void MetaMaskScalePartAction::Move( long nHorzMove
, long nVertMove
)
2404 maDstPt
.Move( nHorzMove
, nVertMove
);
2407 // ------------------------------------------------------------------------
2409 void MetaMaskScalePartAction::Scale( double fScaleX
, double fScaleY
)
2411 ImplScalePoint( maDstPt
, fScaleX
, fScaleY
);
2412 ImplScaleSize( maDstSz
, fScaleX
, fScaleY
);
2415 // ------------------------------------------------------------------------
2417 sal_Bool
MetaMaskScalePartAction::Compare( const MetaAction
& rMetaAction
) const
2419 return ( maBmp
.IsEqual(((MetaMaskScalePartAction
&)rMetaAction
).maBmp
)) &&
2420 ( maColor
== ((MetaMaskScalePartAction
&)rMetaAction
).maColor
) &&
2421 ( maDstPt
== ((MetaMaskScalePartAction
&)rMetaAction
).maDstPt
) &&
2422 ( maDstSz
== ((MetaMaskScalePartAction
&)rMetaAction
).maDstSz
) &&
2423 ( maSrcPt
== ((MetaMaskScalePartAction
&)rMetaAction
).maSrcPt
) &&
2424 ( maSrcSz
== ((MetaMaskScalePartAction
&)rMetaAction
).maSrcSz
);
2427 // ------------------------------------------------------------------------
2429 void MetaMaskScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2433 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2435 maColor
.Write( rOStm
, TRUE
);
2436 rOStm
<< maDstPt
<< maDstSz
<< maSrcPt
<< maSrcSz
;
2440 // ------------------------------------------------------------------------
2442 void MetaMaskScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2446 maColor
.Read( rIStm
, TRUE
);
2447 rIStm
>> maDstPt
>> maDstSz
>> maSrcPt
>> maSrcSz
;
2450 // ========================================================================
2452 IMPL_META_ACTION( Gradient
, META_GRADIENT_ACTION
)
2454 // ------------------------------------------------------------------------
2456 MetaGradientAction::MetaGradientAction( const Rectangle
& rRect
, const Gradient
& rGradient
) :
2457 MetaAction ( META_GRADIENT_ACTION
),
2459 maGradient ( rGradient
)
2463 // ------------------------------------------------------------------------
2465 void MetaGradientAction::Execute( OutputDevice
* pOut
)
2467 pOut
->DrawGradient( maRect
, maGradient
);
2470 // ------------------------------------------------------------------------
2472 MetaAction
* MetaGradientAction::Clone()
2474 MetaAction
* pClone
= (MetaAction
*) new MetaGradientAction( *this );
2475 pClone
->ResetRefCount();
2479 // ------------------------------------------------------------------------
2481 void MetaGradientAction::Move( long nHorzMove
, long nVertMove
)
2483 maRect
.Move( nHorzMove
, nVertMove
);
2486 // ------------------------------------------------------------------------
2488 void MetaGradientAction::Scale( double fScaleX
, double fScaleY
)
2490 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2493 // ------------------------------------------------------------------------
2495 sal_Bool
MetaGradientAction::Compare( const MetaAction
& rMetaAction
) const
2497 return ( maRect
== ((MetaGradientAction
&)rMetaAction
).maRect
) &&
2498 ( maGradient
== ((MetaGradientAction
&)rMetaAction
).maGradient
);
2501 // ------------------------------------------------------------------------
2503 void MetaGradientAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2505 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2506 rOStm
<< maRect
<< maGradient
;
2509 // ------------------------------------------------------------------------
2511 void MetaGradientAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2514 rIStm
>> maRect
>> maGradient
;
2517 // ========================================================================
2519 MetaGradientExAction::MetaGradientExAction() :
2520 MetaAction ( META_GRADIENTEX_ACTION
)
2524 // ------------------------------------------------------------------------
2526 MetaGradientExAction::MetaGradientExAction( const PolyPolygon
& rPolyPoly
, const Gradient
& rGradient
) :
2527 MetaAction ( META_GRADIENTEX_ACTION
),
2528 maPolyPoly ( rPolyPoly
),
2529 maGradient ( rGradient
)
2533 // ------------------------------------------------------------------------
2535 MetaGradientExAction::~MetaGradientExAction()
2539 // ------------------------------------------------------------------------
2541 void MetaGradientExAction::Execute( OutputDevice
* pOut
)
2543 if( pOut
->GetConnectMetaFile() )
2544 pOut
->GetConnectMetaFile()->AddAction( Clone() );
2547 // ------------------------------------------------------------------------
2549 MetaAction
* MetaGradientExAction::Clone()
2551 MetaAction
* pClone
= (MetaAction
*) new MetaGradientExAction( *this );
2552 pClone
->ResetRefCount();
2556 // ------------------------------------------------------------------------
2558 void MetaGradientExAction::Move( long nHorzMove
, long nVertMove
)
2560 maPolyPoly
.Move( nHorzMove
, nVertMove
);
2563 // ------------------------------------------------------------------------
2565 void MetaGradientExAction::Scale( double fScaleX
, double fScaleY
)
2567 for( USHORT i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
2568 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
2571 // ------------------------------------------------------------------------
2573 sal_Bool
MetaGradientExAction::Compare( const MetaAction
& rMetaAction
) const
2575 return ( maPolyPoly
== ((MetaGradientExAction
&)rMetaAction
).maPolyPoly
) &&
2576 ( maGradient
== ((MetaGradientExAction
&)rMetaAction
).maGradient
);
2579 // ------------------------------------------------------------------------
2581 void MetaGradientExAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2583 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2584 rOStm
<< maPolyPoly
<< maGradient
;
2587 // ------------------------------------------------------------------------
2589 void MetaGradientExAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2592 rIStm
>> maPolyPoly
>> maGradient
;
2595 // ========================================================================
2597 IMPL_META_ACTION( Hatch
, META_HATCH_ACTION
)
2599 // ------------------------------------------------------------------------
2601 MetaHatchAction::MetaHatchAction( const PolyPolygon
& rPolyPoly
, const Hatch
& rHatch
) :
2602 MetaAction ( META_HATCH_ACTION
),
2603 maPolyPoly ( rPolyPoly
),
2608 // ------------------------------------------------------------------------
2610 void MetaHatchAction::Execute( OutputDevice
* pOut
)
2612 pOut
->DrawHatch( maPolyPoly
, maHatch
);
2615 // ------------------------------------------------------------------------
2617 MetaAction
* MetaHatchAction::Clone()
2619 MetaAction
* pClone
= (MetaAction
*) new MetaHatchAction( *this );
2620 pClone
->ResetRefCount();
2624 // ------------------------------------------------------------------------
2626 void MetaHatchAction::Move( long nHorzMove
, long nVertMove
)
2628 maPolyPoly
.Move( nHorzMove
, nVertMove
);
2631 // ------------------------------------------------------------------------
2633 void MetaHatchAction::Scale( double fScaleX
, double fScaleY
)
2635 for( USHORT i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
2636 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
2639 // ------------------------------------------------------------------------
2641 sal_Bool
MetaHatchAction::Compare( const MetaAction
& rMetaAction
) const
2643 return ( maPolyPoly
== ((MetaHatchAction
&)rMetaAction
).maPolyPoly
) &&
2644 ( maHatch
== ((MetaHatchAction
&)rMetaAction
).maHatch
);
2647 // ------------------------------------------------------------------------
2649 void MetaHatchAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2651 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2652 rOStm
<< maPolyPoly
<< maHatch
;
2655 // ------------------------------------------------------------------------
2657 void MetaHatchAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2660 rIStm
>> maPolyPoly
>> maHatch
;
2663 // ========================================================================
2665 IMPL_META_ACTION( Wallpaper
, META_WALLPAPER_ACTION
)
2667 // ------------------------------------------------------------------------
2669 MetaWallpaperAction::MetaWallpaperAction( const Rectangle
& rRect
,
2670 const Wallpaper
& rPaper
) :
2671 MetaAction ( META_WALLPAPER_ACTION
),
2673 maWallpaper ( rPaper
)
2677 // ------------------------------------------------------------------------
2679 void MetaWallpaperAction::Execute( OutputDevice
* pOut
)
2681 pOut
->DrawWallpaper( maRect
, maWallpaper
);
2684 // ------------------------------------------------------------------------
2686 MetaAction
* MetaWallpaperAction::Clone()
2688 MetaAction
* pClone
= (MetaAction
*) new MetaWallpaperAction( *this );
2689 pClone
->ResetRefCount();
2693 // ------------------------------------------------------------------------
2695 void MetaWallpaperAction::Move( long nHorzMove
, long nVertMove
)
2697 maRect
.Move( nHorzMove
, nVertMove
);
2700 // ------------------------------------------------------------------------
2702 void MetaWallpaperAction::Scale( double fScaleX
, double fScaleY
)
2704 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2707 // ------------------------------------------------------------------------
2709 sal_Bool
MetaWallpaperAction::Compare( const MetaAction
& rMetaAction
) const
2711 return ( maRect
== ((MetaWallpaperAction
&)rMetaAction
).maRect
) &&
2712 ( maWallpaper
== ((MetaWallpaperAction
&)rMetaAction
).maWallpaper
);
2715 // ------------------------------------------------------------------------
2717 void MetaWallpaperAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2719 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2720 rOStm
<< maWallpaper
;
2723 // ------------------------------------------------------------------------
2725 void MetaWallpaperAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2728 rIStm
>> maWallpaper
;
2731 // ========================================================================
2733 IMPL_META_ACTION( ClipRegion
, META_CLIPREGION_ACTION
)
2735 // ------------------------------------------------------------------------
2737 MetaClipRegionAction::MetaClipRegionAction( const Region
& rRegion
, BOOL bClip
) :
2738 MetaAction ( META_CLIPREGION_ACTION
),
2739 maRegion ( rRegion
),
2744 // ------------------------------------------------------------------------
2746 void MetaClipRegionAction::Execute( OutputDevice
* pOut
)
2749 pOut
->SetClipRegion( maRegion
);
2751 pOut
->SetClipRegion();
2754 // ------------------------------------------------------------------------
2756 MetaAction
* MetaClipRegionAction::Clone()
2758 MetaAction
* pClone
= (MetaAction
*) new MetaClipRegionAction( *this );
2759 pClone
->ResetRefCount();
2763 // ------------------------------------------------------------------------
2765 void MetaClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2767 maRegion
.Move( nHorzMove
, nVertMove
);
2770 // ------------------------------------------------------------------------
2772 void MetaClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2774 maRegion
.Scale( fScaleX
, fScaleY
);
2777 // ------------------------------------------------------------------------
2779 sal_Bool
MetaClipRegionAction::Compare( const MetaAction
& rMetaAction
) const
2781 return ( maRegion
== ((MetaClipRegionAction
&)rMetaAction
).maRegion
) &&
2782 ( mbClip
== ((MetaClipRegionAction
&)rMetaAction
).mbClip
);
2785 // ------------------------------------------------------------------------
2787 void MetaClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2789 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2790 rOStm
<< maRegion
<< mbClip
;
2793 // ------------------------------------------------------------------------
2795 void MetaClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2798 rIStm
>> maRegion
>> mbClip
;
2801 // ========================================================================
2803 IMPL_META_ACTION( ISectRectClipRegion
, META_ISECTRECTCLIPREGION_ACTION
)
2805 // ------------------------------------------------------------------------
2807 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const Rectangle
& rRect
) :
2808 MetaAction ( META_ISECTRECTCLIPREGION_ACTION
),
2813 // ------------------------------------------------------------------------
2815 void MetaISectRectClipRegionAction::Execute( OutputDevice
* pOut
)
2817 pOut
->IntersectClipRegion( maRect
);
2820 // ------------------------------------------------------------------------
2822 MetaAction
* MetaISectRectClipRegionAction::Clone()
2824 MetaAction
* pClone
= (MetaAction
*) new MetaISectRectClipRegionAction( *this );
2825 pClone
->ResetRefCount();
2829 // ------------------------------------------------------------------------
2831 void MetaISectRectClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2833 maRect
.Move( nHorzMove
, nVertMove
);
2836 // ------------------------------------------------------------------------
2838 void MetaISectRectClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2840 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2843 // ------------------------------------------------------------------------
2845 sal_Bool
MetaISectRectClipRegionAction::Compare( const MetaAction
& rMetaAction
) const
2847 return maRect
== ((MetaISectRectClipRegionAction
&)rMetaAction
).maRect
;
2850 // ------------------------------------------------------------------------
2852 void MetaISectRectClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2854 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2858 // ------------------------------------------------------------------------
2860 void MetaISectRectClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2866 // ========================================================================
2868 IMPL_META_ACTION( ISectRegionClipRegion
, META_ISECTREGIONCLIPREGION_ACTION
)
2870 // ------------------------------------------------------------------------
2872 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( const Region
& rRegion
) :
2873 MetaAction ( META_ISECTREGIONCLIPREGION_ACTION
),
2874 maRegion ( rRegion
)
2878 // ------------------------------------------------------------------------
2880 void MetaISectRegionClipRegionAction::Execute( OutputDevice
* pOut
)
2882 pOut
->IntersectClipRegion( maRegion
);
2885 // ------------------------------------------------------------------------
2887 MetaAction
* MetaISectRegionClipRegionAction::Clone()
2889 MetaAction
* pClone
= (MetaAction
*) new MetaISectRegionClipRegionAction( *this );
2890 pClone
->ResetRefCount();
2894 // ------------------------------------------------------------------------
2896 void MetaISectRegionClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2898 maRegion
.Move( nHorzMove
, nVertMove
);
2901 // ------------------------------------------------------------------------
2903 void MetaISectRegionClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2905 maRegion
.Scale( fScaleX
, fScaleY
);
2908 // ------------------------------------------------------------------------
2910 sal_Bool
MetaISectRegionClipRegionAction::Compare( const MetaAction
& rMetaAction
) const
2912 return maRegion
== ((MetaISectRegionClipRegionAction
&)rMetaAction
).maRegion
;
2915 // ------------------------------------------------------------------------
2917 void MetaISectRegionClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2919 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2923 // ------------------------------------------------------------------------
2925 void MetaISectRegionClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2931 // ========================================================================
2933 IMPL_META_ACTION( MoveClipRegion
, META_MOVECLIPREGION_ACTION
)
2935 // ------------------------------------------------------------------------
2937 MetaMoveClipRegionAction::MetaMoveClipRegionAction( long nHorzMove
, long nVertMove
) :
2938 MetaAction ( META_MOVECLIPREGION_ACTION
),
2939 mnHorzMove ( nHorzMove
),
2940 mnVertMove ( nVertMove
)
2944 // ------------------------------------------------------------------------
2946 void MetaMoveClipRegionAction::Execute( OutputDevice
* pOut
)
2948 pOut
->MoveClipRegion( mnHorzMove
, mnVertMove
);
2951 // ------------------------------------------------------------------------
2953 MetaAction
* MetaMoveClipRegionAction::Clone()
2955 MetaAction
* pClone
= (MetaAction
*) new MetaMoveClipRegionAction( *this );
2956 pClone
->ResetRefCount();
2960 // ------------------------------------------------------------------------
2962 void MetaMoveClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2964 mnHorzMove
= FRound( mnHorzMove
* fScaleX
);
2965 mnVertMove
= FRound( mnVertMove
* fScaleY
);
2968 // ------------------------------------------------------------------------
2970 sal_Bool
MetaMoveClipRegionAction::Compare( const MetaAction
& rMetaAction
) const
2972 return ( mnHorzMove
== ((MetaMoveClipRegionAction
&)rMetaAction
).mnHorzMove
) &&
2973 ( mnVertMove
== ((MetaMoveClipRegionAction
&)rMetaAction
).mnVertMove
);
2976 // ------------------------------------------------------------------------
2978 void MetaMoveClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2980 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
2981 rOStm
<< mnHorzMove
<< mnVertMove
;
2984 // ------------------------------------------------------------------------
2986 void MetaMoveClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2989 rIStm
>> mnHorzMove
>> mnVertMove
;
2992 // ========================================================================
2994 IMPL_META_ACTION( LineColor
, META_LINECOLOR_ACTION
)
2996 // ------------------------------------------------------------------------
2998 MetaLineColorAction::MetaLineColorAction( const Color
& rColor
, BOOL bSet
) :
2999 MetaAction ( META_LINECOLOR_ACTION
),
3005 // ------------------------------------------------------------------------
3007 void MetaLineColorAction::Execute( OutputDevice
* pOut
)
3010 pOut
->SetLineColor( maColor
);
3012 pOut
->SetLineColor();
3015 // ------------------------------------------------------------------------
3017 MetaAction
* MetaLineColorAction::Clone()
3019 MetaAction
* pClone
= (MetaAction
*) new MetaLineColorAction( *this );
3020 pClone
->ResetRefCount();
3024 // ------------------------------------------------------------------------
3026 sal_Bool
MetaLineColorAction::Compare( const MetaAction
& rMetaAction
) const
3028 return ( maColor
== ((MetaLineColorAction
&)rMetaAction
).maColor
) &&
3029 ( mbSet
== ((MetaLineColorAction
&)rMetaAction
).mbSet
);
3032 // ------------------------------------------------------------------------
3034 void MetaLineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3036 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3037 maColor
.Write( rOStm
, TRUE
);
3041 // ------------------------------------------------------------------------
3043 void MetaLineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3046 maColor
.Read( rIStm
, TRUE
);
3050 // ========================================================================
3052 IMPL_META_ACTION( FillColor
, META_FILLCOLOR_ACTION
)
3054 // ------------------------------------------------------------------------
3056 MetaFillColorAction::MetaFillColorAction( const Color
& rColor
, BOOL bSet
) :
3057 MetaAction ( META_FILLCOLOR_ACTION
),
3063 // ------------------------------------------------------------------------
3065 void MetaFillColorAction::Execute( OutputDevice
* pOut
)
3068 pOut
->SetFillColor( maColor
);
3070 pOut
->SetFillColor();
3073 // ------------------------------------------------------------------------
3075 MetaAction
* MetaFillColorAction::Clone()
3077 MetaAction
* pClone
= (MetaAction
*) new MetaFillColorAction( *this );
3078 pClone
->ResetRefCount();
3082 // ------------------------------------------------------------------------
3084 sal_Bool
MetaFillColorAction::Compare( const MetaAction
& rMetaAction
) const
3086 return ( maColor
== ((MetaFillColorAction
&)rMetaAction
).maColor
) &&
3087 ( mbSet
== ((MetaFillColorAction
&)rMetaAction
).mbSet
);
3090 // ------------------------------------------------------------------------
3092 void MetaFillColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3094 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3095 maColor
.Write( rOStm
, TRUE
);
3099 // ------------------------------------------------------------------------
3101 void MetaFillColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3104 maColor
.Read( rIStm
, TRUE
);
3108 // ========================================================================
3110 IMPL_META_ACTION( TextColor
, META_TEXTCOLOR_ACTION
)
3112 // ------------------------------------------------------------------------
3114 MetaTextColorAction::MetaTextColorAction( const Color
& rColor
) :
3115 MetaAction ( META_TEXTCOLOR_ACTION
),
3120 // ------------------------------------------------------------------------
3122 void MetaTextColorAction::Execute( OutputDevice
* pOut
)
3124 pOut
->SetTextColor( maColor
);
3127 // ------------------------------------------------------------------------
3129 MetaAction
* MetaTextColorAction::Clone()
3131 MetaAction
* pClone
= (MetaAction
*) new MetaTextColorAction( *this );
3132 pClone
->ResetRefCount();
3136 // ------------------------------------------------------------------------
3138 sal_Bool
MetaTextColorAction::Compare( const MetaAction
& rMetaAction
) const
3140 return maColor
== ((MetaTextColorAction
&)rMetaAction
).maColor
;
3143 // ------------------------------------------------------------------------
3145 void MetaTextColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3147 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3148 maColor
.Write( rOStm
, TRUE
);
3151 // ------------------------------------------------------------------------
3153 void MetaTextColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3156 maColor
.Read( rIStm
, TRUE
);
3159 // ========================================================================
3161 IMPL_META_ACTION( TextFillColor
, META_TEXTFILLCOLOR_ACTION
)
3163 // ------------------------------------------------------------------------
3165 MetaTextFillColorAction::MetaTextFillColorAction( const Color
& rColor
, BOOL bSet
) :
3166 MetaAction ( META_TEXTFILLCOLOR_ACTION
),
3172 // ------------------------------------------------------------------------
3174 void MetaTextFillColorAction::Execute( OutputDevice
* pOut
)
3177 pOut
->SetTextFillColor( maColor
);
3179 pOut
->SetTextFillColor();
3182 // ------------------------------------------------------------------------
3184 MetaAction
* MetaTextFillColorAction::Clone()
3186 MetaAction
* pClone
= (MetaAction
*) new MetaTextFillColorAction( *this );
3187 pClone
->ResetRefCount();
3191 // ------------------------------------------------------------------------
3193 sal_Bool
MetaTextFillColorAction::Compare( const MetaAction
& rMetaAction
) const
3195 return ( maColor
== ((MetaTextFillColorAction
&)rMetaAction
).maColor
) &&
3196 ( mbSet
== ((MetaTextFillColorAction
&)rMetaAction
).mbSet
);
3199 // ------------------------------------------------------------------------
3201 void MetaTextFillColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3203 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3204 maColor
.Write( rOStm
, TRUE
);
3208 // ------------------------------------------------------------------------
3210 void MetaTextFillColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3213 maColor
.Read( rIStm
, TRUE
);
3217 // ========================================================================
3219 IMPL_META_ACTION( TextLineColor
, META_TEXTLINECOLOR_ACTION
)
3221 // ------------------------------------------------------------------------
3223 MetaTextLineColorAction::MetaTextLineColorAction( const Color
& rColor
, BOOL bSet
) :
3224 MetaAction ( META_TEXTLINECOLOR_ACTION
),
3230 // ------------------------------------------------------------------------
3232 void MetaTextLineColorAction::Execute( OutputDevice
* pOut
)
3235 pOut
->SetTextLineColor( maColor
);
3237 pOut
->SetTextLineColor();
3240 // ------------------------------------------------------------------------
3242 MetaAction
* MetaTextLineColorAction::Clone()
3244 MetaAction
* pClone
= (MetaAction
*) new MetaTextLineColorAction( *this );
3245 pClone
->ResetRefCount();
3249 // ------------------------------------------------------------------------
3251 sal_Bool
MetaTextLineColorAction::Compare( const MetaAction
& rMetaAction
) const
3253 return ( maColor
== ((MetaTextLineColorAction
&)rMetaAction
).maColor
) &&
3254 ( mbSet
== ((MetaTextLineColorAction
&)rMetaAction
).mbSet
);
3257 // ------------------------------------------------------------------------
3259 void MetaTextLineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3261 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3262 maColor
.Write( rOStm
, TRUE
);
3266 // ------------------------------------------------------------------------
3268 void MetaTextLineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3271 maColor
.Read( rIStm
, TRUE
);
3275 // ========================================================================
3277 IMPL_META_ACTION( OverlineColor
, META_OVERLINECOLOR_ACTION
)
3279 // ------------------------------------------------------------------------
3281 MetaOverlineColorAction::MetaOverlineColorAction( const Color
& rColor
, BOOL bSet
) :
3282 MetaAction ( META_OVERLINECOLOR_ACTION
),
3288 // ------------------------------------------------------------------------
3290 void MetaOverlineColorAction::Execute( OutputDevice
* pOut
)
3293 pOut
->SetOverlineColor( maColor
);
3295 pOut
->SetOverlineColor();
3298 // ------------------------------------------------------------------------
3300 MetaAction
* MetaOverlineColorAction::Clone()
3302 MetaAction
* pClone
= (MetaAction
*) new MetaOverlineColorAction( *this );
3303 pClone
->ResetRefCount();
3307 // ------------------------------------------------------------------------
3309 sal_Bool
MetaOverlineColorAction::Compare( const MetaAction
& rMetaAction
) const
3311 return ( maColor
== ((MetaOverlineColorAction
&)rMetaAction
).maColor
) &&
3312 ( mbSet
== ((MetaOverlineColorAction
&)rMetaAction
).mbSet
);
3315 // ------------------------------------------------------------------------
3317 void MetaOverlineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3319 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3320 maColor
.Write( rOStm
, TRUE
);
3324 // ------------------------------------------------------------------------
3326 void MetaOverlineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3329 maColor
.Read( rIStm
, TRUE
);
3333 // ========================================================================
3335 IMPL_META_ACTION( TextAlign
, META_TEXTALIGN_ACTION
)
3337 // ------------------------------------------------------------------------
3339 MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign
) :
3340 MetaAction ( META_TEXTALIGN_ACTION
),
3345 // ------------------------------------------------------------------------
3347 void MetaTextAlignAction::Execute( OutputDevice
* pOut
)
3349 pOut
->SetTextAlign( maAlign
);
3352 // ------------------------------------------------------------------------
3354 MetaAction
* MetaTextAlignAction::Clone()
3356 MetaAction
* pClone
= (MetaAction
*) new MetaTextAlignAction( *this );
3357 pClone
->ResetRefCount();
3361 // ------------------------------------------------------------------------
3363 sal_Bool
MetaTextAlignAction::Compare( const MetaAction
& rMetaAction
) const
3365 return maAlign
== ((MetaTextAlignAction
&)rMetaAction
).maAlign
;
3368 // ------------------------------------------------------------------------
3370 void MetaTextAlignAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3372 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3373 rOStm
<< (UINT16
) maAlign
;
3376 // ------------------------------------------------------------------------
3378 void MetaTextAlignAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3383 rIStm
>> nTmp16
; maAlign
= (TextAlign
) nTmp16
;
3386 // ========================================================================
3388 IMPL_META_ACTION( MapMode
, META_MAPMODE_ACTION
)
3390 // ------------------------------------------------------------------------
3392 MetaMapModeAction::MetaMapModeAction( const MapMode
& rMapMode
) :
3393 MetaAction ( META_MAPMODE_ACTION
),
3394 maMapMode ( rMapMode
)
3398 // ------------------------------------------------------------------------
3400 void MetaMapModeAction::Execute( OutputDevice
* pOut
)
3402 pOut
->SetMapMode( maMapMode
);
3405 // ------------------------------------------------------------------------
3407 MetaAction
* MetaMapModeAction::Clone()
3409 MetaAction
* pClone
= (MetaAction
*) new MetaMapModeAction( *this );
3410 pClone
->ResetRefCount();
3414 // ------------------------------------------------------------------------
3416 void MetaMapModeAction::Scale( double fScaleX
, double fScaleY
)
3418 Point
aPoint( maMapMode
.GetOrigin() );
3420 ImplScalePoint( aPoint
, fScaleX
, fScaleY
);
3421 maMapMode
.SetOrigin( aPoint
);
3424 // ------------------------------------------------------------------------
3426 sal_Bool
MetaMapModeAction::Compare( const MetaAction
& rMetaAction
) const
3428 return maMapMode
== ((MetaMapModeAction
&)rMetaAction
).maMapMode
;
3431 // ------------------------------------------------------------------------
3433 void MetaMapModeAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3435 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3439 // ------------------------------------------------------------------------
3441 void MetaMapModeAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3447 // ========================================================================
3449 IMPL_META_ACTION( Font
, META_FONT_ACTION
)
3451 // ------------------------------------------------------------------------
3453 MetaFontAction::MetaFontAction( const Font
& rFont
) :
3454 MetaAction ( META_FONT_ACTION
),
3457 // #96876: because RTL_TEXTENCODING_SYMBOL is often set at the StarSymbol font,
3458 // we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems
3459 // to be the right way; changing the textencoding at other sources
3460 // is too dangerous at the moment
3461 if( ( ( maFont
.GetName().SearchAscii( "StarSymbol" ) != STRING_NOTFOUND
)
3462 || ( maFont
.GetName().SearchAscii( "OpenSymbol" ) != STRING_NOTFOUND
) )
3463 && ( maFont
.GetCharSet() != RTL_TEXTENCODING_UNICODE
) )
3465 maFont
.SetCharSet( RTL_TEXTENCODING_UNICODE
);
3469 // ------------------------------------------------------------------------
3471 void MetaFontAction::Execute( OutputDevice
* pOut
)
3473 pOut
->SetFont( maFont
);
3476 // ------------------------------------------------------------------------
3478 MetaAction
* MetaFontAction::Clone()
3480 MetaAction
* pClone
= (MetaAction
*) new MetaFontAction( *this );
3481 pClone
->ResetRefCount();
3485 // ------------------------------------------------------------------------
3487 void MetaFontAction::Scale( double fScaleX
, double fScaleY
)
3489 Size
aSize( maFont
.GetSize() );
3491 ImplScaleSize( aSize
, fScaleX
, fScaleY
);
3492 maFont
.SetSize( aSize
);
3495 // ------------------------------------------------------------------------
3497 sal_Bool
MetaFontAction::Compare( const MetaAction
& rMetaAction
) const
3499 return maFont
== ((MetaFontAction
&)rMetaAction
).maFont
;
3502 // ------------------------------------------------------------------------
3504 void MetaFontAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3506 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3508 pData
->meActualCharSet
= maFont
.GetCharSet();
3509 if ( pData
->meActualCharSet
== RTL_TEXTENCODING_DONTKNOW
)
3510 pData
->meActualCharSet
= gsl_getSystemTextEncoding();
3513 // ------------------------------------------------------------------------
3515 void MetaFontAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
3519 pData
->meActualCharSet
= maFont
.GetCharSet();
3520 if ( pData
->meActualCharSet
== RTL_TEXTENCODING_DONTKNOW
)
3521 pData
->meActualCharSet
= gsl_getSystemTextEncoding();
3524 // ========================================================================
3526 IMPL_META_ACTION( Push
, META_PUSH_ACTION
)
3528 // ------------------------------------------------------------------------
3530 MetaPushAction::MetaPushAction( USHORT nFlags
) :
3531 MetaAction ( META_PUSH_ACTION
),
3536 // ------------------------------------------------------------------------
3538 void MetaPushAction::Execute( OutputDevice
* pOut
)
3540 pOut
->Push( mnFlags
);
3543 // ------------------------------------------------------------------------
3545 MetaAction
* MetaPushAction::Clone()
3547 MetaAction
* pClone
= (MetaAction
*) new MetaPushAction( *this );
3548 pClone
->ResetRefCount();
3552 // ------------------------------------------------------------------------
3554 sal_Bool
MetaPushAction::Compare( const MetaAction
& rMetaAction
) const
3556 return mnFlags
== ((MetaPushAction
&)rMetaAction
).mnFlags
;
3559 // ------------------------------------------------------------------------
3561 void MetaPushAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3563 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3567 // ------------------------------------------------------------------------
3569 void MetaPushAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3575 // ========================================================================
3577 IMPL_META_ACTION( Pop
, META_POP_ACTION
)
3579 // ------------------------------------------------------------------------
3581 void MetaPopAction::Execute( OutputDevice
* pOut
)
3586 // ------------------------------------------------------------------------
3588 MetaAction
* MetaPopAction::Clone()
3590 MetaAction
* pClone
= (MetaAction
*) new MetaPopAction( *this );
3591 pClone
->ResetRefCount();
3595 // ------------------------------------------------------------------------
3597 void MetaPopAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3599 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3602 // ------------------------------------------------------------------------
3604 void MetaPopAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3609 // ========================================================================
3611 IMPL_META_ACTION( RasterOp
, META_RASTEROP_ACTION
)
3613 // ------------------------------------------------------------------------
3615 MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp
) :
3616 MetaAction ( META_RASTEROP_ACTION
),
3617 meRasterOp ( eRasterOp
)
3621 // ------------------------------------------------------------------------
3623 void MetaRasterOpAction::Execute( OutputDevice
* pOut
)
3625 pOut
->SetRasterOp( meRasterOp
);
3628 // ------------------------------------------------------------------------
3630 MetaAction
* MetaRasterOpAction::Clone()
3632 MetaAction
* pClone
= (MetaAction
*) new MetaRasterOpAction( *this );
3633 pClone
->ResetRefCount();
3637 // ------------------------------------------------------------------------
3639 sal_Bool
MetaRasterOpAction::Compare( const MetaAction
& rMetaAction
) const
3641 return meRasterOp
== ((MetaRasterOpAction
&)rMetaAction
).meRasterOp
;
3644 // ------------------------------------------------------------------------
3646 void MetaRasterOpAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3648 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3649 rOStm
<< (UINT16
) meRasterOp
;
3652 // ------------------------------------------------------------------------
3654 void MetaRasterOpAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3659 rIStm
>> nTmp16
; meRasterOp
= (RasterOp
) nTmp16
;
3662 // ========================================================================
3664 IMPL_META_ACTION( Transparent
, META_TRANSPARENT_ACTION
)
3666 // ------------------------------------------------------------------------
3668 MetaTransparentAction::MetaTransparentAction( const PolyPolygon
& rPolyPoly
, USHORT nTransPercent
) :
3669 MetaAction ( META_TRANSPARENT_ACTION
),
3670 maPolyPoly ( rPolyPoly
),
3671 mnTransPercent ( nTransPercent
)
3675 // ------------------------------------------------------------------------
3677 void MetaTransparentAction::Execute( OutputDevice
* pOut
)
3679 pOut
->DrawTransparent( maPolyPoly
, mnTransPercent
);
3682 // ------------------------------------------------------------------------
3684 MetaAction
* MetaTransparentAction::Clone()
3686 MetaAction
* pClone
= (MetaAction
*) new MetaTransparentAction( *this );
3687 pClone
->ResetRefCount();
3691 // ------------------------------------------------------------------------
3693 void MetaTransparentAction::Move( long nHorzMove
, long nVertMove
)
3695 maPolyPoly
.Move( nHorzMove
, nVertMove
);
3698 // ------------------------------------------------------------------------
3700 void MetaTransparentAction::Scale( double fScaleX
, double fScaleY
)
3702 for( USHORT i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
3703 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
3706 // ------------------------------------------------------------------------
3708 sal_Bool
MetaTransparentAction::Compare( const MetaAction
& rMetaAction
) const
3710 return ( maPolyPoly
== ((MetaTransparentAction
&)rMetaAction
).maPolyPoly
) &&
3711 ( mnTransPercent
== ((MetaTransparentAction
&)rMetaAction
).mnTransPercent
);
3714 // ------------------------------------------------------------------------
3716 void MetaTransparentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3718 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3719 rOStm
<< maPolyPoly
;
3720 rOStm
<< mnTransPercent
;
3723 // ------------------------------------------------------------------------
3725 void MetaTransparentAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3728 rIStm
>> maPolyPoly
;
3729 rIStm
>> mnTransPercent
;
3732 // ========================================================================
3734 IMPL_META_ACTION( FloatTransparent
, META_FLOATTRANSPARENT_ACTION
)
3736 // ------------------------------------------------------------------------
3738 MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile
& rMtf
, const Point
& rPos
,
3739 const Size
& rSize
, const Gradient
& rGradient
) :
3740 MetaAction ( META_FLOATTRANSPARENT_ACTION
),
3744 maGradient ( rGradient
)
3748 // ------------------------------------------------------------------------
3750 void MetaFloatTransparentAction::Execute( OutputDevice
* pOut
)
3752 pOut
->DrawTransparent( maMtf
, maPoint
, maSize
, maGradient
);
3755 // ------------------------------------------------------------------------
3757 MetaAction
* MetaFloatTransparentAction::Clone()
3759 MetaAction
* pClone
= (MetaAction
*) new MetaFloatTransparentAction( *this );
3760 pClone
->ResetRefCount();
3764 // ------------------------------------------------------------------------
3766 void MetaFloatTransparentAction::Move( long nHorzMove
, long nVertMove
)
3768 maPoint
.Move( nHorzMove
, nVertMove
);
3771 // ------------------------------------------------------------------------
3773 void MetaFloatTransparentAction::Scale( double fScaleX
, double fScaleY
)
3775 ImplScalePoint( maPoint
, fScaleX
, fScaleY
);
3776 ImplScaleSize( maSize
, fScaleX
, fScaleY
);
3779 // ------------------------------------------------------------------------
3781 sal_Bool
MetaFloatTransparentAction::Compare( const MetaAction
& rMetaAction
) const
3783 return ( maMtf
== ((MetaFloatTransparentAction
&)rMetaAction
).maMtf
) &&
3784 ( maPoint
== ((MetaFloatTransparentAction
&)rMetaAction
).maPoint
) &&
3785 ( maSize
== ((MetaFloatTransparentAction
&)rMetaAction
).maSize
) &&
3786 ( maGradient
== ((MetaFloatTransparentAction
&)rMetaAction
).maGradient
);
3789 // ------------------------------------------------------------------------
3791 void MetaFloatTransparentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3793 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3795 maMtf
.Write( rOStm
);
3796 rOStm
<< maPoint
<< maSize
<< maGradient
;
3799 // ------------------------------------------------------------------------
3801 void MetaFloatTransparentAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3804 rIStm
>> maMtf
>> maPoint
>> maSize
>> maGradient
;
3807 // ========================================================================
3809 IMPL_META_ACTION( EPS
, META_EPS_ACTION
)
3811 // ------------------------------------------------------------------------
3813 MetaEPSAction::MetaEPSAction( const Point
& rPoint
, const Size
& rSize
,
3814 const GfxLink
& rGfxLink
, const GDIMetaFile
& rSubst
) :
3815 MetaAction ( META_EPS_ACTION
),
3816 maGfxLink ( rGfxLink
),
3823 // ------------------------------------------------------------------------
3825 void MetaEPSAction::Execute( OutputDevice
* pOut
)
3827 pOut
->DrawEPS( maPoint
, maSize
, maGfxLink
, &maSubst
);
3830 // ------------------------------------------------------------------------
3832 MetaAction
* MetaEPSAction::Clone()
3834 MetaAction
* pClone
= (MetaAction
*) new MetaEPSAction( *this );
3835 pClone
->ResetRefCount();
3839 // ------------------------------------------------------------------------
3841 void MetaEPSAction::Move( long nHorzMove
, long nVertMove
)
3843 maPoint
.Move( nHorzMove
, nVertMove
);
3846 // ------------------------------------------------------------------------
3848 void MetaEPSAction::Scale( double fScaleX
, double fScaleY
)
3850 ImplScalePoint( maPoint
, fScaleX
, fScaleY
);
3851 ImplScaleSize( maSize
, fScaleX
, fScaleY
);
3854 // ------------------------------------------------------------------------
3856 sal_Bool
MetaEPSAction::Compare( const MetaAction
& rMetaAction
) const
3858 return ( maGfxLink
.IsEqual(((MetaEPSAction
&)rMetaAction
).maGfxLink
)) &&
3859 ( maSubst
== ((MetaEPSAction
&)rMetaAction
).maSubst
) &&
3860 ( maPoint
== ((MetaEPSAction
&)rMetaAction
).maPoint
) &&
3861 ( maSize
== ((MetaEPSAction
&)rMetaAction
).maSize
);
3864 // ------------------------------------------------------------------------
3866 void MetaEPSAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3868 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3872 maSubst
.Write( rOStm
);
3875 // ------------------------------------------------------------------------
3877 void MetaEPSAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3886 // ========================================================================
3888 IMPL_META_ACTION( RefPoint
, META_REFPOINT_ACTION
)
3890 // ------------------------------------------------------------------------
3892 MetaRefPointAction::MetaRefPointAction( const Point
& rRefPoint
, BOOL bSet
) :
3893 MetaAction ( META_REFPOINT_ACTION
),
3894 maRefPoint ( rRefPoint
),
3899 // ------------------------------------------------------------------------
3901 void MetaRefPointAction::Execute( OutputDevice
* pOut
)
3904 pOut
->SetRefPoint( maRefPoint
);
3906 pOut
->SetRefPoint();
3909 // ------------------------------------------------------------------------
3911 MetaAction
* MetaRefPointAction::Clone()
3913 MetaAction
* pClone
= (MetaAction
*) new MetaRefPointAction( *this );
3914 pClone
->ResetRefCount();
3918 // ------------------------------------------------------------------------
3920 sal_Bool
MetaRefPointAction::Compare( const MetaAction
& rMetaAction
) const
3922 return ( maRefPoint
== ((MetaRefPointAction
&)rMetaAction
).maRefPoint
) &&
3923 ( mbSet
== ((MetaRefPointAction
&)rMetaAction
).mbSet
);
3926 // ------------------------------------------------------------------------
3928 void MetaRefPointAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3930 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
3931 rOStm
<< maRefPoint
<< mbSet
;
3934 // ------------------------------------------------------------------------
3936 void MetaRefPointAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3939 rIStm
>> maRefPoint
>> mbSet
;
3942 // ========================================================================
3944 MetaCommentAction::MetaCommentAction( sal_Int32 nValue
) :
3945 MetaAction ( META_COMMENT_ACTION
),
3948 ImplInitDynamicData( NULL
, 0UL );
3951 // ------------------------------------------------------------------------
3953 MetaCommentAction::MetaCommentAction( const MetaCommentAction
& rAct
) :
3954 MetaAction ( META_COMMENT_ACTION
),
3955 maComment ( rAct
.maComment
),
3956 mnValue ( rAct
.mnValue
)
3958 ImplInitDynamicData( rAct
.mpData
, rAct
.mnDataSize
);
3961 // ------------------------------------------------------------------------
3963 MetaCommentAction::MetaCommentAction( const ByteString
& rComment
, sal_Int32 nValue
, const BYTE
* pData
, sal_uInt32 nDataSize
) :
3964 MetaAction ( META_COMMENT_ACTION
),
3965 maComment ( rComment
),
3968 ImplInitDynamicData( pData
, nDataSize
);
3971 // ------------------------------------------------------------------------
3973 MetaCommentAction::MetaCommentAction( const BYTE
* pData
, sal_uInt32 nDataSize
) :
3974 MetaAction ( META_COMMENT_ACTION
),
3977 ImplInitDynamicData( pData
, nDataSize
);
3980 // ------------------------------------------------------------------------
3982 MetaCommentAction::~MetaCommentAction()
3988 // ------------------------------------------------------------------------
3990 void MetaCommentAction::ImplInitDynamicData( const BYTE
* pData
, sal_uInt32 nDataSize
)
3992 if ( nDataSize
&& pData
)
3994 mnDataSize
= nDataSize
, mpData
= new BYTE
[ mnDataSize
];
3995 memcpy( mpData
, pData
, mnDataSize
);
4004 // ------------------------------------------------------------------------
4006 void MetaCommentAction::Execute( OutputDevice
* pOut
)
4008 if ( pOut
->GetConnectMetaFile() )
4009 pOut
->GetConnectMetaFile()->AddAction( Clone() );
4012 // ------------------------------------------------------------------------
4014 MetaAction
* MetaCommentAction::Clone()
4016 MetaAction
* pClone
= (MetaAction
*) new MetaCommentAction( *this );
4017 pClone
->ResetRefCount();
4021 void MetaCommentAction::Move( long nXMove
, long nYMove
)
4023 if ( nXMove
|| nYMove
)
4025 if ( mnDataSize
&& mpData
)
4027 sal_Bool bPathStroke
= maComment
.Equals( "XPATHSTROKE_SEQ_BEGIN" );
4028 if ( bPathStroke
|| maComment
.Equals( "XPATHFILL_SEQ_BEGIN" ) )
4030 SvMemoryStream
aMemStm( (void*)mpData
, mnDataSize
, STREAM_READ
);
4031 SvMemoryStream aDest
;
4034 SvtGraphicStroke aStroke
;
4037 aStroke
.getPath( aPath
);
4038 aPath
.Move( nXMove
, nYMove
);
4039 aStroke
.setPath( aPath
);
4044 SvtGraphicFill aFill
;
4047 aFill
.getPath( aPath
);
4048 aPath
.Scale( nXMove
, nYMove
);
4049 aFill
.setPath( aPath
);
4053 ImplInitDynamicData( static_cast<const BYTE
*>( aDest
.GetData() ), aDest
.Tell() );
4059 // ------------------------------------------------------------------------
4060 // SJ: 25.07.06 #i56656# we are not able to mirrorcertain kind of
4061 // comments properly, especially the XPATHSTROKE and XPATHFILL lead to
4062 // problems, so it is better to remove these comments when mirroring
4063 void MetaCommentAction::Scale( double fXScale
, double fYScale
)
4065 if ( ( fXScale
!= 1.0 ) || ( fYScale
!= 1.0 ) )
4067 if ( mnDataSize
&& mpData
)
4069 sal_Bool bPathStroke
= maComment
.Equals( "XPATHSTROKE_SEQ_BEGIN" );
4070 if ( bPathStroke
|| maComment
.Equals( "XPATHFILL_SEQ_BEGIN" ) )
4072 SvMemoryStream
aMemStm( (void*)mpData
, mnDataSize
, STREAM_READ
);
4073 SvMemoryStream aDest
;
4076 SvtGraphicStroke aStroke
;
4079 aStroke
.getPath( aPath
);
4080 aPath
.Scale( fXScale
, fYScale
);
4081 aStroke
.setPath( aPath
);
4086 SvtGraphicFill aFill
;
4089 aFill
.getPath( aPath
);
4090 aPath
.Scale( fXScale
, fYScale
);
4091 aFill
.setPath( aPath
);
4095 ImplInitDynamicData( static_cast<const BYTE
*>( aDest
.GetData() ), aDest
.Tell() );
4096 } else if( maComment
.Equals( "EMF_PLUS_HEADER_INFO" ) ) {
4097 SvMemoryStream
aMemStm( (void*)mpData
, mnDataSize
, STREAM_READ
);
4098 SvMemoryStream aDest
;
4100 sal_Int32 nLeft
, nRight
, nTop
, nBottom
;
4101 sal_Int32 nPixX
, nPixY
, nMillX
, nMillY
;
4102 float m11
, m12
, m21
, m22
, mdx
, mdy
;
4105 aMemStm
>> nLeft
>> nTop
>> nRight
>> nBottom
;
4106 aMemStm
>> nPixX
>> nPixY
>> nMillX
>> nMillY
;
4107 aMemStm
>> m11
>> m12
>> m21
>> m22
>> mdx
>> mdy
;
4109 // add scale to the transformation
4116 aDest
<< nLeft
<< nTop
<< nRight
<< nBottom
;
4117 aDest
<< nPixX
<< nPixY
<< nMillX
<< nMillY
;
4118 aDest
<< m11
<< m12
<< m21
<< m22
<< mdx
<< mdy
;
4121 ImplInitDynamicData( static_cast<const BYTE
*>( aDest
.GetData() ), aDest
.Tell() );
4127 // ------------------------------------------------------------------------
4129 sal_Bool
MetaCommentAction::Compare( const MetaAction
& rMetaAction
) const
4131 return ( maComment
== ((MetaCommentAction
&)rMetaAction
).maComment
) &&
4132 ( mnValue
== ((MetaCommentAction
&)rMetaAction
).mnValue
) &&
4133 ( mnDataSize
== ((MetaCommentAction
&)rMetaAction
).mnDataSize
) &&
4134 ( memcmp( mpData
, ((MetaCommentAction
&)rMetaAction
).mpData
, mnDataSize
) == 0 );
4137 // ------------------------------------------------------------------------
4139 void MetaCommentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
4141 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
4142 rOStm
<< maComment
<< mnValue
<< mnDataSize
;
4145 rOStm
.Write( mpData
, mnDataSize
);
4148 // ------------------------------------------------------------------------
4150 void MetaCommentAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
4153 rIStm
>> maComment
>> mnValue
>> mnDataSize
;
4160 mpData
= new BYTE
[ mnDataSize
];
4161 rIStm
.Read( mpData
, mnDataSize
);
4167 // ========================================================================
4169 IMPL_META_ACTION( LayoutMode
, META_LAYOUTMODE_ACTION
)
4171 // ------------------------------------------------------------------------
4173 MetaLayoutModeAction::MetaLayoutModeAction( sal_uInt32 nLayoutMode
) :
4174 MetaAction ( META_LAYOUTMODE_ACTION
),
4175 mnLayoutMode( nLayoutMode
)
4179 // ------------------------------------------------------------------------
4181 void MetaLayoutModeAction::Execute( OutputDevice
* pOut
)
4183 pOut
->SetLayoutMode( mnLayoutMode
);
4186 // ------------------------------------------------------------------------
4188 MetaAction
* MetaLayoutModeAction::Clone()
4190 MetaAction
* pClone
= (MetaAction
*) new MetaLayoutModeAction( *this );
4191 pClone
->ResetRefCount();
4195 // ------------------------------------------------------------------------
4197 sal_Bool
MetaLayoutModeAction::Compare( const MetaAction
& rMetaAction
) const
4199 return mnLayoutMode
== ((MetaLayoutModeAction
&)rMetaAction
).mnLayoutMode
;
4202 // ------------------------------------------------------------------------
4204 void MetaLayoutModeAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
4206 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
4207 rOStm
<< mnLayoutMode
;
4210 // ------------------------------------------------------------------------
4212 void MetaLayoutModeAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
4215 rIStm
>> mnLayoutMode
;
4218 // ========================================================================
4220 IMPL_META_ACTION( TextLanguage
, META_TEXTLANGUAGE_ACTION
)
4222 // ------------------------------------------------------------------------
4224 MetaTextLanguageAction::MetaTextLanguageAction( LanguageType eTextLanguage
) :
4225 MetaAction ( META_TEXTLANGUAGE_ACTION
),
4226 meTextLanguage( eTextLanguage
)
4230 // ------------------------------------------------------------------------
4232 void MetaTextLanguageAction::Execute( OutputDevice
* pOut
)
4234 pOut
->SetDigitLanguage( meTextLanguage
);
4237 // ------------------------------------------------------------------------
4239 MetaAction
* MetaTextLanguageAction::Clone()
4241 MetaAction
* pClone
= (MetaAction
*) new MetaTextLanguageAction( *this );
4242 pClone
->ResetRefCount();
4246 // ------------------------------------------------------------------------
4248 sal_Bool
MetaTextLanguageAction::Compare( const MetaAction
& rMetaAction
) const
4250 return meTextLanguage
== ((MetaTextLanguageAction
&)rMetaAction
).meTextLanguage
;
4253 // ------------------------------------------------------------------------
4255 void MetaTextLanguageAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
4257 WRITE_BASE_COMPAT( rOStm
, 1, pData
);
4258 rOStm
<< meTextLanguage
;
4261 // ------------------------------------------------------------------------
4263 void MetaTextLanguageAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
4266 rIStm
>> meTextLanguage
;
4269 // ========================================================================