00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "precompiled_vcl.hxx"
00030
00031 #define ENABLE_BYTESTRING_STREAM_OPERATORS
00032
00033 #include <algorithm>
00034 #include <string.h>
00035 #include <tools/stream.hxx>
00036 #include <tools/vcompat.hxx>
00037 #include <vcl/outdev.hxx>
00038 #include <vcl/salbtype.hxx>
00039 #include <vcl/metaact.hxx>
00040 #include <vcl/graphictools.hxx>
00041
00042
00043
00044 inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
00045 {
00046 rPt.X() = FRound( fScaleX * rPt.X() );
00047 rPt.Y() = FRound( fScaleY * rPt.Y() );
00048 }
00049
00050
00051
00052 inline void ImplScaleSize( Size& rSz, double fScaleX, double fScaleY )
00053 {
00054 rSz.Width() = FRound( fScaleX * rSz.Width() );
00055 rSz.Height() = FRound( fScaleY * rSz.Height() );
00056 }
00057
00058
00059
00060 inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY )
00061 {
00062 Point aTL( rRect.TopLeft() );
00063 Point aBR( rRect.BottomRight() );
00064
00065 ImplScalePoint( aTL, fScaleX, fScaleY );
00066 ImplScalePoint( aBR, fScaleX, fScaleY );
00067
00068 rRect = Rectangle( aTL, aBR );
00069 }
00070
00071
00072
00073 inline void ImplScalePoly( Polygon& rPoly, double fScaleX, double fScaleY )
00074 {
00075 for( USHORT i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
00076 ImplScalePoint( rPoly[ i ], fScaleX, fScaleY );
00077 }
00078
00079
00080
00081 inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScaleY )
00082 {
00083 if( !rLineInfo.IsDefault() )
00084 {
00085 const double fScale = ( fScaleX + fScaleY ) * 0.5;
00086
00087 rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) );
00088 rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) );
00089 rLineInfo.SetDotLen( FRound( fScale * rLineInfo.GetDotLen() ) );
00090 rLineInfo.SetDistance( FRound( fScale * rLineInfo.GetDistance() ) );
00091 }
00092 }
00093
00094
00095
00096 #define COMPAT( _def_rIStm ) VersionCompat aCompat( ( _def_rIStm ), STREAM_READ );
00097 #define COMPAT_VERSION() aCompat.GetVersion()
00098 #define WRITE_BASE_COMPAT( _def_rOStm, _def_nVer, _pWriteData ) \
00099 MetaAction::Write( ( _def_rOStm ), _pWriteData ); \
00100 VersionCompat aCompat( ( _def_rOStm ), STREAM_WRITE, ( _def_nVer ) );
00101
00102
00103
00104 MetaAction::MetaAction() :
00105 mnRefCount( 1 ),
00106 mnType( META_NULL_ACTION )
00107 {
00108 }
00109
00110
00111
00112 MetaAction::MetaAction( USHORT nType ) :
00113 mnRefCount( 1 ),
00114 mnType( nType )
00115 {
00116 }
00117
00118
00119
00120 MetaAction::~MetaAction()
00121 {
00122 }
00123
00124
00125
00126 void MetaAction::Execute( OutputDevice* )
00127 {
00128 }
00129
00130
00131
00132 MetaAction* MetaAction::Clone()
00133 {
00134 return new MetaAction;
00135 }
00136
00137
00138
00139 void MetaAction::Move( long, long )
00140 {
00141 }
00142
00143
00144
00145 void MetaAction::Scale( double, double )
00146 {
00147 }
00148
00149
00150
00151 sal_Bool MetaAction::Compare( const MetaAction& ) const
00152 {
00153 return sal_True;
00154 }
00155
00156
00157
00158 sal_Bool MetaAction::IsEqual( const MetaAction& rMetaAction ) const
00159 {
00160 if ( mnType != rMetaAction.mnType )
00161 return sal_False;
00162 else
00163 return Compare( rMetaAction );
00164 }
00165
00166
00167
00168 void MetaAction::Write( SvStream& rOStm, ImplMetaWriteData* )
00169 {
00170 rOStm << mnType;
00171 }
00172
00173
00174
00175 void MetaAction::Read( SvStream& rIStm, ImplMetaReadData* )
00176 {
00177 rIStm >> mnType;
00178 }
00179
00180
00181
00182 MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData )
00183 {
00184 MetaAction* pAction = NULL;
00185 UINT16 nType;
00186
00187 rIStm >> nType;
00188
00189 switch( nType )
00190 {
00191 case( META_NULL_ACTION ): pAction = new MetaAction; break;
00192 case( META_PIXEL_ACTION ): pAction = new MetaPixelAction; break;
00193 case( META_POINT_ACTION ): pAction = new MetaPointAction; break;
00194 case( META_LINE_ACTION ): pAction = new MetaLineAction; break;
00195 case( META_RECT_ACTION ): pAction = new MetaRectAction; break;
00196 case( META_ROUNDRECT_ACTION ): pAction = new MetaRoundRectAction; break;
00197 case( META_ELLIPSE_ACTION ): pAction = new MetaEllipseAction; break;
00198 case( META_ARC_ACTION ): pAction = new MetaArcAction; break;
00199 case( META_PIE_ACTION ): pAction = new MetaPieAction; break;
00200 case( META_CHORD_ACTION ): pAction = new MetaChordAction; break;
00201 case( META_POLYLINE_ACTION ): pAction = new MetaPolyLineAction; break;
00202 case( META_POLYGON_ACTION ): pAction = new MetaPolygonAction; break;
00203 case( META_POLYPOLYGON_ACTION ): pAction = new MetaPolyPolygonAction; break;
00204 case( META_TEXT_ACTION ): pAction = new MetaTextAction; break;
00205 case( META_TEXTARRAY_ACTION ): pAction = new MetaTextArrayAction; break;
00206 case( META_STRETCHTEXT_ACTION ): pAction = new MetaStretchTextAction; break;
00207 case( META_TEXTRECT_ACTION ): pAction = new MetaTextRectAction; break;
00208 case( META_TEXTLINE_ACTION ): pAction = new MetaTextLineAction; break;
00209 case( META_BMP_ACTION ): pAction = new MetaBmpAction; break;
00210 case( META_BMPSCALE_ACTION ): pAction = new MetaBmpScaleAction; break;
00211 case( META_BMPSCALEPART_ACTION ): pAction = new MetaBmpScalePartAction; break;
00212 case( META_BMPEX_ACTION ): pAction = new MetaBmpExAction; break;
00213 case( META_BMPEXSCALE_ACTION ): pAction = new MetaBmpExScaleAction; break;
00214 case( META_BMPEXSCALEPART_ACTION ): pAction = new MetaBmpExScalePartAction; break;
00215 case( META_MASK_ACTION ): pAction = new MetaMaskAction; break;
00216 case( META_MASKSCALE_ACTION ): pAction = new MetaMaskScaleAction; break;
00217 case( META_MASKSCALEPART_ACTION ): pAction = new MetaMaskScalePartAction; break;
00218 case( META_GRADIENT_ACTION ): pAction = new MetaGradientAction; break;
00219 case( META_GRADIENTEX_ACTION ): pAction = new MetaGradientExAction; break;
00220 case( META_HATCH_ACTION ): pAction = new MetaHatchAction; break;
00221 case( META_WALLPAPER_ACTION ): pAction = new MetaWallpaperAction; break;
00222 case( META_CLIPREGION_ACTION ): pAction = new MetaClipRegionAction; break;
00223 case( META_ISECTRECTCLIPREGION_ACTION ): pAction = new MetaISectRectClipRegionAction; break;
00224 case( META_ISECTREGIONCLIPREGION_ACTION ): pAction = new MetaISectRegionClipRegionAction; break;
00225 case( META_MOVECLIPREGION_ACTION ): pAction = new MetaMoveClipRegionAction; break;
00226 case( META_LINECOLOR_ACTION ): pAction = new MetaLineColorAction; break;
00227 case( META_FILLCOLOR_ACTION ): pAction = new MetaFillColorAction; break;
00228 case( META_TEXTCOLOR_ACTION ): pAction = new MetaTextColorAction; break;
00229 case( META_TEXTFILLCOLOR_ACTION ): pAction = new MetaTextFillColorAction; break;
00230 case( META_TEXTLINECOLOR_ACTION ): pAction = new MetaTextLineColorAction; break;
00231 case( META_OVERLINECOLOR_ACTION ): pAction = new MetaOverlineColorAction; break;
00232 case( META_TEXTALIGN_ACTION ): pAction = new MetaTextAlignAction; break;
00233 case( META_MAPMODE_ACTION ): pAction = new MetaMapModeAction; break;
00234 case( META_FONT_ACTION ): pAction = new MetaFontAction; break;
00235 case( META_PUSH_ACTION ): pAction = new MetaPushAction; break;
00236 case( META_POP_ACTION ): pAction = new MetaPopAction; break;
00237 case( META_RASTEROP_ACTION ): pAction = new MetaRasterOpAction; break;
00238 case( META_TRANSPARENT_ACTION ): pAction = new MetaTransparentAction; break;
00239 case( META_FLOATTRANSPARENT_ACTION ): pAction = new MetaFloatTransparentAction; break;
00240 case( META_EPS_ACTION ): pAction = new MetaEPSAction; break;
00241 case( META_REFPOINT_ACTION ): pAction = new MetaRefPointAction; break;
00242 case( META_COMMENT_ACTION ): pAction = new MetaCommentAction; break;
00243 case( META_LAYOUTMODE_ACTION ): pAction = new MetaLayoutModeAction; break;
00244 case( META_TEXTLANGUAGE_ACTION ): pAction = new MetaTextLanguageAction; break;
00245
00246 default:
00247 {
00248
00249
00250 delete ( new VersionCompat( rIStm, STREAM_READ ) );
00251 }
00252 break;
00253 }
00254
00255 if( pAction )
00256 pAction->Read( rIStm, pData );
00257
00258 return pAction;
00259 }
00260
00261
00262
00263 IMPL_META_ACTION( Pixel, META_PIXEL_ACTION )
00264
00265
00266
00267 MetaPixelAction::MetaPixelAction( const Point& rPt, const Color& rColor ) :
00268 MetaAction ( META_PIXEL_ACTION ),
00269 maPt ( rPt ),
00270 maColor ( rColor )
00271 {
00272 }
00273
00274
00275
00276 void MetaPixelAction::Execute( OutputDevice* pOut )
00277 {
00278 pOut->DrawPixel( maPt, maColor );
00279 }
00280
00281
00282
00283 MetaAction* MetaPixelAction::Clone()
00284 {
00285 MetaAction* pClone = (MetaAction*) new MetaPixelAction( *this );
00286 pClone->ResetRefCount();
00287 return pClone;
00288 }
00289
00290
00291
00292 void MetaPixelAction::Move( long nHorzMove, long nVertMove )
00293 {
00294 maPt.Move( nHorzMove, nVertMove );
00295 }
00296
00297
00298
00299 void MetaPixelAction::Scale( double fScaleX, double fScaleY )
00300 {
00301 ImplScalePoint( maPt, fScaleX, fScaleY );
00302 }
00303
00304
00305
00306 sal_Bool MetaPixelAction::Compare( const MetaAction& rMetaAction ) const
00307 {
00308 return ( maPt == ((MetaPixelAction&)rMetaAction).maPt ) &&
00309 ( maColor == ((MetaPixelAction&)rMetaAction).maColor );
00310 }
00311
00312
00313
00314 void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00315 {
00316 WRITE_BASE_COMPAT( rOStm, 1, pData );
00317 rOStm << maPt;
00318 maColor.Write( rOStm, TRUE );
00319 }
00320
00321
00322
00323 void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* )
00324 {
00325 COMPAT( rIStm );
00326 rIStm >> maPt;
00327 maColor.Read( rIStm, TRUE );
00328 }
00329
00330
00331
00332 IMPL_META_ACTION( Point, META_POINT_ACTION )
00333
00334
00335
00336 MetaPointAction::MetaPointAction( const Point& rPt ) :
00337 MetaAction ( META_POINT_ACTION ),
00338 maPt ( rPt )
00339 {
00340 }
00341
00342
00343
00344 void MetaPointAction::Execute( OutputDevice* pOut )
00345 {
00346 pOut->DrawPixel( maPt );
00347 }
00348
00349
00350
00351 MetaAction* MetaPointAction::Clone()
00352 {
00353 MetaAction* pClone = (MetaAction*) new MetaPointAction( *this );
00354 pClone->ResetRefCount();
00355 return pClone;
00356 }
00357
00358
00359
00360 void MetaPointAction::Move( long nHorzMove, long nVertMove )
00361 {
00362 maPt.Move( nHorzMove, nVertMove );
00363 }
00364
00365
00366
00367 void MetaPointAction::Scale( double fScaleX, double fScaleY )
00368 {
00369 ImplScalePoint( maPt, fScaleX, fScaleY );
00370 }
00371
00372
00373
00374 sal_Bool MetaPointAction::Compare( const MetaAction& rMetaAction ) const
00375 {
00376 return maPt == ((MetaPointAction&)rMetaAction).maPt;
00377 }
00378
00379
00380
00381 void MetaPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00382 {
00383 WRITE_BASE_COMPAT( rOStm, 1, pData );
00384 rOStm << maPt;
00385 }
00386
00387
00388
00389 void MetaPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
00390 {
00391 COMPAT( rIStm );
00392 rIStm >> maPt;
00393 }
00394
00395
00396
00397 IMPL_META_ACTION( Line, META_LINE_ACTION )
00398
00399
00400
00401 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd ) :
00402 MetaAction ( META_LINE_ACTION ),
00403 maStartPt ( rStart ),
00404 maEndPt ( rEnd )
00405 {
00406 }
00407
00408
00409
00410 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd,
00411 const LineInfo& rLineInfo ) :
00412 MetaAction ( META_LINE_ACTION ),
00413 maLineInfo ( rLineInfo ),
00414 maStartPt ( rStart ),
00415 maEndPt ( rEnd )
00416 {
00417 }
00418
00419
00420
00421 void MetaLineAction::Execute( OutputDevice* pOut )
00422 {
00423 if( maLineInfo.IsDefault() )
00424 pOut->DrawLine( maStartPt, maEndPt );
00425 else
00426 pOut->DrawLine( maStartPt, maEndPt, maLineInfo );
00427 }
00428
00429
00430
00431 MetaAction* MetaLineAction::Clone()
00432 {
00433 MetaAction* pClone = (MetaAction*) new MetaLineAction( *this );
00434 pClone->ResetRefCount();
00435 return pClone;
00436 }
00437
00438
00439
00440 void MetaLineAction::Move( long nHorzMove, long nVertMove )
00441 {
00442 maStartPt.Move( nHorzMove, nVertMove );
00443 maEndPt.Move( nHorzMove, nVertMove );
00444 }
00445
00446
00447
00448 void MetaLineAction::Scale( double fScaleX, double fScaleY )
00449 {
00450 ImplScalePoint( maStartPt, fScaleX, fScaleY );
00451 ImplScalePoint( maEndPt, fScaleX, fScaleY );
00452 ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
00453 }
00454
00455
00456
00457 sal_Bool MetaLineAction::Compare( const MetaAction& rMetaAction ) const
00458 {
00459 return ( maLineInfo == ((MetaLineAction&)rMetaAction).maLineInfo ) &&
00460 ( maStartPt == ((MetaLineAction&)rMetaAction).maStartPt ) &&
00461 ( maEndPt == ((MetaLineAction&)rMetaAction).maEndPt );
00462 }
00463
00464
00465
00466 void MetaLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00467 {
00468 WRITE_BASE_COMPAT( rOStm, 2, pData );
00469
00470 rOStm << maStartPt << maEndPt;
00471 rOStm << maLineInfo;
00472 }
00473
00474
00475
00476 void MetaLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
00477 {
00478 COMPAT( rIStm );
00479
00480
00481 rIStm >> maStartPt >> maEndPt;
00482
00483
00484 if( aCompat.GetVersion() >= 2 )
00485 {
00486 rIStm >> maLineInfo;
00487 }
00488 }
00489
00490
00491
00492 IMPL_META_ACTION( Rect, META_RECT_ACTION )
00493
00494
00495
00496 MetaRectAction::MetaRectAction( const Rectangle& rRect ) :
00497 MetaAction ( META_RECT_ACTION ),
00498 maRect ( rRect )
00499 {
00500 }
00501
00502
00503
00504 void MetaRectAction::Execute( OutputDevice* pOut )
00505 {
00506 pOut->DrawRect( maRect );
00507 }
00508
00509
00510
00511 MetaAction* MetaRectAction::Clone()
00512 {
00513 MetaAction* pClone = (MetaAction*) new MetaRectAction( *this );
00514 pClone->ResetRefCount();
00515 return pClone;
00516 }
00517
00518
00519
00520 void MetaRectAction::Move( long nHorzMove, long nVertMove )
00521 {
00522 maRect.Move( nHorzMove, nVertMove );
00523 }
00524
00525
00526
00527 void MetaRectAction::Scale( double fScaleX, double fScaleY )
00528 {
00529 ImplScaleRect( maRect, fScaleX, fScaleY );
00530 }
00531
00532
00533
00534 sal_Bool MetaRectAction::Compare( const MetaAction& rMetaAction ) const
00535 {
00536 return maRect == ((MetaRectAction&)rMetaAction).maRect;
00537 }
00538
00539
00540
00541 void MetaRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00542 {
00543 WRITE_BASE_COMPAT( rOStm, 1, pData );
00544 rOStm << maRect;
00545 }
00546
00547
00548
00549 void MetaRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
00550 {
00551 COMPAT( rIStm );
00552 rIStm >> maRect;
00553 }
00554
00555
00556
00557 IMPL_META_ACTION( RoundRect, META_ROUNDRECT_ACTION )
00558
00559
00560
00561 MetaRoundRectAction::MetaRoundRectAction( const Rectangle& rRect,
00562 sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) :
00563 MetaAction ( META_ROUNDRECT_ACTION ),
00564 maRect ( rRect ),
00565 mnHorzRound ( nHorzRound ),
00566 mnVertRound ( nVertRound )
00567 {
00568 }
00569
00570
00571
00572 void MetaRoundRectAction::Execute( OutputDevice* pOut )
00573 {
00574 pOut->DrawRect( maRect, mnHorzRound, mnVertRound );
00575 }
00576
00577
00578
00579 MetaAction* MetaRoundRectAction::Clone()
00580 {
00581 MetaAction* pClone = (MetaAction*) new MetaRoundRectAction( *this );
00582 pClone->ResetRefCount();
00583 return pClone;
00584 }
00585
00586
00587
00588 void MetaRoundRectAction::Move( long nHorzMove, long nVertMove )
00589 {
00590 maRect.Move( nHorzMove, nVertMove );
00591 }
00592
00593
00594
00595 void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
00596 {
00597 ImplScaleRect( maRect, fScaleX, fScaleY );
00598 mnHorzRound = FRound( mnHorzRound * fScaleX );
00599 mnVertRound = FRound( mnVertRound * fScaleY );
00600 }
00601
00602
00603
00604 sal_Bool MetaRoundRectAction::Compare( const MetaAction& rMetaAction ) const
00605 {
00606 return ( maRect == ((MetaRoundRectAction&)rMetaAction).maRect ) &&
00607 ( mnHorzRound == ((MetaRoundRectAction&)rMetaAction).mnHorzRound ) &&
00608 ( mnVertRound == ((MetaRoundRectAction&)rMetaAction).mnVertRound );
00609 }
00610
00611
00612
00613 void MetaRoundRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00614 {
00615 WRITE_BASE_COMPAT( rOStm, 1, pData );
00616 rOStm << maRect << mnHorzRound << mnVertRound;
00617 }
00618
00619
00620
00621 void MetaRoundRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
00622 {
00623 COMPAT( rIStm );
00624 rIStm >> maRect >> mnHorzRound >> mnVertRound;
00625 }
00626
00627
00628
00629 IMPL_META_ACTION( Ellipse, META_ELLIPSE_ACTION )
00630
00631
00632
00633 MetaEllipseAction::MetaEllipseAction( const Rectangle& rRect ) :
00634 MetaAction ( META_ELLIPSE_ACTION ),
00635 maRect ( rRect )
00636 {
00637 }
00638
00639
00640
00641 void MetaEllipseAction::Execute( OutputDevice* pOut )
00642 {
00643 pOut->DrawEllipse( maRect );
00644 }
00645
00646
00647
00648 MetaAction* MetaEllipseAction::Clone()
00649 {
00650 MetaAction* pClone = (MetaAction*) new MetaEllipseAction( *this );
00651 pClone->ResetRefCount();
00652 return pClone;
00653 }
00654
00655
00656
00657 void MetaEllipseAction::Move( long nHorzMove, long nVertMove )
00658 {
00659 maRect.Move( nHorzMove, nVertMove );
00660 }
00661
00662
00663
00664 void MetaEllipseAction::Scale( double fScaleX, double fScaleY )
00665 {
00666 ImplScaleRect( maRect, fScaleX, fScaleY );
00667 }
00668
00669
00670
00671 sal_Bool MetaEllipseAction::Compare( const MetaAction& rMetaAction ) const
00672 {
00673 return maRect == ((MetaEllipseAction&)rMetaAction).maRect;
00674 }
00675
00676
00677
00678 void MetaEllipseAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00679 {
00680 WRITE_BASE_COMPAT( rOStm, 1, pData );
00681 rOStm << maRect;
00682 }
00683
00684
00685
00686 void MetaEllipseAction::Read( SvStream& rIStm, ImplMetaReadData* )
00687 {
00688 COMPAT( rIStm );
00689 rIStm >> maRect;
00690 }
00691
00692
00693
00694 IMPL_META_ACTION( Arc, META_ARC_ACTION )
00695
00696
00697
00698 MetaArcAction::MetaArcAction( const Rectangle& rRect,
00699 const Point& rStart, const Point& rEnd ) :
00700 MetaAction ( META_ARC_ACTION ),
00701 maRect ( rRect ),
00702 maStartPt ( rStart ),
00703 maEndPt ( rEnd )
00704 {
00705 }
00706
00707
00708
00709 void MetaArcAction::Execute( OutputDevice* pOut )
00710 {
00711 pOut->DrawArc( maRect, maStartPt, maEndPt );
00712 }
00713
00714
00715
00716 MetaAction* MetaArcAction::Clone()
00717 {
00718 MetaAction* pClone = (MetaAction*) new MetaArcAction( *this );
00719 pClone->ResetRefCount();
00720 return pClone;
00721 }
00722
00723
00724
00725 void MetaArcAction::Move( long nHorzMove, long nVertMove )
00726 {
00727 maRect.Move( nHorzMove, nVertMove );
00728 maStartPt.Move( nHorzMove, nVertMove );
00729 maEndPt.Move( nHorzMove, nVertMove );
00730 }
00731
00732
00733
00734 void MetaArcAction::Scale( double fScaleX, double fScaleY )
00735 {
00736 ImplScaleRect( maRect, fScaleX, fScaleY );
00737 ImplScalePoint( maStartPt, fScaleX, fScaleY );
00738 ImplScalePoint( maEndPt, fScaleX, fScaleY );
00739 }
00740
00741
00742
00743 sal_Bool MetaArcAction::Compare( const MetaAction& rMetaAction ) const
00744 {
00745 return ( maRect == ((MetaArcAction&)rMetaAction).maRect ) &&
00746 ( maStartPt == ((MetaArcAction&)rMetaAction).maStartPt ) &&
00747 ( maEndPt == ((MetaArcAction&)rMetaAction).maEndPt );
00748 }
00749
00750
00751
00752 void MetaArcAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00753 {
00754 WRITE_BASE_COMPAT( rOStm, 1, pData );
00755 rOStm << maRect << maStartPt << maEndPt;
00756 }
00757
00758
00759
00760 void MetaArcAction::Read( SvStream& rIStm, ImplMetaReadData* )
00761 {
00762 COMPAT( rIStm );
00763 rIStm >> maRect >> maStartPt >> maEndPt;
00764 }
00765
00766
00767
00768 IMPL_META_ACTION( Pie, META_PIE_ACTION )
00769
00770
00771
00772 MetaPieAction::MetaPieAction( const Rectangle& rRect,
00773 const Point& rStart, const Point& rEnd ) :
00774 MetaAction ( META_PIE_ACTION ),
00775 maRect ( rRect ),
00776 maStartPt ( rStart ),
00777 maEndPt ( rEnd )
00778 {
00779 }
00780
00781
00782
00783 void MetaPieAction::Execute( OutputDevice* pOut )
00784 {
00785 pOut->DrawPie( maRect, maStartPt, maEndPt );
00786 }
00787
00788
00789
00790 MetaAction* MetaPieAction::Clone()
00791 {
00792 MetaAction* pClone = (MetaAction*) new MetaPieAction( *this );
00793 pClone->ResetRefCount();
00794 return pClone;
00795 }
00796
00797
00798
00799 void MetaPieAction::Move( long nHorzMove, long nVertMove )
00800 {
00801 maRect.Move( nHorzMove, nVertMove );
00802 maStartPt.Move( nHorzMove, nVertMove );
00803 maEndPt.Move( nHorzMove, nVertMove );
00804 }
00805
00806
00807
00808 void MetaPieAction::Scale( double fScaleX, double fScaleY )
00809 {
00810 ImplScaleRect( maRect, fScaleX, fScaleY );
00811 ImplScalePoint( maStartPt, fScaleX, fScaleY );
00812 ImplScalePoint( maEndPt, fScaleX, fScaleY );
00813 }
00814
00815
00816
00817 sal_Bool MetaPieAction::Compare( const MetaAction& rMetaAction ) const
00818 {
00819 return ( maRect == ((MetaPieAction&)rMetaAction).maRect ) &&
00820 ( maStartPt == ((MetaPieAction&)rMetaAction).maStartPt ) &&
00821 ( maEndPt == ((MetaPieAction&)rMetaAction).maEndPt );
00822 }
00823
00824
00825
00826 void MetaPieAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00827 {
00828 WRITE_BASE_COMPAT( rOStm, 1, pData );
00829 rOStm << maRect << maStartPt << maEndPt;
00830 }
00831
00832
00833
00834 void MetaPieAction::Read( SvStream& rIStm, ImplMetaReadData* )
00835 {
00836 COMPAT( rIStm );
00837 rIStm >> maRect >> maStartPt >> maEndPt;
00838 }
00839
00840
00841
00842 IMPL_META_ACTION( Chord, META_CHORD_ACTION )
00843
00844
00845
00846 MetaChordAction::MetaChordAction( const Rectangle& rRect,
00847 const Point& rStart, const Point& rEnd ) :
00848 MetaAction ( META_CHORD_ACTION ),
00849 maRect ( rRect ),
00850 maStartPt ( rStart ),
00851 maEndPt ( rEnd )
00852 {
00853 }
00854
00855
00856
00857 void MetaChordAction::Execute( OutputDevice* pOut )
00858 {
00859 pOut->DrawChord( maRect, maStartPt, maEndPt );
00860 }
00861
00862
00863
00864 MetaAction* MetaChordAction::Clone()
00865 {
00866 MetaAction* pClone = (MetaAction*) new MetaChordAction( *this );
00867 pClone->ResetRefCount();
00868 return pClone;
00869 }
00870
00871
00872
00873 void MetaChordAction::Move( long nHorzMove, long nVertMove )
00874 {
00875 maRect.Move( nHorzMove, nVertMove );
00876 maStartPt.Move( nHorzMove, nVertMove );
00877 maEndPt.Move( nHorzMove, nVertMove );
00878 }
00879
00880
00881
00882 void MetaChordAction::Scale( double fScaleX, double fScaleY )
00883 {
00884 ImplScaleRect( maRect, fScaleX, fScaleY );
00885 ImplScalePoint( maStartPt, fScaleX, fScaleY );
00886 ImplScalePoint( maEndPt, fScaleX, fScaleY );
00887 }
00888
00889
00890
00891 sal_Bool MetaChordAction::Compare( const MetaAction& rMetaAction ) const
00892 {
00893 return ( maRect == ((MetaChordAction&)rMetaAction).maRect ) &&
00894 ( maStartPt == ((MetaChordAction&)rMetaAction).maStartPt ) &&
00895 ( maEndPt == ((MetaChordAction&)rMetaAction).maEndPt );
00896 }
00897
00898
00899
00900 void MetaChordAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00901 {
00902 WRITE_BASE_COMPAT( rOStm, 1, pData );
00903 rOStm << maRect << maStartPt << maEndPt;
00904 }
00905
00906
00907
00908 void MetaChordAction::Read( SvStream& rIStm, ImplMetaReadData* )
00909 {
00910 COMPAT( rIStm );
00911 rIStm >> maRect >> maStartPt >> maEndPt;
00912 }
00913
00914
00915
00916 IMPL_META_ACTION( PolyLine, META_POLYLINE_ACTION )
00917
00918
00919
00920 MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly ) :
00921 MetaAction ( META_POLYLINE_ACTION ),
00922 maPoly ( rPoly )
00923 {
00924 }
00925
00926
00927
00928 MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly, const LineInfo& rLineInfo ) :
00929 MetaAction ( META_POLYLINE_ACTION ),
00930 maLineInfo ( rLineInfo ),
00931 maPoly ( rPoly )
00932 {
00933 }
00934
00935
00936
00937 void MetaPolyLineAction::Execute( OutputDevice* pOut )
00938 {
00939 if( maLineInfo.IsDefault() )
00940 pOut->DrawPolyLine( maPoly );
00941 else
00942 pOut->DrawPolyLine( maPoly, maLineInfo );
00943 }
00944
00945
00946
00947 MetaAction* MetaPolyLineAction::Clone()
00948 {
00949 MetaAction* pClone = (MetaAction*) new MetaPolyLineAction( *this );
00950 pClone->ResetRefCount();
00951 return pClone;
00952 }
00953
00954
00955
00956 void MetaPolyLineAction::Move( long nHorzMove, long nVertMove )
00957 {
00958 maPoly.Move( nHorzMove, nVertMove );
00959 }
00960
00961
00962
00963 void MetaPolyLineAction::Scale( double fScaleX, double fScaleY )
00964 {
00965 ImplScalePoly( maPoly, fScaleX, fScaleY );
00966 ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
00967 }
00968
00969
00970
00971 sal_Bool MetaPolyLineAction::Compare( const MetaAction& rMetaAction ) const
00972 {
00973 sal_Bool bIsEqual = sal_True;;
00974 if ( maLineInfo != ((MetaPolyLineAction&)rMetaAction).maLineInfo )
00975 bIsEqual = sal_False;
00976 else
00977 bIsEqual = maPoly.IsEqual(((MetaPolyLineAction&)rMetaAction).maPoly );
00978 return bIsEqual;
00979
00980 }
00981
00982
00983
00984 void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
00985 {
00986 WRITE_BASE_COMPAT( rOStm, 3, pData );
00987
00988 Polygon aSimplePoly;
00989 maPoly.AdaptiveSubdivide( aSimplePoly );
00990
00991 rOStm << aSimplePoly;
00992 rOStm << maLineInfo;
00993
00994 sal_uInt8 bHasPolyFlags = maPoly.HasFlags();
00995 rOStm << bHasPolyFlags;
00996 if ( bHasPolyFlags )
00997 maPoly.Write( rOStm );
00998 }
00999
01000
01001
01002 void MetaPolyLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
01003 {
01004 COMPAT( rIStm );
01005
01006
01007 rIStm >> maPoly;
01008
01009
01010 if( aCompat.GetVersion() >= 2 )
01011 rIStm >> maLineInfo;
01012 if ( aCompat.GetVersion() >= 3 )
01013 {
01014 sal_uInt8 bHasPolyFlags;
01015 rIStm >> bHasPolyFlags;
01016 if ( bHasPolyFlags )
01017 maPoly.Read( rIStm );
01018 }
01019 }
01020
01021
01022
01023 IMPL_META_ACTION( Polygon, META_POLYGON_ACTION )
01024
01025
01026
01027 MetaPolygonAction::MetaPolygonAction( const Polygon& rPoly ) :
01028 MetaAction ( META_POLYGON_ACTION ),
01029 maPoly ( rPoly )
01030 {
01031 }
01032
01033
01034
01035 void MetaPolygonAction::Execute( OutputDevice* pOut )
01036 {
01037 pOut->DrawPolygon( maPoly );
01038 }
01039
01040
01041
01042 MetaAction* MetaPolygonAction::Clone()
01043 {
01044 MetaAction* pClone = (MetaAction*) new MetaPolygonAction( *this );
01045 pClone->ResetRefCount();
01046 return pClone;
01047 }
01048
01049
01050
01051 void MetaPolygonAction::Move( long nHorzMove, long nVertMove )
01052 {
01053 maPoly.Move( nHorzMove, nVertMove );
01054 }
01055
01056
01057
01058 void MetaPolygonAction::Scale( double fScaleX, double fScaleY )
01059 {
01060 ImplScalePoly( maPoly, fScaleX, fScaleY );
01061 }
01062
01063
01064
01065 sal_Bool MetaPolygonAction::Compare( const MetaAction& rMetaAction ) const
01066 {
01067 return maPoly.IsEqual(((MetaPolygonAction&)rMetaAction).maPoly );
01068 }
01069
01070
01071
01072 void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01073 {
01074 WRITE_BASE_COMPAT( rOStm, 2, pData );
01075
01076 Polygon aSimplePoly;
01077 maPoly.AdaptiveSubdivide( aSimplePoly );
01078 rOStm << aSimplePoly;
01079
01080 sal_uInt8 bHasPolyFlags = maPoly.HasFlags();
01081 rOStm << bHasPolyFlags;
01082 if ( bHasPolyFlags )
01083 maPoly.Write( rOStm );
01084 }
01085
01086
01087
01088 void MetaPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
01089 {
01090 COMPAT( rIStm );
01091
01092 rIStm >> maPoly;
01093
01094 if( aCompat.GetVersion() >= 2 )
01095 {
01096 sal_uInt8 bHasPolyFlags;
01097 rIStm >> bHasPolyFlags;
01098 if ( bHasPolyFlags )
01099 maPoly.Read( rIStm );
01100 }
01101 }
01102
01103
01104
01105 IMPL_META_ACTION( PolyPolygon, META_POLYPOLYGON_ACTION )
01106
01107
01108
01109 MetaPolyPolygonAction::MetaPolyPolygonAction( const PolyPolygon& rPolyPoly ) :
01110 MetaAction ( META_POLYPOLYGON_ACTION ),
01111 maPolyPoly ( rPolyPoly )
01112 {
01113 }
01114
01115
01116
01117 void MetaPolyPolygonAction::Execute( OutputDevice* pOut )
01118 {
01119 pOut->DrawPolyPolygon( maPolyPoly );
01120 }
01121
01122
01123
01124 MetaAction* MetaPolyPolygonAction::Clone()
01125 {
01126 MetaAction* pClone = (MetaAction*) new MetaPolyPolygonAction( *this );
01127 pClone->ResetRefCount();
01128 return pClone;
01129 }
01130
01131
01132
01133 void MetaPolyPolygonAction::Move( long nHorzMove, long nVertMove )
01134 {
01135 maPolyPoly.Move( nHorzMove, nVertMove );
01136 }
01137
01138
01139
01140 void MetaPolyPolygonAction::Scale( double fScaleX, double fScaleY )
01141 {
01142 for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
01143 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
01144 }
01145
01146
01147
01148 sal_Bool MetaPolyPolygonAction::Compare( const MetaAction& rMetaAction ) const
01149 {
01150 return maPolyPoly.IsEqual(((MetaPolyPolygonAction&)rMetaAction).maPolyPoly );
01151 }
01152
01153
01154
01155 void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01156 {
01157 WRITE_BASE_COMPAT( rOStm, 2, pData );
01158
01159 sal_uInt16 nNumberOfComplexPolygons = 0;
01160 sal_uInt16 i, nPolyCount = maPolyPoly.Count();
01161
01162 Polygon aSimplePoly;
01163 rOStm << nPolyCount;
01164 for ( i = 0; i < nPolyCount; i++ )
01165 {
01166 const Polygon& rPoly = maPolyPoly.GetObject( i );
01167 if ( rPoly.HasFlags() )
01168 nNumberOfComplexPolygons++;
01169 rPoly.AdaptiveSubdivide( aSimplePoly );
01170 rOStm << aSimplePoly;
01171 }
01172
01173 rOStm << nNumberOfComplexPolygons;
01174 for ( i = 0; nNumberOfComplexPolygons && ( i < nPolyCount ); i++ )
01175 {
01176 const Polygon& rPoly = maPolyPoly.GetObject( i );
01177 if ( rPoly.HasFlags() )
01178 {
01179 rOStm << i;
01180 rPoly.Write( rOStm );
01181
01182 nNumberOfComplexPolygons--;
01183 }
01184 }
01185 }
01186
01187
01188
01189 void MetaPolyPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
01190 {
01191 COMPAT( rIStm );
01192 rIStm >> maPolyPoly;
01193
01194 if ( aCompat.GetVersion() >= 2 )
01195 {
01196 sal_uInt16 i, nIndex, nNumberOfComplexPolygons;
01197 rIStm >> nNumberOfComplexPolygons;
01198 for ( i = 0; i < nNumberOfComplexPolygons; i++ )
01199 {
01200 rIStm >> nIndex;
01201 Polygon aPoly;
01202 aPoly.Read( rIStm );
01203 maPolyPoly.Replace( aPoly, nIndex );
01204 }
01205 }
01206 }
01207
01208
01209
01210 IMPL_META_ACTION( Text, META_TEXT_ACTION )
01211
01212
01213
01214 MetaTextAction::MetaTextAction( const Point& rPt, const XubString& rStr,
01215 USHORT nIndex, USHORT nLen ) :
01216 MetaAction ( META_TEXT_ACTION ),
01217 maPt ( rPt ),
01218 maStr ( rStr ),
01219 mnIndex ( nIndex ),
01220 mnLen ( nLen )
01221 {
01222 }
01223
01224
01225
01226 void MetaTextAction::Execute( OutputDevice* pOut )
01227 {
01228 pOut->DrawText( maPt, maStr, mnIndex, mnLen );
01229 }
01230
01231
01232
01233 MetaAction* MetaTextAction::Clone()
01234 {
01235 MetaAction* pClone = (MetaAction*) new MetaTextAction( *this );
01236 pClone->ResetRefCount();
01237 return pClone;
01238 }
01239
01240
01241
01242 void MetaTextAction::Move( long nHorzMove, long nVertMove )
01243 {
01244 maPt.Move( nHorzMove, nVertMove );
01245 }
01246
01247
01248
01249 void MetaTextAction::Scale( double fScaleX, double fScaleY )
01250 {
01251 ImplScalePoint( maPt, fScaleX, fScaleY );
01252 }
01253
01254
01255
01256 sal_Bool MetaTextAction::Compare( const MetaAction& rMetaAction ) const
01257 {
01258 return ( maPt == ((MetaTextAction&)rMetaAction).maPt ) &&
01259 ( maStr == ((MetaTextAction&)rMetaAction).maStr ) &&
01260 ( mnIndex == ((MetaTextAction&)rMetaAction).mnIndex ) &&
01261 ( mnLen == ((MetaTextAction&)rMetaAction).mnLen );
01262 }
01263
01264
01265
01266 void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01267 {
01268 WRITE_BASE_COMPAT( rOStm, 2, pData );
01269 rOStm << maPt;
01270 rOStm.WriteByteString( maStr, pData->meActualCharSet );
01271 rOStm << mnIndex;
01272 rOStm << mnLen;
01273
01274 sal_uInt16 i, nLen = maStr.Len();
01275 rOStm << nLen;
01276 for ( i = 0; i < nLen; i++ )
01277 {
01278 sal_Unicode nUni = maStr.GetChar( i );
01279 rOStm << nUni;
01280 }
01281 }
01282
01283
01284
01285 void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
01286 {
01287 COMPAT( rIStm );
01288 rIStm >> maPt;
01289 rIStm.ReadByteString( maStr, pData->meActualCharSet );
01290 rIStm >> mnIndex;
01291 rIStm >> mnLen;
01292
01293 if ( aCompat.GetVersion() >= 2 )
01294 {
01295 sal_uInt16 nLen;
01296 rIStm >> nLen;
01297 sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
01298 while ( nLen-- )
01299 rIStm >> *pBuffer++;
01300 }
01301 }
01302
01303
01304
01305 MetaTextArrayAction::MetaTextArrayAction() :
01306 MetaAction ( META_TEXTARRAY_ACTION ),
01307 mpDXAry ( NULL ),
01308 mnIndex ( 0 ),
01309 mnLen ( 0 )
01310 {
01311 }
01312
01313
01314
01315 MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) :
01316 MetaAction ( META_TEXTARRAY_ACTION ),
01317 maStartPt ( rAction.maStartPt ),
01318 maStr ( rAction.maStr ),
01319 mnIndex ( rAction.mnIndex ),
01320 mnLen ( rAction.mnLen )
01321 {
01322 if( rAction.mpDXAry )
01323 {
01324 const ULONG nAryLen = mnLen;
01325
01326 mpDXAry = new sal_Int32[ nAryLen ];
01327 memcpy( mpDXAry, rAction.mpDXAry, nAryLen * sizeof( sal_Int32 ) );
01328 }
01329 else
01330 mpDXAry = NULL;
01331 }
01332
01333
01334
01335 MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
01336 const XubString& rStr,
01337 const sal_Int32* pDXAry,
01338 USHORT nIndex,
01339 USHORT nLen ) :
01340 MetaAction ( META_TEXTARRAY_ACTION ),
01341 maStartPt ( rStartPt ),
01342 maStr ( rStr ),
01343 mnIndex ( nIndex ),
01344 mnLen ( ( nLen == STRING_LEN ) ? rStr.Len() : nLen )
01345 {
01346 const ULONG nAryLen = pDXAry ? mnLen : 0;
01347
01348 if( nAryLen )
01349 {
01350 mpDXAry = new sal_Int32[ nAryLen ];
01351 memcpy( mpDXAry, pDXAry, nAryLen * sizeof( sal_Int32 ) );
01352 }
01353 else
01354 mpDXAry = NULL;
01355 }
01356
01357
01358
01359 MetaTextArrayAction::~MetaTextArrayAction()
01360 {
01361 delete[] mpDXAry;
01362 }
01363
01364
01365
01366 void MetaTextArrayAction::Execute( OutputDevice* pOut )
01367 {
01368 pOut->DrawTextArray( maStartPt, maStr, mpDXAry, mnIndex, mnLen );
01369 }
01370
01371
01372
01373 MetaAction* MetaTextArrayAction::Clone()
01374 {
01375 MetaAction* pClone = (MetaAction*) new MetaTextArrayAction( *this );
01376 pClone->ResetRefCount();
01377 return pClone;
01378 }
01379
01380
01381
01382 void MetaTextArrayAction::Move( long nHorzMove, long nVertMove )
01383 {
01384 maStartPt.Move( nHorzMove, nVertMove );
01385 }
01386
01387
01388
01389 void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
01390 {
01391 ImplScalePoint( maStartPt, fScaleX, fScaleY );
01392
01393 if ( mpDXAry && mnLen )
01394 {
01395 for ( USHORT i = 0, nCount = mnLen; i < nCount; i++ )
01396 mpDXAry[ i ] = FRound( mpDXAry[ i ] * fScaleX );
01397 }
01398 }
01399
01400
01401
01402 sal_Bool MetaTextArrayAction::Compare( const MetaAction& rMetaAction ) const
01403 {
01404 return ( maStartPt == ((MetaTextArrayAction&)rMetaAction).maStartPt ) &&
01405 ( maStr == ((MetaTextArrayAction&)rMetaAction).maStr ) &&
01406 ( mnIndex == ((MetaTextArrayAction&)rMetaAction).mnIndex ) &&
01407 ( mnLen == ((MetaTextArrayAction&)rMetaAction).mnLen ) &&
01408 ( memcmp( mpDXAry, ((MetaTextArrayAction&)rMetaAction).mpDXAry, mnLen ) == 0 );
01409 }
01410
01411
01412
01413 void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01414 {
01415 const sal_uInt32 nAryLen = mpDXAry ? mnLen : 0;
01416
01417 WRITE_BASE_COMPAT( rOStm, 2, pData );
01418 rOStm << maStartPt;
01419 rOStm.WriteByteString( maStr, pData->meActualCharSet );
01420 rOStm << mnIndex;
01421 rOStm << mnLen;
01422 rOStm << nAryLen;
01423
01424 for( ULONG i = 0UL; i < nAryLen; i++ )
01425 rOStm << mpDXAry[ i ];
01426
01427 sal_uInt16 j, nLen = maStr.Len();
01428 rOStm << nLen;
01429 for ( j = 0; j < nLen; j++ )
01430 {
01431 sal_Unicode nUni = maStr.GetChar( j );
01432 rOStm << nUni;
01433 }
01434 }
01435
01436
01437
01438 void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
01439 {
01440 sal_uInt32 nAryLen;
01441
01442 delete[] mpDXAry;
01443
01444 COMPAT( rIStm );
01445 rIStm >> maStartPt;
01446 rIStm.ReadByteString( maStr, pData->meActualCharSet );
01447 rIStm >> mnIndex;
01448 rIStm >> mnLen;
01449 rIStm >> nAryLen;
01450
01451 if( nAryLen )
01452 {
01453
01454 const ULONG nIntAryLen( Max(nAryLen, static_cast<sal_uInt32>(mnLen)) );
01455 mpDXAry = new sal_Int32[ nIntAryLen ];
01456
01457 ULONG i;
01458 for( i = 0UL; i < nAryLen; i++ )
01459 rIStm >> mpDXAry[ i ];
01460
01461
01462 for( ; i < nIntAryLen; i++ )
01463 mpDXAry[ i ] = 0;
01464 }
01465 else
01466 mpDXAry = NULL;
01467
01468 if ( aCompat.GetVersion() >= 2 )
01469 {
01470 sal_uInt16 nLen;
01471 rIStm >> nLen;
01472 sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
01473 while ( nLen-- )
01474 rIStm >> *pBuffer++;
01475 }
01476 }
01477
01478
01479
01480 IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION )
01481
01482
01483
01484 MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
01485 const XubString& rStr,
01486 USHORT nIndex, USHORT nLen ) :
01487 MetaAction ( META_STRETCHTEXT_ACTION ),
01488 maPt ( rPt ),
01489 maStr ( rStr ),
01490 mnWidth ( nWidth ),
01491 mnIndex ( nIndex ),
01492 mnLen ( nLen )
01493 {
01494 }
01495
01496
01497
01498 void MetaStretchTextAction::Execute( OutputDevice* pOut )
01499 {
01500 pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
01501 }
01502
01503
01504
01505 MetaAction* MetaStretchTextAction::Clone()
01506 {
01507 MetaAction* pClone = (MetaAction*) new MetaStretchTextAction( *this );
01508 pClone->ResetRefCount();
01509 return pClone;
01510 }
01511
01512
01513
01514 void MetaStretchTextAction::Move( long nHorzMove, long nVertMove )
01515 {
01516 maPt.Move( nHorzMove, nVertMove );
01517 }
01518
01519
01520
01521 void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
01522 {
01523 ImplScalePoint( maPt, fScaleX, fScaleY );
01524 mnWidth = (ULONG)FRound( mnWidth * fScaleX );
01525 }
01526
01527
01528
01529 sal_Bool MetaStretchTextAction::Compare( const MetaAction& rMetaAction ) const
01530 {
01531 return ( maPt == ((MetaStretchTextAction&)rMetaAction).maPt ) &&
01532 ( maStr == ((MetaStretchTextAction&)rMetaAction).maStr ) &&
01533 ( mnWidth == ((MetaStretchTextAction&)rMetaAction).mnWidth ) &&
01534 ( mnIndex == ((MetaStretchTextAction&)rMetaAction).mnIndex ) &&
01535 ( mnLen == ((MetaStretchTextAction&)rMetaAction).mnLen );
01536 }
01537
01538
01539
01540 void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01541 {
01542 WRITE_BASE_COMPAT( rOStm, 2, pData );
01543 rOStm << maPt;
01544 rOStm.WriteByteString( maStr, pData->meActualCharSet );
01545 rOStm << mnWidth;
01546 rOStm << mnIndex;
01547 rOStm << mnLen;
01548
01549 sal_uInt16 i, nLen = maStr.Len();
01550 rOStm << nLen;
01551 for ( i = 0; i < nLen; i++ )
01552 {
01553 sal_Unicode nUni = maStr.GetChar( i );
01554 rOStm << nUni;
01555 }
01556 }
01557
01558
01559
01560 void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
01561 {
01562 COMPAT( rIStm );
01563 rIStm >> maPt;
01564 rIStm.ReadByteString( maStr, pData->meActualCharSet );
01565 rIStm >> mnWidth;
01566 rIStm >> mnIndex;
01567 rIStm >> mnLen;
01568
01569 if ( aCompat.GetVersion() >= 2 )
01570 {
01571 sal_uInt16 nLen;
01572 rIStm >> nLen;
01573 sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
01574 while ( nLen-- )
01575 rIStm >> *pBuffer++;
01576 }
01577 }
01578
01579
01580
01581 IMPL_META_ACTION( TextRect, META_TEXTRECT_ACTION )
01582
01583
01584
01585 MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect,
01586 const XubString& rStr, USHORT nStyle ) :
01587 MetaAction ( META_TEXTRECT_ACTION ),
01588 maRect ( rRect ),
01589 maStr ( rStr ),
01590 mnStyle ( nStyle )
01591 {
01592 }
01593
01594
01595
01596 void MetaTextRectAction::Execute( OutputDevice* pOut )
01597 {
01598 pOut->DrawText( maRect, maStr, mnStyle );
01599 }
01600
01601
01602
01603 MetaAction* MetaTextRectAction::Clone()
01604 {
01605 MetaAction* pClone = (MetaAction*) new MetaTextRectAction( *this );
01606 pClone->ResetRefCount();
01607 return pClone;
01608 }
01609
01610
01611
01612 void MetaTextRectAction::Move( long nHorzMove, long nVertMove )
01613 {
01614 maRect.Move( nHorzMove, nVertMove );
01615 }
01616
01617
01618
01619 void MetaTextRectAction::Scale( double fScaleX, double fScaleY )
01620 {
01621 ImplScaleRect( maRect, fScaleX, fScaleY );
01622 }
01623
01624
01625
01626 sal_Bool MetaTextRectAction::Compare( const MetaAction& rMetaAction ) const
01627 {
01628 return ( maRect == ((MetaTextRectAction&)rMetaAction).maRect ) &&
01629 ( maStr == ((MetaTextRectAction&)rMetaAction).maStr ) &&
01630 ( mnStyle == ((MetaTextRectAction&)rMetaAction).mnStyle );
01631 }
01632
01633
01634
01635 void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01636 {
01637 WRITE_BASE_COMPAT( rOStm, 2, pData );
01638 rOStm << maRect;
01639 rOStm.WriteByteString( maStr, pData->meActualCharSet );
01640 rOStm << mnStyle;
01641
01642 sal_uInt16 i, nLen = maStr.Len();
01643 rOStm << nLen;
01644 for ( i = 0; i < nLen; i++ )
01645 {
01646 sal_Unicode nUni = maStr.GetChar( i );
01647 rOStm << nUni;
01648 }
01649 }
01650
01651
01652
01653 void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
01654 {
01655 COMPAT( rIStm );
01656 rIStm >> maRect;
01657 rIStm.ReadByteString( maStr, pData->meActualCharSet );
01658 rIStm >> mnStyle;
01659
01660 if ( aCompat.GetVersion() >= 2 )
01661 {
01662 sal_uInt16 nLen;
01663 rIStm >> nLen;
01664 sal_Unicode* pBuffer = maStr.AllocBuffer( nLen );
01665 while ( nLen-- )
01666 rIStm >> *pBuffer++;
01667 }
01668 }
01669
01670
01671
01672 IMPL_META_ACTION( TextLine, META_TEXTLINE_ACTION )
01673
01674
01675
01676 MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth,
01677 FontStrikeout eStrikeout,
01678 FontUnderline eUnderline,
01679 FontUnderline eOverline ) :
01680 MetaAction ( META_TEXTLINE_ACTION ),
01681 maPos ( rPos ),
01682 mnWidth ( nWidth ),
01683 meStrikeout ( eStrikeout ),
01684 meUnderline ( eUnderline ),
01685 meOverline ( eOverline )
01686 {
01687 }
01688
01689
01690
01691 void MetaTextLineAction::Execute( OutputDevice* pOut )
01692 {
01693 pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline );
01694 }
01695
01696
01697
01698 MetaAction* MetaTextLineAction::Clone()
01699 {
01700 MetaAction* pClone = (MetaAction*)new MetaTextLineAction( *this );
01701 pClone->ResetRefCount();
01702 return pClone;
01703 }
01704
01705
01706
01707 void MetaTextLineAction::Move( long nHorzMove, long nVertMove )
01708 {
01709 maPos.Move( nHorzMove, nVertMove );
01710 }
01711
01712
01713
01714 void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
01715 {
01716 ImplScalePoint( maPos, fScaleX, fScaleY );
01717 mnWidth = FRound( mnWidth * fScaleX );
01718 }
01719
01720
01721
01722 sal_Bool MetaTextLineAction::Compare( const MetaAction& rMetaAction ) const
01723 {
01724 return ( maPos == ((MetaTextLineAction&)rMetaAction).maPos ) &&
01725 ( mnWidth == ((MetaTextLineAction&)rMetaAction).mnWidth ) &&
01726 ( meStrikeout == ((MetaTextLineAction&)rMetaAction).meStrikeout ) &&
01727 ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline ) &&
01728 ( meOverline == ((MetaTextLineAction&)rMetaAction).meOverline );
01729 }
01730
01731
01732
01733 void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01734 {
01735 WRITE_BASE_COMPAT( rOStm, 2, pData );
01736
01737 rOStm << maPos;
01738 rOStm << mnWidth;
01739 rOStm << static_cast<sal_uInt32>(meStrikeout);
01740 rOStm << static_cast<sal_uInt32>(meUnderline);
01741
01742 rOStm << static_cast<sal_uInt32>(meOverline);
01743 }
01744
01745
01746
01747 void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
01748 {
01749 COMPAT( rIStm );
01750
01751 sal_uInt32 nTemp;
01752 rIStm >> maPos;
01753 rIStm >> mnWidth;
01754 rIStm >> nTemp;
01755 meStrikeout = (FontStrikeout)nTemp;
01756 rIStm >> nTemp;
01757 meUnderline = (FontUnderline)nTemp;
01758 if ( aCompat.GetVersion() >= 2 ) {
01759 rIStm >> nTemp;
01760 meUnderline = (FontUnderline)nTemp;
01761 }
01762 }
01763
01764
01765
01766 IMPL_META_ACTION( Bmp, META_BMP_ACTION )
01767
01768
01769
01770 MetaBmpAction::MetaBmpAction( const Point& rPt, const Bitmap& rBmp ) :
01771 MetaAction ( META_BMP_ACTION ),
01772 maBmp ( rBmp ),
01773 maPt ( rPt )
01774 {
01775 }
01776
01777
01778
01779 void MetaBmpAction::Execute( OutputDevice* pOut )
01780 {
01781 pOut->DrawBitmap( maPt, maBmp );
01782 }
01783
01784
01785
01786 MetaAction* MetaBmpAction::Clone()
01787 {
01788 MetaAction* pClone = (MetaAction*) new MetaBmpAction( *this );
01789 pClone->ResetRefCount();
01790 return pClone;
01791 }
01792
01793
01794
01795 void MetaBmpAction::Move( long nHorzMove, long nVertMove )
01796 {
01797 maPt.Move( nHorzMove, nVertMove );
01798 }
01799
01800
01801
01802 void MetaBmpAction::Scale( double fScaleX, double fScaleY )
01803 {
01804 ImplScalePoint( maPt, fScaleX, fScaleY );
01805 }
01806
01807
01808
01809 sal_Bool MetaBmpAction::Compare( const MetaAction& rMetaAction ) const
01810 {
01811 return maBmp.IsEqual(((MetaBmpAction&)rMetaAction).maBmp ) &&
01812 ( maPt == ((MetaBmpAction&)rMetaAction).maPt );
01813 }
01814
01815
01816
01817 void MetaBmpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01818 {
01819 if( !!maBmp )
01820 {
01821 WRITE_BASE_COMPAT( rOStm, 1, pData );
01822 rOStm << maBmp << maPt;
01823 }
01824 }
01825
01826
01827
01828 void MetaBmpAction::Read( SvStream& rIStm, ImplMetaReadData* )
01829 {
01830 COMPAT( rIStm );
01831 rIStm >> maBmp >> maPt;
01832 }
01833
01834
01835
01836 IMPL_META_ACTION( BmpScale, META_BMPSCALE_ACTION )
01837
01838
01839
01840 MetaBmpScaleAction::MetaBmpScaleAction( const Point& rPt, const Size& rSz,
01841 const Bitmap& rBmp ) :
01842 MetaAction ( META_BMPSCALE_ACTION ),
01843 maBmp ( rBmp ),
01844 maPt ( rPt ),
01845 maSz ( rSz )
01846 {
01847 }
01848
01849
01850
01851 void MetaBmpScaleAction::Execute( OutputDevice* pOut )
01852 {
01853 pOut->DrawBitmap( maPt, maSz, maBmp );
01854 }
01855
01856
01857
01858 MetaAction* MetaBmpScaleAction::Clone()
01859 {
01860 MetaAction* pClone = (MetaAction*) new MetaBmpScaleAction( *this );
01861 pClone->ResetRefCount();
01862 return pClone;
01863 }
01864
01865
01866
01867 void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove )
01868 {
01869 maPt.Move( nHorzMove, nVertMove );
01870 }
01871
01872
01873
01874 void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY )
01875 {
01876 ImplScalePoint( maPt, fScaleX, fScaleY );
01877 ImplScaleSize( maSz, fScaleX, fScaleY );
01878 }
01879
01880
01881
01882 sal_Bool MetaBmpScaleAction::Compare( const MetaAction& rMetaAction ) const
01883 {
01884 return ( maBmp.IsEqual(((MetaBmpScaleAction&)rMetaAction).maBmp )) &&
01885 ( maPt == ((MetaBmpScaleAction&)rMetaAction).maPt ) &&
01886 ( maSz == ((MetaBmpScaleAction&)rMetaAction).maSz );
01887 }
01888
01889
01890
01891 void MetaBmpScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01892 {
01893 if( !!maBmp )
01894 {
01895 WRITE_BASE_COMPAT( rOStm, 1, pData );
01896 rOStm << maBmp << maPt << maSz;
01897 }
01898 }
01899
01900
01901
01902 void MetaBmpScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
01903 {
01904 COMPAT( rIStm );
01905 rIStm >> maBmp >> maPt >> maSz;
01906 }
01907
01908
01909
01910 IMPL_META_ACTION( BmpScalePart, META_BMPSCALEPART_ACTION )
01911
01912
01913
01914 MetaBmpScalePartAction::MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz,
01915 const Point& rSrcPt, const Size& rSrcSz,
01916 const Bitmap& rBmp ) :
01917 MetaAction ( META_BMPSCALEPART_ACTION ),
01918 maBmp ( rBmp ),
01919 maDstPt ( rDstPt ),
01920 maDstSz ( rDstSz ),
01921 maSrcPt ( rSrcPt ),
01922 maSrcSz ( rSrcSz )
01923 {
01924 }
01925
01926
01927
01928 void MetaBmpScalePartAction::Execute( OutputDevice* pOut )
01929 {
01930 pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
01931 }
01932
01933
01934
01935 MetaAction* MetaBmpScalePartAction::Clone()
01936 {
01937 MetaAction* pClone = (MetaAction*) new MetaBmpScalePartAction( *this );
01938 pClone->ResetRefCount();
01939 return pClone;
01940 }
01941
01942
01943
01944 void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove )
01945 {
01946 maDstPt.Move( nHorzMove, nVertMove );
01947 }
01948
01949
01950
01951 void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY )
01952 {
01953 ImplScalePoint( maDstPt, fScaleX, fScaleY );
01954 ImplScaleSize( maDstSz, fScaleX, fScaleY );
01955 }
01956
01957
01958
01959 sal_Bool MetaBmpScalePartAction::Compare( const MetaAction& rMetaAction ) const
01960 {
01961 return ( maBmp.IsEqual(((MetaBmpScalePartAction&)rMetaAction).maBmp )) &&
01962 ( maDstPt == ((MetaBmpScalePartAction&)rMetaAction).maDstPt ) &&
01963 ( maDstSz == ((MetaBmpScalePartAction&)rMetaAction).maDstSz ) &&
01964 ( maSrcPt == ((MetaBmpScalePartAction&)rMetaAction).maSrcPt ) &&
01965 ( maSrcSz == ((MetaBmpScalePartAction&)rMetaAction).maSrcSz );
01966 }
01967
01968
01969
01970 void MetaBmpScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
01971 {
01972 if( !!maBmp )
01973 {
01974 WRITE_BASE_COMPAT( rOStm, 1, pData );
01975 rOStm << maBmp << maDstPt << maDstSz << maSrcPt << maSrcSz;
01976 }
01977 }
01978
01979
01980
01981 void MetaBmpScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
01982 {
01983 COMPAT( rIStm );
01984 rIStm >> maBmp >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
01985 }
01986
01987
01988
01989 IMPL_META_ACTION( BmpEx, META_BMPEX_ACTION )
01990
01991
01992
01993 MetaBmpExAction::MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ) :
01994 MetaAction ( META_BMPEX_ACTION ),
01995 maBmpEx ( rBmpEx ),
01996 maPt ( rPt )
01997 {
01998 }
01999
02000
02001
02002 void MetaBmpExAction::Execute( OutputDevice* pOut )
02003 {
02004 pOut->DrawBitmapEx( maPt, maBmpEx );
02005 }
02006
02007
02008
02009 MetaAction* MetaBmpExAction::Clone()
02010 {
02011 MetaAction* pClone = (MetaAction*) new MetaBmpExAction( *this );
02012 pClone->ResetRefCount();
02013 return pClone;
02014 }
02015
02016
02017
02018 void MetaBmpExAction::Move( long nHorzMove, long nVertMove )
02019 {
02020 maPt.Move( nHorzMove, nVertMove );
02021 }
02022
02023
02024
02025 void MetaBmpExAction::Scale( double fScaleX, double fScaleY )
02026 {
02027 ImplScalePoint( maPt, fScaleX, fScaleY );
02028 }
02029
02030
02031
02032 sal_Bool MetaBmpExAction::Compare( const MetaAction& rMetaAction ) const
02033 {
02034 return ( maBmpEx.IsEqual(((MetaBmpExAction&)rMetaAction).maBmpEx )) &&
02035 ( maPt == ((MetaBmpExAction&)rMetaAction).maPt );
02036 }
02037
02038
02039
02040 void MetaBmpExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02041 {
02042 if( !!maBmpEx.GetBitmap() )
02043 {
02044 WRITE_BASE_COMPAT( rOStm, 1, pData );
02045 rOStm << maBmpEx << maPt;
02046 }
02047 }
02048
02049
02050
02051 void MetaBmpExAction::Read( SvStream& rIStm, ImplMetaReadData* )
02052 {
02053 COMPAT( rIStm );
02054 rIStm >> maBmpEx >> maPt;
02055 }
02056
02057
02058
02059 IMPL_META_ACTION( BmpExScale, META_BMPEXSCALE_ACTION )
02060
02061
02062
02063 MetaBmpExScaleAction::MetaBmpExScaleAction( const Point& rPt, const Size& rSz,
02064 const BitmapEx& rBmpEx ) :
02065 MetaAction ( META_BMPEXSCALE_ACTION ),
02066 maBmpEx ( rBmpEx ),
02067 maPt ( rPt ),
02068 maSz ( rSz )
02069 {
02070 }
02071
02072
02073
02074 void MetaBmpExScaleAction::Execute( OutputDevice* pOut )
02075 {
02076 pOut->DrawBitmapEx( maPt, maSz, maBmpEx );
02077 }
02078
02079
02080
02081 MetaAction* MetaBmpExScaleAction::Clone()
02082 {
02083 MetaAction* pClone = (MetaAction*) new MetaBmpExScaleAction( *this );
02084 pClone->ResetRefCount();
02085 return pClone;
02086 }
02087
02088
02089
02090 void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove )
02091 {
02092 maPt.Move( nHorzMove, nVertMove );
02093 }
02094
02095
02096
02097 void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY )
02098 {
02099 ImplScalePoint( maPt, fScaleX, fScaleY );
02100 ImplScaleSize( maSz, fScaleX, fScaleY );
02101 }
02102
02103
02104
02105 sal_Bool MetaBmpExScaleAction::Compare( const MetaAction& rMetaAction ) const
02106 {
02107 return ( maBmpEx.IsEqual(((MetaBmpExScaleAction&)rMetaAction).maBmpEx )) &&
02108 ( maPt == ((MetaBmpExScaleAction&)rMetaAction).maPt ) &&
02109 ( maSz == ((MetaBmpExScaleAction&)rMetaAction).maSz );
02110 }
02111
02112
02113
02114 void MetaBmpExScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02115 {
02116 if( !!maBmpEx.GetBitmap() )
02117 {
02118 WRITE_BASE_COMPAT( rOStm, 1, pData );
02119 rOStm << maBmpEx << maPt << maSz;
02120 }
02121 }
02122
02123
02124
02125 void MetaBmpExScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
02126 {
02127 COMPAT( rIStm );
02128 rIStm >> maBmpEx >> maPt >> maSz;
02129 }
02130
02131
02132
02133 IMPL_META_ACTION( BmpExScalePart, META_BMPEXSCALEPART_ACTION )
02134
02135
02136
02137 MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz,
02138 const Point& rSrcPt, const Size& rSrcSz,
02139 const BitmapEx& rBmpEx ) :
02140 MetaAction ( META_BMPEXSCALEPART_ACTION ),
02141 maBmpEx ( rBmpEx ),
02142 maDstPt ( rDstPt ),
02143 maDstSz ( rDstSz ),
02144 maSrcPt ( rSrcPt ),
02145 maSrcSz ( rSrcSz )
02146 {
02147 }
02148
02149
02150
02151 void MetaBmpExScalePartAction::Execute( OutputDevice* pOut )
02152 {
02153 pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
02154 }
02155
02156
02157
02158 MetaAction* MetaBmpExScalePartAction::Clone()
02159 {
02160 MetaAction* pClone = (MetaAction*) new MetaBmpExScalePartAction( *this );
02161 pClone->ResetRefCount();
02162 return pClone;
02163 }
02164
02165
02166
02167 void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove )
02168 {
02169 maDstPt.Move( nHorzMove, nVertMove );
02170 }
02171
02172
02173
02174 void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY )
02175 {
02176 ImplScalePoint( maDstPt, fScaleX, fScaleY );
02177 ImplScaleSize( maDstSz, fScaleX, fScaleY );
02178 }
02179
02180
02181
02182 sal_Bool MetaBmpExScalePartAction::Compare( const MetaAction& rMetaAction ) const
02183 {
02184 return ( maBmpEx.IsEqual(((MetaBmpExScalePartAction&)rMetaAction).maBmpEx )) &&
02185 ( maDstPt == ((MetaBmpExScalePartAction&)rMetaAction).maDstPt ) &&
02186 ( maDstSz == ((MetaBmpExScalePartAction&)rMetaAction).maDstSz ) &&
02187 ( maSrcPt == ((MetaBmpExScalePartAction&)rMetaAction).maSrcPt ) &&
02188 ( maSrcSz == ((MetaBmpExScalePartAction&)rMetaAction).maSrcSz );
02189 }
02190
02191
02192
02193 void MetaBmpExScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02194 {
02195 if( !!maBmpEx.GetBitmap() )
02196 {
02197 WRITE_BASE_COMPAT( rOStm, 1, pData );
02198 rOStm << maBmpEx << maDstPt << maDstSz << maSrcPt << maSrcSz;
02199 }
02200 }
02201
02202
02203
02204 void MetaBmpExScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
02205 {
02206 COMPAT( rIStm );
02207 rIStm >> maBmpEx >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
02208 }
02209
02210
02211
02212 IMPL_META_ACTION( Mask, META_MASK_ACTION )
02213
02214
02215
02216 MetaMaskAction::MetaMaskAction( const Point& rPt,
02217 const Bitmap& rBmp,
02218 const Color& rColor ) :
02219 MetaAction ( META_MASK_ACTION ),
02220 maBmp ( rBmp ),
02221 maColor ( rColor ),
02222 maPt ( rPt )
02223 {
02224 }
02225
02226
02227
02228 void MetaMaskAction::Execute( OutputDevice* pOut )
02229 {
02230 pOut->DrawMask( maPt, maBmp, maColor );
02231 }
02232
02233
02234
02235 MetaAction* MetaMaskAction::Clone()
02236 {
02237 MetaAction* pClone = (MetaAction*) new MetaMaskAction( *this );
02238 pClone->ResetRefCount();
02239 return pClone;
02240 }
02241
02242
02243
02244 void MetaMaskAction::Move( long nHorzMove, long nVertMove )
02245 {
02246 maPt.Move( nHorzMove, nVertMove );
02247 }
02248
02249
02250
02251 void MetaMaskAction::Scale( double fScaleX, double fScaleY )
02252 {
02253 ImplScalePoint( maPt, fScaleX, fScaleY );
02254 }
02255
02256
02257
02258 sal_Bool MetaMaskAction::Compare( const MetaAction& rMetaAction ) const
02259 {
02260 return ( maBmp.IsEqual(((MetaMaskAction&)rMetaAction).maBmp )) &&
02261 ( maColor == ((MetaMaskAction&)rMetaAction).maColor ) &&
02262 ( maPt == ((MetaMaskAction&)rMetaAction).maPt );
02263 }
02264
02265
02266
02267 void MetaMaskAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02268 {
02269 if( !!maBmp )
02270 {
02271 WRITE_BASE_COMPAT( rOStm, 1, pData );
02272 rOStm << maBmp << maPt;
02273 }
02274 }
02275
02276
02277
02278 void MetaMaskAction::Read( SvStream& rIStm, ImplMetaReadData* )
02279 {
02280 COMPAT( rIStm );
02281 rIStm >> maBmp >> maPt;
02282 }
02283
02284
02285
02286 IMPL_META_ACTION( MaskScale, META_MASKSCALE_ACTION )
02287
02288
02289
02290 MetaMaskScaleAction::MetaMaskScaleAction( const Point& rPt, const Size& rSz,
02291 const Bitmap& rBmp,
02292 const Color& rColor ) :
02293 MetaAction ( META_MASKSCALE_ACTION ),
02294 maBmp ( rBmp ),
02295 maColor ( rColor ),
02296 maPt ( rPt ),
02297 maSz ( rSz )
02298 {
02299 }
02300
02301
02302
02303 void MetaMaskScaleAction::Execute( OutputDevice* pOut )
02304 {
02305 pOut->DrawMask( maPt, maSz, maBmp, maColor );
02306 }
02307
02308
02309
02310 MetaAction* MetaMaskScaleAction::Clone()
02311 {
02312 MetaAction* pClone = (MetaAction*) new MetaMaskScaleAction( *this );
02313 pClone->ResetRefCount();
02314 return pClone;
02315 }
02316
02317
02318
02319 void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove )
02320 {
02321 maPt.Move( nHorzMove, nVertMove );
02322 }
02323
02324
02325
02326 void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY )
02327 {
02328 ImplScalePoint( maPt, fScaleX, fScaleY );
02329 ImplScaleSize( maSz, fScaleX, fScaleY );
02330 }
02331
02332
02333
02334 sal_Bool MetaMaskScaleAction::Compare( const MetaAction& rMetaAction ) const
02335 {
02336 return ( maBmp.IsEqual(((MetaMaskScaleAction&)rMetaAction).maBmp )) &&
02337 ( maColor == ((MetaMaskScaleAction&)rMetaAction).maColor ) &&
02338 ( maPt == ((MetaMaskScaleAction&)rMetaAction).maPt ) &&
02339 ( maSz == ((MetaMaskScaleAction&)rMetaAction).maSz );
02340 }
02341
02342
02343
02344 void MetaMaskScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02345 {
02346 if( !!maBmp )
02347 {
02348 WRITE_BASE_COMPAT( rOStm, 1, pData );
02349 rOStm << maBmp << maPt << maSz;
02350 }
02351 }
02352
02353
02354
02355 void MetaMaskScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
02356 {
02357 COMPAT( rIStm );
02358 rIStm >> maBmp >> maPt >> maSz;
02359 }
02360
02361
02362
02363 IMPL_META_ACTION( MaskScalePart, META_MASKSCALEPART_ACTION )
02364
02365
02366
02367 MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz,
02368 const Point& rSrcPt, const Size& rSrcSz,
02369 const Bitmap& rBmp,
02370 const Color& rColor ) :
02371 MetaAction ( META_MASKSCALEPART_ACTION ),
02372 maBmp ( rBmp ),
02373 maColor ( rColor ),
02374 maDstPt ( rDstPt ),
02375 maDstSz ( rDstSz ),
02376 maSrcPt ( rSrcPt ),
02377 maSrcSz ( rSrcSz )
02378 {
02379 }
02380
02381
02382
02383 void MetaMaskScalePartAction::Execute( OutputDevice* pOut )
02384 {
02385 pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor );
02386 }
02387
02388
02389
02390 MetaAction* MetaMaskScalePartAction::Clone()
02391 {
02392 MetaAction* pClone = (MetaAction*) new MetaMaskScalePartAction( *this );
02393 pClone->ResetRefCount();
02394 return pClone;
02395 }
02396
02397
02398
02399 void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove )
02400 {
02401 maDstPt.Move( nHorzMove, nVertMove );
02402 }
02403
02404
02405
02406 void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY )
02407 {
02408 ImplScalePoint( maDstPt, fScaleX, fScaleY );
02409 ImplScaleSize( maDstSz, fScaleX, fScaleY );
02410 }
02411
02412
02413
02414 sal_Bool MetaMaskScalePartAction::Compare( const MetaAction& rMetaAction ) const
02415 {
02416 return ( maBmp.IsEqual(((MetaMaskScalePartAction&)rMetaAction).maBmp )) &&
02417 ( maColor == ((MetaMaskScalePartAction&)rMetaAction).maColor ) &&
02418 ( maDstPt == ((MetaMaskScalePartAction&)rMetaAction).maDstPt ) &&
02419 ( maDstSz == ((MetaMaskScalePartAction&)rMetaAction).maDstSz ) &&
02420 ( maSrcPt == ((MetaMaskScalePartAction&)rMetaAction).maSrcPt ) &&
02421 ( maSrcSz == ((MetaMaskScalePartAction&)rMetaAction).maSrcSz );
02422 }
02423
02424
02425
02426 void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02427 {
02428 if( !!maBmp )
02429 {
02430 WRITE_BASE_COMPAT( rOStm, 1, pData );
02431 rOStm << maBmp;
02432 maColor.Write( rOStm, TRUE );
02433 rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz;
02434 }
02435 }
02436
02437
02438
02439 void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
02440 {
02441 COMPAT( rIStm );
02442 rIStm >> maBmp;
02443 maColor.Read( rIStm, TRUE );
02444 rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
02445 }
02446
02447
02448
02449 IMPL_META_ACTION( Gradient, META_GRADIENT_ACTION )
02450
02451
02452
02453 MetaGradientAction::MetaGradientAction( const Rectangle& rRect, const Gradient& rGradient ) :
02454 MetaAction ( META_GRADIENT_ACTION ),
02455 maRect ( rRect ),
02456 maGradient ( rGradient )
02457 {
02458 }
02459
02460
02461
02462 void MetaGradientAction::Execute( OutputDevice* pOut )
02463 {
02464 pOut->DrawGradient( maRect, maGradient );
02465 }
02466
02467
02468
02469 MetaAction* MetaGradientAction::Clone()
02470 {
02471 MetaAction* pClone = (MetaAction*) new MetaGradientAction( *this );
02472 pClone->ResetRefCount();
02473 return pClone;
02474 }
02475
02476
02477
02478 void MetaGradientAction::Move( long nHorzMove, long nVertMove )
02479 {
02480 maRect.Move( nHorzMove, nVertMove );
02481 }
02482
02483
02484
02485 void MetaGradientAction::Scale( double fScaleX, double fScaleY )
02486 {
02487 ImplScaleRect( maRect, fScaleX, fScaleY );
02488 }
02489
02490
02491
02492 sal_Bool MetaGradientAction::Compare( const MetaAction& rMetaAction ) const
02493 {
02494 return ( maRect == ((MetaGradientAction&)rMetaAction).maRect ) &&
02495 ( maGradient == ((MetaGradientAction&)rMetaAction).maGradient );
02496 }
02497
02498
02499
02500 void MetaGradientAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02501 {
02502 WRITE_BASE_COMPAT( rOStm, 1, pData );
02503 rOStm << maRect << maGradient;
02504 }
02505
02506
02507
02508 void MetaGradientAction::Read( SvStream& rIStm, ImplMetaReadData* )
02509 {
02510 COMPAT( rIStm );
02511 rIStm >> maRect >> maGradient;
02512 }
02513
02514
02515
02516 MetaGradientExAction::MetaGradientExAction() :
02517 MetaAction ( META_GRADIENTEX_ACTION )
02518 {
02519 }
02520
02521
02522
02523 MetaGradientExAction::MetaGradientExAction( const PolyPolygon& rPolyPoly, const Gradient& rGradient ) :
02524 MetaAction ( META_GRADIENTEX_ACTION ),
02525 maPolyPoly ( rPolyPoly ),
02526 maGradient ( rGradient )
02527 {
02528 }
02529
02530
02531
02532 MetaGradientExAction::~MetaGradientExAction()
02533 {
02534 }
02535
02536
02537
02538 void MetaGradientExAction::Execute( OutputDevice* pOut )
02539 {
02540 if( pOut->GetConnectMetaFile() )
02541 pOut->GetConnectMetaFile()->AddAction( Clone() );
02542 }
02543
02544
02545
02546 MetaAction* MetaGradientExAction::Clone()
02547 {
02548 MetaAction* pClone = (MetaAction*) new MetaGradientExAction( *this );
02549 pClone->ResetRefCount();
02550 return pClone;
02551 }
02552
02553
02554
02555 void MetaGradientExAction::Move( long nHorzMove, long nVertMove )
02556 {
02557 maPolyPoly.Move( nHorzMove, nVertMove );
02558 }
02559
02560
02561
02562 void MetaGradientExAction::Scale( double fScaleX, double fScaleY )
02563 {
02564 for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
02565 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
02566 }
02567
02568
02569
02570 sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const
02571 {
02572 return ( maPolyPoly == ((MetaGradientExAction&)rMetaAction).maPolyPoly ) &&
02573 ( maGradient == ((MetaGradientExAction&)rMetaAction).maGradient );
02574 }
02575
02576
02577
02578 void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02579 {
02580 WRITE_BASE_COMPAT( rOStm, 1, pData );
02581
02582
02583 PolyPolygon aNoCurvePolyPolygon;
02584 maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
02585
02586 rOStm << aNoCurvePolyPolygon;
02587 rOStm << maGradient;
02588 }
02589
02590
02591
02592 void MetaGradientExAction::Read( SvStream& rIStm, ImplMetaReadData* )
02593 {
02594 COMPAT( rIStm );
02595 rIStm >> maPolyPoly >> maGradient;
02596 }
02597
02598
02599
02600 IMPL_META_ACTION( Hatch, META_HATCH_ACTION )
02601
02602
02603
02604 MetaHatchAction::MetaHatchAction( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) :
02605 MetaAction ( META_HATCH_ACTION ),
02606 maPolyPoly ( rPolyPoly ),
02607 maHatch ( rHatch )
02608 {
02609 }
02610
02611
02612
02613 void MetaHatchAction::Execute( OutputDevice* pOut )
02614 {
02615 pOut->DrawHatch( maPolyPoly, maHatch );
02616 }
02617
02618
02619
02620 MetaAction* MetaHatchAction::Clone()
02621 {
02622 MetaAction* pClone = (MetaAction*) new MetaHatchAction( *this );
02623 pClone->ResetRefCount();
02624 return pClone;
02625 }
02626
02627
02628
02629 void MetaHatchAction::Move( long nHorzMove, long nVertMove )
02630 {
02631 maPolyPoly.Move( nHorzMove, nVertMove );
02632 }
02633
02634
02635
02636 void MetaHatchAction::Scale( double fScaleX, double fScaleY )
02637 {
02638 for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
02639 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
02640 }
02641
02642
02643
02644 sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const
02645 {
02646 return ( maPolyPoly == ((MetaHatchAction&)rMetaAction).maPolyPoly ) &&
02647 ( maHatch == ((MetaHatchAction&)rMetaAction).maHatch );
02648 }
02649
02650
02651
02652 void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02653 {
02654 WRITE_BASE_COMPAT( rOStm, 1, pData );
02655
02656
02657 PolyPolygon aNoCurvePolyPolygon;
02658 maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
02659
02660 rOStm << aNoCurvePolyPolygon;
02661 rOStm << maHatch;
02662 }
02663
02664
02665
02666 void MetaHatchAction::Read( SvStream& rIStm, ImplMetaReadData* )
02667 {
02668 COMPAT( rIStm );
02669 rIStm >> maPolyPoly >> maHatch;
02670 }
02671
02672
02673
02674 IMPL_META_ACTION( Wallpaper, META_WALLPAPER_ACTION )
02675
02676
02677
02678 MetaWallpaperAction::MetaWallpaperAction( const Rectangle& rRect,
02679 const Wallpaper& rPaper ) :
02680 MetaAction ( META_WALLPAPER_ACTION ),
02681 maRect ( rRect ),
02682 maWallpaper ( rPaper )
02683 {
02684 }
02685
02686
02687
02688 void MetaWallpaperAction::Execute( OutputDevice* pOut )
02689 {
02690 pOut->DrawWallpaper( maRect, maWallpaper );
02691 }
02692
02693
02694
02695 MetaAction* MetaWallpaperAction::Clone()
02696 {
02697 MetaAction* pClone = (MetaAction*) new MetaWallpaperAction( *this );
02698 pClone->ResetRefCount();
02699 return pClone;
02700 }
02701
02702
02703
02704 void MetaWallpaperAction::Move( long nHorzMove, long nVertMove )
02705 {
02706 maRect.Move( nHorzMove, nVertMove );
02707 }
02708
02709
02710
02711 void MetaWallpaperAction::Scale( double fScaleX, double fScaleY )
02712 {
02713 ImplScaleRect( maRect, fScaleX, fScaleY );
02714 }
02715
02716
02717
02718 sal_Bool MetaWallpaperAction::Compare( const MetaAction& rMetaAction ) const
02719 {
02720 return ( maRect == ((MetaWallpaperAction&)rMetaAction).maRect ) &&
02721 ( maWallpaper == ((MetaWallpaperAction&)rMetaAction).maWallpaper );
02722 }
02723
02724
02725
02726 void MetaWallpaperAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02727 {
02728 WRITE_BASE_COMPAT( rOStm, 1, pData );
02729 rOStm << maWallpaper;
02730 }
02731
02732
02733
02734 void MetaWallpaperAction::Read( SvStream& rIStm, ImplMetaReadData* )
02735 {
02736 COMPAT( rIStm );
02737 rIStm >> maWallpaper;
02738 }
02739
02740
02741
02742 IMPL_META_ACTION( ClipRegion, META_CLIPREGION_ACTION )
02743
02744
02745
02746 MetaClipRegionAction::MetaClipRegionAction( const Region& rRegion, BOOL bClip ) :
02747 MetaAction ( META_CLIPREGION_ACTION ),
02748 maRegion ( rRegion ),
02749 mbClip ( bClip )
02750 {
02751 }
02752
02753
02754
02755 void MetaClipRegionAction::Execute( OutputDevice* pOut )
02756 {
02757 if( mbClip )
02758 pOut->SetClipRegion( maRegion );
02759 else
02760 pOut->SetClipRegion();
02761 }
02762
02763
02764
02765 MetaAction* MetaClipRegionAction::Clone()
02766 {
02767 MetaAction* pClone = (MetaAction*) new MetaClipRegionAction( *this );
02768 pClone->ResetRefCount();
02769 return pClone;
02770 }
02771
02772
02773
02774 void MetaClipRegionAction::Move( long nHorzMove, long nVertMove )
02775 {
02776 maRegion.Move( nHorzMove, nVertMove );
02777 }
02778
02779
02780
02781 void MetaClipRegionAction::Scale( double fScaleX, double fScaleY )
02782 {
02783 maRegion.Scale( fScaleX, fScaleY );
02784 }
02785
02786
02787
02788 sal_Bool MetaClipRegionAction::Compare( const MetaAction& rMetaAction ) const
02789 {
02790 return ( maRegion == ((MetaClipRegionAction&)rMetaAction).maRegion ) &&
02791 ( mbClip == ((MetaClipRegionAction&)rMetaAction).mbClip );
02792 }
02793
02794
02795
02796 void MetaClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02797 {
02798 WRITE_BASE_COMPAT( rOStm, 1, pData );
02799 rOStm << maRegion << mbClip;
02800 }
02801
02802
02803
02804 void MetaClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
02805 {
02806 COMPAT( rIStm );
02807 rIStm >> maRegion >> mbClip;
02808 }
02809
02810
02811
02812 IMPL_META_ACTION( ISectRectClipRegion, META_ISECTRECTCLIPREGION_ACTION )
02813
02814
02815
02816 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const Rectangle& rRect ) :
02817 MetaAction ( META_ISECTRECTCLIPREGION_ACTION ),
02818 maRect ( rRect )
02819 {
02820 }
02821
02822
02823
02824 void MetaISectRectClipRegionAction::Execute( OutputDevice* pOut )
02825 {
02826 pOut->IntersectClipRegion( maRect );
02827 }
02828
02829
02830
02831 MetaAction* MetaISectRectClipRegionAction::Clone()
02832 {
02833 MetaAction* pClone = (MetaAction*) new MetaISectRectClipRegionAction( *this );
02834 pClone->ResetRefCount();
02835 return pClone;
02836 }
02837
02838
02839
02840 void MetaISectRectClipRegionAction::Move( long nHorzMove, long nVertMove )
02841 {
02842 maRect.Move( nHorzMove, nVertMove );
02843 }
02844
02845
02846
02847 void MetaISectRectClipRegionAction::Scale( double fScaleX, double fScaleY )
02848 {
02849 ImplScaleRect( maRect, fScaleX, fScaleY );
02850 }
02851
02852
02853
02854 sal_Bool MetaISectRectClipRegionAction::Compare( const MetaAction& rMetaAction ) const
02855 {
02856 return maRect == ((MetaISectRectClipRegionAction&)rMetaAction).maRect;
02857 }
02858
02859
02860
02861 void MetaISectRectClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02862 {
02863 WRITE_BASE_COMPAT( rOStm, 1, pData );
02864 rOStm << maRect;
02865 }
02866
02867
02868
02869 void MetaISectRectClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
02870 {
02871 COMPAT( rIStm );
02872 rIStm >> maRect;
02873 }
02874
02875
02876
02877 IMPL_META_ACTION( ISectRegionClipRegion, META_ISECTREGIONCLIPREGION_ACTION )
02878
02879
02880
02881 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( const Region& rRegion ) :
02882 MetaAction ( META_ISECTREGIONCLIPREGION_ACTION ),
02883 maRegion ( rRegion )
02884 {
02885 }
02886
02887
02888
02889 void MetaISectRegionClipRegionAction::Execute( OutputDevice* pOut )
02890 {
02891 pOut->IntersectClipRegion( maRegion );
02892 }
02893
02894
02895
02896 MetaAction* MetaISectRegionClipRegionAction::Clone()
02897 {
02898 MetaAction* pClone = (MetaAction*) new MetaISectRegionClipRegionAction( *this );
02899 pClone->ResetRefCount();
02900 return pClone;
02901 }
02902
02903
02904
02905 void MetaISectRegionClipRegionAction::Move( long nHorzMove, long nVertMove )
02906 {
02907 maRegion.Move( nHorzMove, nVertMove );
02908 }
02909
02910
02911
02912 void MetaISectRegionClipRegionAction::Scale( double fScaleX, double fScaleY )
02913 {
02914 maRegion.Scale( fScaleX, fScaleY );
02915 }
02916
02917
02918
02919 sal_Bool MetaISectRegionClipRegionAction::Compare( const MetaAction& rMetaAction ) const
02920 {
02921 return maRegion == ((MetaISectRegionClipRegionAction&)rMetaAction).maRegion;
02922 }
02923
02924
02925
02926 void MetaISectRegionClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02927 {
02928 WRITE_BASE_COMPAT( rOStm, 1, pData );
02929 rOStm << maRegion;
02930 }
02931
02932
02933
02934 void MetaISectRegionClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
02935 {
02936 COMPAT( rIStm );
02937 rIStm >> maRegion;
02938 }
02939
02940
02941
02942 IMPL_META_ACTION( MoveClipRegion, META_MOVECLIPREGION_ACTION )
02943
02944
02945
02946 MetaMoveClipRegionAction::MetaMoveClipRegionAction( long nHorzMove, long nVertMove ) :
02947 MetaAction ( META_MOVECLIPREGION_ACTION ),
02948 mnHorzMove ( nHorzMove ),
02949 mnVertMove ( nVertMove )
02950 {
02951 }
02952
02953
02954
02955 void MetaMoveClipRegionAction::Execute( OutputDevice* pOut )
02956 {
02957 pOut->MoveClipRegion( mnHorzMove, mnVertMove );
02958 }
02959
02960
02961
02962 MetaAction* MetaMoveClipRegionAction::Clone()
02963 {
02964 MetaAction* pClone = (MetaAction*) new MetaMoveClipRegionAction( *this );
02965 pClone->ResetRefCount();
02966 return pClone;
02967 }
02968
02969
02970
02971 void MetaMoveClipRegionAction::Scale( double fScaleX, double fScaleY )
02972 {
02973 mnHorzMove = FRound( mnHorzMove * fScaleX );
02974 mnVertMove = FRound( mnVertMove * fScaleY );
02975 }
02976
02977
02978
02979 sal_Bool MetaMoveClipRegionAction::Compare( const MetaAction& rMetaAction ) const
02980 {
02981 return ( mnHorzMove == ((MetaMoveClipRegionAction&)rMetaAction).mnHorzMove ) &&
02982 ( mnVertMove == ((MetaMoveClipRegionAction&)rMetaAction).mnVertMove );
02983 }
02984
02985
02986
02987 void MetaMoveClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
02988 {
02989 WRITE_BASE_COMPAT( rOStm, 1, pData );
02990 rOStm << mnHorzMove << mnVertMove;
02991 }
02992
02993
02994
02995 void MetaMoveClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
02996 {
02997 COMPAT( rIStm );
02998 rIStm >> mnHorzMove >> mnVertMove;
02999 }
03000
03001
03002
03003 IMPL_META_ACTION( LineColor, META_LINECOLOR_ACTION )
03004
03005
03006
03007 MetaLineColorAction::MetaLineColorAction( const Color& rColor, BOOL bSet ) :
03008 MetaAction ( META_LINECOLOR_ACTION ),
03009 maColor ( rColor ),
03010 mbSet ( bSet )
03011 {
03012 }
03013
03014
03015
03016 void MetaLineColorAction::Execute( OutputDevice* pOut )
03017 {
03018 if( mbSet )
03019 pOut->SetLineColor( maColor );
03020 else
03021 pOut->SetLineColor();
03022 }
03023
03024
03025
03026 MetaAction* MetaLineColorAction::Clone()
03027 {
03028 MetaAction* pClone = (MetaAction*) new MetaLineColorAction( *this );
03029 pClone->ResetRefCount();
03030 return pClone;
03031 }
03032
03033
03034
03035 sal_Bool MetaLineColorAction::Compare( const MetaAction& rMetaAction ) const
03036 {
03037 return ( maColor == ((MetaLineColorAction&)rMetaAction).maColor ) &&
03038 ( mbSet == ((MetaLineColorAction&)rMetaAction).mbSet );
03039 }
03040
03041
03042
03043 void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03044 {
03045 WRITE_BASE_COMPAT( rOStm, 1, pData );
03046 maColor.Write( rOStm, TRUE );
03047 rOStm << mbSet;
03048 }
03049
03050
03051
03052 void MetaLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03053 {
03054 COMPAT( rIStm );
03055 maColor.Read( rIStm, TRUE );
03056 rIStm >> mbSet;
03057 }
03058
03059
03060
03061 IMPL_META_ACTION( FillColor, META_FILLCOLOR_ACTION )
03062
03063
03064
03065 MetaFillColorAction::MetaFillColorAction( const Color& rColor, BOOL bSet ) :
03066 MetaAction ( META_FILLCOLOR_ACTION ),
03067 maColor ( rColor ),
03068 mbSet ( bSet )
03069 {
03070 }
03071
03072
03073
03074 void MetaFillColorAction::Execute( OutputDevice* pOut )
03075 {
03076 if( mbSet )
03077 pOut->SetFillColor( maColor );
03078 else
03079 pOut->SetFillColor();
03080 }
03081
03082
03083
03084 MetaAction* MetaFillColorAction::Clone()
03085 {
03086 MetaAction* pClone = (MetaAction*) new MetaFillColorAction( *this );
03087 pClone->ResetRefCount();
03088 return pClone;
03089 }
03090
03091
03092
03093 sal_Bool MetaFillColorAction::Compare( const MetaAction& rMetaAction ) const
03094 {
03095 return ( maColor == ((MetaFillColorAction&)rMetaAction).maColor ) &&
03096 ( mbSet == ((MetaFillColorAction&)rMetaAction).mbSet );
03097 }
03098
03099
03100
03101 void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03102 {
03103 WRITE_BASE_COMPAT( rOStm, 1, pData );
03104 maColor.Write( rOStm, TRUE );
03105 rOStm << mbSet;
03106 }
03107
03108
03109
03110 void MetaFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03111 {
03112 COMPAT( rIStm );
03113 maColor.Read( rIStm, TRUE );
03114 rIStm >> mbSet;
03115 }
03116
03117
03118
03119 IMPL_META_ACTION( TextColor, META_TEXTCOLOR_ACTION )
03120
03121
03122
03123 MetaTextColorAction::MetaTextColorAction( const Color& rColor ) :
03124 MetaAction ( META_TEXTCOLOR_ACTION ),
03125 maColor ( rColor )
03126 {
03127 }
03128
03129
03130
03131 void MetaTextColorAction::Execute( OutputDevice* pOut )
03132 {
03133 pOut->SetTextColor( maColor );
03134 }
03135
03136
03137
03138 MetaAction* MetaTextColorAction::Clone()
03139 {
03140 MetaAction* pClone = (MetaAction*) new MetaTextColorAction( *this );
03141 pClone->ResetRefCount();
03142 return pClone;
03143 }
03144
03145
03146
03147 sal_Bool MetaTextColorAction::Compare( const MetaAction& rMetaAction ) const
03148 {
03149 return maColor == ((MetaTextColorAction&)rMetaAction).maColor;
03150 }
03151
03152
03153
03154 void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03155 {
03156 WRITE_BASE_COMPAT( rOStm, 1, pData );
03157 maColor.Write( rOStm, TRUE );
03158 }
03159
03160
03161
03162 void MetaTextColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03163 {
03164 COMPAT( rIStm );
03165 maColor.Read( rIStm, TRUE );
03166 }
03167
03168
03169
03170 IMPL_META_ACTION( TextFillColor, META_TEXTFILLCOLOR_ACTION )
03171
03172
03173
03174 MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, BOOL bSet ) :
03175 MetaAction ( META_TEXTFILLCOLOR_ACTION ),
03176 maColor ( rColor ),
03177 mbSet ( bSet )
03178 {
03179 }
03180
03181
03182
03183 void MetaTextFillColorAction::Execute( OutputDevice* pOut )
03184 {
03185 if( mbSet )
03186 pOut->SetTextFillColor( maColor );
03187 else
03188 pOut->SetTextFillColor();
03189 }
03190
03191
03192
03193 MetaAction* MetaTextFillColorAction::Clone()
03194 {
03195 MetaAction* pClone = (MetaAction*) new MetaTextFillColorAction( *this );
03196 pClone->ResetRefCount();
03197 return pClone;
03198 }
03199
03200
03201
03202 sal_Bool MetaTextFillColorAction::Compare( const MetaAction& rMetaAction ) const
03203 {
03204 return ( maColor == ((MetaTextFillColorAction&)rMetaAction).maColor ) &&
03205 ( mbSet == ((MetaTextFillColorAction&)rMetaAction).mbSet );
03206 }
03207
03208
03209
03210 void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03211 {
03212 WRITE_BASE_COMPAT( rOStm, 1, pData );
03213 maColor.Write( rOStm, TRUE );
03214 rOStm << mbSet;
03215 }
03216
03217
03218
03219 void MetaTextFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03220 {
03221 COMPAT( rIStm );
03222 maColor.Read( rIStm, TRUE );
03223 rIStm >> mbSet;
03224 }
03225
03226
03227
03228 IMPL_META_ACTION( TextLineColor, META_TEXTLINECOLOR_ACTION )
03229
03230
03231
03232 MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, BOOL bSet ) :
03233 MetaAction ( META_TEXTLINECOLOR_ACTION ),
03234 maColor ( rColor ),
03235 mbSet ( bSet )
03236 {
03237 }
03238
03239
03240
03241 void MetaTextLineColorAction::Execute( OutputDevice* pOut )
03242 {
03243 if( mbSet )
03244 pOut->SetTextLineColor( maColor );
03245 else
03246 pOut->SetTextLineColor();
03247 }
03248
03249
03250
03251 MetaAction* MetaTextLineColorAction::Clone()
03252 {
03253 MetaAction* pClone = (MetaAction*) new MetaTextLineColorAction( *this );
03254 pClone->ResetRefCount();
03255 return pClone;
03256 }
03257
03258
03259
03260 sal_Bool MetaTextLineColorAction::Compare( const MetaAction& rMetaAction ) const
03261 {
03262 return ( maColor == ((MetaTextLineColorAction&)rMetaAction).maColor ) &&
03263 ( mbSet == ((MetaTextLineColorAction&)rMetaAction).mbSet );
03264 }
03265
03266
03267
03268 void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03269 {
03270 WRITE_BASE_COMPAT( rOStm, 1, pData );
03271 maColor.Write( rOStm, TRUE );
03272 rOStm << mbSet;
03273 }
03274
03275
03276
03277 void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03278 {
03279 COMPAT( rIStm );
03280 maColor.Read( rIStm, TRUE );
03281 rIStm >> mbSet;
03282 }
03283
03284
03285
03286 IMPL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION )
03287
03288
03289
03290 MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, BOOL bSet ) :
03291 MetaAction ( META_OVERLINECOLOR_ACTION ),
03292 maColor ( rColor ),
03293 mbSet ( bSet )
03294 {
03295 }
03296
03297
03298
03299 void MetaOverlineColorAction::Execute( OutputDevice* pOut )
03300 {
03301 if( mbSet )
03302 pOut->SetOverlineColor( maColor );
03303 else
03304 pOut->SetOverlineColor();
03305 }
03306
03307
03308
03309 MetaAction* MetaOverlineColorAction::Clone()
03310 {
03311 MetaAction* pClone = (MetaAction*) new MetaOverlineColorAction( *this );
03312 pClone->ResetRefCount();
03313 return pClone;
03314 }
03315
03316
03317
03318 sal_Bool MetaOverlineColorAction::Compare( const MetaAction& rMetaAction ) const
03319 {
03320 return ( maColor == ((MetaOverlineColorAction&)rMetaAction).maColor ) &&
03321 ( mbSet == ((MetaOverlineColorAction&)rMetaAction).mbSet );
03322 }
03323
03324
03325
03326 void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03327 {
03328 WRITE_BASE_COMPAT( rOStm, 1, pData );
03329 maColor.Write( rOStm, TRUE );
03330 rOStm << mbSet;
03331 }
03332
03333
03334
03335 void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
03336 {
03337 COMPAT( rIStm );
03338 maColor.Read( rIStm, TRUE );
03339 rIStm >> mbSet;
03340 }
03341
03342
03343
03344 IMPL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION )
03345
03346
03347
03348 MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign ) :
03349 MetaAction ( META_TEXTALIGN_ACTION ),
03350 maAlign ( aAlign )
03351 {
03352 }
03353
03354
03355
03356 void MetaTextAlignAction::Execute( OutputDevice* pOut )
03357 {
03358 pOut->SetTextAlign( maAlign );
03359 }
03360
03361
03362
03363 MetaAction* MetaTextAlignAction::Clone()
03364 {
03365 MetaAction* pClone = (MetaAction*) new MetaTextAlignAction( *this );
03366 pClone->ResetRefCount();
03367 return pClone;
03368 }
03369
03370
03371
03372 sal_Bool MetaTextAlignAction::Compare( const MetaAction& rMetaAction ) const
03373 {
03374 return maAlign == ((MetaTextAlignAction&)rMetaAction).maAlign;
03375 }
03376
03377
03378
03379 void MetaTextAlignAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03380 {
03381 WRITE_BASE_COMPAT( rOStm, 1, pData );
03382 rOStm << (UINT16) maAlign;
03383 }
03384
03385
03386
03387 void MetaTextAlignAction::Read( SvStream& rIStm, ImplMetaReadData* )
03388 {
03389 UINT16 nTmp16;
03390
03391 COMPAT( rIStm );
03392 rIStm >> nTmp16; maAlign = (TextAlign) nTmp16;
03393 }
03394
03395
03396
03397 IMPL_META_ACTION( MapMode, META_MAPMODE_ACTION )
03398
03399
03400
03401 MetaMapModeAction::MetaMapModeAction( const MapMode& rMapMode ) :
03402 MetaAction ( META_MAPMODE_ACTION ),
03403 maMapMode ( rMapMode )
03404 {
03405 }
03406
03407
03408
03409 void MetaMapModeAction::Execute( OutputDevice* pOut )
03410 {
03411 pOut->SetMapMode( maMapMode );
03412 }
03413
03414
03415
03416 MetaAction* MetaMapModeAction::Clone()
03417 {
03418 MetaAction* pClone = (MetaAction*) new MetaMapModeAction( *this );
03419 pClone->ResetRefCount();
03420 return pClone;
03421 }
03422
03423
03424
03425 void MetaMapModeAction::Scale( double fScaleX, double fScaleY )
03426 {
03427 Point aPoint( maMapMode.GetOrigin() );
03428
03429 ImplScalePoint( aPoint, fScaleX, fScaleY );
03430 maMapMode.SetOrigin( aPoint );
03431 }
03432
03433
03434
03435 sal_Bool MetaMapModeAction::Compare( const MetaAction& rMetaAction ) const
03436 {
03437 return maMapMode == ((MetaMapModeAction&)rMetaAction).maMapMode;
03438 }
03439
03440
03441
03442 void MetaMapModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03443 {
03444 WRITE_BASE_COMPAT( rOStm, 1, pData );
03445 rOStm << maMapMode;
03446 }
03447
03448
03449
03450 void MetaMapModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
03451 {
03452 COMPAT( rIStm );
03453 rIStm >> maMapMode;
03454 }
03455
03456
03457
03458 IMPL_META_ACTION( Font, META_FONT_ACTION )
03459
03460
03461
03462 MetaFontAction::MetaFontAction( const Font& rFont ) :
03463 MetaAction ( META_FONT_ACTION ),
03464 maFont ( rFont )
03465 {
03466
03467
03468
03469
03470 if( ( ( maFont.GetName().SearchAscii( "StarSymbol" ) != STRING_NOTFOUND )
03471 || ( maFont.GetName().SearchAscii( "OpenSymbol" ) != STRING_NOTFOUND ) )
03472 && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
03473 {
03474 maFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
03475 }
03476 }
03477
03478
03479
03480 void MetaFontAction::Execute( OutputDevice* pOut )
03481 {
03482 pOut->SetFont( maFont );
03483 }
03484
03485
03486
03487 MetaAction* MetaFontAction::Clone()
03488 {
03489 MetaAction* pClone = (MetaAction*) new MetaFontAction( *this );
03490 pClone->ResetRefCount();
03491 return pClone;
03492 }
03493
03494
03495
03496 void MetaFontAction::Scale( double fScaleX, double fScaleY )
03497 {
03498 Size aSize( maFont.GetSize() );
03499
03500 ImplScaleSize( aSize, fScaleX, fScaleY );
03501 maFont.SetSize( aSize );
03502 }
03503
03504
03505
03506 sal_Bool MetaFontAction::Compare( const MetaAction& rMetaAction ) const
03507 {
03508 return maFont == ((MetaFontAction&)rMetaAction).maFont;
03509 }
03510
03511
03512
03513 void MetaFontAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03514 {
03515 WRITE_BASE_COMPAT( rOStm, 1, pData );
03516 rOStm << maFont;
03517 pData->meActualCharSet = maFont.GetCharSet();
03518 if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
03519 pData->meActualCharSet = gsl_getSystemTextEncoding();
03520 }
03521
03522
03523
03524 void MetaFontAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
03525 {
03526 COMPAT( rIStm );
03527 rIStm >> maFont;
03528 pData->meActualCharSet = maFont.GetCharSet();
03529 if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
03530 pData->meActualCharSet = gsl_getSystemTextEncoding();
03531 }
03532
03533
03534
03535 IMPL_META_ACTION( Push, META_PUSH_ACTION )
03536
03537
03538
03539 MetaPushAction::MetaPushAction( USHORT nFlags ) :
03540 MetaAction ( META_PUSH_ACTION ),
03541 mnFlags ( nFlags )
03542 {
03543 }
03544
03545
03546
03547 void MetaPushAction::Execute( OutputDevice* pOut )
03548 {
03549 pOut->Push( mnFlags );
03550 }
03551
03552
03553
03554 MetaAction* MetaPushAction::Clone()
03555 {
03556 MetaAction* pClone = (MetaAction*) new MetaPushAction( *this );
03557 pClone->ResetRefCount();
03558 return pClone;
03559 }
03560
03561
03562
03563 sal_Bool MetaPushAction::Compare( const MetaAction& rMetaAction ) const
03564 {
03565 return mnFlags == ((MetaPushAction&)rMetaAction).mnFlags;
03566 }
03567
03568
03569
03570 void MetaPushAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03571 {
03572 WRITE_BASE_COMPAT( rOStm, 1, pData );
03573 rOStm << mnFlags;
03574 }
03575
03576
03577
03578 void MetaPushAction::Read( SvStream& rIStm, ImplMetaReadData* )
03579 {
03580 COMPAT( rIStm );
03581 rIStm >> mnFlags;
03582 }
03583
03584
03585
03586 IMPL_META_ACTION( Pop, META_POP_ACTION )
03587
03588
03589
03590 void MetaPopAction::Execute( OutputDevice* pOut )
03591 {
03592 pOut->Pop();
03593 }
03594
03595
03596
03597 MetaAction* MetaPopAction::Clone()
03598 {
03599 MetaAction* pClone = (MetaAction*) new MetaPopAction( *this );
03600 pClone->ResetRefCount();
03601 return pClone;
03602 }
03603
03604
03605
03606 void MetaPopAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03607 {
03608 WRITE_BASE_COMPAT( rOStm, 1, pData );
03609 }
03610
03611
03612
03613 void MetaPopAction::Read( SvStream& rIStm, ImplMetaReadData* )
03614 {
03615 COMPAT( rIStm );
03616 }
03617
03618
03619
03620 IMPL_META_ACTION( RasterOp, META_RASTEROP_ACTION )
03621
03622
03623
03624 MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp ) :
03625 MetaAction ( META_RASTEROP_ACTION ),
03626 meRasterOp ( eRasterOp )
03627 {
03628 }
03629
03630
03631
03632 void MetaRasterOpAction::Execute( OutputDevice* pOut )
03633 {
03634 pOut->SetRasterOp( meRasterOp );
03635 }
03636
03637
03638
03639 MetaAction* MetaRasterOpAction::Clone()
03640 {
03641 MetaAction* pClone = (MetaAction*) new MetaRasterOpAction( *this );
03642 pClone->ResetRefCount();
03643 return pClone;
03644 }
03645
03646
03647
03648 sal_Bool MetaRasterOpAction::Compare( const MetaAction& rMetaAction ) const
03649 {
03650 return meRasterOp == ((MetaRasterOpAction&)rMetaAction).meRasterOp;
03651 }
03652
03653
03654
03655 void MetaRasterOpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03656 {
03657 WRITE_BASE_COMPAT( rOStm, 1, pData );
03658 rOStm << (UINT16) meRasterOp;
03659 }
03660
03661
03662
03663 void MetaRasterOpAction::Read( SvStream& rIStm, ImplMetaReadData* )
03664 {
03665 UINT16 nTmp16;
03666
03667 COMPAT( rIStm );
03668 rIStm >> nTmp16; meRasterOp = (RasterOp) nTmp16;
03669 }
03670
03671
03672
03673 IMPL_META_ACTION( Transparent, META_TRANSPARENT_ACTION )
03674
03675
03676
03677 MetaTransparentAction::MetaTransparentAction( const PolyPolygon& rPolyPoly, USHORT nTransPercent ) :
03678 MetaAction ( META_TRANSPARENT_ACTION ),
03679 maPolyPoly ( rPolyPoly ),
03680 mnTransPercent ( nTransPercent )
03681 {
03682 }
03683
03684
03685
03686 void MetaTransparentAction::Execute( OutputDevice* pOut )
03687 {
03688 pOut->DrawTransparent( maPolyPoly, mnTransPercent );
03689 }
03690
03691
03692
03693 MetaAction* MetaTransparentAction::Clone()
03694 {
03695 MetaAction* pClone = (MetaAction*) new MetaTransparentAction( *this );
03696 pClone->ResetRefCount();
03697 return pClone;
03698 }
03699
03700
03701
03702 void MetaTransparentAction::Move( long nHorzMove, long nVertMove )
03703 {
03704 maPolyPoly.Move( nHorzMove, nVertMove );
03705 }
03706
03707
03708
03709 void MetaTransparentAction::Scale( double fScaleX, double fScaleY )
03710 {
03711 for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
03712 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
03713 }
03714
03715
03716
03717 sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const
03718 {
03719 return ( maPolyPoly == ((MetaTransparentAction&)rMetaAction).maPolyPoly ) &&
03720 ( mnTransPercent == ((MetaTransparentAction&)rMetaAction).mnTransPercent );
03721 }
03722
03723
03724
03725 void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03726 {
03727 WRITE_BASE_COMPAT( rOStm, 1, pData );
03728
03729
03730
03731
03732
03733
03734
03735
03736
03737
03738 PolyPolygon aNoCurvePolyPolygon;
03739 maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
03740
03741 rOStm << aNoCurvePolyPolygon;
03742 rOStm << mnTransPercent;
03743 }
03744
03745
03746
03747 void MetaTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
03748 {
03749 COMPAT( rIStm );
03750 rIStm >> maPolyPoly;
03751 rIStm >> mnTransPercent;
03752 }
03753
03754
03755
03756 IMPL_META_ACTION( FloatTransparent, META_FLOATTRANSPARENT_ACTION )
03757
03758
03759
03760 MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos,
03761 const Size& rSize, const Gradient& rGradient ) :
03762 MetaAction ( META_FLOATTRANSPARENT_ACTION ),
03763 maMtf ( rMtf ),
03764 maPoint ( rPos ),
03765 maSize ( rSize ),
03766 maGradient ( rGradient )
03767 {
03768 }
03769
03770
03771
03772 void MetaFloatTransparentAction::Execute( OutputDevice* pOut )
03773 {
03774 pOut->DrawTransparent( maMtf, maPoint, maSize, maGradient );
03775 }
03776
03777
03778
03779 MetaAction* MetaFloatTransparentAction::Clone()
03780 {
03781 MetaAction* pClone = (MetaAction*) new MetaFloatTransparentAction( *this );
03782 pClone->ResetRefCount();
03783 return pClone;
03784 }
03785
03786
03787
03788 void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
03789 {
03790 maPoint.Move( nHorzMove, nVertMove );
03791 }
03792
03793
03794
03795 void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
03796 {
03797 ImplScalePoint( maPoint, fScaleX, fScaleY );
03798 ImplScaleSize( maSize, fScaleX, fScaleY );
03799 }
03800
03801
03802
03803 sal_Bool MetaFloatTransparentAction::Compare( const MetaAction& rMetaAction ) const
03804 {
03805 return ( maMtf == ((MetaFloatTransparentAction&)rMetaAction).maMtf ) &&
03806 ( maPoint == ((MetaFloatTransparentAction&)rMetaAction).maPoint ) &&
03807 ( maSize == ((MetaFloatTransparentAction&)rMetaAction).maSize ) &&
03808 ( maGradient == ((MetaFloatTransparentAction&)rMetaAction).maGradient );
03809 }
03810
03811
03812
03813 void MetaFloatTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03814 {
03815 WRITE_BASE_COMPAT( rOStm, 1, pData );
03816
03817 maMtf.Write( rOStm );
03818 rOStm << maPoint << maSize << maGradient;
03819 }
03820
03821
03822
03823 void MetaFloatTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
03824 {
03825 COMPAT( rIStm );
03826 rIStm >> maMtf >> maPoint >> maSize >> maGradient;
03827 }
03828
03829
03830
03831 IMPL_META_ACTION( EPS, META_EPS_ACTION )
03832
03833
03834
03835 MetaEPSAction::MetaEPSAction( const Point& rPoint, const Size& rSize,
03836 const GfxLink& rGfxLink, const GDIMetaFile& rSubst ) :
03837 MetaAction ( META_EPS_ACTION ),
03838 maGfxLink ( rGfxLink ),
03839 maSubst ( rSubst ),
03840 maPoint ( rPoint ),
03841 maSize ( rSize )
03842 {
03843 }
03844
03845
03846
03847 void MetaEPSAction::Execute( OutputDevice* pOut )
03848 {
03849 pOut->DrawEPS( maPoint, maSize, maGfxLink, &maSubst );
03850 }
03851
03852
03853
03854 MetaAction* MetaEPSAction::Clone()
03855 {
03856 MetaAction* pClone = (MetaAction*) new MetaEPSAction( *this );
03857 pClone->ResetRefCount();
03858 return pClone;
03859 }
03860
03861
03862
03863 void MetaEPSAction::Move( long nHorzMove, long nVertMove )
03864 {
03865 maPoint.Move( nHorzMove, nVertMove );
03866 }
03867
03868
03869
03870 void MetaEPSAction::Scale( double fScaleX, double fScaleY )
03871 {
03872 ImplScalePoint( maPoint, fScaleX, fScaleY );
03873 ImplScaleSize( maSize, fScaleX, fScaleY );
03874 }
03875
03876
03877
03878 sal_Bool MetaEPSAction::Compare( const MetaAction& rMetaAction ) const
03879 {
03880 return ( maGfxLink.IsEqual(((MetaEPSAction&)rMetaAction).maGfxLink )) &&
03881 ( maSubst == ((MetaEPSAction&)rMetaAction).maSubst ) &&
03882 ( maPoint == ((MetaEPSAction&)rMetaAction).maPoint ) &&
03883 ( maSize == ((MetaEPSAction&)rMetaAction).maSize );
03884 }
03885
03886
03887
03888 void MetaEPSAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03889 {
03890 WRITE_BASE_COMPAT( rOStm, 1, pData );
03891 rOStm << maGfxLink;
03892 rOStm << maPoint;
03893 rOStm << maSize;
03894 maSubst.Write( rOStm );
03895 }
03896
03897
03898
03899 void MetaEPSAction::Read( SvStream& rIStm, ImplMetaReadData* )
03900 {
03901 COMPAT( rIStm );
03902 rIStm >> maGfxLink;
03903 rIStm >> maPoint;
03904 rIStm >> maSize;
03905 rIStm >> maSubst;
03906 }
03907
03908
03909
03910 IMPL_META_ACTION( RefPoint, META_REFPOINT_ACTION )
03911
03912
03913
03914 MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, BOOL bSet ) :
03915 MetaAction ( META_REFPOINT_ACTION ),
03916 maRefPoint ( rRefPoint ),
03917 mbSet ( bSet )
03918 {
03919 }
03920
03921
03922
03923 void MetaRefPointAction::Execute( OutputDevice* pOut )
03924 {
03925 if( mbSet )
03926 pOut->SetRefPoint( maRefPoint );
03927 else
03928 pOut->SetRefPoint();
03929 }
03930
03931
03932
03933 MetaAction* MetaRefPointAction::Clone()
03934 {
03935 MetaAction* pClone = (MetaAction*) new MetaRefPointAction( *this );
03936 pClone->ResetRefCount();
03937 return pClone;
03938 }
03939
03940
03941
03942 sal_Bool MetaRefPointAction::Compare( const MetaAction& rMetaAction ) const
03943 {
03944 return ( maRefPoint == ((MetaRefPointAction&)rMetaAction).maRefPoint ) &&
03945 ( mbSet == ((MetaRefPointAction&)rMetaAction).mbSet );
03946 }
03947
03948
03949
03950 void MetaRefPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
03951 {
03952 WRITE_BASE_COMPAT( rOStm, 1, pData );
03953 rOStm << maRefPoint << mbSet;
03954 }
03955
03956
03957
03958 void MetaRefPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
03959 {
03960 COMPAT( rIStm );
03961 rIStm >> maRefPoint >> mbSet;
03962 }
03963
03964
03965
03966 MetaCommentAction::MetaCommentAction( sal_Int32 nValue ) :
03967 MetaAction ( META_COMMENT_ACTION ),
03968 mnValue ( nValue )
03969 {
03970 ImplInitDynamicData( NULL, 0UL );
03971 }
03972
03973
03974
03975 MetaCommentAction::MetaCommentAction( const MetaCommentAction& rAct ) :
03976 MetaAction ( META_COMMENT_ACTION ),
03977 maComment ( rAct.maComment ),
03978 mnValue ( rAct.mnValue )
03979 {
03980 ImplInitDynamicData( rAct.mpData, rAct.mnDataSize );
03981 }
03982
03983
03984
03985 MetaCommentAction::MetaCommentAction( const ByteString& rComment, sal_Int32 nValue, const BYTE* pData, sal_uInt32 nDataSize ) :
03986 MetaAction ( META_COMMENT_ACTION ),
03987 maComment ( rComment ),
03988 mnValue ( nValue )
03989 {
03990 ImplInitDynamicData( pData, nDataSize );
03991 }
03992
03993
03994
03995 MetaCommentAction::MetaCommentAction( const BYTE* pData, sal_uInt32 nDataSize ) :
03996 MetaAction ( META_COMMENT_ACTION ),
03997 mnValue ( 0L )
03998 {
03999 ImplInitDynamicData( pData, nDataSize );
04000 }
04001
04002
04003
04004 MetaCommentAction::~MetaCommentAction()
04005 {
04006 if ( mpData )
04007 delete[] mpData;
04008 }
04009
04010
04011
04012 void MetaCommentAction::ImplInitDynamicData( const BYTE* pData, sal_uInt32 nDataSize )
04013 {
04014 if ( nDataSize && pData )
04015 {
04016 mnDataSize = nDataSize, mpData = new BYTE[ mnDataSize ];
04017 memcpy( mpData, pData, mnDataSize );
04018 }
04019 else
04020 {
04021 mnDataSize = 0;
04022 mpData = NULL;
04023 }
04024 }
04025
04026
04027
04028 void MetaCommentAction::Execute( OutputDevice* pOut )
04029 {
04030 if ( pOut->GetConnectMetaFile() )
04031 pOut->GetConnectMetaFile()->AddAction( Clone() );
04032 }
04033
04034
04035
04036 MetaAction* MetaCommentAction::Clone()
04037 {
04038 MetaAction* pClone = (MetaAction*) new MetaCommentAction( *this );
04039 pClone->ResetRefCount();
04040 return pClone;
04041 }
04042
04043 void MetaCommentAction::Move( long nXMove, long nYMove )
04044 {
04045 if ( nXMove || nYMove )
04046 {
04047 if ( mnDataSize && mpData )
04048 {
04049 sal_Bool bPathStroke = maComment.Equals( "XPATHSTROKE_SEQ_BEGIN" );
04050 if ( bPathStroke || maComment.Equals( "XPATHFILL_SEQ_BEGIN" ) )
04051 {
04052 SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
04053 SvMemoryStream aDest;
04054 if ( bPathStroke )
04055 {
04056 SvtGraphicStroke aStroke;
04057 aMemStm >> aStroke;
04058 Polygon aPath;
04059 aStroke.getPath( aPath );
04060 aPath.Move( nXMove, nYMove );
04061 aStroke.setPath( aPath );
04062 aDest << aStroke;
04063 }
04064 else
04065 {
04066 SvtGraphicFill aFill;
04067 aMemStm >> aFill;
04068 PolyPolygon aPath;
04069 aFill.getPath( aPath );
04070 aPath.Scale( nXMove, nYMove );
04071 aFill.setPath( aPath );
04072 aDest << aFill;
04073 }
04074 delete[] mpData;
04075 ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() );
04076 }
04077 }
04078 }
04079 }
04080
04081
04082
04083
04084
04085
04086 void MetaCommentAction::Scale( double fXScale, double fYScale )
04087 {
04088 if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
04089 {
04090 if ( mnDataSize && mpData )
04091 {
04092 sal_Bool bPathStroke = maComment.Equals( "XPATHSTROKE_SEQ_BEGIN" );
04093 if ( bPathStroke || maComment.Equals( "XPATHFILL_SEQ_BEGIN" ) )
04094 {
04095 SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
04096 SvMemoryStream aDest;
04097 if ( bPathStroke )
04098 {
04099 SvtGraphicStroke aStroke;
04100 aMemStm >> aStroke;
04101 Polygon aPath;
04102 aStroke.getPath( aPath );
04103 aPath.Scale( fXScale, fYScale );
04104 aStroke.setPath( aPath );
04105 aDest << aStroke;
04106 }
04107 else
04108 {
04109 SvtGraphicFill aFill;
04110 aMemStm >> aFill;
04111 PolyPolygon aPath;
04112 aFill.getPath( aPath );
04113 aPath.Scale( fXScale, fYScale );
04114 aFill.setPath( aPath );
04115 aDest << aFill;
04116 }
04117 delete[] mpData;
04118 ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() );
04119 } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) {
04120 SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
04121 SvMemoryStream aDest;
04122
04123 sal_Int32 nLeft, nRight, nTop, nBottom;
04124 sal_Int32 nPixX, nPixY, nMillX, nMillY;
04125 float m11, m12, m21, m22, mdx, mdy;
04126
04127
04128 aMemStm >> nLeft >> nTop >> nRight >> nBottom;
04129 aMemStm >> nPixX >> nPixY >> nMillX >> nMillY;
04130 aMemStm >> m11 >> m12 >> m21 >> m22 >> mdx >> mdy;
04131
04132
04133 m11 *= fXScale;
04134 m12 *= fXScale;
04135 m22 *= fYScale;
04136 m21 *= fYScale;
04137
04138
04139 aDest << nLeft << nTop << nRight << nBottom;
04140 aDest << nPixX << nPixY << nMillX << nMillY;
04141 aDest << m11 << m12 << m21 << m22 << mdx << mdy;
04142
04143
04144 ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() );
04145 }
04146 }
04147 }
04148 }
04149
04150
04151
04152 sal_Bool MetaCommentAction::Compare( const MetaAction& rMetaAction ) const
04153 {
04154 return ( maComment == ((MetaCommentAction&)rMetaAction).maComment ) &&
04155 ( mnValue == ((MetaCommentAction&)rMetaAction).mnValue ) &&
04156 ( mnDataSize == ((MetaCommentAction&)rMetaAction).mnDataSize ) &&
04157 ( memcmp( mpData, ((MetaCommentAction&)rMetaAction).mpData, mnDataSize ) == 0 );
04158 }
04159
04160
04161
04162 void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
04163 {
04164 WRITE_BASE_COMPAT( rOStm, 1, pData );
04165 rOStm << maComment << mnValue << mnDataSize;
04166
04167 if ( mnDataSize )
04168 rOStm.Write( mpData, mnDataSize );
04169 }
04170
04171
04172
04173 void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
04174 {
04175 COMPAT( rIStm );
04176 rIStm >> maComment >> mnValue >> mnDataSize;
04177
04178 if( mpData )
04179 delete[] mpData;
04180
04181 if( mnDataSize )
04182 {
04183 mpData = new BYTE[ mnDataSize ];
04184 rIStm.Read( mpData, mnDataSize );
04185 }
04186 else
04187 mpData = NULL;
04188 }
04189
04190
04191
04192 IMPL_META_ACTION( LayoutMode, META_LAYOUTMODE_ACTION )
04193
04194
04195
04196 MetaLayoutModeAction::MetaLayoutModeAction( sal_uInt32 nLayoutMode ) :
04197 MetaAction ( META_LAYOUTMODE_ACTION ),
04198 mnLayoutMode( nLayoutMode )
04199 {
04200 }
04201
04202
04203
04204 void MetaLayoutModeAction::Execute( OutputDevice* pOut )
04205 {
04206 pOut->SetLayoutMode( mnLayoutMode );
04207 }
04208
04209
04210
04211 MetaAction* MetaLayoutModeAction::Clone()
04212 {
04213 MetaAction* pClone = (MetaAction*) new MetaLayoutModeAction( *this );
04214 pClone->ResetRefCount();
04215 return pClone;
04216 }
04217
04218
04219
04220 sal_Bool MetaLayoutModeAction::Compare( const MetaAction& rMetaAction ) const
04221 {
04222 return mnLayoutMode == ((MetaLayoutModeAction&)rMetaAction).mnLayoutMode;
04223 }
04224
04225
04226
04227 void MetaLayoutModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
04228 {
04229 WRITE_BASE_COMPAT( rOStm, 1, pData );
04230 rOStm << mnLayoutMode;
04231 }
04232
04233
04234
04235 void MetaLayoutModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
04236 {
04237 COMPAT( rIStm );
04238 rIStm >> mnLayoutMode;
04239 }
04240
04241
04242
04243 IMPL_META_ACTION( TextLanguage, META_TEXTLANGUAGE_ACTION )
04244
04245
04246
04247 MetaTextLanguageAction::MetaTextLanguageAction( LanguageType eTextLanguage ) :
04248 MetaAction ( META_TEXTLANGUAGE_ACTION ),
04249 meTextLanguage( eTextLanguage )
04250 {
04251 }
04252
04253
04254
04255 void MetaTextLanguageAction::Execute( OutputDevice* pOut )
04256 {
04257 pOut->SetDigitLanguage( meTextLanguage );
04258 }
04259
04260
04261
04262 MetaAction* MetaTextLanguageAction::Clone()
04263 {
04264 MetaAction* pClone = (MetaAction*) new MetaTextLanguageAction( *this );
04265 pClone->ResetRefCount();
04266 return pClone;
04267 }
04268
04269
04270
04271 sal_Bool MetaTextLanguageAction::Compare( const MetaAction& rMetaAction ) const
04272 {
04273 return meTextLanguage == ((MetaTextLanguageAction&)rMetaAction).meTextLanguage;
04274 }
04275
04276
04277
04278 void MetaTextLanguageAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
04279 {
04280 WRITE_BASE_COMPAT( rOStm, 1, pData );
04281 rOStm << meTextLanguage;
04282 }
04283
04284
04285
04286 void MetaTextLanguageAction::Read( SvStream& rIStm, ImplMetaReadData* )
04287 {
04288 COMPAT( rIStm );
04289 rIStm >> meTextLanguage;
04290 }
04291
04292