Kaydet (Commit) 66270070 authored tarafından Noel Grandin's avatar Noel Grandin

convert GRID constants to scoped enum

Change-Id: I73ae63bc5f41f38d1a4e396152808b22e88681d8
üst dcefc97c
......@@ -201,11 +201,19 @@ namespace o3tl
template<> struct typed_flags<DrawImageFlags> : is_typed_flags<DrawImageFlags, 0x001f> {};
}
// Grid
#define GRID_DOTS ((sal_uLong)0x00000001)
#define GRID_HORZLINES ((sal_uLong)0x00000002)
#define GRID_VERTLINES ((sal_uLong)0x00000004)
#define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
// Flags for DrawGrid()
enum class DrawGridFlags
{
NONE = 0x0000,
Dots = 0x0001,
HorzLines = 0x0002,
VertLines = 0x0004,
Lines = HorzLines | VertLines,
};
namespace o3tl
{
template<> struct typed_flags<DrawGridFlags> : is_typed_flags<DrawGridFlags, 0x0007> {};
}
// DrawModes
#define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
......@@ -405,12 +413,12 @@ public:
protected:
/// release all references to other objects.
virtual void dispose();
virtual void dispose();
public:
/// call the dispose() method if we have not already been disposed.
void disposeOnce();
bool isDisposed() const { return mbDisposed; }
void disposeOnce();
bool isDisposed() const { return mbDisposed; }
public:
......@@ -719,7 +727,7 @@ public:
Color aStart = Color(COL_WHITE),
Color aEnd = Color(COL_BLACK));
void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
void DrawGrid( const Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags );
///@}
......
......@@ -1143,7 +1143,7 @@ void ScCsvGrid::ImplDrawColumnBackgr( sal_uInt32 nColIndex )
Rectangle aRect( nX1, nHdrHt, nX2, nY2 );
mpBackgrDev->DrawRect( aRect );
mpBackgrDev->SetLineColor( maGridColor );
mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES );
mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), DrawGridFlags::HorzLines );
mpBackgrDev->DrawLine( Point( nX2, nHdrHt ), Point( nX2, nY2 ) );
ImplDrawFirstLineSep( true );
......@@ -1207,7 +1207,7 @@ void ScCsvGrid::ImplDrawRowHeaders()
else
mpBackgrDev->DrawLine( aRect.TopRight(), aRect.BottomRight() );
aRect.Top() = GetHdrHeight();
mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES );
mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), DrawGridFlags::HorzLines );
}
void ScCsvGrid::ImplDrawBackgrDev()
......
......@@ -140,7 +140,7 @@ void ScGridMerger::Flush()
}
pDev->DrawGrid( Rectangle( nVarStart, nFixStart, nVarEnd, nFixEnd ),
Size( nVarDiff, nFixEnd - nFixStart ),
GRID_VERTLINES );
DrawGridFlags::VertLines );
}
}
else
......@@ -152,7 +152,7 @@ void ScGridMerger::Flush()
long nVarEnd = nVarStart + ( nCount - 1 ) * nVarDiff;
pDev->DrawGrid( Rectangle( nFixStart, nVarStart, nFixEnd, nVarEnd ),
Size( nFixEnd - nFixStart, nVarDiff ),
GRID_HORZLINES );
DrawGridFlags::HorzLines );
}
}
nCount = 0;
......
......@@ -557,7 +557,7 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, C
{
if( bHoriLines )
{
sal_uIntPtr nGridFlags = ( bHoriSolid ? GRID_HORZLINES : GRID_DOTS );
DrawGridFlags nGridFlags = ( bHoriSolid ? DrawGridFlags::HorzLines : DrawGridFlags::Dots );
sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000L)/ nSteps) - (nx2 * 1000L) ) : 0;
sal_uInt32 nStepOffset = 0;
......@@ -582,7 +582,7 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, C
if( bVertLines )
{
sal_uIntPtr nGridFlags = ( bVertSolid ? GRID_VERTLINES : GRID_DOTS );
DrawGridFlags nGridFlags = ( bVertSolid ? DrawGridFlags::VertLines : DrawGridFlags::Dots );
sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
sal_uInt32 nStepOffset = 0;
......
......@@ -145,7 +145,7 @@ void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt3
Pop();
}
void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags )
void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags )
{
Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
aDstRect.Intersection( rRect );
......@@ -178,7 +178,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
css::uno::Sequence< sal_Int32 > aVertBuf;
css::uno::Sequence< sal_Int32 > aHorzBuf;
if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_HORZLINES ) )
if( ( nFlags & DrawGridFlags::Dots ) || ( nFlags & DrawGridFlags::HorzLines ) )
{
aVertBuf.realloc( aDstRect.GetHeight() / nDistY + 2L );
aVertBuf[ nVertCount++ ] = nStartY;
......@@ -188,7 +188,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
}
}
if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_VERTLINES ) )
if( ( nFlags & DrawGridFlags::Dots ) || ( nFlags & DrawGridFlags::VertLines ) )
{
aHorzBuf.realloc( aDstRect.GetWidth() / nDistX + 2L );
aHorzBuf[ nHorzCount++ ] = nStartX;
......@@ -207,7 +207,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
const bool bOldMap = mbMap;
EnableMapMode( false );
if( nFlags & GRID_DOTS )
if( nFlags & DrawGridFlags::Dots )
{
for( long i = 0L; i < nVertCount; i++ )
{
......@@ -219,7 +219,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
}
else
{
if( nFlags & GRID_HORZLINES )
if( nFlags & DrawGridFlags::HorzLines )
{
for( long i = 0L; i < nVertCount; i++ )
{
......@@ -228,7 +228,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
}
}
if( nFlags & GRID_VERTLINES )
if( nFlags & DrawGridFlags::VertLines )
{
for( long i = 0L; i < nHorzCount; i++ )
{
......
......@@ -759,7 +759,7 @@ void setupMethodStubs( functor_vector_type& res )
boost::bind(
&OutputDevice::DrawGrid,
_1,
aRect,Size(10,20),GRID_HORZLINES|GRID_VERTLINES ));
aRect,Size(10,20),DrawGridFlags::HorzLines|DrawGridFlags::VertLines ));
/* void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
sal_uInt16 nTransparencePercent );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment