22#include <osl/thread.h>
41void ImplScalePoint( Point& rPt,
double fScaleX,
double fScaleY )
43 rPt.setX(
FRound( fScaleX * rPt.X() ) );
44 rPt.setY(
FRound( fScaleY * rPt.Y() ) );
52 ImplScalePoint( aTL, fScaleX, fScaleY );
53 ImplScalePoint( aBR, fScaleX, fScaleY );
59void 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 );
65void ImplScaleLineInfo(
LineInfo& rLineInfo,
double fScaleX,
double fScaleY )
67 if( !rLineInfo.IsDefault() )
69 const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
71 rLineInfo.SetWidth(
FRound( fScale * rLineInfo.GetWidth() ) );
72 rLineInfo.SetDashLen(
FRound( fScale * rLineInfo.GetDashLen() ) );
73 rLineInfo.SetDotLen(
FRound( fScale * rLineInfo.GetDotLen() ) );
74 rLineInfo.SetDistance(
FRound( fScale * rLineInfo.GetDistance() ) );
141 maPt.Move( nHorzMove, nVertMove );
146 ImplScalePoint(
maPt, fScaleX, fScaleY );
173 maPt.Move( nHorzMove, nVertMove );
178 ImplScalePoint(
maPt, fScaleX, fScaleY );
190 maStartPt ( rStart ),
197 maLineInfo (
std::move( aLineInfo )),
198 maStartPt ( rStart ),
218 maEndPt.Move( nHorzMove, nVertMove );
223 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
224 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
225 ImplScaleLineInfo(
maLineInfo, fScaleX, fScaleY );
257 ImplScaleRect(
maRect, fScaleX, fScaleY );
270 sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) :
273 mnHorzRound ( nHorzRound ),
274 mnVertRound ( nVertRound )
294 ImplScaleRect(
maRect, fScaleX, fScaleY );
328 ImplScaleRect(
maRect, fScaleX, fScaleY );
339 const Point& rStart,
const Point& rEnd ) :
342 maStartPt ( rStart ),
360 maEndPt.Move( nHorzMove, nVertMove );
365 ImplScaleRect(
maRect, fScaleX, fScaleY );
366 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
367 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
378 const Point& rStart,
const Point& rEnd ) :
381 maStartPt ( rStart ),
399 maEndPt.Move( nHorzMove, nVertMove );
404 ImplScaleRect(
maRect, fScaleX, fScaleY );
405 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
406 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
417 const Point& rStart,
const Point& rEnd ) :
420 maStartPt ( rStart ),
438 maEndPt.Move( nHorzMove, nVertMove );
443 ImplScaleRect(
maRect, fScaleX, fScaleY );
444 ImplScalePoint(
maStartPt, fScaleX, fScaleY );
445 ImplScalePoint(
maEndPt, fScaleX, fScaleY );
457 maPoly (
std::move( aPoly ))
462 maLineInfo (
std::move( aLineInfo )),
463 maPoly (
std::move( aPoly ))
486 ImplScalePoly(
maPoly, fScaleX, fScaleY );
487 ImplScaleLineInfo(
maLineInfo, fScaleX, fScaleY );
499 maPoly (
std::move( aPoly ))
519 ImplScalePoly(
maPoly, fScaleX, fScaleY );
531 maPolyPoly (
std::move( aPolyPoly ))
552 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
565 sal_Int32 nIndex, sal_Int32 nLen ) :
578 if (nY > 0x20000000 || nY < -0x20000000)
580 SAL_WARN(
"vcl",
"skipping huge y: " << nY);
607 maPt.Move( nHorzMove, nVertMove );
612 ImplScalePoint(
maPt, fScaleX, fScaleY );
615MetaTextArrayAction::MetaTextArrayAction() :
621MetaTextArrayAction::MetaTextArrayAction(
const MetaTextArrayAction& rAction ) :
623 maStartPt ( rAction.maStartPt ),
624 maStr ( rAction.maStr ),
625 maDXAry ( rAction.maDXAry ),
626 maKashidaAry( rAction.maKashidaAry ),
628 mnLen ( rAction.mnLen )
632MetaTextArrayAction::MetaTextArrayAction(
const Point& rStartPt,
635 std::vector<sal_Bool> aKashidaAry,
639 maStartPt ( rStartPt ),
641 maDXAry (
std::move( aDXAry )),
642 maKashidaAry(
std::move( aKashidaAry )),
648MetaTextArrayAction::MetaTextArrayAction(
const Point& rStartPt,
655 maStartPt ( rStartPt ),
657 maKashidaAry( pKashidaAry.
begin(), pKashidaAry.
end() ),
661 maDXAry.assign(pDXAry);
664MetaTextArrayAction::~MetaTextArrayAction()
670 pOut->DrawTextArray( maStartPt, maStr, maDXAry, maKashidaAry, mnIndex, mnLen );
675 return new MetaTextArrayAction( *
this );
680 maStartPt.Move( nHorzMove, nVertMove );
683void MetaTextArrayAction::Scale(
double fScaleX,
double fScaleY )
685 ImplScalePoint( maStartPt, fScaleX, fScaleY );
687 if ( !maDXAry.empty() && mnLen )
689 for ( sal_uInt16 i = 0, nCount = mnLen;
i <
nCount;
i++ )
690 maDXAry.set(i,
FRound(maDXAry[i] * fabs(fScaleX)));
694void MetaTextArrayAction::SetDXArray(
KernArray aArray)
696 maDXAry = std::move(aArray);
699void MetaTextArrayAction::SetKashidaArray(std::vector<sal_Bool> aArray)
701 maKashidaAry = std::move(aArray);
716 sal_Int32 nIndex, sal_Int32 nLen ) :
740 maPt.Move( nHorzMove, nVertMove );
745 ImplScalePoint(
maPt, fScaleX, fScaleY );
784 ImplScaleRect(
maRect, fScaleX, fScaleY );
805 meStrikeout ( eStrikeout ),
806 meUnderline ( eUnderline ),
807 meOverline ( eOverline )
822 maPos.Move( nHorzMove, nVertMove );
827 ImplScalePoint(
maPos, fScaleX, fScaleY );
856 maPt.Move( nHorzMove, nVertMove );
861 ImplScalePoint(
maPt, fScaleX, fScaleY );
884 constexpr int nMaxScaleWhenFuzzing = 256;
886 auto nSourceHeight = rSource.
Height();
887 auto nDestHeight = rDest.
Height();
888 if (nSourceHeight && nDestHeight > nSourceHeight && nDestHeight / nSourceHeight > nMaxScaleWhenFuzzing)
890 SAL_WARN(
"vcl",
"skipping large vertical scaling: " << nSourceHeight <<
" to " << nDestHeight);
894 if (nDestHeight && nSourceHeight > nDestHeight && nSourceHeight / nDestHeight > nMaxScaleWhenFuzzing)
896 SAL_WARN(
"vcl",
"skipping large vertical scaling: " << nSourceHeight <<
" to " << nDestHeight);
900 auto nSourceWidth = rSource.
Width();
901 auto nDestWidth = rDest.
Width();
902 if (nSourceWidth && nDestWidth > nSourceWidth && nDestWidth / nSourceWidth > nMaxScaleWhenFuzzing)
904 SAL_WARN(
"vcl",
"skipping large horizontal scaling: " << nSourceWidth <<
" to " << nDestWidth);
908 if (nDestWidth && nSourceWidth > nDestWidth && nSourceWidth / nDestWidth > nMaxScaleWhenFuzzing)
910 SAL_WARN(
"vcl",
"skipping large horizontal scaling: " << nSourceWidth <<
" to " << nDestWidth);
933 maPt.Move( nHorzMove, nVertMove );
939 ImplScaleRect( aRectangle, fScaleX, fScaleY );
944MetaBmpScalePartAction::MetaBmpScalePartAction() :
948MetaBmpScalePartAction::~MetaBmpScalePartAction()
951MetaBmpScalePartAction::MetaBmpScalePartAction(
const Point& rDstPt,
const Size& rDstSz,
952 const Point& rSrcPt,
const Size& rSrcSz,
962void MetaBmpScalePartAction::Execute(
OutputDevice* pOut )
964 pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
969 return new MetaBmpScalePartAction( *
this );
974 maDstPt.Move( nHorzMove, nVertMove );
977void MetaBmpScalePartAction::Scale(
double fScaleX,
double fScaleY )
980 ImplScaleRect( aRectangle, fScaleX, fScaleY );
981 maDstPt = aRectangle.TopLeft();
982 maDstSz = aRectangle.GetSize();
1010 maPt.Move( nHorzMove, nVertMove );
1015 ImplScalePoint(
maPt, fScaleX, fScaleY );
1050 maPt.Move( nHorzMove, nVertMove );
1056 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1061MetaBmpExScalePartAction::MetaBmpExScalePartAction() :
1065MetaBmpExScalePartAction::~MetaBmpExScalePartAction()
1068MetaBmpExScalePartAction::MetaBmpExScalePartAction(
const Point& rDstPt,
const Size& rDstSz,
1069 const Point& rSrcPt,
const Size& rSrcSz,
1079void MetaBmpExScalePartAction::Execute(
OutputDevice* pOut )
1081 pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
1086 return new MetaBmpExScalePartAction( *
this );
1091 maDstPt.Move( nHorzMove, nVertMove );
1094void MetaBmpExScalePartAction::Scale(
double fScaleX,
double fScaleY )
1097 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1098 maDstPt = aRectangle.TopLeft();
1099 maDstSz = aRectangle.GetSize();
1111 const Color& rColor ) :
1130 maPt.Move( nHorzMove, nVertMove );
1135 ImplScalePoint(
maPt, fScaleX, fScaleY );
1147 const Color& rColor ) :
1169 maPt.Move( nHorzMove, nVertMove );
1175 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1188 const Point& rSrcPt,
const Size& rSrcSz,
1190 const Color& rColor ) :
1215 maDstPt.Move( nHorzMove, nVertMove );
1221 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1236 maGradient (
std::move( aGradient ))
1256 ImplScaleRect(
maRect, fScaleX, fScaleY );
1265 maPolyPoly (
std::move( aPolyPoly )),
1266 maGradient (
std::move( aGradient ))
1274 if(
pOut->GetConnectMetaFile() )
1276 pOut->GetConnectMetaFile()->AddAction(
this );
1293 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1305 maPolyPoly (
std::move( aPolyPoly )),
1327 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1330MetaWallpaperAction::MetaWallpaperAction() :
1334MetaWallpaperAction::~MetaWallpaperAction()
1341 maWallpaper ( rPaper )
1346 pOut->DrawWallpaper( maRect, maWallpaper );
1351 return new MetaWallpaperAction( *
this );
1356 maRect.Move( nHorzMove, nVertMove );
1359void MetaWallpaperAction::Scale(
double fScaleX,
double fScaleY )
1361 ImplScaleRect( maRect, fScaleX, fScaleY );
1374 maRegion (
std::move( aRegion )),
1383 pOut->SetClipRegion();
1430 ImplScaleRect(
maRect, fScaleX, fScaleY );
1442 maRegion (
std::move( aRegion ))
1477 mnHorzMove ( nHorzMove ),
1478 mnVertMove ( nVertMove )
1516 pOut->SetLineColor();
1543 pOut->SetFillColor();
1592 pOut->SetTextFillColor();
1619 pOut->SetTextLineColor();
1646 pOut->SetOverlineColor();
1686 maMapMode ( rMapMode )
1703 ImplScalePoint( aPoint, fScaleX, fScaleY );
1716 maFont (
std::move( aFont ))
1725 SAL_WARN_IF(
maFont.
GetCharSet() == RTL_TEXTENCODING_SYMBOL,
"vcl",
"OpenSymbol should not have charset of RTL_TEXTENCODING_SYMBOL in new documents");
1798 meRasterOp ( eRasterOp )
1814 mnTransPercent ( 0 )
1822 maPolyPoly (
std::move( aPolyPoly )),
1823 mnTransPercent ( nTransPercent )
1844 ImplScalePoly(
maPolyPoly[
i ], fScaleX, fScaleY );
1860 maGradient (
std::move( aGradient ))
1875 maPoint.Move( nHorzMove, nVertMove );
1881 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1896 maGfxLink (
std::move( aGfxLink )),
1914 maPoint.Move( nHorzMove, nVertMove );
1920 ImplScaleRect( aRectangle, fScaleX, fScaleY );
1935 maRefPoint ( rRefPoint ),
1944 pOut->SetRefPoint();
1981 if ( nDataSize &&
pData )
1996 if (
pOut->GetConnectMetaFile() )
1998 pOut->GetConnectMetaFile()->AddAction(
this );
2009 if ( !(nXMove || nYMove) )
2015 bool bPathStroke = (
maComment ==
"XPATHSTROKE_SEQ_BEGIN");
2016 if ( !(bPathStroke ||
maComment ==
"XPATHFILL_SEQ_BEGIN") )
2028 aPath.
Move( nXMove, nYMove );
2033 aStartArrow.
Move(nXMove, nYMove);
2038 aEndArrow.
Move(nXMove, nYMove);
2050 aPath.
Move( nXMove, nYMove );
2065 if (( fXScale == 1.0 ) && ( fYScale == 1.0 ))
2071 bool bPathStroke = (
maComment ==
"XPATHSTROKE_SEQ_BEGIN");
2072 if ( bPathStroke ||
maComment ==
"XPATHFILL_SEQ_BEGIN" )
2080 aStroke.
scale( fXScale, fYScale );
2089 aPath.
Scale( fXScale, fYScale );
2095 }
else if(
maComment ==
"EMF_PLUS_HEADER_INFO" ){
2099 sal_Int32 nLeft(0), nRight(0), nTop(0), nBottom(0);
2100 sal_Int32 nPixX(0), nPixY(0), nMillX(0), nMillY(0);
2101 float m11(0), m12(0), m21(0), m22(0), mdx(0), mdy(0);
2134 mnLayoutMode( nLayoutMode )
2157 meTextLanguage( eTextLanguage )
geometry::RealSize2D maSize
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)
UNOTOOLS_DLLPUBLIC bool IsOpenSymbol(std::u16string_view rFontName)
tools::Long FRound(double fVal)
#define LANGUAGE_DONTKNOW
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
const sal_uInt16 TEXTCOLOR
enumrange< T >::Iterator begin(enumrange< T >)