1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <vcl/gdimtf.hxx>
23 #include <vcl/virdev.hxx>
26 namespace basegfx
{ class B2DPolygon
; }
27 enum class EmfPlusRecordType
;
33 ScopedVclPtr
<VirtualDevice
> maVDev
;
34 MapMode maDestMapMode
;
36 std::vector
<bool> mHandlesUsed
;
37 sal_uLong mnHandleCount
;
38 sal_uLong mnRecordCount
;
39 sal_uInt64 mnRecordPos
;
40 sal_uInt64 mnRecordPlusPos
;
42 bool mbRecordPlusOpen
;
44 sal_uInt32 mnLineHandle
;
46 sal_uInt32 mnFillHandle
;
48 sal_uInt32 mnTextHandle
;
49 sal_uInt32 mnHorTextAlign
;
51 void ImplBeginRecord( sal_uInt32 nType
);
53 void ImplBeginPlusRecord( EmfPlusRecordType nType
, sal_uInt16 nFlags
);
54 void ImplEndPlusRecord();
55 void ImplPlusRecord( EmfPlusRecordType nType
, sal_uInt16 nFlags
);
56 void ImplBeginCommentRecord( sal_Int32 nCommentType
);
57 void ImplEndCommentRecord();
59 sal_uLong
ImplAcquireHandle();
60 void ImplReleaseHandle( sal_uLong nHandle
);
62 bool ImplPrepareHandleSelect( sal_uInt32
& rHandle
, sal_uLong nSelectType
);
63 void ImplCheckLineAttr();
64 void ImplCheckFillAttr();
65 void ImplCheckTextAttr();
67 void ImplWriteColor( const Color
& rColor
);
68 void ImplWriteRasterOp( RasterOp eRop
);
69 void ImplWriteExtent( tools::Long nExtent
);
70 void ImplWritePoint( const Point
& rPoint
);
71 void ImplWriteSize( const Size
& rSize
);
72 void ImplWriteRect( const tools::Rectangle
& rRect
);
73 void ImplWritePath( const tools::PolyPolygon
& rPolyPoly
, bool bClose
);
74 void ImplWritePolygonRecord( const tools::Polygon
& rPoly
, bool bClose
);
75 void ImplWritePolyPolygonRecord( const tools::PolyPolygon
& rPolyPoly
);
76 void ImplWriteBmpRecord( const Bitmap
& rBmp
, const Point
& rPt
, const Size
& rSz
, sal_uInt32 nROP
);
77 void ImplWriteTextRecord( const Point
& rPos
, const OUString
& rText
, KernArraySpan pDXArray
, sal_uInt32 nWidth
);
79 void Impl_handleLineInfoPolyPolygons(const LineInfo
& rInfo
, const basegfx::B2DPolygon
& rLinePolygon
);
80 void ImplWrite( const GDIMetaFile
& rMtf
);
81 void WriteEMFPlusHeader( const Size
&rMtfSizePix
, const Size
&rMtfSizeLog
);
82 void ImplWritePlusEOF();
83 void ImplWritePlusFillPolygonRecord( const tools::Polygon
& rPoly
, sal_uInt32 nTrans
);
84 void ImplWritePlusColor( const Color
& rColor
, sal_uInt32 nTrans
);
85 void ImplWritePlusPoint( const Point
& rPoint
);
89 explicit EMFWriter(SvStream
&rStream
)
90 : maVDev( VclPtr
<VirtualDevice
>::Create() )
97 , mbRecordPlusOpen(false)
98 , mbLineChanged(false)
100 , mbFillChanged(false)
102 , mbTextChanged(false)
108 bool WriteEMF(const GDIMetaFile
& rMtf
);
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */