Line data Source code
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 _EMFWR_HXX
21 : #define _EMFWR_HXX
22 :
23 : #include <vcl/metaact.hxx>
24 : #include <vcl/graph.hxx>
25 : #include <vcl/gdimtf.hxx>
26 : #include <vcl/virdev.hxx>
27 : #include <svtools/fltcall.hxx>
28 :
29 : // -------------
30 : // - EMFWriter -
31 : // -------------
32 :
33 : class LineInfo;
34 : namespace basegfx { class B2DPolygon; }
35 :
36 30 : class EMFWriter
37 : {
38 : private:
39 :
40 : VirtualDevice maVDev;
41 : MapMode maDestMapMode;
42 : FilterConfigItem* mpFilterConfigItem;
43 : SvStream& m_rStm;
44 : sal_Bool* mpHandlesUsed;
45 : sal_uLong mnHandleCount;
46 : sal_uLong mnLastPercent;
47 : sal_uLong mnRecordCount;
48 : sal_uLong mnRecordPos;
49 : sal_uLong mnRecordPlusPos;
50 : sal_Bool mbRecordOpen;
51 : sal_Bool mbRecordPlusOpen;
52 : sal_Bool mbLineChanged;
53 : sal_uInt32 mnLineHandle;
54 : sal_Bool mbFillChanged;
55 : sal_uInt32 mnFillHandle;
56 : sal_Bool mbTextChanged;
57 : sal_uInt32 mnTextHandle;
58 : sal_uInt32 mnHorTextAlign;
59 :
60 : void ImplBeginRecord( sal_uInt32 nType );
61 : void ImplEndRecord();
62 : void ImplBeginPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags );
63 : void ImplEndPlusRecord();
64 : void ImplPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags );
65 : void ImplBeginCommentRecord( sal_Int32 nCommentType );
66 : void ImplEndCommentRecord();
67 :
68 : sal_uLong ImplAcquireHandle();
69 : void ImplReleaseHandle( sal_uLong nHandle );
70 :
71 : sal_Bool ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType );
72 : void ImplCheckLineAttr();
73 : void ImplCheckFillAttr();
74 : void ImplCheckTextAttr();
75 :
76 : void ImplWriteColor( const Color& rColor );
77 : void ImplWriteRasterOp( RasterOp eRop );
78 : void ImplWriteExtent( long nExtent );
79 : void ImplWritePoint( const Point& rPoint );
80 : void ImplWriteSize( const Size& rSize);
81 : void ImplWriteRect( const Rectangle& rRect );
82 : void ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClose );
83 : void ImplWritePolygonRecord( const Polygon& rPoly, sal_Bool bClose );
84 : void ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly );
85 : void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP );
86 : void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
87 :
88 : void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
89 : void ImplWrite( const GDIMetaFile& rMtf );
90 : void WriteEMFPlusHeader( const Size &rMtfSizePix, const Size &rMtfSizeLog );
91 : void ImplWritePlusEOF();
92 : void ImplWritePlusFillPolygonRecord( const Polygon& rPoly, const sal_uInt32& nTrans );
93 : void ImplWritePlusColor( const Color& rColor, const sal_uInt32& nTrans );
94 : void ImplWritePlusPoint( const Point& rPoint );
95 :
96 : public:
97 :
98 30 : EMFWriter(SvStream &rStream) : m_rStm(rStream) {}
99 :
100 : sal_Bool WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL );
101 : };
102 :
103 : #endif // _EMFWR_HXX
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|