1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <osl/thread.h>
23 #include <sal/log.hxx>
24 #include <tools/stream.hxx>
25 #include <tools/vcompat.hxx>
26 #include <tools/helpers.hxx>
27 #include <vcl/dibtools.hxx>
28 #include <vcl/outdev.hxx>
29 #include <vcl/metaact.hxx>
30 #include <vcl/graphictools.hxx>
31 #include <unotools/fontdefs.hxx>
32 #include <TypeSerializer.hxx>
38 meta_action_name(MetaActionType nMetaAction
)
46 case MetaActionType::NONE
: return "NULL";
47 case MetaActionType::PIXEL
: return "PIXEL";
48 case MetaActionType::POINT
: return "POINT";
49 case MetaActionType::LINE
: return "LINE";
50 case MetaActionType::RECT
: return "RECT";
51 case MetaActionType::ROUNDRECT
: return "ROUNDRECT";
52 case MetaActionType::ELLIPSE
: return "ELLIPSE";
53 case MetaActionType::ARC
: return "ARC";
54 case MetaActionType::PIE
: return "PIE";
55 case MetaActionType::CHORD
: return "CHORD";
56 case MetaActionType::POLYLINE
: return "POLYLINE";
57 case MetaActionType::POLYGON
: return "POLYGON";
58 case MetaActionType::POLYPOLYGON
: return "POLYPOLYGON";
59 case MetaActionType::TEXT
: return "TEXT";
60 case MetaActionType::TEXTARRAY
: return "TEXTARRAY";
61 case MetaActionType::STRETCHTEXT
: return "STRETCHTEXT";
62 case MetaActionType::TEXTRECT
: return "TEXTRECT";
63 case MetaActionType::BMP
: return "BMP";
64 case MetaActionType::BMPSCALE
: return "BMPSCALE";
65 case MetaActionType::BMPSCALEPART
: return "BMPSCALEPART";
66 case MetaActionType::BMPEX
: return "BMPEX";
67 case MetaActionType::BMPEXSCALE
: return "BMPEXSCALE";
68 case MetaActionType::BMPEXSCALEPART
: return "BMPEXSCALEPART";
69 case MetaActionType::MASK
: return "MASK";
70 case MetaActionType::MASKSCALE
: return "MASKSCALE";
71 case MetaActionType::MASKSCALEPART
: return "MASKSCALEPART";
72 case MetaActionType::GRADIENT
: return "GRADIENT";
73 case MetaActionType::HATCH
: return "HATCH";
74 case MetaActionType::WALLPAPER
: return "WALLPAPER";
75 case MetaActionType::CLIPREGION
: return "CLIPREGION";
76 case MetaActionType::ISECTRECTCLIPREGION
: return "ISECTRECTCLIPREGION";
77 case MetaActionType::ISECTREGIONCLIPREGION
: return "ISECTREGIONCLIPREGION";
78 case MetaActionType::MOVECLIPREGION
: return "MOVECLIPREGION";
79 case MetaActionType::LINECOLOR
: return "LINECOLOR";
80 case MetaActionType::FILLCOLOR
: return "FILLCOLOR";
81 case MetaActionType::TEXTCOLOR
: return "TEXTCOLOR";
82 case MetaActionType::TEXTFILLCOLOR
: return "TEXTFILLCOLOR";
83 case MetaActionType::TEXTALIGN
: return "TEXTALIGN";
84 case MetaActionType::MAPMODE
: return "MAPMODE";
85 case MetaActionType::FONT
: return "FONT";
86 case MetaActionType::PUSH
: return "PUSH";
87 case MetaActionType::POP
: return "POP";
88 case MetaActionType::RASTEROP
: return "RASTEROP";
89 case MetaActionType::Transparent
: return "TRANSPARENT";
90 case MetaActionType::EPS
: return "EPS";
91 case MetaActionType::REFPOINT
: return "REFPOINT";
92 case MetaActionType::TEXTLINECOLOR
: return "TEXTLINECOLOR";
93 case MetaActionType::TEXTLINE
: return "TEXTLINE";
94 case MetaActionType::FLOATTRANSPARENT
: return "FLOATTRANSPARENT";
95 case MetaActionType::GRADIENTEX
: return "GRADIENTEX";
96 case MetaActionType::LAYOUTMODE
: return "LAYOUTMODE";
97 case MetaActionType::TEXTLANGUAGE
: return "TEXTLANGUAGE";
98 case MetaActionType::OVERLINECOLOR
: return "OVERLINECOLOR";
99 case MetaActionType::COMMENT
: return "COMMENT";
101 // Yes, return a pointer to a static buffer. This is a very
102 // local debugging output function, so no big deal.
103 static char buffer
[6];
104 sprintf(buffer
, "%u", static_cast<unsigned int>(nMetaAction
));
110 void ImplScalePoint( Point
& rPt
, double fScaleX
, double fScaleY
)
112 rPt
.setX( FRound( fScaleX
* rPt
.X() ) );
113 rPt
.setY( FRound( fScaleY
* rPt
.Y() ) );
116 void ImplScaleRect( tools::Rectangle
& rRect
, double fScaleX
, double fScaleY
)
118 Point
aTL( rRect
.TopLeft() );
119 Point
aBR( rRect
.BottomRight() );
121 ImplScalePoint( aTL
, fScaleX
, fScaleY
);
122 ImplScalePoint( aBR
, fScaleX
, fScaleY
);
124 rRect
= tools::Rectangle( aTL
, aBR
);
128 void ImplScalePoly( tools::Polygon
& rPoly
, double fScaleX
, double fScaleY
)
130 for( sal_uInt16 i
= 0, nCount
= rPoly
.GetSize(); i
< nCount
; i
++ )
131 ImplScalePoint( rPoly
[ i
], fScaleX
, fScaleY
);
134 void ImplScaleLineInfo( LineInfo
& rLineInfo
, double fScaleX
, double fScaleY
)
136 if( !rLineInfo
.IsDefault() )
138 const double fScale
= ( fabs(fScaleX
) + fabs(fScaleY
) ) * 0.5;
140 rLineInfo
.SetWidth( FRound( fScale
* rLineInfo
.GetWidth() ) );
141 rLineInfo
.SetDashLen( FRound( fScale
* rLineInfo
.GetDashLen() ) );
142 rLineInfo
.SetDotLen( FRound( fScale
* rLineInfo
.GetDotLen() ) );
143 rLineInfo
.SetDistance( FRound( fScale
* rLineInfo
.GetDistance() ) );
147 } //anonymous namespace
149 MetaAction::MetaAction() :
150 mnType( MetaActionType::NONE
)
154 MetaAction::MetaAction( MetaActionType nType
) :
159 MetaAction::MetaAction( MetaAction
const & rOther
) :
160 SimpleReferenceObject(), mnType( rOther
.mnType
)
164 MetaAction::~MetaAction()
168 void MetaAction::Execute( OutputDevice
* )
172 rtl::Reference
<MetaAction
> MetaAction::Clone()
174 return new MetaAction
;
177 void MetaAction::Move( long, long )
181 void MetaAction::Scale( double, double )
185 void MetaAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* )
187 rOStm
.WriteUInt16( static_cast<sal_uInt16
>(mnType
) );
190 void MetaAction::Read( SvStream
&, ImplMetaReadData
* )
192 // DO NOT read mnType - ReadMetaAction already did that!
195 MetaAction
* MetaAction::ReadMetaAction( SvStream
& rIStm
, ImplMetaReadData
* pData
)
197 MetaAction
* pAction
= nullptr;
199 rIStm
.ReadUInt16( nTmp
);
200 MetaActionType nType
= static_cast<MetaActionType
>(nTmp
);
202 SAL_INFO("vcl.gdi", "ReadMetaAction " << meta_action_name( nType
));
206 case MetaActionType::NONE
: pAction
= new MetaAction
; break;
207 case MetaActionType::PIXEL
: pAction
= new MetaPixelAction
; break;
208 case MetaActionType::POINT
: pAction
= new MetaPointAction
; break;
209 case MetaActionType::LINE
: pAction
= new MetaLineAction
; break;
210 case MetaActionType::RECT
: pAction
= new MetaRectAction
; break;
211 case MetaActionType::ROUNDRECT
: pAction
= new MetaRoundRectAction
; break;
212 case MetaActionType::ELLIPSE
: pAction
= new MetaEllipseAction
; break;
213 case MetaActionType::ARC
: pAction
= new MetaArcAction
; break;
214 case MetaActionType::PIE
: pAction
= new MetaPieAction
; break;
215 case MetaActionType::CHORD
: pAction
= new MetaChordAction
; break;
216 case MetaActionType::POLYLINE
: pAction
= new MetaPolyLineAction
; break;
217 case MetaActionType::POLYGON
: pAction
= new MetaPolygonAction
; break;
218 case MetaActionType::POLYPOLYGON
: pAction
= new MetaPolyPolygonAction
; break;
219 case MetaActionType::TEXT
: pAction
= new MetaTextAction
; break;
220 case MetaActionType::TEXTARRAY
: pAction
= new MetaTextArrayAction
; break;
221 case MetaActionType::STRETCHTEXT
: pAction
= new MetaStretchTextAction
; break;
222 case MetaActionType::TEXTRECT
: pAction
= new MetaTextRectAction
; break;
223 case MetaActionType::TEXTLINE
: pAction
= new MetaTextLineAction
; break;
224 case MetaActionType::BMP
: pAction
= new MetaBmpAction
; break;
225 case MetaActionType::BMPSCALE
: pAction
= new MetaBmpScaleAction
; break;
226 case MetaActionType::BMPSCALEPART
: pAction
= new MetaBmpScalePartAction
; break;
227 case MetaActionType::BMPEX
: pAction
= new MetaBmpExAction
; break;
228 case MetaActionType::BMPEXSCALE
: pAction
= new MetaBmpExScaleAction
; break;
229 case MetaActionType::BMPEXSCALEPART
: pAction
= new MetaBmpExScalePartAction
; break;
230 case MetaActionType::MASK
: pAction
= new MetaMaskAction
; break;
231 case MetaActionType::MASKSCALE
: pAction
= new MetaMaskScaleAction
; break;
232 case MetaActionType::MASKSCALEPART
: pAction
= new MetaMaskScalePartAction
; break;
233 case MetaActionType::GRADIENT
: pAction
= new MetaGradientAction
; break;
234 case MetaActionType::GRADIENTEX
: pAction
= new MetaGradientExAction
; break;
235 case MetaActionType::HATCH
: pAction
= new MetaHatchAction
; break;
236 case MetaActionType::WALLPAPER
: pAction
= new MetaWallpaperAction
; break;
237 case MetaActionType::CLIPREGION
: pAction
= new MetaClipRegionAction
; break;
238 case MetaActionType::ISECTRECTCLIPREGION
: pAction
= new MetaISectRectClipRegionAction
; break;
239 case MetaActionType::ISECTREGIONCLIPREGION
: pAction
= new MetaISectRegionClipRegionAction
; break;
240 case MetaActionType::MOVECLIPREGION
: pAction
= new MetaMoveClipRegionAction
; break;
241 case MetaActionType::LINECOLOR
: pAction
= new MetaLineColorAction
; break;
242 case MetaActionType::FILLCOLOR
: pAction
= new MetaFillColorAction
; break;
243 case MetaActionType::TEXTCOLOR
: pAction
= new MetaTextColorAction
; break;
244 case MetaActionType::TEXTFILLCOLOR
: pAction
= new MetaTextFillColorAction
; break;
245 case MetaActionType::TEXTLINECOLOR
: pAction
= new MetaTextLineColorAction
; break;
246 case MetaActionType::OVERLINECOLOR
: pAction
= new MetaOverlineColorAction
; break;
247 case MetaActionType::TEXTALIGN
: pAction
= new MetaTextAlignAction
; break;
248 case MetaActionType::MAPMODE
: pAction
= new MetaMapModeAction
; break;
249 case MetaActionType::FONT
: pAction
= new MetaFontAction
; break;
250 case MetaActionType::PUSH
: pAction
= new MetaPushAction
; break;
251 case MetaActionType::POP
: pAction
= new MetaPopAction
; break;
252 case MetaActionType::RASTEROP
: pAction
= new MetaRasterOpAction
; break;
253 case MetaActionType::Transparent
: pAction
= new MetaTransparentAction
; break;
254 case MetaActionType::FLOATTRANSPARENT
: pAction
= new MetaFloatTransparentAction
; break;
255 case MetaActionType::EPS
: pAction
= new MetaEPSAction
; break;
256 case MetaActionType::REFPOINT
: pAction
= new MetaRefPointAction
; break;
257 case MetaActionType::COMMENT
: pAction
= new MetaCommentAction
; break;
258 case MetaActionType::LAYOUTMODE
: pAction
= new MetaLayoutModeAction
; break;
259 case MetaActionType::TEXTLANGUAGE
: pAction
= new MetaTextLanguageAction
; break;
263 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
269 pAction
->Read( rIStm
, pData
);
274 MetaPixelAction::MetaPixelAction() :
275 MetaAction(MetaActionType::PIXEL
)
278 MetaPixelAction::~MetaPixelAction()
281 MetaPixelAction::MetaPixelAction( const Point
& rPt
, const Color
& rColor
) :
282 MetaAction ( MetaActionType::PIXEL
),
287 void MetaPixelAction::Execute( OutputDevice
* pOut
)
289 pOut
->DrawPixel( maPt
, maColor
);
292 rtl::Reference
<MetaAction
> MetaPixelAction::Clone()
294 return new MetaPixelAction( *this );
297 void MetaPixelAction::Move( long nHorzMove
, long nVertMove
)
299 maPt
.Move( nHorzMove
, nVertMove
);
302 void MetaPixelAction::Scale( double fScaleX
, double fScaleY
)
304 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
307 void MetaPixelAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
309 MetaAction::Write(rOStm
, pData
);
310 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
311 TypeSerializer
aSerializer(rOStm
);
312 aSerializer
.writePoint(maPt
);
313 rOStm
.WriteUInt32(maColor
.mValue
);
316 void MetaPixelAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
318 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
319 TypeSerializer
aSerializer(rIStm
);
320 aSerializer
.readPoint(maPt
);
321 rIStm
.ReadUInt32(maColor
.mValue
);
324 MetaPointAction::MetaPointAction() :
325 MetaAction(MetaActionType::POINT
)
328 MetaPointAction::~MetaPointAction()
331 MetaPointAction::MetaPointAction( const Point
& rPt
) :
332 MetaAction ( MetaActionType::POINT
),
336 void MetaPointAction::Execute( OutputDevice
* pOut
)
338 pOut
->DrawPixel( maPt
);
341 rtl::Reference
<MetaAction
> MetaPointAction::Clone()
343 return new MetaPointAction( *this );
346 void MetaPointAction::Move( long nHorzMove
, long nVertMove
)
348 maPt
.Move( nHorzMove
, nVertMove
);
351 void MetaPointAction::Scale( double fScaleX
, double fScaleY
)
353 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
356 void MetaPointAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
358 MetaAction::Write(rOStm
, pData
);
359 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
360 TypeSerializer
aSerializer(rOStm
);
361 aSerializer
.writePoint(maPt
);
364 void MetaPointAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
366 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
367 TypeSerializer
aSerializer(rIStm
);
368 aSerializer
.readPoint(maPt
);
371 MetaLineAction::MetaLineAction() :
372 MetaAction(MetaActionType::LINE
)
375 MetaLineAction::~MetaLineAction()
378 MetaLineAction::MetaLineAction( const Point
& rStart
, const Point
& rEnd
) :
379 MetaAction ( MetaActionType::LINE
),
380 maStartPt ( rStart
),
384 MetaLineAction::MetaLineAction( const Point
& rStart
, const Point
& rEnd
,
385 const LineInfo
& rLineInfo
) :
386 MetaAction ( MetaActionType::LINE
),
387 maLineInfo ( rLineInfo
),
388 maStartPt ( rStart
),
392 void MetaLineAction::Execute( OutputDevice
* pOut
)
394 if( maLineInfo
.IsDefault() )
395 pOut
->DrawLine( maStartPt
, maEndPt
);
397 pOut
->DrawLine( maStartPt
, maEndPt
, maLineInfo
);
400 rtl::Reference
<MetaAction
> MetaLineAction::Clone()
402 return new MetaLineAction( *this );
405 void MetaLineAction::Move( long nHorzMove
, long nVertMove
)
407 maStartPt
.Move( nHorzMove
, nVertMove
);
408 maEndPt
.Move( nHorzMove
, nVertMove
);
411 void MetaLineAction::Scale( double fScaleX
, double fScaleY
)
413 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
414 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
415 ImplScaleLineInfo( maLineInfo
, fScaleX
, fScaleY
);
418 void MetaLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
420 MetaAction::Write(rOStm
, pData
);
421 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
424 TypeSerializer
aSerializer(rOStm
);
425 aSerializer
.writePoint(maStartPt
);
426 aSerializer
.writePoint(maEndPt
);
428 WriteLineInfo( rOStm
, maLineInfo
);
431 void MetaLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
433 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
436 TypeSerializer
aSerializer(rIStm
);
437 aSerializer
.readPoint(maStartPt
);
438 aSerializer
.readPoint(maEndPt
);
441 if( aCompat
.GetVersion() >= 2 )
443 ReadLineInfo( rIStm
, maLineInfo
);
447 MetaRectAction::MetaRectAction() :
448 MetaAction(MetaActionType::RECT
)
451 MetaRectAction::~MetaRectAction()
454 MetaRectAction::MetaRectAction( const tools::Rectangle
& rRect
) :
455 MetaAction ( MetaActionType::RECT
),
459 void MetaRectAction::Execute( OutputDevice
* pOut
)
461 pOut
->DrawRect( maRect
);
464 rtl::Reference
<MetaAction
> MetaRectAction::Clone()
466 return new MetaRectAction( *this );
469 void MetaRectAction::Move( long nHorzMove
, long nVertMove
)
471 maRect
.Move( nHorzMove
, nVertMove
);
474 void MetaRectAction::Scale( double fScaleX
, double fScaleY
)
476 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
479 void MetaRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
481 MetaAction::Write(rOStm
, pData
);
482 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
483 TypeSerializer
aSerializer(rOStm
);
484 aSerializer
.writeRectangle(maRect
);
487 void MetaRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
489 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
490 TypeSerializer
aSerializer(rIStm
);
491 aSerializer
.readRectangle(maRect
);
494 MetaRoundRectAction::MetaRoundRectAction() :
495 MetaAction ( MetaActionType::ROUNDRECT
),
500 MetaRoundRectAction::~MetaRoundRectAction()
503 MetaRoundRectAction::MetaRoundRectAction( const tools::Rectangle
& rRect
,
504 sal_uInt32 nHorzRound
, sal_uInt32 nVertRound
) :
505 MetaAction ( MetaActionType::ROUNDRECT
),
507 mnHorzRound ( nHorzRound
),
508 mnVertRound ( nVertRound
)
511 void MetaRoundRectAction::Execute( OutputDevice
* pOut
)
513 pOut
->DrawRect( maRect
, mnHorzRound
, mnVertRound
);
516 rtl::Reference
<MetaAction
> MetaRoundRectAction::Clone()
518 return new MetaRoundRectAction( *this );
521 void MetaRoundRectAction::Move( long nHorzMove
, long nVertMove
)
523 maRect
.Move( nHorzMove
, nVertMove
);
526 void MetaRoundRectAction::Scale( double fScaleX
, double fScaleY
)
528 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
529 mnHorzRound
= FRound( mnHorzRound
* fabs(fScaleX
) );
530 mnVertRound
= FRound( mnVertRound
* fabs(fScaleY
) );
533 void MetaRoundRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
535 MetaAction::Write(rOStm
, pData
);
536 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
537 TypeSerializer
aSerializer(rOStm
);
538 aSerializer
.writeRectangle(maRect
);
539 rOStm
.WriteUInt32( mnHorzRound
).WriteUInt32( mnVertRound
);
542 void MetaRoundRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
544 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
545 TypeSerializer
aSerializer(rIStm
);
546 aSerializer
.readRectangle(maRect
);
547 rIStm
.ReadUInt32( mnHorzRound
).ReadUInt32( mnVertRound
);
550 MetaEllipseAction::MetaEllipseAction() :
551 MetaAction(MetaActionType::ELLIPSE
)
554 MetaEllipseAction::~MetaEllipseAction()
557 MetaEllipseAction::MetaEllipseAction( const tools::Rectangle
& rRect
) :
558 MetaAction ( MetaActionType::ELLIPSE
),
562 void MetaEllipseAction::Execute( OutputDevice
* pOut
)
564 pOut
->DrawEllipse( maRect
);
567 rtl::Reference
<MetaAction
> MetaEllipseAction::Clone()
569 return new MetaEllipseAction( *this );
572 void MetaEllipseAction::Move( long nHorzMove
, long nVertMove
)
574 maRect
.Move( nHorzMove
, nVertMove
);
577 void MetaEllipseAction::Scale( double fScaleX
, double fScaleY
)
579 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
582 void MetaEllipseAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
584 MetaAction::Write(rOStm
, pData
);
585 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
586 TypeSerializer
aSerializer(rOStm
);
587 aSerializer
.writeRectangle(maRect
);
590 void MetaEllipseAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
592 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
593 TypeSerializer
aSerializer(rIStm
);
594 aSerializer
.readRectangle(maRect
);
597 MetaArcAction::MetaArcAction() :
598 MetaAction(MetaActionType::ARC
)
601 MetaArcAction::~MetaArcAction()
604 MetaArcAction::MetaArcAction( const tools::Rectangle
& rRect
,
605 const Point
& rStart
, const Point
& rEnd
) :
606 MetaAction ( MetaActionType::ARC
),
608 maStartPt ( rStart
),
612 void MetaArcAction::Execute( OutputDevice
* pOut
)
614 pOut
->DrawArc( maRect
, maStartPt
, maEndPt
);
617 rtl::Reference
<MetaAction
> MetaArcAction::Clone()
619 return new MetaArcAction( *this );
622 void MetaArcAction::Move( long nHorzMove
, long nVertMove
)
624 maRect
.Move( nHorzMove
, nVertMove
);
625 maStartPt
.Move( nHorzMove
, nVertMove
);
626 maEndPt
.Move( nHorzMove
, nVertMove
);
629 void MetaArcAction::Scale( double fScaleX
, double fScaleY
)
631 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
632 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
633 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
636 void MetaArcAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
638 MetaAction::Write(rOStm
, pData
);
639 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
640 TypeSerializer
aSerializer(rOStm
);
641 aSerializer
.writeRectangle(maRect
);
642 aSerializer
.writePoint(maStartPt
);
643 aSerializer
.writePoint(maEndPt
);
646 void MetaArcAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
648 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
649 TypeSerializer
aSerializer(rIStm
);
650 aSerializer
.readRectangle(maRect
);
651 aSerializer
.readPoint(maStartPt
);
652 aSerializer
.readPoint(maEndPt
);
655 MetaPieAction::MetaPieAction() :
656 MetaAction(MetaActionType::PIE
)
659 MetaPieAction::~MetaPieAction()
662 MetaPieAction::MetaPieAction( const tools::Rectangle
& rRect
,
663 const Point
& rStart
, const Point
& rEnd
) :
664 MetaAction ( MetaActionType::PIE
),
666 maStartPt ( rStart
),
670 void MetaPieAction::Execute( OutputDevice
* pOut
)
672 pOut
->DrawPie( maRect
, maStartPt
, maEndPt
);
675 rtl::Reference
<MetaAction
> MetaPieAction::Clone()
677 return new MetaPieAction( *this );
680 void MetaPieAction::Move( long nHorzMove
, long nVertMove
)
682 maRect
.Move( nHorzMove
, nVertMove
);
683 maStartPt
.Move( nHorzMove
, nVertMove
);
684 maEndPt
.Move( nHorzMove
, nVertMove
);
687 void MetaPieAction::Scale( double fScaleX
, double fScaleY
)
689 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
690 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
691 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
694 void MetaPieAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
696 MetaAction::Write(rOStm
, pData
);
697 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
698 TypeSerializer
aSerializer(rOStm
);
699 aSerializer
.writeRectangle(maRect
);
700 aSerializer
.writePoint(maStartPt
);
701 aSerializer
.writePoint(maEndPt
);
704 void MetaPieAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
706 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
707 TypeSerializer
aSerializer(rIStm
);
708 aSerializer
.readRectangle(maRect
);
709 aSerializer
.readPoint(maStartPt
);
710 aSerializer
.readPoint(maEndPt
);
713 MetaChordAction::MetaChordAction() :
714 MetaAction(MetaActionType::CHORD
)
717 MetaChordAction::~MetaChordAction()
720 MetaChordAction::MetaChordAction( const tools::Rectangle
& rRect
,
721 const Point
& rStart
, const Point
& rEnd
) :
722 MetaAction ( MetaActionType::CHORD
),
724 maStartPt ( rStart
),
728 void MetaChordAction::Execute( OutputDevice
* pOut
)
730 pOut
->DrawChord( maRect
, maStartPt
, maEndPt
);
733 rtl::Reference
<MetaAction
> MetaChordAction::Clone()
735 return new MetaChordAction( *this );
738 void MetaChordAction::Move( long nHorzMove
, long nVertMove
)
740 maRect
.Move( nHorzMove
, nVertMove
);
741 maStartPt
.Move( nHorzMove
, nVertMove
);
742 maEndPt
.Move( nHorzMove
, nVertMove
);
745 void MetaChordAction::Scale( double fScaleX
, double fScaleY
)
747 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
748 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
749 ImplScalePoint( maEndPt
, fScaleX
, fScaleY
);
752 void MetaChordAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
754 MetaAction::Write(rOStm
, pData
);
755 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
756 TypeSerializer
aSerializer(rOStm
);
757 aSerializer
.writeRectangle(maRect
);
758 aSerializer
.writePoint(maStartPt
);
759 aSerializer
.writePoint(maEndPt
);
762 void MetaChordAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
764 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
765 TypeSerializer
aSerializer(rIStm
);
766 aSerializer
.readRectangle(maRect
);
767 aSerializer
.readPoint(maStartPt
);
768 aSerializer
.readPoint(maEndPt
);
771 MetaPolyLineAction::MetaPolyLineAction() :
772 MetaAction(MetaActionType::POLYLINE
)
775 MetaPolyLineAction::~MetaPolyLineAction()
778 MetaPolyLineAction::MetaPolyLineAction( const tools::Polygon
& rPoly
) :
779 MetaAction ( MetaActionType::POLYLINE
),
783 MetaPolyLineAction::MetaPolyLineAction( const tools::Polygon
& rPoly
, const LineInfo
& rLineInfo
) :
784 MetaAction ( MetaActionType::POLYLINE
),
785 maLineInfo ( rLineInfo
),
789 void MetaPolyLineAction::Execute( OutputDevice
* pOut
)
791 if( maLineInfo
.IsDefault() )
792 pOut
->DrawPolyLine( maPoly
);
794 pOut
->DrawPolyLine( maPoly
, maLineInfo
);
797 rtl::Reference
<MetaAction
> MetaPolyLineAction::Clone()
799 return new MetaPolyLineAction( *this );
802 void MetaPolyLineAction::Move( long nHorzMove
, long nVertMove
)
804 maPoly
.Move( nHorzMove
, nVertMove
);
807 void MetaPolyLineAction::Scale( double fScaleX
, double fScaleY
)
809 ImplScalePoly( maPoly
, fScaleX
, fScaleY
);
810 ImplScaleLineInfo( maLineInfo
, fScaleX
, fScaleY
);
813 void MetaPolyLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
815 MetaAction::Write(rOStm
, pData
);
816 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 3);
818 tools::Polygon aSimplePoly
;
819 maPoly
.AdaptiveSubdivide( aSimplePoly
);
821 WritePolygon( rOStm
, aSimplePoly
); // Version 1
822 WriteLineInfo( rOStm
, maLineInfo
); // Version 2
824 bool bHasPolyFlags
= maPoly
.HasFlags(); // Version 3
825 rOStm
.WriteBool( bHasPolyFlags
);
827 maPoly
.Write( rOStm
);
830 void MetaPolyLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
832 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
835 ReadPolygon( rIStm
, maPoly
);
838 if( aCompat
.GetVersion() >= 2 )
839 ReadLineInfo( rIStm
, maLineInfo
);
840 if ( aCompat
.GetVersion() >= 3 )
842 sal_uInt8
bHasPolyFlags(0);
843 rIStm
.ReadUChar( bHasPolyFlags
);
845 maPoly
.Read( rIStm
);
849 MetaPolygonAction::MetaPolygonAction() :
850 MetaAction(MetaActionType::POLYGON
)
853 MetaPolygonAction::~MetaPolygonAction()
856 MetaPolygonAction::MetaPolygonAction( const tools::Polygon
& rPoly
) :
857 MetaAction ( MetaActionType::POLYGON
),
861 void MetaPolygonAction::Execute( OutputDevice
* pOut
)
863 pOut
->DrawPolygon( maPoly
);
866 rtl::Reference
<MetaAction
> MetaPolygonAction::Clone()
868 return new MetaPolygonAction( *this );
871 void MetaPolygonAction::Move( long nHorzMove
, long nVertMove
)
873 maPoly
.Move( nHorzMove
, nVertMove
);
876 void MetaPolygonAction::Scale( double fScaleX
, double fScaleY
)
878 ImplScalePoly( maPoly
, fScaleX
, fScaleY
);
881 void MetaPolygonAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
883 MetaAction::Write(rOStm
, pData
);
884 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
886 tools::Polygon aSimplePoly
; // Version 1
887 maPoly
.AdaptiveSubdivide( aSimplePoly
);
888 WritePolygon( rOStm
, aSimplePoly
);
890 bool bHasPolyFlags
= maPoly
.HasFlags(); // Version 2
891 rOStm
.WriteBool( bHasPolyFlags
);
893 maPoly
.Write( rOStm
);
896 void MetaPolygonAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
898 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
900 ReadPolygon( rIStm
, maPoly
); // Version 1
902 if( aCompat
.GetVersion() >= 2 ) // Version 2
904 sal_uInt8
bHasPolyFlags(0);
905 rIStm
.ReadUChar( bHasPolyFlags
);
907 maPoly
.Read( rIStm
);
911 MetaPolyPolygonAction::MetaPolyPolygonAction() :
912 MetaAction(MetaActionType::POLYPOLYGON
)
915 MetaPolyPolygonAction::~MetaPolyPolygonAction()
918 MetaPolyPolygonAction::MetaPolyPolygonAction( const tools::PolyPolygon
& rPolyPoly
) :
919 MetaAction ( MetaActionType::POLYPOLYGON
),
920 maPolyPoly ( rPolyPoly
)
923 void MetaPolyPolygonAction::Execute( OutputDevice
* pOut
)
925 pOut
->DrawPolyPolygon( maPolyPoly
);
928 rtl::Reference
<MetaAction
> MetaPolyPolygonAction::Clone()
930 return new MetaPolyPolygonAction( *this );
933 void MetaPolyPolygonAction::Move( long nHorzMove
, long nVertMove
)
935 maPolyPoly
.Move( nHorzMove
, nVertMove
);
938 void MetaPolyPolygonAction::Scale( double fScaleX
, double fScaleY
)
940 for( sal_uInt16 i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
941 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
944 void MetaPolyPolygonAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
946 MetaAction::Write(rOStm
, pData
);
947 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
949 sal_uInt16 nNumberOfComplexPolygons
= 0;
950 sal_uInt16 i
, nPolyCount
= maPolyPoly
.Count();
952 tools::Polygon aSimplePoly
; // Version 1
953 rOStm
.WriteUInt16( nPolyCount
);
954 for ( i
= 0; i
< nPolyCount
; i
++ )
956 const tools::Polygon
& rPoly
= maPolyPoly
.GetObject( i
);
957 if ( rPoly
.HasFlags() )
958 nNumberOfComplexPolygons
++;
959 rPoly
.AdaptiveSubdivide( aSimplePoly
);
960 WritePolygon( rOStm
, aSimplePoly
);
963 rOStm
.WriteUInt16( nNumberOfComplexPolygons
); // Version 2
964 for ( i
= 0; nNumberOfComplexPolygons
&& ( i
< nPolyCount
); i
++ )
966 const tools::Polygon
& rPoly
= maPolyPoly
.GetObject( i
);
967 if ( rPoly
.HasFlags() )
969 rOStm
.WriteUInt16( i
);
970 rPoly
.Write( rOStm
);
972 nNumberOfComplexPolygons
--;
977 void MetaPolyPolygonAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
979 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
980 ReadPolyPolygon( rIStm
, maPolyPoly
); // Version 1
982 if ( aCompat
.GetVersion() >= 2 ) // Version 2
984 sal_uInt16
nNumberOfComplexPolygons(0);
985 rIStm
.ReadUInt16( nNumberOfComplexPolygons
);
986 const size_t nMinRecordSize
= sizeof(sal_uInt16
);
987 const size_t nMaxRecords
= rIStm
.remainingSize() / nMinRecordSize
;
988 if (nNumberOfComplexPolygons
> nMaxRecords
)
990 SAL_WARN("vcl.gdi", "Parsing error: " << nMaxRecords
<<
991 " max possible entries, but " << nNumberOfComplexPolygons
<< " claimed, truncating");
992 nNumberOfComplexPolygons
= nMaxRecords
;
994 for (sal_uInt16 i
= 0; i
< nNumberOfComplexPolygons
; ++i
)
996 sal_uInt16
nIndex(0);
997 rIStm
.ReadUInt16( nIndex
);
998 tools::Polygon aPoly
;
1000 if (nIndex
>= maPolyPoly
.Count())
1002 SAL_WARN("vcl.gdi", "svm contains polygon index " << nIndex
1003 << " outside possible range " << maPolyPoly
.Count());
1006 maPolyPoly
.Replace( aPoly
, nIndex
);
1011 MetaTextAction::MetaTextAction() :
1012 MetaAction ( MetaActionType::TEXT
),
1017 MetaTextAction::~MetaTextAction()
1020 MetaTextAction::MetaTextAction( const Point
& rPt
, const OUString
& rStr
,
1021 sal_Int32 nIndex
, sal_Int32 nLen
) :
1022 MetaAction ( MetaActionType::TEXT
),
1029 void MetaTextAction::Execute( OutputDevice
* pOut
)
1031 pOut
->DrawText( maPt
, maStr
, mnIndex
, mnLen
);
1034 rtl::Reference
<MetaAction
> MetaTextAction::Clone()
1036 return new MetaTextAction( *this );
1039 void MetaTextAction::Move( long nHorzMove
, long nVertMove
)
1041 maPt
.Move( nHorzMove
, nVertMove
);
1044 void MetaTextAction::Scale( double fScaleX
, double fScaleY
)
1046 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1049 void MetaTextAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1051 MetaAction::Write(rOStm
, pData
);
1052 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
1053 TypeSerializer
aSerializer(rOStm
);
1054 aSerializer
.writePoint(maPt
);
1055 rOStm
.WriteUniOrByteString( maStr
, pData
->meActualCharSet
);
1056 rOStm
.WriteUInt16(mnIndex
);
1057 rOStm
.WriteUInt16(mnLen
);
1059 write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm
, maStr
); // version 2
1062 void MetaTextAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1064 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1065 TypeSerializer
aSerializer(rIStm
);
1066 aSerializer
.readPoint(maPt
);
1067 maStr
= rIStm
.ReadUniOrByteString(pData
->meActualCharSet
);
1068 sal_uInt16
nTmpIndex(0);
1069 rIStm
.ReadUInt16(nTmpIndex
);
1070 mnIndex
= nTmpIndex
;
1071 sal_uInt16
nTmpLen(0);
1072 rIStm
.ReadUInt16(nTmpLen
);
1075 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1076 maStr
= read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm
);
1079 MetaTextArrayAction::MetaTextArrayAction() :
1080 MetaAction ( MetaActionType::TEXTARRAY
),
1085 MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction
& rAction
) :
1086 MetaAction ( MetaActionType::TEXTARRAY
),
1087 maStartPt ( rAction
.maStartPt
),
1088 maStr ( rAction
.maStr
),
1089 mnIndex ( rAction
.mnIndex
),
1090 mnLen ( rAction
.mnLen
)
1092 if( rAction
.mpDXAry
)
1094 mpDXAry
.reset( new long[ mnLen
] );
1095 memcpy( mpDXAry
.get(), rAction
.mpDXAry
.get(), mnLen
* sizeof( long ) );
1099 MetaTextArrayAction::MetaTextArrayAction( const Point
& rStartPt
,
1100 const OUString
& rStr
,
1104 MetaAction ( MetaActionType::TEXTARRAY
),
1105 maStartPt ( rStartPt
),
1110 const sal_Int32 nAryLen
= pDXAry
? mnLen
: 0;
1114 mpDXAry
.reset( new long[ nAryLen
] );
1115 memcpy( mpDXAry
.get(), pDXAry
, nAryLen
* sizeof(long) );
1119 MetaTextArrayAction::~MetaTextArrayAction()
1123 void MetaTextArrayAction::Execute( OutputDevice
* pOut
)
1125 pOut
->DrawTextArray( maStartPt
, maStr
, mpDXAry
.get(), mnIndex
, mnLen
);
1128 rtl::Reference
<MetaAction
> MetaTextArrayAction::Clone()
1130 return new MetaTextArrayAction( *this );
1133 void MetaTextArrayAction::Move( long nHorzMove
, long nVertMove
)
1135 maStartPt
.Move( nHorzMove
, nVertMove
);
1138 void MetaTextArrayAction::Scale( double fScaleX
, double fScaleY
)
1140 ImplScalePoint( maStartPt
, fScaleX
, fScaleY
);
1142 if ( mpDXAry
&& mnLen
)
1144 for ( sal_uInt16 i
= 0, nCount
= mnLen
; i
< nCount
; i
++ )
1145 mpDXAry
[ i
] = FRound( mpDXAry
[ i
] * fabs(fScaleX
) );
1149 void MetaTextArrayAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1151 const sal_Int32 nAryLen
= mpDXAry
? mnLen
: 0;
1153 MetaAction::Write(rOStm
, pData
);
1154 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
1155 TypeSerializer
aSerializer(rOStm
);
1156 aSerializer
.writePoint(maStartPt
);
1157 rOStm
.WriteUniOrByteString( maStr
, pData
->meActualCharSet
);
1158 rOStm
.WriteUInt16(mnIndex
);
1159 rOStm
.WriteUInt16(mnLen
);
1160 rOStm
.WriteInt32(nAryLen
);
1162 for (sal_Int32 i
= 0; i
< nAryLen
; ++i
)
1163 rOStm
.WriteInt32( mpDXAry
[ i
] );
1165 write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm
, maStr
); // version 2
1168 void MetaTextArrayAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1172 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1173 TypeSerializer
aSerializer(rIStm
);
1174 aSerializer
.readPoint(maStartPt
);
1175 maStr
= rIStm
.ReadUniOrByteString(pData
->meActualCharSet
);
1176 sal_uInt16
nTmpIndex(0);
1177 rIStm
.ReadUInt16(nTmpIndex
);
1178 mnIndex
= nTmpIndex
;
1179 sal_uInt16
nTmpLen(0);
1180 rIStm
.ReadUInt16(nTmpLen
);
1182 sal_Int32
nAryLen(0);
1183 rIStm
.ReadInt32(nAryLen
);
1185 if (mnLen
> maStr
.getLength() - mnIndex
)
1194 // #i9762#, #106172# Ensure that DX array is at least mnLen entries long
1195 if ( mnLen
>= nAryLen
)
1197 mpDXAry
.reset( new (std::nothrow
)long[ mnLen
] );
1202 for( i
= 0; i
< nAryLen
; i
++ )
1204 rIStm
.ReadInt32( val
);
1207 // #106172# setup remainder
1208 for( ; i
< mnLen
; i
++ )
1221 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1223 maStr
= read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm
);
1225 if ( mnIndex
+ mnLen
> maStr
.getLength() )
1233 MetaStretchTextAction::MetaStretchTextAction() :
1234 MetaAction ( MetaActionType::STRETCHTEXT
),
1240 MetaStretchTextAction::~MetaStretchTextAction()
1243 MetaStretchTextAction::MetaStretchTextAction( const Point
& rPt
, sal_uInt32 nWidth
,
1244 const OUString
& rStr
,
1245 sal_Int32 nIndex
, sal_Int32 nLen
) :
1246 MetaAction ( MetaActionType::STRETCHTEXT
),
1254 void MetaStretchTextAction::Execute( OutputDevice
* pOut
)
1256 pOut
->DrawStretchText( maPt
, mnWidth
, maStr
, mnIndex
, mnLen
);
1259 rtl::Reference
<MetaAction
> MetaStretchTextAction::Clone()
1261 return new MetaStretchTextAction( *this );
1264 void MetaStretchTextAction::Move( long nHorzMove
, long nVertMove
)
1266 maPt
.Move( nHorzMove
, nVertMove
);
1269 void MetaStretchTextAction::Scale( double fScaleX
, double fScaleY
)
1271 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1272 mnWidth
= static_cast<sal_uLong
>(FRound( mnWidth
* fabs(fScaleX
) ));
1275 void MetaStretchTextAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1277 MetaAction::Write(rOStm
, pData
);
1278 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
1279 TypeSerializer
aSerializer(rOStm
);
1280 aSerializer
.writePoint(maPt
);
1281 rOStm
.WriteUniOrByteString( maStr
, pData
->meActualCharSet
);
1282 rOStm
.WriteUInt32( mnWidth
);
1283 rOStm
.WriteUInt16( mnIndex
);
1284 rOStm
.WriteUInt16( mnLen
);
1286 write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm
, maStr
); // version 2
1289 void MetaStretchTextAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1291 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1292 TypeSerializer
aSerializer(rIStm
);
1293 aSerializer
.readPoint(maPt
);
1294 maStr
= rIStm
.ReadUniOrByteString(pData
->meActualCharSet
);
1295 rIStm
.ReadUInt32( mnWidth
);
1296 sal_uInt16
nTmpIndex(0);
1297 rIStm
.ReadUInt16(nTmpIndex
);
1298 mnIndex
= nTmpIndex
;
1299 sal_uInt16
nTmpLen(0);
1300 rIStm
.ReadUInt16(nTmpLen
);
1303 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1304 maStr
= read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm
);
1307 MetaTextRectAction::MetaTextRectAction() :
1308 MetaAction ( MetaActionType::TEXTRECT
),
1309 mnStyle ( DrawTextFlags::NONE
)
1312 MetaTextRectAction::~MetaTextRectAction()
1315 MetaTextRectAction::MetaTextRectAction( const tools::Rectangle
& rRect
,
1316 const OUString
& rStr
, DrawTextFlags nStyle
) :
1317 MetaAction ( MetaActionType::TEXTRECT
),
1323 void MetaTextRectAction::Execute( OutputDevice
* pOut
)
1325 pOut
->DrawText( maRect
, maStr
, mnStyle
);
1328 rtl::Reference
<MetaAction
> MetaTextRectAction::Clone()
1330 return new MetaTextRectAction( *this );
1333 void MetaTextRectAction::Move( long nHorzMove
, long nVertMove
)
1335 maRect
.Move( nHorzMove
, nVertMove
);
1338 void MetaTextRectAction::Scale( double fScaleX
, double fScaleY
)
1340 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
1343 void MetaTextRectAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1345 MetaAction::Write(rOStm
, pData
);
1346 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
1347 TypeSerializer
aSerializer(rOStm
);
1348 aSerializer
.writeRectangle(maRect
);
1349 rOStm
.WriteUniOrByteString( maStr
, pData
->meActualCharSet
);
1350 rOStm
.WriteUInt16( static_cast<sal_uInt16
>(mnStyle
) );
1352 write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm
, maStr
); // version 2
1355 void MetaTextRectAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
1357 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1358 TypeSerializer
aSerializer(rIStm
);
1359 aSerializer
.readRectangle(maRect
);
1360 maStr
= rIStm
.ReadUniOrByteString(pData
->meActualCharSet
);
1362 rIStm
.ReadUInt16( nTmp
);
1363 mnStyle
= static_cast<DrawTextFlags
>(nTmp
);
1365 if ( aCompat
.GetVersion() >= 2 ) // Version 2
1366 maStr
= read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm
);
1369 MetaTextLineAction::MetaTextLineAction() :
1370 MetaAction ( MetaActionType::TEXTLINE
),
1372 meStrikeout ( STRIKEOUT_NONE
),
1373 meUnderline ( LINESTYLE_NONE
),
1374 meOverline ( LINESTYLE_NONE
)
1377 MetaTextLineAction::~MetaTextLineAction()
1380 MetaTextLineAction::MetaTextLineAction( const Point
& rPos
, long nWidth
,
1381 FontStrikeout eStrikeout
,
1382 FontLineStyle eUnderline
,
1383 FontLineStyle eOverline
) :
1384 MetaAction ( MetaActionType::TEXTLINE
),
1387 meStrikeout ( eStrikeout
),
1388 meUnderline ( eUnderline
),
1389 meOverline ( eOverline
)
1392 void MetaTextLineAction::Execute( OutputDevice
* pOut
)
1394 pOut
->DrawTextLine( maPos
, mnWidth
, meStrikeout
, meUnderline
, meOverline
);
1397 rtl::Reference
<MetaAction
> MetaTextLineAction::Clone()
1399 return new MetaTextLineAction( *this );
1402 void MetaTextLineAction::Move( long nHorzMove
, long nVertMove
)
1404 maPos
.Move( nHorzMove
, nVertMove
);
1407 void MetaTextLineAction::Scale( double fScaleX
, double fScaleY
)
1409 ImplScalePoint( maPos
, fScaleX
, fScaleY
);
1410 mnWidth
= FRound( mnWidth
* fabs(fScaleX
) );
1413 void MetaTextLineAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1415 MetaAction::Write(rOStm
, pData
);
1416 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 2);
1418 TypeSerializer
aSerializer(rOStm
);
1419 aSerializer
.writePoint(maPos
);
1421 rOStm
.WriteInt32( mnWidth
);
1422 rOStm
.WriteUInt32( meStrikeout
);
1423 rOStm
.WriteUInt32( meUnderline
);
1425 rOStm
.WriteUInt32( meOverline
);
1428 void MetaTextLineAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1430 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1432 sal_Int32
nTempWidth(0);
1433 TypeSerializer
aSerializer(rIStm
);
1434 aSerializer
.readPoint(maPos
);
1435 rIStm
.ReadInt32(nTempWidth
);
1436 mnWidth
= nTempWidth
;
1438 sal_uInt32
nTempStrikeout(0);
1439 rIStm
.ReadUInt32( nTempStrikeout
);
1440 meStrikeout
= static_cast<FontStrikeout
>(nTempStrikeout
);
1442 sal_uInt32
nTempUnderline(0);
1443 rIStm
.ReadUInt32( nTempUnderline
);
1444 meUnderline
= static_cast<FontLineStyle
>(nTempUnderline
);
1446 if (aCompat
.GetVersion() >= 2)
1448 sal_uInt32
nTempOverline(0);
1449 rIStm
.ReadUInt32(nTempOverline
);
1450 meOverline
= static_cast<FontLineStyle
>(nTempOverline
);
1454 MetaBmpAction::MetaBmpAction() :
1455 MetaAction(MetaActionType::BMP
)
1458 MetaBmpAction::~MetaBmpAction()
1461 MetaBmpAction::MetaBmpAction( const Point
& rPt
, const Bitmap
& rBmp
) :
1462 MetaAction ( MetaActionType::BMP
),
1467 void MetaBmpAction::Execute( OutputDevice
* pOut
)
1469 pOut
->DrawBitmap( maPt
, maBmp
);
1472 rtl::Reference
<MetaAction
> MetaBmpAction::Clone()
1474 return new MetaBmpAction( *this );
1477 void MetaBmpAction::Move( long nHorzMove
, long nVertMove
)
1479 maPt
.Move( nHorzMove
, nVertMove
);
1482 void MetaBmpAction::Scale( double fScaleX
, double fScaleY
)
1484 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1487 void MetaBmpAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1491 MetaAction::Write(rOStm
, pData
);
1492 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1493 WriteDIB(maBmp
, rOStm
, false, true);
1494 TypeSerializer
aSerializer(rOStm
);
1495 aSerializer
.writePoint(maPt
);
1499 void MetaBmpAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1501 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1502 ReadDIB(maBmp
, rIStm
, true);
1503 TypeSerializer
aSerializer(rIStm
);
1504 aSerializer
.readPoint(maPt
);
1507 MetaBmpScaleAction::MetaBmpScaleAction() :
1508 MetaAction(MetaActionType::BMPSCALE
)
1511 MetaBmpScaleAction::~MetaBmpScaleAction()
1514 MetaBmpScaleAction::MetaBmpScaleAction( const Point
& rPt
, const Size
& rSz
,
1515 const Bitmap
& rBmp
) :
1516 MetaAction ( MetaActionType::BMPSCALE
),
1522 void MetaBmpScaleAction::Execute( OutputDevice
* pOut
)
1524 pOut
->DrawBitmap( maPt
, maSz
, maBmp
);
1527 rtl::Reference
<MetaAction
> MetaBmpScaleAction::Clone()
1529 return new MetaBmpScaleAction( *this );
1532 void MetaBmpScaleAction::Move( long nHorzMove
, long nVertMove
)
1534 maPt
.Move( nHorzMove
, nVertMove
);
1537 void MetaBmpScaleAction::Scale( double fScaleX
, double fScaleY
)
1539 tools::Rectangle
aRectangle(maPt
, maSz
);
1540 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1541 maPt
= aRectangle
.TopLeft();
1542 maSz
= aRectangle
.GetSize();
1545 void MetaBmpScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1549 MetaAction::Write(rOStm
, pData
);
1550 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1551 WriteDIB(maBmp
, rOStm
, false, true);
1552 TypeSerializer
aSerializer(rOStm
);
1553 aSerializer
.writePoint(maPt
);
1554 aSerializer
.writeSize(maSz
);
1559 void MetaBmpScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1561 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1562 ReadDIB(maBmp
, rIStm
, true);
1563 TypeSerializer
aSerializer(rIStm
);
1564 aSerializer
.readPoint(maPt
);
1565 aSerializer
.readSize(maSz
);
1568 MetaBmpScalePartAction::MetaBmpScalePartAction() :
1569 MetaAction(MetaActionType::BMPSCALEPART
)
1572 MetaBmpScalePartAction::~MetaBmpScalePartAction()
1575 MetaBmpScalePartAction::MetaBmpScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
1576 const Point
& rSrcPt
, const Size
& rSrcSz
,
1577 const Bitmap
& rBmp
) :
1578 MetaAction ( MetaActionType::BMPSCALEPART
),
1586 void MetaBmpScalePartAction::Execute( OutputDevice
* pOut
)
1588 pOut
->DrawBitmap( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmp
);
1591 rtl::Reference
<MetaAction
> MetaBmpScalePartAction::Clone()
1593 return new MetaBmpScalePartAction( *this );
1596 void MetaBmpScalePartAction::Move( long nHorzMove
, long nVertMove
)
1598 maDstPt
.Move( nHorzMove
, nVertMove
);
1601 void MetaBmpScalePartAction::Scale( double fScaleX
, double fScaleY
)
1603 tools::Rectangle
aRectangle(maDstPt
, maDstSz
);
1604 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1605 maDstPt
= aRectangle
.TopLeft();
1606 maDstSz
= aRectangle
.GetSize();
1609 void MetaBmpScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1613 MetaAction::Write(rOStm
, pData
);
1614 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1615 WriteDIB(maBmp
, rOStm
, false, true);
1616 TypeSerializer
aSerializer(rOStm
);
1617 aSerializer
.writePoint(maDstPt
);
1618 aSerializer
.writeSize(maDstSz
);
1619 aSerializer
.writePoint(maSrcPt
);
1620 aSerializer
.writeSize(maSrcSz
);
1625 void MetaBmpScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1627 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1628 ReadDIB(maBmp
, rIStm
, true);
1629 TypeSerializer
aSerializer(rIStm
);
1630 aSerializer
.readPoint(maDstPt
);
1631 aSerializer
.readSize(maDstSz
);
1632 aSerializer
.readPoint(maSrcPt
);
1633 aSerializer
.readSize(maSrcSz
);
1636 MetaBmpExAction::MetaBmpExAction() :
1637 MetaAction(MetaActionType::BMPEX
)
1640 MetaBmpExAction::~MetaBmpExAction()
1643 MetaBmpExAction::MetaBmpExAction( const Point
& rPt
, const BitmapEx
& rBmpEx
) :
1644 MetaAction ( MetaActionType::BMPEX
),
1649 void MetaBmpExAction::Execute( OutputDevice
* pOut
)
1651 pOut
->DrawBitmapEx( maPt
, maBmpEx
);
1654 rtl::Reference
<MetaAction
> MetaBmpExAction::Clone()
1656 return new MetaBmpExAction( *this );
1659 void MetaBmpExAction::Move( long nHorzMove
, long nVertMove
)
1661 maPt
.Move( nHorzMove
, nVertMove
);
1664 void MetaBmpExAction::Scale( double fScaleX
, double fScaleY
)
1666 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1669 void MetaBmpExAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1671 if( !!maBmpEx
.GetBitmap() )
1673 MetaAction::Write(rOStm
, pData
);
1674 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1675 WriteDIBBitmapEx(maBmpEx
, rOStm
);
1676 TypeSerializer
aSerializer(rOStm
);
1677 aSerializer
.writePoint(maPt
);
1681 void MetaBmpExAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1683 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1684 ReadDIBBitmapEx(maBmpEx
, rIStm
);
1685 TypeSerializer
aSerializer(rIStm
);
1686 aSerializer
.readPoint(maPt
);
1689 MetaBmpExScaleAction::MetaBmpExScaleAction() :
1690 MetaAction(MetaActionType::BMPEXSCALE
)
1693 MetaBmpExScaleAction::~MetaBmpExScaleAction()
1696 MetaBmpExScaleAction::MetaBmpExScaleAction( const Point
& rPt
, const Size
& rSz
,
1697 const BitmapEx
& rBmpEx
) :
1698 MetaAction ( MetaActionType::BMPEXSCALE
),
1704 void MetaBmpExScaleAction::Execute( OutputDevice
* pOut
)
1706 pOut
->DrawBitmapEx( maPt
, maSz
, maBmpEx
);
1709 rtl::Reference
<MetaAction
> MetaBmpExScaleAction::Clone()
1711 return new MetaBmpExScaleAction( *this );
1714 void MetaBmpExScaleAction::Move( long nHorzMove
, long nVertMove
)
1716 maPt
.Move( nHorzMove
, nVertMove
);
1719 void MetaBmpExScaleAction::Scale( double fScaleX
, double fScaleY
)
1721 tools::Rectangle
aRectangle(maPt
, maSz
);
1722 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1723 maPt
= aRectangle
.TopLeft();
1724 maSz
= aRectangle
.GetSize();
1727 void MetaBmpExScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1729 if( !!maBmpEx
.GetBitmap() )
1731 MetaAction::Write(rOStm
, pData
);
1732 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1733 WriteDIBBitmapEx(maBmpEx
, rOStm
);
1734 TypeSerializer
aSerializer(rOStm
);
1735 aSerializer
.writePoint(maPt
);
1736 aSerializer
.writeSize(maSz
);
1740 void MetaBmpExScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1742 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1743 ReadDIBBitmapEx(maBmpEx
, rIStm
);
1744 TypeSerializer
aSerializer(rIStm
);
1745 aSerializer
.readPoint(maPt
);
1746 aSerializer
.readSize(maSz
);
1749 MetaBmpExScalePartAction::MetaBmpExScalePartAction() :
1750 MetaAction(MetaActionType::BMPEXSCALEPART
)
1753 MetaBmpExScalePartAction::~MetaBmpExScalePartAction()
1756 MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
1757 const Point
& rSrcPt
, const Size
& rSrcSz
,
1758 const BitmapEx
& rBmpEx
) :
1759 MetaAction ( MetaActionType::BMPEXSCALEPART
),
1767 void MetaBmpExScalePartAction::Execute( OutputDevice
* pOut
)
1769 pOut
->DrawBitmapEx( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmpEx
);
1772 rtl::Reference
<MetaAction
> MetaBmpExScalePartAction::Clone()
1774 return new MetaBmpExScalePartAction( *this );
1777 void MetaBmpExScalePartAction::Move( long nHorzMove
, long nVertMove
)
1779 maDstPt
.Move( nHorzMove
, nVertMove
);
1782 void MetaBmpExScalePartAction::Scale( double fScaleX
, double fScaleY
)
1784 tools::Rectangle
aRectangle(maDstPt
, maDstSz
);
1785 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1786 maDstPt
= aRectangle
.TopLeft();
1787 maDstSz
= aRectangle
.GetSize();
1790 void MetaBmpExScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1792 if( !!maBmpEx
.GetBitmap() )
1794 MetaAction::Write(rOStm
, pData
);
1795 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1796 WriteDIBBitmapEx(maBmpEx
, rOStm
);
1797 TypeSerializer
aSerializer(rOStm
);
1798 aSerializer
.writePoint(maDstPt
);
1799 aSerializer
.writeSize(maDstSz
);
1800 aSerializer
.writePoint(maSrcPt
);
1801 aSerializer
.writeSize(maSrcSz
);
1805 void MetaBmpExScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1807 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1808 ReadDIBBitmapEx(maBmpEx
, rIStm
);
1809 TypeSerializer
aSerializer(rIStm
);
1810 aSerializer
.readPoint(maDstPt
);
1811 aSerializer
.readSize(maDstSz
);
1812 aSerializer
.readPoint(maSrcPt
);
1813 aSerializer
.readSize(maSrcSz
);
1816 MetaMaskAction::MetaMaskAction() :
1817 MetaAction(MetaActionType::MASK
)
1820 MetaMaskAction::~MetaMaskAction()
1823 MetaMaskAction::MetaMaskAction( const Point
& rPt
,
1825 const Color
& rColor
) :
1826 MetaAction ( MetaActionType::MASK
),
1832 void MetaMaskAction::Execute( OutputDevice
* pOut
)
1834 pOut
->DrawMask( maPt
, maBmp
, maColor
);
1837 rtl::Reference
<MetaAction
> MetaMaskAction::Clone()
1839 return new MetaMaskAction( *this );
1842 void MetaMaskAction::Move( long nHorzMove
, long nVertMove
)
1844 maPt
.Move( nHorzMove
, nVertMove
);
1847 void MetaMaskAction::Scale( double fScaleX
, double fScaleY
)
1849 ImplScalePoint( maPt
, fScaleX
, fScaleY
);
1852 void MetaMaskAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1856 MetaAction::Write(rOStm
, pData
);
1857 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1858 WriteDIB(maBmp
, rOStm
, false, true);
1859 TypeSerializer
aSerializer(rOStm
);
1860 aSerializer
.writePoint(maPt
);
1864 void MetaMaskAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1866 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1867 ReadDIB(maBmp
, rIStm
, true);
1868 TypeSerializer
aSerializer(rIStm
);
1869 aSerializer
.readPoint(maPt
);
1872 MetaMaskScaleAction::MetaMaskScaleAction() :
1873 MetaAction(MetaActionType::MASKSCALE
)
1876 MetaMaskScaleAction::~MetaMaskScaleAction()
1879 MetaMaskScaleAction::MetaMaskScaleAction( const Point
& rPt
, const Size
& rSz
,
1881 const Color
& rColor
) :
1882 MetaAction ( MetaActionType::MASKSCALE
),
1889 void MetaMaskScaleAction::Execute( OutputDevice
* pOut
)
1891 pOut
->DrawMask( maPt
, maSz
, maBmp
, maColor
);
1894 rtl::Reference
<MetaAction
> MetaMaskScaleAction::Clone()
1896 return new MetaMaskScaleAction( *this );
1899 void MetaMaskScaleAction::Move( long nHorzMove
, long nVertMove
)
1901 maPt
.Move( nHorzMove
, nVertMove
);
1904 void MetaMaskScaleAction::Scale( double fScaleX
, double fScaleY
)
1906 tools::Rectangle
aRectangle(maPt
, maSz
);
1907 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1908 maPt
= aRectangle
.TopLeft();
1909 maSz
= aRectangle
.GetSize();
1912 void MetaMaskScaleAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1916 MetaAction::Write(rOStm
, pData
);
1917 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1918 WriteDIB(maBmp
, rOStm
, false, true);
1919 TypeSerializer
aSerializer(rOStm
);
1920 aSerializer
.writePoint(maPt
);
1921 aSerializer
.writeSize(maSz
);
1925 void MetaMaskScaleAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1927 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1928 ReadDIB(maBmp
, rIStm
, true);
1929 TypeSerializer
aSerializer(rIStm
);
1930 aSerializer
.readPoint(maPt
);
1931 aSerializer
.readSize(maSz
);
1934 MetaMaskScalePartAction::MetaMaskScalePartAction() :
1935 MetaAction(MetaActionType::MASKSCALEPART
)
1938 MetaMaskScalePartAction::~MetaMaskScalePartAction()
1941 MetaMaskScalePartAction::MetaMaskScalePartAction( const Point
& rDstPt
, const Size
& rDstSz
,
1942 const Point
& rSrcPt
, const Size
& rSrcSz
,
1944 const Color
& rColor
) :
1945 MetaAction ( MetaActionType::MASKSCALEPART
),
1954 void MetaMaskScalePartAction::Execute( OutputDevice
* pOut
)
1956 pOut
->DrawMask( maDstPt
, maDstSz
, maSrcPt
, maSrcSz
, maBmp
, maColor
, MetaActionType::MASKSCALE
);
1959 rtl::Reference
<MetaAction
> MetaMaskScalePartAction::Clone()
1961 return new MetaMaskScalePartAction( *this );
1964 void MetaMaskScalePartAction::Move( long nHorzMove
, long nVertMove
)
1966 maDstPt
.Move( nHorzMove
, nVertMove
);
1969 void MetaMaskScalePartAction::Scale( double fScaleX
, double fScaleY
)
1971 tools::Rectangle
aRectangle(maDstPt
, maDstSz
);
1972 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
1973 maDstPt
= aRectangle
.TopLeft();
1974 maDstSz
= aRectangle
.GetSize();
1977 void MetaMaskScalePartAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
1981 MetaAction::Write(rOStm
, pData
);
1982 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
1983 WriteDIB(maBmp
, rOStm
, false, true);
1984 rOStm
.WriteUInt32(maColor
.mValue
);
1985 TypeSerializer
aSerializer(rOStm
);
1986 aSerializer
.writePoint(maDstPt
);
1987 aSerializer
.writeSize(maDstSz
);
1988 aSerializer
.writePoint(maSrcPt
);
1989 aSerializer
.writeSize(maSrcSz
);
1993 void MetaMaskScalePartAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
1995 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
1996 ReadDIB(maBmp
, rIStm
, true);
1997 rIStm
.ReadUInt32(maColor
.mValue
);
1998 TypeSerializer
aSerializer(rIStm
);
1999 aSerializer
.readPoint(maDstPt
);
2000 aSerializer
.readSize(maDstSz
);
2001 aSerializer
.readPoint(maSrcPt
);
2002 aSerializer
.readSize(maSrcSz
);
2005 MetaGradientAction::MetaGradientAction() :
2006 MetaAction(MetaActionType::GRADIENT
)
2009 MetaGradientAction::~MetaGradientAction()
2012 MetaGradientAction::MetaGradientAction( const tools::Rectangle
& rRect
, const Gradient
& rGradient
) :
2013 MetaAction ( MetaActionType::GRADIENT
),
2015 maGradient ( rGradient
)
2018 void MetaGradientAction::Execute( OutputDevice
* pOut
)
2020 pOut
->DrawGradient( maRect
, maGradient
);
2023 rtl::Reference
<MetaAction
> MetaGradientAction::Clone()
2025 return new MetaGradientAction( *this );
2028 void MetaGradientAction::Move( long nHorzMove
, long nVertMove
)
2030 maRect
.Move( nHorzMove
, nVertMove
);
2033 void MetaGradientAction::Scale( double fScaleX
, double fScaleY
)
2035 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2038 void MetaGradientAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2040 MetaAction::Write(rOStm
, pData
);
2041 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2042 TypeSerializer
aSerializer(rOStm
);
2043 aSerializer
.writeRectangle(maRect
);
2044 aSerializer
.writeGradient(maGradient
);
2047 void MetaGradientAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2049 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2050 TypeSerializer
aSerializer(rIStm
);
2051 aSerializer
.readRectangle(maRect
);
2052 aSerializer
.readGradient(maGradient
);
2055 MetaGradientExAction::MetaGradientExAction() :
2056 MetaAction ( MetaActionType::GRADIENTEX
)
2059 MetaGradientExAction::MetaGradientExAction( const tools::PolyPolygon
& rPolyPoly
, const Gradient
& rGradient
) :
2060 MetaAction ( MetaActionType::GRADIENTEX
),
2061 maPolyPoly ( rPolyPoly
),
2062 maGradient ( rGradient
)
2065 MetaGradientExAction::~MetaGradientExAction()
2068 void MetaGradientExAction::Execute( OutputDevice
* pOut
)
2070 if( pOut
->GetConnectMetaFile() )
2072 pOut
->GetConnectMetaFile()->AddAction( this );
2076 rtl::Reference
<MetaAction
> MetaGradientExAction::Clone()
2078 return new MetaGradientExAction( *this );
2081 void MetaGradientExAction::Move( long nHorzMove
, long nVertMove
)
2083 maPolyPoly
.Move( nHorzMove
, nVertMove
);
2086 void MetaGradientExAction::Scale( double fScaleX
, double fScaleY
)
2088 for( sal_uInt16 i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
2089 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
2092 void MetaGradientExAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2094 MetaAction::Write(rOStm
, pData
);
2095 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2097 // #i105373# see comment at MetaTransparentAction::Write
2098 tools::PolyPolygon aNoCurvePolyPolygon
;
2099 maPolyPoly
.AdaptiveSubdivide(aNoCurvePolyPolygon
);
2101 WritePolyPolygon( rOStm
, aNoCurvePolyPolygon
);
2102 TypeSerializer
aSerializer(rOStm
);
2103 aSerializer
.writeGradient(maGradient
);
2106 void MetaGradientExAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2108 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2109 ReadPolyPolygon( rIStm
, maPolyPoly
);
2110 TypeSerializer
aSerializer(rIStm
);
2111 aSerializer
.readGradient(maGradient
);
2114 MetaHatchAction::MetaHatchAction() :
2115 MetaAction(MetaActionType::HATCH
)
2118 MetaHatchAction::~MetaHatchAction()
2121 MetaHatchAction::MetaHatchAction( const tools::PolyPolygon
& rPolyPoly
, const Hatch
& rHatch
) :
2122 MetaAction ( MetaActionType::HATCH
),
2123 maPolyPoly ( rPolyPoly
),
2127 void MetaHatchAction::Execute( OutputDevice
* pOut
)
2129 pOut
->DrawHatch( maPolyPoly
, maHatch
);
2132 rtl::Reference
<MetaAction
> MetaHatchAction::Clone()
2134 return new MetaHatchAction( *this );
2137 void MetaHatchAction::Move( long nHorzMove
, long nVertMove
)
2139 maPolyPoly
.Move( nHorzMove
, nVertMove
);
2142 void MetaHatchAction::Scale( double fScaleX
, double fScaleY
)
2144 for( sal_uInt16 i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
2145 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
2148 void MetaHatchAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2150 MetaAction::Write(rOStm
, pData
);
2151 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2153 // #i105373# see comment at MetaTransparentAction::Write
2154 tools::PolyPolygon aNoCurvePolyPolygon
;
2155 maPolyPoly
.AdaptiveSubdivide(aNoCurvePolyPolygon
);
2157 WritePolyPolygon( rOStm
, aNoCurvePolyPolygon
);
2158 WriteHatch( rOStm
, maHatch
);
2161 void MetaHatchAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2163 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2164 ReadPolyPolygon( rIStm
, maPolyPoly
);
2165 ReadHatch( rIStm
, maHatch
);
2168 MetaWallpaperAction::MetaWallpaperAction() :
2169 MetaAction(MetaActionType::WALLPAPER
)
2172 MetaWallpaperAction::~MetaWallpaperAction()
2175 MetaWallpaperAction::MetaWallpaperAction( const tools::Rectangle
& rRect
,
2176 const Wallpaper
& rPaper
) :
2177 MetaAction ( MetaActionType::WALLPAPER
),
2179 maWallpaper ( rPaper
)
2182 void MetaWallpaperAction::Execute( OutputDevice
* pOut
)
2184 pOut
->DrawWallpaper( maRect
, maWallpaper
);
2187 rtl::Reference
<MetaAction
> MetaWallpaperAction::Clone()
2189 return new MetaWallpaperAction( *this );
2192 void MetaWallpaperAction::Move( long nHorzMove
, long nVertMove
)
2194 maRect
.Move( nHorzMove
, nVertMove
);
2197 void MetaWallpaperAction::Scale( double fScaleX
, double fScaleY
)
2199 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2202 void MetaWallpaperAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2204 MetaAction::Write(rOStm
, pData
);
2205 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2207 WriteWallpaper( rOStm
, maWallpaper
);
2210 void MetaWallpaperAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2212 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2213 ReadWallpaper( rIStm
, maWallpaper
);
2216 MetaClipRegionAction::MetaClipRegionAction() :
2217 MetaAction ( MetaActionType::CLIPREGION
),
2221 MetaClipRegionAction::~MetaClipRegionAction()
2224 MetaClipRegionAction::MetaClipRegionAction( const vcl::Region
& rRegion
, bool bClip
) :
2225 MetaAction ( MetaActionType::CLIPREGION
),
2226 maRegion ( rRegion
),
2230 void MetaClipRegionAction::Execute( OutputDevice
* pOut
)
2233 pOut
->SetClipRegion( maRegion
);
2235 pOut
->SetClipRegion();
2238 rtl::Reference
<MetaAction
> MetaClipRegionAction::Clone()
2240 return new MetaClipRegionAction( *this );
2243 void MetaClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2245 maRegion
.Move( nHorzMove
, nVertMove
);
2248 void MetaClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2250 maRegion
.Scale( fScaleX
, fScaleY
);
2253 void MetaClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2255 MetaAction::Write(rOStm
, pData
);
2256 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2258 WriteRegion( rOStm
, maRegion
);
2259 rOStm
.WriteBool( mbClip
);
2262 void MetaClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2264 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2265 ReadRegion( rIStm
, maRegion
);
2266 rIStm
.ReadCharAsBool( mbClip
);
2269 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction() :
2270 MetaAction(MetaActionType::ISECTRECTCLIPREGION
)
2273 MetaISectRectClipRegionAction::~MetaISectRectClipRegionAction()
2276 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const tools::Rectangle
& rRect
) :
2277 MetaAction ( MetaActionType::ISECTRECTCLIPREGION
),
2281 void MetaISectRectClipRegionAction::Execute( OutputDevice
* pOut
)
2283 pOut
->IntersectClipRegion( maRect
);
2286 rtl::Reference
<MetaAction
> MetaISectRectClipRegionAction::Clone()
2288 return new MetaISectRectClipRegionAction( *this );
2291 void MetaISectRectClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2293 maRect
.Move( nHorzMove
, nVertMove
);
2296 void MetaISectRectClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2298 ImplScaleRect( maRect
, fScaleX
, fScaleY
);
2301 void MetaISectRectClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2303 MetaAction::Write(rOStm
, pData
);
2304 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2305 TypeSerializer
aSerializer(rOStm
);
2306 aSerializer
.writeRectangle(maRect
);
2309 void MetaISectRectClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2311 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2312 TypeSerializer
aSerializer(rIStm
);
2313 aSerializer
.readRectangle(maRect
);
2316 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction() :
2317 MetaAction(MetaActionType::ISECTREGIONCLIPREGION
)
2320 MetaISectRegionClipRegionAction::~MetaISectRegionClipRegionAction()
2323 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( const vcl::Region
& rRegion
) :
2324 MetaAction ( MetaActionType::ISECTREGIONCLIPREGION
),
2325 maRegion ( rRegion
)
2329 void MetaISectRegionClipRegionAction::Execute( OutputDevice
* pOut
)
2331 pOut
->IntersectClipRegion( maRegion
);
2334 rtl::Reference
<MetaAction
> MetaISectRegionClipRegionAction::Clone()
2336 return new MetaISectRegionClipRegionAction( *this );
2339 void MetaISectRegionClipRegionAction::Move( long nHorzMove
, long nVertMove
)
2341 maRegion
.Move( nHorzMove
, nVertMove
);
2344 void MetaISectRegionClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2346 maRegion
.Scale( fScaleX
, fScaleY
);
2349 void MetaISectRegionClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2351 MetaAction::Write(rOStm
, pData
);
2352 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2353 WriteRegion( rOStm
, maRegion
);
2356 void MetaISectRegionClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2358 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2359 ReadRegion( rIStm
, maRegion
);
2362 MetaMoveClipRegionAction::MetaMoveClipRegionAction() :
2363 MetaAction ( MetaActionType::MOVECLIPREGION
),
2368 MetaMoveClipRegionAction::~MetaMoveClipRegionAction()
2371 MetaMoveClipRegionAction::MetaMoveClipRegionAction( long nHorzMove
, long nVertMove
) :
2372 MetaAction ( MetaActionType::MOVECLIPREGION
),
2373 mnHorzMove ( nHorzMove
),
2374 mnVertMove ( nVertMove
)
2377 void MetaMoveClipRegionAction::Execute( OutputDevice
* pOut
)
2379 pOut
->MoveClipRegion( mnHorzMove
, mnVertMove
);
2382 rtl::Reference
<MetaAction
> MetaMoveClipRegionAction::Clone()
2384 return new MetaMoveClipRegionAction( *this );
2387 void MetaMoveClipRegionAction::Scale( double fScaleX
, double fScaleY
)
2389 mnHorzMove
= FRound( mnHorzMove
* fScaleX
);
2390 mnVertMove
= FRound( mnVertMove
* fScaleY
);
2393 void MetaMoveClipRegionAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2395 MetaAction::Write(rOStm
, pData
);
2396 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2397 rOStm
.WriteInt32( mnHorzMove
).WriteInt32( mnVertMove
);
2400 void MetaMoveClipRegionAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2402 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2403 sal_Int32
nTmpHM(0), nTmpVM(0);
2404 rIStm
.ReadInt32( nTmpHM
).ReadInt32( nTmpVM
);
2405 mnHorzMove
= nTmpHM
;
2406 mnVertMove
= nTmpVM
;
2409 MetaLineColorAction::MetaLineColorAction() :
2410 MetaAction ( MetaActionType::LINECOLOR
),
2414 MetaLineColorAction::~MetaLineColorAction()
2417 MetaLineColorAction::MetaLineColorAction( const Color
& rColor
, bool bSet
) :
2418 MetaAction ( MetaActionType::LINECOLOR
),
2423 void MetaLineColorAction::Execute( OutputDevice
* pOut
)
2426 pOut
->SetLineColor( maColor
);
2428 pOut
->SetLineColor();
2431 rtl::Reference
<MetaAction
> MetaLineColorAction::Clone()
2433 return new MetaLineColorAction( *this );
2436 void MetaLineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2438 MetaAction::Write(rOStm
, pData
);
2439 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2440 rOStm
.WriteUInt32(maColor
.mValue
);
2441 rOStm
.WriteBool( mbSet
);
2444 void MetaLineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2446 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2447 rIStm
.ReadUInt32(maColor
.mValue
);
2448 rIStm
.ReadCharAsBool( mbSet
);
2451 MetaFillColorAction::MetaFillColorAction() :
2452 MetaAction ( MetaActionType::FILLCOLOR
),
2456 MetaFillColorAction::~MetaFillColorAction()
2459 MetaFillColorAction::MetaFillColorAction( const Color
& rColor
, bool bSet
) :
2460 MetaAction ( MetaActionType::FILLCOLOR
),
2465 void MetaFillColorAction::Execute( OutputDevice
* pOut
)
2468 pOut
->SetFillColor( maColor
);
2470 pOut
->SetFillColor();
2473 rtl::Reference
<MetaAction
> MetaFillColorAction::Clone()
2475 return new MetaFillColorAction( *this );
2478 void MetaFillColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2480 MetaAction::Write(rOStm
, pData
);
2481 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2482 rOStm
.WriteUInt32(maColor
.mValue
);
2483 rOStm
.WriteBool( mbSet
);
2486 void MetaFillColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2488 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2489 rIStm
.ReadUInt32(maColor
.mValue
);
2490 rIStm
.ReadCharAsBool( mbSet
);
2493 MetaTextColorAction::MetaTextColorAction() :
2494 MetaAction(MetaActionType::TEXTCOLOR
)
2497 MetaTextColorAction::~MetaTextColorAction()
2500 MetaTextColorAction::MetaTextColorAction( const Color
& rColor
) :
2501 MetaAction ( MetaActionType::TEXTCOLOR
),
2505 void MetaTextColorAction::Execute( OutputDevice
* pOut
)
2507 pOut
->SetTextColor( maColor
);
2510 rtl::Reference
<MetaAction
> MetaTextColorAction::Clone()
2512 return new MetaTextColorAction( *this );
2515 void MetaTextColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2517 MetaAction::Write(rOStm
, pData
);
2518 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2519 rOStm
.WriteUInt32(maColor
.mValue
);
2522 void MetaTextColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2524 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2525 rIStm
.ReadUInt32(maColor
.mValue
);
2528 MetaTextFillColorAction::MetaTextFillColorAction() :
2529 MetaAction ( MetaActionType::TEXTFILLCOLOR
),
2533 MetaTextFillColorAction::~MetaTextFillColorAction()
2536 MetaTextFillColorAction::MetaTextFillColorAction( const Color
& rColor
, bool bSet
) :
2537 MetaAction ( MetaActionType::TEXTFILLCOLOR
),
2542 void MetaTextFillColorAction::Execute( OutputDevice
* pOut
)
2545 pOut
->SetTextFillColor( maColor
);
2547 pOut
->SetTextFillColor();
2550 rtl::Reference
<MetaAction
> MetaTextFillColorAction::Clone()
2552 return new MetaTextFillColorAction( *this );
2555 void MetaTextFillColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2557 MetaAction::Write(rOStm
, pData
);
2558 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2559 rOStm
.WriteUInt32(maColor
.mValue
);
2560 rOStm
.WriteBool( mbSet
);
2563 void MetaTextFillColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2565 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2566 rIStm
.ReadUInt32(maColor
.mValue
);
2567 rIStm
.ReadCharAsBool( mbSet
);
2570 MetaTextLineColorAction::MetaTextLineColorAction() :
2571 MetaAction ( MetaActionType::TEXTLINECOLOR
),
2575 MetaTextLineColorAction::~MetaTextLineColorAction()
2578 MetaTextLineColorAction::MetaTextLineColorAction( const Color
& rColor
, bool bSet
) :
2579 MetaAction ( MetaActionType::TEXTLINECOLOR
),
2584 void MetaTextLineColorAction::Execute( OutputDevice
* pOut
)
2587 pOut
->SetTextLineColor( maColor
);
2589 pOut
->SetTextLineColor();
2592 rtl::Reference
<MetaAction
> MetaTextLineColorAction::Clone()
2594 return new MetaTextLineColorAction( *this );
2597 void MetaTextLineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2599 MetaAction::Write(rOStm
, pData
);
2600 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2601 rOStm
.WriteUInt32(maColor
.mValue
);
2602 rOStm
.WriteBool( mbSet
);
2605 void MetaTextLineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2607 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2608 rIStm
.ReadUInt32(maColor
.mValue
);
2609 rIStm
.ReadCharAsBool( mbSet
);
2612 MetaOverlineColorAction::MetaOverlineColorAction() :
2613 MetaAction ( MetaActionType::OVERLINECOLOR
),
2617 MetaOverlineColorAction::~MetaOverlineColorAction()
2620 MetaOverlineColorAction::MetaOverlineColorAction( const Color
& rColor
, bool bSet
) :
2621 MetaAction ( MetaActionType::OVERLINECOLOR
),
2626 void MetaOverlineColorAction::Execute( OutputDevice
* pOut
)
2629 pOut
->SetOverlineColor( maColor
);
2631 pOut
->SetOverlineColor();
2634 rtl::Reference
<MetaAction
> MetaOverlineColorAction::Clone()
2636 return new MetaOverlineColorAction( *this );
2639 void MetaOverlineColorAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2641 MetaAction::Write(rOStm
, pData
);
2642 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2643 rOStm
.WriteUInt32(maColor
.mValue
);
2644 rOStm
.WriteBool( mbSet
);
2647 void MetaOverlineColorAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2649 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2650 rIStm
.ReadUInt32(maColor
.mValue
);
2651 rIStm
.ReadCharAsBool( mbSet
);
2654 MetaTextAlignAction::MetaTextAlignAction() :
2655 MetaAction ( MetaActionType::TEXTALIGN
),
2656 maAlign ( ALIGN_TOP
)
2659 MetaTextAlignAction::~MetaTextAlignAction()
2662 MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign
) :
2663 MetaAction ( MetaActionType::TEXTALIGN
),
2667 void MetaTextAlignAction::Execute( OutputDevice
* pOut
)
2669 pOut
->SetTextAlign( maAlign
);
2672 rtl::Reference
<MetaAction
> MetaTextAlignAction::Clone()
2674 return new MetaTextAlignAction( *this );
2677 void MetaTextAlignAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2679 MetaAction::Write(rOStm
, pData
);
2680 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2681 rOStm
.WriteUInt16( maAlign
);
2684 void MetaTextAlignAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2686 sal_uInt16
nTmp16(0);
2688 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2689 rIStm
.ReadUInt16( nTmp16
); maAlign
= static_cast<TextAlign
>(nTmp16
);
2692 MetaMapModeAction::MetaMapModeAction() :
2693 MetaAction(MetaActionType::MAPMODE
)
2696 MetaMapModeAction::~MetaMapModeAction()
2699 MetaMapModeAction::MetaMapModeAction( const MapMode
& rMapMode
) :
2700 MetaAction ( MetaActionType::MAPMODE
),
2701 maMapMode ( rMapMode
)
2704 void MetaMapModeAction::Execute( OutputDevice
* pOut
)
2706 pOut
->SetMapMode( maMapMode
);
2709 rtl::Reference
<MetaAction
> MetaMapModeAction::Clone()
2711 return new MetaMapModeAction( *this );
2714 void MetaMapModeAction::Scale( double fScaleX
, double fScaleY
)
2716 Point
aPoint( maMapMode
.GetOrigin() );
2718 ImplScalePoint( aPoint
, fScaleX
, fScaleY
);
2719 maMapMode
.SetOrigin( aPoint
);
2722 void MetaMapModeAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2724 MetaAction::Write(rOStm
, pData
);
2725 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2726 WriteMapMode( rOStm
, maMapMode
);
2729 void MetaMapModeAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2731 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2732 ReadMapMode( rIStm
, maMapMode
);
2735 MetaFontAction::MetaFontAction() :
2736 MetaAction(MetaActionType::FONT
)
2739 MetaFontAction::~MetaFontAction()
2742 MetaFontAction::MetaFontAction( const vcl::Font
& rFont
) :
2743 MetaAction ( MetaActionType::FONT
),
2746 // #96876: because RTL_TEXTENCODING_SYMBOL is often set at the StarSymbol font,
2747 // we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems
2748 // to be the right way; changing the textencoding at other sources
2749 // is too dangerous at the moment
2750 if ( IsStarSymbol( maFont
.GetFamilyName() )
2751 && ( maFont
.GetCharSet() != RTL_TEXTENCODING_UNICODE
) )
2753 maFont
.SetCharSet( RTL_TEXTENCODING_UNICODE
);
2757 void MetaFontAction::Execute( OutputDevice
* pOut
)
2759 pOut
->SetFont( maFont
);
2762 rtl::Reference
<MetaAction
> MetaFontAction::Clone()
2764 return new MetaFontAction( *this );
2767 void MetaFontAction::Scale( double fScaleX
, double fScaleY
)
2770 FRound(maFont
.GetFontSize().Width() * fabs(fScaleX
)),
2771 FRound(maFont
.GetFontSize().Height() * fabs(fScaleY
)));
2772 maFont
.SetFontSize( aSize
);
2775 void MetaFontAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2777 MetaAction::Write(rOStm
, pData
);
2778 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2779 WriteFont( rOStm
, maFont
);
2780 pData
->meActualCharSet
= maFont
.GetCharSet();
2781 if ( pData
->meActualCharSet
== RTL_TEXTENCODING_DONTKNOW
)
2782 pData
->meActualCharSet
= osl_getThreadTextEncoding();
2785 void MetaFontAction::Read( SvStream
& rIStm
, ImplMetaReadData
* pData
)
2787 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2788 ReadFont( rIStm
, maFont
);
2789 pData
->meActualCharSet
= maFont
.GetCharSet();
2790 if ( pData
->meActualCharSet
== RTL_TEXTENCODING_DONTKNOW
)
2791 pData
->meActualCharSet
= osl_getThreadTextEncoding();
2794 MetaPushAction::MetaPushAction() :
2795 MetaAction ( MetaActionType::PUSH
),
2796 mnFlags ( PushFlags::NONE
)
2799 MetaPushAction::~MetaPushAction()
2802 MetaPushAction::MetaPushAction( PushFlags nFlags
) :
2803 MetaAction ( MetaActionType::PUSH
),
2807 void MetaPushAction::Execute( OutputDevice
* pOut
)
2809 pOut
->Push( mnFlags
);
2812 rtl::Reference
<MetaAction
> MetaPushAction::Clone()
2814 return new MetaPushAction( *this );
2817 void MetaPushAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2819 MetaAction::Write(rOStm
, pData
);
2820 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2821 rOStm
.WriteUInt16( static_cast<sal_uInt16
>(mnFlags
) );
2824 void MetaPushAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2826 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2828 rIStm
.ReadUInt16( tmp
);
2829 mnFlags
= static_cast<PushFlags
>(tmp
);
2832 MetaPopAction::MetaPopAction() :
2833 MetaAction(MetaActionType::POP
)
2836 MetaPopAction::~MetaPopAction()
2839 void MetaPopAction::Execute( OutputDevice
* pOut
)
2844 rtl::Reference
<MetaAction
> MetaPopAction::Clone()
2846 return new MetaPopAction( *this );
2849 void MetaPopAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2851 MetaAction::Write(rOStm
, pData
);
2852 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2855 void MetaPopAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2857 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2860 MetaRasterOpAction::MetaRasterOpAction() :
2861 MetaAction ( MetaActionType::RASTEROP
),
2862 meRasterOp ( RasterOp::OverPaint
)
2865 MetaRasterOpAction::~MetaRasterOpAction()
2868 MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp
) :
2869 MetaAction ( MetaActionType::RASTEROP
),
2870 meRasterOp ( eRasterOp
)
2874 void MetaRasterOpAction::Execute( OutputDevice
* pOut
)
2876 pOut
->SetRasterOp( meRasterOp
);
2879 rtl::Reference
<MetaAction
> MetaRasterOpAction::Clone()
2881 return new MetaRasterOpAction( *this );
2884 void MetaRasterOpAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2886 MetaAction::Write(rOStm
, pData
);
2887 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2888 rOStm
.WriteUInt16( static_cast<sal_uInt16
>(meRasterOp
) );
2891 void MetaRasterOpAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2893 sal_uInt16
nTmp16(0);
2895 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2896 rIStm
.ReadUInt16( nTmp16
); meRasterOp
= static_cast<RasterOp
>(nTmp16
);
2899 MetaTransparentAction::MetaTransparentAction() :
2900 MetaAction ( MetaActionType::Transparent
),
2901 mnTransPercent ( 0 )
2904 MetaTransparentAction::~MetaTransparentAction()
2907 MetaTransparentAction::MetaTransparentAction( const tools::PolyPolygon
& rPolyPoly
, sal_uInt16 nTransPercent
) :
2908 MetaAction ( MetaActionType::Transparent
),
2909 maPolyPoly ( rPolyPoly
),
2910 mnTransPercent ( nTransPercent
)
2913 void MetaTransparentAction::Execute( OutputDevice
* pOut
)
2915 pOut
->DrawTransparent( maPolyPoly
, mnTransPercent
);
2918 rtl::Reference
<MetaAction
> MetaTransparentAction::Clone()
2920 return new MetaTransparentAction( *this );
2923 void MetaTransparentAction::Move( long nHorzMove
, long nVertMove
)
2925 maPolyPoly
.Move( nHorzMove
, nVertMove
);
2928 void MetaTransparentAction::Scale( double fScaleX
, double fScaleY
)
2930 for( sal_uInt16 i
= 0, nCount
= maPolyPoly
.Count(); i
< nCount
; i
++ )
2931 ImplScalePoly( maPolyPoly
[ i
], fScaleX
, fScaleY
);
2934 void MetaTransparentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
2936 MetaAction::Write(rOStm
, pData
);
2937 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
2939 // #i105373# The tools::PolyPolygon in this action may be a curve; this
2940 // was ignored until now what is an error. To make older office
2941 // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
2942 // to the PolyPolygon.
2943 // The alternative would be to really write the curve information
2944 // like in MetaPolyPolygonAction::Write (where someone extended it
2945 // correctly, but not here :-( ).
2946 // The golden solution would be to combine both, but i think it's
2947 // not necessary; a good subdivision will be sufficient.
2948 tools::PolyPolygon aNoCurvePolyPolygon
;
2949 maPolyPoly
.AdaptiveSubdivide(aNoCurvePolyPolygon
);
2951 WritePolyPolygon( rOStm
, aNoCurvePolyPolygon
);
2952 rOStm
.WriteUInt16( mnTransPercent
);
2955 void MetaTransparentAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
2957 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
2958 ReadPolyPolygon( rIStm
, maPolyPoly
);
2959 rIStm
.ReadUInt16( mnTransPercent
);
2962 MetaFloatTransparentAction::MetaFloatTransparentAction() :
2963 MetaAction(MetaActionType::FLOATTRANSPARENT
)
2966 MetaFloatTransparentAction::~MetaFloatTransparentAction()
2969 MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile
& rMtf
, const Point
& rPos
,
2970 const Size
& rSize
, const Gradient
& rGradient
) :
2971 MetaAction ( MetaActionType::FLOATTRANSPARENT
),
2975 maGradient ( rGradient
)
2978 void MetaFloatTransparentAction::Execute( OutputDevice
* pOut
)
2980 pOut
->DrawTransparent( maMtf
, maPoint
, maSize
, maGradient
);
2983 rtl::Reference
<MetaAction
> MetaFloatTransparentAction::Clone()
2985 return new MetaFloatTransparentAction( *this );
2988 void MetaFloatTransparentAction::Move( long nHorzMove
, long nVertMove
)
2990 maPoint
.Move( nHorzMove
, nVertMove
);
2993 void MetaFloatTransparentAction::Scale( double fScaleX
, double fScaleY
)
2995 tools::Rectangle
aRectangle(maPoint
, maSize
);
2996 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
2997 maPoint
= aRectangle
.TopLeft();
2998 maSize
= aRectangle
.GetSize();
3001 void MetaFloatTransparentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3003 MetaAction::Write(rOStm
, pData
);
3004 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3006 maMtf
.Write( rOStm
);
3007 TypeSerializer
aSerializer(rOStm
);
3008 aSerializer
.writePoint(maPoint
);
3009 aSerializer
.writeSize(maSize
);
3010 aSerializer
.writeGradient(maGradient
);
3013 void MetaFloatTransparentAction::Read(SvStream
& rIStm
, ImplMetaReadData
* pData
)
3015 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3016 ReadGDIMetaFile(rIStm
, maMtf
, pData
);
3017 TypeSerializer
aSerializer(rIStm
);
3018 aSerializer
.readPoint(maPoint
);
3019 aSerializer
.readSize(maSize
);
3020 aSerializer
.readGradient(maGradient
);
3023 MetaEPSAction::MetaEPSAction() :
3024 MetaAction(MetaActionType::EPS
)
3027 MetaEPSAction::~MetaEPSAction()
3030 MetaEPSAction::MetaEPSAction( const Point
& rPoint
, const Size
& rSize
,
3031 const GfxLink
& rGfxLink
, const GDIMetaFile
& rSubst
) :
3032 MetaAction ( MetaActionType::EPS
),
3033 maGfxLink ( rGfxLink
),
3039 void MetaEPSAction::Execute( OutputDevice
* pOut
)
3041 pOut
->DrawEPS( maPoint
, maSize
, maGfxLink
, &maSubst
);
3044 rtl::Reference
<MetaAction
> MetaEPSAction::Clone()
3046 return new MetaEPSAction( *this );
3049 void MetaEPSAction::Move( long nHorzMove
, long nVertMove
)
3051 maPoint
.Move( nHorzMove
, nVertMove
);
3054 void MetaEPSAction::Scale( double fScaleX
, double fScaleY
)
3056 tools::Rectangle
aRectangle(maPoint
, maSize
);
3057 ImplScaleRect( aRectangle
, fScaleX
, fScaleY
);
3058 maPoint
= aRectangle
.TopLeft();
3059 maSize
= aRectangle
.GetSize();
3062 void MetaEPSAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3064 MetaAction::Write(rOStm
, pData
);
3065 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3067 WriteGfxLink( rOStm
, maGfxLink
);
3068 TypeSerializer
aSerializer(rOStm
);
3069 aSerializer
.writePoint(maPoint
);
3070 aSerializer
.writeSize(maSize
);
3071 maSubst
.Write( rOStm
);
3074 void MetaEPSAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3076 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3077 ReadGfxLink( rIStm
, maGfxLink
);
3078 TypeSerializer
aSerializer(rIStm
);
3079 aSerializer
.readPoint(maPoint
);
3080 aSerializer
.readSize(maSize
);
3081 ReadGDIMetaFile( rIStm
, maSubst
);
3084 MetaRefPointAction::MetaRefPointAction() :
3085 MetaAction ( MetaActionType::REFPOINT
),
3089 MetaRefPointAction::~MetaRefPointAction()
3092 MetaRefPointAction::MetaRefPointAction( const Point
& rRefPoint
, bool bSet
) :
3093 MetaAction ( MetaActionType::REFPOINT
),
3094 maRefPoint ( rRefPoint
),
3098 void MetaRefPointAction::Execute( OutputDevice
* pOut
)
3101 pOut
->SetRefPoint( maRefPoint
);
3103 pOut
->SetRefPoint();
3106 rtl::Reference
<MetaAction
> MetaRefPointAction::Clone()
3108 return new MetaRefPointAction( *this );
3111 void MetaRefPointAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3113 MetaAction::Write(rOStm
, pData
);
3114 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3116 TypeSerializer
aSerializer(rOStm
);
3117 aSerializer
.writePoint(maRefPoint
);
3118 rOStm
.WriteBool( mbSet
);
3121 void MetaRefPointAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3123 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3124 TypeSerializer
aSerializer(rIStm
);
3125 aSerializer
.readPoint(maRefPoint
);
3126 rIStm
.ReadCharAsBool( mbSet
);
3129 MetaCommentAction::MetaCommentAction() :
3130 MetaAction ( MetaActionType::COMMENT
),
3133 ImplInitDynamicData( nullptr, 0UL );
3136 MetaCommentAction::MetaCommentAction( const MetaCommentAction
& rAct
) :
3137 MetaAction ( MetaActionType::COMMENT
),
3138 maComment ( rAct
.maComment
),
3139 mnValue ( rAct
.mnValue
)
3141 ImplInitDynamicData( rAct
.mpData
.get(), rAct
.mnDataSize
);
3144 MetaCommentAction::MetaCommentAction( const OString
& rComment
, sal_Int32 nValue
, const sal_uInt8
* pData
, sal_uInt32 nDataSize
) :
3145 MetaAction ( MetaActionType::COMMENT
),
3146 maComment ( rComment
),
3149 ImplInitDynamicData( pData
, nDataSize
);
3152 MetaCommentAction::~MetaCommentAction()
3156 void MetaCommentAction::ImplInitDynamicData( const sal_uInt8
* pData
, sal_uInt32 nDataSize
)
3158 if ( nDataSize
&& pData
)
3160 mnDataSize
= nDataSize
;
3161 mpData
.reset( new sal_uInt8
[ mnDataSize
] );
3162 memcpy( mpData
.get(), pData
, mnDataSize
);
3171 void MetaCommentAction::Execute( OutputDevice
* pOut
)
3173 if ( pOut
->GetConnectMetaFile() )
3175 pOut
->GetConnectMetaFile()->AddAction( this );
3179 rtl::Reference
<MetaAction
> MetaCommentAction::Clone()
3181 return new MetaCommentAction( *this );
3184 void MetaCommentAction::Move( long nXMove
, long nYMove
)
3186 if ( nXMove
|| nYMove
)
3188 if ( mnDataSize
&& mpData
)
3190 bool bPathStroke
= (maComment
== "XPATHSTROKE_SEQ_BEGIN");
3191 if ( bPathStroke
|| maComment
== "XPATHFILL_SEQ_BEGIN" )
3193 SvMemoryStream
aMemStm( static_cast<void*>(mpData
.get()), mnDataSize
, StreamMode::READ
);
3194 SvMemoryStream aDest
;
3197 SvtGraphicStroke aStroke
;
3198 ReadSvtGraphicStroke( aMemStm
, aStroke
);
3200 tools::Polygon aPath
;
3201 aStroke
.getPath( aPath
);
3202 aPath
.Move( nXMove
, nYMove
);
3203 aStroke
.setPath( aPath
);
3205 tools::PolyPolygon aStartArrow
;
3206 aStroke
.getStartArrow(aStartArrow
);
3207 aStartArrow
.Move(nXMove
, nYMove
);
3208 aStroke
.setStartArrow(aStartArrow
);
3210 tools::PolyPolygon aEndArrow
;
3211 aStroke
.getEndArrow(aEndArrow
);
3212 aEndArrow
.Move(nXMove
, nYMove
);
3213 aStroke
.setEndArrow(aEndArrow
);
3215 WriteSvtGraphicStroke( aDest
, aStroke
);
3219 SvtGraphicFill aFill
;
3220 ReadSvtGraphicFill( aMemStm
, aFill
);
3222 tools::PolyPolygon aPath
;
3223 aFill
.getPath( aPath
);
3224 aPath
.Move( nXMove
, nYMove
);
3225 aFill
.setPath( aPath
);
3227 WriteSvtGraphicFill( aDest
, aFill
);
3230 ImplInitDynamicData( static_cast<const sal_uInt8
*>( aDest
.GetData() ), aDest
.Tell() );
3236 // SJ: 25.07.06 #i56656# we are not able to mirror certain kind of
3237 // comments properly, especially the XPATHSTROKE and XPATHFILL lead to
3238 // problems, so it is better to remove these comments when mirroring
3239 // FIXME: fake comment to apply the next hunk in the right location
3240 void MetaCommentAction::Scale( double fXScale
, double fYScale
)
3242 if ( ( fXScale
!= 1.0 ) || ( fYScale
!= 1.0 ) )
3244 if ( mnDataSize
&& mpData
)
3246 bool bPathStroke
= (maComment
== "XPATHSTROKE_SEQ_BEGIN");
3247 if ( bPathStroke
|| maComment
== "XPATHFILL_SEQ_BEGIN" )
3249 SvMemoryStream
aMemStm( static_cast<void*>(mpData
.get()), mnDataSize
, StreamMode::READ
);
3250 SvMemoryStream aDest
;
3253 SvtGraphicStroke aStroke
;
3254 ReadSvtGraphicStroke( aMemStm
, aStroke
);
3255 aStroke
.scale( fXScale
, fYScale
);
3256 WriteSvtGraphicStroke( aDest
, aStroke
);
3260 SvtGraphicFill aFill
;
3261 ReadSvtGraphicFill( aMemStm
, aFill
);
3262 tools::PolyPolygon aPath
;
3263 aFill
.getPath( aPath
);
3264 aPath
.Scale( fXScale
, fYScale
);
3265 aFill
.setPath( aPath
);
3266 WriteSvtGraphicFill( aDest
, aFill
);
3269 ImplInitDynamicData( static_cast<const sal_uInt8
*>( aDest
.GetData() ), aDest
.Tell() );
3270 } else if( maComment
== "EMF_PLUS_HEADER_INFO" ){
3271 SvMemoryStream
aMemStm( static_cast<void*>(mpData
.get()), mnDataSize
, StreamMode::READ
);
3272 SvMemoryStream aDest
;
3274 sal_Int32
nLeft(0), nRight(0), nTop(0), nBottom(0);
3275 sal_Int32
nPixX(0), nPixY(0), nMillX(0), nMillY(0);
3276 float m11(0), m12(0), m21(0), m22(0), mdx(0), mdy(0);
3279 aMemStm
.ReadInt32( nLeft
).ReadInt32( nTop
).ReadInt32( nRight
).ReadInt32( nBottom
);
3280 aMemStm
.ReadInt32( nPixX
).ReadInt32( nPixY
).ReadInt32( nMillX
).ReadInt32( nMillY
);
3281 aMemStm
.ReadFloat( m11
).ReadFloat( m12
).ReadFloat( m21
).ReadFloat( m22
).ReadFloat( mdx
).ReadFloat( mdy
);
3283 // add scale to the transformation
3290 aDest
.WriteInt32( nLeft
).WriteInt32( nTop
).WriteInt32( nRight
).WriteInt32( nBottom
);
3291 aDest
.WriteInt32( nPixX
).WriteInt32( nPixY
).WriteInt32( nMillX
).WriteInt32( nMillY
);
3292 aDest
.WriteFloat( m11
).WriteFloat( m12
).WriteFloat( m21
).WriteFloat( m22
).WriteFloat( mdx
).WriteFloat( mdy
);
3295 ImplInitDynamicData( static_cast<const sal_uInt8
*>( aDest
.GetData() ), aDest
.Tell() );
3301 void MetaCommentAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3303 MetaAction::Write(rOStm
, pData
);
3304 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3305 write_uInt16_lenPrefixed_uInt8s_FromOString(rOStm
, maComment
);
3306 rOStm
.WriteInt32( mnValue
).WriteUInt32( mnDataSize
);
3309 rOStm
.WriteBytes( mpData
.get(), mnDataSize
);
3312 void MetaCommentAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3314 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3315 maComment
= read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm
);
3316 rIStm
.ReadInt32( mnValue
).ReadUInt32( mnDataSize
);
3318 if (mnDataSize
> rIStm
.remainingSize())
3320 SAL_WARN("vcl.gdi", "Parsing error: " << rIStm
.remainingSize() <<
3321 " available data, but " << mnDataSize
<< " claimed, truncating");
3322 mnDataSize
= rIStm
.remainingSize();
3325 SAL_INFO("vcl.gdi", "MetaCommentAction::Read " << maComment
);
3331 mpData
.reset(new sal_uInt8
[ mnDataSize
]);
3332 rIStm
.ReadBytes(mpData
.get(), mnDataSize
);
3336 MetaLayoutModeAction::MetaLayoutModeAction() :
3337 MetaAction ( MetaActionType::LAYOUTMODE
),
3338 mnLayoutMode( ComplexTextLayoutFlags::Default
)
3341 MetaLayoutModeAction::~MetaLayoutModeAction()
3344 MetaLayoutModeAction::MetaLayoutModeAction( ComplexTextLayoutFlags nLayoutMode
) :
3345 MetaAction ( MetaActionType::LAYOUTMODE
),
3346 mnLayoutMode( nLayoutMode
)
3349 void MetaLayoutModeAction::Execute( OutputDevice
* pOut
)
3351 pOut
->SetLayoutMode( mnLayoutMode
);
3354 rtl::Reference
<MetaAction
> MetaLayoutModeAction::Clone()
3356 return new MetaLayoutModeAction( *this );
3359 void MetaLayoutModeAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3361 MetaAction::Write(rOStm
, pData
);
3362 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3363 rOStm
.WriteUInt32( static_cast<sal_uInt32
>(mnLayoutMode
) );
3366 void MetaLayoutModeAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3368 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3370 rIStm
.ReadUInt32( tmp
);
3371 mnLayoutMode
= static_cast<ComplexTextLayoutFlags
>(tmp
);
3374 MetaTextLanguageAction::MetaTextLanguageAction() :
3375 MetaAction ( MetaActionType::TEXTLANGUAGE
),
3376 meTextLanguage( LANGUAGE_DONTKNOW
)
3379 MetaTextLanguageAction::~MetaTextLanguageAction()
3382 MetaTextLanguageAction::MetaTextLanguageAction( LanguageType eTextLanguage
) :
3383 MetaAction ( MetaActionType::TEXTLANGUAGE
),
3384 meTextLanguage( eTextLanguage
)
3387 void MetaTextLanguageAction::Execute( OutputDevice
* pOut
)
3389 pOut
->SetDigitLanguage( meTextLanguage
);
3392 rtl::Reference
<MetaAction
> MetaTextLanguageAction::Clone()
3394 return new MetaTextLanguageAction( *this );
3397 void MetaTextLanguageAction::Write( SvStream
& rOStm
, ImplMetaWriteData
* pData
)
3399 MetaAction::Write(rOStm
, pData
);
3400 VersionCompat
aCompat(rOStm
, StreamMode::WRITE
, 1);
3401 rOStm
.WriteUInt16( static_cast<sal_uInt16
>(meTextLanguage
) );
3404 void MetaTextLanguageAction::Read( SvStream
& rIStm
, ImplMetaReadData
* )
3406 VersionCompat
aCompat(rIStm
, StreamMode::READ
);
3407 sal_uInt16 nTmp
= 0;
3408 rIStm
.ReadUInt16( nTmp
);
3409 meTextLanguage
= static_cast<LanguageType
>(nTmp
);
3412 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */