Fix GNU C++ version check
[LibreOffice.git] / vcl / source / gdi / metaact.cxx
blobb5f1eac4776184b778286ab2547dcecb34b5e099
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <stdio.h>
21 #include <string.h>
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 <utility>
28 #include <vcl/dibtools.hxx>
29 #include <vcl/filter/SvmReader.hxx>
30 #include <vcl/filter/SvmWriter.hxx>
31 #include <vcl/outdev.hxx>
32 #include <vcl/metaact.hxx>
33 #include <vcl/graphictools.hxx>
34 #include <comphelper/configuration.hxx>
35 #include <unotools/fontdefs.hxx>
36 #include <vcl/TypeSerializer.hxx>
38 namespace
41 void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
43 rPt.setX(basegfx::fround<tools::Long>(fScaleX * rPt.X()));
44 rPt.setY(basegfx::fround<tools::Long>(fScaleY * rPt.Y()));
47 void ImplScaleRect( tools::Rectangle& rRect, double fScaleX, double fScaleY )
49 Point aTL( rRect.TopLeft() );
50 Point aBR( rRect.BottomRight() );
52 ImplScalePoint( aTL, fScaleX, fScaleY );
53 ImplScalePoint( aBR, fScaleX, fScaleY );
55 rRect = tools::Rectangle( aTL, aBR );
56 rRect.Normalize();
59 void ImplScalePoly( tools::Polygon& rPoly, double fScaleX, double fScaleY )
61 for( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
62 ImplScalePoint( rPoly[ i ], fScaleX, fScaleY );
65 void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScaleY )
67 if( !rLineInfo.IsDefault() )
69 const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
71 rLineInfo.SetWidth(fScale * rLineInfo.GetWidth());
72 rLineInfo.SetDashLen(fScale * rLineInfo.GetDashLen());
73 rLineInfo.SetDotLen(fScale * rLineInfo.GetDotLen());
74 rLineInfo.SetDistance(fScale * rLineInfo.GetDistance());
78 } //anonymous namespace
80 MetaAction::MetaAction() :
81 mnType( MetaActionType::NONE )
85 MetaAction::MetaAction( MetaActionType nType ) :
86 mnType( nType )
90 MetaAction::MetaAction( MetaAction const & rOther ) :
91 SimpleReferenceObject(), mnType( rOther.mnType )
95 MetaAction::~MetaAction()
99 void MetaAction::Execute( OutputDevice* )
103 rtl::Reference<MetaAction> MetaAction::Clone() const
105 return new MetaAction;
108 void MetaAction::Move( tools::Long, tools::Long )
112 void MetaAction::Scale( double, double )
116 MetaPixelAction::MetaPixelAction() :
117 MetaAction(MetaActionType::PIXEL)
120 MetaPixelAction::~MetaPixelAction()
123 MetaPixelAction::MetaPixelAction( const Point& rPt, const Color& rColor ) :
124 MetaAction ( MetaActionType::PIXEL ),
125 maPt ( rPt ),
126 maColor ( rColor )
129 void MetaPixelAction::Execute( OutputDevice* pOut )
131 pOut->DrawPixel( maPt, maColor );
134 rtl::Reference<MetaAction> MetaPixelAction::Clone() const
136 return new MetaPixelAction( *this );
139 void MetaPixelAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
141 maPt.Move( nHorzMove, nVertMove );
144 void MetaPixelAction::Scale( double fScaleX, double fScaleY )
146 ImplScalePoint( maPt, fScaleX, fScaleY );
149 MetaPointAction::MetaPointAction() :
150 MetaAction(MetaActionType::POINT)
153 MetaPointAction::~MetaPointAction()
156 MetaPointAction::MetaPointAction( const Point& rPt ) :
157 MetaAction ( MetaActionType::POINT ),
158 maPt ( rPt )
161 void MetaPointAction::Execute( OutputDevice* pOut )
163 pOut->DrawPixel( maPt );
166 rtl::Reference<MetaAction> MetaPointAction::Clone() const
168 return new MetaPointAction( *this );
171 void MetaPointAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
173 maPt.Move( nHorzMove, nVertMove );
176 void MetaPointAction::Scale( double fScaleX, double fScaleY )
178 ImplScalePoint( maPt, fScaleX, fScaleY );
181 MetaLineAction::MetaLineAction() :
182 MetaAction(MetaActionType::LINE)
185 MetaLineAction::~MetaLineAction()
188 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd ) :
189 MetaAction ( MetaActionType::LINE ),
190 maStartPt ( rStart ),
191 maEndPt ( rEnd )
194 MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd,
195 LineInfo aLineInfo ) :
196 MetaAction ( MetaActionType::LINE ),
197 maLineInfo (std::move( aLineInfo )),
198 maStartPt ( rStart ),
199 maEndPt ( rEnd )
202 void MetaLineAction::Execute( OutputDevice* pOut )
204 if( maLineInfo.IsDefault() )
205 pOut->DrawLine( maStartPt, maEndPt );
206 else
207 pOut->DrawLine( maStartPt, maEndPt, maLineInfo );
210 rtl::Reference<MetaAction> MetaLineAction::Clone() const
212 return new MetaLineAction( *this );
215 void MetaLineAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
217 maStartPt.Move( nHorzMove, nVertMove );
218 maEndPt.Move( nHorzMove, nVertMove );
221 void MetaLineAction::Scale( double fScaleX, double fScaleY )
223 ImplScalePoint( maStartPt, fScaleX, fScaleY );
224 ImplScalePoint( maEndPt, fScaleX, fScaleY );
225 ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
228 MetaRectAction::MetaRectAction() :
229 MetaAction(MetaActionType::RECT)
232 MetaRectAction::~MetaRectAction()
235 MetaRectAction::MetaRectAction( const tools::Rectangle& rRect ) :
236 MetaAction ( MetaActionType::RECT ),
237 maRect ( rRect )
240 static bool AllowDim(tools::Long nDim)
242 static bool bFuzzing = comphelper::IsFuzzing();
243 if (bFuzzing)
245 if (nDim > 0x20000000 || nDim < -0x20000000)
247 SAL_WARN("vcl", "skipping huge dimension: " << nDim);
248 return false;
251 return true;
254 static bool AllowPoint(const Point& rPoint)
256 return AllowDim(rPoint.X()) && AllowDim(rPoint.Y());
259 static bool AllowRect(const tools::Rectangle& rRect)
261 return AllowPoint(rRect.TopLeft()) && AllowPoint(rRect.BottomRight());
264 void MetaRectAction::Execute( OutputDevice* pOut )
266 if (!AllowRect(pOut->LogicToPixel(maRect)))
267 return;
269 pOut->DrawRect( maRect );
272 rtl::Reference<MetaAction> MetaRectAction::Clone() const
274 return new MetaRectAction( *this );
277 void MetaRectAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
279 maRect.Move( nHorzMove, nVertMove );
282 void MetaRectAction::Scale( double fScaleX, double fScaleY )
284 ImplScaleRect( maRect, fScaleX, fScaleY );
287 MetaRoundRectAction::MetaRoundRectAction() :
288 MetaAction ( MetaActionType::ROUNDRECT ),
289 mnHorzRound ( 0 ),
290 mnVertRound ( 0 )
293 MetaRoundRectAction::~MetaRoundRectAction()
296 MetaRoundRectAction::MetaRoundRectAction( const tools::Rectangle& rRect,
297 sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) :
298 MetaAction ( MetaActionType::ROUNDRECT ),
299 maRect ( rRect ),
300 mnHorzRound ( nHorzRound ),
301 mnVertRound ( nVertRound )
304 void MetaRoundRectAction::Execute( OutputDevice* pOut )
306 pOut->DrawRect( maRect, mnHorzRound, mnVertRound );
309 rtl::Reference<MetaAction> MetaRoundRectAction::Clone() const
311 return new MetaRoundRectAction( *this );
314 void MetaRoundRectAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
316 maRect.Move( nHorzMove, nVertMove );
319 void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
321 ImplScaleRect( maRect, fScaleX, fScaleY );
322 mnHorzRound = basegfx::fround<sal_uInt32>(mnHorzRound * fabs(fScaleX));
323 mnVertRound = basegfx::fround<sal_uInt32>(mnVertRound * fabs(fScaleY));
326 MetaEllipseAction::MetaEllipseAction() :
327 MetaAction(MetaActionType::ELLIPSE)
330 MetaEllipseAction::~MetaEllipseAction()
333 MetaEllipseAction::MetaEllipseAction( const tools::Rectangle& rRect ) :
334 MetaAction ( MetaActionType::ELLIPSE ),
335 maRect ( rRect )
338 void MetaEllipseAction::Execute( OutputDevice* pOut )
340 pOut->DrawEllipse( maRect );
343 rtl::Reference<MetaAction> MetaEllipseAction::Clone() const
345 return new MetaEllipseAction( *this );
348 void MetaEllipseAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
350 maRect.Move( nHorzMove, nVertMove );
353 void MetaEllipseAction::Scale( double fScaleX, double fScaleY )
355 ImplScaleRect( maRect, fScaleX, fScaleY );
358 MetaArcAction::MetaArcAction() :
359 MetaAction(MetaActionType::ARC)
362 MetaArcAction::~MetaArcAction()
365 MetaArcAction::MetaArcAction( const tools::Rectangle& rRect,
366 const Point& rStart, const Point& rEnd ) :
367 MetaAction ( MetaActionType::ARC ),
368 maRect ( rRect ),
369 maStartPt ( rStart ),
370 maEndPt ( rEnd )
373 void MetaArcAction::Execute( OutputDevice* pOut )
375 if (!AllowRect(pOut->LogicToPixel(maRect)))
376 return;
378 pOut->DrawArc( maRect, maStartPt, maEndPt );
381 rtl::Reference<MetaAction> MetaArcAction::Clone() const
383 return new MetaArcAction( *this );
386 void MetaArcAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
388 maRect.Move( nHorzMove, nVertMove );
389 maStartPt.Move( nHorzMove, nVertMove );
390 maEndPt.Move( nHorzMove, nVertMove );
393 void MetaArcAction::Scale( double fScaleX, double fScaleY )
395 ImplScaleRect( maRect, fScaleX, fScaleY );
396 ImplScalePoint( maStartPt, fScaleX, fScaleY );
397 ImplScalePoint( maEndPt, fScaleX, fScaleY );
400 MetaPieAction::MetaPieAction() :
401 MetaAction(MetaActionType::PIE)
404 MetaPieAction::~MetaPieAction()
407 MetaPieAction::MetaPieAction( const tools::Rectangle& rRect,
408 const Point& rStart, const Point& rEnd ) :
409 MetaAction ( MetaActionType::PIE ),
410 maRect ( rRect ),
411 maStartPt ( rStart ),
412 maEndPt ( rEnd )
415 void MetaPieAction::Execute( OutputDevice* pOut )
417 if (!AllowRect(pOut->LogicToPixel(maRect)))
418 return;
420 pOut->DrawPie( maRect, maStartPt, maEndPt );
423 rtl::Reference<MetaAction> MetaPieAction::Clone() const
425 return new MetaPieAction( *this );
428 void MetaPieAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
430 maRect.Move( nHorzMove, nVertMove );
431 maStartPt.Move( nHorzMove, nVertMove );
432 maEndPt.Move( nHorzMove, nVertMove );
435 void MetaPieAction::Scale( double fScaleX, double fScaleY )
437 ImplScaleRect( maRect, fScaleX, fScaleY );
438 ImplScalePoint( maStartPt, fScaleX, fScaleY );
439 ImplScalePoint( maEndPt, fScaleX, fScaleY );
442 MetaChordAction::MetaChordAction() :
443 MetaAction(MetaActionType::CHORD)
446 MetaChordAction::~MetaChordAction()
449 MetaChordAction::MetaChordAction( const tools::Rectangle& rRect,
450 const Point& rStart, const Point& rEnd ) :
451 MetaAction ( MetaActionType::CHORD ),
452 maRect ( rRect ),
453 maStartPt ( rStart ),
454 maEndPt ( rEnd )
457 void MetaChordAction::Execute( OutputDevice* pOut )
459 pOut->DrawChord( maRect, maStartPt, maEndPt );
462 rtl::Reference<MetaAction> MetaChordAction::Clone() const
464 return new MetaChordAction( *this );
467 void MetaChordAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
469 maRect.Move( nHorzMove, nVertMove );
470 maStartPt.Move( nHorzMove, nVertMove );
471 maEndPt.Move( nHorzMove, nVertMove );
474 void MetaChordAction::Scale( double fScaleX, double fScaleY )
476 ImplScaleRect( maRect, fScaleX, fScaleY );
477 ImplScalePoint( maStartPt, fScaleX, fScaleY );
478 ImplScalePoint( maEndPt, fScaleX, fScaleY );
481 MetaPolyLineAction::MetaPolyLineAction() :
482 MetaAction(MetaActionType::POLYLINE)
485 MetaPolyLineAction::~MetaPolyLineAction()
488 MetaPolyLineAction::MetaPolyLineAction( tools::Polygon aPoly ) :
489 MetaAction ( MetaActionType::POLYLINE ),
490 maPoly (std::move( aPoly ))
493 MetaPolyLineAction::MetaPolyLineAction( tools::Polygon aPoly, LineInfo aLineInfo ) :
494 MetaAction ( MetaActionType::POLYLINE ),
495 maLineInfo (std::move( aLineInfo )),
496 maPoly (std::move( aPoly ))
499 void MetaPolyLineAction::Execute( OutputDevice* pOut )
501 if (!AllowRect(pOut->LogicToPixel(maPoly.GetBoundRect())))
502 return;
504 if( maLineInfo.IsDefault() )
505 pOut->DrawPolyLine( maPoly );
506 else
507 pOut->DrawPolyLine( maPoly, maLineInfo );
510 rtl::Reference<MetaAction> MetaPolyLineAction::Clone() const
512 return new MetaPolyLineAction( *this );
515 void MetaPolyLineAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
517 maPoly.Move( nHorzMove, nVertMove );
520 void MetaPolyLineAction::Scale( double fScaleX, double fScaleY )
522 ImplScalePoly( maPoly, fScaleX, fScaleY );
523 ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
526 MetaPolygonAction::MetaPolygonAction() :
527 MetaAction(MetaActionType::POLYGON)
530 MetaPolygonAction::~MetaPolygonAction()
533 MetaPolygonAction::MetaPolygonAction( tools::Polygon aPoly ) :
534 MetaAction ( MetaActionType::POLYGON ),
535 maPoly (std::move( aPoly ))
538 void MetaPolygonAction::Execute( OutputDevice* pOut )
540 pOut->DrawPolygon( maPoly );
543 rtl::Reference<MetaAction> MetaPolygonAction::Clone() const
545 return new MetaPolygonAction( *this );
548 void MetaPolygonAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
550 maPoly.Move( nHorzMove, nVertMove );
553 void MetaPolygonAction::Scale( double fScaleX, double fScaleY )
555 ImplScalePoly( maPoly, fScaleX, fScaleY );
558 MetaPolyPolygonAction::MetaPolyPolygonAction() :
559 MetaAction(MetaActionType::POLYPOLYGON)
562 MetaPolyPolygonAction::~MetaPolyPolygonAction()
565 MetaPolyPolygonAction::MetaPolyPolygonAction( tools::PolyPolygon aPolyPoly ) :
566 MetaAction ( MetaActionType::POLYPOLYGON ),
567 maPolyPoly (std::move( aPolyPoly ))
570 void MetaPolyPolygonAction::Execute( OutputDevice* pOut )
572 pOut->DrawPolyPolygon( maPolyPoly );
575 rtl::Reference<MetaAction> MetaPolyPolygonAction::Clone() const
577 return new MetaPolyPolygonAction( *this );
580 void MetaPolyPolygonAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
582 maPolyPoly.Move( nHorzMove, nVertMove );
585 void MetaPolyPolygonAction::Scale( double fScaleX, double fScaleY )
587 for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
588 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
591 MetaTextAction::MetaTextAction() :
592 MetaAction ( MetaActionType::TEXT ),
593 mnIndex ( 0 ),
594 mnLen ( 0 )
597 MetaTextAction::~MetaTextAction()
600 MetaTextAction::MetaTextAction( const Point& rPt, OUString aStr,
601 sal_Int32 nIndex, sal_Int32 nLen ) :
602 MetaAction ( MetaActionType::TEXT ),
603 maPt ( rPt ),
604 maStr (std::move( aStr )),
605 mnIndex ( nIndex ),
606 mnLen ( nLen )
609 void MetaTextAction::Execute( OutputDevice* pOut )
611 if (!AllowDim(pOut->LogicToPixel(maPt).Y()))
612 return;
614 pOut->DrawText( maPt, maStr, mnIndex, mnLen );
617 rtl::Reference<MetaAction> MetaTextAction::Clone() const
619 return new MetaTextAction( *this );
622 void MetaTextAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
624 maPt.Move( nHorzMove, nVertMove );
627 void MetaTextAction::Scale( double fScaleX, double fScaleY )
629 ImplScalePoint( maPt, fScaleX, fScaleY );
632 MetaTextArrayAction::MetaTextArrayAction() :
633 MetaAction ( MetaActionType::TEXTARRAY ),
634 mnIndex ( 0 ),
635 mnLen ( 0 )
638 MetaTextArrayAction::MetaTextArrayAction(const MetaTextArrayAction& rAction)
639 : MetaAction(MetaActionType::TEXTARRAY)
640 , maStartPt(rAction.maStartPt)
641 , maStr(rAction.maStr)
642 , maDXAry(rAction.maDXAry)
643 , maKashidaAry(rAction.maKashidaAry)
644 , mnIndex(rAction.mnIndex)
645 , mnLen(rAction.mnLen)
646 , mnLayoutContextIndex(rAction.mnLayoutContextIndex)
647 , mnLayoutContextLen(rAction.mnLayoutContextLen)
651 MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
652 OUString aStr,
653 KernArray aDXAry,
654 std::vector<sal_Bool> aKashidaAry,
655 sal_Int32 nIndex,
656 sal_Int32 nLen ) :
657 MetaAction ( MetaActionType::TEXTARRAY ),
658 maStartPt ( rStartPt ),
659 maStr (std::move( aStr )),
660 maDXAry (std::move( aDXAry )),
661 maKashidaAry(std::move( aKashidaAry )),
662 mnIndex ( nIndex ),
663 mnLen ( nLen )
667 MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
668 OUString aStr,
669 KernArraySpan pDXAry,
670 std::span<const sal_Bool> pKashidaAry,
671 sal_Int32 nIndex,
672 sal_Int32 nLen ) :
673 MetaAction ( MetaActionType::TEXTARRAY ),
674 maStartPt ( rStartPt ),
675 maStr (std::move( aStr )),
676 maKashidaAry( pKashidaAry.begin(), pKashidaAry.end() ),
677 mnIndex ( nIndex ),
678 mnLen ( nLen )
680 maDXAry.assign(pDXAry.begin(), pDXAry.end());
683 MetaTextArrayAction::MetaTextArrayAction(const Point& rStartPt, OUString aStr, KernArraySpan pDXAry,
684 std::span<const sal_Bool> pKashidaAry, sal_Int32 nIndex,
685 sal_Int32 nLen, sal_Int32 nLayoutContextIndex,
686 sal_Int32 nLayoutContextLen)
687 : MetaAction(MetaActionType::TEXTARRAY)
688 , maStartPt(rStartPt)
689 , maStr(std::move(aStr))
690 , maKashidaAry(pKashidaAry.begin(), pKashidaAry.end())
691 , mnIndex(nIndex)
692 , mnLen(nLen)
693 , mnLayoutContextIndex(nLayoutContextIndex)
694 , mnLayoutContextLen(nLayoutContextLen)
696 maDXAry.assign(pDXAry.begin(), pDXAry.end());
699 MetaTextArrayAction::~MetaTextArrayAction()
703 void MetaTextArrayAction::Execute( OutputDevice* pOut )
705 if (!AllowPoint(pOut->LogicToPixel(maStartPt)))
706 return;
708 if (mnLayoutContextIndex >= 0)
710 pOut->DrawPartialTextArray(maStartPt, maStr, maDXAry, maKashidaAry, mnLayoutContextIndex,
711 mnLayoutContextLen, mnIndex, mnLen);
713 else
715 pOut->DrawTextArray(maStartPt, maStr, maDXAry, maKashidaAry, mnIndex, mnLen);
719 rtl::Reference<MetaAction> MetaTextArrayAction::Clone() const
721 return new MetaTextArrayAction( *this );
724 void MetaTextArrayAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
726 maStartPt.Move( nHorzMove, nVertMove );
729 void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
731 ImplScalePoint( maStartPt, fScaleX, fScaleY );
733 if ( !maDXAry.empty() && mnLen )
735 for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
736 maDXAry[i] *= fabs(fScaleX);
740 void MetaTextArrayAction::SetDXArray(KernArray aArray)
742 maDXAry = std::move(aArray);
745 void MetaTextArrayAction::SetKashidaArray(std::vector<sal_Bool> aArray)
747 maKashidaAry = std::move(aArray);
750 MetaStretchTextAction::MetaStretchTextAction() :
751 MetaAction ( MetaActionType::STRETCHTEXT ),
752 mnWidth ( 0 ),
753 mnIndex ( 0 ),
754 mnLen ( 0 )
757 MetaStretchTextAction::~MetaStretchTextAction()
760 MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
761 OUString aStr,
762 sal_Int32 nIndex, sal_Int32 nLen ) :
763 MetaAction ( MetaActionType::STRETCHTEXT ),
764 maPt ( rPt ),
765 maStr (std::move( aStr )),
766 mnWidth ( nWidth ),
767 mnIndex ( nIndex ),
768 mnLen ( nLen )
771 void MetaStretchTextAction::Execute( OutputDevice* pOut )
773 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPt, Size(mnWidth, pOut->GetTextHeight())))))
774 return;
776 static bool bFuzzing = comphelper::IsFuzzing();
777 if (bFuzzing && mnWidth > 10000)
779 FontLineStyle eUnderline = pOut->GetFont().GetUnderline();
780 FontLineStyle eOverline = pOut->GetFont().GetOverline();
782 if (eUnderline == LINESTYLE_SMALLWAVE || eUnderline == LINESTYLE_WAVE ||
783 eUnderline == LINESTYLE_DOUBLEWAVE || eUnderline == LINESTYLE_BOLDWAVE ||
784 eOverline == LINESTYLE_SMALLWAVE || eOverline == LINESTYLE_WAVE ||
785 eOverline == LINESTYLE_DOUBLEWAVE || eOverline == LINESTYLE_BOLDWAVE)
787 SAL_WARN("vcl.gdi", "MetaStretchTextAction::Execute, skipping suspicious WaveTextLine of length: "
788 << mnWidth << " for fuzzing performance");
789 return;
793 pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
796 rtl::Reference<MetaAction> MetaStretchTextAction::Clone() const
798 return new MetaStretchTextAction( *this );
801 void MetaStretchTextAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
803 maPt.Move( nHorzMove, nVertMove );
806 void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
808 ImplScalePoint( maPt, fScaleX, fScaleY );
809 mnWidth = basegfx::fround<sal_uInt32>(mnWidth * fabs(fScaleX));
811 MetaTextRectAction::MetaTextRectAction() :
812 MetaAction ( MetaActionType::TEXTRECT ),
813 mnStyle ( DrawTextFlags::NONE )
816 MetaTextRectAction::~MetaTextRectAction()
819 MetaTextRectAction::MetaTextRectAction( const tools::Rectangle& rRect,
820 OUString aStr, DrawTextFlags nStyle ) :
821 MetaAction ( MetaActionType::TEXTRECT ),
822 maRect ( rRect ),
823 maStr (std::move( aStr )),
824 mnStyle ( nStyle )
827 void MetaTextRectAction::Execute( OutputDevice* pOut )
829 if (!AllowRect(pOut->LogicToPixel(maRect)))
830 return;
832 pOut->DrawText( maRect, maStr, mnStyle );
835 rtl::Reference<MetaAction> MetaTextRectAction::Clone() const
837 return new MetaTextRectAction( *this );
840 void MetaTextRectAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
842 maRect.Move( nHorzMove, nVertMove );
845 void MetaTextRectAction::Scale( double fScaleX, double fScaleY )
847 ImplScaleRect( maRect, fScaleX, fScaleY );
850 MetaTextLineAction::MetaTextLineAction() :
851 MetaAction ( MetaActionType::TEXTLINE ),
852 mnWidth ( 0 ),
853 meStrikeout ( STRIKEOUT_NONE ),
854 meUnderline ( LINESTYLE_NONE ),
855 meOverline ( LINESTYLE_NONE )
858 MetaTextLineAction::~MetaTextLineAction()
861 MetaTextLineAction::MetaTextLineAction( const Point& rPos, tools::Long nWidth,
862 FontStrikeout eStrikeout,
863 FontLineStyle eUnderline,
864 FontLineStyle eOverline ) :
865 MetaAction ( MetaActionType::TEXTLINE ),
866 maPos ( rPos ),
867 mnWidth ( nWidth ),
868 meStrikeout ( eStrikeout ),
869 meUnderline ( eUnderline ),
870 meOverline ( eOverline )
873 void MetaTextLineAction::Execute( OutputDevice* pOut )
875 if (mnWidth < 0)
877 SAL_WARN("vcl", "skipping line with negative width: " << mnWidth);
878 return;
880 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPos, Size(mnWidth, pOut->GetTextHeight())))))
881 return;
883 pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline );
886 rtl::Reference<MetaAction> MetaTextLineAction::Clone() const
888 return new MetaTextLineAction( *this );
891 void MetaTextLineAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
893 maPos.Move( nHorzMove, nVertMove );
896 void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
898 ImplScalePoint( maPos, fScaleX, fScaleY );
899 mnWidth = basegfx::fround<tools::Long>(mnWidth * fabs(fScaleX));
902 MetaBmpAction::MetaBmpAction() :
903 MetaAction(MetaActionType::BMP)
906 MetaBmpAction::~MetaBmpAction()
909 MetaBmpAction::MetaBmpAction( const Point& rPt, const Bitmap& rBmp ) :
910 MetaAction ( MetaActionType::BMP ),
911 maBmp ( rBmp ),
912 maPt ( rPt )
915 void MetaBmpAction::Execute( OutputDevice* pOut )
917 pOut->DrawBitmap( maPt, maBmp );
920 rtl::Reference<MetaAction> MetaBmpAction::Clone() const
922 return new MetaBmpAction( *this );
925 void MetaBmpAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
927 maPt.Move( nHorzMove, nVertMove );
930 void MetaBmpAction::Scale( double fScaleX, double fScaleY )
932 ImplScalePoint( maPt, fScaleX, fScaleY );
935 MetaBmpScaleAction::MetaBmpScaleAction() :
936 MetaAction(MetaActionType::BMPSCALE)
939 MetaBmpScaleAction::~MetaBmpScaleAction()
942 MetaBmpScaleAction::MetaBmpScaleAction( const Point& rPt, const Size& rSz,
943 const Bitmap& rBmp ) :
944 MetaAction ( MetaActionType::BMPSCALE ),
945 maBmp ( rBmp ),
946 maPt ( rPt ),
947 maSz ( rSz )
950 static bool AllowScale(const Size& rSource, const Size& rDest)
952 static bool bFuzzing = comphelper::IsFuzzing();
953 if (bFuzzing)
955 constexpr int nMaxScaleWhenFuzzing = 128;
957 auto nSourceHeight = rSource.Height();
958 auto nDestHeight = rDest.Height();
959 if (nSourceHeight && std::abs(nDestHeight / nSourceHeight) > nMaxScaleWhenFuzzing)
961 SAL_WARN("vcl", "skipping large vertical scaling: " << nSourceHeight << " to " << nDestHeight);
962 return false;
965 if (nDestHeight && std::abs(nSourceHeight / nDestHeight) > nMaxScaleWhenFuzzing)
967 SAL_WARN("vcl", "skipping large vertical scaling: " << nSourceHeight << " to " << nDestHeight);
968 return false;
971 auto nSourceWidth = rSource.Width();
972 auto nDestWidth = rDest.Width();
973 if (nSourceWidth && std::abs(nDestWidth / nSourceWidth) > nMaxScaleWhenFuzzing)
975 SAL_WARN("vcl", "skipping large horizontal scaling: " << nSourceWidth << " to " << nDestWidth);
976 return false;
979 if (nDestWidth && std::abs(nSourceWidth / nDestWidth) > nMaxScaleWhenFuzzing)
981 SAL_WARN("vcl", "skipping large horizontal scaling: " << nSourceWidth << " to " << nDestWidth);
982 return false;
986 return true;
989 void MetaBmpScaleAction::Execute( OutputDevice* pOut )
991 Size aPixelSize(pOut->LogicToPixel(maSz));
992 if (!AllowRect(tools::Rectangle(pOut->LogicToPixel(maPt), aPixelSize)) ||
993 !AllowScale(maBmp.GetSizePixel(), aPixelSize))
995 return;
998 pOut->DrawBitmap( maPt, maSz, maBmp );
1001 rtl::Reference<MetaAction> MetaBmpScaleAction::Clone() const
1003 return new MetaBmpScaleAction( *this );
1006 void MetaBmpScaleAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1008 maPt.Move( nHorzMove, nVertMove );
1011 void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY )
1013 tools::Rectangle aRectangle(maPt, maSz);
1014 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1015 maPt = aRectangle.TopLeft();
1016 maSz = aRectangle.GetSize();
1019 MetaBmpScalePartAction::MetaBmpScalePartAction() :
1020 MetaAction(MetaActionType::BMPSCALEPART)
1023 MetaBmpScalePartAction::~MetaBmpScalePartAction()
1026 MetaBmpScalePartAction::MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz,
1027 const Point& rSrcPt, const Size& rSrcSz,
1028 const Bitmap& rBmp ) :
1029 MetaAction ( MetaActionType::BMPSCALEPART ),
1030 maBmp ( rBmp ),
1031 maDstPt ( rDstPt ),
1032 maDstSz ( rDstSz ),
1033 maSrcPt ( rSrcPt ),
1034 maSrcSz ( rSrcSz )
1037 void MetaBmpScalePartAction::Execute( OutputDevice* pOut )
1039 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maDstPt, maDstSz))))
1040 return;
1042 pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
1045 rtl::Reference<MetaAction> MetaBmpScalePartAction::Clone() const
1047 return new MetaBmpScalePartAction( *this );
1050 void MetaBmpScalePartAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1052 maDstPt.Move( nHorzMove, nVertMove );
1055 void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY )
1057 tools::Rectangle aRectangle(maDstPt, maDstSz);
1058 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1059 maDstPt = aRectangle.TopLeft();
1060 maDstSz = aRectangle.GetSize();
1063 MetaBmpExAction::MetaBmpExAction() :
1064 MetaAction(MetaActionType::BMPEX)
1067 MetaBmpExAction::~MetaBmpExAction()
1070 MetaBmpExAction::MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ) :
1071 MetaAction ( MetaActionType::BMPEX ),
1072 maBmpEx ( rBmpEx ),
1073 maPt ( rPt )
1076 void MetaBmpExAction::Execute( OutputDevice* pOut )
1078 pOut->DrawBitmapEx( maPt, maBmpEx );
1081 rtl::Reference<MetaAction> MetaBmpExAction::Clone() const
1083 return new MetaBmpExAction( *this );
1086 void MetaBmpExAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1088 maPt.Move( nHorzMove, nVertMove );
1091 void MetaBmpExAction::Scale( double fScaleX, double fScaleY )
1093 ImplScalePoint( maPt, fScaleX, fScaleY );
1096 MetaBmpExScaleAction::MetaBmpExScaleAction() :
1097 MetaAction(MetaActionType::BMPEXSCALE)
1100 MetaBmpExScaleAction::~MetaBmpExScaleAction()
1103 MetaBmpExScaleAction::MetaBmpExScaleAction( const Point& rPt, const Size& rSz,
1104 const BitmapEx& rBmpEx ) :
1105 MetaAction ( MetaActionType::BMPEXSCALE ),
1106 maBmpEx ( rBmpEx ),
1107 maPt ( rPt ),
1108 maSz ( rSz )
1111 void MetaBmpExScaleAction::Execute( OutputDevice* pOut )
1113 if (!AllowScale(maBmpEx.GetSizePixel(), pOut->LogicToPixel(maSz)))
1114 return;
1115 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPt, maSz))))
1116 return;
1118 pOut->DrawBitmapEx( maPt, maSz, maBmpEx );
1121 rtl::Reference<MetaAction> MetaBmpExScaleAction::Clone() const
1123 return new MetaBmpExScaleAction( *this );
1126 void MetaBmpExScaleAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1128 maPt.Move( nHorzMove, nVertMove );
1131 void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY )
1133 tools::Rectangle aRectangle(maPt, maSz);
1134 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1135 maPt = aRectangle.TopLeft();
1136 maSz = aRectangle.GetSize();
1139 MetaBmpExScalePartAction::MetaBmpExScalePartAction() :
1140 MetaAction(MetaActionType::BMPEXSCALEPART)
1143 MetaBmpExScalePartAction::~MetaBmpExScalePartAction()
1146 MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz,
1147 const Point& rSrcPt, const Size& rSrcSz,
1148 const BitmapEx& rBmpEx ) :
1149 MetaAction ( MetaActionType::BMPEXSCALEPART ),
1150 maBmpEx ( rBmpEx ),
1151 maDstPt ( rDstPt ),
1152 maDstSz ( rDstSz ),
1153 maSrcPt ( rSrcPt ),
1154 maSrcSz ( rSrcSz )
1157 void MetaBmpExScalePartAction::Execute( OutputDevice* pOut )
1159 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maDstPt, maDstSz))))
1160 return;
1162 pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
1165 rtl::Reference<MetaAction> MetaBmpExScalePartAction::Clone() const
1167 return new MetaBmpExScalePartAction( *this );
1170 void MetaBmpExScalePartAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1172 maDstPt.Move( nHorzMove, nVertMove );
1175 void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY )
1177 tools::Rectangle aRectangle(maDstPt, maDstSz);
1178 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1179 maDstPt = aRectangle.TopLeft();
1180 maDstSz = aRectangle.GetSize();
1183 MetaMaskAction::MetaMaskAction() :
1184 MetaAction(MetaActionType::MASK)
1187 MetaMaskAction::~MetaMaskAction()
1190 MetaMaskAction::MetaMaskAction( const Point& rPt,
1191 const Bitmap& rBmp,
1192 const Color& rColor ) :
1193 MetaAction ( MetaActionType::MASK ),
1194 maBmp ( rBmp ),
1195 maColor ( rColor ),
1196 maPt ( rPt )
1199 void MetaMaskAction::Execute( OutputDevice* pOut )
1201 pOut->DrawMask( maPt, maBmp, maColor );
1204 rtl::Reference<MetaAction> MetaMaskAction::Clone() const
1206 return new MetaMaskAction( *this );
1209 void MetaMaskAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1211 maPt.Move( nHorzMove, nVertMove );
1214 void MetaMaskAction::Scale( double fScaleX, double fScaleY )
1216 ImplScalePoint( maPt, fScaleX, fScaleY );
1219 MetaMaskScaleAction::MetaMaskScaleAction() :
1220 MetaAction(MetaActionType::MASKSCALE)
1223 MetaMaskScaleAction::~MetaMaskScaleAction()
1226 MetaMaskScaleAction::MetaMaskScaleAction( const Point& rPt, const Size& rSz,
1227 const Bitmap& rBmp,
1228 const Color& rColor ) :
1229 MetaAction ( MetaActionType::MASKSCALE ),
1230 maBmp ( rBmp ),
1231 maColor ( rColor ),
1232 maPt ( rPt ),
1233 maSz ( rSz )
1236 void MetaMaskScaleAction::Execute( OutputDevice* pOut )
1238 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPt, maSz))))
1239 return;
1240 pOut->DrawMask( maPt, maSz, maBmp, maColor );
1243 rtl::Reference<MetaAction> MetaMaskScaleAction::Clone() const
1245 return new MetaMaskScaleAction( *this );
1248 void MetaMaskScaleAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1250 maPt.Move( nHorzMove, nVertMove );
1253 void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY )
1255 tools::Rectangle aRectangle(maPt, maSz);
1256 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1257 maPt = aRectangle.TopLeft();
1258 maSz = aRectangle.GetSize();
1261 MetaMaskScalePartAction::MetaMaskScalePartAction() :
1262 MetaAction(MetaActionType::MASKSCALEPART)
1265 MetaMaskScalePartAction::~MetaMaskScalePartAction()
1268 MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz,
1269 const Point& rSrcPt, const Size& rSrcSz,
1270 const Bitmap& rBmp,
1271 const Color& rColor ) :
1272 MetaAction ( MetaActionType::MASKSCALEPART ),
1273 maBmp ( rBmp ),
1274 maColor ( rColor ),
1275 maDstPt ( rDstPt ),
1276 maDstSz ( rDstSz ),
1277 maSrcPt ( rSrcPt ),
1278 maSrcSz ( rSrcSz )
1281 void MetaMaskScalePartAction::Execute( OutputDevice* pOut )
1283 if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maDstPt, maDstSz))))
1284 return;
1286 pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor, MetaActionType::MASKSCALE );
1289 rtl::Reference<MetaAction> MetaMaskScalePartAction::Clone() const
1291 return new MetaMaskScalePartAction( *this );
1294 void MetaMaskScalePartAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1296 maDstPt.Move( nHorzMove, nVertMove );
1299 void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY )
1301 tools::Rectangle aRectangle(maDstPt, maDstSz);
1302 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1303 maDstPt = aRectangle.TopLeft();
1304 maDstSz = aRectangle.GetSize();
1307 MetaGradientAction::MetaGradientAction() :
1308 MetaAction(MetaActionType::GRADIENT)
1311 MetaGradientAction::~MetaGradientAction()
1314 MetaGradientAction::MetaGradientAction( const tools::Rectangle& rRect, Gradient aGradient ) :
1315 MetaAction ( MetaActionType::GRADIENT ),
1316 maRect ( rRect ),
1317 maGradient (std::move( aGradient ))
1320 void MetaGradientAction::Execute( OutputDevice* pOut )
1322 pOut->DrawGradient( maRect, maGradient );
1325 rtl::Reference<MetaAction> MetaGradientAction::Clone() const
1327 return new MetaGradientAction( *this );
1330 void MetaGradientAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1332 maRect.Move( nHorzMove, nVertMove );
1335 void MetaGradientAction::Scale( double fScaleX, double fScaleY )
1337 ImplScaleRect( maRect, fScaleX, fScaleY );
1340 MetaGradientExAction::MetaGradientExAction() :
1341 MetaAction ( MetaActionType::GRADIENTEX )
1344 MetaGradientExAction::MetaGradientExAction( tools::PolyPolygon aPolyPoly, Gradient aGradient ) :
1345 MetaAction ( MetaActionType::GRADIENTEX ),
1346 maPolyPoly (std::move( aPolyPoly )),
1347 maGradient (std::move( aGradient ))
1350 MetaGradientExAction::~MetaGradientExAction()
1353 void MetaGradientExAction::Execute( OutputDevice* pOut )
1355 if( pOut->GetConnectMetaFile() )
1357 pOut->GetConnectMetaFile()->AddAction( this );
1361 rtl::Reference<MetaAction> MetaGradientExAction::Clone() const
1363 return new MetaGradientExAction( *this );
1366 void MetaGradientExAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1368 maPolyPoly.Move( nHorzMove, nVertMove );
1371 void MetaGradientExAction::Scale( double fScaleX, double fScaleY )
1373 for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
1374 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
1377 MetaHatchAction::MetaHatchAction() :
1378 MetaAction(MetaActionType::HATCH)
1381 MetaHatchAction::~MetaHatchAction()
1384 MetaHatchAction::MetaHatchAction( tools::PolyPolygon aPolyPoly, const Hatch& rHatch ) :
1385 MetaAction ( MetaActionType::HATCH ),
1386 maPolyPoly (std::move( aPolyPoly )),
1387 maHatch ( rHatch )
1390 void MetaHatchAction::Execute( OutputDevice* pOut )
1392 if (!AllowRect(pOut->LogicToPixel(maPolyPoly.GetBoundRect())))
1393 return;
1394 if (!AllowDim(pOut->LogicToPixel(Point(maHatch.GetDistance(), 0)).X()))
1395 return;
1397 pOut->DrawHatch( maPolyPoly, maHatch );
1400 rtl::Reference<MetaAction> MetaHatchAction::Clone() const
1402 return new MetaHatchAction( *this );
1405 void MetaHatchAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1407 maPolyPoly.Move( nHorzMove, nVertMove );
1410 void MetaHatchAction::Scale( double fScaleX, double fScaleY )
1412 for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
1413 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
1416 MetaWallpaperAction::MetaWallpaperAction() :
1417 MetaAction(MetaActionType::WALLPAPER)
1420 MetaWallpaperAction::~MetaWallpaperAction()
1423 MetaWallpaperAction::MetaWallpaperAction( const tools::Rectangle& rRect,
1424 const Wallpaper& rPaper ) :
1425 MetaAction ( MetaActionType::WALLPAPER ),
1426 maRect ( rRect ),
1427 maWallpaper ( rPaper )
1430 void MetaWallpaperAction::Execute( OutputDevice* pOut )
1432 pOut->DrawWallpaper( maRect, maWallpaper );
1435 rtl::Reference<MetaAction> MetaWallpaperAction::Clone() const
1437 return new MetaWallpaperAction( *this );
1440 void MetaWallpaperAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1442 maRect.Move( nHorzMove, nVertMove );
1445 void MetaWallpaperAction::Scale( double fScaleX, double fScaleY )
1447 ImplScaleRect( maRect, fScaleX, fScaleY );
1450 MetaClipRegionAction::MetaClipRegionAction() :
1451 MetaAction ( MetaActionType::CLIPREGION ),
1452 mbClip ( false )
1455 MetaClipRegionAction::~MetaClipRegionAction()
1458 MetaClipRegionAction::MetaClipRegionAction( vcl::Region aRegion, bool bClip ) :
1459 MetaAction ( MetaActionType::CLIPREGION ),
1460 maRegion (std::move( aRegion )),
1461 mbClip ( bClip )
1464 void MetaClipRegionAction::Execute( OutputDevice* pOut )
1466 if( mbClip )
1467 pOut->SetClipRegion( maRegion );
1468 else
1469 pOut->SetClipRegion();
1472 rtl::Reference<MetaAction> MetaClipRegionAction::Clone() const
1474 return new MetaClipRegionAction( *this );
1477 void MetaClipRegionAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1479 maRegion.Move( nHorzMove, nVertMove );
1482 void MetaClipRegionAction::Scale( double fScaleX, double fScaleY )
1484 maRegion.Scale( fScaleX, fScaleY );
1487 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction() :
1488 MetaAction(MetaActionType::ISECTRECTCLIPREGION)
1491 MetaISectRectClipRegionAction::~MetaISectRectClipRegionAction()
1494 MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const tools::Rectangle& rRect ) :
1495 MetaAction ( MetaActionType::ISECTRECTCLIPREGION ),
1496 maRect ( rRect )
1499 void MetaISectRectClipRegionAction::Execute( OutputDevice* pOut )
1501 pOut->IntersectClipRegion( maRect );
1504 rtl::Reference<MetaAction> MetaISectRectClipRegionAction::Clone() const
1506 return new MetaISectRectClipRegionAction( *this );
1509 void MetaISectRectClipRegionAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1511 maRect.Move( nHorzMove, nVertMove );
1514 void MetaISectRectClipRegionAction::Scale( double fScaleX, double fScaleY )
1516 ImplScaleRect( maRect, fScaleX, fScaleY );
1519 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction() :
1520 MetaAction(MetaActionType::ISECTREGIONCLIPREGION)
1523 MetaISectRegionClipRegionAction::~MetaISectRegionClipRegionAction()
1526 MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( vcl::Region aRegion ) :
1527 MetaAction ( MetaActionType::ISECTREGIONCLIPREGION ),
1528 maRegion (std::move( aRegion ))
1532 void MetaISectRegionClipRegionAction::Execute( OutputDevice* pOut )
1534 if (!AllowRect(pOut->LogicToPixel(maRegion.GetBoundRect())))
1535 return;
1537 pOut->IntersectClipRegion( maRegion );
1540 rtl::Reference<MetaAction> MetaISectRegionClipRegionAction::Clone() const
1542 return new MetaISectRegionClipRegionAction( *this );
1545 void MetaISectRegionClipRegionAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1547 maRegion.Move( nHorzMove, nVertMove );
1550 void MetaISectRegionClipRegionAction::Scale( double fScaleX, double fScaleY )
1552 maRegion.Scale( fScaleX, fScaleY );
1555 MetaMoveClipRegionAction::MetaMoveClipRegionAction() :
1556 MetaAction ( MetaActionType::MOVECLIPREGION ),
1557 mnHorzMove ( 0 ),
1558 mnVertMove ( 0 )
1561 MetaMoveClipRegionAction::~MetaMoveClipRegionAction()
1564 MetaMoveClipRegionAction::MetaMoveClipRegionAction( tools::Long nHorzMove, tools::Long nVertMove ) :
1565 MetaAction ( MetaActionType::MOVECLIPREGION ),
1566 mnHorzMove ( nHorzMove ),
1567 mnVertMove ( nVertMove )
1570 void MetaMoveClipRegionAction::Execute( OutputDevice* pOut )
1572 if (!AllowPoint(pOut->LogicToPixel(Point(mnHorzMove, mnVertMove))))
1573 return;
1574 pOut->MoveClipRegion( mnHorzMove, mnVertMove );
1577 rtl::Reference<MetaAction> MetaMoveClipRegionAction::Clone() const
1579 return new MetaMoveClipRegionAction( *this );
1582 void MetaMoveClipRegionAction::Scale( double fScaleX, double fScaleY )
1584 mnHorzMove = basegfx::fround<tools::Long>(mnHorzMove * fScaleX);
1585 mnVertMove = basegfx::fround<tools::Long>(mnVertMove * fScaleY);
1588 MetaLineColorAction::MetaLineColorAction() :
1589 MetaAction ( MetaActionType::LINECOLOR ),
1590 mbSet ( false )
1593 MetaLineColorAction::~MetaLineColorAction()
1596 MetaLineColorAction::MetaLineColorAction( const Color& rColor, bool bSet ) :
1597 MetaAction ( MetaActionType::LINECOLOR ),
1598 maColor ( rColor ),
1599 mbSet ( bSet )
1602 void MetaLineColorAction::Execute( OutputDevice* pOut )
1604 if( mbSet )
1605 pOut->SetLineColor( maColor );
1606 else
1607 pOut->SetLineColor();
1610 rtl::Reference<MetaAction> MetaLineColorAction::Clone() const
1612 return new MetaLineColorAction( *this );
1615 MetaFillColorAction::MetaFillColorAction() :
1616 MetaAction ( MetaActionType::FILLCOLOR ),
1617 mbSet ( false )
1620 MetaFillColorAction::~MetaFillColorAction()
1623 MetaFillColorAction::MetaFillColorAction( const Color& rColor, bool bSet ) :
1624 MetaAction ( MetaActionType::FILLCOLOR ),
1625 maColor ( rColor ),
1626 mbSet ( bSet )
1629 void MetaFillColorAction::Execute( OutputDevice* pOut )
1631 if( mbSet )
1632 pOut->SetFillColor( maColor );
1633 else
1634 pOut->SetFillColor();
1637 rtl::Reference<MetaAction> MetaFillColorAction::Clone() const
1639 return new MetaFillColorAction( *this );
1642 MetaTextColorAction::MetaTextColorAction() :
1643 MetaAction(MetaActionType::TEXTCOLOR)
1646 MetaTextColorAction::~MetaTextColorAction()
1649 MetaTextColorAction::MetaTextColorAction( const Color& rColor ) :
1650 MetaAction ( MetaActionType::TEXTCOLOR ),
1651 maColor ( rColor )
1654 void MetaTextColorAction::Execute( OutputDevice* pOut )
1656 pOut->SetTextColor( maColor );
1659 rtl::Reference<MetaAction> MetaTextColorAction::Clone() const
1661 return new MetaTextColorAction( *this );
1664 MetaTextFillColorAction::MetaTextFillColorAction() :
1665 MetaAction ( MetaActionType::TEXTFILLCOLOR ),
1666 mbSet ( false )
1669 MetaTextFillColorAction::~MetaTextFillColorAction()
1672 MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, bool bSet ) :
1673 MetaAction ( MetaActionType::TEXTFILLCOLOR ),
1674 maColor ( rColor ),
1675 mbSet ( bSet )
1678 void MetaTextFillColorAction::Execute( OutputDevice* pOut )
1680 if( mbSet )
1681 pOut->SetTextFillColor( maColor );
1682 else
1683 pOut->SetTextFillColor();
1686 rtl::Reference<MetaAction> MetaTextFillColorAction::Clone() const
1688 return new MetaTextFillColorAction( *this );
1691 MetaTextLineColorAction::MetaTextLineColorAction() :
1692 MetaAction ( MetaActionType::TEXTLINECOLOR ),
1693 mbSet ( false )
1696 MetaTextLineColorAction::~MetaTextLineColorAction()
1699 MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, bool bSet ) :
1700 MetaAction ( MetaActionType::TEXTLINECOLOR ),
1701 maColor ( rColor ),
1702 mbSet ( bSet )
1705 void MetaTextLineColorAction::Execute( OutputDevice* pOut )
1707 if( mbSet )
1708 pOut->SetTextLineColor( maColor );
1709 else
1710 pOut->SetTextLineColor();
1713 rtl::Reference<MetaAction> MetaTextLineColorAction::Clone() const
1715 return new MetaTextLineColorAction( *this );
1718 MetaOverlineColorAction::MetaOverlineColorAction() :
1719 MetaAction ( MetaActionType::OVERLINECOLOR ),
1720 mbSet ( false )
1723 MetaOverlineColorAction::~MetaOverlineColorAction()
1726 MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, bool bSet ) :
1727 MetaAction ( MetaActionType::OVERLINECOLOR ),
1728 maColor ( rColor ),
1729 mbSet ( bSet )
1732 void MetaOverlineColorAction::Execute( OutputDevice* pOut )
1734 if( mbSet )
1735 pOut->SetOverlineColor( maColor );
1736 else
1737 pOut->SetOverlineColor();
1740 rtl::Reference<MetaAction> MetaOverlineColorAction::Clone() const
1742 return new MetaOverlineColorAction( *this );
1745 MetaTextAlignAction::MetaTextAlignAction() :
1746 MetaAction ( MetaActionType::TEXTALIGN ),
1747 maAlign ( ALIGN_TOP )
1750 MetaTextAlignAction::~MetaTextAlignAction()
1753 MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign ) :
1754 MetaAction ( MetaActionType::TEXTALIGN ),
1755 maAlign ( aAlign )
1758 void MetaTextAlignAction::Execute( OutputDevice* pOut )
1760 pOut->SetTextAlign( maAlign );
1763 rtl::Reference<MetaAction> MetaTextAlignAction::Clone() const
1765 return new MetaTextAlignAction( *this );
1768 MetaMapModeAction::MetaMapModeAction() :
1769 MetaAction(MetaActionType::MAPMODE)
1772 MetaMapModeAction::~MetaMapModeAction()
1775 MetaMapModeAction::MetaMapModeAction( const MapMode& rMapMode ) :
1776 MetaAction ( MetaActionType::MAPMODE ),
1777 maMapMode ( rMapMode )
1780 void MetaMapModeAction::Execute( OutputDevice* pOut )
1782 pOut->SetMapMode( maMapMode );
1785 rtl::Reference<MetaAction> MetaMapModeAction::Clone() const
1787 return new MetaMapModeAction( *this );
1790 void MetaMapModeAction::Scale( double fScaleX, double fScaleY )
1792 Point aPoint( maMapMode.GetOrigin() );
1794 ImplScalePoint( aPoint, fScaleX, fScaleY );
1795 maMapMode.SetOrigin( aPoint );
1798 MetaFontAction::MetaFontAction() :
1799 MetaAction(MetaActionType::FONT)
1802 MetaFontAction::~MetaFontAction()
1805 MetaFontAction::MetaFontAction( vcl::Font aFont ) :
1806 MetaAction ( MetaActionType::FONT ),
1807 maFont (std::move( aFont ))
1809 // #96876: because RTL_TEXTENCODING_SYMBOL is often set at the OpenSymbol font,
1810 // we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems
1811 // to be the right way; changing the textencoding at other sources
1812 // is too dangerous at the moment
1813 if ( IsOpenSymbol( maFont.GetFamilyName() )
1814 && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
1816 SAL_WARN_IF(maFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL, "vcl", "OpenSymbol should not have charset of RTL_TEXTENCODING_SYMBOL in new documents");
1817 maFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
1821 void MetaFontAction::Execute( OutputDevice* pOut )
1823 pOut->SetFont( maFont );
1826 rtl::Reference<MetaAction> MetaFontAction::Clone() const
1828 return new MetaFontAction( *this );
1831 void MetaFontAction::Scale( double fScaleX, double fScaleY )
1833 const Size aSize(
1834 basegfx::fround<tools::Long>(maFont.GetFontSize().Width() * fabs(fScaleX)),
1835 basegfx::fround<tools::Long>(maFont.GetFontSize().Height() * fabs(fScaleY)));
1836 maFont.SetFontSize( aSize );
1839 MetaPushAction::MetaPushAction() :
1840 MetaAction ( MetaActionType::PUSH ),
1841 mnFlags ( vcl::PushFlags::NONE )
1844 MetaPushAction::~MetaPushAction()
1847 MetaPushAction::MetaPushAction( vcl::PushFlags nFlags ) :
1848 MetaAction ( MetaActionType::PUSH ),
1849 mnFlags ( nFlags )
1852 void MetaPushAction::Execute( OutputDevice* pOut )
1854 pOut->Push( mnFlags );
1857 rtl::Reference<MetaAction> MetaPushAction::Clone() const
1859 return new MetaPushAction( *this );
1862 MetaPopAction::MetaPopAction() :
1863 MetaAction(MetaActionType::POP)
1866 MetaPopAction::~MetaPopAction()
1869 void MetaPopAction::Execute( OutputDevice* pOut )
1871 pOut->Pop();
1874 rtl::Reference<MetaAction> MetaPopAction::Clone() const
1876 return new MetaPopAction( *this );
1879 MetaRasterOpAction::MetaRasterOpAction() :
1880 MetaAction ( MetaActionType::RASTEROP ),
1881 meRasterOp ( RasterOp::OverPaint )
1884 MetaRasterOpAction::~MetaRasterOpAction()
1887 MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp ) :
1888 MetaAction ( MetaActionType::RASTEROP ),
1889 meRasterOp ( eRasterOp )
1893 void MetaRasterOpAction::Execute( OutputDevice* pOut )
1895 pOut->SetRasterOp( meRasterOp );
1898 rtl::Reference<MetaAction> MetaRasterOpAction::Clone() const
1900 return new MetaRasterOpAction( *this );
1903 MetaTransparentAction::MetaTransparentAction() :
1904 MetaAction ( MetaActionType::Transparent ),
1905 mnTransPercent ( 0 )
1908 MetaTransparentAction::~MetaTransparentAction()
1911 MetaTransparentAction::MetaTransparentAction( tools::PolyPolygon aPolyPoly, sal_uInt16 nTransPercent ) :
1912 MetaAction ( MetaActionType::Transparent ),
1913 maPolyPoly (std::move( aPolyPoly )),
1914 mnTransPercent ( nTransPercent )
1917 void MetaTransparentAction::Execute( OutputDevice* pOut )
1919 pOut->DrawTransparent( maPolyPoly, mnTransPercent );
1922 rtl::Reference<MetaAction> MetaTransparentAction::Clone() const
1924 return new MetaTransparentAction( *this );
1927 void MetaTransparentAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1929 maPolyPoly.Move( nHorzMove, nVertMove );
1932 void MetaTransparentAction::Scale( double fScaleX, double fScaleY )
1934 for( sal_uInt16 i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
1935 ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
1938 MetaFloatTransparentAction::MetaFloatTransparentAction() :
1939 MetaAction(MetaActionType::FLOATTRANSPARENT)
1942 MetaFloatTransparentAction::~MetaFloatTransparentAction()
1945 MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos,
1946 const Size& rSize, Gradient aGradient ) :
1947 MetaAction ( MetaActionType::FLOATTRANSPARENT ),
1948 maMtf ( rMtf ),
1949 maPoint ( rPos ),
1950 maSize ( rSize ),
1951 maGradient (std::move( aGradient ))
1954 void MetaFloatTransparentAction::Execute( OutputDevice* pOut )
1956 pOut->DrawTransparent( maMtf, maPoint, maSize, maGradient );
1959 rtl::Reference<MetaAction> MetaFloatTransparentAction::Clone() const
1961 return new MetaFloatTransparentAction( *this );
1964 void MetaFloatTransparentAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
1966 maPoint.Move( nHorzMove, nVertMove );
1969 void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
1971 tools::Rectangle aRectangle(maPoint, maSize);
1972 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1973 maPoint = aRectangle.TopLeft();
1974 maSize = aRectangle.GetSize();
1977 void MetaFloatTransparentAction::addSVGTransparencyColorStops(const basegfx::BColorStops& rSVGTransparencyColorStops)
1979 maSVGTransparencyColorStops = rSVGTransparencyColorStops;
1982 MetaEPSAction::MetaEPSAction() :
1983 MetaAction(MetaActionType::EPS)
1986 MetaEPSAction::~MetaEPSAction()
1989 MetaEPSAction::MetaEPSAction( const Point& rPoint, const Size& rSize,
1990 GfxLink aGfxLink, const GDIMetaFile& rSubst ) :
1991 MetaAction ( MetaActionType::EPS ),
1992 maGfxLink (std::move( aGfxLink )),
1993 maSubst ( rSubst ),
1994 maPoint ( rPoint ),
1995 maSize ( rSize )
1998 void MetaEPSAction::Execute( OutputDevice* pOut )
2000 pOut->DrawEPS( maPoint, maSize, maGfxLink, &maSubst );
2003 rtl::Reference<MetaAction> MetaEPSAction::Clone() const
2005 return new MetaEPSAction( *this );
2008 void MetaEPSAction::Move( tools::Long nHorzMove, tools::Long nVertMove )
2010 maPoint.Move( nHorzMove, nVertMove );
2013 void MetaEPSAction::Scale( double fScaleX, double fScaleY )
2015 tools::Rectangle aRectangle(maPoint, maSize);
2016 ImplScaleRect( aRectangle, fScaleX, fScaleY );
2017 maPoint = aRectangle.TopLeft();
2018 maSize = aRectangle.GetSize();
2021 MetaRefPointAction::MetaRefPointAction() :
2022 MetaAction ( MetaActionType::REFPOINT ),
2023 mbSet ( false )
2026 MetaRefPointAction::~MetaRefPointAction()
2029 MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, bool bSet ) :
2030 MetaAction ( MetaActionType::REFPOINT ),
2031 maRefPoint ( rRefPoint ),
2032 mbSet ( bSet )
2035 void MetaRefPointAction::Execute( OutputDevice* pOut )
2037 if( mbSet )
2038 pOut->SetRefPoint( maRefPoint );
2039 else
2040 pOut->SetRefPoint();
2043 rtl::Reference<MetaAction> MetaRefPointAction::Clone() const
2045 return new MetaRefPointAction( *this );
2048 MetaCommentAction::MetaCommentAction() :
2049 MetaAction ( MetaActionType::COMMENT ),
2050 mnValue ( 0 )
2052 ImplInitDynamicData( nullptr, 0UL );
2055 MetaCommentAction::MetaCommentAction( const MetaCommentAction& rAct ) :
2056 MetaAction ( MetaActionType::COMMENT ),
2057 maComment ( rAct.maComment ),
2058 mnValue ( rAct.mnValue )
2060 ImplInitDynamicData( rAct.mpData.get(), rAct.mnDataSize );
2063 MetaCommentAction::MetaCommentAction( OString aComment, sal_Int32 nValue, const sal_uInt8* pData, sal_uInt32 nDataSize ) :
2064 MetaAction ( MetaActionType::COMMENT ),
2065 maComment (std::move( aComment )),
2066 mnValue ( nValue )
2068 ImplInitDynamicData( pData, nDataSize );
2071 MetaCommentAction::~MetaCommentAction()
2075 void MetaCommentAction::ImplInitDynamicData( const sal_uInt8* pData, sal_uInt32 nDataSize )
2077 if ( nDataSize && pData )
2079 mnDataSize = nDataSize;
2080 mpData.reset( new sal_uInt8[ mnDataSize ] );
2081 memcpy( mpData.get(), pData, mnDataSize );
2083 else
2085 mnDataSize = 0;
2086 mpData = nullptr;
2090 void MetaCommentAction::Execute( OutputDevice* pOut )
2092 if ( pOut->GetConnectMetaFile() )
2094 pOut->GetConnectMetaFile()->AddAction( this );
2098 rtl::Reference<MetaAction> MetaCommentAction::Clone() const
2100 return new MetaCommentAction( *this );
2103 void MetaCommentAction::Move( tools::Long nXMove, tools::Long nYMove )
2105 if ( !(nXMove || nYMove) )
2106 return;
2108 if ( !(mnDataSize && mpData) )
2109 return;
2111 bool bPathStroke = (maComment == "XPATHSTROKE_SEQ_BEGIN");
2112 if ( !(bPathStroke || maComment == "XPATHFILL_SEQ_BEGIN") )
2113 return;
2115 SvMemoryStream aMemStm( static_cast<void*>(mpData.get()), mnDataSize, StreamMode::READ );
2116 SvMemoryStream aDest;
2117 if ( bPathStroke )
2119 SvtGraphicStroke aStroke;
2120 ReadSvtGraphicStroke( aMemStm, aStroke );
2122 tools::Polygon aPath;
2123 aStroke.getPath( aPath );
2124 aPath.Move( nXMove, nYMove );
2125 aStroke.setPath( aPath );
2127 tools::PolyPolygon aStartArrow;
2128 aStroke.getStartArrow(aStartArrow);
2129 aStartArrow.Move(nXMove, nYMove);
2130 aStroke.setStartArrow(aStartArrow);
2132 tools::PolyPolygon aEndArrow;
2133 aStroke.getEndArrow(aEndArrow);
2134 aEndArrow.Move(nXMove, nYMove);
2135 aStroke.setEndArrow(aEndArrow);
2137 WriteSvtGraphicStroke( aDest, aStroke );
2139 else
2141 SvtGraphicFill aFill;
2142 ReadSvtGraphicFill( aMemStm, aFill );
2144 tools::PolyPolygon aPath;
2145 aFill.getPath( aPath );
2146 aPath.Move( nXMove, nYMove );
2147 aFill.setPath( aPath );
2149 WriteSvtGraphicFill( aDest, aFill );
2151 mpData.reset();
2152 ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
2155 // SJ: 25.07.06 #i56656# we are not able to mirror certain kind of
2156 // comments properly, especially the XPATHSTROKE and XPATHFILL lead to
2157 // problems, so it is better to remove these comments when mirroring
2158 // FIXME: fake comment to apply the next hunk in the right location
2159 void MetaCommentAction::Scale( double fXScale, double fYScale )
2161 if (( fXScale == 1.0 ) && ( fYScale == 1.0 ))
2162 return;
2164 if ( !(mnDataSize && mpData) )
2165 return;
2167 bool bPathStroke = (maComment == "XPATHSTROKE_SEQ_BEGIN");
2168 if ( bPathStroke || maComment == "XPATHFILL_SEQ_BEGIN" )
2170 SvMemoryStream aMemStm( static_cast<void*>(mpData.get()), mnDataSize, StreamMode::READ );
2171 SvMemoryStream aDest;
2172 if ( bPathStroke )
2174 SvtGraphicStroke aStroke;
2175 ReadSvtGraphicStroke( aMemStm, aStroke );
2176 aStroke.scale( fXScale, fYScale );
2177 WriteSvtGraphicStroke( aDest, aStroke );
2179 else
2181 SvtGraphicFill aFill;
2182 ReadSvtGraphicFill( aMemStm, aFill );
2183 tools::PolyPolygon aPath;
2184 aFill.getPath( aPath );
2185 aPath.Scale( fXScale, fYScale );
2186 aFill.setPath( aPath );
2187 WriteSvtGraphicFill( aDest, aFill );
2189 mpData.reset();
2190 ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
2191 } else if( maComment == "EMF_PLUS_HEADER_INFO" ){
2192 SvMemoryStream aMemStm( static_cast<void*>(mpData.get()), mnDataSize, StreamMode::READ );
2193 SvMemoryStream aDest;
2195 sal_Int32 nLeft(0), nRight(0), nTop(0), nBottom(0);
2196 sal_Int32 nPixX(0), nPixY(0), nMillX(0), nMillY(0);
2197 float m11(0), m12(0), m21(0), m22(0), mdx(0), mdy(0);
2199 // read data
2200 aMemStm.ReadInt32( nLeft ).ReadInt32( nTop ).ReadInt32( nRight ).ReadInt32( nBottom );
2201 aMemStm.ReadInt32( nPixX ).ReadInt32( nPixY ).ReadInt32( nMillX ).ReadInt32( nMillY );
2202 aMemStm.ReadFloat( m11 ).ReadFloat( m12 ).ReadFloat( m21 ).ReadFloat( m22 ).ReadFloat( mdx ).ReadFloat( mdy );
2204 // add scale to the transformation
2205 m11 *= fXScale;
2206 m12 *= fXScale;
2207 m22 *= fYScale;
2208 m21 *= fYScale;
2210 // prepare new data
2211 aDest.WriteInt32( nLeft ).WriteInt32( nTop ).WriteInt32( nRight ).WriteInt32( nBottom );
2212 aDest.WriteInt32( nPixX ).WriteInt32( nPixY ).WriteInt32( nMillX ).WriteInt32( nMillY );
2213 aDest.WriteFloat( m11 ).WriteFloat( m12 ).WriteFloat( m21 ).WriteFloat( m22 ).WriteFloat( mdx ).WriteFloat( mdy );
2215 // save them
2216 ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
2220 MetaLayoutModeAction::MetaLayoutModeAction() :
2221 MetaAction ( MetaActionType::LAYOUTMODE ),
2222 mnLayoutMode( vcl::text::ComplexTextLayoutFlags::Default )
2225 MetaLayoutModeAction::~MetaLayoutModeAction()
2228 MetaLayoutModeAction::MetaLayoutModeAction( vcl::text::ComplexTextLayoutFlags nLayoutMode ) :
2229 MetaAction ( MetaActionType::LAYOUTMODE ),
2230 mnLayoutMode( nLayoutMode )
2233 void MetaLayoutModeAction::Execute( OutputDevice* pOut )
2235 pOut->SetLayoutMode( mnLayoutMode );
2238 rtl::Reference<MetaAction> MetaLayoutModeAction::Clone() const
2240 return new MetaLayoutModeAction( *this );
2243 MetaTextLanguageAction::MetaTextLanguageAction() :
2244 MetaAction ( MetaActionType::TEXTLANGUAGE ),
2245 meTextLanguage( LANGUAGE_DONTKNOW )
2248 MetaTextLanguageAction::~MetaTextLanguageAction()
2251 MetaTextLanguageAction::MetaTextLanguageAction( LanguageType eTextLanguage ) :
2252 MetaAction ( MetaActionType::TEXTLANGUAGE ),
2253 meTextLanguage( eTextLanguage )
2256 void MetaTextLanguageAction::Execute( OutputDevice* pOut )
2258 pOut->SetDigitLanguage( meTextLanguage );
2261 rtl::Reference<MetaAction> MetaTextLanguageAction::Clone() const
2263 return new MetaTextLanguageAction( *this );
2266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */