convert WALLPAPER constants to scoped enum

Change-Id: I3b4b4e8a94904e22823a263bd5446a2e1aa47661
This commit is contained in:
Noel Grandin 2015-07-23 12:43:02 +02:00
parent 7bf70574e1
commit dc7fc2074d
15 changed files with 111 additions and 132 deletions

View File

@ -1149,7 +1149,7 @@ namespace
// if bitmap visualisation is transparent, maybe background // if bitmap visualisation is transparent, maybe background
// needs to be filled. Create background // needs to be filled. Create background
if(aBitmapEx.IsTransparent() if(aBitmapEx.IsTransparent()
|| (WALLPAPER_TILE != eWallpaperStyle && WALLPAPER_SCALE != eWallpaperStyle)) || (WallpaperStyle::Tile != eWallpaperStyle && WallpaperStyle::Scale != eWallpaperStyle))
{ {
if(rWallpaper.IsGradient()) if(rWallpaper.IsGradient())
{ {
@ -2375,7 +2375,7 @@ namespace
aWallpaperRectangle.Left(), aWallpaperRectangle.Top(), aWallpaperRectangle.Left(), aWallpaperRectangle.Top(),
aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom()); aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom());
if(WALLPAPER_NULL != eWallpaperStyle) if(WallpaperStyle::NONE != eWallpaperStyle)
{ {
if(rWallpaper.IsBitmap()) if(rWallpaper.IsBitmap())
{ {

View File

@ -44,7 +44,7 @@ namespace drawinglayer
if(rPixelSize.Width() > 0 && rPixelSize.Height() > 0) if(rPixelSize.Width() > 0 && rPixelSize.Height() > 0)
{ {
if(WALLPAPER_SCALE == getWallpaperStyle()) if(WallpaperStyle::Scale == getWallpaperStyle())
{ {
// shortcut for scale; use simple BitmapPrimitive2D // shortcut for scale; use simple BitmapPrimitive2D
basegfx::B2DHomMatrix aObjectTransform; basegfx::B2DHomMatrix aObjectTransform;
@ -76,64 +76,64 @@ namespace drawinglayer
switch(getWallpaperStyle()) switch(getWallpaperStyle())
{ {
default: //case WALLPAPER_TILE :, also WALLPAPER_NULL and WALLPAPER_APPLICATIONGRADIENT default: //case WallpaperStyle::Tile :, also WallpaperStyle::NONE and WallpaperStyle::ApplicationGradient
{ {
bUseTargetTopLeft = false; bUseTargetTopLeft = false;
break; break;
} }
case WALLPAPER_SCALE : case WallpaperStyle::Scale :
{ {
// handled by shortcut above // handled by shortcut above
break; break;
} }
case WALLPAPER_TOPLEFT : case WallpaperStyle::TopLeft :
{ {
// nothing to do // nothing to do
break; break;
} }
case WALLPAPER_TOP : case WallpaperStyle::Top :
{ {
const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5)); aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5));
break; break;
} }
case WALLPAPER_TOPRIGHT : case WallpaperStyle::TopRight :
{ {
aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX()); aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX());
break; break;
} }
case WALLPAPER_LEFT : case WallpaperStyle::Left :
{ {
const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5)); aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5));
break; break;
} }
case WALLPAPER_CENTER : case WallpaperStyle::Center :
{ {
const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
aTargetTopLeft = aCenter - (aLogicSize * 0.5); aTargetTopLeft = aCenter - (aLogicSize * 0.5);
break; break;
} }
case WALLPAPER_RIGHT : case WallpaperStyle::Right :
{ {
const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX()); aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX());
aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5)); aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5));
break; break;
} }
case WALLPAPER_BOTTOMLEFT : case WallpaperStyle::BottomLeft :
{ {
aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY()); aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY());
break; break;
} }
case WALLPAPER_BOTTOM : case WallpaperStyle::Bottom :
{ {
const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5)); aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5));
aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY()); aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY());
break; break;
} }
case WALLPAPER_BOTTOMRIGHT : case WallpaperStyle::BottomRight :
{ {
aTargetTopLeft = getLocalObjectRange().getMaximum() - aLogicSize; aTargetTopLeft = getLocalObjectRange().getMaximum() - aLogicSize;
break; break;
@ -164,14 +164,14 @@ namespace drawinglayer
} }
else else
{ {
// WALLPAPER_TILE, WALLPAPER_NULL, WALLPAPER_APPLICATIONGRADIENT // WallpaperStyle::Tile, WallpaperStyle::NONE, WallpaperStyle::ApplicationGradient
// convert to relative positions // convert to relative positions
const basegfx::B2DVector aRelativeSize( const basegfx::B2DVector aRelativeSize(
aLogicSize.getX() / (getLocalObjectRange().getWidth() ? getLocalObjectRange().getWidth() : 1.0), aLogicSize.getX() / (getLocalObjectRange().getWidth() ? getLocalObjectRange().getWidth() : 1.0),
aLogicSize.getY() / (getLocalObjectRange().getHeight() ? getLocalObjectRange().getHeight() : 1.0)); aLogicSize.getY() / (getLocalObjectRange().getHeight() ? getLocalObjectRange().getHeight() : 1.0));
basegfx::B2DPoint aRelativeTopLeft(0.0, 0.0); basegfx::B2DPoint aRelativeTopLeft(0.0, 0.0);
if(WALLPAPER_TILE != getWallpaperStyle()) if(WallpaperStyle::Tile != getWallpaperStyle())
{ {
aRelativeTopLeft.setX(0.5 - aRelativeSize.getX()); aRelativeTopLeft.setX(0.5 - aRelativeSize.getX());
aRelativeTopLeft.setY(0.5 - aRelativeSize.getY()); aRelativeTopLeft.setY(0.5 - aRelativeSize.getY());

View File

@ -4069,18 +4069,18 @@ SvxGraphicPosition SvxBrushItem::WallpaperStyle2GraphicPos( WallpaperStyle eStyl
// The switch is not the fastest, but the safest // The switch is not the fastest, but the safest
switch( eStyle ) switch( eStyle )
{ {
case WALLPAPER_NULL: eResult = GPOS_NONE; break; case WallpaperStyle::NONE: eResult = GPOS_NONE; break;
case WALLPAPER_TILE: eResult = GPOS_TILED; break; case WallpaperStyle::Tile: eResult = GPOS_TILED; break;
case WALLPAPER_CENTER: eResult = GPOS_MM; break; case WallpaperStyle::Center: eResult = GPOS_MM; break;
case WALLPAPER_SCALE: eResult = GPOS_AREA; break; case WallpaperStyle::Scale: eResult = GPOS_AREA; break;
case WALLPAPER_TOPLEFT: eResult = GPOS_LT; break; case WallpaperStyle::TopLeft: eResult = GPOS_LT; break;
case WALLPAPER_TOP: eResult = GPOS_MT; break; case WallpaperStyle::Top: eResult = GPOS_MT; break;
case WALLPAPER_TOPRIGHT: eResult = GPOS_RT; break; case WallpaperStyle::TopRight: eResult = GPOS_RT; break;
case WALLPAPER_LEFT: eResult = GPOS_LM; break; case WallpaperStyle::Left: eResult = GPOS_LM; break;
case WALLPAPER_RIGHT: eResult = GPOS_RM; break; case WallpaperStyle::Right: eResult = GPOS_RM; break;
case WALLPAPER_BOTTOMLEFT: eResult = GPOS_LB; break; case WallpaperStyle::BottomLeft: eResult = GPOS_LB; break;
case WALLPAPER_BOTTOM: eResult = GPOS_MB; break; case WallpaperStyle::Bottom: eResult = GPOS_MB; break;
case WALLPAPER_BOTTOMRIGHT: eResult = GPOS_RB; break; case WallpaperStyle::BottomRight: eResult = GPOS_RB; break;
default: eResult = GPOS_NONE; default: eResult = GPOS_NONE;
} }
return eResult; return eResult;
@ -4092,19 +4092,19 @@ WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos
WallpaperStyle eResult; WallpaperStyle eResult;
switch( ePos ) switch( ePos )
{ {
case GPOS_NONE: eResult = WALLPAPER_NULL; break; case GPOS_NONE: eResult = WallpaperStyle::NONE; break;
case GPOS_TILED: eResult = WALLPAPER_TILE; break; case GPOS_TILED: eResult = WallpaperStyle::Tile; break;
case GPOS_MM: eResult = WALLPAPER_CENTER; break; case GPOS_MM: eResult = WallpaperStyle::Center; break;
case GPOS_AREA: eResult = WALLPAPER_SCALE; break; case GPOS_AREA: eResult = WallpaperStyle::Scale; break;
case GPOS_LT: eResult = WALLPAPER_TOPLEFT; break; case GPOS_LT: eResult = WallpaperStyle::TopLeft; break;
case GPOS_MT: eResult = WALLPAPER_TOP; break; case GPOS_MT: eResult = WallpaperStyle::Top; break;
case GPOS_RT: eResult = WALLPAPER_TOPRIGHT; break; case GPOS_RT: eResult = WallpaperStyle::TopRight; break;
case GPOS_LM: eResult = WALLPAPER_LEFT; break; case GPOS_LM: eResult = WallpaperStyle::Left; break;
case GPOS_RM: eResult = WALLPAPER_RIGHT; break; case GPOS_RM: eResult = WallpaperStyle::Right; break;
case GPOS_LB: eResult = WALLPAPER_BOTTOMLEFT; break; case GPOS_LB: eResult = WallpaperStyle::BottomLeft; break;
case GPOS_MB: eResult = WALLPAPER_BOTTOM; break; case GPOS_MB: eResult = WallpaperStyle::Bottom; break;
case GPOS_RB: eResult = WALLPAPER_BOTTOMRIGHT; break; case GPOS_RB: eResult = WallpaperStyle::BottomRight; break;
default: eResult = WALLPAPER_NULL; default: eResult = WallpaperStyle::NONE;
} }
return eResult; return eResult;
} }

View File

@ -28,45 +28,24 @@ class Gradient;
class BitmapEx; class BitmapEx;
class ImplWallpaper; class ImplWallpaper;
#define WALLPAPER_NULL WallpaperStyle_NULL enum class WallpaperStyle
#define WALLPAPER_TILE WallpaperStyle_TILE
#define WALLPAPER_CENTER WallpaperStyle_CENTER
#define WALLPAPER_SCALE WallpaperStyle_SCALE
#define WALLPAPER_TOPLEFT WallpaperStyle_TOPLEFT
#define WALLPAPER_TOP WallpaperStyle_TOP
#define WALLPAPER_TOPRIGHT WallpaperStyle_TOPRIGHT
#define WALLPAPER_LEFT WallpaperStyle_LEFT
#define WALLPAPER_RIGHT WallpaperStyle_RIGHT
#define WALLPAPER_BOTTOMLEFT WallpaperStyle_BOTTOMLEFT
#define WALLPAPER_BOTTOM WallpaperStyle_BOTTOM
#define WALLPAPER_BOTTOMRIGHT WallpaperStyle_BOTTOMRIGHT
#define WALLPAPER_APPLICATIONGRADIENT WallpaperStyle_APPLICATIONGRADIENT
#define WALLPAPER_FORCE_EQUAL_SIZE WallpaperStyle_FORCE_EQUAL_SIZE
#ifndef ENUM_WALLPAPERSTYLE_DECLARED
#define ENUM_WALLPAPERSTYLE_DECLARED
enum WallpaperStyle
{ {
WALLPAPER_NULL, NONE,
WALLPAPER_TILE, Tile,
WALLPAPER_CENTER, Center,
WALLPAPER_SCALE, Scale,
WALLPAPER_TOPLEFT, TopLeft,
WALLPAPER_TOP, Top,
WALLPAPER_TOPRIGHT, TopRight,
WALLPAPER_LEFT, Left,
WALLPAPER_RIGHT, Right,
WALLPAPER_BOTTOMLEFT, BottomLeft,
WALLPAPER_BOTTOM, Bottom,
WALLPAPER_BOTTOMRIGHT, BottomRight,
WALLPAPER_APPLICATIONGRADIENT, // defines a gradient that internally covers the whole application ApplicationGradient // defines a gradient that internally covers the whole application
// and uses a color derived from the face color // and uses a color derived from the face color
WALLPAPER_FORCE_EQUAL_SIZE = 0x7fffffff
}; };
#endif
class VCL_DLLPUBLIC Wallpaper class VCL_DLLPUBLIC Wallpaper
{ {
private: private:

View File

@ -322,7 +322,7 @@ void BackingWindow::initControls()
// motif image under the buttons // motif image under the buttons
Wallpaper aWallpaper(get<FixedImage>("motif")->GetImage().GetBitmapEx()); Wallpaper aWallpaper(get<FixedImage>("motif")->GetImage().GetBitmapEx());
aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); aWallpaper.SetStyle(WallpaperStyle::BottomRight);
aWallpaper.SetColor(aButtonsBackground); aWallpaper.SetColor(aButtonsBackground);
mpButtonsBox->SetBackground(aWallpaper); mpButtonsBox->SetBackground(aWallpaper);

View File

@ -139,7 +139,7 @@ void SfxFrameDescriptor::SetWallpaper( const Wallpaper& rWallpaper )
{ {
DELETEZ( pImp->pWallpaper ); DELETEZ( pImp->pWallpaper );
if ( rWallpaper.GetStyle() != WALLPAPER_NULL ) if ( rWallpaper.GetStyle() != WallpaperStyle::NONE )
pImp->pWallpaper = new Wallpaper( rWallpaper ); pImp->pWallpaper = new Wallpaper( rWallpaper );
} }

View File

@ -371,7 +371,7 @@ void SvtIconChoiceCtrl::SetBackground( const Wallpaper& rPaper )
Wallpaper aBackground( rPaper ); Wallpaper aBackground( rPaper );
// HACK, as background might be transparent! // HACK, as background might be transparent!
if( !aBackground.IsBitmap() ) if( !aBackground.IsBitmap() )
aBackground.SetStyle( WALLPAPER_TILE ); aBackground.SetStyle( WallpaperStyle::Tile );
WallpaperStyle eStyle = aBackground.GetStyle(); WallpaperStyle eStyle = aBackground.GetStyle();
Color aBack( aBackground.GetColor()); Color aBack( aBackground.GetColor());
@ -379,7 +379,7 @@ void SvtIconChoiceCtrl::SetBackground( const Wallpaper& rPaper )
if( aBack == aTrans && ( if( aBack == aTrans && (
(!aBackground.IsBitmap() || (!aBackground.IsBitmap() ||
aBackground.GetBitmap().IsTransparent() || aBackground.GetBitmap().IsTransparent() ||
(eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE)))) (eStyle != WallpaperStyle::Tile && eStyle != WallpaperStyle::Scale))))
{ {
aBackground.SetColor( rStyleSettings.GetFieldColor() ); aBackground.SetColor( rStyleSettings.GetFieldColor() );
} }

View File

@ -2397,7 +2397,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
Image aImage( xGraphic ); Image aImage( xGraphic );
Wallpaper aWallpaper( aImage.GetBitmapEx()); Wallpaper aWallpaper( aImage.GetBitmapEx());
aWallpaper.SetStyle( WALLPAPER_SCALE ); aWallpaper.SetStyle( WallpaperStyle::Scale );
pDialog->SetBackground( aWallpaper ); pDialog->SetBackground( aWallpaper );
} }
else if ( bVoid || !xGraphic.is() ) else if ( bVoid || !xGraphic.is() )
@ -2561,7 +2561,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
Image aImage( xGraphic ); Image aImage( xGraphic );
Wallpaper aWallpaper( aImage.GetBitmapEx()); Wallpaper aWallpaper( aImage.GetBitmapEx());
aWallpaper.SetStyle( WALLPAPER_SCALE ); aWallpaper.SetStyle( WallpaperStyle::Scale );
pTabControl->SetBackground( aWallpaper ); pTabControl->SetBackground( aWallpaper );
} }
else if ( bVoid || !xGraphic.is() ) else if ( bVoid || !xGraphic.is() )
@ -2803,7 +2803,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
Image aImage( xGraphic ); Image aImage( xGraphic );
Wallpaper aWallpaper( aImage.GetBitmapEx()); Wallpaper aWallpaper( aImage.GetBitmapEx());
aWallpaper.SetStyle( WALLPAPER_SCALE ); aWallpaper.SetStyle( WallpaperStyle::Scale );
pTabPage->SetBackground( aWallpaper ); pTabPage->SetBackground( aWallpaper );
} }
else if ( bVoid || !xGraphic.is() ) else if ( bVoid || !xGraphic.is() )

View File

@ -348,7 +348,7 @@ void doTestCode()
aWriter.NewPage( 595, 842 ); aWriter.NewPage( 595, 842 );
aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); aWriter.SetMapMode( MapMode( MAP_100TH_MM ) );
Wallpaper aWall( aTransMask ); Wallpaper aWall( aTransMask );
aWall.SetStyle( WALLPAPER_TILE ); aWall.SetStyle( WallpaperStyle::Tile );
aWriter.DrawWallpaper( Rectangle( Point( 4400, 4200 ), Size( 10200, 6300 ) ), aWall ); aWriter.DrawWallpaper( Rectangle( Point( 4400, 4200 ), Size( 10200, 6300 ) ), aWall );
aWriter.NewPage( 595, 842 ); aWriter.NewPage( 595, 842 );
@ -11823,9 +11823,9 @@ void PDFWriterImpl::drawWallpaper( const Rectangle& rRect, const Wallpaper& rWal
aBmpPos = aRect.TopLeft(); aBmpPos = aRect.TopLeft();
aBmpSize = aRect.GetSize(); aBmpSize = aRect.GetSize();
} }
if( rWall.GetStyle() != WALLPAPER_SCALE ) if( rWall.GetStyle() != WallpaperStyle::Scale )
{ {
if( rWall.GetStyle() != WALLPAPER_TILE ) if( rWall.GetStyle() != WallpaperStyle::Tile )
{ {
bDrawBitmap = true; bDrawBitmap = true;
if( rWall.IsGradient() ) if( rWall.IsGradient() )
@ -11834,33 +11834,33 @@ void PDFWriterImpl::drawWallpaper( const Rectangle& rRect, const Wallpaper& rWal
bDrawColor = true; bDrawColor = true;
switch( rWall.GetStyle() ) switch( rWall.GetStyle() )
{ {
case WALLPAPER_TOPLEFT: case WallpaperStyle::TopLeft:
break; break;
case WALLPAPER_TOP: case WallpaperStyle::Top:
aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2; aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2;
break; break;
case WALLPAPER_LEFT: case WallpaperStyle::Left:
aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2; aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2;
break; break;
case WALLPAPER_TOPRIGHT: case WallpaperStyle::TopRight:
aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width(); aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width();
break; break;
case WALLPAPER_CENTER: case WallpaperStyle::Center:
aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2; aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2;
aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2; aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2;
break; break;
case WALLPAPER_RIGHT: case WallpaperStyle::Right:
aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width(); aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width();
aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2; aBmpPos.Y() += (aRect.GetHeight()-aBmpSize.Height())/2;
break; break;
case WALLPAPER_BOTTOMLEFT: case WallpaperStyle::BottomLeft:
aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height(); aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height();
break; break;
case WALLPAPER_BOTTOM: case WallpaperStyle::Bottom:
aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2; aBmpPos.X() += (aRect.GetWidth()-aBmpSize.Width())/2;
aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height(); aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height();
break; break;
case WALLPAPER_BOTTOMRIGHT: case WallpaperStyle::BottomRight:
aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width(); aBmpPos.X() += aRect.GetWidth()-aBmpSize.Width();
aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height(); aBmpPos.Y() += aRect.GetHeight()-aBmpSize.Height();
break; break;

View File

@ -36,7 +36,7 @@ ImplWallpaper::ImplWallpaper() :
mpCache = NULL; mpCache = NULL;
mpGradient = NULL; mpGradient = NULL;
mpRect = NULL; mpRect = NULL;
meStyle = WALLPAPER_NULL; meStyle = WallpaperStyle::NONE;
} }
ImplWallpaper::ImplWallpaper( const ImplWallpaper& rImplWallpaper ) : ImplWallpaper::ImplWallpaper( const ImplWallpaper& rImplWallpaper ) :
@ -148,7 +148,7 @@ SvStream& WriteImplWallpaper( SvStream& rOStm, const ImplWallpaper& rImplWallpap
// version 1 // version 1
WriteColor( rOStm, rImplWallpaper.maColor ); WriteColor( rOStm, rImplWallpaper.maColor );
rOStm.WriteUInt16( rImplWallpaper.meStyle ); rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplWallpaper.meStyle) );
// version 2 // version 2
rOStm.WriteBool( bRect ).WriteBool( bGrad ).WriteBool( bBmp ).WriteBool( bDummy ).WriteBool( bDummy ).WriteBool( bDummy ); rOStm.WriteBool( bRect ).WriteBool( bGrad ).WriteBool( bBmp ).WriteBool( bDummy ).WriteBool( bDummy ).WriteBool( bDummy );
@ -207,7 +207,7 @@ Wallpaper::Wallpaper( const Color& rColor )
mpImplWallpaper = new ImplWallpaper; mpImplWallpaper = new ImplWallpaper;
mpImplWallpaper->maColor = rColor; mpImplWallpaper->maColor = rColor;
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
Wallpaper::Wallpaper( const BitmapEx& rBmpEx ) Wallpaper::Wallpaper( const BitmapEx& rBmpEx )
@ -215,7 +215,7 @@ Wallpaper::Wallpaper( const BitmapEx& rBmpEx )
mpImplWallpaper = new ImplWallpaper; mpImplWallpaper = new ImplWallpaper;
mpImplWallpaper->mpBitmap = new BitmapEx( rBmpEx ); mpImplWallpaper->mpBitmap = new BitmapEx( rBmpEx );
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
Wallpaper::Wallpaper( const Gradient& rGradient ) Wallpaper::Wallpaper( const Gradient& rGradient )
@ -223,7 +223,7 @@ Wallpaper::Wallpaper( const Gradient& rGradient )
mpImplWallpaper = new ImplWallpaper; mpImplWallpaper = new ImplWallpaper;
mpImplWallpaper->mpGradient = new Gradient( rGradient ); mpImplWallpaper->mpGradient = new Gradient( rGradient );
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
Wallpaper::~Wallpaper() Wallpaper::~Wallpaper()
@ -245,8 +245,8 @@ void Wallpaper::SetColor( const Color& rColor )
ImplMakeUnique(); ImplMakeUnique();
mpImplWallpaper->maColor = rColor; mpImplWallpaper->maColor = rColor;
if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle ) if( WallpaperStyle::NONE == mpImplWallpaper->meStyle || WallpaperStyle::ApplicationGradient == mpImplWallpaper->meStyle )
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
const Color& Wallpaper::GetColor() const const Color& Wallpaper::GetColor() const
@ -260,7 +260,7 @@ void Wallpaper::SetStyle( WallpaperStyle eStyle )
ImplMakeUnique( false ); ImplMakeUnique( false );
if( eStyle == WALLPAPER_APPLICATIONGRADIENT ) if( eStyle == WallpaperStyle::ApplicationGradient )
// set a dummy gradient, the correct gradient // set a dummy gradient, the correct gradient
// will be created dynamically in GetGradient() // will be created dynamically in GetGradient()
SetGradient( ImplGetApplicationGradient() ); SetGradient( ImplGetApplicationGradient() );
@ -295,8 +295,8 @@ void Wallpaper::SetBitmap( const BitmapEx& rBitmap )
mpImplWallpaper->mpBitmap = new BitmapEx( rBitmap ); mpImplWallpaper->mpBitmap = new BitmapEx( rBitmap );
} }
if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle) if( WallpaperStyle::NONE == mpImplWallpaper->meStyle || WallpaperStyle::ApplicationGradient == mpImplWallpaper->meStyle)
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
BitmapEx Wallpaper::GetBitmap() const BitmapEx Wallpaper::GetBitmap() const
@ -327,14 +327,14 @@ void Wallpaper::SetGradient( const Gradient& rGradient )
else else
mpImplWallpaper->mpGradient = new Gradient( rGradient ); mpImplWallpaper->mpGradient = new Gradient( rGradient );
if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle ) if( WallpaperStyle::NONE == mpImplWallpaper->meStyle || WallpaperStyle::ApplicationGradient == mpImplWallpaper->meStyle )
mpImplWallpaper->meStyle = WALLPAPER_TILE; mpImplWallpaper->meStyle = WallpaperStyle::Tile;
} }
Gradient Wallpaper::GetGradient() const Gradient Wallpaper::GetGradient() const
{ {
if( WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle ) if( WallpaperStyle::ApplicationGradient == mpImplWallpaper->meStyle )
return ImplGetApplicationGradient(); return ImplGetApplicationGradient();
else if ( mpImplWallpaper->mpGradient ) else if ( mpImplWallpaper->mpGradient )
return *(mpImplWallpaper->mpGradient); return *(mpImplWallpaper->mpGradient);
@ -407,7 +407,7 @@ bool Wallpaper::IsRect() const
bool Wallpaper::IsFixed() const bool Wallpaper::IsFixed() const
{ {
if ( mpImplWallpaper->meStyle == WALLPAPER_NULL ) if ( mpImplWallpaper->meStyle == WallpaperStyle::NONE )
return false; return false;
else else
return (!mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient); return (!mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient);
@ -415,12 +415,12 @@ bool Wallpaper::IsFixed() const
bool Wallpaper::IsScrollable() const bool Wallpaper::IsScrollable() const
{ {
if ( mpImplWallpaper->meStyle == WALLPAPER_NULL ) if ( mpImplWallpaper->meStyle == WallpaperStyle::NONE )
return false; return false;
else if ( !mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient ) else if ( !mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient )
return true; return true;
else if ( mpImplWallpaper->mpBitmap ) else if ( mpImplWallpaper->mpBitmap )
return (mpImplWallpaper->meStyle == WALLPAPER_TILE); return (mpImplWallpaper->meStyle == WallpaperStyle::Tile);
else else
return false; return false;
} }

View File

@ -466,7 +466,7 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground )
maBackground = rBackground; maBackground = rBackground;
if( rBackground.GetStyle() == WALLPAPER_NULL ) if( rBackground.GetStyle() == WallpaperStyle::NONE )
mbBackground = false; mbBackground = false;
else else
mbBackground = true; mbBackground = true;

View File

@ -36,7 +36,7 @@ void OutputDevice::DrawWallpaper( const Rectangle& rRect,
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
return; return;
if ( rWallpaper.GetStyle() != WALLPAPER_NULL ) if ( rWallpaper.GetStyle() != WallpaperStyle::NONE )
{ {
Rectangle aRect = LogicToPixel( rRect ); Rectangle aRect = LogicToPixel( rRect );
aRect.Justify(); aRect.Justify();
@ -150,7 +150,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
bDrawColorBackground = true; bDrawColorBackground = true;
} }
} }
else if( eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE ) else if( eStyle != WallpaperStyle::Tile && eStyle != WallpaperStyle::Scale )
{ {
if( rWallpaper.IsGradient() ) if( rWallpaper.IsGradient() )
bDrawGradientBackground = true; bDrawGradientBackground = true;
@ -187,7 +187,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
switch( eStyle ) switch( eStyle )
{ {
case( WALLPAPER_SCALE ): case( WallpaperStyle::Scale ):
if( !pCached || ( pCached->GetSizePixel() != aSize ) ) if( !pCached || ( pCached->GetSizePixel() != aSize ) )
{ {
if( pCached ) if( pCached )
@ -199,41 +199,41 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
} }
break; break;
case( WALLPAPER_TOPLEFT ): case( WallpaperStyle::TopLeft ):
break; break;
case( WALLPAPER_TOP ): case( WallpaperStyle::Top ):
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1; aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
break; break;
case( WALLPAPER_TOPRIGHT ): case( WallpaperStyle::TopRight ):
aPos.X() += ( aSize.Width() - nBmpWidth ); aPos.X() += ( aSize.Width() - nBmpWidth );
break; break;
case( WALLPAPER_LEFT ): case( WallpaperStyle::Left ):
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1; aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
break; break;
case( WALLPAPER_CENTER ): case( WallpaperStyle::Center ):
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1; aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1; aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
break; break;
case( WALLPAPER_RIGHT ): case( WallpaperStyle::Right ):
aPos.X() += ( aSize.Width() - nBmpWidth ); aPos.X() += ( aSize.Width() - nBmpWidth );
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1; aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
break; break;
case( WALLPAPER_BOTTOMLEFT ): case( WallpaperStyle::BottomLeft ):
aPos.Y() += ( aSize.Height() - nBmpHeight ); aPos.Y() += ( aSize.Height() - nBmpHeight );
break; break;
case( WALLPAPER_BOTTOM ): case( WallpaperStyle::Bottom ):
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1; aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
aPos.Y() += ( aSize.Height() - nBmpHeight ); aPos.Y() += ( aSize.Height() - nBmpHeight );
break; break;
case( WALLPAPER_BOTTOMRIGHT ): case( WallpaperStyle::BottomRight ):
aPos.X() += ( aSize.Width() - nBmpWidth ); aPos.X() += ( aSize.Width() - nBmpWidth );
aPos.Y() += ( aSize.Height() - nBmpHeight ); aPos.Y() += ( aSize.Height() - nBmpHeight );
break; break;
@ -245,7 +245,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
long nFirstX; long nFirstX;
long nFirstY; long nFirstY;
if( eStyle == WALLPAPER_TILE ) if( eStyle == WallpaperStyle::Tile )
{ {
nFirstX = aPos.X(); nFirstX = aPos.X();
nFirstY = aPos.Y(); nFirstY = aPos.Y();

View File

@ -128,9 +128,9 @@ void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{ {
Wallpaper aWallpaper(rPersonaBitmap); Wallpaper aWallpaper(rPersonaBitmap);
if (GetAlign() == WINDOWALIGN_TOP) if (GetAlign() == WINDOWALIGN_TOP)
aWallpaper.SetStyle(WALLPAPER_TOPRIGHT); aWallpaper.SetStyle(WallpaperStyle::TopRight);
else else
aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); aWallpaper.SetStyle(WallpaperStyle::BottomRight);
aWallpaper.SetColor(rSetting.GetWorkspaceColor()); aWallpaper.SetColor(rSetting.GetWorkspaceColor());
// we need to shift the bitmap vertically so that it spans over the // we need to shift the bitmap vertically so that it spans over the
@ -152,7 +152,7 @@ void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext)
else if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) else if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
{ {
Wallpaper aWallpaper; Wallpaper aWallpaper;
aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT); aWallpaper.SetStyle(WallpaperStyle::ApplicationGradient);
rRenderContext.SetBackground(aWallpaper); rRenderContext.SetBackground(aWallpaper);
} }
else else

View File

@ -1054,7 +1054,7 @@ void MenuBarWindow::ApplySettings(vcl::RenderContext& rRenderContext)
if (!rPersonaBitmap.IsEmpty()) if (!rPersonaBitmap.IsEmpty())
{ {
Wallpaper aWallpaper(rPersonaBitmap); Wallpaper aWallpaper(rPersonaBitmap);
aWallpaper.SetStyle(WALLPAPER_TOPRIGHT); aWallpaper.SetStyle(WallpaperStyle::TopRight);
aWallpaper.SetColor(Application::GetSettings().GetStyleSettings().GetWorkspaceColor()); aWallpaper.SetColor(Application::GetSettings().GetStyleSettings().GetWorkspaceColor());
rRenderContext.SetBackground(aWallpaper); rRenderContext.SetBackground(aWallpaper);
@ -1068,7 +1068,7 @@ void MenuBarWindow::ApplySettings(vcl::RenderContext& rRenderContext)
else else
{ {
Wallpaper aWallpaper; Wallpaper aWallpaper;
aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT); aWallpaper.SetStyle(WallpaperStyle::ApplicationGradient);
rRenderContext.SetBackground(aWallpaper); rRenderContext.SetBackground(aWallpaper);
SetPaintTransparent(false); SetPaintTransparent(false);
SetParentClipMode(ParentClipMode::NONE); SetParentClipMode(ParentClipMode::NONE);

View File

@ -1468,7 +1468,7 @@ public:
SetText("VCL widget demo"); SetText("VCL widget demo");
Wallpaper aWallpaper(BitmapEx("sfx2/res/startcenter-logo.png")); Wallpaper aWallpaper(BitmapEx("sfx2/res/startcenter-logo.png"));
aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); aWallpaper.SetStyle(WallpaperStyle::BottomRight);
aWallpaper.SetColor(COL_RED); aWallpaper.SetColor(COL_RED);
mpBox->SetBackground(aWallpaper); mpBox->SetBackground(aWallpaper);