sc/source/ui/sidebar/CellLineStyleValueSet.cxx | 8 ++------ svx/source/sidebar/line/LineWidthValueSet.cxx | 8 ++------ svx/source/stbctrls/xmlsecctrl.cxx | 6 ++---- svx/source/stbctrls/zoomsliderctrl.cxx | 6 ++---- sw/source/ui/frmdlg/column.cxx | 6 ++---- 5 files changed, 10 insertions(+), 24 deletions(-)
New commits: commit 5aeb53c4b09e8c5fa8f67268e97cce00cab0f186 Author: RMZeroFour <[email protected]> AuthorDate: Sun Mar 31 14:08:17 2024 +0530 Commit: Hossein <[email protected]> CommitDate: Wed Jul 17 15:01:12 2024 +0200 tdf#137525 Update ColumnValueSet (and others) to use push/pop This patch updates the ColumnValueSet and some other parts of the drawing code to use the Push/Pop functions of RenderContext. Change-Id: I3fbdee9afa167facb45242bc8bad9a35758b3c0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165587 Reviewed-by: Hossein <[email protected]> Tested-by: Jenkins diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx index d7c9e9b3ced5..b31ac611e729 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -93,9 +93,7 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) tools::Long nRectWidth = aRect.GetWidth(); Point aBLPos = aRect.TopLeft(); - vcl::Font aOldFont = pDev->GetFont(); - Color aOldColor = pDev->GetLineColor(); - Color aOldFillColor = pDev->GetFillColor(); + pDev->Push(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getConfiguredSystemLanguage(), GetDefaultFontFlags::OnlyOne)); Size aSize = aFont.GetFontSize(); @@ -176,9 +174,7 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) } Invalidate( aRect ); - pDev->SetLineColor(aOldColor); - pDev->SetFillColor(aOldFillColor); - pDev->SetFont(aOldFont); + pDev->Pop(); } diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx index be518fe4fa74..21e80c00034f 100644 --- a/svx/source/sidebar/line/LineWidthValueSet.cxx +++ b/svx/source/sidebar/line/LineWidthValueSet.cxx @@ -86,9 +86,7 @@ void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); //Color aBackColor(0,0,200); //const Color aTextColor = rStyleSettings.GetFieldTextColor(); - vcl::Font aOldFont = pDev->GetFont(); - Color aOldColor = pDev->GetLineColor(); - Color aOldFillColor = pDev->GetFillColor(); + pDev->Push(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getConfiguredSystemLanguage(), GetDefaultFontFlags::OnlyOne)); Size aSize = aFont.GetFontSize(); @@ -154,9 +152,7 @@ void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) } Invalidate( aRect ); - pDev->SetLineColor(aOldColor); - pDev->SetFillColor(aOldFillColor); - pDev->SetFont(aOldFont); + pDev->Pop(); } void LineWidthValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index ee08326c1bf1..ce852da13e62 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -128,8 +128,7 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) vcl::RenderContext* pDev = rUsrEvt.GetRenderContext(); tools::Rectangle aRect = rUsrEvt.GetRect(); - Color aOldLineColor = pDev->GetLineColor(); - Color aOldFillColor = pDev->GetFillColor(); + pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); pDev->SetLineColor(); pDev->SetFillColor( pDev->GetBackground().GetColor() ); @@ -155,8 +154,7 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) else pDev->DrawRect( aRect ); - pDev->SetLineColor( aOldLineColor ); - pDev->SetFillColor( aOldFillColor ); + pDev->Pop(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index 389c4d314310..0a0346f38129 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -234,8 +234,7 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) aSlider.AdjustLeft(nSliderXOffset ); aSlider.AdjustRight( -nSliderXOffset ); - Color aOldLineColor = pDev->GetLineColor(); - Color aOldFillColor = pDev->GetFillColor(); + pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() ); @@ -274,8 +273,7 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) aImagePoint.setX( aRect.Left() + aControlRect.GetWidth() - mxImpl->maIncreaseButton.GetSizePixel().Width() - (nSliderXOffset - mxImpl->maIncreaseButton.GetSizePixel().Height())/2 ); pDev->DrawImage( aImagePoint, mxImpl->maIncreaseButton ); - pDev->SetLineColor( aOldLineColor ); - pDev->SetFillColor( aOldFillColor ); + pDev->Pop(); } bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 103c5f2c9e35..8edd1959a1de 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -1317,8 +1317,7 @@ void ColumnValueSet::UserDraw(const UserDrawEvent& rUDEvt) tools::Long nRectHeight = aRect.GetHeight(); Point aBLPos = aRect.TopLeft(); - Color aFillColor(pDev->GetFillColor()); - Color aLineColor(pDev->GetLineColor()); + pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); pDev->SetFillColor(rStyleSettings.GetFieldColor()); pDev->SetLineColor(rStyleSettings.GetFieldTextColor()); @@ -1368,8 +1367,7 @@ void ColumnValueSet::UserDraw(const UserDrawEvent& rUDEvt) pDev->DrawLine(aStart, aEnd); } } - pDev->SetFillColor(aFillColor); - pDev->SetLineColor(aLineColor); + pDev->Pop(); } void ColumnValueSet::StyleUpdated()
