summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2022-02-28 00:07:16 +0100
committerHossein <hossein@libreoffice.org>2022-03-15 13:00:59 +0100
commit3e7dd04dd8ca1baea4b7918eb7a7080c595c4625 (patch)
tree385b48cbef6b844f5a1dbaffc8471bafcfb71912 /emfio
parent9b6a44a3d58cb050156f6f5253c14f6e0f79eabf (diff)
tdf#145614 Convert #define to enum and constexpr
* Converted symbolic constants with #define in mftools.hxx to: a) 'enum' where facing multiple values of the same category with similar prefixes, or enums from the [MS-WMF] / [MS-EMF] b) extracted the underlying integral type from the above documents c) 'constexpr' where there was a single value * Where possible, 'enum class' in 'emfio' namespace is used * Some enums with binary or comparison operations are not converted MappingMode, TextAlignmentMode, RasterOperations, PenStyle CharacterSet, ExtTextOutOptions, PitchFont, FamilyFont, WeightFont Change-Id: I144b2df4722e23d3b0c0aca7880cf603faa80686 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124099 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/inc/mtftools.hxx445
-rw-r--r--emfio/qa/cppunit/wmf/wmfimporttest.cxx4
-rw-r--r--emfio/source/reader/emfreader.cxx23
-rw-r--r--emfio/source/reader/mtftools.cxx168
-rw-r--r--emfio/source/reader/wmfreader.cxx64
5 files changed, 397 insertions, 307 deletions
diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index d258a9250b91..cb6e1c7ff243 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -32,51 +32,60 @@
#include "emfiodllapi.h"
-#define ERROR 0
-#define NULLREGION 1
-#define COMPLEXREGION 3
-
-#define RGN_AND 1
-#define RGN_OR 2
-#define RGN_XOR 3
-#define RGN_DIFF 4
-#define RGN_COPY 5
-
namespace emfio
{
- enum class BkMode
+ /* [MS-EMF] - v20210625 - pages 43, 107 */
+ enum class RegionMode : sal_uInt32
+ {
+ RGN_AND = 0x01,
+ RGN_OR = 0x02,
+ RGN_XOR = 0x03,
+ RGN_DIFF = 0x04,
+ RGN_COPY = 0x05
+ };
+
+ /* [MS-EMF] - v20210625 - pages 40, 198 */
+ enum class BackgroundMode : sal_uInt32
{
NONE = 0,
Transparent = 1,
OPAQUE = 2,
};
-}
-/* xform stuff */
-#define MWT_IDENTITY 1
-#define MWT_LEFTMULTIPLY 2
-#define MWT_RIGHTMULTIPLY 3
-#define MWT_SET 4
-
-#define ENHMETA_STOCK_OBJECT 0x80000000
-
-/* Stock Logical Objects */
-#define WHITE_BRUSH 0
-#define LTGRAY_BRUSH 1
-#define GRAY_BRUSH 2
-#define DKGRAY_BRUSH 3
-#define BLACK_BRUSH 4
-#define NULL_BRUSH 5
-#define WHITE_PEN 6
-#define BLACK_PEN 7
-#define NULL_PEN 8
-#define ANSI_FIXED_FONT 11
-#define ANSI_VAR_FONT 12
-#define SYSTEM_FIXED_FONT 16
+ /* [MS-EMF] - v20210625 - pages 40, 210 */
+ /* xform stuff */
+ enum class ModifyWorldTransformMode : sal_uInt32
+ {
+ MWT_IDENTITY = 0x01,
+ MWT_LEFTMULTIPLY = 0x02,
+ MWT_RIGHTMULTIPLY = 0x03,
+ MWT_SET = 0x04
+ };
+
+ constexpr sal_uInt32 ENHMETA_STOCK_OBJECT = 0x80000000;
-namespace emfio
-{
- enum class WMFRasterOp {
+ /* [MS-EMF] - v20210625 - pages 44, 45, 182 */
+ /* Stock Logical Objects */
+ enum class StockObject : sal_uInt32
+ {
+ WHITE_BRUSH = 0,
+ LTGRAY_BRUSH = 1,
+ GRAY_BRUSH = 2,
+ DKGRAY_BRUSH = 3,
+ BLACK_BRUSH = 4,
+ NULL_BRUSH = 5,
+ WHITE_PEN = 6,
+ BLACK_PEN = 7,
+ NULL_PEN = 8,
+ ANSI_FIXED_FONT = 11,
+ ANSI_VAR_FONT = 12,
+ SYSTEM_FIXED_FONT = 16
+ };
+
+ /* Note: This enum is incomplete compared to the specification */
+ /* [MS-WMF] - v20210625 - pages 25-26 */
+ enum class WMFRasterOp : sal_uInt16
+ {
NONE = 0,
Black = 1,
Not = 6,
@@ -84,35 +93,48 @@ namespace emfio
Nop = 11,
CopyPen = 13
};
-}
-/* Mapping modes */
-#define MM_TEXT 1
-#define MM_LOMETRIC 2
-#define MM_HIMETRIC 3
-#define MM_LOENGLISH 4
-#define MM_HIENGLISH 5
-#define MM_TWIPS 6
-#define MM_ISOTROPIC 7
-#define MM_ANISOTROPIC 8
-
-/* Graphics modes */
-#define GM_COMPATIBLE 1
-#define GM_ADVANCED 2
-
-/* StretchBlt() modes */
-#define BLACKONWHITE 1
-#define WHITEONBLACK 2
-#define COLORONCOLOR 3
-#define HALFTONE 4
-#define STRETCH_ANDSCANS BLACKONWHITE
-#define STRETCH_ORSCANS WHITEONBLACK
-#define STRETCH_DELETESCANS COLORONCOLOR
-
-#define LF_FACESIZE 32
+ /* Note: We have MapMode elsewhere, so we use MappingMode instead */
+ /* [MS-EMF] - v20210625 - pages 38-50, 202 */
+ /* Mapping modes */
+ enum MappingMode : sal_uInt32
+ {
+ MM_TEXT = 0x01,
+ MM_LOMETRIC = 0x02,
+ MM_HIMETRIC = 0x03,
+ MM_LOENGLISH = 0x04,
+ MM_HIENGLISH = 0x05,
+ MM_TWIPS = 0x06,
+ MM_ISOTROPIC = 0x07,
+ MM_ANISOTROPIC = 0x08
+ };
+
+ /* Note: No type is specified, but 32-bit unsigned is used to provide
+ * to match the number of bits in the binary literal, and also the
+ * previous definition of SetGfxMode() and GetGfxMode() functions */
+ /* [MS-EMF] - v20210625 - pages 35 */
+ /* Graphics modes */
+ enum class GraphicsMode : sal_uInt32
+ {
+ GM_COMPATIBLE = 0x00000001,
+ GM_ADVANCED = 0x00000002
+ } ;
+
+ /* [MS-WMF] - v20210625 - pages 46 */
+ /* StretchBlt() modes */
+ enum class StretchMode : sal_uInt16
+ {
+ BLACKONWHITE = 0x0001,
+ WHITEONBLACK = 0x0002,
+ COLORONCOLOR = 0x0003,
+ HALFTONE = 0x0004,
+ STRETCH_ANDSCANS = BLACKONWHITE,
+ STRETCH_ORSCANS = WHITEONBLACK,
+ STRETCH_DELETESCANS = COLORONCOLOR
+ };
+
+ constexpr sal_Int32 LF_FACESIZE = 32;
-namespace emfio
-{
struct LOGFONTW
{
sal_Int32 lfHeight;
@@ -146,120 +168,162 @@ namespace emfio
{
}
};
-}
-#define TA_NOUPDATECP 0x0000
-#define TA_UPDATECP 0x0001
-#define TA_LEFT 0x0000
-#define TA_RIGHT 0x0002
-#define TA_CENTER 0x0006
-#define TA_RIGHT_CENTER (TA_RIGHT | TA_CENTER)
-#define TA_TOP 0x0000
-#define TA_BOTTOM 0x0008
-#define TA_BASELINE 0x0018
-
-#define SRCCOPY 0x00CC0020L
-#define SRCPAINT 0x00EE0086L
-#define SRCAND 0x008800C6L
-#define SRCINVERT 0x00660046L
-#define SRCERASE 0x00440328L
-#define PATCOPY 0x00F00021L
-#define PATINVERT 0x005A0049L
-#define BLACKNESS 0x00000042L
-#define WHITENESS 0x00FF0062L
-
-#define PS_SOLID 0
-#define PS_DASH 1
-#define PS_DOT 2
-#define PS_DASHDOT 3
-#define PS_DASHDOTDOT 4
-#define PS_NULL 5
-#define PS_INSIDEFRAME 6
-#define PS_STYLE_MASK 15
-
-#define PS_ENDCAP_ROUND 0x000
-#define PS_ENDCAP_SQUARE 0x100
-#define PS_ENDCAP_FLAT 0x200
-#define PS_ENDCAP_STYLE_MASK 0xF00
-
-#define PS_JOIN_ROUND 0x0000
-#define PS_JOIN_BEVEL 0x1000
-#define PS_JOIN_MITER 0x2000
-#define PS_JOIN_STYLE_MASK 0xF000
-
-#define ANSI_CHARSET 0
-#define DEFAULT_CHARSET 1
-#define SYMBOL_CHARSET 2
-#define SHIFTJIS_CHARSET 128
-#define HANGEUL_CHARSET 129
-#define GB2312_CHARSET 134
-#define CHINESEBIG5_CHARSET 136
-#define OEM_CHARSET 255
-/*WINVER >= 0x0400*/
-#define JOHAB_CHARSET 130
-#define HEBREW_CHARSET 177
-#define ARABIC_CHARSET 178
-#define GREEK_CHARSET 161
-#define TURKISH_CHARSET 162
-#define VIETNAMESE_CHARSET 163
-#define THAI_CHARSET 222
-#define EASTEUROPE_CHARSET 238
-#define RUSSIAN_CHARSET 204
-#define MAC_CHARSET 77
-#define BALTIC_CHARSET 186
-
-#define ETO_OPAQUE 0x0002
-#define ETO_CLIPPED 0x0004
-/*WINVER >= 0x0400*/
-#define ETO_GLYPH_INDEX 0x0010
-#define ETO_RTLREADING 0x0080
-/*_WIN32_WINNT >= 0x0500*/
-#define ETO_NO_RECT 0x0100
-#define ETO_PDY 0x2000
-
-#define DEFAULT_PITCH 0x00
-#define FIXED_PITCH 0x01
-#define VARIABLE_PITCH 0x02
-
-/* Font Families */
-#define FF_DONTCARE 0x00
-#define FF_ROMAN 0x10
-#define FF_SWISS 0x20
-#define FF_MODERN 0x30
-#define FF_SCRIPT 0x40
-#define FF_DECORATIVE 0x50
-
-#define FW_THIN 100
-#define FW_EXTRALIGHT 200
-#define FW_LIGHT 300
-#define FW_NORMAL 400
-#define FW_MEDIUM 500
-#define FW_SEMIBOLD 600
-#define FW_BOLD 700
-#define FW_EXTRABOLD 800
-#define FW_ULTRALIGHT 200
-#define FW_ULTRABOLD 800
-#define FW_BLACK 900
-
-#define BS_SOLID 0
-#define BS_NULL 1
-#define BS_HOLLOW 1
-#define BS_HATCHED 2
-#define BS_PATTERN 3
-#define BS_INDEXED 4
-#define BS_DIBPATTERN 5
-#define BS_DIBPATTERNPT 6
-#define BS_PATTERN8X8 7
-#define BS_DIBPATTERN8X8 8
-#define BS_MONOPATTERN 9
-
-#define RDH_RECTANGLES 1
-#define W_MFCOMMENT 15
-#define PRIVATE_ESCAPE_UNICODE 2
-
-//Scalar constants
-#define UNDOCUMENTED_WIN_RCL_RELATION 32
-#define MS_FIXPOINT_BITCOUNT_28_4 4
+ /* [MS-WMF] - v20210625 - pages 153 */
+ enum TextAlignmentMode : sal_uInt16
+ {
+ TA_NOUPDATECP = 0x0000,
+ TA_UPDATECP = 0x0001,
+ TA_LEFT = 0x0000,
+ TA_RIGHT = 0x0002,
+ TA_CENTER = 0x0006,
+ TA_RIGHT_CENTER = (TA_RIGHT | TA_CENTER),
+ TA_TOP = 0x0000,
+ TA_BOTTOM = 0x0008,
+ TA_BASELINE = 0x0018,
+ TA_RTLREADING = 0x0100
+ };
+
+ /* Note: This enum is incomplete compared to the specification */
+ /* [MS-EMF] - v20210625 - pages 47-50, 126 */
+ /* Ternary raster operations */
+ enum TernaryRasterOperation : sal_uInt32
+ {
+ SRCCOPY = 0x00CC0020L,
+ SRCPAINT = 0x00EE0086L,
+ SRCAND = 0x008800C6L,
+ SRCINVERT = 0x00660046L,
+ SRCERASE = 0x00440328L,
+ PATCOPY = 0x00F00021L,
+ PATINVERT = 0x005A0049L,
+ BLACKNESS = 0x00000042L,
+ WHITENESS = 0x00FF0062L
+ };
+
+ /* [MS-EMF] - v20210625 - pages 40, 41, 65 */
+ enum PenStyle : sal_uInt32
+ {
+ PS_COSMETIC = 0x00000000,
+ PS_ENDCAP_ROUND = 0x00000000,
+ PS_JOIN_ROUND = 0x00000000,
+ PS_SOLID = 0x00000000,
+ PS_DASH = 0x00000001,
+ PS_DOT = 0x00000002,
+ PS_DASHDOT = 0x00000003,
+ PS_DASHDOTDOT = 0x00000004,
+ PS_NULL = 0x00000005,
+ PS_INSIDEFRAME = 0x00000006,
+ PS_USERSTYLE = 0x00000007,
+ PS_ALTERNATE = 0x00000008,
+ PS_STYLE_MASK = 0x0000000F,
+ PS_ENDCAP_SQUARE = 0x00000100,
+ PS_ENDCAP_FLAT = 0x00000200,
+ PS_ENDCAP_STYLE_MASK = 0x00000F00,
+ PS_JOIN_BEVEL = 0x00001000,
+ PS_JOIN_MITER = 0x00002000,
+ PS_JOIN_STYLE_MASK = 0x0000F000,
+ PS_GEOMETRIC = 0x00010000
+ };
+
+ /* [MS-WMF] - v20210625 - pages 30, 82 */
+ /* Character Sets */
+ enum CharacterSet : sal_uInt8
+ {
+ ANSI_CHARSET = 0x00000000,
+ DEFAULT_CHARSET = 0x00000001,
+ SYMBOL_CHARSET = 0x00000002,
+ SHIFTJIS_CHARSET = 0x00000080,
+ HANGUL_CHARSET = 0x00000081,
+ GB2312_CHARSET = 0x00000086,
+ CHINESEBIG5_CHARSET = 0x00000088,
+ OEM_CHARSET = 0x000000FF,
+ /* WINVER >= 0x0400 */
+ MAC_CHARSET = 0x0000004D,
+ JOHAB_CHARSET = 0x00000082,
+ GREEK_CHARSET = 0x000000A1,
+ TURKISH_CHARSET = 0x000000A2,
+ VIETNAMESE_CHARSET = 0x000000A3,
+ HEBREW_CHARSET = 0x000000B1,
+ ARABIC_CHARSET = 0x000000B2,
+ BALTIC_CHARSET = 0x000000BA,
+ RUSSIAN_CHARSET = 0x000000CC,
+ THAI_CHARSET = 0x000000DE,
+ EASTEUROPE_CHARSET = 0x000000EE
+ };
+
+ /* Note: This enum is incomplete compared to the specification */
+ /* [MS-EMF] - v20210625 - pages 32, 283 */
+ enum ExtTextOutOptions : sal_uInt32
+ {
+ ETO_OPAQUE = 0x0002,
+ ETO_CLIPPED = 0x0004,
+ /* WINVER >= 0x0400 */
+ ETO_GLYPH_INDEX = 0x0010,
+ ETO_RTLREADING = 0x0080,
+ /* _WIN32_WINNT >= 0x0500 */
+ ETO_NO_RECT = 0x0100,
+ ETO_PDY = 0x2000
+ };
+
+ /* [MS-WMF] - v20210625 - pages 44, 96 */
+ /* This is packed into a byte as 2 bits */
+ enum PitchFont : sal_uInt8
+ {
+ DEFAULT_PITCH = 0,
+ FIXED_PITCH = 1,
+ VARIABLE_PITCH = 2
+ };
+
+ /* [MS-WMF] - v20210625 - pages 33, */
+ enum FamilyFont : sal_uInt32
+ {
+ FF_DONTCARE = 0x00,
+ FF_ROMAN = 0x01,
+ FF_SWISS = 0x02,
+ FF_MODERN = 0x03,
+ FF_SCRIPT = 0x04,
+ FF_DECORATIVE = 0x05
+ };
+
+ enum WeightFont
+ {
+ FW_THIN = 100,
+ FW_EXTRALIGHT = 200,
+ FW_LIGHT = 300,
+ FW_NORMAL = 400,
+ FW_MEDIUM = 500,
+ FW_SEMIBOLD = 600,
+ FW_BOLD = 700,
+ FW_EXTRABOLD = 800,
+ FW_ULTRALIGHT = 200,
+ FW_ULTRABOLD = 800,
+ FW_BLACK = 900
+ };
+
+ /* [MS-WMF] - v20210625 - pages 29, 30, 182 */
+ enum class BrushStyle : sal_uInt16
+ {
+ BS_SOLID = 0,
+ BS_NULL = 1,
+ BS_HOLLOW = 1,
+ BS_HATCHED = 2,
+ BS_PATTERN = 3,
+ BS_INDEXED = 4,
+ BS_DIBPATTERN = 5,
+ BS_DIBPATTERNPT = 6,
+ BS_PATTERN8X8 = 7,
+ BS_DIBPATTERN8X8 = 8,
+ BS_MONOPATTERN = 9
+ };
+
+ constexpr sal_Int32 RDH_RECTANGLES = 1;
+ constexpr sal_Int32 W_MFCOMMENT = 15;
+ constexpr sal_Int32 PRIVATE_ESCAPE_UNICODE = 2;
+
+ //Scalar constants
+ constexpr sal_Int32 UNDOCUMENTED_WIN_RCL_RELATION = 32;
+ constexpr sal_Int32 MS_FIXPOINT_BITCOUNT_28_4 = 4;
+}
//============================ WmfReader ==================================
@@ -272,7 +336,7 @@ namespace emfio
public:
WinMtfClipPath() : maClip() {};
- void setClipPath(const basegfx::B2DPolyPolygon&, sal_Int32 nClippingMode);
+ void setClipPath(const basegfx::B2DPolyPolygon&, RegionMode nClippingMode);
void intersectClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
void excludeClip(const basegfx::B2DPolyPolygon& rPolyPolygon);
void moveClipRegion(const Size& rSize);
@@ -434,8 +498,9 @@ namespace emfio
struct SaveStruct
{
- BkMode nBkMode;
- sal_uInt32 nMapMode, nGfxMode;
+ BackgroundMode nBkMode;
+ MappingMode eMapMode;
+ GraphicsMode eGfxMode;
vcl::text::ComplexTextLayoutFlags nTextLayoutMode;
sal_Int32 nWinOrgX, nWinOrgY, nWinExtX, nWinExtY;
sal_Int32 nDevOrgX, nDevOrgY, nDevWidth, nDevHeight;
@@ -525,8 +590,8 @@ namespace emfio
Color maBkColor;
vcl::text::ComplexTextLayoutFlags mnLatestTextLayoutMode;
vcl::text::ComplexTextLayoutFlags mnTextLayoutMode;
- BkMode mnLatestBkMode;
- BkMode mnBkMode;
+ BackgroundMode mnLatestBkMode;
+ BackgroundMode mnBkMode;
RasterOp meLatestRasterOp;
RasterOp meRasterOp;
@@ -535,8 +600,8 @@ namespace emfio
WMFRasterOp mnRop;
std::vector< std::shared_ptr<SaveStruct> > mvSaveStack;
- sal_uInt32 mnGfxMode;
- sal_uInt32 mnMapMode;
+ GraphicsMode meGfxMode;
+ MappingMode meMapMode;
XForm maXForm;
sal_Int32 mnDevOrgX;
@@ -608,9 +673,9 @@ namespace emfio
void SetRefPix(const Size& rSize);
void SetRefMill(const Size& rSize);
- void SetMapMode(sal_uInt32 mnMapMode);
+ void SetMapMode(MappingMode mnMapMode);
void SetWorldTransform(const XForm& rXForm);
- void ModifyWorldTransform(const XForm& rXForm, sal_uInt32 nMode);
+ void ModifyWorldTransform(const XForm& rXForm, ModifyWorldTransformMode nMode);
void Push();
void Pop( const sal_Int32 nSavedDC = -1 );
@@ -618,11 +683,11 @@ namespace emfio
WMFRasterOp SetRasterOp(WMFRasterOp nRasterOp);
void StrokeAndFillPath(bool bStroke, bool bFill);
- void SetGfxMode(sal_Int32 nGfxMode) { mnGfxMode = nGfxMode; };
- sal_Int32 GetGfxMode() const { return mnGfxMode; };
void SetArcDirection(bool bCounterClockWise);
bool IsArcDirectionClockWise() { return mbClockWiseArcDirection; };
- void SetBkMode(BkMode nMode);
+ void SetGfxMode(GraphicsMode nGfxMode) { meGfxMode = nGfxMode; };
+ GraphicsMode GetGfxMode() const { return meGfxMode; };
+ void SetBkMode(BackgroundMode nMode);
void SetBkColor(const Color& rColor);
void SetTextColor(const Color& rColor);
void SetTextAlign(sal_uInt32 nAlign);
@@ -679,7 +744,7 @@ namespace emfio
std::vector<sal_Int32>* pDXArry = nullptr,
tools::Long* pDYArry = nullptr,
bool bRecordPath = false,
- sal_Int32 nGraphicsMode = GM_COMPATIBLE);
+ GraphicsMode nGraphicsMode = GraphicsMode::GM_COMPATIBLE);
void ResolveBitmapActions(std::vector<BSaveStruct>& rSaveList);
@@ -688,7 +753,7 @@ namespace emfio
void MoveClipRegion(const Size& rSize);
void SetClipPath(
const tools::PolyPolygon& rPolyPoly,
- sal_Int32 nClippingMode,
+ RegionMode nClippingMode,
bool bIsMapped
);
void SetDefaultClipPath();
diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 846527b3aa22..31511202abcd 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -335,8 +335,8 @@ void WmfTest::testTdf99402()
logfontw.lfItalic = 0;
logfontw.lfUnderline = 0;
logfontw.lfStrikeOut = 0;
- logfontw.lfCharSet = OEM_CHARSET;
- logfontw.lfPitchAndFamily = FF_ROMAN | DEFAULT_PITCH;
+ logfontw.lfCharSet = emfio::CharacterSet::OEM_CHARSET;
+ logfontw.lfPitchAndFamily = emfio::FamilyFont::FF_ROMAN | emfio::PitchFont::DEFAULT_PITCH;
logfontw.alfFaceName = "Symbol";
emfio::WinMtfFontStyle fontStyle(logfontw);
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index f34250f0ba19..54be65c3bcbf 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -349,7 +349,7 @@ bool ImplReadRegion( basegfx::B2DPolyPolygon& rPolyPoly, SvStream& rStream, sal_
rStream.ReadInt32(nRight);
rStream.ReadInt32(nBottom);
- if (!rStream.good() || nCountRects == 0 || nType != RDH_RECTANGLES)
+ if (!rStream.good() || nCountRects == 0 || nType != emfio::RDH_RECTANGLES)
return false;
SAL_INFO("emfio", "\t\tBounds Left: " << nLeft << ", top: " << nTop << ", right: " << nRight << ", bottom: " << nBottom);
@@ -1019,7 +1019,7 @@ namespace emfio
sal_uInt32 nMapMode(0);
mpInputStream->ReadUInt32( nMapMode );
SAL_INFO("emfio", "\t\tMapMode: 0x" << std::hex << nMapMode << std::dec);
- SetMapMode( nMapMode );
+ SetMapMode( static_cast<MappingMode>(nMapMode) );
}
break;
@@ -1027,7 +1027,7 @@ namespace emfio
{
mpInputStream->ReadUInt32( nDat32 );
SAL_INFO("emfio", "\t\tBkMode: 0x" << std::hex << nDat32 << std::dec);
- SetBkMode( static_cast<BkMode>(nDat32) );
+ SetBkMode( static_cast<BackgroundMode>(nDat32) );
}
break;
@@ -1133,7 +1133,7 @@ namespace emfio
XForm aTempXForm;
*mpInputStream >> aTempXForm;
mpInputStream->ReadUInt32( nMode );
- ModifyWorldTransform( aTempXForm, nMode );
+ ModifyWorldTransform( aTempXForm, static_cast<ModifyWorldTransformMode>(nMode) );
}
break;
@@ -1336,7 +1336,8 @@ namespace emfio
{
sal_uInt32 nStyle;
mpInputStream->ReadUInt32( nStyle );
- CreateObjectIndexed(nIndex, std::make_unique<WinMtfFillStyle>( ReadColor(), ( nStyle == BS_HOLLOW ) ));
+ BrushStyle eStyle = static_cast<BrushStyle>(nStyle);
+ CreateObjectIndexed(nIndex, std::make_unique<WinMtfFillStyle>( ReadColor(), ( eStyle == BrushStyle::BS_HOLLOW ) ));
}
}
break;
@@ -1466,7 +1467,7 @@ namespace emfio
{
sal_Int32 nClippingMode(0);
mpInputStream->ReadInt32(nClippingMode);
- SetClipPath(GetPathObj(), nClippingMode, true);
+ SetClipPath(GetPathObj(), static_cast<RegionMode>(nClippingMode), true);
}
break;
@@ -1484,7 +1485,7 @@ namespace emfio
// This record's region data should be ignored if mode
// is RGN_COPY - see EMF spec section 2.3.2.2
- if (nClippingMode == RGN_COPY)
+ if (static_cast<RegionMode>(nClippingMode) == RegionMode::RGN_COPY)
{
SetDefaultClipPath();
}
@@ -1494,7 +1495,7 @@ namespace emfio
if (cbRgnData)
ImplReadRegion(aPolyPoly, *mpInputStream, nRemainingRecSize);
const tools::PolyPolygon aPolyPolygon(aPolyPoly);
- SetClipPath(aPolyPolygon, nClippingMode, false);
+ SetClipPath(aPolyPolygon, static_cast<RegionMode>(nClippingMode), false);
}
}
}
@@ -1912,9 +1913,9 @@ namespace emfio
else
{
const tools::Rectangle aRect( nLeftRect, nTopRect, nRightRect, nBottomRect );
- const BkMode mnBkModeBackup = mnBkMode;
+ const BackgroundMode mnBkModeBackup = mnBkMode;
if ( nOptions & ETO_NO_RECT ) // Don't draw the background rectangle and text background
- mnBkMode = BkMode::Transparent;
+ mnBkMode = BackgroundMode::Transparent;
else if ( nOptions & ETO_OPAQUE )
DrawRectWithBGColor( aRect );
@@ -2018,7 +2019,7 @@ namespace emfio
Push(); // Save the current clip. It will be restored after text drawing
IntersectClipRect( aRect );
}
- DrawText(aPos, aText, aDXAry.empty() ? nullptr : &aDXAry, pDYAry.get(), mbRecordPath, nGfxMode);
+ DrawText(aPos, aText, aDXAry.empty() ? nullptr : &aDXAry, pDYAry.get(), mbRecordPath, static_cast<GraphicsMode>(nGfxMode));
if ( nOptions & ETO_CLIPPED )
Pop();
}
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index f822915a2fc0..5117411fc54f 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -76,23 +76,23 @@ namespace emfio
maClip.subtractPolyPolygon(rPolyPolygon);
}
- void WinMtfClipPath::setClipPath( const basegfx::B2DPolyPolygon& rB2DPoly, sal_Int32 nClippingMode )
+ void WinMtfClipPath::setClipPath( const basegfx::B2DPolyPolygon& rB2DPoly, RegionMode nClippingMode )
{
switch ( nClippingMode )
{
- case RGN_OR :
+ case RegionMode::RGN_OR :
maClip.unionPolyPolygon(rB2DPoly);
break;
- case RGN_XOR :
+ case RegionMode::RGN_XOR :
maClip.xorPolyPolygon(rB2DPoly);
break;
- case RGN_DIFF :
+ case RegionMode::RGN_DIFF :
maClip.subtractPolyPolygon(rB2DPoly);
break;
- case RGN_AND :
+ case RegionMode::RGN_AND :
maClip.intersectPolyPolygon(rB2DPoly);
break;
- case RGN_COPY :
+ case RegionMode::RGN_COPY :
maClip = basegfx::utils::B2DClipState(rB2DPoly);
break;
}
@@ -181,23 +181,23 @@ namespace emfio
FontFamily eFamily;
switch ( rFont.lfPitchAndFamily & 0xf0 )
{
- case FF_ROMAN:
+ case FamilyFont::FF_ROMAN:
eFamily = FAMILY_ROMAN;
break;
- case FF_SWISS:
+ case FamilyFont::FF_SWISS:
eFamily = FAMILY_SWISS;
break;
- case FF_MODERN:
+ case FamilyFont::FF_MODERN:
eFamily = FAMILY_MODERN;
break;
- case FF_SCRIPT:
+ case FamilyFont::FF_SCRIPT:
eFamily = FAMILY_SCRIPT;
break;
- case FF_DECORATIVE:
+ case FamilyFont::FF_DECORATIVE:
eFamily = FAMILY_DECORATIVE;
break;
@@ -517,38 +517,38 @@ namespace emfio
double fX2 = fX * maXForm.eM11 + fY * maXForm.eM21 + maXForm.eDx;
double fY2 = fX * maXForm.eM12 + fY * maXForm.eM22 + maXForm.eDy;
- if ( mnGfxMode == GM_COMPATIBLE )
+ if ( meGfxMode == GraphicsMode::GM_COMPATIBLE )
{
fX2 -= mnWinOrgX;
fY2 -= mnWinOrgY;
- switch( mnMapMode )
+ switch( meMapMode )
{
- case MM_LOENGLISH :
+ case MappingMode::MM_LOENGLISH :
{
fX2 = o3tl::convert(fX2, o3tl::Length::in100, o3tl::Length::mm100);
fY2 = o3tl::convert(-fY2, o3tl::Length::in100, o3tl::Length::mm100);
}
break;
- case MM_HIENGLISH :
+ case MappingMode::MM_HIENGLISH :
{
fX2 = o3tl::convert(fX2, o3tl::Length::in1000, o3tl::Length::mm100);
fY2 = o3tl::convert(-fY2, o3tl::Length::in1000, o3tl::Length::mm100);
}
break;
- case MM_TWIPS:
+ case MappingMode::MM_TWIPS:
{
fX2 = o3tl::convert(fX2, o3tl::Length::twip, o3tl::Length::mm100);
fY2 = o3tl::convert(-fY2, o3tl::Length::twip, o3tl::Length::mm100);
}
break;
- case MM_LOMETRIC :
+ case MappingMode::MM_LOMETRIC :
{
fX2 = o3tl::convert(fX2, o3tl::Length::mm10, o3tl::Length::mm100);
fY2 = o3tl::convert(-fY2, o3tl::Length::mm10, o3tl::Length::mm100);
}
break;
- case MM_HIMETRIC : // in hundredth of a millimeter
+ case MappingMode::MM_HIMETRIC : // in hundredth of a millimeter
{
fY2 *= -1;
}
@@ -562,7 +562,7 @@ namespace emfio
}
else
{
- if ( mnMapMode != MM_TEXT )
+ if ( meMapMode != MappingMode::MM_TEXT )
{
fX2 /= mnWinExtX;
fY2 /= mnWinExtY;
@@ -621,34 +621,34 @@ namespace emfio
fHeight = rSz.Height() * aScale.getY();
}
- if ( mnGfxMode == GM_COMPATIBLE )
+ if ( meGfxMode == GraphicsMode::GM_COMPATIBLE )
{
- switch( mnMapMode )
+ switch( meMapMode )
{
- case MM_LOENGLISH :
+ case MappingMode::MM_LOENGLISH :
{
fWidth = o3tl::convert(fWidth, o3tl::Length::in100, o3tl::Length::mm100);
fHeight = o3tl::convert(-fHeight, o3tl::Length::in100, o3tl::Length::mm100);
}
break;
- case MM_HIENGLISH :
+ case MappingMode::MM_HIENGLISH :
{
fWidth = o3tl::convert(fWidth, o3tl::Length::in1000, o3tl::Length::mm100);
fHeight = o3tl::convert(-fHeight, o3tl::Length::in1000, o3tl::Length::mm100);
}
break;
- case MM_LOMETRIC :
+ case MappingMode::MM_LOMETRIC :
{
fWidth = o3tl::convert(fWidth, o3tl::Length::mm10, o3tl::Length::mm100);
fHeight = o3tl::convert(-fHeight, o3tl::Length::mm10, o3tl::Length::mm100);
}
break;
- case MM_HIMETRIC : // in hundredth of millimeters
+ case MappingMode::MM_HIMETRIC : // in hundredth of millimeters
{
fHeight *= -1;
}
break;
- case MM_TWIPS:
+ case MappingMode::MM_TWIPS:
{
fWidth = o3tl::convert(fWidth, o3tl::Length::twip, o3tl::Length::mm100);
fHeight = o3tl::convert(-fHeight, o3tl::Length::twip, o3tl::Length::mm100);
@@ -663,7 +663,7 @@ namespace emfio
}
else
{
- if ( mnMapMode != MM_TEXT )
+ if ( meMapMode != MappingMode::MM_TEXT )
{
fWidth /= mnWinExtX;
fHeight /= mnWinExtY;
@@ -750,56 +750,56 @@ namespace emfio
if ( nIndex & ENHMETA_STOCK_OBJECT )
{
SAL_INFO ( "emfio", "\t\t ENHMETA_STOCK_OBJECT, StockObject Enumeration: 0x" << std::hex << nIndex );
- sal_uInt16 nStockId = static_cast<sal_uInt8>(nIndex);
+ StockObject nStockId = static_cast<StockObject>(nIndex);
switch( nStockId )
{
- case WHITE_BRUSH :
+ case StockObject::WHITE_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_WHITE );
mbFillStyleSelected = true;
}
break;
- case LTGRAY_BRUSH :
+ case StockObject::LTGRAY_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_LIGHTGRAY );
mbFillStyleSelected = true;
}
break;
- case GRAY_BRUSH :
+ case StockObject::GRAY_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_GRAY );
mbFillStyleSelected = true;
}
break;
- case DKGRAY_BRUSH :
+ case StockObject::DKGRAY_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_GRAY7 );
mbFillStyleSelected = true;
}
break;
- case BLACK_BRUSH :
+ case StockObject::BLACK_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_BLACK );
mbFillStyleSelected = true;
}
break;
- case NULL_BRUSH :
+ case StockObject::NULL_BRUSH :
{
maFillStyle = WinMtfFillStyle( COL_TRANSPARENT, true );
mbFillStyleSelected = true;
}
break;
- case WHITE_PEN :
+ case StockObject::WHITE_PEN :
{
maLineStyle = WinMtfLineStyle( COL_WHITE );
}
break;
- case BLACK_PEN :
+ case StockObject::BLACK_PEN :
{
maLineStyle = WinMtfLineStyle( COL_BLACK );
}
break;
- case NULL_PEN :
+ case StockObject::NULL_PEN :
{
maLineStyle = WinMtfLineStyle( COL_TRANSPARENT, true );
}
@@ -865,7 +865,7 @@ namespace emfio
mbClockWiseArcDirection = bClockWise;
}
- void MtfTools::SetBkMode( BkMode nMode )
+ void MtfTools::SetBkMode( BackgroundMode nMode )
{
mnBkMode = nMode;
}
@@ -1036,7 +1036,7 @@ namespace emfio
maClipPath.moveClipRegion( ImplMap( rSize ) );
}
- void MtfTools::SetClipPath( const tools::PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode, bool bIsMapped )
+ void MtfTools::SetClipPath( const tools::PolyPolygon& rPolyPolygon, RegionMode eClippingMode, bool bIsMapped )
{
if (utl::ConfigManager::IsFuzzing())
return;
@@ -1045,12 +1045,12 @@ namespace emfio
if (!bIsMapped)
{
- if (!mbIsMapDevSet && (mnMapMode == MM_ISOTROPIC || mnMapMode == MM_ANISOTROPIC))
+ if (!mbIsMapDevSet && (meMapMode == MappingMode::MM_ISOTROPIC || meMapMode == MappingMode::MM_ANISOTROPIC))
aPolyPolygon = ImplScale(aPolyPolygon);
else
aPolyPolygon = ImplMap(aPolyPolygon);
}
- maClipPath.setClipPath(aPolyPolygon.getB2DPolyPolygon(), nClippingMode);
+ maClipPath.setClipPath(aPolyPolygon.getB2DPolyPolygon(), eClippingMode);
}
void MtfTools::SetDefaultClipPath()
@@ -1061,18 +1061,18 @@ namespace emfio
MtfTools::MtfTools( GDIMetaFile& rGDIMetaFile, SvStream& rStreamWMF)
: mnLatestTextAlign(90),
- mnTextAlign(TA_LEFT | TA_TOP | TA_NOUPDATECP),
+ mnTextAlign(TextAlignmentMode::TA_LEFT | TextAlignmentMode::TA_TOP | TextAlignmentMode::TA_NOUPDATECP),
maLatestBkColor(ColorTransparency, 0x12345678),
maBkColor(COL_WHITE),
mnLatestTextLayoutMode(vcl::text::ComplexTextLayoutFlags::Default),
mnTextLayoutMode(vcl::text::ComplexTextLayoutFlags::Default),
- mnLatestBkMode(BkMode::NONE),
- mnBkMode(BkMode::OPAQUE),
+ mnLatestBkMode(BackgroundMode::NONE),
+ mnBkMode(BackgroundMode::OPAQUE),
meLatestRasterOp(RasterOp::Invert),
meRasterOp(RasterOp::OverPaint),
mnRop(),
- mnGfxMode(GM_COMPATIBLE),
- mnMapMode(MM_TEXT),
+ meGfxMode(GraphicsMode::GM_COMPATIBLE),
+ meMapMode(MappingMode::MM_TEXT),
mnDevOrgX(0),
mnDevOrgY(0),
mnDevWidth(1),
@@ -1193,7 +1193,7 @@ namespace emfio
void MtfTools::UpdateFillStyle()
{
if ( !mbFillStyleSelected ) // SJ: #i57205# taking care of bkcolor if no brush is selected
- maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == BkMode::Transparent );
+ maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == BackgroundMode::Transparent );
if (!( maLatestFillStyle == maFillStyle ) )
{
maLatestFillStyle = maFillStyle;
@@ -1323,12 +1323,12 @@ namespace emfio
{
WinMtfFillStyle aFillStyleBackup = maFillStyle;
bool aTransparentBackup = maLineStyle.bTransparent;
- BkMode mnBkModeBackup = mnBkMode;
+ BackgroundMode mnBkModeBackup = mnBkMode;
const tools::Polygon aPoly( rRect );
maLineStyle.bTransparent = true;
maFillStyle = maBkColor;
- mnBkMode = BkMode::OPAQUE;
+ mnBkMode = BackgroundMode::OPAQUE;
ImplSetNonPersistentLineColorTransparenz();
DrawPolygon(aPoly, false);
mnBkMode = mnBkModeBackup; // The rectangle needs to be always drawned even if mode is transparent
@@ -1644,12 +1644,12 @@ namespace emfio
}
}
- void MtfTools::DrawText( Point& rPosition, OUString const & rText, std::vector<sal_Int32>* pDXArry, tools::Long* pDYArry, bool bRecordPath, sal_Int32 nGfxMode )
+ void MtfTools::DrawText( Point& rPosition, OUString const & rText, std::vector<sal_Int32>* pDXArry, tools::Long* pDYArry, bool bRecordPath, GraphicsMode nGfxMode )
{
UpdateClipRegion();
rPosition = ImplMap( rPosition );
- sal_Int32 nOldGfxMode = GetGfxMode();
- SetGfxMode( GM_COMPATIBLE );
+ GraphicsMode nOldGfxMode = GetGfxMode();
+ SetGfxMode( GraphicsMode::GM_COMPATIBLE );
if (pDXArry)
{
@@ -1722,14 +1722,14 @@ namespace emfio
aTmp.SetColor( maTextColor );
aTmp.SetFillColor( maBkColor );
- if( mnBkMode == BkMode::Transparent )
+ if( mnBkMode == BackgroundMode::Transparent )
aTmp.SetTransparent( true );
else
aTmp.SetTransparent( false );
aTmp.SetAlignment( eTextAlign );
- if ( nGfxMode == GM_ADVANCED )
+ if ( nGfxMode == GraphicsMode::GM_ADVANCED )
{
// check whether there is a font rotation applied via transformation
Point aP1( ImplMap( Point() ) );
@@ -2143,14 +2143,19 @@ namespace emfio
if ( !(rSize.Width() && rSize.Height()) )
return;
- switch( mnMapMode )
+ switch( meMapMode )
{
- case MM_ISOTROPIC :
- case MM_ANISOTROPIC :
+ case MappingMode::MM_ISOTROPIC :
+ case MappingMode::MM_ANISOTROPIC :
{
mnDevWidth = rSize.Width();
mnDevHeight = rSize.Height();
+ break;
}
+
+ //do nothing
+ default:
+ break;
}
if (regular)
{
@@ -2185,7 +2190,7 @@ namespace emfio
{
if (!mbIsMapDevSet)
{
- if ( mnMapMode == MM_ISOTROPIC ) //TODO: WHAT ABOUT ANISOTROPIC???
+ if ( meMapMode == MappingMode::MM_ISOTROPIC ) //TODO: WHAT ABOUT ANISOTROPIC???
{
sal_Int32 nX, nY;
if (o3tl::checked_add(mnWinExtX, mnWinOrgX, nX) || o3tl::checked_sub(mnWinExtY, mnWinOrgY, nY))
@@ -2201,10 +2206,10 @@ namespace emfio
if (!(rSize.Width() && rSize.Height()))
return;
- switch( mnMapMode )
+ switch( meMapMode )
{
- case MM_ISOTROPIC :
- case MM_ANISOTROPIC :
+ case MappingMode::MM_ISOTROPIC :
+ case MappingMode::MM_ANISOTROPIC :
{
mnWinExtX = rSize.Width();
mnWinExtY = rSize.Height();
@@ -2213,7 +2218,12 @@ namespace emfio
SetDevByWin();
}
mbIsMapWinSet = true;
+ break;
}
+
+ default:
+ //do nothing
+ break;
}
}
@@ -2245,15 +2255,15 @@ namespace emfio
mnMillY = rSize.Height();
}
- void MtfTools::SetMapMode( sal_uInt32 nMapMode )
+ void MtfTools::SetMapMode( MappingMode nMapMode )
{
- mnMapMode = nMapMode;
- if ( nMapMode == MM_TEXT && !mbIsMapWinSet )
+ meMapMode = nMapMode;
+ if ( nMapMode == MappingMode::MM_TEXT && !mbIsMapWinSet )
{
mnWinExtX = mnDevWidth;
mnWinExtY = mnDevHeight;
}
- else if ( mnMapMode == MM_HIMETRIC )
+ else if ( meMapMode == MappingMode::MM_HIMETRIC )
{
sal_Int32 nWinExtX, nWinExtY;
if (o3tl::checked_multiply<sal_Int32>(mnMillX, 100, nWinExtX) ||
@@ -2276,24 +2286,24 @@ namespace emfio
maXForm.eDy = rXForm.eDy;
}
- void MtfTools::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode )
+ void MtfTools::ModifyWorldTransform( const XForm& rXForm, ModifyWorldTransformMode nMode )
{
switch( nMode )
{
- case MWT_IDENTITY :
+ case ModifyWorldTransformMode::MWT_IDENTITY :
{
maXForm.eM11 = maXForm.eM22 = 1.0f;
maXForm.eM12 = maXForm.eM21 = maXForm.eDx = maXForm.eDy = 0.0f;
break;
}
- case MWT_RIGHTMULTIPLY :
- case MWT_LEFTMULTIPLY :
+ case ModifyWorldTransformMode::MWT_RIGHTMULTIPLY :
+ case ModifyWorldTransformMode::MWT_LEFTMULTIPLY :
{
const XForm* pLeft;
const XForm* pRight;
- if ( nMode == MWT_LEFTMULTIPLY )
+ if ( nMode == ModifyWorldTransformMode::MWT_LEFTMULTIPLY )
{
pLeft = &rXForm;
pRight = &maXForm;
@@ -2346,7 +2356,7 @@ namespace emfio
maXForm.eDy = cF[2][1];
break;
}
- case MWT_SET:
+ case ModifyWorldTransformMode::MWT_SET:
{
SetWorldTransform(rXForm);
break;
@@ -2366,8 +2376,8 @@ namespace emfio
pSave->aTextColor = maTextColor;
pSave->nTextAlign = mnTextAlign;
pSave->nTextLayoutMode = mnTextLayoutMode;
- pSave->nMapMode = mnMapMode;
- pSave->nGfxMode = mnGfxMode;
+ pSave->eMapMode = meMapMode;
+ pSave->eGfxMode = meGfxMode;
pSave->nBkMode = mnBkMode;
pSave->aBkColor = maBkColor;
pSave->bClockWiseArcDirection = mbClockWiseArcDirection;
@@ -2389,8 +2399,8 @@ namespace emfio
pSave->maPathObj = maPathObj;
pSave->maClipPath = maClipPath;
- SAL_INFO("emfio", "\t\t GfxMode: " << mnGfxMode);
- SAL_INFO("emfio", "\t\t MapMode: " << mnMapMode);
+ SAL_INFO("emfio", "\t\t GfxMode: " << static_cast<sal_uInt32>(meGfxMode));
+ SAL_INFO("emfio", "\t\t MapMode: " << static_cast<sal_uInt32>(meMapMode));
SAL_INFO("emfio", "\t\t WinOrg: " << mnWinOrgX << ", " << mnWinOrgY);
SAL_INFO("emfio", "\t\t WinExt: " << mnWinExtX << " x " << mnWinExtY);
SAL_INFO("emfio", "\t\t DevOrg: " << mnDevOrgX << ", " << mnDevOrgY);
@@ -2429,8 +2439,8 @@ namespace emfio
mnTextAlign = pSave->nTextAlign;
mnTextLayoutMode = pSave->nTextLayoutMode;
mnBkMode = pSave->nBkMode;
- mnGfxMode = pSave->nGfxMode;
- mnMapMode = pSave->nMapMode;
+ meGfxMode = pSave->eGfxMode;
+ meMapMode = pSave->eMapMode;
maBkColor = pSave->aBkColor;
mbClockWiseArcDirection = pSave->bClockWiseArcDirection;
mbFillStyleSelected = pSave->bFillStyleSelected;
@@ -2460,8 +2470,8 @@ namespace emfio
meLatestRasterOp = meRasterOp;
}
- SAL_INFO("emfio", "\t\t GfxMode: " << mnGfxMode);
- SAL_INFO("emfio", "\t\t MapMode: " << mnMapMode);
+ SAL_INFO("emfio", "\t\t GfxMode: " << static_cast<sal_uInt32>(meGfxMode));
+ SAL_INFO("emfio", "\t\t MapMode: " << static_cast<sal_uInt32>(meMapMode));
SAL_INFO("emfio", "\t\t WinOrg: " << mnWinOrgX << ", " << mnWinOrgY);
SAL_INFO("emfio", "\t\t WinExt: " << mnWinExtX << " x " << mnWinExtY);
SAL_INFO("emfio", "\t\t DevOrg: " << mnDevOrgX << ", " << mnDevOrgY);
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index c4d21b3231b1..44615556793f 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -125,10 +125,10 @@ namespace
W_META_CREATEREGION = 0x06FF
};
- void GetWinExtMax(const Point& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
+ void GetWinExtMax(const Point& rSource, tools::Rectangle& rPlaceableBound, emfio::MappingMode eMapMode)
{
Point aSource(rSource);
- if (nMapMode == MM_HIMETRIC)
+ if (eMapMode == emfio::MappingMode::MM_HIMETRIC)
aSource.setY( -rSource.Y() );
if (aSource.X() < rPlaceableBound.Left())
rPlaceableBound.SetLeft( aSource.X() );
@@ -140,7 +140,7 @@ namespace
rPlaceableBound.SetBottom( aSource.Y() );
}
- void GetWinExtMax(const tools::Rectangle& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
+ void GetWinExtMax(const tools::Rectangle& rSource, tools::Rectangle& rPlaceableBound, emfio::MappingMode nMapMode)
{
GetWinExtMax(rSource.TopLeft(), rPlaceableBound, nMapMode);
GetWinExtMax(rSource.BottomRight(), rPlaceableBound, nMapMode);
@@ -298,7 +298,7 @@ namespace emfio
{
sal_uInt16 nDat = 0;
mpInputStream->ReadUInt16( nDat );
- SetBkMode( static_cast<BkMode>(nDat) );
+ SetBkMode( static_cast<BackgroundMode>(nDat) );
}
break;
@@ -307,7 +307,7 @@ namespace emfio
{
sal_Int16 nMapMode = 0;
mpInputStream->ReadInt16( nMapMode );
- SetMapMode( nMapMode );
+ SetMapMode( static_cast<MappingMode>(nMapMode) );
}
break;
@@ -939,8 +939,9 @@ namespace emfio
sal_uInt16 nStyle(0), nColorUsage(0);
mpInputStream->ReadUInt16( nStyle ).ReadUInt16( nColorUsage );
+ BrushStyle eStyle = static_cast<BrushStyle>(nStyle);
SAL_INFO( "emfio", "\t\t Style:" << nStyle << ", ColorUsage: " << nColorUsage );
- if ( nStyle == BS_PATTERN ) // TODO tdf#142625 Add support for pattern
+ if ( eStyle == BrushStyle::BS_PATTERN ) // TODO tdf#142625 Add support for pattern
{
SAL_WARN( "emfio", "\tTODO: Pattern brush style is not supported." );
CreateObject();
@@ -1095,8 +1096,9 @@ namespace emfio
{
sal_uInt16 nBrushStyle = 0;
mpInputStream->ReadUInt16( nBrushStyle );
- CreateObject(std::make_unique<WinMtfFillStyle>( ReadColor(), ( nBrushStyle == BS_NULL ) ));
- SAL_WARN_IF( (nBrushStyle != BS_SOLID) && (nBrushStyle != BS_NULL), "emfio", "TODO: Brush style not implemented. Please fill the bug report" );
+ BrushStyle eBrushStyle = static_cast<BrushStyle>(nBrushStyle);
+ CreateObject(std::make_unique<WinMtfFillStyle>( ReadColor(), ( eBrushStyle == BrushStyle::BS_NULL ) ));
+ SAL_WARN_IF( (eBrushStyle != BrushStyle::BS_SOLID) && (eBrushStyle != BrushStyle::BS_NULL), "emfio", "TODO: Brush style not implemented. Please fill the bug report" );
}
break;
@@ -1191,7 +1193,7 @@ namespace emfio
if ( !nObjIndex )
{
tools::PolyPolygon aEmptyPolyPoly;
- SetClipPath( aEmptyPolyPoly, RGN_COPY, true );
+ SetClipPath( aEmptyPolyPoly, RegionMode::RGN_COPY, true );
}
}
break;
@@ -1458,7 +1460,7 @@ namespace emfio
if (mpExternalHeader != nullptr
&& mpExternalHeader->xExt > 0
&& mpExternalHeader->yExt > 0
- && (mpExternalHeader->mapMode == MM_ISOTROPIC || mpExternalHeader->mapMode == MM_ANISOTROPIC))
+ && (mpExternalHeader->mapMode == MappingMode::MM_ISOTROPIC || mpExternalHeader->mapMode == MappingMode::MM_ANISOTROPIC))
{
// #n417818#: If we have an external header then overwrite the bounds!
tools::Rectangle aExtRect(0, 0,
@@ -1470,7 +1472,7 @@ namespace emfio
" left: " << aPlaceableBound.Left() << " top: " << aPlaceableBound.Top()
<< " right: " << aPlaceableBound.Right() << " bottom: " << aPlaceableBound.Bottom());
- SetMapMode(mpExternalHeader->mapMode);
+ SetMapMode(static_cast<MappingMode>(mpExternalHeader->mapMode));;
}
else
{
@@ -1551,7 +1553,7 @@ namespace emfio
mnEMFRec = 0;
mnEMFSize = 0;
- SetMapMode( MM_ANISOTROPIC );
+ SetMapMode( MappingMode::MM_ANISOTROPIC );
SetWinOrg( Point() );
SetWinExt( Size( 1, 1 ) );
SetDevExt( Size( 10000, 10000 ) );
@@ -1671,7 +1673,7 @@ namespace emfio
if (nEnd - nPos)
{
- sal_Int16 nMapMode = MM_ANISOTROPIC;
+ MappingMode eMapMode = MappingMode::MM_ANISOTROPIC;
sal_uInt16 nFunction;
sal_uInt32 nRSize;
@@ -1732,36 +1734,48 @@ namespace emfio
break;
case W_META_SETMAPMODE :
+ {
+ sal_Int16 nMapMode(0);
pStm->ReadInt16( nMapMode );
+ eMapMode = static_cast<MappingMode>(nMapMode);
+ }
break;
case W_META_MOVETO:
case W_META_LINETO:
- GetWinExtMax( ReadYX(), aBound, nMapMode );
+ {
+ GetWinExtMax( ReadYX(), aBound, eMapMode );
bBoundsDetermined = true;
+ }
break;
case W_META_RECTANGLE:
case W_META_INTERSECTCLIPRECT:
case W_META_EXCLUDECLIPRECT :
case W_META_ELLIPSE:
- GetWinExtMax( ReadRectangle(), aBound, nMapMode );
+ {
+ GetWinExtMax( ReadRectangle(), aBound, eMapMode );
bBoundsDetermined = true;
+ }
break;
case W_META_ROUNDRECT:
+ {
ReadYXExt(); // size
- GetWinExtMax( ReadRectangle(), aBound, nMapMode );
+ GetWinExtMax( ReadRectangle(), aBound, eMapMode );
bBoundsDetermined = true;
+ }
break;
case W_META_ARC:
case W_META_PIE:
case W_META_CHORD:
+ {
ReadYX(); // end
ReadYX(); // start
- GetWinExtMax( ReadRectangle(), aBound, nMapMode );
+ GetWinExtMax( ReadRectangle(), aBound, eMapMode );
bBoundsDetermined = true;
+ }
break;
case W_META_POLYGON:
@@ -1779,7 +1793,7 @@ namespace emfio
{
for(sal_uInt16 i = 0; i < nPoints; i++ )
{
- GetWinExtMax( ReadPoint(), aBound, nMapMode );
+ GetWinExtMax( ReadPoint(), aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1840,7 +1854,7 @@ namespace emfio
{
for (sal_uInt16 i = 0; i < nPoints; i++ )
{
- GetWinExtMax( ReadPoint(), aBound, nMapMode );
+ GetWinExtMax( ReadPoint(), aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1872,7 +1886,7 @@ namespace emfio
{
for (sal_uInt16 i = 0; i < nPoints; ++i)
{
- GetWinExtMax( ReadPoint(), aBound, nMapMode );
+ GetWinExtMax( ReadPoint(), aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1893,7 +1907,7 @@ namespace emfio
case W_META_SETPIXEL:
{
ReadColor();
- GetWinExtMax( ReadYX(), aBound, nMapMode );
+ GetWinExtMax( ReadYX(), aBound, eMapMode );
bBoundsDetermined = true;
}
break;
@@ -1906,7 +1920,7 @@ namespace emfio
if ( nLength )
{
pStm->SeekRel( ( nLength + 1 ) &~ 1 );
- GetWinExtMax( ReadYX(), aBound, nMapMode );
+ GetWinExtMax( ReadYX(), aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1920,7 +1934,7 @@ namespace emfio
// todo: we also have to take care of the text width
if( nLen )
{
- GetWinExtMax( aPosition, aBound, nMapMode );
+ GetWinExtMax( aPosition, aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1958,7 +1972,7 @@ namespace emfio
if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps
{
tools::Rectangle aDestRect( ReadYX(), aDestSize );
- GetWinExtMax( aDestRect, aBound, nMapMode );
+ GetWinExtMax( aDestRect, aBound, eMapMode );
bBoundsDetermined = true;
}
}
@@ -1969,7 +1983,7 @@ namespace emfio
sal_uInt32 nROP(0);
pStm->ReadUInt32( nROP );
Size aSize = ReadYXExt();
- GetWinExtMax( tools::Rectangle( ReadYX(), aSize ), aBound, nMapMode );
+ GetWinExtMax( tools::Rectangle( ReadYX(), aSize ), aBound, eMapMode );
bBoundsDetermined = true;
}
break;