summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-21 07:31:11 +0200
committerNoel Grandin <noel@peralex.com>2014-08-21 09:17:32 +0200
commita69f8ea61ce274a5839f1904d1eba9ea91ce6676 (patch)
treeeb7693e3cca148c3013220bcbc4c3b322b0f8123 /include
parent46bf3068de40192e0b69ef5f6ab3b2f43c71ef71 (diff)
vcl: convert push flags to type-safe enum-like class
Change-Id: Ib49a0dd5ecee0225f51bea2ff1c0ab5326595a47
Diffstat (limited to 'include')
-rw-r--r--include/vcl/metaact.hxx6
-rw-r--r--include/vcl/outdev.hxx2
-rw-r--r--include/vcl/outdevstate.hxx45
-rw-r--r--include/vcl/pdfwriter.hxx2
4 files changed, 34 insertions, 21 deletions
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index 572a0a2f3be4..1f0fd7964dbf 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -1350,7 +1350,7 @@ class VCL_DLLPUBLIC MetaPushAction : public MetaAction
{
private:
- sal_uInt16 mnFlags;
+ PushFlags mnFlags;
virtual bool Compare( const MetaAction& ) const SAL_OVERRIDE;
@@ -1364,9 +1364,9 @@ public:
virtual void Write( SvStream& rOStm, ImplMetaWriteData* pData ) SAL_OVERRIDE;
virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ) SAL_OVERRIDE;
- explicit MetaPushAction( sal_uInt16 nFlags );
+ explicit MetaPushAction( PushFlags nFlags );
- sal_uInt16 GetFlags() const { return mnFlags; }
+ PushFlags GetFlags() const { return mnFlags; }
};
class VCL_DLLPUBLIC MetaPopAction : public MetaAction
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 61114a1fba9c..df0cd270ed89 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -534,7 +534,7 @@ private:
public:
- void Push( sal_uInt16 nFlags = PUSH_ALL );
+ void Push( PushFlags nFlags = PUSH_ALL );
void Pop();
// returns the current stack depth; that is the number of Push() calls minus the number of Pop() calls
diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 847a5f27a70b..578a1a978843 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -32,23 +32,36 @@
#include <tools/fontenum.hxx>
// Flags for OutputDevice::Push() and OutDevState
-#define PUSH_LINECOLOR ((sal_uInt16)0x0001)
-#define PUSH_FILLCOLOR ((sal_uInt16)0x0002)
-#define PUSH_FONT ((sal_uInt16)0x0004)
-#define PUSH_TEXTCOLOR ((sal_uInt16)0x0008)
-#define PUSH_MAPMODE ((sal_uInt16)0x0010)
-#define PUSH_CLIPREGION ((sal_uInt16)0x0020)
-#define PUSH_RASTEROP ((sal_uInt16)0x0040)
-#define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080)
-#define PUSH_TEXTALIGN ((sal_uInt16)0x0100)
-#define PUSH_REFPOINT ((sal_uInt16)0x0200)
-#define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400)
-#define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800)
-#define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000)
-#define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000)
+enum PushFlags {
+ PUSH_NONE = ((sal_uInt16)0x0000),
+ PUSH_LINECOLOR = ((sal_uInt16)0x0001),
+ PUSH_FILLCOLOR = ((sal_uInt16)0x0002),
+ PUSH_FONT = ((sal_uInt16)0x0004),
+ PUSH_TEXTCOLOR = ((sal_uInt16)0x0008),
+ PUSH_MAPMODE = ((sal_uInt16)0x0010),
+ PUSH_CLIPREGION = ((sal_uInt16)0x0020),
+ PUSH_RASTEROP = ((sal_uInt16)0x0040),
+ PUSH_TEXTFILLCOLOR = ((sal_uInt16)0x0080),
+ PUSH_TEXTALIGN = ((sal_uInt16)0x0100),
+ PUSH_REFPOINT = ((sal_uInt16)0x0200),
+ PUSH_TEXTLINECOLOR = ((sal_uInt16)0x0400),
+ PUSH_TEXTLAYOUTMODE = ((sal_uInt16)0x0800),
+ PUSH_TEXTLANGUAGE = ((sal_uInt16)0x1000),
+ PUSH_OVERLINECOLOR = ((sal_uInt16)0x2000),
+ PUSH_ALL = ((sal_uInt16)0xFFFF)
+};
+// make combining these type-safe
+inline PushFlags operator| (PushFlags lhs, PushFlags rhs)
+{
+ return static_cast<PushFlags>(static_cast<sal_uInt16>(lhs) | static_cast<sal_uInt16>(rhs));
+}
+inline PushFlags operator& (PushFlags lhs, PushFlags rhs)
+{
+ return static_cast<PushFlags>(static_cast<sal_uInt16>(lhs) & static_cast<sal_uInt16>(rhs));
+}
+
#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
#define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
-#define PUSH_ALL ((sal_uInt16)0xFFFF)
// LayoutModes for Complex Text Layout
// These are flag values, i.e they can be combined
@@ -108,7 +121,7 @@ public:
RasterOp meRasterOp;
ComplexTextLayoutMode mnTextLayoutMode;
LanguageType meTextLanguage;
- sal_uInt16 mnFlags;
+ PushFlags mnFlags;
};
#endif // INCLUDED_VCL_OUTDEVSTATE_HXX
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 95a99ed8133f..223dcf3998ad 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -729,7 +729,7 @@ The following structure describes the permissions used in PDF security
/* functions for graphics state */
/* flag values: see vcl/outdev.hxx */
- void Push( sal_uInt16 nFlags = 0xffff );
+ void Push( PushFlags nFlags = PUSH_ALL );
void Pop();
void SetClipRegion();