22#include <osl/thread.h>
40void ImplScalePoint( Point& rPt,
double fScaleX,
double fScaleY )
42 rPt.setX(
FRound( fScaleX * rPt.X() ) );
43 rPt.setY(
FRound( fScaleY * rPt.Y() ) );
51 ImplScalePoint( aTL, fScaleX, fScaleY );
52 ImplScalePoint( aBR, fScaleX, fScaleY );
58void ImplScalePoly(
tools::Polygon& rPoly,
double fScaleX,
double fScaleY )
60 for( sal_uInt16 i = 0, nCount = rPoly.
GetSize(); i < nCount; i++ )
61 ImplScalePoint( rPoly[ i ], fScaleX, fScaleY );
64void ImplScaleLineInfo(
LineInfo& rLineInfo,
double fScaleX,
double fScaleY )
66 if( !rLineInfo.IsDefault() )
68 const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
70 rLineInfo.SetWidth(
FRound( fScale * rLineInfo.GetWidth() ) );
71 rLineInfo.SetDashLen(
FRound( fScale * rLineInfo.GetDashLen() ) );
72 rLineInfo.SetDotLen(
FRound( fScale * rLineInfo.GetDotLen() ) );
73 rLineInfo.SetDistance(
FRound( fScale * rLineInfo.GetDistance() ) );
140 maPt.Move( nHorzMove, nVertMove );
145 ImplScalePoint(
maPt, fScaleX, fScaleY );
172 maPt.Move( nHorzMove, nVertMove );
177 ImplScalePoint(
maPt, fScaleX, fScaleY );
189 maStartPt ( rStart ),
196 maLineInfo ( rLineInfo ),
197 maStartPt ( rStart ),
217 maEndPt.Move( nHorzMove, nVertMove );
222 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
223 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
224 ImplScaleLineInfo(
maLineInfo, fScaleX, fScaleY );
256 ImplScaleRect(
maRect, fScaleX, fScaleY );
269 sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) :
272 mnHorzRound ( nHorzRound ),
273 mnVertRound ( nVertRound )
293 ImplScaleRect(
maRect, fScaleX, fScaleY );
327 ImplScaleRect(
maRect, fScaleX, fScaleY );
338 const Point& rStart,
const Point& rEnd ) :
341 maStartPt ( rStart ),
359 maEndPt.Move( nHorzMove, nVertMove );
364 ImplScaleRect(
maRect, fScaleX, fScaleY );
365 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
366 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
377 const Point& rStart,
const Point& rEnd ) :
380 maStartPt ( rStart ),
398 maEndPt.Move( nHorzMove, nVertMove );
403 ImplScaleRect(
maRect, fScaleX, fScaleY );
404 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
405 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
416 const Point& rStart,
const Point& rEnd ) :
419 maStartPt ( rStart ),
437 maEndPt.Move( nHorzMove, nVertMove );
442 ImplScaleRect(
maRect, fScaleX, fScaleY );
443 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
444 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
461 maLineInfo ( rLineInfo ),
485 ImplScalePoly(
maPoly, fScaleX, fScaleY );
486 ImplScaleLineInfo(
maLineInfo, fScaleX, fScaleY );
518 ImplScalePoly(
maPoly, fScaleX, fScaleY );
530 maPolyPoly ( rPolyPoly )
551 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
564 sal_Int32 nIndex, sal_Int32 nLen ) :
584 maPt.Move( nHorzMove, nVertMove );
589 ImplScalePoint(
maPt, fScaleX, fScaleY );
592MetaTextArrayAction::MetaTextArrayAction() :
598MetaTextArrayAction::MetaTextArrayAction(
const MetaTextArrayAction& rAction ) :
600 maStartPt ( rAction.maStartPt ),
601 maStr ( rAction.maStr ),
602 maDXAry ( rAction.maDXAry ),
604 mnLen ( rAction.mnLen )
608MetaTextArrayAction::MetaTextArrayAction(
const Point& rStartPt,
609 const OUString& rStr,
610 const std::vector<sal_Int32>& rDXAry,
614 maStartPt ( rStartPt ),
622MetaTextArrayAction::MetaTextArrayAction(
const Point& rStartPt,
623 const OUString& rStr,
628 maStartPt ( rStartPt ),
630 maDXAry ( pDXAry.
begin(), pDXAry.
end() ),
636MetaTextArrayAction::~MetaTextArrayAction()
642 pOut->DrawTextArray( maStartPt, maStr, maDXAry, mnIndex, mnLen );
647 return new MetaTextArrayAction( *
this );
652 maStartPt.Move( nHorzMove, nVertMove );
655void MetaTextArrayAction::Scale(
double fScaleX,
double fScaleY )
657 ImplScalePoint( maStartPt, fScaleX, fScaleY );
659 if ( !maDXAry.empty() && mnLen )
661 for ( sal_uInt16 i = 0, nCount = mnLen;
i <
nCount;
i++ )
662 maDXAry[ i ] =
FRound( maDXAry[ i ] * fabs(fScaleX) );
666void MetaTextArrayAction::SetDXArray(std::vector<sal_Int32> aArray)
668 maDXAry = std::move(aArray);
682 const OUString& rStr,
683 sal_Int32 nIndex, sal_Int32 nLen ) :
704 maPt.Move( nHorzMove, nVertMove );
709 ImplScalePoint(
maPt, fScaleX, fScaleY );
745 ImplScaleRect(
maRect, fScaleX, fScaleY );
766 meStrikeout ( eStrikeout ),
767 meUnderline ( eUnderline ),
768 meOverline ( eOverline )
783 maPos.Move( nHorzMove, nVertMove );
788 ImplScalePoint(
maPos, fScaleX, fScaleY );
817 maPt.Move( nHorzMove, nVertMove );
822 ImplScalePoint(
maPt, fScaleX, fScaleY );
844 constexpr int nMaxScaleWhenFuzzing = 512;
846 auto nSourceHeight = rSource.
Height();
847 auto nDestHeight = rDest.
Height();
848 if (nSourceHeight && nDestHeight > nSourceHeight && nDestHeight / nSourceHeight > nMaxScaleWhenFuzzing)
850 SAL_WARN(
"vcl",
"skipping large vertical scaling: " << nSourceHeight <<
" to " << nDestHeight);
854 if (nDestHeight && nSourceHeight > nDestHeight && nSourceHeight / nDestHeight > nMaxScaleWhenFuzzing)
856 SAL_WARN(
"vcl",
"skipping large vertical scaling: " << nSourceHeight <<
" to " << nDestHeight);
860 auto nSourceWidth = rSource.
Width();
861 auto nDestWidth = rDest.
Width();
862 if (nSourceWidth && nDestWidth > nSourceWidth && nDestWidth / nSourceWidth > nMaxScaleWhenFuzzing)
864 SAL_WARN(
"vcl",
"skipping large horizontal scaling: " << nSourceWidth <<
" to " << nDestWidth);
868 if (nDestWidth && nSourceWidth > nDestWidth && nSourceWidth / nDestWidth > nMaxScaleWhenFuzzing)
870 SAL_WARN(
"vcl",
"skipping large horizontal scaling: " << nSourceWidth <<
" to " << nDestWidth);
893 maPt.Move( nHorzMove, nVertMove );
899 ImplScaleRect( aRectangle, fScaleX, fScaleY );
904MetaBmpScalePartAction::MetaBmpScalePartAction() :
908MetaBmpScalePartAction::~MetaBmpScalePartAction()
911MetaBmpScalePartAction::MetaBmpScalePartAction(
const Point& rDstPt,
const Size& rDstSz,
912 const Point& rSrcPt,
const Size& rSrcSz,
922void MetaBmpScalePartAction::Execute(
OutputDevice* pOut )
924 pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
929 return new MetaBmpScalePartAction( *
this );
934 maDstPt.Move( nHorzMove, nVertMove );
937void MetaBmpScalePartAction::Scale(
double fScaleX,
double fScaleY )
940 ImplScaleRect( aRectangle, fScaleX, fScaleY );
941 maDstPt = aRectangle.TopLeft();
942 maDstSz = aRectangle.GetSize();
970 maPt.Move( nHorzMove, nVertMove );
975 ImplScalePoint(
maPt, fScaleX, fScaleY );
1008 maPt.Move( nHorzMove, nVertMove );
1014 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1019MetaBmpExScalePartAction::MetaBmpExScalePartAction() :
1023MetaBmpExScalePartAction::~MetaBmpExScalePartAction()
1026MetaBmpExScalePartAction::MetaBmpExScalePartAction(
const Point& rDstPt,
const Size& rDstSz,
1027 const Point& rSrcPt,
const Size& rSrcSz,
1037void MetaBmpExScalePartAction::Execute(
OutputDevice* pOut )
1039 pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
1044 return new MetaBmpExScalePartAction( *
this );
1049 maDstPt.Move( nHorzMove, nVertMove );
1052void MetaBmpExScalePartAction::Scale(
double fScaleX,
double fScaleY )
1055 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1056 maDstPt = aRectangle.TopLeft();
1057 maDstSz = aRectangle.GetSize();
1069 const Color& rColor ) :
1088 maPt.Move( nHorzMove, nVertMove );
1093 ImplScalePoint(
maPt, fScaleX, fScaleY );
1105 const Color& rColor ) :
1125 maPt.Move( nHorzMove, nVertMove );
1131 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1144 const Point& rSrcPt,
const Size& rSrcSz,
1146 const Color& rColor ) :
1168 maDstPt.Move( nHorzMove, nVertMove );
1174 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1189 maGradient ( rGradient )
1209 ImplScaleRect(
maRect, fScaleX, fScaleY );
1218 maPolyPoly ( rPolyPoly ),
1219 maGradient ( rGradient )
1227 if(
pOut->GetConnectMetaFile() )
1229 pOut->GetConnectMetaFile()->AddAction(
this );
1246 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1258 maPolyPoly ( rPolyPoly ),
1280 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1283MetaWallpaperAction::MetaWallpaperAction() :
1287MetaWallpaperAction::~MetaWallpaperAction()
1294 maWallpaper ( rPaper )
1299 pOut->DrawWallpaper( maRect, maWallpaper );
1304 return new MetaWallpaperAction( *
this );
1309 maRect.Move( nHorzMove, nVertMove );
1312void MetaWallpaperAction::Scale(
double fScaleX,
double fScaleY )
1314 ImplScaleRect( maRect, fScaleX, fScaleY );
1327 maRegion ( rRegion ),
1336 pOut->SetClipRegion();
1383 ImplScaleRect(
maRect, fScaleX, fScaleY );
1395 maRegion ( rRegion )
1430 mnHorzMove ( nHorzMove ),
1431 mnVertMove ( nVertMove )
1469 pOut->SetLineColor();
1496 pOut->SetFillColor();
1545 pOut->SetTextFillColor();
1572 pOut->SetTextLineColor();
1599 pOut->SetOverlineColor();
1639 maMapMode ( rMapMode )
1656 ImplScalePoint( aPoint, fScaleX, fScaleY );
1750 meRasterOp ( eRasterOp )
1766 mnTransPercent ( 0 )
1774 maPolyPoly ( rPolyPoly ),
1775 mnTransPercent ( nTransPercent )
1796 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1812 maGradient ( rGradient )
1827 maPoint.Move( nHorzMove, nVertMove );
1833 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1848 maGfxLink ( rGfxLink ),
1866 maPoint.Move( nHorzMove, nVertMove );
1872 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1887 maRefPoint ( rRefPoint ),
1896 pOut->SetRefPoint();
1933 if ( nDataSize &&
pData )
1948 if (
pOut->GetConnectMetaFile() )
1950 pOut->GetConnectMetaFile()->AddAction(
this );
1961 if ( !(nXMove || nYMove) )
1967 bool bPathStroke = (
maComment ==
"XPATHSTROKE_SEQ_BEGIN");
1968 if ( !(bPathStroke ||
maComment ==
"XPATHFILL_SEQ_BEGIN") )
1980 aPath.
Move( nXMove, nYMove );
1985 aStartArrow.
Move(nXMove, nYMove);
1990 aEndArrow.
Move(nXMove, nYMove);
2002 aPath.
Move( nXMove, nYMove );
2017 if (( fXScale == 1.0 ) && ( fYScale == 1.0 ))
2023 bool bPathStroke = (
maComment ==
"XPATHSTROKE_SEQ_BEGIN");
2024 if ( bPathStroke ||
maComment ==
"XPATHFILL_SEQ_BEGIN" )
2032 aStroke.
scale( fXScale, fYScale );
2041 aPath.
Scale( fXScale, fYScale );
2047 }
else if(
maComment ==
"EMF_PLUS_HEADER_INFO" ){
2051 sal_Int32 nLeft(0), nRight(0), nTop(0), nBottom(0);
2052 sal_Int32 nPixX(0), nPixY(0), nMillX(0), nMillY(0);
2053 float m11(0), m12(0), m21(0), m22(0), mdx(0), mdy(0);
2086 mnLayoutMode( nLayoutMode )
2109 meTextLanguage( eTextLanguage )
const Size & GetSizePixel() const
Size GetSizePixel() const
void SetOrigin(const Point &rOrigin)
const Point & GetOrigin() const
virtual ~MetaStretchTextAction() override
virtual rtl::Reference< MetaAction > Clone() const override
virtual void Scale(double fScaleX, double fScaleY) override
virtual void Execute(OutputDevice *pOut) override
virtual void Move(tools::Long nHorzMove, tools::Long nVertMove) override
virtual void Scale(double fScaleX, double fScaleY) override
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextAction() override
virtual void Move(tools::Long nHorzMove, tools::Long nVertMove) override
virtual void Execute(OutputDevice *pOut) override
virtual ~MetaTextAlignAction() override
virtual void Execute(OutputDevice *pOut) override
virtual rtl::Reference< MetaAction > Clone() const override
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextColorAction() override
virtual void Execute(OutputDevice *pOut) override
MetaTextFillColorAction()
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextFillColorAction() override
virtual void Execute(OutputDevice *pOut) override
virtual ~MetaTextLanguageAction() override
LanguageType meTextLanguage
virtual void Execute(OutputDevice *pOut) override
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextLineAction() override
virtual void Move(tools::Long nHorzMove, tools::Long nVertMove) override
virtual void Execute(OutputDevice *pOut) override
virtual void Scale(double fScaleX, double fScaleY) override
FontStrikeout meStrikeout
FontLineStyle meUnderline
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextLineColorAction() override
MetaTextLineColorAction()
virtual void Execute(OutputDevice *pOut) override
virtual rtl::Reference< MetaAction > Clone() const override
virtual ~MetaTextRectAction() override
virtual rtl::Reference< MetaAction > Clone() const override
virtual void Execute(OutputDevice *pOut) override
virtual void Move(tools::Long nHorzMove, tools::Long nVertMove) override
virtual void Scale(double fScaleX, double fScaleY) override
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & ReadFloat(float &rFloat)
SvStream & WriteFloat(float nFloat)
SvStream & ReadInt32(sal_Int32 &rInt32)
Encapsulates geometry and associated attributes of a filled area.
void getPath(tools::PolyPolygon &) const
Query path to fill.
void setPath(const tools::PolyPolygon &rPath)
Set path to fill.
Encapsulates geometry and associated attributes of a graphical 'pen stroke'.
void getPath(tools::Polygon &) const
Query path to stroke.
void getStartArrow(tools::PolyPolygon &) const
Get the polygon that is put at the start of the line.
void getEndArrow(tools::PolyPolygon &) const
Get the polygon that is put at the end of the line.
void setEndArrow(const tools::PolyPolygon &)
Set the polygon that is put at the end of the line.
void setPath(const tools::Polygon &)
Set path to stroke.
void scale(double fScaleX, double fScaleY)
Affine scaling in both X and Y dimensions.
void setStartArrow(const tools::PolyPolygon &)
Set the polygon that is put at the start of the line.
void SetFontSize(const Size &)
const OUString & GetFamilyName() const
void SetCharSet(rtl_TextEncoding)
const Size & GetFontSize() const
rtl_TextEncoding GetCharSet() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Scale(double fScaleX, double fScaleY)
::basegfx::B2IVector maSize
UNOTOOLS_DLLPUBLIC bool IsStarSymbol(std::u16string_view rFontName)
tools::Long FRound(double fVal)
#define LANGUAGE_DONTKNOW
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
const sal_uInt16 TEXTCOLOR
enumrange< T >::Iterator begin(enumrange< T >)