xref: /trunk/main/svtools/source/filter/wmf/emfwr.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _EMFWR_HXX
25 #define _EMFWR_HXX
26 
27 #include <tools/debug.hxx>
28 #include <vcl/metaact.hxx>
29 #include <vcl/graph.hxx>
30 #include <vcl/gdimtf.hxx>
31 #include <vcl/virdev.hxx>
32 #include <svtools/fltcall.hxx>
33 
34 // -------------
35 // - EMFWriter -
36 // -------------
37 
38 class LineInfo;
39 namespace basegfx { class B2DPolygon; }
40 
41 class EMFWriter
42 {
43 private:
44 
45 	VirtualDevice		maVDev;
46 	MapMode				maDestMapMode;
47 	FilterConfigItem*	mpFilterConfigItem;
48 	SvStream*			mpStm;
49 	sal_Bool*				mpHandlesUsed;
50 	sal_uLong				mnHandleCount;
51 	sal_uLong				mnLastPercent;
52 	sal_uLong				mnRecordCount;
53 	sal_uLong				mnRecordPos;
54 	sal_Bool				mbRecordOpen;
55 	sal_Bool				mbLineChanged;
56 	sal_uInt32			mnLineHandle;
57 	sal_Bool				mbFillChanged;
58 	sal_uInt32			mnFillHandle;
59 	sal_Bool				mbTextChanged;
60 	sal_uInt32			mnTextHandle;
61 	sal_uInt32			mnHorTextAlign;
62 
63 	void				ImplBeginRecord( sal_uInt32 nType );
64 	void				ImplEndRecord();
65 
66 	sal_uLong				ImplAcquireHandle();
67 	void				ImplReleaseHandle( sal_uLong nHandle );
68 
69 	sal_Bool				ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType );
70 	void				ImplCheckLineAttr();
71 	void				ImplCheckFillAttr();
72 	void				ImplCheckTextAttr();
73 
74 	void				ImplWriteColor( const Color& rColor );
75 	void				ImplWriteRasterOp( RasterOp eRop );
76 	void				ImplWriteExtent( long nExtent );
77 	void				ImplWritePoint( const Point& rPoint );
78 	void				ImplWriteSize( const Size& rSize);
79 	void				ImplWriteRect( const Rectangle& rRect );
80 	void				ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClose );
81 	void				ImplWritePolygonRecord( const Polygon& rPoly, sal_Bool bClose );
82 	void				ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly );
83 	void				ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP );
84 	void				ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
85 
86     void                Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
87 	void				ImplWrite( const GDIMetaFile& rMtf );
88 
89 public:
90 
EMFWriter()91 						EMFWriter() {}
92 
93 	sal_Bool				WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfigItem* pConfigItem = NULL );
94 };
95 
96 #endif // _EMFWR_HXX
97