36 #define WIN_EMR_POLYGON 3
37 #define WIN_EMR_POLYLINE 4
38 #define WIN_EMR_POLYBEZIERTO 5
39 #define WIN_EMR_POLYLINETO 6
40 #define WIN_EMR_POLYPOLYGON 8
41 #define WIN_EMR_SETWINDOWEXTEX 9
42 #define WIN_EMR_SETWINDOWORGEX 10
43 #define WIN_EMR_SETVIEWPORTEXTEX 11
44 #define WIN_EMR_SETVIEWPORTORGEX 12
45 #define WIN_EMR_EOF 14
46 #define WIN_EMR_SETPIXELV 15
47 #define WIN_EMR_SETMAPMODE 17
48 #define WIN_EMR_SETBKMODE 18
49 #define WIN_EMR_SETROP2 20
50 #define WIN_EMR_SETTEXTALIGN 22
51 #define WIN_EMR_SETTEXTCOLOR 24
52 #define WIN_EMR_MOVETOEX 27
53 #define WIN_EMR_INTERSECTCLIPRECT 30
54 #define WIN_EMR_SAVEDC 33
55 #define WIN_EMR_RESTOREDC 34
56 #define WIN_EMR_SELECTOBJECT 37
57 #define WIN_EMR_CREATEPEN 38
58 #define WIN_EMR_CREATEBRUSHINDIRECT 39
59 #define WIN_EMR_DELETEOBJECT 40
60 #define WIN_EMR_ELLIPSE 42
61 #define WIN_EMR_RECTANGLE 43
62 #define WIN_EMR_ROUNDRECT 44
63 #define WIN_EMR_LINETO 54
64 #define WIN_EMR_BEGINPATH 59
65 #define WIN_EMR_ENDPATH 60
66 #define WIN_EMR_CLOSEFIGURE 61
67 #define WIN_EMR_FILLPATH 62
68 #define WIN_EMR_STROKEPATH 64
70 #define WIN_EMR_GDICOMMENT 70
71 #define WIN_EMR_STRETCHDIBITS 81
72 #define WIN_EMR_EXTCREATEFONTINDIRECTW 82
73 #define WIN_EMR_EXTTEXTOUTW 84
75 #define WIN_SRCCOPY 0x00CC0020L
76 #define WIN_SRCPAINT 0x00EE0086L
77 #define WIN_SRCAND 0x008800C6L
78 #define WIN_SRCINVERT 0x00660046L
79 #define WIN_EMR_COMMENT_EMFPLUS 0x2B464D45L
81 #define HANDLE_INVALID 0xffffffff
82 #define MAXHANDLES 65000
84 #define LINE_SELECT 0x00000001
85 #define FILL_SELECT 0x00000002
86 #define TEXT_SELECT 0x00000004
93 #define TA_BASELINE 24
94 #define TA_RTLREADING 256
96 #define MM_ANISOTROPIC 8
169 sal_Int32 nDPIX = rMtfSizePix.
Width()*25;
170 sal_Int32 nDivX = rMtfSizeLog.
Width()/100;
174 sal_Int32 nDPIY = rMtfSizePix.
Height()*25;
175 sal_Int32 nDivY = rMtfSizeLog.
Height()/100;
208 sal_uInt32 nAlpha = ((100-nTrans)*0xFF)/100;
209 sal_uInt32 nCol = rColor.
GetBlue();
211 nCol |=
static_cast<sal_uInt32
>(rColor.
GetGreen()) << 8;
212 nCol |=
static_cast<sal_uInt32
>(rColor.
GetRed()) << 16;
213 nCol |= ( nAlpha << 24 );
232 for( sal_uInt16
i = 0;
i < rPoly.
GetSize();
i++ )
243 maVDev->EnableOutput(
false );
313 .WriteInt32( aMtfSizeLog.
Width() / 100 ).WriteInt32( aMtfSizeLog.
Height() / 100 )
369 sal_Int32 nFillBytes, nActPos =
m_rStm.
Tell();
377 while( nFillBytes-- )
388 sal_uInt32 nStockObject = 0x80000000;
391 nStockObject |= 0x00000007;
393 nStockObject |= 0x00000001;
395 nStockObject |= 0x0000000a;
421 sal_uInt32 nStyle =
maVDev->IsLineColor() ? 0 : 5;
438 sal_uInt32 nStyle =
maVDev->IsFillColor() ? 0 : 1;
468 const bool bFontScaledHorizontally(nFontWidth != 0 && nFontWidth != nFontHeight);
470 if(bFontScaledHorizontally)
479 const double fScaleFactor(static_cast<double>(nAverageFontWidth) / static_cast<double>(nFontHeight));
480 nFontWidth =
static_cast<tools::Long>(
static_cast<double>(nFontWidth) * fScaleFactor);
503 default: nWeight = 0;
break;
517 default: nPitchAndFamily = 0x00;
break;
532 for( i = 0; i < 32; i++ )
536 for( i = 0; i < 64; i++ )
540 for( i = 0; i < 32; i++ )
561 sal_uInt32 nTextAlign;
588 sal_uInt32 nCol = rColor.
GetRed();
590 nCol |=
static_cast<sal_uInt32
>(rColor.
GetGreen()) << 8;
591 nCol |=
static_cast<sal_uInt32
>(rColor.
GetBlue()) << 16;
604 default: nROP2 = 13;
break;
637 .WriteInt32( aRect.
Top() )
660 for( sal_uInt16
i = 0;
i < rPoly.
GetSize();
i++ )
669 sal_uInt16
n,
i, nPolyCount = rPolyPoly.
Count();
674 if( 1 == nPolyCount )
678 bool bHasFlags =
false;
679 sal_uInt32 nTotalPoints = 0;
681 for( i = 0; i < nPolyCount; i++ )
683 nTotalPoints += rPolyPoly[ i ].GetSize();
684 if ( rPolyPoly[ i ].HasFlags() )
700 for( i = 0; i < nPolyCount; i++ )
703 for( i = 0; i < nPolyCount; i++ )
707 for( n = 0; n < rPoly.
GetSize(); n++ )
725 sal_uInt16
i,
n, o, nPolyCount = rPolyPoly.
Count();
726 for ( i = 0; i < nPolyCount; i++ )
741 sal_uInt16 nBezPoints = 0;
743 while ( ( ( nBezPoints + n + 2 ) < rPoly.
GetSize() ) && ( rPoly.
GetFlags( nBezPoints + n ) == PolyFlags::Control ) )
750 aNewPoly[ 0 ] = rPoly[ n - 1 ];
751 for ( o = 0; o < nBezPoints; o++ )
752 aNewPoly[ o + 1 ] = rPoly[ n + o ];
755 for( o = 1; o < aNewPoly.
GetSize(); o++ )
762 sal_uInt16 nPoints = 1;
763 while( ( nPoints + n ) < rPoly.
GetSize() && ( rPoly.
GetFlags( nPoints + n ) != PolyFlags::Control ) )
770 aNewPoly[ 0 ] = rPoly[ n - 1];
771 for ( o = 1; o <= nPoints; o++ )
772 aNewPoly[ o ] = rPoly[ n - 1 + o ];
775 for( o = 1; o < aNewPoly.
GetSize(); o++ )
787 if ( bClosed && ( n == rPoly.
GetSize() ) )
802 const Size& rSz, sal_uInt32 nROP )
822 WriteDIB(rBmp, aMemStm,
true,
false);
824 sal_uInt32 nDIBSize = aMemStm.
Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
838 nPalCount = nColsUsed;
840 nPalCount = 1 <<
static_cast<sal_uInt32
>(
nBitCount);
850 sal_uInt32 nPalSize = nPalCount * 4;
866 sal_Int32 nLen = rText.getLength(),
i;
871 sal_uInt32 nNormWidth;
872 std::unique_ptr<tools::Long[]> pOwnArray;
878 nNormWidth =
maVDev->GetTextWidth( rText );
884 nNormWidth =
maVDev->GetTextArray( rText, pOwnArray.get() );
885 pDX = pOwnArray.
get();
890 nNormWidth = pDX[ nLen - 2 ] +
maVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
892 if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
894 const double fFactor =
static_cast<double>(nWidth) / nNormWidth;
896 for(
i = 0;
i < ( nLen - 1 );
i++ )
897 pDX[
i ] =
FRound( pDX[
i ] * fFactor );
913 for(
i = 0;
i < nLen;
i++ )
925 for( i = 1; i < ( nLen - 1 ); i++ )
937 if(!rLinePolygon.
count())
943 rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
945 if(aLinePolyPolygon.
count())
947 for(
auto const& rB2DPolygon : aLinePolyPolygon)
953 if(!aFillPolyPolygon.
count())
960 maVDev->SetFillColor(aOldLineColor);
962 for(
auto const& rB2DPolygon : aFillPolyPolygon)
967 maVDev->SetLineColor(aOldLineColor);
968 maVDev->SetFillColor(aOldFillColor);
973 for(
size_t j = 0, nActionCount = rMtf.
GetActionSize(); j < nActionCount; j++ )
982 const MetaPixelAction* pA =
static_cast<const MetaPixelAction*
>(pAction);
994 if(
maVDev->IsLineColor() )
1009 if(
maVDev->IsLineColor() )
1062 const MetaRoundRectAction* pA =
static_cast<const MetaRoundRectAction*
>(pAction);
1079 const MetaEllipseAction* pA =
static_cast<const MetaEllipseAction*
>(pAction);
1104 const MetaArcAction* pA =
static_cast<const MetaArcAction*
>(pAction);
1105 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Arc );
1111 const MetaPieAction* pA =
static_cast<const MetaPieAction*
>(pAction);
1112 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Pie );
1118 const MetaChordAction* pA =
static_cast<const MetaChordAction*
>(pAction);
1119 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Chord );
1124 aPoly =
static_cast<const MetaPolygonAction*
>(pAction)->GetPolygon();
1136 if(
maVDev->IsLineColor() )
1138 const MetaPolyLineAction* pA =
static_cast<const MetaPolyLineAction*
>(pAction);
1143 if(pA->GetLineInfo().IsDefault())
1187 if( rPolyPoly.
Count() )
1204 Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
1205 const Size aSrcSize( aTmpMtf.GetPrefSize() );
1208 const double fScaleX = aSrcSize.
Width() ?
static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0;
1209 const double fScaleY = aSrcSize.Height() ?
static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0;
1212 if( fScaleX != 1.0 || fScaleY != 1.0 )
1214 aTmpMtf.Scale( fScaleX, fScaleY );
1215 aSrcPt.setX(
FRound( aSrcPt.X() * fScaleX ) );
1216 aSrcPt.setY(
FRound( aSrcPt.Y() * fScaleY ) );
1219 nMoveX = aDestPt.X() - aSrcPt.X();
1220 nMoveY = aDestPt.Y() - aSrcPt.Y();
1222 if( nMoveX || nMoveY )
1223 aTmpMtf.Move( nMoveX, nMoveY );
1237 for(
size_t i = 0,
nCount = aSubstitute.GetActionSize();
i <
nCount;
i++ )
1239 const MetaAction* pSubstAct = aSubstitute.GetAction(
i );
1246 MapMode aMapMode( aSubstitute.GetPrefMapMode() );
1248 aMapMode.SetScaleX(
Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) );
1249 aMapMode.SetScaleY(
Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) );
1251 maVDev->SetMapMode( aMapMode );
1280 const MetaBmpScalePartAction* pA =
static_cast<const MetaBmpScalePartAction*
>(pAction);
1281 Bitmap aTmp( pA->GetBitmap() );
1294 if( !aMsk.IsEmpty() )
1312 if( !aMsk.IsEmpty() )
1326 const MetaBmpExScalePartAction* pA =
static_cast<const MetaBmpExScalePartAction*
>(pAction);
1327 BitmapEx aBmpEx( pA->GetBitmapEx() );
1329 Bitmap aBmp( aBmpEx.GetBitmap() );
1330 Bitmap aMsk( aBmpEx.GetMask() );
1332 if( !aMsk.IsEmpty() )
1357 const OUString& aText( pA->
GetText() );
1366 const MetaTextArrayAction* pA =
static_cast<const MetaTextArrayAction*
>(pAction);
1367 const OUString aText = pA->GetText().copy( pA->GetIndex(), std::min(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
1414 ImplWriteRect( static_cast<const MetaISectRectClipRegionAction*>(pAction)->GetRect() );
1457 ImplWriteRasterOp( static_cast<const MetaRasterOpAction*>(pAction)->GetRasterOp() );
1479 static_cast<MetaCommentAction const*>(pAction));
1480 if (pCommentAction->
GetComment() ==
"EMF_PLUS")
void ImplEndCommentRecord()
void ImplWriteSize(const Size &rSize)
void ImplWriteRect(const tools::Rectangle &rRect)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
#define WIN_EMR_ROUNDRECT
const OUString & GetFamilyName() const
void ImplBeginPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
std::vector< bool > mHandlesUsed
void ImplWritePlusFillPolygonRecord(const tools::Polygon &rPoly, sal_uInt32 nTrans)
void ImplWrite(const GDIMetaFile &rMtf)
#define WIN_EMR_SETWINDOWORGEX
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
#define WIN_EMR_SETTEXTALIGN
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define WIN_EMR_DELETEOBJECT
#define WIN_EMR_BEGINPATH
void ImplWritePlusColor(const Color &rColor, sal_uInt32 nTrans)
void ImplWritePolygonRecord(const tools::Polygon &rPoly, bool bClose)
bool ImplPrepareHandleSelect(sal_uInt32 &rHandle, sal_uLong nSelectType)
#define WIN_EMR_CLOSEFIGURE
#define WIN_EMR_CREATEPEN
sal_uInt64 Seek(sal_uInt64 nPos)
#define WIN_EMR_STROKEPATH
#define WIN_EMR_SETTEXTCOLOR
#define WIN_EMR_RESTOREDC
#define WIN_EMR_SETPIXELV
const OUString & GetText() const
Size GetSizePixel() const
sal_uInt64 SeekRel(sal_Int64 nPos)
#define WIN_EMR_SETMAPMODE
FontFamily GetFamilyType()
FontAlign GetAlignment() const
constexpr tools::Long Width() const
void ImplBeginRecord(sal_uInt32 nType)
const OUString & GetText() const
void ImplWriteRasterOp(RasterOp eRop)
void ImplReleaseHandle(sal_uLong nHandle)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
#define WIN_EMR_SETVIEWPORTEXTEX
void ImplWritePoint(const Point &rPoint)
ScopedVclPtr< VirtualDevice > maVDev
sal_uInt8 GetBlue() const
void ImplWriteColor(const Color &rColor)
void ImplWriteExtent(tools::Long nExtent)
void ImplWritePlusPoint(const Point &rPoint)
void SetMapUnit(MapUnit eUnit)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
#define WIN_EMR_SELECTOBJECT
UNDERLYING_TYPE get() const
const Point & GetPoint() const
tools::Long FRound(double fVal)
tools::Long GetOrCalculateAverageFontWidth() const
void Impl_handleLineInfoPolyPolygons(const LineInfo &rInfo, const basegfx::B2DPolygon &rLinePolygon)
#define WIN_EMR_POLYPOLYGON
#define WIN_EMR_INTERSECTCLIPRECT
sal_uInt32 GetWidth() const
void ImplBeginCommentRecord(sal_Int32 nCommentType)
#define WIN_EMR_GDICOMMENT
std::size_t WriteBytes(const void *pData, std::size_t nSize)
sal_uInt32 mnHorTextAlign
#define WIN_EMR_COMMENT_EMFPLUS
bool WriteEMF(const GDIMetaFile &rMtf)
const Size & GetFontSize() const
const OUString & GetText() const
#define WIN_EMR_EXTTEXTOUTW
FontStrikeout GetStrikeout() const
#define WIN_EMR_POLYLINETO
void ImplWritePolyPolygonRecord(const tools::PolyPolygon &rPolyPoly)
void ImplWritePath(const tools::PolyPolygon &rPolyPoly, bool bClose)
#define WIN_EMR_CREATEBRUSHINDIRECT
#define WIN_EMR_SETWINDOWEXTEX
Bitmap GetBitmap(Color aTransparentReplaceColor) const
#define WIN_EMR_STRETCHDIBITS
const Point & GetPoint() const
sal_uInt8 GetGreen() const
#define WIN_EMR_POLYBEZIERTO
void ImplWriteBmpRecord(const Bitmap &rBmp, const Point &rPt, const Size &rSz, sal_uInt32 nROP)
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
SvStream & WriteUChar(unsigned char nChar)
#define WIN_EMR_RECTANGLE
SvStream & WriteInt16(sal_Int16 nInt16)
Degree10 GetOrientation() const
void ImplPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
void ImplWriteTextRecord(const Point &rPos, const OUString &rText, const tools::Long *pDXArray, sal_uInt32 nWidth)
#define WIN_EMR_SETBKMODE
FontLineStyle GetUnderline() const
reference_type * get() const
Get the body.
void WriteEMFPlusHeader(const Size &rMtfSizePix, const Size &rMtfSizeLog)
sal_uLong mnRecordPlusPos
bool Replace(const Bitmap &rMask, const Color &rReplaceColor)
Replace all pixel where the given mask is on with the specified color.
sal_uLong ImplAcquireHandle()
#define WIN_EMR_SETVIEWPORTORGEX
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
const tools::Rectangle & GetRect() const
sal_Int32 GetIndex() const
sal_Int32 GetIndex() const
#define WIN_EMR_EXTCREATEFONTINDIRECTW
rtl_TextEncoding GetCharSet() const