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;
480 default: nWeight = 0;
break;
494 default: nPitchAndFamily = 0x00;
break;
509 for( i = 0; i < 32; i++ )
513 for( i = 0; i < 64; i++ )
517 for( i = 0; i < 32; i++ )
538 sal_uInt32 nTextAlign;
565 sal_uInt32 nCol = rColor.
GetRed();
567 nCol |=
static_cast<sal_uInt32
>(rColor.
GetGreen()) << 8;
568 nCol |=
static_cast<sal_uInt32
>(rColor.
GetBlue()) << 16;
581 default: nROP2 = 13;
break;
614 .WriteInt32( aRect.
Top() )
637 for( sal_uInt16
i = 0;
i < rPoly.
GetSize();
i++ )
646 sal_uInt16
n,
i, nPolyCount = rPolyPoly.
Count();
651 if( 1 == nPolyCount )
655 bool bHasFlags =
false;
656 sal_uInt32 nTotalPoints = 0;
658 for( i = 0; i < nPolyCount; i++ )
660 nTotalPoints += rPolyPoly[ i ].GetSize();
661 if ( rPolyPoly[ i ].HasFlags() )
677 for( i = 0; i < nPolyCount; i++ )
680 for( i = 0; i < nPolyCount; i++ )
684 for( n = 0; n < rPoly.
GetSize(); n++ )
702 sal_uInt16
i,
n, o, nPolyCount = rPolyPoly.
Count();
703 for ( i = 0; i < nPolyCount; i++ )
718 sal_uInt16 nBezPoints = 0;
720 while ( ( ( nBezPoints + n + 2 ) < rPoly.
GetSize() ) && ( rPoly.
GetFlags( nBezPoints + n ) == PolyFlags::Control ) )
727 aNewPoly[ 0 ] = rPoly[ n - 1 ];
728 for ( o = 0; o < nBezPoints; o++ )
729 aNewPoly[ o + 1 ] = rPoly[ n + o ];
732 for( o = 1; o < aNewPoly.
GetSize(); o++ )
739 sal_uInt16 nPoints = 1;
740 while( ( nPoints + n ) < rPoly.
GetSize() && ( rPoly.
GetFlags( nPoints + n ) != PolyFlags::Control ) )
747 aNewPoly[ 0 ] = rPoly[ n - 1];
748 for ( o = 1; o <= nPoints; o++ )
749 aNewPoly[ o ] = rPoly[ n - 1 + o ];
752 for( o = 1; o < aNewPoly.
GetSize(); o++ )
764 if ( bClosed && ( n == rPoly.
GetSize() ) )
779 const Size& rSz, sal_uInt32 nROP )
799 WriteDIB(rBmp, aMemStm,
true,
false);
801 sal_uInt32 nDIBSize = aMemStm.
Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
815 nPalCount = nColsUsed;
817 nPalCount = 1 <<
static_cast<sal_uInt32
>(nBitCount);
827 sal_uInt32 nPalSize = nPalCount * 4;
843 sal_Int32 nLen = rText.getLength(),
i;
848 sal_uInt32 nNormWidth;
849 std::unique_ptr<tools::Long[]> pOwnArray;
855 nNormWidth =
maVDev->GetTextWidth( rText );
861 nNormWidth =
maVDev->GetTextArray( rText, pOwnArray.get() );
862 pDX = pOwnArray.
get();
867 nNormWidth = pDX[ nLen - 2 ] +
maVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
869 if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
871 const double fFactor =
static_cast<double>(nWidth) / nNormWidth;
873 for(
i = 0;
i < ( nLen - 1 );
i++ )
874 pDX[
i ] =
FRound( pDX[
i ] * fFactor );
890 for(
i = 0;
i < nLen;
i++ )
902 for( i = 1; i < ( nLen - 1 ); i++ )
914 if(!rLinePolygon.
count())
920 rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
922 if(aLinePolyPolygon.
count())
924 for(
auto const& rB2DPolygon : aLinePolyPolygon)
930 if(!aFillPolyPolygon.
count())
937 maVDev->SetFillColor(aOldLineColor);
939 for(
auto const& rB2DPolygon : aFillPolyPolygon)
944 maVDev->SetLineColor(aOldLineColor);
945 maVDev->SetFillColor(aOldFillColor);
950 for(
size_t j = 0, nActionCount = rMtf.
GetActionSize(); j < nActionCount; j++ )
959 const MetaPixelAction* pA =
static_cast<const MetaPixelAction*
>(pAction);
971 if(
maVDev->IsLineColor() )
986 if(
maVDev->IsLineColor() )
1039 const MetaRoundRectAction* pA =
static_cast<const MetaRoundRectAction*
>(pAction);
1056 const MetaEllipseAction* pA =
static_cast<const MetaEllipseAction*
>(pAction);
1081 const MetaArcAction* pA =
static_cast<const MetaArcAction*
>(pAction);
1082 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Arc );
1088 const MetaPieAction* pA =
static_cast<const MetaPieAction*
>(pAction);
1089 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Pie );
1095 const MetaChordAction* pA =
static_cast<const MetaChordAction*
>(pAction);
1096 aPoly =
tools::Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), PolyStyle::Chord );
1101 aPoly =
static_cast<const MetaPolygonAction*
>(pAction)->GetPolygon();
1113 if(
maVDev->IsLineColor() )
1115 const MetaPolyLineAction* pA =
static_cast<const MetaPolyLineAction*
>(pAction);
1120 if(pA->GetLineInfo().IsDefault())
1164 if( rPolyPoly.
Count() )
1181 Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
1182 const Size aSrcSize( aTmpMtf.GetPrefSize() );
1185 const double fScaleX = aSrcSize.
Width() ?
static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0;
1186 const double fScaleY = aSrcSize.Height() ?
static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0;
1189 if( fScaleX != 1.0 || fScaleY != 1.0 )
1191 aTmpMtf.Scale( fScaleX, fScaleY );
1192 aSrcPt.setX(
FRound( aSrcPt.X() * fScaleX ) );
1193 aSrcPt.setY(
FRound( aSrcPt.Y() * fScaleY ) );
1196 nMoveX = aDestPt.X() - aSrcPt.X();
1197 nMoveY = aDestPt.Y() - aSrcPt.Y();
1199 if( nMoveX || nMoveY )
1200 aTmpMtf.Move( nMoveX, nMoveY );
1214 for(
size_t i = 0,
nCount = aSubstitute.GetActionSize();
i <
nCount;
i++ )
1216 const MetaAction* pSubstAct = aSubstitute.GetAction(
i );
1223 MapMode aMapMode( aSubstitute.GetPrefMapMode() );
1225 aMapMode.SetScaleX(
Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) );
1226 aMapMode.SetScaleY(
Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) );
1228 maVDev->SetMapMode( aMapMode );
1257 const MetaBmpScalePartAction* pA =
static_cast<const MetaBmpScalePartAction*
>(pAction);
1258 Bitmap aTmp( pA->GetBitmap() );
1303 const MetaBmpExScalePartAction* pA =
static_cast<const MetaBmpExScalePartAction*
>(pAction);
1304 BitmapEx aBmpEx( pA->GetBitmapEx() );
1306 Bitmap aBmp( aBmpEx.GetBitmap() );
1307 Bitmap aMsk( aBmpEx.GetMask() );
1334 const OUString& aText( pA->
GetText() );
1343 const MetaTextArrayAction* pA =
static_cast<const MetaTextArrayAction*
>(pAction);
1344 const OUString aText = pA->GetText().copy( pA->GetIndex(), std::min(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
1391 ImplWriteRect( static_cast<const MetaISectRectClipRegionAction*>(pAction)->GetRect() );
1434 ImplWriteRasterOp( static_cast<const MetaRasterOpAction*>(pAction)->GetRasterOp() );
1456 static_cast<MetaCommentAction const*>(pAction));
1457 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
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)
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
tools::Long Width() const
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)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
SvStream & WriteUChar(unsigned char nChar)
#define WIN_EMR_RECTANGLE
SvStream & WriteInt16(sal_Int16 nInt16)
tools::Long Height() const
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