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#pragma once
21
22#include <vcl/gdimtf.hxx>
23#include <vcl/virdev.hxx>
24
25class LineInfo;
26namespace basegfx { class B2DPolygon; }
27enum class EmfPlusRecordType;
28
30{
31private:
32
36 std::vector<bool> mHandlesUsed;
44 sal_uInt32 mnLineHandle;
46 sal_uInt32 mnFillHandle;
48 sal_uInt32 mnTextHandle;
49 sal_uInt32 mnHorTextAlign;
50
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 );
58
60 void ImplReleaseHandle( sal_uLong nHandle );
61
62 bool ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType );
63 void ImplCheckLineAttr();
64 void ImplCheckFillAttr();
65 void ImplCheckTextAttr();
66
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 );
78
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 );
86
87public:
88
89 explicit EMFWriter(SvStream &rStream)
91 , m_rStm(rStream)
92 , mnHandleCount(0)
93 , mnRecordCount(0)
94 , mnRecordPos(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)
105 {
106 }
107
108 bool WriteEMF(const GDIMetaFile& rMtf);
109};
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RasterOp
Definition: RasterOp.hxx:23
sal_uLong mnRecordCount
Definition: emfwr.hxx:38
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:45
void ImplWriteExtent(tools::Long nExtent)
Definition: emfwr.cxx:612
sal_uLong mnRecordPos
Definition: emfwr.hxx:39
void ImplPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
Definition: emfwr.cxx:159
sal_uInt32 mnFillHandle
Definition: emfwr.hxx:46
bool mbLineChanged
Definition: emfwr.hxx:43
void ImplWrite(const GDIMetaFile &rMtf)
Definition: emfwr.cxx:975
void ImplWritePoint(const Point &rPoint)
Definition: emfwr.cxx:618
sal_uLong mnRecordPlusPos
Definition: emfwr.hxx:40
void ImplWritePolygonRecord(const tools::Polygon &rPoly, bool bClose)
Definition: emfwr.cxx:642
sal_uInt32 mnLineHandle
Definition: emfwr.hxx:44
void ImplEndRecord()
Definition: emfwr.cxx:362
void ImplBeginPlusRecord(EmfPlusRecordType nType, sal_uInt16 nFlags)
Definition: emfwr.cxx:129
void ImplWriteTextRecord(const Point &rPos, const OUString &rText, KernArraySpan pDXArray, sal_uInt32 nWidth)
Definition: emfwr.cxx:864
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:34
void ImplReleaseHandle(sal_uLong nHandle)
Definition: emfwr.cxx:342
bool mbRecordPlusOpen
Definition: emfwr.hxx:42
sal_uInt32 mnHorTextAlign
Definition: emfwr.hxx:49
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:41
sal_uLong mnHandleCount
Definition: emfwr.hxx:37
void ImplEndPlusRecord()
Definition: emfwr.cxx:143
std::vector< bool > mHandlesUsed
Definition: emfwr.hxx:36
sal_uLong ImplAcquireHandle()
Definition: emfwr.cxx:323
bool mbTextChanged
Definition: emfwr.hxx:47
void ImplEndCommentRecord()
Definition: emfwr.cxx:117
sal_uInt32 mnTextHandle
Definition: emfwr.hxx:48
void ImplWriteBmpRecord(const Bitmap &rBmp, const Point &rPt, const Size &rSz, sal_uInt32 nROP)
Definition: emfwr.cxx:801
SvStream & m_rStm
Definition: emfwr.hxx:35
bool WriteEMF(const GDIMetaFile &rMtf)
Definition: emfwr.cxx:239
EMFWriter(SvStream &rStream)
Definition: emfwr.hxx:89
void ImplWriteColor(const Color &rColor)
Definition: emfwr.cxx:586
ScopedVclPtr< VirtualDevice > maVDev
Definition: emfwr.hxx:33
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