summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-28 14:14:05 +0200
committerNoel Grandin <noel@peralex.com>2015-04-29 10:41:40 +0200
commita9bfa6547ae2a4721363289f3816568e6a7e6a2d (patch)
tree36d8dc5b99de1c9416af793cf2ffa3e970438517
parent5d96ccd0ab9d315aea85b4630f85feb29d2aa14a (diff)
convert INITOUTDEV constants to scoped enum
Change-Id: Ic2443b557620bd269851d64f42107b304f6b4082
-rw-r--r--include/toolkit/awt/vclxgraphics.hxx19
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx44
2 files changed, 35 insertions, 28 deletions
diff --git a/include/toolkit/awt/vclxgraphics.hxx b/include/toolkit/awt/vclxgraphics.hxx
index 89a568fe6fa9..fdd3d406a52d 100644
--- a/include/toolkit/awt/vclxgraphics.hxx
+++ b/include/toolkit/awt/vclxgraphics.hxx
@@ -32,16 +32,23 @@
#include <tools/color.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/vclptr.hxx>
+#include <o3tl/typed_flags_set.hxx>
class OutputDevice;
namespace vcl { class Region; }
-#define INITOUTDEV_FONT 0x0001
-#define INITOUTDEV_COLORS 0x0002
-#define INITOUTDEV_RASTEROP 0x0004
-#define INITOUTDEV_CLIPREGION 0x0008
-
+enum class InitOutDevFlags
+{
+ FONT = 0x0001,
+ COLORS = 0x0002,
+ RASTEROP = 0x0004,
+ CLIPREGION = 0x0008,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<InitOutDevFlags> : is_typed_flags<InitOutDevFlags, 0x0f> {};
+}
// class VCLXGraphics
@@ -72,7 +79,7 @@ public:
virtual ~VCLXGraphics();
void Init( OutputDevice* pOutDev );
- void InitOutputDevice( sal_uInt16 nFlags );
+ void InitOutputDevice( InitOutDevFlags nFlags );
void SetOutputDevice( OutputDevice* pOutDev );
OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
index ee009e86ef22..f4155b1e2762 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -117,31 +117,31 @@ void VCLXGraphics::initAttrs()
meRasterOp = mpOutputDevice->GetRasterOp(); /* ROP_OVERPAINT */
}
-void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
+void VCLXGraphics::InitOutputDevice( InitOutDevFlags nFlags )
{
if(mpOutputDevice)
{
SolarMutexGuard aVclGuard;
- if ( nFlags & INITOUTDEV_FONT )
+ if ( nFlags & InitOutDevFlags::FONT )
{
mpOutputDevice->SetFont( maFont );
mpOutputDevice->SetTextColor( maTextColor );
mpOutputDevice->SetTextFillColor( maTextFillColor );
}
- if ( nFlags & INITOUTDEV_COLORS )
+ if ( nFlags & InitOutDevFlags::COLORS )
{
mpOutputDevice->SetLineColor( maLineColor );
mpOutputDevice->SetFillColor( maFillColor );
}
- if ( nFlags & INITOUTDEV_RASTEROP )
+ if ( nFlags & InitOutDevFlags::RASTEROP )
{
mpOutputDevice->SetRasterOp( meRasterOp );
}
- if ( nFlags & INITOUTDEV_CLIPREGION )
+ if ( nFlags & InitOutDevFlags::CLIPREGION )
{
if( mpClipRegion )
mpOutputDevice->SetClipRegion( *mpClipRegion );
@@ -292,7 +292,7 @@ void VCLXGraphics::copy( const uno::Reference< awt::XDevice >& rxSource, sal_Int
DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
if ( pFromDev )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP );
mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
}
@@ -305,7 +305,7 @@ void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHa
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP);
uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
@@ -337,7 +337,7 @@ void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(uno::RuntimeExcep
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawPixel( Point( x, y ) );
}
}
@@ -348,7 +348,7 @@ void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
}
}
@@ -359,7 +359,7 @@ void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int3
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
}
}
@@ -370,7 +370,7 @@ void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, s
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
}
}
@@ -381,7 +381,7 @@ void VCLXGraphics::drawPolyLine( const uno::Sequence< sal_Int32 >& DataX, const
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
}
}
@@ -392,7 +392,7 @@ void VCLXGraphics::drawPolygon( const uno::Sequence< sal_Int32 >& DataX, const u
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
}
}
@@ -403,7 +403,7 @@ void VCLXGraphics::drawPolyPolygon( const uno::Sequence< uno::Sequence< sal_Int3
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
tools::PolyPolygon aPolyPoly( nPolys );
for ( sal_uInt16 n = 0; n < nPolys; n++ )
@@ -419,7 +419,7 @@ void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_I
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
}
}
@@ -430,7 +430,7 @@ void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
}
}
@@ -441,7 +441,7 @@ void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
}
}
@@ -452,7 +452,7 @@ void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
}
}
@@ -463,7 +463,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
aGradient.SetAngle(rGradient.Angle);
aGradient.SetBorder(rGradient.Border);
@@ -482,7 +482,7 @@ void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) t
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS |InitOutDevFlags::FONT);
mpOutputDevice->DrawText( Point( x, y ), rText );
}
}
@@ -493,7 +493,7 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex
if( mpOutputDevice )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS|InitOutDevFlags::FONT );
long* pDXA = static_cast<long*>(alloca(rText.getLength() * sizeof(long)));
for(int i = 0; i < rText.getLength(); i++)
{
@@ -513,7 +513,7 @@ void VCLXGraphics::drawImage( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int
Image aImage( xGraphic );
if ( !!aImage )
{
- InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
mpOutputDevice->DrawImage( Point( x, y ), Size( width, height ), aImage, nStyle );
}
}