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_EMFIO_INC_MTFTOOLS_HXX
21 #define INCLUDED_EMFIO_INC_MTFTOOLS_HXX
22 
23 #include <config_options.h>
24 #include <basegfx/utils/b2dclipstate.hxx>
25 #include <tools/poly.hxx>
26 #include <vcl/font.hxx>
27 #include <vcl/bitmapex.hxx>
28 #include <vcl/lineinfo.hxx>
29 #include <vcl/outdevstate.hxx>
30 #include <rtl/ref.hxx>
31 
32 #include "emfiodllapi.h"
33 
34 #define ERROR                   0
35 #define NULLREGION              1
36 #define COMPLEXREGION           3
37 
38 #define RGN_AND                 1
39 #define RGN_OR                  2
40 #define RGN_XOR                 3
41 #define RGN_DIFF                4
42 #define RGN_COPY                5
43 
44 namespace emfio
45 {
46     enum class BkMode
47     {
48         NONE = 0,
49         Transparent = 1,
50         OPAQUE = 2,
51     };
52 }
53 
54 /* xform stuff */
55 #define MWT_IDENTITY            1
56 #define MWT_LEFTMULTIPLY        2
57 #define MWT_RIGHTMULTIPLY       3
58 #define MWT_SET                 4
59 
60 #define ENHMETA_STOCK_OBJECT    0x80000000
61 
62 /* Stock Logical Objects */
63 #define WHITE_BRUSH             0
64 #define LTGRAY_BRUSH            1
65 #define GRAY_BRUSH              2
66 #define DKGRAY_BRUSH            3
67 #define BLACK_BRUSH             4
68 #define NULL_BRUSH              5
69 #define WHITE_PEN               6
70 #define BLACK_PEN               7
71 #define NULL_PEN                8
72 #define ANSI_FIXED_FONT         11
73 #define ANSI_VAR_FONT           12
74 #define SYSTEM_FIXED_FONT       16
75 
76 namespace emfio
77 {
78     enum class WMFRasterOp {
79         NONE = 0,
80         Black = 1,
81         Not = 6,
82         XorPen = 7,
83         Nop = 11,
84         CopyPen = 13
85     };
86 }
87 
88 /* Mapping modes */
89 #define MM_TEXT                 1
90 #define MM_LOMETRIC             2
91 #define MM_HIMETRIC             3
92 #define MM_LOENGLISH            4
93 #define MM_HIENGLISH            5
94 #define MM_TWIPS                6
95 #define MM_ISOTROPIC            7
96 #define MM_ANISOTROPIC          8
97 
98 /* Graphics modes */
99 #define GM_COMPATIBLE           1
100 #define GM_ADVANCED             2
101 
102 /* StretchBlt() modes */
103 #define BLACKONWHITE            1
104 #define WHITEONBLACK            2
105 #define COLORONCOLOR            3
106 #define HALFTONE                4
107 #define STRETCH_ANDSCANS        BLACKONWHITE
108 #define STRETCH_ORSCANS         WHITEONBLACK
109 #define STRETCH_DELETESCANS     COLORONCOLOR
110 
111 #define LF_FACESIZE             32
112 
113 namespace emfio
114 {
115     struct LOGFONTW
116     {
117         sal_Int32       lfHeight;
118         sal_Int32       lfWidth;
119         sal_Int32       lfEscapement;
120         sal_Int32       lfOrientation;
121         sal_Int32       lfWeight;
122         sal_uInt8       lfItalic;
123         sal_uInt8       lfUnderline;
124         sal_uInt8       lfStrikeOut;
125         sal_uInt8       lfCharSet;
126         sal_uInt8       lfOutPrecision;
127         sal_uInt8       lfClipPrecision;
128         sal_uInt8       lfQuality;
129         sal_uInt8       lfPitchAndFamily;
130         OUString        alfFaceName;
LOGFONTWemfio::LOGFONTW131         LOGFONTW()
132             : lfHeight(0)
133             , lfWidth(0)
134             , lfEscapement(0)
135             , lfOrientation(0)
136             , lfWeight(0)
137             , lfItalic(0)
138             , lfUnderline(0)
139             , lfStrikeOut(0)
140             , lfCharSet(0)
141             , lfOutPrecision(0)
142             , lfClipPrecision(0)
143             , lfQuality(0)
144             , lfPitchAndFamily(0)
145         {
146         }
147     };
148 }
149 
150 #define TA_NOUPDATECP           0x0000
151 #define TA_UPDATECP             0x0001
152 #define TA_LEFT                 0x0000
153 #define TA_RIGHT                0x0002
154 #define TA_CENTER               0x0006
155 #define TA_RIGHT_CENTER  (TA_RIGHT | TA_CENTER)
156 #define TA_TOP                  0x0000
157 #define TA_BOTTOM               0x0008
158 #define TA_BASELINE             0x0018
159 
160 #define SRCCOPY                 0x00CC0020L
161 #define SRCPAINT                0x00EE0086L
162 #define SRCAND                  0x008800C6L
163 #define SRCINVERT               0x00660046L
164 #define SRCERASE                0x00440328L
165 #define PATCOPY                 0x00F00021L
166 #define PATINVERT               0x005A0049L
167 #define BLACKNESS               0x00000042L
168 #define WHITENESS               0x00FF0062L
169 
170 #define PS_SOLID                0
171 #define PS_DASH                 1
172 #define PS_DOT                  2
173 #define PS_DASHDOT              3
174 #define PS_DASHDOTDOT           4
175 #define PS_NULL                 5
176 #define PS_INSIDEFRAME          6
177 #define PS_STYLE_MASK           15
178 
179 #define PS_ENDCAP_ROUND      0x000
180 #define PS_ENDCAP_SQUARE     0x100
181 #define PS_ENDCAP_FLAT       0x200
182 #define PS_ENDCAP_STYLE_MASK 0xF00
183 
184 #define PS_JOIN_ROUND       0x0000
185 #define PS_JOIN_BEVEL       0x1000
186 #define PS_JOIN_MITER       0x2000
187 #define PS_JOIN_STYLE_MASK  0xF000
188 
189 #define ANSI_CHARSET            0
190 #define DEFAULT_CHARSET         1
191 #define SYMBOL_CHARSET          2
192 #define SHIFTJIS_CHARSET        128
193 #define HANGEUL_CHARSET         129
194 #define GB2312_CHARSET          134
195 #define CHINESEBIG5_CHARSET     136
196 #define OEM_CHARSET             255
197 /*WINVER >= 0x0400*/
198 #define JOHAB_CHARSET           130
199 #define HEBREW_CHARSET          177
200 #define ARABIC_CHARSET          178
201 #define GREEK_CHARSET           161
202 #define TURKISH_CHARSET         162
203 #define VIETNAMESE_CHARSET      163
204 #define THAI_CHARSET            222
205 #define EASTEUROPE_CHARSET      238
206 #define RUSSIAN_CHARSET         204
207 #define MAC_CHARSET             77
208 #define BALTIC_CHARSET          186
209 
210 #define ETO_OPAQUE              0x0002
211 #define ETO_CLIPPED             0x0004
212 /*WINVER >= 0x0400*/
213 #define ETO_GLYPH_INDEX         0x0010
214 #define ETO_RTLREADING          0x0080
215 /*_WIN32_WINNT >= 0x0500*/
216 #define ETO_NO_RECT             0x0100
217 #define ETO_PDY                 0x2000
218 
219 #define DEFAULT_PITCH           0x00
220 #define FIXED_PITCH             0x01
221 #define VARIABLE_PITCH          0x02
222 
223 /* Font Families */
224 #define FF_DONTCARE             0x00
225 #define FF_ROMAN                0x10
226 #define FF_SWISS                0x20
227 #define FF_MODERN               0x30
228 #define FF_SCRIPT               0x40
229 #define FF_DECORATIVE           0x50
230 
231 #define FW_THIN                 100
232 #define FW_EXTRALIGHT           200
233 #define FW_LIGHT                300
234 #define FW_NORMAL               400
235 #define FW_MEDIUM               500
236 #define FW_SEMIBOLD             600
237 #define FW_BOLD                 700
238 #define FW_EXTRABOLD            800
239 #define FW_ULTRALIGHT           200
240 #define FW_ULTRABOLD            800
241 #define FW_BLACK                900
242 
243 #define BS_SOLID                0
244 #define BS_NULL                 1
245 #define BS_HOLLOW               1
246 #define BS_HATCHED              2
247 #define BS_PATTERN              3
248 #define BS_INDEXED              4
249 #define BS_DIBPATTERN           5
250 #define BS_DIBPATTERNPT         6
251 #define BS_PATTERN8X8           7
252 #define BS_DIBPATTERN8X8        8
253 #define BS_MONOPATTERN          9
254 
255 #define RDH_RECTANGLES          1
256 #define W_MFCOMMENT             15
257 #define PRIVATE_ESCAPE_UNICODE  2
258 
259 //Scalar constants
260 #define UNDOCUMENTED_WIN_RCL_RELATION 32
261 #define MS_FIXPOINT_BITCOUNT_28_4 4
262 #define HUNDREDTH_MILLIMETERS_PER_MILLIINCH 2.54
263 #define MILLIINCH_PER_TWIPS   1.44
264 
265 class MetaFontAction;
266 
267 //============================ WmfReader ==================================
268 
269 namespace emfio
270 {
271     class WinMtfClipPath
272     {
273         basegfx::utils::B2DClipState maClip;
274 
275     public:
WinMtfClipPath()276         WinMtfClipPath() : maClip() {};
277 
278         void        setClipPath(const basegfx::B2DPolyPolygon&, sal_Int32 nClippingMode);
279         void        intersectClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
280         void        excludeClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
281         void        moveClipRegion(const Size& rSize);
282         void        setDefaultClipPath();
283 
isEmpty() const284         bool        isEmpty() const { return maClip.isCleared(); }
285 
getClip() const286         basegfx::utils::B2DClipState const & getClip() const { return maClip; }
287         basegfx::B2DPolyPolygon const & getClipPath() const;
288 
operator ==(const WinMtfClipPath & rPath) const289         bool        operator==(const WinMtfClipPath& rPath) const
290         {
291             return maClip == rPath.maClip;
292         };
293     };
294 
295     class WinMtfPathObj : public tools::PolyPolygon
296     {
297         bool    bClosed;
298 
299     public:
300 
WinMtfPathObj()301         WinMtfPathObj() :
302             bClosed(true)
303         {}
304 
Init()305         void        Init()
306         {
307             Clear();
308             bClosed = true;
309         }
310 
311         void        ClosePath();
312         void        AddPoint(const Point& rPoint);
313         void        AddPolygon(const tools::Polygon& rPoly);
314         void        AddPolyLine(const tools::Polygon& rPoly);
315         void        AddPolyPolygon(const tools::PolyPolygon& rPolyPolygon);
316     };
317 
318     struct EMFIO_DLLPUBLIC GDIObj
319     {
320         GDIObj() = default;
321         GDIObj(GDIObj const &) = default;
322         virtual ~GDIObj() = default; // Polymorphic base class
323         GDIObj & operator =(GDIObj const &) = default;
324     };
325 
326     struct UNLESS_MERGELIBS(EMFIO_DLLPUBLIC) WinMtfFontStyle final : GDIObj
327     {
328         vcl::Font    aFont;
329 
330         explicit WinMtfFontStyle(LOGFONTW const & rLogFont);
331     };
332 
333     enum class WinMtfFillStyleType
334     {
335         Solid, Pattern
336     };
337 
338     struct WinMtfFillStyle final : GDIObj
339     {
340         Color               aFillColor;
341         bool                bTransparent;
342         WinMtfFillStyleType aType;
343         Bitmap              aBmp;
344 
WinMtfFillStyleemfio::WinMtfFillStyle345         WinMtfFillStyle()
346             : aFillColor(COL_BLACK)
347             , bTransparent(false)
348             , aType(WinMtfFillStyleType::Solid)
349         {}
350 
WinMtfFillStyleemfio::WinMtfFillStyle351         WinMtfFillStyle(const Color& rColor, bool bTrans = false)
352             : aFillColor(rColor)
353             , bTransparent(bTrans)
354             , aType(WinMtfFillStyleType::Solid)
355         {}
356 
WinMtfFillStyleemfio::WinMtfFillStyle357         explicit WinMtfFillStyle(Bitmap const & rBmp)
358             : bTransparent(false)
359             , aType(WinMtfFillStyleType::Pattern)
360             , aBmp(rBmp)
361         {}
362 
operator ==emfio::WinMtfFillStyle363         bool operator==(const WinMtfFillStyle& rStyle) const
364         {
365             return aFillColor == rStyle.aFillColor
366                 && bTransparent == rStyle.bTransparent
367                 && aType == rStyle.aType;
368         }
369     };
370 
371 
372     struct WinMtfPalette final : GDIObj
373     {
374         std::vector< Color > aPaletteColors;
375 
WinMtfPaletteemfio::WinMtfPalette376         WinMtfPalette()
377             : aPaletteColors(std::vector< Color >{})
378         {}
379 
WinMtfPaletteemfio::WinMtfPalette380         WinMtfPalette(const std::vector< Color > rPaletteColors)
381             : aPaletteColors(rPaletteColors)
382         {}
383 
384     };
385 
386 
387     struct WinMtfLineStyle final : GDIObj
388     {
389         Color       aLineColor;
390         LineInfo    aLineInfo;
391         bool        bTransparent;
392 
WinMtfLineStyleemfio::WinMtfLineStyle393         WinMtfLineStyle()
394             : aLineColor(COL_BLACK)
395             , bTransparent(false)
396         {}
397 
WinMtfLineStyleemfio::WinMtfLineStyle398         WinMtfLineStyle(const Color& rColor, bool bTrans = false)
399             : aLineColor(rColor)
400             , bTransparent(bTrans)
401         {}
402 
WinMtfLineStyleemfio::WinMtfLineStyle403         WinMtfLineStyle(const Color& rColor, const LineInfo& rStyle, bool bTrans)
404             : aLineColor(rColor)
405             , aLineInfo(rStyle)
406             , bTransparent(bTrans)
407         {}
408 
operator ==emfio::WinMtfLineStyle409         bool operator==(const WinMtfLineStyle& rStyle) const
410         {
411             return aLineColor == rStyle.aLineColor
412                 && bTransparent == rStyle.bTransparent
413                 && aLineInfo == rStyle.aLineInfo;
414         }
415     };
416 
417     struct XForm
418     {
419         float   eM11;
420         float   eM12;
421         float   eM21;
422         float   eM22;
423         float   eDx;
424         float   eDy;
425 
XFormemfio::XForm426         XForm()
427             : eM11(1.0f)
428             , eM12(0.0f)
429             , eM21(0.0f)
430             , eM22(1.0f)
431             , eDx(0.0f)
432             , eDy(0.0f)
433         {}
434     };
435 
436     SvStream& operator >> (SvStream& rInStream, XForm& rXForm);
437 
438     struct SaveStruct
439     {
440         BkMode              nBkMode;
441         sal_uInt32          nMapMode, nGfxMode;
442         ComplexTextLayoutFlags nTextLayoutMode;
443         sal_Int32           nWinOrgX, nWinOrgY, nWinExtX, nWinExtY;
444         sal_Int32           nDevOrgX, nDevOrgY, nDevWidth, nDevHeight;
445 
446         WinMtfLineStyle     aLineStyle;
447         WinMtfFillStyle     aFillStyle;
448 
449         vcl::Font           aFont;
450         Color               aBkColor;
451         Color               aTextColor;
452         sal_uInt32          nTextAlign;
453         RasterOp            eRasterOp;
454 
455         Point               aActPos;
456         WinMtfPathObj       maPathObj;
457         WinMtfClipPath      maClipPath;
458         XForm               aXForm;
459 
460         bool                bFillStyleSelected;
461     };
462 
463     struct BSaveStruct
464     {
465         BitmapEx            aBmpEx;
466         tools::Rectangle    aOutRect;
467         sal_uInt32          nWinRop;
468         bool m_bForceAlpha = false;
469 
BSaveStructemfio::BSaveStruct470         BSaveStruct(const Bitmap& rBmp, const tools::Rectangle& rOutRect, sal_uInt32 nRop)
471             : aBmpEx(rBmp)
472             , aOutRect(rOutRect)
473             , nWinRop(nRop)
474         {}
475 
BSaveStructemfio::BSaveStruct476         BSaveStruct(const BitmapEx& rBmpEx, const tools::Rectangle& rOutRect, sal_uInt32 nRop,
477                     bool bForceAlpha = false)
478             : aBmpEx(rBmpEx)
479             , aOutRect(rOutRect)
480             , nWinRop(nRop)
481             , m_bForceAlpha(bForceAlpha)
482         {}
483     };
484 
485     // tdf#127471 implement detection and correction of wrongly scaled
486     // fonts in own-written, old (before this fix) EMF/WMF files
487     class ScaledFontDetectCorrectHelper
488     {
489     private:
490         rtl::Reference<MetaFontAction>                                  maCurrentMetaFontAction;
491         std::vector<double>                                             maAlternativeFontScales;
492         std::vector<std::pair<rtl::Reference<MetaFontAction>, double>>  maPositiveIdentifiedCases;
493         std::vector<std::pair<rtl::Reference<MetaFontAction>, double>>  maNegativeIdentifiedCases;
494 
495     public:
496         ScaledFontDetectCorrectHelper();
497         void endCurrentMetaFontAction();
498         void newCurrentMetaFontAction(rtl::Reference<MetaFontAction>& rNewMetaFontAction);
499         void evaluateAlternativeFontScale(OUString const & rText, tools::Long nImportedTextLength);
500         void applyAlternativeFontScale();
501     };
502 
503     class MtfTools
504     {
505         MtfTools(MtfTools const &) = delete;
506         MtfTools& operator =(MtfTools const &) = delete;
507 
508     protected:
509         WinMtfPathObj       maPathObj;
510         WinMtfClipPath      maClipPath;
511 
512         WinMtfLineStyle     maLatestLineStyle;
513         WinMtfLineStyle     maLineStyle;
514         WinMtfLineStyle     maNopLineStyle;
515         WinMtfFillStyle     maLatestFillStyle;
516         WinMtfFillStyle     maFillStyle;
517         WinMtfFillStyle     maNopFillStyle;
518         WinMtfPalette       maPalette;
519 
520         vcl::Font           maLatestFont;
521         vcl::Font           maFont;
522         sal_uInt32          mnLatestTextAlign;
523         sal_uInt32          mnTextAlign;
524         Color               maLatestTextColor;
525         Color               maTextColor;
526         Color               maLatestBkColor;
527         Color               maBkColor;
528         ComplexTextLayoutFlags  mnLatestTextLayoutMode;
529         ComplexTextLayoutFlags  mnTextLayoutMode;
530         BkMode              mnLatestBkMode;
531         BkMode              mnBkMode;
532         RasterOp            meLatestRasterOp;
533         RasterOp            meRasterOp;
534 
535         std::vector< std::unique_ptr<GDIObj> > mvGDIObj;
536         Point               maActPos;
537         WMFRasterOp         mnRop;
538         std::vector< std::shared_ptr<SaveStruct> > mvSaveStack;
539 
540         sal_uInt32          mnGfxMode;
541         sal_uInt32          mnMapMode;
542 
543         XForm               maXForm;
544         sal_Int32           mnDevOrgX;
545         sal_Int32           mnDevOrgY;
546         sal_Int32           mnDevWidth;
547         sal_Int32           mnDevHeight;
548         sal_Int32           mnWinOrgX;
549         sal_Int32           mnWinOrgY;
550         sal_Int32           mnWinExtX;
551         sal_Int32           mnWinExtY;
552 
553         sal_Int32           mnPixX;            // Reference Device in pixel
554         sal_Int32           mnPixY;            // Reference Device in pixel
555         sal_Int32           mnMillX;           // Reference Device in Mill
556         sal_Int32           mnMillY;           // Reference Device in Mill
557         tools::Rectangle    mrclFrame;
558         tools::Rectangle    mrclBounds;
559 
560         GDIMetaFile*        mpGDIMetaFile;
561 
562         SvStream*           mpInputStream;               // the WMF/EMF file to be read
563         sal_uInt32          mnStartPos;
564         sal_uInt32          mnEndPos;
565         std::vector<std::unique_ptr<BSaveStruct>>    maBmpSaveList;
566 
567         // tdf#127471 always try to detect - only used with ScaledText
568         ScaledFontDetectCorrectHelper maScaledFontHelper;
569 
570         bool                mbNopMode : 1;
571         bool                mbFillStyleSelected : 1;
572         bool                mbClipNeedsUpdate : 1;
573         bool                mbComplexClip : 1;
574         bool                mbIsMapWinSet : 1;
575         bool                mbIsMapDevSet : 1;
576 
577         void                UpdateLineStyle();
578         void                UpdateFillStyle();
579 
580         Point               ImplMap(const Point& rPt);
581         Point               ImplScale(const Point& rPt);
582         Size                ImplMap(const Size& rSize, bool bDoWorldTransform = true);
583         tools::Rectangle    ImplMap(const tools::Rectangle& rRectangle);
584         void                ImplMap(vcl::Font& rFont);
585         tools::Polygon&     ImplMap(tools::Polygon& rPolygon);
586         tools::PolyPolygon& ImplMap(tools::PolyPolygon& rPolyPolygon);
587         void                ImplScale(tools::Polygon& rPolygon);
588         tools::PolyPolygon& ImplScale(tools::PolyPolygon& rPolyPolygon);
589         void                ImplResizeObjectArry(sal_uInt32 nNewEntry);
590         void                ImplSetNonPersistentLineColorTransparenz();
591         void                ImplDrawClippedPolyPolygon(const tools::PolyPolygon& rPolyPoly);
592         void                ImplDrawBitmap(const Point& rPos, const Size& rSize, const BitmapEx& rBitmap);
593 
594     public:
595 
596         void                SetDevByWin(); //Hack to set varying defaults for incompletely defined files.
597         void                SetDevOrg(const Point& rPoint);
598         void                SetDevOrgOffset(sal_Int32 nXAdd, sal_Int32 nYAdd);
599         void                SetDevExt(const Size& rSize, bool regular = true);
600         void                ScaleDevExt(double fX, double fY);
601 
602         void                SetWinOrg(const Point& rPoint, bool bIsEMF = false);
603         void                SetWinOrgOffset(sal_Int32 nX, sal_Int32 nY);
604         void                SetWinExt(const Size& rSize, bool bIsEMF = false);
605         void                ScaleWinExt(double fX, double fY);
606 
607         void                SetrclBounds(const tools::Rectangle& rRect);
608         void                SetrclFrame(const tools::Rectangle& rRect);
609         void                SetRefPix(const Size& rSize);
610         void                SetRefMill(const Size& rSize);
611 
612         void                SetMapMode(sal_uInt32 mnMapMode);
613         void                SetWorldTransform(const XForm& rXForm);
614         void                ModifyWorldTransform(const XForm& rXForm, sal_uInt32 nMode);
615 
616         void                Push();
617         void                Pop( const sal_Int32 nSavedDC = -1 );
618 
619         WMFRasterOp         SetRasterOp(WMFRasterOp nRasterOp);
620         void                StrokeAndFillPath(bool bStroke, bool bFill);
621 
SetGfxMode(sal_Int32 nGfxMode)622         void                SetGfxMode(sal_Int32 nGfxMode) { mnGfxMode = nGfxMode; };
GetGfxMode() const623         sal_Int32           GetGfxMode() const { return mnGfxMode; };
624         void                SetBkMode(BkMode nMode);
625         void                SetBkColor(const Color& rColor);
626         void                SetTextColor(const Color& rColor);
627         void                SetTextAlign(sal_uInt32 nAlign);
628 
629         void                CreateObject(std::unique_ptr<GDIObj> pObject);
630         void                CreateObjectIndexed(sal_uInt32 nIndex, std::unique_ptr<GDIObj> pObject);
631         void                CreateObject();
632 
633         void                DeleteObject(sal_uInt32 nIndex);
634         void                SelectObject(sal_uInt32 nIndex);
GetCharSet() const635         rtl_TextEncoding    GetCharSet() const { return maFont.GetCharSet(); };
GetFont() const636         const vcl::Font&    GetFont() const { return maFont; }
637         void                SetTextLayoutMode(ComplexTextLayoutFlags nLayoutMode);
638 
ClearPath()639         void                ClearPath() { maPathObj.Init(); };
ClosePath()640         void                ClosePath() { maPathObj.ClosePath(); };
GetPathObj() const641         const tools::PolyPolygon& GetPathObj() const { return maPathObj; };
642 
643         void                MoveTo(const Point& rPoint, bool bRecordPath = false);
644         void                LineTo(const Point& rPoint, bool bRecordPath = false);
645         void                DrawPixel(const Point& rSource, const Color& rColor);
646         void                DrawRect(const tools::Rectangle& rRect, bool bEdge = true);
647         void                DrawRectWithBGColor(const tools::Rectangle& rRect);
648         void                DrawRoundRect(const tools::Rectangle& rRect, const Size& rSize);
649         void                DrawEllipse(const tools::Rectangle& rRect);
650         void                DrawArc(
651             const tools::Rectangle& rRect,
652             const Point& rStartAngle,
653             const Point& rEndAngle,
654             bool bDrawTo = false
655         );
656         void                DrawPie(
657             const tools::Rectangle& rRect,
658             const Point& rStartAngle,
659             const Point& rEndAngle
660         );
661         void                DrawChord(
662             const tools::Rectangle& rRect,
663             const Point& rStartAngle,
664             const Point& rEndAngle
665         );
666         void                DrawPolygon(tools::Polygon rPolygon, bool bRecordPath);
667         void                DrawPolyPolygon(tools::PolyPolygon& rPolyPolygon, bool bRecordPath = false);
668         void                DrawPolyLine(tools::Polygon rPolygon,
669             bool bDrawTo = false,
670             bool bRecordPath = false
671         );
672         void                DrawPolyBezier(tools::Polygon rPolygon,
673             bool bDrawTo,
674             bool bRecordPath
675         );
676         void                DrawText(Point& rPosition,
677             OUString const & rString,
678             tools::Long* pDXArry = nullptr,
679             tools::Long* pDYArry = nullptr,
680             bool bRecordPath = false,
681             sal_Int32 nGraphicsMode = GM_COMPATIBLE);
682 
683         void                ResolveBitmapActions(std::vector<std::unique_ptr<BSaveStruct>>& rSaveList);
684 
685         void                IntersectClipRect(const tools::Rectangle& rRect);
686         void                ExcludeClipRect(const tools::Rectangle& rRect);
687         void                MoveClipRegion(const Size& rSize);
688         void                SetClipPath(
689             const tools::PolyPolygon& rPolyPoly,
690             sal_Int32 nClippingMode,
691             bool bIsMapped
692         );
693         void                SetDefaultClipPath();
694         void                UpdateClipRegion();
695         void                AddFromGDIMetaFile(GDIMetaFile& rGDIMetaFile);
696 
697         void                PassEMFPlus(void const * pBuffer, sal_uInt32 nLength);
698         void                PassEMFPlusHeaderInfo();
699 
700         Color               ReadColor();
701 
702         explicit            MtfTools(GDIMetaFile& rGDIMetaFile, SvStream& rStreamWMF);
703         ~MtfTools() COVERITY_NOEXCEPT_FALSE;
704     };
705 }
706 
707 #endif
708 
709 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
710