svx/source/dialog/_bmpmask.cxx | 3 +-- svx/source/dialog/connctrl.cxx | 4 +--- svx/source/dialog/cuicharmap.cxx | 3 +-- svx/source/dialog/dlgctrl.cxx | 7 ++----- svx/source/dialog/fntctrl.cxx | 3 +-- svx/source/dialog/measctrl.cxx | 8 ++------ svx/source/dialog/pagectrl.cxx | 6 ++---- svx/source/dialog/paraprev.cxx | 3 +-- svx/source/dialog/rubydialog.cxx | 3 +-- svx/source/dialog/weldeditview.cxx | 4 +--- svx/source/fmcomp/gridcell.cxx | 3 +-- svx/source/form/filtnav.cxx | 7 ++----- svx/source/sidebar/line/LineWidthValueSet.cxx | 3 +-- svx/source/sidebar/tools/ValueSetWithTextControl.cxx | 3 +-- svx/source/stbctrls/pszctrl.cxx | 3 +-- svx/source/stbctrls/xmlsecctrl.cxx | 4 +--- svx/source/stbctrls/zoomsliderctrl.cxx | 4 +--- svx/source/styles/CommonStylePreviewRenderer.cxx | 4 +--- svx/source/tbxctrls/StylesPreviewWindow.cxx | 6 ++---- svx/source/tbxctrls/layctrl.cxx | 8 ++------ svx/source/tbxctrls/tbcontrl.cxx | 12 +++--------- 21 files changed, 29 insertions(+), 72 deletions(-)
New commits: commit dbf58620f0962d5799783c0ce5e6b6f6e34c3fad Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Aug 16 23:37:14 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Aug 17 08:31:06 2025 +0200 Use OutputDevice::ScopedPush in svx Change-Id: I4b6c125f82f34d420ba8faea2385fd5a9610ee98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189804 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 4a3de2955f8e..794f2c419ced 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -307,11 +307,10 @@ IMPL_LINK_NOARG(MaskData, ExecHdl, weld::Button&, void) void BmpColorWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& /*Rect*/) { - rRenderContext.Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); rRenderContext.SetLineColor(aColor); rRenderContext.SetFillColor(aColor); rRenderContext.DrawRect(tools::Rectangle(Point(), GetOutputSizePixel())); - rRenderContext.Pop(); } SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( SvxBmpMask& rMask, diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx index c7e1c31a6362..41f825b91ab0 100644 --- a/svx/source/dialog/connctrl.cxx +++ b/svx/source/dialog/connctrl.cxx @@ -193,7 +193,7 @@ void SvxXConnectionPreview::Construct() void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::ALL); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::ALL); rRenderContext.SetMapMode(GetMapMode()); @@ -221,8 +221,6 @@ void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tool // do processing aPainter.ProcessDisplay(aDisplayInfo); } - - rRenderContext.Pop(); } void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs ) diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx index 964e540180c5..aabf313ec9d8 100644 --- a/svx/source/dialog/cuicharmap.cxx +++ b/svx/source/dialog/cuicharmap.cxx @@ -769,11 +769,10 @@ void SvxShowText::SetDrawingArea(weld::DrawingArea* pDrawingArea) vcl::Font aFont = m_xVirDev->GetFont(); Size aFontSize(aFont.GetFontSize().Width() * 5, aFont.GetFontSize().Height() * 5); aFont.SetFontSize(aFontSize); - m_xVirDev->Push(PUSH_ALLFONT); + auto popIt = m_xVirDev->ScopedPush(PUSH_ALLFONT); m_xVirDev->SetFont(aFont); pDrawingArea->set_size_request(m_xVirDev->approximate_digit_width() + 2 * 12, m_xVirDev->LogicToPixel(aFontSize).Height() * 2); - m_xVirDev->Pop(); } void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 432d1570d5f0..86ea226133d8 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1243,7 +1243,7 @@ void SvxXShadowPreview::SetShadowPosition(const Point& rPos) void SvxXShadowPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE); rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM)); LocalPrePaint(rRenderContext); @@ -1269,8 +1269,6 @@ void SvxXShadowPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R aPainter.ProcessDisplay(aDisplayInfo); LocalPostPaint(rRenderContext); - - rRenderContext.Pop(); } void SvxPreviewBase::InitSettings() @@ -1404,7 +1402,7 @@ void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) void SvxXRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE); rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM)); LocalPrePaint(rRenderContext); @@ -1418,7 +1416,6 @@ void SvxXRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec aPainter.ProcessDisplay(aDisplayInfo); LocalPostPaint(rRenderContext); - rRenderContext.Pop(); } void limitWidthForSidebar(weld::SpinButton& rSpinButton) diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index ad918212c15b..164b19541a77 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -579,7 +579,7 @@ void SvxFontPrevWindow::SetOverlineColor(const Color &rColor) void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::ALL); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::ALL); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); ApplySettings(rRenderContext); @@ -780,7 +780,6 @@ void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint, rFont); } } - rRenderContext.Pop(); } bool SvxFontPrevWindow::IsTwoLines() const diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index 9539d2f68c46..19b743601955 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -51,7 +51,7 @@ void SvxXMeasurePreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) void SvxXMeasurePreview::ResizeImpl(const Size& rSize) { OutputDevice& rRefDevice = GetDrawingArea()->get_ref_device(); - rRefDevice.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRefDevice.ScopedPush(vcl::PushFlags::MAPMODE); rRefDevice.SetMapMode(m_aMapMode); @@ -60,8 +60,6 @@ void SvxXMeasurePreview::ResizeImpl(const Size& rSize) pMeasureObj->SetPoint(aPt1, 0); Point aPt2(aSize.Width() * 4 / 5, static_cast<tools::Long>(aSize.Height() / 2)); pMeasureObj->SetPoint(aPt2, 1); - - rRefDevice.Pop(); } void SvxXMeasurePreview::Resize() @@ -78,14 +76,12 @@ void SvxXMeasurePreview::Paint(vcl::RenderContext& rRenderContext, const tools:: rRenderContext.SetBackground(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); rRenderContext.Erase(); - rRenderContext.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE); rRenderContext.SetMapMode(m_aMapMode); bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); rRenderContext.SetDrawMode(bHighContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); pMeasureObj->SingleObjectPainter(rRenderContext); - - rRenderContext.Pop(); } void SvxXMeasurePreview::SetAttributes(const SfxItemSet& rInAttrs) diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 2cadfae290ee..b76b4fc8adfb 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -67,7 +67,7 @@ SvxPageWindow::~SvxPageWindow() void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); Fraction aXScale(aWinSize.Width(), std::max(aSize.Width() * 2 + aSize.Width() / 8, tools::Long(1))); @@ -119,7 +119,6 @@ void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta DrawPage(rRenderContext, Point(aSize.Width() + aSize.Width() / 8, nYPos), true, eUsage == SvxPageUsage::Right || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror); } - rRenderContext.Pop(); } void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) @@ -380,7 +379,7 @@ void SvxPageWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) OutputDevice& rRefDevice = pDrawingArea->get_ref_device(); // Count in Twips by default - rRefDevice.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRefDevice.ScopedPush(vcl::PushFlags::MAPMODE); rRefDevice.SetMapMode(MapMode(MapUnit::MapTwip)); aWinSize = rRefDevice.LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont)); pDrawingArea->set_size_request(aWinSize.Width(), aWinSize.Height()); @@ -389,7 +388,6 @@ void SvxPageWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) aWinSize.AdjustWidth( -4 ); aWinSize = rRefDevice.PixelToLogic(aWinSize); - rRefDevice.Pop(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx index 27dccbfd9f6a..ee9fa7ad4397 100644 --- a/svx/source/dialog/paraprev.cxx +++ b/svx/source/dialog/paraprev.cxx @@ -52,7 +52,7 @@ void SvxParaPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R void SvxParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) { // Count in Twips by default - rRenderContext.Push(vcl::PushFlags::MAPMODE); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); Size aWinSize(GetOutputSizePixel()); @@ -206,7 +206,6 @@ void SvxParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) aPnt.setX( DEF_MARGIN / 2 ); aSiz = aLineSiz; } - rRenderContext.Pop(); } #undef DEF_MARGIN diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index df75a5c4e365..da62ade1fa56 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -899,7 +899,7 @@ RubyPreview::~RubyPreview() {} void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { - rRenderContext.Push(vcl::PushFlags::ALL); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::ALL); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); @@ -1038,7 +1038,6 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang default: break; } - rRenderContext.Pop(); } void RubyPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 59fc48350000..a45cd7b49095 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -228,7 +228,7 @@ void WeldEditView::DoPaint(vcl::RenderContext& rRenderContext, const tools::Rect return; } - rRenderContext.Push(vcl::PushFlags::ALL); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::ALL); rRenderContext.SetClipRegion(); pEditView->DrawText_ToEditView( @@ -249,8 +249,6 @@ void WeldEditView::DoPaint(vcl::RenderContext& rRenderContext, const tools::Rect // get the system's highlight color const Color aHighlight(SvtOptionsDrawinglayer::getHilightColor()); PaintSelection(rRenderContext, rRect, aLogicRects, aHighlight); - - rRenderContext.Pop(); } bool WeldEditView::MouseMove(const MouseEvent& rMEvt) diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index d43351da912a..16736bd18b76 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1733,7 +1733,7 @@ void DbCheckBox::PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) aStateRect.SetRight(aStateRect.Left() + aImageSize.Width() - 1); aStateRect.SetBottom(aStateRect.Top() + aImageSize.Height() - 1); - rDev.Push(); + auto popIt = rDev.ScopedPush(); rDev.SetMapMode(); rDev.SetLineColor(); @@ -1787,7 +1787,6 @@ void DbCheckBox::PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) } } - rDev.Pop(); break; } } diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 9d673e76ad70..4b5665ca6f61 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -960,7 +960,7 @@ IMPL_STATIC_LINK(FmFilterNavigator, CustomRenderHdl, weld::TreeView::render_args bool bSelected = std::get<2>(aPayload); const OUString& rId = std::get<3>(aPayload); - rRenderContext.Push(vcl::PushFlags::TEXTCOLOR); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::TEXTCOLOR); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); if (bSelected) rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor()); @@ -996,7 +996,7 @@ IMPL_STATIC_LINK(FmFilterNavigator, CustomRenderHdl, weld::TreeView::render_args const bool bIsCurrentFilter = pForm->GetChildren()[ pForm->GetFilterController()->getActiveTerm() ].get() == pRow; if (bIsCurrentFilter) { - rRenderContext.Push(vcl::PushFlags::LINECOLOR); + auto popIt2 = rRenderContext.ScopedPush(vcl::PushFlags::LINECOLOR); rRenderContext.SetLineColor(rRenderContext.GetTextColor()); Point aFirst(aPos.X(), aRect.Bottom() - 6); @@ -1010,15 +1010,12 @@ IMPL_STATIC_LINK(FmFilterNavigator, CustomRenderHdl, weld::TreeView::render_args aSecond.AdjustY(-5); rRenderContext.DrawLine(aFirst, aSecond); - rRenderContext.Pop(); } rRenderContext.DrawText(Point(aPos.X() + nxDBmp, aPos.Y()), sText); } else rRenderContext.DrawText(aPos, sText); - - rRenderContext.Pop(); } FmFilterNavigatorDropTarget::FmFilterNavigatorDropTarget(FmFilterNavigator& rTreeView) diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx index 21e80c00034f..d7ee509a0354 100644 --- a/svx/source/sidebar/line/LineWidthValueSet.cxx +++ b/svx/source/sidebar/line/LineWidthValueSet.cxx @@ -86,7 +86,7 @@ void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); //Color aBackColor(0,0,200); //const Color aTextColor = rStyleSettings.GetFieldTextColor(); - 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(); @@ -152,7 +152,6 @@ void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) } Invalidate( aRect ); - pDev->Pop(); } void LineWidthValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx index cddd7b0aa801..ea6e4bca932f 100644 --- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -60,7 +60,7 @@ void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt ) { const tools::Rectangle aRect = rUDEvt.GetRect(); vcl::RenderContext* pDev = rUDEvt.GetRenderContext(); - pDev->Push(); + auto popIt = pDev->ScopedPush(); const sal_uInt16 nItemId = rUDEvt.GetItemId(); const tools::Long nRectHeight = aRect.GetHeight(); @@ -112,7 +112,6 @@ void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt ) } Invalidate( aRect ); - pDev->Pop(); } } // end of namespace svx::sidebar diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index 89746ef61614..92c2c0a25dae 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -437,7 +437,7 @@ void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) const tools::Rectangle& rRect = rUsrEvt.GetRect(); StatusBar& rBar = GetStatusBar(); Point aItemPos = rBar.GetItemTextPos( GetId() ); - pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); + auto popIt = pDev->ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); pDev->SetLineColor(); pDev->SetFillColor( pDev->GetBackground().GetColor() ); @@ -500,7 +500,6 @@ void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) // Date/Time are no longer used (#65302#). pDev->DrawRect( rRect ); } - pDev->Pop(); } void SvxPosSizeStatusBarControl::ImplUpdateItemText() diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index ce852da13e62..bfa32388fe52 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -128,7 +128,7 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) vcl::RenderContext* pDev = rUsrEvt.GetRenderContext(); tools::Rectangle aRect = rUsrEvt.GetRect(); - pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); + auto popIt = pDev->ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); pDev->SetLineColor(); pDev->SetFillColor( pDev->GetBackground().GetColor() ); @@ -153,8 +153,6 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) } else pDev->DrawRect( aRect ); - - pDev->Pop(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index 632f4dc826e5..5bae895870e0 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -235,7 +235,7 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) aSlider.AdjustLeft(nSliderXOffset ); aSlider.AdjustRight( -nSliderXOffset ); - pDev->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); + auto popIt = pDev->ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() ); @@ -273,8 +273,6 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) // draw increase button aImagePoint.setX( aRect.Left() + aControlRect.GetWidth() - mxImpl->maIncreaseButton.GetSizePixel().Width() - (nSliderXOffset - mxImpl->maIncreaseButton.GetSizePixel().Height())/2 ); pDev->DrawImage( aImagePoint, mxImpl->maIncreaseButton ); - - pDev->Pop(); } bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx index b517b4437811..e26cc5575620 100644 --- a/svx/source/styles/CommonStylePreviewRenderer.cxx +++ b/svx/source/styles/CommonStylePreviewRenderer.cxx @@ -326,7 +326,7 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend const OUString& rText = maStyleName; // setup the device & draw - mrOutputDev.Push(vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR | vcl::PushFlags::FILLCOLOR | vcl::PushFlags::TEXTFILLCOLOR); + auto popIt = mrOutputDev.ScopedPush(vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR | vcl::PushFlags::FILLCOLOR | vcl::PushFlags::TEXTFILLCOLOR); if (maBackgroundColor != COL_AUTO) { @@ -396,8 +396,6 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend } while(true); - mrOutputDev.Pop(); - return true; } diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index 037f2c9c4f23..ec0988106784 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -182,12 +182,10 @@ StyleItemController::StyleItemController(std::pair<OUString, OUString> aStyleNam void StyleItemController::Paint(vcl::RenderContext& rRenderContext) { - rRenderContext.Push(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::FONT - | vcl::PushFlags::TEXTCOLOR); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::FONT + | vcl::PushFlags::TEXTCOLOR); DrawEntry(rRenderContext); - - rRenderContext.Pop(); } bool StylesPreviewWindow_Base::Command(const CommandEvent& rEvent) diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 261c012c8287..7079de22b99e 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -252,7 +252,7 @@ bool TableWidget::MouseButtonDown(const MouseEvent&) void TableWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::FONT); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FONT); rRenderContext.SetBackground( aBackgroundColor ); vcl::Font aFont = rRenderContext.GetFont(); @@ -329,8 +329,6 @@ void TableWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang aText = u"\u202D" + aText; rRenderContext.DrawText(Point(nTextX, nTextY), aText); - - rRenderContext.Pop(); } void TableWidget::InsertTable() @@ -591,7 +589,7 @@ bool ColumnsWidget::MouseButtonUp(const MouseEvent&) void ColumnsWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - rRenderContext.Push(vcl::PushFlags::FONT); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FONT); rRenderContext.SetBackground(); vcl::Font aFont( rRenderContext.GetFont() ); @@ -647,8 +645,6 @@ void ColumnsWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Recta rRenderContext.SetLineColor(aLineColor); rRenderContext.SetFillColor(); rRenderContext.DrawRect(tools::Rectangle( 0, 0, aSize.Width() - 1, aSize.Height() - 1)); - - rRenderContext.Pop(); } void SvxColumnsToolBoxControl::InsertColumns(const Sequence< PropertyValue >& rArgs) diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index abbeef7ad5fa..c1cdc73fe702 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1193,7 +1193,7 @@ tools::Rectangle SvxStyleBox_Base::CalcBoundRect(vcl::RenderContext& rRenderCont m_oCTLFont : m_oFont); - rRenderContext.Push(vcl::PushFlags::FONT); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FONT); if (oFont) rRenderContext.SetFont(*oFont); @@ -1214,8 +1214,6 @@ tools::Rectangle SvxStyleBox_Base::CalcBoundRect(vcl::RenderContext& rRenderCont tools::Long nWidth = rRenderContext.GetTextWidth(rStyleName, nStart, nEnd - nStart); - rRenderContext.Pop(); - if (nIdx >= rScriptChanges.size()) break; @@ -1277,7 +1275,7 @@ void SvxStyleBox_Base::UserDrawEntry(vcl::RenderContext& rRenderContext, const t m_oCTLFont : m_oFont); - rRenderContext.Push(vcl::PushFlags::FONT); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FONT); if (oFont) rRenderContext.SetFont(*oFont); @@ -1294,8 +1292,6 @@ void SvxStyleBox_Base::UserDrawEntry(vcl::RenderContext& rRenderContext, const t rRenderContext.DrawText(aPos, rStyleName, nStart, nEnd - nStart); - rRenderContext.Pop(); - aPos.AdjustX(rScriptChanges[nIdx++].textWidth * fRatio); if (nEnd < rStyleName.getLength() && nIdx < nCnt) { @@ -1550,14 +1546,12 @@ IMPL_LINK(SvxStyleBox_Base, CustomRenderHdl, weld::ComboBox::render_args, aPaylo OUString aStyleName(m_xWidget->get_text(nIndex)); - rRenderContext.Push(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR); + auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR); SetupEntry(rRenderContext, nIndex, rRect, aStyleName, !bSelected); auto aScriptChanges = CheckScript(aStyleName); auto aTextRect = CalcBoundRect(rRenderContext, aStyleName, aScriptChanges); UserDrawEntry(rRenderContext, rRect, aTextRect, aStyleName, aScriptChanges); - - rRenderContext.Pop(); } void SvxStyleBox_Base::CalcOptimalExtraUserWidth(vcl::RenderContext& rRenderContext)