sc/source/ui/cctrl/dpcontrol.cxx | 3 +-- sc/source/ui/dbgui/csvcontrol.cxx | 3 +-- sc/source/ui/inc/SparklineRenderer.hxx | 4 +--- sc/source/ui/miscdlgs/autofmt.cxx | 6 ++---- sc/source/ui/sidebar/CellLineStyleValueSet.cxx | 4 +--- sc/source/ui/view/output.cxx | 3 +-- sc/source/ui/view/tabsplit.cxx | 4 +--- 7 files changed, 8 insertions(+), 19 deletions(-)
New commits: commit 915accf7030a1407bdfbea7782640b7abdbdb319 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Aug 16 23:30:30 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Aug 17 08:19:12 2025 +0200 Use OutputDevice::ScopedPush in sc Change-Id: Icae940091885adad69edfc00cc2914852a7b201f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189799 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index f6979b1d5b1e..068ee78c44cd 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -143,10 +143,9 @@ void ScDPFieldButton::draw() aTextPos.setX(maPos.getX() + 2); // 2 = Margin aTextPos.setY(maPos.getY() + (maSize.Height()-nTHeight)/2); - mpOutDev->Push(vcl::PushFlags::CLIPREGION); + auto popIt = mpOutDev->ScopedPush(vcl::PushFlags::CLIPREGION); mpOutDev->IntersectClipRegion(aRect); mpOutDev->DrawText(aTextPos, maText); - mpOutDev->Pop(); } if (mbPopupButton || mbPopupButtonMulti) diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index 409e898b46a3..7df3d1be2704 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -241,12 +241,11 @@ sal_Int32 ScCsvControl::GetLineFromY( sal_Int32 nY ) const void ScCsvControl::ImplInvertRect( OutputDevice& rOutDev, const tools::Rectangle& rRect ) { - rOutDev.Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR | vcl::PushFlags::RASTEROP ); + auto popIt = rOutDev.ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR | vcl::PushFlags::RASTEROP); rOutDev.SetLineColor( COL_BLACK ); rOutDev.SetFillColor( COL_BLACK ); rOutDev.SetRasterOp( RasterOp::Invert ); rOutDev.DrawRect( rRect ); - rOutDev.Pop(); } ScMoveMode ScCsvControl::GetHorzDirection( sal_uInt16 nCode, bool bHomeEnd ) diff --git a/sc/source/ui/inc/SparklineRenderer.hxx b/sc/source/ui/inc/SparklineRenderer.hxx index 1a8adc39a828..8fb5f64d214b 100644 --- a/sc/source/ui/inc/SparklineRenderer.hxx +++ b/sc/source/ui/inc/SparklineRenderer.hxx @@ -15,7 +15,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <comphelper/scopeguard.hxx> #include <Sparkline.hxx> #include <SparklineGroup.hxx> @@ -494,8 +493,7 @@ public: vcl::RenderContext& rRenderContext, tools::Rectangle const& rRectangle, tools::Long nOneX, tools::Long nOneY, double fScaleX, double fScaleY) { - rRenderContext.Push(); - comphelper::ScopeGuard aPushPopGuard([&rRenderContext]() { rRenderContext.Pop(); }); + auto popIt = rRenderContext.ScopedPush(); rRenderContext.SetAntialiasing(AntialiasingFlags::Enable); rRenderContext.SetClipRegion(vcl::Region(rRectangle)); diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index 8c8f946f0e77..accb3c99b752 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -368,7 +368,7 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext) const SvxBrushItem* pItem = pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND ); - rRenderContext.Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR ); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); rRenderContext.SetLineColor(); if (pItem->GetColor() == COL_TRANSPARENT) rRenderContext.SetFillColor(); @@ -381,7 +381,6 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext) basegfx::fround<tools::Long>(aCellRange.getMinX()), basegfx::fround<tools::Long>(aCellRange.getMinY()), basegfx::fround<tools::Long>(aCellRange.getMaxX()), basegfx::fround<tools::Long>(aCellRange.getMaxY()))); - rRenderContext.Pop(); } } } @@ -497,7 +496,7 @@ void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData ) void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext) { - rRenderContext.Push(vcl::PushFlags::ALL); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::ALL); DrawModeFlags nOldDrawMode = aVD->GetDrawMode(); Size aWndSize(GetOutputSizePixel()); @@ -523,7 +522,6 @@ void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext) aPos.setX( -aPos.X() ); rRenderContext.DrawOutDev(aPos, aWndSize, Point(), aWndSize, *aVD); aVD->SetDrawMode(nOldDrawMode); - rRenderContext.Pop(); } void ScAutoFmtPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx index b31ac611e729..a6c97eff30ce 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -93,7 +93,7 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) tools::Long nRectWidth = aRect.GetWidth(); Point aBLPos = aRect.TopLeft(); - pDev->Push(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); + auto popIt = pDev->ScopedPush(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(); @@ -174,8 +174,6 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) } Invalidate( aRect ); - pDev->Pop(); - } } // end of namespace sc::sidebar diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 9be731d12b91..d49918ec9f27 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -980,10 +980,9 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldI double fRatio = static_cast<double>(aSize.Width()) / aSize.Height(); tools::Long aWidth = fRatio * aHeight; - rRenderContext.Push(); + auto popIt = rRenderContext.ScopedPush(); rRenderContext.SetClipRegion(vcl::Region(rRect)); rRenderContext.DrawBitmapEx(Point(rRect.Left() + 2 * nOneX, rRect.Bottom() - 2 * nOneY - aHeight), Size(aWidth, aHeight), rIcon); - rRenderContext.Pop(); } void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const & pColor, const SvxBrushItem* pBackground, std::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground, diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx index 95fef3d1acf6..f74bde7c17ff 100644 --- a/sc/source/ui/view/tabsplit.cxx +++ b/sc/source/ui/view/tabsplit.cxx @@ -55,7 +55,7 @@ void ScTabSplitter::SetFixed(bool bSet) void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) { - rRenderContext.Push(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); if (IsHorizontal()) @@ -120,8 +120,6 @@ void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const tools::Rect break; } } - - rRenderContext.Pop(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */