LibreOffice Module vcl (master) 1
emfwr.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_SOURCE_FILTER_WMF_EMFWR_HXX
21#define INCLUDED_VCL_SOURCE_FILTER_WMF_EMFWR_HXX
22
23#include <vcl/gdimtf.hxx>
24#include <vcl/virdev.hxx>
25
26class LineInfo;
27namespace basegfx { class B2DPolygon; }
28enum class EmfPlusRecordType;
29
31{
32private:
33
37 std::vector<bool> mHandlesUsed;
45 sal_uInt32 mnLineHandle;
47 sal_uInt32 mnFillHandle;
49 sal_uInt32 mnTextHandle;
50 sal_uInt32 mnHorTextAlign;
51
52 void ImplBeginRecord( sal_uInt32 nType );
53 void ImplEndRecord();
54 void ImplBeginPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags );
55 void ImplEndPlusRecord();
56 void ImplPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags );
57 void ImplBeginCommentRecord( sal_Int32 nCommentType );
59
61 void ImplReleaseHandle( sal_uLong nHandle );
62
63 bool ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType );
64 void ImplCheckLineAttr();
65 void ImplCheckFillAttr();
66 void ImplCheckTextAttr();
67
68 void ImplWriteColor( const Color& rColor );
69 void ImplWriteRasterOp( RasterOp eRop );
70 void ImplWriteExtent( tools::Long nExtent );
71 void ImplWritePoint( const Point& rPoint );
72 void ImplWriteSize( const Size& rSize);
73 void ImplWriteRect( const tools::Rectangle& rRect );
74 void ImplWritePath( const tools::PolyPolygon& rPolyPoly, bool bClose );
75 void ImplWritePolygonRecord( const tools::Polygon& rPoly, bool bClose );
76 void ImplWritePolyPolygonRecord( const tools::PolyPolygon& rPolyPoly );
77 void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP );
78 void ImplWriteTextRecord( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, sal_uInt32 nWidth );
79
80 void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
81 void ImplWrite( const GDIMetaFile& rMtf );
82 void WriteEMFPlusHeader( const Size &rMtfSizePix, const Size &rMtfSizeLog );
83 void ImplWritePlusEOF();
84 void ImplWritePlusFillPolygonRecord( const tools::Polygon& rPoly, sal_uInt32 nTrans );
85 void ImplWritePlusColor( const Color& rColor, sal_uInt32 nTrans );
86 void ImplWritePlusPoint( const Point& rPoint );
87
88public:
89
90 explicit EMFWriter(SvStream &rStream)
92 , m_rStm(rStream)
93 , mnHandleCount(0)
94 , mnRecordCount(0)
95 , mnRecordPos(0)
97 , mbRecordOpen(false)
98 , mbRecordPlusOpen(false)
99 , mbLineChanged(false)
100 , mnLineHandle(0)
101 , mbFillChanged(false)
102 , mnFillHandle(0)
103 , mbTextChanged(false)
104 , mnTextHandle(0)
105 , mnHorTextAlign(0)
106 {
107 }
108
109 bool WriteEMF(const GDIMetaFile& rMtf);
110};
111
112#endif // INCLUDED_VCL_SOURCE_FILTER_WMF_EMFWR_HXX
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RasterOp
Definition: RasterOp.hxx:23
sal_uLong mnRecordCount
Definition: emfwr.hxx:39
void ImplWritePlusColor(const Color &rColor, sal_uInt32 nTrans)
Definition: emfwr.cxx:206
void ImplWritePath(const tools::PolyPolygon &rPolyPoly, bool bClose)
Definition: emfwr.cxx:716
bool mbFillChanged
Definition: emfwr.hxx:46
void ImplWriteExtent(tools::Long nExtent)
Definition: emfwr.cxx:612
sal_uLong mnRecordPos
Definition: emfwr.hxx:40
void ImplPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
Definition: emfwr.cxx:159
sal_uInt32 mnFillHandle
Definition: emfwr.hxx:47
bool mbLineChanged
Definition: emfwr.hxx:44
void ImplWrite(const GDIMetaFile &rMtf)
Definition: emfwr.cxx:975
void ImplWritePoint(const Point &rPoint)
Definition: emfwr.cxx:618
sal_uLong mnRecordPlusPos
Definition: emfwr.hxx:41
void ImplWritePolygonRecord(const tools::Polygon &rPoly, bool bClose)
Definition: emfwr.cxx:642
sal_uInt32 mnLineHandle
Definition: emfwr.hxx:45
void ImplEndRecord()
Definition: emfwr.cxx:362
void ImplBeginPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
Definition: emfwr.cxx:129
bool ImplPrepareHandleSelect(sal_uInt32 &rHandle, sal_uLong nSelectType)
Definition: emfwr.cxx:384
void ImplBeginCommentRecord(sal_Int32 nCommentType)
Definition: emfwr.cxx:110
void ImplWritePlusFillPolygonRecord(const tools::Polygon &rPoly, sal_uInt32 nTrans)
Definition: emfwr.cxx:224
void ImplWritePlusEOF()
Definition: emfwr.cxx:199
void ImplWriteRect(const tools::Rectangle &rRect)
Definition: emfwr.cxx:630
void ImplCheckFillAttr()
Definition: emfwr.cxx:433
void ImplBeginRecord(sal_uInt32 nType)
Definition: emfwr.cxx:348
void ImplCheckTextAttr()
Definition: emfwr.cxx:451
void ImplWriteRasterOp(RasterOp eRop)
Definition: emfwr.cxx:596
void ImplWritePlusPoint(const Point &rPoint)
Definition: emfwr.cxx:217
void ImplWritePolyPolygonRecord(const tools::PolyPolygon &rPolyPoly)
Definition: emfwr.cxx:667
MapMode maDestMapMode
Definition: emfwr.hxx:35
void ImplReleaseHandle(sal_uLong nHandle)
Definition: emfwr.cxx:342
bool mbRecordPlusOpen
Definition: emfwr.hxx:43
sal_uInt32 mnHorTextAlign
Definition: emfwr.hxx:50
void ImplCheckLineAttr()
Definition: emfwr.cxx:416
void Impl_handleLineInfoPolyPolygons(const LineInfo &rInfo, const basegfx::B2DPolygon &rLinePolygon)
Definition: emfwr.cxx:939
void ImplWriteSize(const Size &rSize)
Definition: emfwr.cxx:624
void WriteEMFPlusHeader(const Size &rMtfSizePix, const Size &rMtfSizeLog)
Definition: emfwr.cxx:165
bool mbRecordOpen
Definition: emfwr.hxx:42
sal_uLong mnHandleCount
Definition: emfwr.hxx:38
void ImplEndPlusRecord()
Definition: emfwr.cxx:143
std::vector< bool > mHandlesUsed
Definition: emfwr.hxx:37
sal_uLong ImplAcquireHandle()
Definition: emfwr.cxx:323
bool mbTextChanged
Definition: emfwr.hxx:48
void ImplEndCommentRecord()
Definition: emfwr.cxx:117
sal_uInt32 mnTextHandle
Definition: emfwr.hxx:49
void ImplWriteBmpRecord(const Bitmap &rBmp, const Point &rPt, const Size &rSz, sal_uInt32 nROP)
Definition: emfwr.cxx:801
SvStream & m_rStm
Definition: emfwr.hxx:36
bool WriteEMF(const GDIMetaFile &rMtf)
Definition: emfwr.cxx:239
EMFWriter(SvStream &rStream)
Definition: emfwr.hxx:90
void ImplWriteTextRecord(const Point &rPos, const OUString &rText, o3tl::span< const sal_Int32 > pDXArray, sal_uInt32 nWidth)
Definition: emfwr.cxx:864
void ImplWriteColor(const Color &rColor)
Definition: emfwr.cxx:586
ScopedVclPtr< VirtualDevice > maVDev
Definition: emfwr.hxx:34
A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for refer...
Definition: vclptr.hxx:58
EmfPlusRecordType
Definition: emfwr.cxx:99
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
long Long
sal_uIntPtr sal_uLong