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