cid#1606940 Check of thread-shared field evades lock acquisition
[LibreOffice.git] / vcl / source / filter / wmf / emfwr.hxx
blob75f7f38196041db27662109cb86ddd95cc7b4896
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <vcl/gdimtf.hxx>
23 #include <vcl/virdev.hxx>
25 class LineInfo;
26 namespace basegfx { class B2DPolygon; }
27 enum class EmfPlusRecordType;
29 class EMFWriter
31 private:
33 ScopedVclPtr<VirtualDevice> maVDev;
34 MapMode maDestMapMode;
35 SvStream& m_rStm;
36 std::vector<bool> mHandlesUsed;
37 sal_uLong mnHandleCount;
38 sal_uLong mnRecordCount;
39 sal_uInt64 mnRecordPos;
40 sal_uInt64 mnRecordPlusPos;
41 bool mbRecordOpen;
42 bool mbRecordPlusOpen;
43 bool mbLineChanged;
44 sal_uInt32 mnLineHandle;
45 bool mbFillChanged;
46 sal_uInt32 mnFillHandle;
47 bool mbTextChanged;
48 sal_uInt32 mnTextHandle;
49 sal_uInt32 mnHorTextAlign;
51 void ImplBeginRecord( sal_uInt32 nType );
52 void ImplEndRecord();
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 );
87 public:
89 explicit EMFWriter(SvStream &rStream)
90 : maVDev( VclPtr<VirtualDevice>::Create() )
91 , m_rStm(rStream)
92 , mnHandleCount(0)
93 , mnRecordCount(0)
94 , mnRecordPos(0)
95 , mnRecordPlusPos(0)
96 , mbRecordOpen(false)
97 , mbRecordPlusOpen(false)
98 , mbLineChanged(false)
99 , mnLineHandle(0)
100 , mbFillChanged(false)
101 , mnFillHandle(0)
102 , mbTextChanged(false)
103 , mnTextHandle(0)
104 , mnHorTextAlign(0)
108 bool WriteEMF(const GDIMetaFile& rMtf);
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */