From 84d9785a04a1d4929505ef1d7958e0420eec43b6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Nov 2018 14:54:34 +0200 Subject: remove unused DrawFlags enum values Change-Id: I3f313dfa085612d805ea54352793a3fb0356b986 Reviewed-on: https://gerrit.libreoffice.org/63970 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/control/button.cxx | 46 ++++++++++++----------------------------- vcl/source/control/combobox.cxx | 6 +++--- vcl/source/control/edit.cxx | 6 +++--- vcl/source/control/fixed.cxx | 40 ++++++++++++----------------------- vcl/source/control/imgctrl.cxx | 22 ++++++++------------ vcl/source/control/listbox.cxx | 6 +++--- vcl/source/control/spinfld.cxx | 2 +- vcl/source/edit/vclmedit.cxx | 6 +++--- vcl/source/toolkit/group.cxx | 15 ++------------ vcl/source/treelist/headbar.cxx | 2 +- 10 files changed, 51 insertions(+), 100 deletions(-) (limited to 'vcl') diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 4ac8c03cc32b..b5e889d92e0d 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -202,25 +202,13 @@ void Button::ImplSetSeparatorX( long nX ) mpButtonData->mnSeparatorX = nX; } -DrawTextFlags Button::ImplGetTextStyle(OUString& rText, WinBits nWinStyle, DrawFlags nDrawFlags ) +DrawTextFlags Button::ImplGetTextStyle( WinBits nWinStyle, DrawFlags nDrawFlags ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle(nWinStyle & ~WB_DEFBUTTON); - if (nDrawFlags & DrawFlags::NoMnemonic) - { - if (nTextStyle & DrawTextFlags::Mnemonic) - { - rText = GetNonMnemonicString( rText ); - nTextStyle &= ~DrawTextFlags::Mnemonic; - } - } - - if (!(nDrawFlags & DrawFlags::NoDisable)) - { - if (!IsEnabled()) - nTextStyle |= DrawTextFlags::Disable; - } + if (!IsEnabled()) + nTextStyle |= DrawTextFlags::Disable; if ((nDrawFlags & DrawFlags::Mono) || (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono)) @@ -233,7 +221,7 @@ DrawTextFlags Button::ImplGetTextStyle(OUString& rText, WinBits nWinStyle, DrawF void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, Size& rSize, - sal_uLong nImageSep, DrawFlags nDrawFlags, + sal_uLong nImageSep, DrawTextFlags nTextStyle, tools::Rectangle *pSymbolRect, bool bAddImageSep) { @@ -251,13 +239,6 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, ImageAlign eImageAlign = mpButtonData->meImageAlign; Size aImageSize = mpButtonData->maImage.GetSizePixel(); - if ((nDrawFlags & DrawFlags::NoMnemonic) && - (nTextStyle & DrawTextFlags::Mnemonic)) - { - aText = GetNonMnemonicString(aText); - nTextStyle &= ~DrawTextFlags::Mnemonic; - } - aImageSize.setWidth( CalcZoom( aImageSize.Width() ) ); aImageSize.setHeight( CalcZoom( aImageSize.Height() ) ); @@ -482,8 +463,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, DrawImageFlags nStyle = DrawImageFlags::NONE; - if (!(nDrawFlags & DrawFlags::NoDisable) && - !IsEnabled()) + if (!IsEnabled()) { nStyle |= DrawImageFlags::Disable; } @@ -786,7 +766,7 @@ DrawTextFlags PushButton::ImplGetTextStyle( DrawFlags nDrawFlags ) const else nTextStyle |= DrawTextFlags::VCenter; - if ( ! ( (nDrawFlags & DrawFlags::NoDisable) || IsEnabled() ) ) + if ( !IsEnabled() ) nTextStyle |= DrawTextFlags::Disable; return nTextStyle; @@ -857,7 +837,7 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl pDev->SetTextColor( aColor ); - if ( IsEnabled() || (nDrawFlags & DrawFlags::NoDisable) ) + if ( IsEnabled() ) nStyle = DrawSymbolFlags::NONE; else nStyle = DrawSymbolFlags::Disable; @@ -886,7 +866,7 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize ); ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep, - nDrawFlags, nTextStyle, nullptr, true ); + nTextStyle, nullptr, true ); } else ImplCalcSymbolRect( aSymbolRect ); @@ -907,7 +887,7 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl else { tools::Rectangle aSymbolRect; - ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep, nDrawFlags, + ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep, nTextStyle, IsSymbol() ? &aSymbolRect : nullptr, true ); if ( IsSymbol() ) @@ -2042,7 +2022,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) || ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) ) { - DrawTextFlags nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -2060,7 +2040,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, aSize.setHeight( rImageSize.Height() ); } - ImplDrawAlignedImage( pDev, aPos, aSize, 1, nDrawFlags, nTextStyle ); + ImplDrawAlignedImage( pDev, aPos, aSize, 1, nTextStyle ); rMouseRect = tools::Rectangle( aPos, aSize ); rMouseRect.SetLeft( rPos.X() ); @@ -3050,7 +3030,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) || ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) ) { - DrawTextFlags nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -3068,7 +3048,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, aSize.setHeight( rImageSize.Height() ); } - ImplDrawAlignedImage( pDev, aPos, aSize, 1, nDrawFlags, nTextStyle ); + ImplDrawAlignedImage( pDev, aPos, aSize, 1, nTextStyle ); rMouseRect = tools::Rectangle( aPos, aSize ); rMouseRect.SetLeft( rPos.X() ); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 91901b883882..8dee63269d0e 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1178,8 +1178,8 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, D // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - bool bBorder = !(nFlags & DrawFlags::NoBorder ) && (GetStyle() & WB_BORDER); - bool bBackground = !(nFlags & DrawFlags::NoBackground) && IsControlBackground(); + bool bBorder = (GetStyle() & WB_BORDER); + bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { tools::Rectangle aRect( aPos, aSize ); @@ -1220,7 +1220,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, D } else { - if ( !(nFlags & DrawFlags::NoDisable ) && !IsEnabled() ) + if ( !IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); pDev->SetTextColor( rStyleSettings.GetDisableColor() ); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 56563c48c96c..795f1e828f4e 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1755,8 +1755,8 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawF // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - bool bBorder = !(nFlags & DrawFlags::NoBorder ) && (GetStyle() & WB_BORDER); - bool bBackground = !(nFlags & DrawFlags::NoBackground) && IsControlBackground(); + bool bBorder = (GetStyle() & WB_BORDER); + bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { tools::Rectangle aRect( aPos, aSize ); @@ -1776,7 +1776,7 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawF pDev->SetTextColor( COL_BLACK ); else { - if ( !(nFlags & DrawFlags::NoDisable ) && !IsEnabled() ) + if ( !IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); pDev->SetTextColor( rStyleSettings.GetDisableColor() ); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 435c0b6a6a67..a43ea3165c95 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -153,19 +153,8 @@ void FixedText::ImplDraw(OutputDevice* pDev, DrawFlags nDrawFlags, nTextStyle &= ~DrawTextFlags(DrawTextFlags::EndEllipsis | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak); nTextStyle |= DrawTextFlags::PathEllipsis; } - if ( nDrawFlags & DrawFlags::NoMnemonic ) - { - if ( nTextStyle & DrawTextFlags::Mnemonic ) - { - aText = GetNonMnemonicString( aText ); - nTextStyle &= ~DrawTextFlags::Mnemonic; - } - } - if ( !(nDrawFlags & DrawFlags::NoDisable) ) - { - if ( !IsEnabled() ) - nTextStyle |= DrawTextFlags::Disable; - } + if ( !IsEnabled() ) + nTextStyle |= DrawTextFlags::Disable; if ( (nDrawFlags & DrawFlags::Mono) || (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono) ) nTextStyle |= DrawTextFlags::Mono; @@ -232,8 +221,8 @@ void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - bool bBorder = !(nFlags & DrawFlags::NoBorder ) && (GetStyle() & WB_BORDER); - bool bBackground = !(nFlags & DrawFlags::NoBackground) && IsControlBackground(); + bool bBorder = (GetStyle() & WB_BORDER); + bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { tools::Rectangle aRect( aPos, aSize ); @@ -735,7 +724,7 @@ void FixedBitmap::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang } void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - DrawFlags nFlags ) + DrawFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -745,7 +734,7 @@ void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize pDev->SetMapMode(); // Border - if ( !(nFlags & DrawFlags::NoBorder) && (GetStyle() & WB_BORDER) ) + if ( GetStyle() & WB_BORDER ) { DecorationView aDecoView( pDev ); aRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleIn ); @@ -825,15 +814,12 @@ FixedImage::FixedImage( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -void FixedImage::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, +void FixedImage::ImplDraw( OutputDevice* pDev, const Point& rPos, const Size& rSize ) { DrawImageFlags nStyle = DrawImageFlags::NONE; - if ( !(nDrawFlags & DrawFlags::NoDisable) ) - { - if ( !IsEnabled() ) - nStyle |= DrawImageFlags::Disable; - } + if ( !IsEnabled() ) + nStyle |= DrawImageFlags::Disable; Image *pImage = &maImage; @@ -876,7 +862,7 @@ void FixedImage::ApplySettings(vcl::RenderContext& rRenderContext) void FixedImage::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - ImplDraw(&rRenderContext, DrawFlags::NONE, Point(), GetOutputSizePixel()); + ImplDraw(&rRenderContext, Point(), GetOutputSizePixel()); } Size FixedImage::GetOptimalSize() const @@ -885,7 +871,7 @@ Size FixedImage::GetOptimalSize() const } void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - DrawFlags nFlags ) + DrawFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -895,12 +881,12 @@ void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetMapMode(); // Border - if ( !(nFlags & DrawFlags::NoBorder) && (GetStyle() & WB_BORDER) ) + if ( GetStyle() & WB_BORDER ) { ImplDrawFrame( pDev, aRect ); } pDev->IntersectClipRegion( aRect ); - ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() ); + ImplDraw( pDev, aRect.TopLeft(), aRect.GetSize() ); pDev->Pop(); } diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index b25f35febcd2..29d7f171ad39 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -67,14 +67,11 @@ namespace } } -void ImageControl::ImplDraw(OutputDevice& rDev, DrawFlags nDrawFlags, const Point& rPos, const Size& rSize) const +void ImageControl::ImplDraw(OutputDevice& rDev, const Point& rPos, const Size& rSize) const { DrawImageFlags nStyle = DrawImageFlags::NONE; - if ( !(nDrawFlags & DrawFlags::NoDisable) ) - { - if ( !IsEnabled() ) - nStyle |= DrawImageFlags::Disable; - } + if ( !IsEnabled() ) + nStyle |= DrawImageFlags::Disable; const Image& rImage( GetModeImage() ); const tools::Rectangle aDrawRect( rPos, rSize ); @@ -86,9 +83,8 @@ void ImageControl::ImplDraw(OutputDevice& rDev, DrawFlags nDrawFlags, const Poin WinBits nWinStyle = GetStyle(); DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); - if ( !(nDrawFlags & DrawFlags::NoDisable) ) - if ( !IsEnabled() ) - nTextStyle |= DrawTextFlags::Disable; + if ( !IsEnabled() ) + nTextStyle |= DrawTextFlags::Disable; rDev.DrawText( aDrawRect, sText, nTextStyle ); return; @@ -129,7 +125,7 @@ void ImageControl::ImplDraw(OutputDevice& rDev, DrawFlags nDrawFlags, const Poin void ImageControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { - ImplDraw(rRenderContext, DrawFlags::NONE, Point(), GetOutputSizePixel()); + ImplDraw(rRenderContext, Point(), GetOutputSizePixel()); if (!HasFocus()) return; @@ -154,7 +150,7 @@ void ImageControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan } -void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) +void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags ) { const Point aPos = pDev->LogicToPixel( rPos ); const Size aSize = pDev->LogicToPixel( rSize ); @@ -164,12 +160,12 @@ void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSiz pDev->SetMapMode(); // Border - if ( !(nFlags & DrawFlags::NoBorder) && (GetStyle() & WB_BORDER) ) + if ( GetStyle() & WB_BORDER ) { ImplDrawFrame( pDev, aRect ); } pDev->IntersectClipRegion( aRect ); - ImplDraw( *pDev, nFlags, aRect.TopLeft(), aRect.GetSize() ); + ImplDraw( *pDev, aRect.TopLeft(), aRect.GetSize() ); pDev->Pop(); } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index d1ee6e2a876a..e109e135d0d4 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -342,8 +342,8 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dr // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - bool bBorder = !(nFlags & DrawFlags::NoBorder ) && (GetStyle() & WB_BORDER); - bool bBackground = !(nFlags & DrawFlags::NoBackground) && IsControlBackground(); + bool bBorder = (GetStyle() & WB_BORDER); + bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { tools::Rectangle aRect( aPos, aSize ); @@ -365,7 +365,7 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dr } else { - if ( !(nFlags & DrawFlags::NoDisable ) && !IsEnabled() ) + if ( !IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); pDev->SetTextColor( rStyleSettings.GetDisableColor() ); diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index acc132e537f2..dd7d6561c554 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -1001,7 +1001,7 @@ void SpinField::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, D { DecorationView aView( pDev ); tools::Rectangle aInnerRect = aView.DrawButton( aDD, DrawButtonFlags::NoLightBorder ); - DrawSymbolFlags nSymbolStyle = (IsEnabled() || (nFlags & DrawFlags::NoDisable)) ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable; + DrawSymbolFlags nSymbolStyle = IsEnabled() ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable; aView.DrawSymbol(aInnerRect, SymbolType::SPIN_DOWN, aButtonTextColor, nSymbolStyle); } diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 10c6f20c0bb9..263d8231c715 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -1338,8 +1338,8 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& // Border/Background pDev->SetLineColor(); pDev->SetFillColor(); - bool bBorder = !(nFlags & DrawFlags::NoBorder ) && (GetStyle() & WB_BORDER); - bool bBackground = !(nFlags & DrawFlags::NoBackground) && IsControlBackground(); + bool bBorder = (GetStyle() & WB_BORDER); + bool bBackground = IsControlBackground(); if ( bBorder || bBackground ) { tools::Rectangle aRect( aPos, aSize ); @@ -1360,7 +1360,7 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& pDev->SetTextColor( COL_BLACK ); else { - if ( !(nFlags & DrawFlags::NoDisable ) && !IsEnabled() ) + if ( !IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); pDev->SetTextColor( rStyleSettings.GetDisableColor() ); diff --git a/vcl/source/toolkit/group.cxx b/vcl/source/toolkit/group.cxx index 8ef95d4ff587..0743518f8ba1 100644 --- a/vcl/source/toolkit/group.cxx +++ b/vcl/source/toolkit/group.cxx @@ -101,19 +101,8 @@ void GroupBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, if ( GetStyle() & WB_NOLABEL ) nTextStyle &= ~DrawTextFlags::Mnemonic; - if ( nDrawFlags & DrawFlags::NoMnemonic ) - { - if ( nTextStyle & DrawTextFlags::Mnemonic ) - { - aText = GetNonMnemonicString( aText ); - nTextStyle &= ~DrawTextFlags::Mnemonic; - } - } - if ( !(nDrawFlags & DrawFlags::NoDisable) ) - { - if ( !IsEnabled() ) - nTextStyle |= DrawTextFlags::Disable; - } + if ( !IsEnabled() ) + nTextStyle |= DrawTextFlags::Disable; if ( (nDrawFlags & DrawFlags::Mono) || (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono) ) { diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx index 07f32358af54..0523ffa21699 100644 --- a/vcl/source/treelist/headbar.cxx +++ b/vcl/source/treelist/headbar.cxx @@ -935,7 +935,7 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - if ( !(nFlags & DrawFlags::NoBackground) ) + // draw background { pDev->DrawWallpaper( aRect, GetBackground() ); if ( mnBorderOff1 || mnBorderOff2 ) -- cgit v1.2.3