update dev300-m58
[ooovba.git] / svtools / source / filter.vcl / wmf / winmtf.hxx
blobba4d774f496d440f8622bdb13f2ceb55f11e72bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: winmtf.hxx,v $
10 * $Revision: 1.34.134.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _WINMTF_HXX
32 #define _WINMTF_HXX
34 #ifdef DBG_UTIL
35 #define WIN_MTF_ASSERT
36 #endif
38 #include <sot/object.hxx>
39 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
40 #include <boost/shared_ptr.hpp>
41 #endif
42 #ifndef _TOOL_DEBUG_HXX
43 #include <tools/debug.hxx>
44 #endif
45 #include <tools/stack.hxx>
46 #include <tools/table.hxx>
47 #include <tools/dynary.hxx>
48 #include <vcl/graph.hxx>
49 #include <vcl/virdev.hxx>
50 #include <tools/poly.hxx>
51 #include <vcl/font.hxx>
52 #include <vcl/bmpacc.hxx>
53 #include <vcl/lineinfo.hxx>
54 #include <svtools/fltcall.hxx>
56 #include <vector>
57 #include <math.h>
58 #include <stdlib.h>
60 #define ERROR 0
61 #define NULLREGION 1
62 #define SIMPLEREGION 2
63 #define COMPLEXREGION 3
65 #define RGN_AND 1
66 #define RGN_OR 2
67 #define RGN_XOR 3
68 #define RGN_DIFF 4
69 #define RGN_COPY 5
71 #define TRANSPARENT 1
72 #define OPAQUE 2
73 #define BKMODE_LAST 2
75 /* xform stuff */
76 #define MWT_IDENTITY 1
77 #define MWT_LEFTMULTIPLY 2
78 #define MWT_RIGHTMULTIPLY 3
80 #define ENHMETA_STOCK_OBJECT 0x80000000
82 /* Stock Logical Objects */
83 #define WHITE_BRUSH 0
84 #define LTGRAY_BRUSH 1
85 #define GRAY_BRUSH 2
86 #define DKGRAY_BRUSH 3
87 #define BLACK_BRUSH 4
88 #define NULL_BRUSH 5
89 #define HOLLOW_BRUSH NULL_BRUSH
90 #define WHITE_PEN 6
91 #define BLACK_PEN 7
92 #define NULL_PEN 8
93 #define OEM_FIXED_FONT 10
94 #define ANSI_FIXED_FONT 11
95 #define ANSI_VAR_FONT 12
96 #define SYSTEM_FONT 13
97 #define DEVICE_DEFAULT_FONT 14
98 #define DEFAULT_PALETTE 15
99 #define SYSTEM_FIXED_FONT 16
102 #define R2_BLACK 1
103 #define R2_NOTMERGEPEN 2
104 #define R2_MASKNOTPEN 3
105 #define R2_NOTCOPYPEN 4
106 #define R2_MASKPENNOT 5
107 #define R2_NOT 6
108 #define R2_XORPEN 7
109 #define R2_NOTMASKPEN 8
110 #define R2_MASKPEN 9
111 #define R2_NOTXORPEN 10
112 #define R2_NOP 11
113 #define R2_MERGENOTPEN 12
114 #define R2_COPYPEN 13
115 #define R2_MERGEPENNOT 14
116 #define R2_MERGEPEN 15
117 #define R2_WHITE 16
119 /* Mapping Modes */
120 #define MM_TEXT 1
121 #define MM_LOMETRIC 2
122 #define MM_HIMETRIC 3
123 #define MM_LOENGLISH 4
124 #define MM_HIENGLISH 5
125 #define MM_TWIPS 6
126 #define MM_ISOTROPIC 7
127 #define MM_ANISOTROPIC 8
130 /* Graphics Modes */
131 #define GM_COMPATIBLE 1
132 #define GM_ADVANCED 2
133 #define GM_LAST 2
135 /* StretchBlt() Modes */
136 #define BLACKONWHITE 1
137 #define WHITEONBLACK 2
138 #define COLORONCOLOR 3
139 #define HALFTONE 4
140 #define MAXSTRETCHBLTMODE 4
141 #define STRETCH_ANDSCANS BLACKONWHITE
142 #define STRETCH_ORSCANS WHITEONBLACK
143 #define STRETCH_DELETESCANS COLORONCOLOR
144 #define STRETCH_HALFTONE HALFTONE
146 #define LF_FACESIZE 32
148 struct LOGFONTW
150 INT32 lfHeight;
151 INT32 lfWidth;
152 INT32 lfEscapement;
153 INT32 lfOrientation;
154 INT32 lfWeight;
155 BYTE lfItalic;
156 BYTE lfUnderline;
157 BYTE lfStrikeOut;
158 BYTE lfCharSet;
159 BYTE lfOutPrecision;
160 BYTE lfClipPrecision;
161 BYTE lfQuality;
162 BYTE lfPitchAndFamily;
163 String alfFaceName;
165 struct WMF_APMFILEHEADER;
167 #define TA_NOUPDATECP 0x0000
168 #define TA_UPDATECP 0x0001
169 #define TA_LEFT 0x0000
170 #define TA_RIGHT 0x0002
171 #define TA_CENTER 0x0006
172 #define TA_RIGHT_CENTER (TA_RIGHT | TA_CENTER)
173 #define TA_TOP 0x0000
174 #define TA_BOTTOM 0x0008
175 #define TA_BASELINE 0x0018
177 #define SRCCOPY 0x00CC0020L
178 #define SRCPAINT 0x00EE0086L
179 #define SRCAND 0x008800C6L
180 #define SRCINVERT 0x00660046L
181 #define SRCERASE 0x00440328L
182 #define NOTSRCCOPY 0x00330008L
183 #define NOTSRCERASE 0x001100A6L
184 #define MERGECOPY 0x00C000CAL
185 #define MERGEPAINT 0x00BB0226L
186 #define PATCOPY 0x00F00021L
187 #define PATPAINT 0x00FB0A09L
188 #define PATINVERT 0x005A0049L
189 #define DSTINVERT 0x00550009L
190 #define BLACKNESS 0x00000042L
191 #define WHITENESS 0x00FF0062L
193 #define PS_SOLID 0
194 #define PS_DASH 1
195 #define PS_DOT 2
196 #define PS_DASHDOT 3
197 #define PS_DASHDOTDOT 4
198 #define PS_NULL 5
199 #define PS_INSIDEFRAME 6
200 #define PS_USERSTYLE 7
201 #define PS_ALTERNATE 8
202 #define PS_STYLE_MASK 15
204 #define PS_ENDCAP_ROUND 0x000
205 #define PS_ENDCAP_SQUARE 0x100
206 #define PS_ENDCAP_FLAT 0x200
207 #define PS_ENDCAP_MASK 0xF00
209 #define PS_JOIN_ROUND 0x0000
210 #define PS_JOIN_BEVEL 0x1000
211 #define PS_JOIN_MITER 0x2000
212 #define PS_JOIN_MASK 0xF000
214 #define PS_COSMETIC 0x00000
215 #define PS_GEOMETRIC 0x10000
216 #define PS_TYPE_MASK 0xF0000
218 #define ANSI_CHARSET 0
219 #define DEFAULT_CHARSET 1
220 #define SYMBOL_CHARSET 2
221 #define SHIFTJIS_CHARSET 128
222 #define HANGEUL_CHARSET 129
223 #define GB2312_CHARSET 134
224 #define CHINESEBIG5_CHARSET 136
225 #define OEM_CHARSET 255
226 /*WINVER >= 0x0400*/
227 #define JOHAB_CHARSET 130
228 #define HEBREW_CHARSET 177
229 #define ARABIC_CHARSET 178
230 #define GREEK_CHARSET 161
231 #define TURKISH_CHARSET 162
232 #define VIETNAMESE_CHARSET 163
233 #define THAI_CHARSET 222
234 #define EASTEUROPE_CHARSET 238
235 #define RUSSIAN_CHARSET 204
236 #define MAC_CHARSET 77
237 #define BALTIC_CHARSET 186
239 #define ETO_OPAQUE 0x0002
240 #define ETO_CLIPPED 0x0004
241 /*WINVER >= 0x0400*/
242 #define ETO_GLYPH_INDEX 0x0010
243 #define ETO_RTLREADING 0x0080
244 #define ETO_NUMERICSLOCAL 0x0400
245 #define ETO_NUMERICSLATIN 0x0800
246 #define ETO_IGNORELANGUAGE 0x1000
247 /*_WIN32_WINNT >= 0x0500*/
248 #define ETO_PDY 0x2000
251 #define DEFAULT_PITCH 0x00
252 #define FIXED_PITCH 0x01
253 #define VARIABLE_PITCH 0x02
255 /* Font Families */
256 #define FF_DONTCARE 0x00
257 #define FF_ROMAN 0x10
258 #define FF_SWISS 0x20
259 #define FF_MODERN 0x30
260 #define FF_SCRIPT 0x40
261 #define FF_DECORATIVE 0x50
263 #define FW_DONTCARE 0
264 #define FW_THIN 100
265 #define FW_EXTRALIGHT 200
266 #define FW_LIGHT 300
267 #define FW_NORMAL 400
268 #define FW_MEDIUM 500
269 #define FW_SEMIBOLD 600
270 #define FW_BOLD 700
271 #define FW_EXTRABOLD 800
272 #define FW_HEAVY 900
273 #define FW_ULTRALIGHT 200
274 #define FW_REGULAR 400
275 #define FW_DEMIBOLD 600
276 #define FW_ULTRABOLD 800
277 #define FW_BLACK 900
279 #define BS_SOLID 0
280 #define BS_NULL 1
281 #define BS_HOLLOW 1
282 #define BS_HATCHED 2
283 #define BS_PATTERN 3
284 #define BS_INDEXED 4
285 #define BS_DIBPATTERN 5
286 #define BS_DIBPATTERNPT 6
287 #define BS_PATTERN8X8 7
288 #define BS_DIBPATTERN8X8 8
289 #define BS_MONOPATTERN 9
291 #define W_HS_HORIZONTAL 0
292 #define W_HS_VERTICAL 1
293 #define W_HS_FDIAGONAL 2
294 #define W_HS_BDIAGONAL 3
295 #define W_HS_CROSS 4
296 #define W_HS_DIAGCROSS 5
298 #define RDH_RECTANGLES 1
300 #define W_MFCOMMENT 15
302 #define PRIVATE_ESCAPE_UNICODE 2
304 //============================ WMFReader ==================================
307 #ifdef WIN_MTF_ASSERT
308 #define WIN_MTF_ASSERT_INIT 0x80000000
309 #define WIN_MTF_ASSERT_ONCE 0x40000000
310 #define WIN_MTF_ASSERT_MIFE 0x20000000
312 void WinMtfAssertHandler( const sal_Char*, sal_uInt32 nFlags = WIN_MTF_ASSERT_MIFE );
313 #endif
315 enum WinMtfClipPathType{ EMPTY, RECTANGLE, COMPLEX };
317 class WinMtfClipPath
319 PolyPolygon aPolyPoly;
320 WinMtfClipPathType eType;
322 void ImpUpdateType();
324 public :
326 sal_Bool bNeedsUpdate;
328 WinMtfClipPath(): eType(EMPTY), bNeedsUpdate( sal_False ){};
330 void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode );
331 void IntersectClipRect( const Rectangle& rRect );
332 void ExcludeClipRect( const Rectangle& rRect );
333 void MoveClipRegion( const Size& rSize );
335 WinMtfClipPathType GetType() const { return eType; };
336 const PolyPolygon& GetClipPath() const { return aPolyPoly; };
338 sal_Bool operator==( const WinMtfClipPath& rPath )
340 return ( rPath.eType == eType ) &&
341 ( rPath.aPolyPoly == aPolyPoly );
345 class WinMtfPathObj : public PolyPolygon
347 sal_Bool bClosed;
349 public :
351 WinMtfPathObj() { bClosed = sal_True; }
352 void Init() { Clear(); bClosed = sal_True; };
353 void ClosePath();
355 void AddPoint( const Point& rPoint );
356 void AddPolygon( const Polygon& rPoly );
357 void AddPolyLine( const Polygon& rPoly );
358 void AddPolyPolygon( const PolyPolygon& rPolyPolygon );
361 struct WinMtfFontStyle
363 Font aFont;
365 WinMtfFontStyle( LOGFONTW& rLogFont );
368 // -----------------------------------------------------------------------------
370 typedef enum {
371 FillStyleSolid,
372 FillStylePattern
373 } WinMtfFillStyleType;
375 struct WinMtfFillStyle
377 Color aFillColor;
378 BOOL bTransparent;
379 WinMtfFillStyleType aType;
380 Bitmap aBmp;
382 WinMtfFillStyle() :
383 aFillColor ( Color( COL_BLACK ) ),
384 bTransparent( FALSE )
388 WinMtfFillStyle( const Color& rColor, BOOL bTrans = FALSE ) :
389 aFillColor ( rColor ),
390 bTransparent( bTrans ),
391 aType ( FillStyleSolid )
395 WinMtfFillStyle( Bitmap& rBmp ) :
396 aBmp ( rBmp ),
397 aType( FillStylePattern )
401 BOOL operator==( const WinMtfFillStyle& rStyle )
402 { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); };
403 BOOL operator==( WinMtfFillStyle* pStyle )
404 { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); };
405 void operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; };
406 void operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; };
409 // -----------------------------------------------------------------------------
411 struct WinMtfLineStyle
413 Color aLineColor;
414 LineInfo aLineInfo;
415 BOOL bTransparent;
417 WinMtfLineStyle() :
418 aLineColor ( COL_BLACK ),
419 bTransparent( FALSE ) {};
421 WinMtfLineStyle( const Color& rColor, BOOL bTrans = FALSE ) :
422 aLineColor ( rColor ),
423 bTransparent( bTrans ) {};
425 WinMtfLineStyle( const Color& rColor, const LineInfo rStyle, BOOL bTrans = FALSE ) :
426 aLineColor ( rColor ),
427 aLineInfo ( rStyle ),
428 bTransparent( bTrans ) {};
430 BOOL operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); };
431 BOOL operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); };
432 void operator=( const WinMtfLineStyle& rStyle )
434 aLineColor = rStyle.aLineColor;
435 bTransparent = rStyle.bTransparent;
436 aLineInfo = rStyle.aLineInfo;
439 void operator=( WinMtfLineStyle* pStyle )
441 aLineColor = pStyle->aLineColor;
442 bTransparent = pStyle->bTransparent;
443 aLineInfo = pStyle->aLineInfo;
447 // -----------------------------------------------------------------------------
449 struct XForm
451 float eM11;
452 float eM12;
453 float eM21;
454 float eM22;
455 float eDx;
456 float eDy;
457 XForm()
459 eM11 = eM22 = 1.0f;
460 eDx = eDy = eM12 = eM21 = 0.0f;
463 friend SvStream& operator>>( SvStream& rIn, XForm& rXForm );
466 // -----------------------------------------------------------------------------
468 struct SaveStruct
470 sal_uInt32 nBkMode, nMapMode, nGfxMode, nTextLayoutMode;
471 sal_Int32 nWinOrgX, nWinOrgY, nWinExtX, nWinExtY;
472 sal_Int32 nDevOrgX, nDevOrgY, nDevWidth, nDevHeight;
474 WinMtfLineStyle aLineStyle;
475 WinMtfFillStyle aFillStyle;
477 Font aFont;
478 Color aBkColor;
479 Color aTextColor;
480 sal_uInt32 nTextAlign;
481 RasterOp eRasterOp;
483 Point aActPos;
484 WinMtfPathObj aPathObj;
485 WinMtfClipPath aClipPath;
486 XForm aXForm;
488 sal_Bool bRecordPath;
489 sal_Bool bFillStyleSelected;
492 typedef ::boost::shared_ptr< SaveStruct > SaveStructPtr;
494 // -----------------------------------------------------------------------------
496 struct BSaveStruct
498 Bitmap aBmp;
499 Rectangle aOutRect;
500 UINT32 nWinRop;
501 WinMtfFillStyle aStyle;
503 BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, UINT32 nRop, WinMtfFillStyle& rStyle ) :
504 aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){};
507 // -----------------------------------------------------------------------------
509 enum GDIObjectType { GDI_DUMMY = 0, GDI_PEN = 1, GDI_BRUSH = 2, GDI_FONT = 3, GDI_PALETTE = 4, GDI_BITMAP = 5, GDI_REGION = 6 };
511 struct GDIObj
513 void* pStyle;
514 GDIObjectType eType;
516 GDIObj() :
517 pStyle ( NULL ),
518 eType ( GDI_DUMMY )
522 GDIObj( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; };
523 void Set( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; };
524 void Delete()
526 if ( pStyle )
528 switch ( eType )
530 case GDI_PEN :
531 delete (WinMtfLineStyle*)pStyle;
532 break;
533 case GDI_BRUSH :
534 delete (WinMtfFillStyle*)pStyle;
535 break;
536 case GDI_FONT :
537 delete (WinMtfFontStyle*)pStyle;
538 break;
540 default:
541 DBG_ERROR( "unsupported style deleted" );
542 break;
544 pStyle = NULL;
548 ~GDIObj()
550 Delete();
554 // -----------------------------------------------------------------------------
556 class WinMtfOutput
559 WinMtfPathObj aPathObj;
560 WinMtfClipPath aClipPath;
562 WinMtfLineStyle maLatestLineStyle;
563 WinMtfLineStyle maLineStyle;
564 WinMtfFillStyle maLatestFillStyle;
565 WinMtfFillStyle maFillStyle;
566 Font maLatestFont;
567 Font maFont;
568 sal_uInt32 mnLatestTextAlign;
569 sal_uInt32 mnTextAlign;
570 Color maLatestTextColor;
571 Color maTextColor;
572 Color maLatestBkColor;
573 Color maBkColor;
574 sal_uInt32 mnLatestTextLayoutMode;
575 sal_uInt32 mnTextLayoutMode;
576 sal_uInt32 mnLatestBkMode;
577 sal_uInt32 mnBkMode;
578 RasterOp meLatestRasterOp;
579 RasterOp meRasterOp;
581 std::vector< GDIObj* > vGDIObj;
583 Point maActPos;
585 sal_uInt32 mnRop;
586 sal_Bool mbNopMode;
587 sal_Bool mbFillStyleSelected;
589 std::vector< SaveStructPtr > vSaveStack;
591 sal_uInt32 mnGfxMode;
592 sal_uInt32 mnMapMode;
593 UINT16 mnUnitsPerInch;
595 XForm maXForm;
596 sal_Int32 mnDevOrgX, mnDevOrgY;
597 sal_Int32 mnDevWidth, mnDevHeight;
598 sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin
599 sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent
601 sal_Int32 mnPixX, mnPixY; // Reference Device in pixel
602 sal_Int32 mnMillX, mnMillY; // Reference Device in Mill
603 Rectangle mrclFrame; // rectangle in logical units 1/100th mm
604 Rectangle mrclBounds;
606 GDIMetaFile* mpGDIMetaFile;
608 void UpdateLineStyle();
609 void UpdateFillStyle();
611 Point ImplMap( const Point& rPt );
612 Size ImplMap( const Size& rSz );
613 Rectangle ImplMap( const Rectangle& rRectangle );
614 void ImplMap( Font& rFont );
615 Polygon& ImplMap( Polygon& rPolygon );
616 PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon );
617 void ImplResizeObjectArry( UINT32 nNewEntry );
618 void ImplSetNonPersistentLineColorTransparenz();
619 void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly );
620 void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap );
622 public:
624 void SetDevOrg( const Point& rPoint );
625 void SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd );
626 void SetDevExt( const Size& rSize );
627 void ScaleDevExt( double fX, double fY );
629 void SetWinOrg( const Point& rPoint );
630 void SetWinOrgOffset( INT32 nX, INT32 nY );
631 void SetWinExt( const Size& rSize );
632 void ScaleWinExt( double fX, double fY );
634 void SetrclBounds( const Rectangle& rRect );
635 void SetrclFrame( const Rectangle& rRect );
636 void SetRefPix( const Size& rSize );
637 void SetRefMill( const Size& rSize );
639 sal_uInt32 GetMapMode() const { return mnMapMode; };
640 void SetMapMode( sal_uInt32 mnMapMode );
641 void SetUnitsPerInch( UINT16 nUnitsPerInch );
642 void SetWorldTransform( const XForm& rXForm );
643 void ModifyWorldTransform( const XForm& rXForm, UINT32 nMode );
645 void Push();
646 void Pop();
648 UINT32 SetRasterOp( UINT32 nRasterOp );
649 void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill );
651 void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; };
652 sal_Int32 GetGfxMode() const { return mnGfxMode; };
653 void SetBkMode( UINT32 nMode );
654 void SetBkColor( const Color& rColor );
655 void SetTextColor( const Color& rColor );
656 void SetTextAlign( UINT32 nAlign );
657 void CreateObject( GDIObjectType, void* pStyle = NULL );
658 void CreateObject( INT32 nIndex, GDIObjectType, void* pStyle = NULL );
659 void DeleteObject( INT32 nIndex );
660 void SelectObject( INT32 nIndex );
661 CharSet GetCharSet(){ return maFont.GetCharSet(); };
662 WinMtfFillStyle& GetFillStyle () { return maFillStyle; }
663 void SetFont( const Font& rFont );
664 const Font& GetFont() const;
665 void SetTextLayoutMode( const sal_uInt32 nLayoutMode );
666 sal_uInt32 GetTextLayoutMode() const;
668 void ClearPath(){ aPathObj.Init(); };
669 void ClosePath(){ aPathObj.ClosePath(); };
670 const PolyPolygon& GetPathObj(){ return aPathObj; };
672 void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
673 void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
674 void DrawPixel( const Point& rSource, const Color& rColor );
675 void DrawLine( const Point& rSource, const Point& rDest );
676 void DrawRect( const Rectangle& rRect, BOOL bEdge = TRUE );
677 void DrawRoundRect( const Rectangle& rRect, const Size& rSize );
678 void DrawEllipse( const Rectangle& rRect );
679 void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, BOOL bDrawTo = FALSE );
680 void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
681 void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
682 void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False );
683 void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False );
684 void DrawPolyLine( Polygon& rPolygon, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False );
685 void DrawPolyBezier( Polygon& rPolygin, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False );
686 void DrawText( Point& rPosition, String& rString, sal_Int32* pDXArry = NULL, sal_Bool bRecordPath = sal_False,
687 sal_Int32 nGraphicsMode = GM_COMPATIBLE );
688 void ResolveBitmapActions( List& rSaveList );
690 void IntersectClipRect( const Rectangle& rRect );
691 void ExcludeClipRect( const Rectangle& rRect );
692 void MoveClipRegion( const Size& rSize );
693 void SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped );
694 void UpdateClipRegion();
696 void PassEMFPlus( void* pBuffer, UINT32 nLength );
697 void PassEMFPlusHeaderInfo();
699 WinMtfOutput( GDIMetaFile& rGDIMetaFile );
700 virtual ~WinMtfOutput();
703 // -----------------------------------------------------------------------------
705 class WinMtf
707 protected:
709 WinMtfOutput* pOut; //
710 SvStream* pWMF; // Die einzulesende WMF/EMF-Datei
712 UINT32 nStartPos, nEndPos;
713 List aBmpSaveList;
715 FilterConfigItem* pFilterConfigItem;
717 com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
719 // Sorgt dafuer, das aSampledBrush der aktuelle Brush des GDIMetaFiles ist.
721 Color ReadColor();
722 void Callback( USHORT nPercent );
724 WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, FilterConfigItem* pConfigItem = NULL );
725 ~WinMtf();
727 public:
731 //============================ EMFReader ==================================
733 class EnhWMFReader : public WinMtf
735 sal_Bool bRecordPath;
736 sal_Int32 nRecordCount;
737 BOOL bEMFPlus;
740 BOOL ReadHeader();
741 Rectangle ReadRectangle( INT32, INT32, INT32, INT32 ); // Liesst und konvertiert ein Rechteck
742 void ImplExtTextOut( BOOL bWideCharakter );
744 public:
745 EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
746 : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus (FALSE) {};
747 ~EnhWMFReader();
749 BOOL ReadEnhWMF();
750 void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC);
751 void ReadGDIComment();
754 //============================ WMFReader ==================================
756 class WMFReader : public WinMtf
758 private:
760 VirtualDevice aVDev; // just for the purpose of "IsFontAvailable"
761 UINT16 nUnitsPerInch;
762 sal_uInt32 nRecSize;
764 sal_uInt32 nSkipActions;
765 sal_uInt32 nCurrentAction;
766 sal_uInt32 nUnicodeEscapeAction;
768 // Liesst den Kopf der WMF-Datei
769 BOOL ReadHeader(WMF_APMFILEHEADER *pAPMHeader);
771 // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction.
772 void ReadRecordParams( USHORT nFunction );
774 Point ReadPoint(); // Liesst und konvertiert einen Punkt (erst X dann Y)
775 Point ReadYX(); // Liesst und konvertiert einen Punkt (erst Y dann X)
776 Rectangle ReadRectangle(); // Liesst und konvertiert ein Rechteck
777 Size ReadYXExt();
778 sal_Bool GetPlaceableBound( Rectangle& rSize, SvStream* pStrm );
780 public:
782 WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
783 : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) {};
785 // Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile
786 void ReadWMF(WMF_APMFILEHEADER *pAPMHeader=NULL);
789 #endif