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