[Libreoffice-commits] .: 6 commits - vcl/inc vcl/source
Tor Lillqvist
tml at kemper.freedesktop.org
Mon Dec 5 02:56:55 PST 2011
vcl/inc/vcl/decoview.hxx | 5
vcl/inc/vcl/outdev.hxx | 1
vcl/source/gdi/outdev6.cxx | 14
vcl/source/window/decoview.cxx | 598 ++++++++++++++++++-----------------------
4 files changed, 278 insertions(+), 340 deletions(-)
New commits:
commit 363728c52f41cbf3f5d4a1d5ead08fbde161ca55
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Dec 4 23:55:56 2011 +0100
DecoView - a more descriptive comment about mirroring issues with checkmarks
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 1958cd6..c249a86 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -339,6 +339,8 @@ void ImplDrawSymbol( OutputDevice* pDev, Rectangle nRect, const SymbolType eType
// #106953# never mirror checkmarks
if ( pDev->ImplHasMirroredGraphics() && pDev->IsRTLEnabled() )
{
+ // Draw a mirrored checkmark so that it looks "normal" in a
+ // mirrored graphics device (double mirroring!)
pDev->DrawLine( Point( nRect.Right(), nRect.Bottom()-n3 ),
Point( nRect.Right()-n3, nRect.Bottom() ) );
pDev->DrawLine( Point( nRect.Right()-n3, nRect.Bottom() ),
commit ca0c44628911ba23d92a0d3b08556cedcf282ec1
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Dec 4 23:20:40 2011 +0100
DecoView cleanup - remove unused button styles
diff --git a/vcl/inc/vcl/decoview.hxx b/vcl/inc/vcl/decoview.hxx
index 63434be..64b738e 100644
--- a/vcl/inc/vcl/decoview.hxx
+++ b/vcl/inc/vcl/decoview.hxx
@@ -76,12 +76,9 @@ class OutputDevice;
#define BUTTON_DRAW_DISABLED ((sal_uInt16)0x0080)
#define BUTTON_DRAW_HIGHLIGHT ((sal_uInt16)0x0100)
#define BUTTON_DRAW_FLAT ((sal_uInt16)0x0200)
-#define BUTTON_DRAW_NOTOPLIGHTBORDER ((sal_uInt16)0x0400)
-#define BUTTON_DRAW_NOBOTTOMSHADOWBORDER ((sal_uInt16)0x0800)
#define BUTTON_DRAW_NOLEFTLIGHTBORDER ((sal_uInt16)0x1000)
#define BUTTON_DRAW_NOTEXT ((sal_uInt16)0x2000)
-#define BUTTON_DRAW_NOIMAGE ((sal_uInt16)0x4000)
-#define BUTTON_DRAW_NODRAW ((sal_uInt16)0x8000)
+#define BUTTON_DRAW_NOIMAGE ((sal_uInt16)0x4000)
// ------------------
// - DecorationView -
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index ec46b89..1958cd6 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -589,22 +589,6 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
}
else
{
- if ( nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER )
- {
- pDev->SetLineColor( rStyleSettings.GetLightBorderColor() );
- pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Top()),
- Point( aFillRect.Right(), aFillRect.Top() ) );
- ++aFillRect.Top();
- }
- if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
- !(nStyle & BUTTON_DRAW_HIGHLIGHT) )
- {
- pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
- pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Bottom() ),
- Point( aFillRect.Right(), aFillRect.Bottom() ) );
- --aFillRect.Bottom();
- }
-
if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
aColor1 = rStyleSettings.GetLightBorderColor();
else
@@ -1024,14 +1008,11 @@ Rectangle DecorationView::DrawButton( const Rectangle& rRect, sal_uInt16 nStyle
mpOutDev->EnableMapMode( false );
}
- if ( !(nStyle & BUTTON_DRAW_NODRAW) )
- {
- const Color maOldLineColor = mpOutDev->GetLineColor();
- const Color maOldFillColor = mpOutDev->GetFillColor();
- ImplDrawButton( mpOutDev, aRect, nStyle );
- mpOutDev->SetLineColor( maOldLineColor );
- mpOutDev->SetFillColor( maOldFillColor );
- }
+ const Color maOldLineColor = mpOutDev->GetLineColor();
+ const Color maOldFillColor = mpOutDev->GetFillColor();
+ ImplDrawButton( mpOutDev, aRect, nStyle );
+ mpOutDev->SetLineColor( maOldLineColor );
+ mpOutDev->SetFillColor( maOldFillColor );
// Ein Border freilassen, der jedoch bei Default-Darstellung
// mitbenutzt wird
commit 651ce3894ddc3838510f3f06bff143ddb7f0fb54
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Dec 4 16:09:21 2011 +0100
DecoView cleanup - ImplDraw2ColorFrame also resizes its rectangle
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 58f425c..ec46b89 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -481,15 +481,21 @@ void ImplDrawDPILineRect( OutputDevice *const pDev, Rectangle& rRect,
}
-void ImplDraw2ColorFrame( OutputDevice *const pDev, const Rectangle& rRect,
+void ImplDraw2ColorFrame( OutputDevice *const pDev, Rectangle& rRect,
const Color& rLeftTopColor, const Color& rRightBottomColor )
{
- pDev->SetFillColor( rLeftTopColor );
- pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
- pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
- pDev->SetFillColor( rRightBottomColor );
- pDev->DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
- pDev->DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
+ pDev->SetLineColor( rLeftTopColor );
+ pDev->DrawLine( rRect.TopLeft(), rRect.BottomLeft() );
+ pDev->DrawLine( rRect.TopLeft(), rRect.TopRight() );
+ pDev->SetLineColor( rRightBottomColor );
+ pDev->DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+ pDev->DrawLine( rRect.TopRight(), rRect.BottomRight() );
+
+ // reduce drawing area
+ ++rRect.Left();
+ ++rRect.Top();
+ --rRect.Right();
+ --rRect.Bottom();
}
@@ -609,13 +615,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
aColor2 = rStyleSettings.GetDarkShadowColor();
}
- pDev->SetLineColor();
-
ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
- ++aFillRect.Left();
- ++aFillRect.Top();
- --aFillRect.Right();
- --aFillRect.Bottom();
if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
{
@@ -633,14 +633,11 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
aColor2 = rStyleSettings.GetShadowColor();
}
ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
- ++aFillRect.Left();
- ++aFillRect.Top();
- --aFillRect.Right();
- --aFillRect.Bottom();
}
if ( !(nStyle & BUTTON_DRAW_NOFILL) )
{
+ pDev->SetLineColor();
if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
else
@@ -704,15 +701,12 @@ void DecorationView::DrawFrame( const Rectangle& rRect,
const Color& rLeftTopColor,
const Color& rRightBottomColor )
{
- Rectangle aRect = mpOutDev->LogicToPixel( rRect );
- Color aOldLineColor = mpOutDev->GetLineColor();
- Color aOldFillColor = mpOutDev->GetFillColor();
- sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled();
- mpOutDev->EnableMapMode( sal_False );
- mpOutDev->SetLineColor();
+ Rectangle aRect = mpOutDev->LogicToPixel( rRect );
+ const Color aOldLineColor = mpOutDev->GetLineColor();
+ const bool bOldMapMode = mpOutDev->IsMapModeEnabled();
+ mpOutDev->EnableMapMode( false );
ImplDraw2ColorFrame( mpOutDev, aRect, rLeftTopColor, rRightBottomColor );
mpOutDev->SetLineColor( aOldLineColor );
- mpOutDev->SetFillColor( aOldFillColor );
mpOutDev->EnableMapMode( bOldMapMode );
}
@@ -908,8 +902,6 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
}
else
{
- pDev->SetLineColor();
-
if ( (nFrameStyle == FRAME_DRAW_IN) ||
(nFrameStyle == FRAME_DRAW_OUT) )
{
@@ -925,11 +917,6 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
rStyleSettings.GetLightColor(),
rStyleSettings.GetShadowColor() );
}
-
- rRect.Left()++;
- rRect.Top()++;
- rRect.Right()--;
- rRect.Bottom()--;
}
else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
{
@@ -959,12 +946,6 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
}
- rRect.Left()++;
- rRect.Top()++;
- rRect.Right()--;
- rRect.Bottom()--;
-
- sal_Bool bDrawn = sal_True;
if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
{
if( bFlatBorders ) // no 3d effect
@@ -983,15 +964,6 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
ImplDraw2ColorFrame( pDev, rRect,
rStyleSettings.GetLightColor(),
rStyleSettings.GetShadowColor() );
- else
- bDrawn = sal_False;
- }
- if( bDrawn )
- {
- rRect.Left()++;
- rRect.Top()++;
- rRect.Right()--;
- rRect.Bottom()--;
}
}
}
commit 1edf28e073a5088a7d26c61f509fc654be56696b
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Dec 4 15:25:04 2011 +0100
DecoView cleanup - Embed OutputDevice::ImplDraw2ColorFrame
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 17b94db..d2d3809 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -489,7 +489,6 @@ public:
SAL_DLLPRIVATE void ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
SAL_DLLPRIVATE void ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
SAL_DLLPRIVATE void ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
- SAL_DLLPRIVATE void ImplDraw2ColorFrame( const Rectangle& rRect, const Color& rLeftTopColor, const Color& rRightBottomColor );
SAL_DLLPRIVATE void ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pPosAry );
SAL_DLLPRIVATE void ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 8800fd4..098d36d 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -1170,20 +1170,6 @@ void OutputDevice::Erase()
// -----------------------------------------------------------------------
-void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect,
- const Color& rLeftTopColor,
- const Color& rRightBottomColor )
-{
- SetFillColor( rLeftTopColor );
- DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
- DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
- SetFillColor( rRightBottomColor );
- DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
- DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
-}
-
-// -----------------------------------------------------------------------
-
bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
const GfxLink& rGfxLink, GDIMetaFile* pSubst )
{
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 452bbb4..58f425c 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -481,6 +481,18 @@ void ImplDrawDPILineRect( OutputDevice *const pDev, Rectangle& rRect,
}
+void ImplDraw2ColorFrame( OutputDevice *const pDev, const Rectangle& rRect,
+ const Color& rLeftTopColor, const Color& rRightBottomColor )
+{
+ pDev->SetFillColor( rLeftTopColor );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
+ pDev->SetFillColor( rRightBottomColor );
+ pDev->DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
+ pDev->DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
+}
+
+
void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
const sal_uInt16 nStyle )
{
@@ -599,7 +611,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
pDev->SetLineColor();
- pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
++aFillRect.Left();
++aFillRect.Top();
--aFillRect.Right();
@@ -620,7 +632,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
aColor1 = rStyleSettings.GetLightBorderColor();
aColor2 = rStyleSettings.GetShadowColor();
}
- pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
++aFillRect.Left();
++aFillRect.Top();
--aFillRect.Right();
@@ -698,7 +710,7 @@ void DecorationView::DrawFrame( const Rectangle& rRect,
sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled();
mpOutDev->EnableMapMode( sal_False );
mpOutDev->SetLineColor();
- mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
+ ImplDraw2ColorFrame( mpOutDev, aRect, rLeftTopColor, rRightBottomColor );
mpOutDev->SetLineColor( aOldLineColor );
mpOutDev->SetFillColor( aOldFillColor );
mpOutDev->EnableMapMode( bOldMapMode );
@@ -903,15 +915,15 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
{
if ( nFrameStyle == FRAME_DRAW_IN )
{
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetShadowColor(),
- rStyleSettings.GetLightColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetLightColor() );
}
else
{
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetLightColor(),
- rStyleSettings.GetShadowColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetLightColor(),
+ rStyleSettings.GetShadowColor() );
}
rRect.Left()++;
@@ -924,26 +936,26 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
{
if( bFlatBorders ) // no 3d effect
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetShadowColor(),
- rStyleSettings.GetShadowColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetShadowColor() );
else
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetShadowColor(),
- rStyleSettings.GetLightColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetLightColor() );
}
else
{
if( bMenuStyle )
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetMenuBorderColor(),
- rStyleSettings.GetDarkShadowColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetMenuBorderColor(),
+ rStyleSettings.GetDarkShadowColor() );
else
- pDev->ImplDraw2ColorFrame( rRect,
- bFlatBorders ? // no 3d effect
- rStyleSettings.GetDarkShadowColor() :
- rStyleSettings.GetLightBorderColor(),
- rStyleSettings.GetDarkShadowColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ bFlatBorders ? // no 3d effect
+ rStyleSettings.GetDarkShadowColor() :
+ rStyleSettings.GetLightBorderColor(),
+ rStyleSettings.GetDarkShadowColor() );
}
@@ -956,21 +968,21 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
{
if( bFlatBorders ) // no 3d effect
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetFaceColor(),
- rStyleSettings.GetFaceColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetFaceColor(),
+ rStyleSettings.GetFaceColor() );
else
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetDarkShadowColor(),
- rStyleSettings.GetLightBorderColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetDarkShadowColor(),
+ rStyleSettings.GetLightBorderColor() );
}
else
{
// flat menues have no shadow border
if( !bMenuStyle || !rStyleSettings.GetUseFlatMenues() )
- pDev->ImplDraw2ColorFrame( rRect,
- rStyleSettings.GetLightColor(),
- rStyleSettings.GetShadowColor() );
+ ImplDraw2ColorFrame( pDev, rRect,
+ rStyleSettings.GetLightColor(),
+ rStyleSettings.GetShadowColor() );
else
bDrawn = sal_False;
}
commit 7a6941d76b61432a059c81d31b026272db822231
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Dec 4 12:18:49 2011 +0100
Decoview cleanup - DrawButton
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 9abd97e..452bbb4 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -430,6 +430,214 @@ void ImplDrawSymbol( OutputDevice* pDev, Rectangle nRect, const SymbolType eType
}
}
+
+void ImplDrawDPILineRect( OutputDevice *const pDev, Rectangle& rRect,
+ const Color *const pColor, const bool bRound = false )
+{
+ long nLineWidth = pDev->ImplGetDPIX()/300;
+ long nLineHeight = pDev->ImplGetDPIY()/300;
+ if ( !nLineWidth )
+ nLineWidth = 1;
+ if ( !nLineHeight )
+ nLineHeight = 1;
+
+ if ( pColor )
+ {
+ if ( (nLineWidth == 1) && (nLineHeight == 1) )
+ {
+ pDev->SetLineColor( *pColor );
+ if( bRound )
+ {
+ pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()), Point( rRect.Right()-1, rRect.Top()) );
+ pDev->DrawLine( Point( rRect.Left()+1, rRect.Bottom()), Point( rRect.Right()-1, rRect.Bottom()) );
+ pDev->DrawLine( Point( rRect.Left(), rRect.Top()+1), Point( rRect.Left(), rRect.Bottom()-1) );
+ pDev->DrawLine( Point( rRect.Right(), rRect.Top()+1), Point( rRect.Right(), rRect.Bottom()-1) );
+ }
+ else
+ {
+ pDev->SetFillColor();
+ pDev->DrawRect( rRect );
+ }
+ }
+ else
+ {
+ const long nWidth = rRect.GetWidth();
+ const long nHeight = rRect.GetHeight();
+ pDev->SetLineColor();
+ pDev->SetFillColor( *pColor );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nWidth, nLineHeight ) ) );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nLineWidth, nHeight ) ) );
+ pDev->DrawRect( Rectangle( Point( rRect.Left(), rRect.Bottom()-nLineHeight ),
+ Size( nWidth, nLineHeight ) ) );
+ pDev->DrawRect( Rectangle( Point( rRect.Right()-nLineWidth, rRect.Top() ),
+ Size( nLineWidth, nHeight ) ) );
+ }
+ }
+
+ rRect.Left() += nLineWidth;
+ rRect.Top() += nLineHeight;
+ rRect.Right() -= nLineWidth;
+ rRect.Bottom() -= nLineHeight;
+}
+
+
+void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
+ const sal_uInt16 nStyle )
+{
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+
+ if ( (nStyle & BUTTON_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ const Color aBlackColor( COL_BLACK );
+
+ if ( nStyle & BUTTON_DRAW_DEFAULT )
+ {
+ // default selection shows a wider border
+ ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
+ }
+
+ ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
+
+ Size aBrdSize( 1, 1 );
+ if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ {
+ aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), MapMode(MAP_100TH_MM) );
+ if ( !aBrdSize.Width() )
+ aBrdSize.Width() = 1;
+ if ( !aBrdSize.Height() )
+ aBrdSize.Height() = 1;
+ }
+
+ pDev->SetLineColor();
+ pDev->SetFillColor( aBlackColor );
+ const Rectangle aOrigFillRect(aFillRect);
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ // shrink fill rect
+ aFillRect.Left() += aBrdSize.Width();
+ aFillRect.Top() += aBrdSize.Height();
+ // draw top and left borders (aOrigFillRect-aFillRect)
+ pDev->DrawRect( Rectangle( aOrigFillRect.Left(), aOrigFillRect.Top(),
+ aOrigFillRect.Right(), aFillRect.Top()-1 ) );
+ pDev->DrawRect( Rectangle( aOrigFillRect.Left(), aOrigFillRect.Top(),
+ aFillRect.Left()-1, aOrigFillRect.Bottom() ) );
+ }
+ else
+ {
+ // shrink fill rect
+ aFillRect.Right() -= aBrdSize.Width();
+ aFillRect.Bottom() -= aBrdSize.Height();
+ // draw bottom and right borders (aOrigFillRect-aFillRect)
+ pDev->DrawRect( Rectangle( aOrigFillRect.Left(), aFillRect.Bottom()+1,
+ aOrigFillRect.Right(), aOrigFillRect.Bottom() ) );
+ pDev->DrawRect( Rectangle( aFillRect.Right()+1, aOrigFillRect.Top(),
+ aOrigFillRect.Right(), aOrigFillRect.Bottom() ) );
+ }
+
+ if ( !(nStyle & BUTTON_DRAW_NOFILL) )
+ {
+ // Hack: Auf Druckern wollen wir im MonoChrom-Modus trotzdem
+ // erstmal graue Buttons haben
+ if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
+ else
+ pDev->SetFillColor( Color( COL_WHITE ) );
+ pDev->DrawRect( aFillRect );
+ }
+ }
+ else
+ {
+ if ( nStyle & BUTTON_DRAW_DEFAULT )
+ {
+ const Color aDefBtnColor = rStyleSettings.GetDarkShadowColor();
+ ImplDrawDPILineRect( pDev, aFillRect, &aDefBtnColor );
+ }
+
+ if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightBorderColor() );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Top() ),
+ Point( aFillRect.Left(), aFillRect.Bottom() ) );
+ ++aFillRect.Left();
+ }
+
+ Color aColor1;
+ Color aColor2;
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aColor1 = rStyleSettings.GetDarkShadowColor();
+ aColor2 = rStyleSettings.GetLightColor();
+ }
+ else
+ {
+ if ( nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightBorderColor() );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Top()),
+ Point( aFillRect.Right(), aFillRect.Top() ) );
+ ++aFillRect.Top();
+ }
+ if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
+ !(nStyle & BUTTON_DRAW_HIGHLIGHT) )
+ {
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Bottom() ),
+ Point( aFillRect.Right(), aFillRect.Bottom() ) );
+ --aFillRect.Bottom();
+ }
+
+ if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
+ aColor1 = rStyleSettings.GetLightBorderColor();
+ else
+ aColor1 = rStyleSettings.GetLightColor();
+ if ( (nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT )
+ aColor2 = rStyleSettings.GetShadowColor();
+ else
+ aColor2 = rStyleSettings.GetDarkShadowColor();
+ }
+
+ pDev->SetLineColor();
+
+ pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ ++aFillRect.Left();
+ ++aFillRect.Top();
+ --aFillRect.Right();
+ --aFillRect.Bottom();
+
+ if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
+ {
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aColor1 = rStyleSettings.GetShadowColor();
+ aColor2 = rStyleSettings.GetLightBorderColor();
+ }
+ else
+ {
+ if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
+ aColor1 = rStyleSettings.GetLightColor();
+ else
+ aColor1 = rStyleSettings.GetLightBorderColor();
+ aColor2 = rStyleSettings.GetShadowColor();
+ }
+ pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ ++aFillRect.Left();
+ ++aFillRect.Top();
+ --aFillRect.Right();
+ --aFillRect.Bottom();
+ }
+
+ if ( !(nStyle & BUTTON_DRAW_NOFILL) )
+ {
+ if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
+ pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetFaceColor() );
+ pDev->DrawRect( aFillRect );
+ }
+ }
+}
+
}
@@ -548,55 +756,6 @@ void DecorationView::DrawHighlightFrame( const Rectangle& rRect,
// =======================================================================
-static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect,
- const Color* pColor, sal_Bool bRound = sal_False )
-{
- long nLineWidth = pDev->ImplGetDPIX()/300;
- long nLineHeight = pDev->ImplGetDPIY()/300;
- if ( !nLineWidth )
- nLineWidth = 1;
- if ( !nLineHeight )
- nLineHeight = 1;
-
- if ( pColor )
- {
- if ( (nLineWidth == 1) && (nLineHeight == 1) )
- {
- pDev->SetLineColor( *pColor );
- pDev->SetFillColor();
- if( bRound )
- {
- pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()), Point( rRect.Right()-1, rRect.Top()) );
- pDev->DrawLine( Point( rRect.Left()+1, rRect.Bottom()), Point( rRect.Right()-1, rRect.Bottom()) );
- pDev->DrawLine( Point( rRect.Left(), rRect.Top()+1), Point( rRect.Left(), rRect.Bottom()-1) );
- pDev->DrawLine( Point( rRect.Right(), rRect.Top()+1), Point( rRect.Right(), rRect.Bottom()-1) );
- }
- else
- pDev->DrawRect( rRect );
- }
- else
- {
- long nWidth = rRect.GetWidth();
- long nHeight = rRect.GetHeight();
- pDev->SetLineColor();
- pDev->SetFillColor( *pColor );
- pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nWidth, nLineHeight ) ) );
- pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nLineWidth, nHeight ) ) );
- pDev->DrawRect( Rectangle( Point( rRect.Left(), rRect.Bottom()-nLineHeight ),
- Size( nWidth, nLineHeight ) ) );
- pDev->DrawRect( Rectangle( Point( rRect.Right()-nLineWidth, rRect.Top() ),
- Size( nLineWidth, nHeight ) ) );
- }
- }
-
- rRect.Left() += nLineWidth;
- rRect.Top() += nLineHeight;
- rRect.Right() -= nLineWidth;
- rRect.Bottom() -= nLineHeight;
-}
-
-// =======================================================================
-
static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
const StyleSettings& rStyleSettings, sal_uInt16 nStyle )
{
@@ -865,247 +1024,78 @@ Rectangle DecorationView::DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle )
// =======================================================================
-static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect,
- const StyleSettings& rStyleSettings, sal_uInt16 nStyle )
+Rectangle DecorationView::DrawButton( const Rectangle& rRect, sal_uInt16 nStyle )
{
- Rectangle aFillRect = rRect;
-
- if ( nStyle & BUTTON_DRAW_MONO )
+ if ( rRect.IsEmpty() )
{
- if ( !(nStyle & BUTTON_DRAW_NODRAW) )
- {
- Color aBlackColor( COL_BLACK );
-
- if ( nStyle & BUTTON_DRAW_DEFAULT )
- ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
-
- ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
-
- Size aBrdSize( 1, 1 );
- if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
- {
- MapMode aResMapMode( MAP_100TH_MM );
- aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
- if ( !aBrdSize.Width() )
- aBrdSize.Width() = 1;
- if ( !aBrdSize.Height() )
- aBrdSize.Height() = 1;
- }
- pDev->SetLineColor();
- pDev->SetFillColor( aBlackColor );
- Rectangle aRect1;
- Rectangle aRect2;
- aRect1.Left() = aFillRect.Left();
- aRect1.Right() = aFillRect.Right(),
- aRect2.Top() = aFillRect.Top();
- aRect2.Bottom() = aFillRect.Bottom();
- if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
- {
- aRect1.Top() = aFillRect.Top();
- aRect1.Bottom() = aBrdSize.Height()-1;
- aRect2.Left() = aFillRect.Left();
- aRect2.Right() = aFillRect.Left()+aBrdSize.Width()-1;
- aFillRect.Left() += aBrdSize.Width();
- aFillRect.Top() += aBrdSize.Height();
- }
- else
- {
- aRect1.Top() = aFillRect.Bottom()-aBrdSize.Height()+1;
- aRect1.Bottom() = aFillRect.Bottom();
- aRect2.Left() = aFillRect.Right()-aBrdSize.Width()+1;
- aRect2.Right() = aFillRect.Right(),
- aFillRect.Right() -= aBrdSize.Width();
- aFillRect.Bottom() -= aBrdSize.Height();
- }
- pDev->DrawRect( aRect1 );
- pDev->DrawRect( aRect2 );
- }
+ return rRect;
}
- else
- {
- if ( !(nStyle & BUTTON_DRAW_NODRAW) )
- {
- if ( nStyle & BUTTON_DRAW_DEFAULT )
- {
- Color aDefBtnColor = rStyleSettings.GetDarkShadowColor();
- ImplDrawDPILineRect( pDev, aFillRect, &aDefBtnColor );
- }
- }
-
- if ( !(nStyle & BUTTON_DRAW_NODRAW) )
- {
- pDev->SetLineColor();
- if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
- {
- pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
- pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
- aFillRect.Left(), aFillRect.Bottom() ) );
- aFillRect.Left()++;
- }
- if ( (nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER) &&
- !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) )
- {
- pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
- pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
- aFillRect.Right(), aFillRect.Top() ) );
- aFillRect.Top()++;
- }
- if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
- !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED | BUTTON_DRAW_HIGHLIGHT)) )
- {
- pDev->SetFillColor( rStyleSettings.GetDarkShadowColor() );
- pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Bottom(),
- aFillRect.Right(), aFillRect.Bottom() ) );
- aFillRect.Bottom()--;
- }
- Color aColor1;
- Color aColor2;
- if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
- {
- aColor1 = rStyleSettings.GetDarkShadowColor();
- aColor2 = rStyleSettings.GetLightColor();
- }
- else
- {
- if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
- aColor1 = rStyleSettings.GetLightBorderColor();
- else
- aColor1 = rStyleSettings.GetLightColor();
- if ( (nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT )
- aColor2 = rStyleSettings.GetShadowColor();
- else
- aColor2 = rStyleSettings.GetDarkShadowColor();
- }
- pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
- aFillRect.Left()++;
- aFillRect.Top()++;
- aFillRect.Right()--;
- aFillRect.Bottom()--;
+ Rectangle aRect = rRect;
+ const bool bOldMap = mpOutDev->IsMapModeEnabled();
- if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
- {
- if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
- {
- aColor1 = rStyleSettings.GetShadowColor();
- aColor2 = rStyleSettings.GetLightBorderColor();
- }
- else
- {
- if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
- aColor1 = rStyleSettings.GetLightColor();
- else
- aColor1 = rStyleSettings.GetLightBorderColor();
- aColor2 = rStyleSettings.GetShadowColor();
- }
- pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
- aFillRect.Left()++;
- aFillRect.Top()++;
- aFillRect.Right()--;
- aFillRect.Bottom()--;
- }
- }
+ if ( bOldMap )
+ {
+ aRect = mpOutDev->LogicToPixel( aRect );
+ mpOutDev->EnableMapMode( false );
}
- if ( !(nStyle & (BUTTON_DRAW_NOFILL | BUTTON_DRAW_NODRAW)) )
+ if ( !(nStyle & BUTTON_DRAW_NODRAW) )
{
- pDev->SetLineColor();
- if ( nStyle & BUTTON_DRAW_MONO )
- {
- // Hack: Auf Druckern wollen wir im MonoChrom-Modus trotzdem
- // erstmal graue Buttons haben
- if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
- pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
- else
- pDev->SetFillColor( Color( COL_WHITE ) );
- }
- else
- {
- if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
- pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
- else
- pDev->SetFillColor( rStyleSettings.GetFaceColor() );
- }
- pDev->DrawRect( aFillRect );
+ const Color maOldLineColor = mpOutDev->GetLineColor();
+ const Color maOldFillColor = mpOutDev->GetFillColor();
+ ImplDrawButton( mpOutDev, aRect, nStyle );
+ mpOutDev->SetLineColor( maOldLineColor );
+ mpOutDev->SetFillColor( maOldFillColor );
}
// Ein Border freilassen, der jedoch bei Default-Darstellung
// mitbenutzt wird
- rRect.Left()++;
- rRect.Top()++;
- rRect.Right()--;
- rRect.Bottom()--;
+ ++aRect.Left();
+ ++aRect.Top();
+ --aRect.Right();
+ --aRect.Bottom();
if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
{
- rRect.Left()++;
- rRect.Top()++;
+ ++aRect.Left();
+ ++aRect.Top();
}
else if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
- rRect.Left()++;
+ {
+ ++aRect.Left();
+ }
if ( nStyle & BUTTON_DRAW_PRESSED )
{
- if ( (rRect.GetHeight() > 10) && (rRect.GetWidth() > 10) )
+ if ( (aRect.GetHeight() > 10) && (aRect.GetWidth() > 10) )
{
- rRect.Left() += 4;
- rRect.Top() += 4;
- rRect.Right() -= 1;
- rRect.Bottom() -= 1;
+ aRect.Left() += 4;
+ aRect.Top() += 4;
+ aRect.Right() -= 1;
+ aRect.Bottom() -= 1;
}
else
{
- rRect.Left() += 3;
- rRect.Top() += 3;
- rRect.Right() -= 2;
- rRect.Bottom() -= 2;
+ aRect.Left() += 3;
+ aRect.Top() += 3;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
}
}
else if ( nStyle & BUTTON_DRAW_CHECKED )
{
- rRect.Left() += 3;
- rRect.Top() += 3;
- rRect.Right() -= 2;
- rRect.Bottom() -= 2;
+ aRect.Left() += 3;
+ aRect.Top() += 3;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
}
else
{
- rRect.Left() += 2;
- rRect.Top() += 2;
- rRect.Right() -= 3;
- rRect.Bottom() -= 3;
- }
-}
-
-// -----------------------------------------------------------------------
-
-Rectangle DecorationView::DrawButton( const Rectangle& rRect, sal_uInt16 nStyle )
-{
- Rectangle aRect = rRect;
- sal_Bool bOldMap = mpOutDev->IsMapModeEnabled();
- if ( bOldMap )
- {
- aRect = mpOutDev->LogicToPixel( aRect );
- mpOutDev->EnableMapMode( sal_False );
- }
-
- if ( !rRect.IsEmpty() )
- {
- const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
-
- if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
- nStyle |= BUTTON_DRAW_MONO;
-
- if ( nStyle & BUTTON_DRAW_NODRAW )
- ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
- else
- {
- Color maOldLineColor = mpOutDev->GetLineColor();
- Color maOldFillColor = mpOutDev->GetFillColor();
- ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
- mpOutDev->SetLineColor( maOldLineColor );
- mpOutDev->SetFillColor( maOldFillColor );
- }
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 3;
+ aRect.Bottom() -= 3;
}
if ( bOldMap )
commit 41cfce47ed649905254fe0d0b03bd0b3d08de195
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sun Nov 27 09:58:48 2011 +0100
Removed unused header
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index e8ed434..9abd97e 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -27,7 +27,6 @@
************************************************************************/
#include <vcl/settings.hxx>
-#include <tools/poly.hxx>
#include <vcl/outdev.hxx>
#include <vcl/decoview.hxx>
#include <vcl/window.hxx>
More information about the Libreoffice-commits
mailing list