[Libreoffice-commits] core.git: canvas/source cui/source dbaccess/source editeng/source forms/source include/editeng include/vcl sc/source sd/source sfx2/source svtools/source svx/source sw/inc sw/source vcl/inc vcl/qa vcl/source vcl/workben

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed May 19 07:46:37 UTC 2021


 canvas/source/vcl/canvashelper.cxx             |   22 ++--
 canvas/source/vcl/canvashelper_texturefill.cxx |    8 -
 cui/source/dialogs/cuigrfflt.cxx               |    4 
 cui/source/options/personalization.cxx         |    2 
 cui/source/tabpages/grfpage.cxx                |    2 
 cui/source/tabpages/numpages.cxx               |   10 +-
 dbaccess/source/ui/app/AppDetailPageHelper.cxx |    4 
 editeng/source/editeng/editeng.cxx             |   52 +++++------
 editeng/source/editeng/impedit.hxx             |    2 
 editeng/source/editeng/impedit3.cxx            |  118 ++++++++++++-------------
 editeng/source/outliner/outleeng.cxx           |    6 -
 editeng/source/outliner/outleeng.hxx           |    2 
 editeng/source/outliner/outlin2.cxx            |    8 -
 editeng/source/outliner/outliner.cxx           |   36 +++----
 forms/source/richtext/richtextimplcontrol.cxx  |    2 
 include/editeng/editeng.hxx                    |   10 +-
 include/editeng/outliner.hxx                   |   10 +-
 include/vcl/GraphicObject.hxx                  |   18 +--
 include/vcl/animate/Animation.hxx              |    6 -
 include/vcl/gdimtf.hxx                         |    9 -
 include/vcl/graph.hxx                          |   26 ++---
 sc/source/ui/dbgui/csvgrid.cxx                 |    2 
 sc/source/ui/view/gridwin4.cxx                 |    2 
 sc/source/ui/view/output2.cxx                  |   16 +--
 sc/source/ui/view/preview.cxx                  |    2 
 sc/source/ui/view/printfun.cxx                 |   34 +++----
 sd/source/filter/html/buttonset.cxx            |    2 
 sd/source/ui/presenter/PresenterTextView.cxx   |    2 
 sd/source/ui/slideshow/showwin.cxx             |    4 
 sd/source/ui/view/DocumentRenderer.cxx         |    2 
 sfx2/source/doc/new.cxx                        |    2 
 svtools/source/graphic/renderer.cxx            |    3 
 svx/source/dialog/_contdlg.cxx                 |    2 
 svx/source/dialog/contwnd.cxx                  |    2 
 svx/source/dialog/dlgctrl.cxx                  |    2 
 svx/source/dialog/graphctl.cxx                 |    2 
 svx/source/dialog/svxbmpnumvalueset.cxx        |    2 
 svx/source/gallery2/galctrl.cxx                |    8 -
 svx/source/svdraw/svdotext.cxx                 |    2 
 svx/source/xoutdev/_xoutbmp.cxx                |    6 -
 sw/inc/ndgrf.hxx                               |    2 
 sw/source/core/doc/notxtfrm.cxx                |    6 -
 sw/source/core/frmedt/fecopy.cxx               |    4 
 sw/source/core/inc/frmtool.hxx                 |    2 
 sw/source/core/layout/paintfrm.cxx             |   92 +++++++++----------
 sw/source/core/text/porfld.cxx                 |    8 +
 sw/source/core/view/vprint.cxx                 |    2 
 sw/source/ui/frmdlg/frmpage.cxx                |    2 
 sw/source/ui/misc/outline.cxx                  |    8 -
 sw/source/uibase/docvw/SidebarTxtControl.cxx   |    2 
 vcl/inc/impgraph.hxx                           |   20 +---
 vcl/qa/cppunit/svm/svmtest.cxx                 |    2 
 vcl/source/animate/Animation.cxx               |   28 ++---
 vcl/source/filter/graphicfilter.cxx            |    2 
 vcl/source/gdi/gdimtf.cxx                      |   69 +++++++-------
 vcl/source/gdi/graph.cxx                       |   72 +++++++--------
 vcl/source/gdi/impgraph.cxx                    |   28 ++---
 vcl/source/gdi/oldprintadaptor.cxx             |    2 
 vcl/source/gdi/pdfwriter_impl2.cxx             |    4 
 vcl/source/gdi/print3.cxx                      |    2 
 vcl/source/graphic/GraphicObject.cxx           |   68 +++++++-------
 vcl/source/graphic/GraphicObject2.cxx          |   46 ++++-----
 vcl/source/outdev/outdev.cxx                   |    2 
 vcl/source/outdev/transparent.cxx              |    6 -
 vcl/source/window/paint.cxx                    |    2 
 vcl/source/window/printdlg.cxx                 |    2 
 vcl/workben/mtfdemo.cxx                        |    2 
 67 files changed, 467 insertions(+), 472 deletions(-)

New commits:
commit 692c5df18ec1f558abe1a3a658c9881cfb7210a9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 18 11:44:12 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 19 09:45:46 2021 +0200

    ImplPlayWithRenderer never checks its OutputDevice against nullptr
    
    just pass a reference instead and spread that around to some similar
    cases
    
    Change-Id: Ifb2dee8c7bf02a9f01982b928c90666cbbdd84fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115759
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index bec73b3d336a..a6cd6e0b6fd3 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -835,16 +835,16 @@ namespace vclcanvas
                 const ::Size  aSz( ::basegfx::fround( aScale.getX() * aBmpSize.Width() ),
                                    ::basegfx::fround( aScale.getY() * aBmpSize.Height() ) );
 
-                pGrfObj->Draw( &mpOutDevProvider->getOutDev(),
-                               aPt,
-                               aSz,
-                               &aGrfAttr );
+                pGrfObj->Draw(mpOutDevProvider->getOutDev(),
+                              aPt,
+                              aSz,
+                              &aGrfAttr);
 
                 if( mp2ndOutDevProvider )
-                    pGrfObj->Draw( &mp2ndOutDevProvider->getOutDev(),
-                                   aPt,
-                                   aSz,
-                                   &aGrfAttr );
+                    pGrfObj->Draw(mp2ndOutDevProvider->getOutDev(),
+                                  aPt,
+                                  aSz,
+                                  &aGrfAttr);
 
                 // created GraphicObject, which possibly cached
                 // display bitmap - return cache object, to retain
@@ -1161,12 +1161,12 @@ namespace vclcanvas
             tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDevProvider );
             setupOutDevState( viewState, renderState, IGNORE_COLOR );
 
-            if( !rGrf->Draw( &mpOutDevProvider->getOutDev(), rPt, rSz, &rAttr ) )
+            if (!rGrf->Draw(mpOutDevProvider->getOutDev(), rPt, rSz, &rAttr))
                 return false;
 
             // #i80779# Redraw also into mask outdev
-            if( mp2ndOutDevProvider )
-                return rGrf->Draw( &mp2ndOutDevProvider->getOutDev(), rPt, rSz, &rAttr );
+            if (mp2ndOutDevProvider)
+                return rGrf->Draw(mp2ndOutDevProvider->getOutDev(), rPt, rSz, &rAttr);
 
             return true;
         }
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index c0ef516d4c0a..b397ffcb7d2e 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -77,10 +77,10 @@ namespace vclcanvas
                 {
                     // update return value. This method should return true, if
                     // at least one of the looped Draws succeeded.
-                    bRet |= rGraphic.Draw( &rOutDev,
-                                           aCurrPos,
-                                           rTileSize,
-                                           &rAttr );
+                    bRet |= rGraphic.Draw(rOutDev,
+                                          aCurrPos,
+                                          rTileSize,
+                                          &rAttr);
 
                     aCurrPos.AdjustX(rNextTileX.Width() );
                     aCurrPos.AdjustY(rNextTileX.Height() );
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index 01a5ad0786ac..e5597dae8265 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -57,14 +57,14 @@ void CuiGraphicPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const ::
         const Size aGraphicSize(rRenderContext.LogicToPixel(maPreview.GetPrefSize(), maPreview.GetPrefMapMode()));
         const Point aGraphicPosition((aOutputSize.Width()  - aGraphicSize.Width()  ) >> 1,
                                      (aOutputSize.Height() - aGraphicSize.Height() ) >> 1);
-        maPreview.StartAnimation(&rRenderContext, aGraphicPosition, aGraphicSize);
+        maPreview.StartAnimation(rRenderContext, aGraphicPosition, aGraphicSize);
     }
     else
     {
         const Size  aGraphicSize(maPreview.GetSizePixel());
         const Point aGraphicPosition((aOutputSize.Width()  - aGraphicSize.Width())  >> 1,
                                      (aOutputSize.Height() - aGraphicSize.Height()) >> 1);
-        maPreview.Draw(&rRenderContext, aGraphicPosition, aGraphicSize);
+        maPreview.Draw(rRenderContext, aGraphicPosition, aGraphicSize);
     }
 }
 
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index ac2def078f5c..02c064d1b2e7 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -148,7 +148,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
         ScopedVclPtr<VirtualDevice> xVirDev
             = m_vDefaultPersonaImages[nIndex]->create_virtual_device();
         xVirDev->SetOutputSizePixel(aSize);
-        aGraphic.Draw(xVirDev.get(), Point(0, 0));
+        aGraphic.Draw(*xVirDev, Point(0, 0));
         m_vDefaultPersonaImages[nIndex]->set_image(xVirDev.get());
         xVirDev.disposeAndClear();
 
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 569329e3a160..beb8bc207ddd 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -719,7 +719,7 @@ void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
     ::tools::Rectangle aRect(
         Point((aWinSize.Width() - m_aFrameSize.Width())/2, (aWinSize.Height() - m_aFrameSize.Height())/2),
         m_aFrameSize);
-    m_aGrf.Draw(&rRenderContext, aRect.TopLeft(), aRect.GetSize());
+    m_aGrf.Draw(rRenderContext, aRect.TopLeft(), aRect.GetSize());
 
     // Remove one more case that uses XOR paint (RasterOp::Invert).
     // Get colors and logic DashLength from settings, use equal to
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index f93ebc8ed497..e03ec1451daa 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2120,7 +2120,7 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
     SetModified();
 }
 
-static tools::Long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, tools::Long nXStart,
+static tools::Long lcl_DrawGraphic(VirtualDevice& rVDev, const SvxNumberFormat &rFmt, tools::Long nXStart,
                         tools::Long nYMiddle, tools::Long nDivision)
 {
     const SvxBrushItem* pBrushItem = rFmt.GetBrush();
@@ -2134,8 +2134,8 @@ static tools::Long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &
             aGSize.setWidth( aGSize.Width() / nDivision );
             nRet = aGSize.Width();
             aGSize.setHeight( aGSize.Height() / nDivision );
-            pGrf->Draw( pVDev, Point(nXStart,nYMiddle - ( aGSize.Height() / 2) ),
-                    pVDev->PixelToLogic( aGSize ) );
+            pGrf->Draw(rVDev, Point(nXStart,nYMiddle - ( aGSize.Height() / 2) ),
+                       rVDev.PixelToLogic( aGSize ) );
         }
     }
     return nRet;
@@ -2280,7 +2280,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                 if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
                 {
                     tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
-                    nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
+                    nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(*pVDev, rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
                 }
                 else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
                 {
@@ -2401,7 +2401,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                     if (rFmt.IsShowSymbol())
                     {
                         tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
-                        nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
+                        nTextOffset = lcl_DrawGraphic(*pVDev, rFmt, nXStart, nYMiddle, nWidthRelation);
                         nTextOffset = nTextOffset + nXStep;
                     }
                 }
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 00ace78497b1..6855edff1644 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -1211,9 +1211,9 @@ void OPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
         const Size aSize(m_aPreviewRect.GetSize());
 
         if (m_aGraphicObj.IsAnimated())
-            m_aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize);
+            m_aGraphicObj.StartAnimation(rRenderContext, aPos, aSize);
         else
-            m_aGraphicObj.Draw(&rRenderContext, aPos, aSize);
+            m_aGraphicObj.Draw(rRenderContext, aPos, aSize);
     }
 }
 
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index f42b494ab139..60165977fc32 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -200,35 +200,35 @@ const SfxItemSet& EditEngine::GetEmptyItemSet() const
     return pImpEditEngine->GetEmptyItemSet();
 }
 
-void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect )
+void EditEngine::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect )
 {
-    Draw( pOutDev, rOutRect, Point( 0, 0 ) );
+    Draw( rOutDev, rOutRect, Point( 0, 0 ) );
 }
 
-void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation )
+void EditEngine::Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 nOrientation )
 {
     // Create with 2 points, as with positive points it will end up with
     // LONGMAX as Size, Bottom and Right in the range > LONGMAX.
     tools::Rectangle aBigRect( -0x3FFFFFFF, -0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF );
-    if( pOutDev->GetConnectMetaFile() )
-        pOutDev->Push();
+    if( rOutDev.GetConnectMetaFile() )
+        rOutDev.Push();
     Point aStartPos( rStartPos );
     if ( IsVertical() )
     {
         aStartPos.AdjustX(GetPaperSize().Width() );
         aStartPos = Rotate( aStartPos, nOrientation, rStartPos );
     }
-    pImpEditEngine->Paint( pOutDev, aBigRect, aStartPos, false, nOrientation );
-    if( pOutDev->GetConnectMetaFile() )
-        pOutDev->Pop();
+    pImpEditEngine->Paint(rOutDev, aBigRect, aStartPos, false, nOrientation);
+    if( rOutDev.GetConnectMetaFile() )
+        rOutDev.Pop();
 }
 
-void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos )
+void EditEngine::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos )
 {
-    Draw( pOutDev, rOutRect, rStartDocPos, true );
+    Draw( rOutDev, rOutRect, rStartDocPos, true );
 }
 
-void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip )
+void EditEngine::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip )
 {
 #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
     if ( bDebugPaint )
@@ -237,8 +237,8 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect,
 
     // Align to the pixel boundary, so that it becomes exactly the same
     // as Paint ()
-    tools::Rectangle aOutRect( pOutDev->LogicToPixel( rOutRect ) );
-    aOutRect = pOutDev->PixelToLogic( aOutRect );
+    tools::Rectangle aOutRect( rOutDev.LogicToPixel( rOutRect ) );
+    aOutRect = rOutDev.PixelToLogic( aOutRect );
 
     Point aStartPos;
     if ( !IsVertical() )
@@ -252,14 +252,14 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect,
         aStartPos.setY( aOutRect.Top() - rStartDocPos.X() );
     }
 
-    bool bClipRegion = pOutDev->IsClipRegion();
-    bool bMetafile = pOutDev->GetConnectMetaFile();
-    vcl::Region aOldRegion = pOutDev->GetClipRegion();
+    bool bClipRegion = rOutDev.IsClipRegion();
+    bool bMetafile = rOutDev.GetConnectMetaFile();
+    vcl::Region aOldRegion = rOutDev.GetClipRegion();
 
     // If one existed => intersection!
     // Use Push/pop for creating the Meta file
     if ( bMetafile )
-        pOutDev->Push();
+        rOutDev.Push();
 
     // Always use the Intersect method, it is a must for Metafile!
     if ( bClip )
@@ -272,25 +272,25 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect,
             // Some printer drivers cause problems if characters graze the
             // ClipRegion, therefore rather add a pixel more ...
             tools::Rectangle aClipRect( aOutRect );
-            if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
+            if ( rOutDev.GetOutDevType() == OUTDEV_PRINTER )
             {
                 Size aPixSz( 1, 0 );
-                aPixSz = pOutDev->PixelToLogic( aPixSz );
+                aPixSz = rOutDev.PixelToLogic( aPixSz );
                 aClipRect.AdjustRight(aPixSz.Width() );
                 aClipRect.AdjustBottom(aPixSz.Width() );
             }
-            pOutDev->IntersectClipRegion( aClipRect );
+            rOutDev.IntersectClipRegion( aClipRect );
         }
     }
 
-    pImpEditEngine->Paint( pOutDev, aOutRect, aStartPos );
+    pImpEditEngine->Paint( rOutDev, aOutRect, aStartPos );
 
     if ( bMetafile )
-        pOutDev->Pop();
+        rOutDev.Pop();
     else if ( bClipRegion )
-        pOutDev->SetClipRegion( aOldRegion );
+        rOutDev.SetClipRegion( aOldRegion );
     else
-        pOutDev->SetClipRegion();
+        rOutDev.SetClipRegion();
 }
 
 void EditEngine::InsertView(EditView* pEditView, size_t nIndex)
@@ -1820,7 +1820,7 @@ void EditEngine::StripPortions()
             aBigRect.SetBottom( 0 );
         }
     }
-    pImpEditEngine->Paint( aTmpDev.get(), aBigRect, Point(), true );
+    pImpEditEngine->Paint(*aTmpDev, aBigRect, Point(), true);
 }
 
 void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList )
@@ -2475,7 +2475,7 @@ void EditEngine::DrawingTab( const Point& /*rStartPos*/, tools::Long /*nWidth*/,
 {
 }
 
-void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, const Point&, Degree10, OutputDevice* )
+void EditEngine::PaintingFirstLine(sal_Int32, const Point&, tools::Long, const Point&, Degree10, OutputDevice&)
 {
 }
 
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 473856281e3c..284c55bc029c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -844,7 +844,7 @@ public:
     void                    FormatFullDoc();
     void                    UpdateViews( EditView* pCurView = nullptr );
     void                    Paint( ImpEditView* pView, const tools::Rectangle& rRect, OutputDevice* pTargetDevice );
-    void                    Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, Degree10 nOrientation = 0_deg10 );
+    void                    Paint(OutputDevice& rOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, Degree10 nOrientation = 0_deg10);
 
     bool                MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
     bool                MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index ee9c0bb1a202..efc0e30ea90b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -150,7 +150,7 @@ AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar )
     }
 }
 
-static void lcl_DrawRedLines( OutputDevice* pOutDev,
+static void lcl_DrawRedLines( OutputDevice& rOutDev,
                               tools::Long nFontHeight,
                               const Point& rPoint,
                               size_t nIndex,
@@ -163,7 +163,7 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
                               bool bIsRightToLeft )
 {
     // But only if font is not too small...
-    tools::Long nHeight = pOutDev->LogicToPixel(Size(0, nFontHeight)).Height();
+    tools::Long nHeight = rOutDev.LogicToPixel(Size(0, nFontHeight)).Height();
     if (WRONG_SHOW_MIN >= nHeight)
         return;
 
@@ -186,7 +186,7 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
         {
             // VCL doesn't know that the text is vertical, and is manipulating
             // the positions a little bit in y direction...
-            tools::Long nOnePixel = pOutDev->PixelToLogic(Size(0, 1)).Height();
+            tools::Long nOnePixel = rOutDev.PixelToLogic(Size(0, 1)).Height();
             tools::Long nCorrect = 2 * nOnePixel;
             aPoint1.AdjustY(-nCorrect);
             aPoint1.AdjustX(-nCorrect);
@@ -224,8 +224,8 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
         }
 
         {
-            vcl::ScopedAntialiasing a(*pOutDev, true);
-            pOutDev->DrawWaveLine(aPoint1, aPoint2);
+            vcl::ScopedAntialiasing a(rOutDev, true);
+            rOutDev.DrawWaveLine(aPoint1, aPoint2);
         }
 
         nStart = nEnd + 1;
@@ -3029,7 +3029,7 @@ bool ImpEditEngine::isXOverflowDirectionAware(const Point& pt, const tools::Rect
         return pt.Y() < rectMax.Top();
 }
 
-void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, Degree10 nOrientation )
+void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, Degree10 nOrientation )
 {
     if ( !GetUpdateMode() && !bStripOnly )
         return;
@@ -3037,12 +3037,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
     if ( !IsFormatted() )
         FormatDoc();
 
-    tools::Long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
-    tools::Long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
+    tools::Long nFirstVisXPos = - rOutDev.GetMapMode().GetOrigin().X();
+    tools::Long nFirstVisYPos = - rOutDev.GetMapMode().GetOrigin().Y();
 
     DBG_ASSERT( GetParaPortions().Count(), "No ParaPortion?!" );
     SvxFont aTmpFont( GetParaPortions()[0].GetNode()->GetCharAttribs().GetDefFont() );
-    vcl::PDFExtOutDevData* const pPDFExtOutDevData = dynamic_cast< vcl::PDFExtOutDevData* >( pOutDev->GetExtOutDevData() );
+    vcl::PDFExtOutDevData* const pPDFExtOutDevData = dynamic_cast< vcl::PDFExtOutDevData* >( rOutDev.GetExtOutDevData() );
 
     // In the case of rotated text is aStartPos considered TopLeft because
     // other information is missing, and since the whole object is shown anyway
@@ -3059,7 +3059,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
     // #110496# Added some more optional metafile comments. This
     // change: factored out some duplicated code.
-    GDIMetaFile* pMtf = pOutDev->GetConnectMetaFile();
+    GDIMetaFile* pMtf = rOutDev.GetConnectMetaFile();
     const bool bMetafileValid( pMtf != nullptr );
 
     const tools::Long nVertLineSpacing = CalcVertLineSpacing(aStartPos);
@@ -3127,7 +3127,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                     // does, too. No change for not-layouting (painting).
                     if(0 == nLine) // && !bStripOnly)
                     {
-                        GetEditEnginePtr()->PaintingFirstLine( n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, pOutDev );
+                        GetEditEnginePtr()->PaintingFirstLine(n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, rOutDev);
 
                         // Remember whether a bullet was painted.
                         const SfxBoolItem& rBulletState = pEditEngine->GetParaAttrib(n, EE_PARA_BULLETSTATE);
@@ -3157,17 +3157,17 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                             case PortionKind::FIELD:
                             case PortionKind::HYPHENATOR:
                             {
-                                SeekCursor( rPortion.GetNode(), nIndex+1, aTmpFont, pOutDev );
+                                SeekCursor( rPortion.GetNode(), nIndex+1, aTmpFont, &rOutDev );
 
                                 bool bDrawFrame = false;
 
                                 if ( ( rTextPortion.GetKind() == PortionKind::FIELD ) && !aTmpFont.IsTransparent() &&
                                      ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() &&
-                                     ( IsAutoColorEnabled() && ( pOutDev->GetOutDevType() != OUTDEV_PRINTER ) ) )
+                                     ( IsAutoColorEnabled() && ( rOutDev.GetOutDevType() != OUTDEV_PRINTER ) ) )
                                 {
                                     aTmpFont.SetTransparent( true );
-                                    pOutDev->SetFillColor();
-                                    pOutDev->SetLineColor( GetAutoColor() );
+                                    rOutDev.SetFillColor();
+                                    rOutDev.SetLineColor( GetAutoColor() );
                                     bDrawFrame = true;
                                 }
 
@@ -3189,13 +3189,13 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     aTmpFont.SetTransparent( sal_False );
                                 }
 #endif
-                                aTmpFont.SetPhysFont( pOutDev );
+                                aTmpFont.SetPhysFont( &rOutDev );
 
                                 // #114278# Saving both layout mode and language (since I'm
                                 // potentially changing both)
-                                pOutDev->Push( PushFlags::TEXTLAYOUTMODE|PushFlags::TEXTLANGUAGE );
-                                ImplInitLayoutMode( pOutDev, n, nIndex );
-                                ImplInitDigitMode(pOutDev, aTmpFont.GetLanguage());
+                                rOutDev.Push( PushFlags::TEXTLAYOUTMODE|PushFlags::TEXTLANGUAGE );
+                                ImplInitLayoutMode( &rOutDev, n, nIndex );
+                                ImplInitDigitMode(&rOutDev, aTmpFont.GetLanguage());
 
                                 OUString aText;
                                 sal_Int32 nTextStart = 0;
@@ -3229,7 +3229,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
                                             if ( 0x200B == cChar || 0x2060 == cChar )
                                             {
-                                                tools::Long nHalfBlankWidth = aTmpFont.QuickGetTextSize( pOutDev, " ", 0, 1 ).Width() / 2;
+                                                tools::Long nHalfBlankWidth = aTmpFont.QuickGetTextSize( &rOutDev, " ", 0, 1 ).Width() / 2;
 
                                                 const tools::Long nAdvanceX = ( nTmpIdx == nTmpEnd ?
                                                                          rTextPortion.GetSize().Width() :
@@ -3244,16 +3244,16 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                                 adjustXDirectionAware(aBottomRightRectPos, 2 * nHalfBlankWidth);
                                                 adjustYDirectionAware(aBottomRightRectPos, pLine->GetHeight());
 
-                                                pOutDev->Push( PushFlags::FILLCOLOR );
-                                                pOutDev->Push( PushFlags::LINECOLOR );
-                                                pOutDev->SetFillColor( COL_LIGHTGRAY );
-                                                pOutDev->SetLineColor( COL_LIGHTGRAY );
+                                                rOutDev.Push( PushFlags::FILLCOLOR );
+                                                rOutDev.Push( PushFlags::LINECOLOR );
+                                                rOutDev.SetFillColor( COL_LIGHTGRAY );
+                                                rOutDev.SetLineColor( COL_LIGHTGRAY );
 
                                                 const tools::Rectangle aBackRect( aTopLeftRectPos, aBottomRightRectPos );
-                                                pOutDev->DrawRect( aBackRect );
+                                                rOutDev.DrawRect( aBackRect );
 
-                                                pOutDev->Pop();
-                                                pOutDev->Pop();
+                                                rOutDev.Pop();
+                                                rOutDev.Pop();
 
                                                 if ( 0x200B == cChar )
                                                 {
@@ -3263,19 +3263,19 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
                                                     aTmpFont.SetEscapement( -20 );
                                                     aTmpFont.SetPropr( 25 );
-                                                    aTmpFont.SetPhysFont( pOutDev );
+                                                    aTmpFont.SetPhysFont( &rOutDev );
 
-                                                    const Size aSlashSize = aTmpFont.QuickGetTextSize( pOutDev, aSlash, 0, 1 );
+                                                    const Size aSlashSize = aTmpFont.QuickGetTextSize( &rOutDev, aSlash, 0, 1 );
                                                     Point aSlashPos( aTmpPos );
                                                     const tools::Long nAddX = nHalfBlankWidth - aSlashSize.Width() / 2;
                                                     setXDirectionAware(aSlashPos, getXDirectionAware(aTopLeftRectPos));
                                                     adjustXDirectionAware(aSlashPos, nAddX);
 
-                                                    aTmpFont.QuickDrawText( pOutDev, aSlashPos, aSlash, 0, 1 );
+                                                    aTmpFont.QuickDrawText( &rOutDev, aSlashPos, aSlash, 0, 1 );
 
                                                     aTmpFont.SetEscapement( nOldEscapement );
                                                     aTmpFont.SetPropr( nOldPropr );
-                                                    aTmpFont.SetPhysFont( pOutDev );
+                                                    aTmpFont.SetPhysFont( &rOutDev );
                                                 }
                                             }
                                         }
@@ -3445,12 +3445,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines);
 
                                     // get Overline color (from ((const SvxOverlineItem*)GetItem())->GetColor() in
-                                    // consequence, but also already set at pOutDev)
-                                    const Color aOverlineColor(pOutDev->GetOverlineColor());
+                                    // consequence, but also already set at rOutDev)
+                                    const Color aOverlineColor(rOutDev.GetOverlineColor());
 
                                     // get TextLine color (from ((const SvxUnderlineItem*)GetItem())->GetColor() in
-                                    // consequence, but also already set at pOutDev)
-                                    const Color aTextLineColor(pOutDev->GetTextLineColor());
+                                    // consequence, but also already set at rOutDev)
+                                    const Color aTextLineColor(rOutDev.GetTextLineColor());
 
                                     // Unicode code points conversion according to ctl text numeral setting
                                     aText = convertDigits(aText, nTextStart, nTextLen,
@@ -3488,7 +3488,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
                                         aOutPos = lcl_ImplCalcRotatedPos( aOutPos, aOrigin, nSin, nCos );
                                         aTmpFont.SetOrientation( aTmpFont.GetOrientation()+nOrientation );
-                                        aTmpFont.SetPhysFont( pOutDev );
+                                        aTmpFont.SetPhysFont( &rOutDev );
 
                                     }
 
@@ -3525,23 +3525,23 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                             }
                                             if ( bSpecialUnderline )
                                             {
-                                                Size aSz = aTmpFont.GetPhysTxtSize( pOutDev, aText, nTextStart, nTextLen );
+                                                Size aSz = aTmpFont.GetPhysTxtSize( &rOutDev, aText, nTextStart, nTextLen );
                                                 sal_uInt8 nProp = aTmpFont.GetPropr();
                                                 aTmpFont.SetEscapement( 0 );
                                                 aTmpFont.SetPropr( 100 );
-                                                aTmpFont.SetPhysFont( pOutDev );
+                                                aTmpFont.SetPhysFont( &rOutDev );
                                                 OUStringBuffer aBlanks;
                                                 comphelper::string::padToLength( aBlanks, nTextLen, ' ' );
                                                 Point aUnderlinePos( aOutPos );
                                                 if ( nOrientation )
                                                     aUnderlinePos = lcl_ImplCalcRotatedPos( aTmpPos, aOrigin, nSin, nCos );
-                                                pOutDev->DrawStretchText( aUnderlinePos, aSz.Width(), aBlanks.makeStringAndClear(), 0, nTextLen );
+                                                rOutDev.DrawStretchText( aUnderlinePos, aSz.Width(), aBlanks.makeStringAndClear(), 0, nTextLen );
 
                                                 aTmpFont.SetUnderline( LINESTYLE_NONE );
                                                 if ( !nOrientation )
                                                     aTmpFont.SetEscapement( nEsc );
                                                 aTmpFont.SetPropr( nProp );
-                                                aTmpFont.SetPhysFont( pOutDev );
+                                                aTmpFont.SetPhysFont( &rOutDev );
                                             }
                                         }
                                         Point aRealOutPos( aOutPos );
@@ -3561,7 +3561,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                             --nTextLen;
 
                                         // output directly
-                                        aTmpFont.QuickDrawText( pOutDev, aRealOutPos, aText, nTextStart, nTextLen, pDXArray );
+                                        aTmpFont.QuickDrawText( &rOutDev, aRealOutPos, aText, nTextStart, nTextLen, pDXArray );
 
                                         if ( bDrawFrame )
                                         {
@@ -3570,7 +3570,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                             if ( nOrientation )
                                                 aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos );
                                             tools::Rectangle aRect( aTopLeft, rTextPortion.GetSize() );
-                                            pOutDev->DrawRect( aRect );
+                                            rOutDev.DrawRect( aRect );
                                         }
 
                                         // PDF export:
@@ -3611,14 +3611,14 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                                 adjustYDirectionAware(aRedLineTmpPos, -nShift);
                                             }
                                         }
-                                        Color aOldColor( pOutDev->GetLineColor() );
-                                        pOutDev->SetLineColor( GetColorConfig().GetColorValue( svtools::SPELL ).nColor );
-                                        lcl_DrawRedLines( pOutDev, aTmpFont.GetFontSize().Height(), aRedLineTmpPos, static_cast<size_t>(nIndex), static_cast<size_t>(nIndex) + rTextPortion.GetLen(), pDXArray, rPortion.GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), rTextPortion.IsRightToLeft() );
-                                        pOutDev->SetLineColor( aOldColor );
+                                        Color aOldColor( rOutDev.GetLineColor() );
+                                        rOutDev.SetLineColor( GetColorConfig().GetColorValue( svtools::SPELL ).nColor );
+                                        lcl_DrawRedLines( rOutDev, aTmpFont.GetFontSize().Height(), aRedLineTmpPos, static_cast<size_t>(nIndex), static_cast<size_t>(nIndex) + rTextPortion.GetLen(), pDXArray, rPortion.GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), rTextPortion.IsRightToLeft() );
+                                        rOutDev.SetLineColor( aOldColor );
                                     }
                                 }
 
-                                pOutDev->Pop();
+                                rOutDev.Pop();
 
                                 pTmpDXArray.reset();
 
@@ -3649,11 +3649,11 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                             {
                                 if ( rTextPortion.GetExtraValue() && ( rTextPortion.GetExtraValue() != ' ' ) )
                                 {
-                                    SeekCursor( rPortion.GetNode(), nIndex+1, aTmpFont, pOutDev );
+                                    SeekCursor( rPortion.GetNode(), nIndex+1, aTmpFont, &rOutDev );
                                     aTmpFont.SetTransparent( false );
                                     aTmpFont.SetEscapement( 0 );
-                                    aTmpFont.SetPhysFont( pOutDev );
-                                    tools::Long nCharWidth = aTmpFont.QuickGetTextSize( pOutDev,
+                                    aTmpFont.SetPhysFont( &rOutDev );
+                                    tools::Long nCharWidth = aTmpFont.QuickGetTextSize( &rOutDev,
                                         OUString(rTextPortion.GetExtraValue()), 0, 1 ).Width();
                                     sal_Int32 nChars = 2;
                                     if( nCharWidth )
@@ -3666,8 +3666,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     OUStringBuffer aBuf;
                                     comphelper::string::padToLength(aBuf, nChars, rTextPortion.GetExtraValue());
                                     OUString aText(aBuf.makeStringAndClear());
-                                    aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.getLength() );
-                                    pOutDev->DrawStretchText( aTmpPos, rTextPortion.GetSize().Width(), aText );
+                                    aTmpFont.QuickDrawText( &rOutDev, aTmpPos, aText, 0, aText.getLength() );
+                                    rOutDev.DrawStretchText( aTmpPos, rTextPortion.GetSize().Width(), aText );
 
                                     if ( bStripOnly )
                                     {
@@ -3675,8 +3675,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                         const bool bEndOfLine(nPortion == pLine->GetEndPortion());
                                         const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines);
 
-                                        const Color aOverlineColor(pOutDev->GetOverlineColor());
-                                        const Color aTextLineColor(pOutDev->GetTextLineColor());
+                                        const Color aOverlineColor(rOutDev.GetOverlineColor());
+                                        const Color aTextLineColor(rOutDev.GetTextLineColor());
 
                                         // StripPortions() data callback
                                         GetEditEnginePtr()->DrawingTab( aTmpPos,
@@ -3695,8 +3695,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     const bool bEndOfLine(nPortion == pLine->GetEndPortion());
                                     const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines);
 
-                                    const Color aOverlineColor(pOutDev->GetOverlineColor());
-                                    const Color aTextLineColor(pOutDev->GetTextLineColor());
+                                    const Color aOverlineColor(rOutDev.GetOverlineColor());
+                                    const Color aTextLineColor(rOutDev.GetTextLineColor());
 
                                     GetEditEnginePtr()->DrawingText(
                                         aTmpPos, OUString(), 0, 0, nullptr,
@@ -3744,8 +3744,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
             // changes in EditEngine behaviour.
             if(!bEndOfParagraphWritten && !bPaintBullet && bStripOnly)
             {
-                const Color aOverlineColor(pOutDev->GetOverlineColor());
-                const Color aTextLineColor(pOutDev->GetTextLineColor());
+                const Color aOverlineColor(rOutDev.GetOverlineColor());
+                const Color aTextLineColor(rOutDev.GetTextLineColor());
 
                 GetEditEnginePtr()->DrawingText(
                     aTmpPos, OUString(), 0, 0, nullptr,
@@ -3815,7 +3815,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const tools::Rectangle& rRect, Ou
     vcl::Region aOldRegion = rTarget.GetClipRegion();
     rTarget.IntersectClipRegion( aClipRect );
 
-    Paint( &rTarget, aClipRect, aStartPos );
+    Paint(rTarget, aClipRect, aStartPos);
 
     if ( bClipRegion )
         rTarget.SetClipRegion( aOldRegion );
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index 116fec186fc3..b166c71831ba 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -38,15 +38,15 @@ OutlinerEditEng::~OutlinerEditEng()
 {
 }
 
-void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev )
+void OutlinerEditEng::PaintingFirstLine(sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, Degree10 nOrientation, OutputDevice& rOutDev)
 {
     if( GetControlWord() & EEControlBits::OUTLINER )
     {
-        PaintFirstLineInfo aInfo( nPara, rStartPos, pOutDev );
+        PaintFirstLineInfo aInfo(nPara, rStartPos, &rOutDev);
         pOwner->maPaintFirstLineHdl.Call( &aInfo );
     }
 
-    pOwner->PaintBullet( nPara, rStartPos, rOrigin, nOrientation, pOutDev );
+    pOwner->PaintBullet(nPara, rStartPos, rOrigin, nOrientation, rOutDev);
 }
 
 const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_Int32 nPara ) const
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx
index fa6ae0da381b..9759ce851f12 100644
--- a/editeng/source/outliner/outleeng.hxx
+++ b/editeng/source/outliner/outleeng.hxx
@@ -37,7 +37,7 @@ public:
                         OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool );
                         virtual ~OutlinerEditEng() override;
 
-    virtual void        PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ) override;
+    virtual void        PaintingFirstLine(sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice& rOutDev) override;
 
     virtual void        ParagraphInserted( sal_Int32 nNewParagraph ) override;
     virtual void        ParagraphDeleted( sal_Int32 nDeletedParagraph ) override;
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index b00878c874a0..1acab5ba4d48 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -168,14 +168,14 @@ OUString Outliner::GetWord( sal_Int32 nPara, sal_Int32 nIndex )
     return pEditEngine->GetWord( nPara, nIndex );
 }
 
-void Outliner::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect )
+void Outliner::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect )
 {
-    pEditEngine->Draw( pOutDev, rOutRect );
+    pEditEngine->Draw( rOutDev, rOutRect );
 }
 
-void Outliner::Draw( OutputDevice* pOutDev, const Point& rStartPos )
+void Outliner::Draw( OutputDevice& rOutDev, const Point& rStartPos )
 {
-    pEditEngine->Draw( pOutDev, rStartPos );
+    pEditEngine->Draw( rOutDev, rStartPos );
 }
 
 void Outliner::SetPaperSize( const Size& rSize )
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index de072f8c96c0..8c74fe883345 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -879,8 +879,8 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
     return aBulletFont;
 }
 
-void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
-    const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev )
+void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point& rOrigin,
+                           Degree10 nOrientation, OutputDevice& rOutDev)
 {
 
     bool bDrawBullet = false;
@@ -916,8 +916,8 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
             // Use baseline
             bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
             aBulletFont.SetAlignment( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
-            vcl::Font aOldFont = pOutDev->GetFont();
-            pOutDev->SetFont( aBulletFont );
+            vcl::Font aOldFont = rOutDev.GetFont();
+            rOutDev.SetFont( aBulletFont );
 
             ParagraphInfos  aParaInfos = pEditEngine->GetParagraphInfos( nPara );
             Point aTextPos;
@@ -963,26 +963,26 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
                 aTextPos += rOrigin;
                 vcl::Font aRotatedFont( aBulletFont );
                 aRotatedFont.SetOrientation( nOrientation );
-                pOutDev->SetFont( aRotatedFont );
+                rOutDev.SetFont( aRotatedFont );
             }
 
             // VCL will take care of brackets and so on...
-            ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
+            ComplexTextLayoutFlags nLayoutMode = rOutDev.GetLayoutMode();
             nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::BiDiStrong);
             if ( bRightToLeftPara )
                 nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft | ComplexTextLayoutFlags::BiDiStrong;
-            pOutDev->SetLayoutMode( nLayoutMode );
+            rOutDev.SetLayoutMode( nLayoutMode );
 
             if(bStrippingPortions)
             {
-                const vcl::Font& aSvxFont(pOutDev->GetFont());
+                const vcl::Font& aSvxFont(rOutDev.GetFont());
                 std::unique_ptr<tools::Long[]> pBuf(new tools::Long[ pPara->GetText().getLength() ]);
-                pOutDev->GetTextArray( pPara->GetText(), pBuf.get() );
+                rOutDev.GetTextArray( pPara->GetText(), pBuf.get() );
 
                 if(bSymbol)
                 {
                     // aTextPos is Bottom, go to Baseline
-                    FontMetric aMetric(pOutDev->GetFontMetric());
+                    FontMetric aMetric(rOutDev.GetFontMetric());
                     aTextPos.AdjustY( -(aMetric.GetDescent()) );
                 }
 
@@ -991,10 +991,10 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
             }
             else
             {
-                pOutDev->DrawText( aTextPos, pPara->GetText() );
+                rOutDev.DrawText( aTextPos, pPara->GetText() );
             }
 
-            pOutDev->SetFont( aOldFont );
+            rOutDev.SetFont( aOldFont );
         }
         else
         {
@@ -1042,7 +1042,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
                 else
                 {
                     // Remove CAST when KA made the Draw-Method const
-                    const_cast<GraphicObject*>(pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+                    const_cast<GraphicObject*>(pFmt->GetBrush()->GetGraphicObject())->Draw(rOutDev, aBulletPos, pPara->aBulSize);
                 }
             }
         }
@@ -1053,7 +1053,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
             bStrippingPortions || nOrientation )
         return;
 
-    tools::Long nWidth = pOutDev->PixelToLogic( Size( 10, 0 ) ).Width();
+    tools::Long nWidth = rOutDev.PixelToLogic( Size( 10, 0 ) ).Width();
 
     Point aStartPos, aEndPos;
     if ( !bVertical )
@@ -1074,10 +1074,10 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
         aEndPos.AdjustY(nWidth );
     }
 
-    const Color& rOldLineColor = pOutDev->GetLineColor();
-    pOutDev->SetLineColor( COL_BLACK );
-    pOutDev->DrawLine( aStartPos, aEndPos );
-    pOutDev->SetLineColor( rOldLineColor );
+    const Color& rOldLineColor = rOutDev.GetLineColor();
+    rOutDev.SetLineColor( COL_BLACK );
+    rOutDev.DrawLine( aStartPos, aEndPos );
+    rOutDev.SetLineColor( rOldLineColor );
 }
 
 void Outliner::InvalidateBullet(sal_Int32 nPara)
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index eb61fc60a78a..c12ad42a9aa5 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -616,7 +616,7 @@ namespace frm
         lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
 
         // actually draw the content
-        m_pEngine->Draw( _pDev, aPlayground, Point(), true );
+        m_pEngine->Draw(*_pDev, aPlayground, Point(), true);
 
         _pDev->Pop();
     }
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index cc043ec2a897..02bc57484083 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -371,10 +371,10 @@ public:
     bool            IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );
 
     // StartDocPos corresponds to VisArea.TopLeft().
-    void            Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect );
-    void            Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos );
-    void            Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip );
-    void            Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation = 0_deg10 );
+    void            Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect );
+    void            Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos );
+    void            Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip );
+    void            Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 nOrientation = 0_deg10 );
 
     ErrCode         Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr );
     void            Write( SvStream& rOutput, EETextFormat );
@@ -481,7 +481,7 @@ public:
     void            SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink );
     void            SetEndPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink );
 
-    virtual void    PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev );
+    virtual void    PaintingFirstLine(sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice& rOutDev);
     virtual void    ParagraphInserted( sal_Int32 nNewParagraph );
     virtual void    ParagraphDeleted( sal_Int32 nDeletedParagraph );
     virtual void    ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph );
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 411ab2d891cb..98dd7dc14b00 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -635,9 +635,9 @@ protected:
     void            StyleSheetChanged( SfxStyleSheet const * pStyle );
 
     void            InvalidateBullet(sal_Int32 nPara);
-    void            PaintBullet( sal_Int32 nPara, const Point& rStartPos,
-                    const Point& rOrigin, Degree10 nOrientation,
-                    OutputDevice* pOutDev );
+    void            PaintBullet(sal_Int32 nPara, const Point& rStartPos,
+                                const Point& rOrigin, Degree10 nOrientation,
+                                OutputDevice& rOutDev);
 
     // used by OutlinerEditEng. Allows Outliner objects to provide
     // bullet access to the EditEngine.
@@ -771,8 +771,8 @@ public:
     void            SetStatusEventHdl( const Link<EditStatus&, void>& rLink );
     Link<EditStatus&, void> const & GetStatusEventHdl() const;
 
-    void            Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect );
-    void            Draw( OutputDevice* pOutDev, const Point& rStartPos );
+    void            Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect );
+    void            Draw( OutputDevice& rOutDev, const Point& rStartPos );
 
     const Size&     GetPaperSize() const;
     void            SetPaperSize( const Size& rSize );
diff --git a/include/vcl/GraphicObject.hxx b/include/vcl/GraphicObject.hxx
index d10b46b92c4c..27b50455864a 100644
--- a/include/vcl/GraphicObject.hxx
+++ b/include/vcl/GraphicObject.hxx
@@ -59,7 +59,7 @@ private:
     std::unique_ptr<GrfSimpleCacheObj> mxSimpleCache;
 
     bool                    VCL_DLLPRIVATE ImplGetCropParams(
-                                OutputDevice const * pOut,
+                                const OutputDevice& rOut,
                                 Point& rPt,
                                 Size& rSz,
                                 const GraphicAttr* pAttr,
@@ -128,7 +128,7 @@ private:
                             );
 
     bool VCL_DLLPRIVATE     ImplDrawTiled(
-                                OutputDevice* pOut,
+                                OutputDevice& rOut,
                                 const tools::Rectangle& rArea,
                                 const Size& rSizePixel,
                                 const Size& rOffset,
@@ -217,12 +217,10 @@ public:
     bool                    IsAnimated() const;
     bool                    IsEPS() const;
 
-    bool                    Draw(
-                                OutputDevice* pOut,
-                                const Point& rPt,
-                                const Size& rSz,
-                                const GraphicAttr* pAttr = nullptr
-                            );
+    bool                    Draw(OutputDevice& rOut,
+                                 const Point& rPt,
+                                 const Size& rSz,
+                                 const GraphicAttr* pAttr = nullptr);
 
     /** Draw the graphic repeatedly into the given output rectangle
 
@@ -253,7 +251,7 @@ public:
         bitmap drawings appear on the outdev.
      */
     void                    DrawTiled(
-                                OutputDevice* pOut,
+                                OutputDevice& rOut,
                                 const tools::Rectangle& rArea,
                                 const Size& rSize,
                                 const Size& rOffset,
@@ -261,7 +259,7 @@ public:
                             );
 
     bool                    StartAnimation(
-                                OutputDevice* pOut,
+                                OutputDevice& rOut,
                                 const Point& rPt,
                                 const Size& rSz,
                                 tools::Long nExtraData = 0,
diff --git a/include/vcl/animate/Animation.hxx b/include/vcl/animate/Animation.hxx
index e6b55a7c510f..8c187723e78f 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -41,13 +41,13 @@ public:
 
     void Clear();
 
-    bool Start(OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz,
+    bool Start(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz,
                tools::Long nExtraData, OutputDevice* pFirstFrameOutDev);
 
     void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nExtraData = 0);
 
-    void Draw(OutputDevice* pOutDev, const Point& rDestPt) const;
-    void Draw(OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz) const;
+    void Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
+    void Draw(OutputDevice& rOutDev, const Point& rDestPt, const Size& rDestSz) const;
 
     bool IsInAnimation() const { return mbIsInAnimation; }
     bool IsTransparent() const;
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 363f15f10842..5293958ddaad 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -97,7 +97,7 @@ private:
                                                            const tools::PolyPolygon& rPolyPoly,
                                                            const Gradient& rGrad );
 
-    SAL_DLLPRIVATE bool                 ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rLogicDestSize );
+    SAL_DLLPRIVATE bool                 ImplPlayWithRenderer(OutputDevice& rOut, const Point& rPos, Size rLogicDestSize);
 
     void                                Linker( OutputDevice* pOut, bool bLink );
 
@@ -144,10 +144,9 @@ public:
     void            Record( OutputDevice* pOutDev );
     bool            IsRecord() const { return m_bRecord; }
 
-    void            Play( GDIMetaFile& rMtf );
-    void            Play( OutputDevice* pOutDev, size_t nPos = GDI_METAFILE_END );
-    void            Play( OutputDevice* pOutDev, const Point& rPos,
-                          const Size& rSize );
+    void            Play(GDIMetaFile& rMtf);
+    void            Play(OutputDevice& rOutDev, size_t nPos = GDI_METAFILE_END);
+    void            Play(OutputDevice& rOutDev, const Point& rPos, const Size& rSize);
 
     void            Pause( bool bPause );
     bool            IsPause() const { return m_bPause; }
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index f74cfe91ae30..abff7521381f 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -147,20 +147,18 @@ public:
 
     sal_uLong       GetSizeBytes() const;
 
-    void            Draw( OutputDevice* pOutDev,
-                          const Point& rDestPt ) const;
-    void            Draw( OutputDevice* pOutDev,
-                          const Point& rDestPt,
-                          const Size& rDestSize ) const;
-    static void     DrawEx( OutputDevice* pOutDev, const OUString& rText,
-                          vcl::Font& rFont, const BitmapEx& rBitmap,
-                          const Point& rDestPt, const Size& rDestSize );
-
-    void            StartAnimation( OutputDevice* pOutDev,
-                          const Point& rDestPt,
-                          const Size& rDestSize,
-                          tools::Long nExtraData = 0,
-                          OutputDevice* pFirstFrameOutDev = nullptr );
+    void            Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
+    void            Draw(OutputDevice& rOutDev, const Point& rDestPt,
+                         const Size& rDestSize) const;
+    static void     DrawEx(OutputDevice& rOutDev, const OUString& rText,
+                           vcl::Font& rFont, const BitmapEx& rBitmap,
+                           const Point& rDestPt, const Size& rDestSize);
+
+    void            StartAnimation(OutputDevice& rOutDev,
+                                   const Point& rDestPt,
+                                   const Size& rDestSize,
+                                   tools::Long nExtraData = 0,
+                                   OutputDevice* pFirstFrameOutDev = nullptr);
     void            StopAnimation( const OutputDevice* pOutputDevice,
                           tools::Long nExtraData );
 
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 1d05d38f1d3f..29edeba6cf85 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -1130,7 +1130,7 @@ void ScCsvGrid::ImplDrawCellText( const Point& rPos, const OUString& rText )
         {
             sal_Int32 nX = rPos.X() + GetCharWidth() * nBeginIx;
             mpEditEngine->SetTextCurrentDefaults( aToken );
-            mpEditEngine->Draw( mpBackgrDev.get(), Point( nX, rPos.Y() ) );
+            mpEditEngine->Draw(*mpBackgrDev, Point(nX, rPos.Y()));
         }
     }
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a32ca723b446..9c1ff475449a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1797,7 +1797,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                                 Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
                                 Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
                                             (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
-                                pEditEng->Draw( &rRenderContext, aPos );
+                                pEditEng->Draw(rRenderContext, aPos);
                             }
                             else
                             {
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index e2726517a874..2d45fa62eaa7 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -3175,11 +3175,11 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
             // no hard clip, only draw the affected rows
             Point aDocStart = aClip.getRect().TopLeft();
             aDocStart -= aLogicStart;
-            rParam.mpEngine->Draw( mpDev, aClip.getRect(), aDocStart, false );
+            rParam.mpEngine->Draw(*mpDev, aClip.getRect(), aDocStart, false);
         }
         else
         {
-            rParam.mpEngine->Draw(mpDev, aLogicStart);
+            rParam.mpEngine->Draw(*mpDev, aLogicStart);
         }
     }
 
@@ -3497,7 +3497,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam)
             }
         }
 
-        rParam.mpEngine->Draw(mpDev, aLogicStart, 900_deg10);
+        rParam.mpEngine->Draw(*mpDev, aLogicStart, 900_deg10);
     }
 
     rParam.adjustForHyperlinkInPDF(aURLStart, mpDev);
@@ -3734,7 +3734,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam)
         // bMoveClipped handling has been replaced by complete alignment
         // handling (also extending to the left).
 
-        rParam.mpEngine->Draw(mpDev, aLogicStart, 2700_deg10);
+        rParam.mpEngine->Draw(*mpDev, aLogicStart, 2700_deg10);
     }
 
     rParam.adjustForHyperlinkInPDF(aURLStart, mpDev);
@@ -4012,11 +4012,11 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
             // no hard clip, only draw the affected rows
             Point aDocStart = aClip.getRect().TopLeft();
             aDocStart -= aLogicStart;
-            rParam.mpEngine->Draw( mpDev, aClip.getRect(), aDocStart, false );
+            rParam.mpEngine->Draw(*mpDev, aClip.getRect(), aDocStart, false);
         }
         else
         {
-            rParam.mpEngine->Draw( mpDev, aLogicStart );
+            rParam.mpEngine->Draw(*mpDev, aLogicStart);
         }
     }
 
@@ -4281,7 +4281,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
         // the whole output area, not the text itself
         aLogicStart.AdjustX( -(rParam.mpEngine->GetPaperSize().Width()) );
 
-        rParam.mpEngine->Draw(mpDev, aLogicStart);
+        rParam.mpEngine->Draw(*mpDev, aLogicStart);
     }
 
     rParam.adjustForHyperlinkInPDF(aURLStart, mpDev);
@@ -5101,7 +5101,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
 
                                 //  bSimClip is not used here (because nOriVal is set)
 
-                                pEngine->Draw( mpDev, aLogicStart, nOriVal );
+                                pEngine->Draw(*mpDev, aLogicStart, nOriVal);
 
                                 if (bMetaFile)
                                     mpDev->Pop();
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index f5477989f73f..0ac87b887c08 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -530,7 +530,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
             (aWinEnd.X() - pEditEng->CalcTextWidth())/2,
             (aWinEnd.Y() - pEditEng->GetTextHeight())/2);
 
-        pEditEng->Draw(GetOutDev(), aCenter);
+        pEditEng->Draw(*GetOutDev(), aCenter);
 
         return;
     }
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 128f726d1c76..dc084ec75689 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1114,23 +1114,23 @@ void ScPrintFunc::SetDateTime( const DateTime& rDateTime )
     aFieldData.aDateTime = rDateTime;
 }
 
-static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut,
+static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext& rOutDev,
                       const tools::Rectangle &rGrf, const tools::Rectangle &rOut )
 {
     const bool bNotInside = !rOut.IsInside( rGrf );
     if ( bNotInside )
     {
-        pOut->Push();
-        pOut->IntersectClipRegion( rOut );
+        rOutDev.Push();
+        rOutDev.IntersectClipRegion( rOut );
     }
 
-    rGraphic.Draw( pOut, rGrf.TopLeft(), rGrf.GetSize() );
+    rGraphic.Draw(rOutDev, rGrf.TopLeft(), rGrf.GetSize());
 
     if ( bNotInside )
-        pOut->Pop();
+        rOutDev.Pop();
 }
 
-static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOut, const OutputDevice* pRefDev,
+static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext& rOutDev, const OutputDevice* pRefDev,
                         const tools::Rectangle &rOrg, const tools::Rectangle &rOut,
                         OUString const & referer )
 {
@@ -1197,7 +1197,7 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOu
 
                         GraphicObject aObject( *pGraphic );
 
-                        if( pOut->GetOutDevType() == OUTDEV_PDF &&
+                        if( rOutDev.GetOutDevType() == OUTDEV_PDF &&
                             (aObject.GetType() == GraphicType::Bitmap || aObject.GetType() == GraphicType::Default) )
                         {
                             // For PDF export, every draw
@@ -1227,12 +1227,12 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOu
                             const Size      aSize( rOrg.GetSize() );
                             const double    Abitmap( k1/k2 * aSize.Width()*aSize.Height() );
 
-                            aObject.DrawTiled( pOut, rOrg, aGrfSize, Size(0,0),
+                            aObject.DrawTiled( rOutDev, rOrg, aGrfSize, Size(0,0),
                                                ::std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
                         }
                         else
                         {
-                            aObject.DrawTiled( pOut, rOrg, aGrfSize, Size(0,0) );
+                            aObject.DrawTiled( rOutDev, rOrg, aGrfSize, Size(0,0) );
                         }
 
                         bDraw = false;
@@ -1243,12 +1243,12 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOu
                       bDraw = false;
                       break;
 
-        default: OSL_ENSURE( !pOut, "new Graphic position?" );
+        default: OSL_ENSURE( false, "new Graphic position?" );
     }
     tools::Rectangle aGrf( aPos,aDrawSize );
     if ( bDraw && aGrf.IsOver( rOut ) )
     {
-        lcl_DrawGraphic( *pGraphic, pOut, aGrf, rOut );
+        lcl_DrawGraphic( *pGraphic, rOutDev, aGrf, rOut );
     }
 }
 
@@ -1310,7 +1310,7 @@ void ScPrintFunc::DrawBorder( tools::Long nScrX, tools::Long nScrY, tools::Long
             if (pDocShell->HasName()) {
                 referer = pDocShell->GetMedium()->GetName();
             }
-            lcl_DrawGraphic( *pBackground, pDev, pRefDev, aFrameRect, aFrameRect, referer );
+            lcl_DrawGraphic(*pBackground, *pDev, pRefDev, aFrameRect, aFrameRect, referer);
         }
         else
         {
@@ -1831,7 +1831,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart
             tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
             if (nDif > 0)
                 aDraw.AdjustY(nDif / 2 );
-            pEditEngine->Draw( pDev, aDraw );
+            pEditEngine->Draw(*pDev, aDraw);
         }
 
         //  center
@@ -1845,7 +1845,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart
             tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
             if (nDif > 0)
                 aDraw.AdjustY(nDif / 2 );
-            pEditEngine->Draw( pDev, aDraw );
+            pEditEngine->Draw(*pDev, aDraw);
         }
 
         //  right
@@ -1859,7 +1859,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart
             tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
             if (nDif > 0)
                 aDraw.AdjustY(nDif / 2 );
-            pEditEngine->Draw( pDev, aDraw );
+            pEditEngine->Draw(*pDev, aDraw);
         }
 
         pDev->SetClipRegion();
@@ -1916,13 +1916,13 @@ tools::Long ScPrintFunc::DoNotes( tools::Long nNoteStart, bool bDoPrint, ScPrevi
                 {
                     if (bDoPrint)
                     {
-                        pEditEngine->Draw( pDev, Point( nPosX, nPosY ) );
+                        pEditEngine->Draw(*pDev, Point(nPosX, nPosY));
 
                         OUString aMarkStr(rPos.Format(ScRefFlags::VALID, &rDoc, rDoc.GetAddressConvention()) + ":");
 
                         //  cell position also via EditEngine, for correct positioning
                         pEditEngine->SetTextCurrentDefaults(aMarkStr);
-                        pEditEngine->Draw( pDev, Point( aPageRect.Left(), nPosY ) );
+                        pEditEngine->Draw(*pDev, Point(aPageRect.Left(), nPosY));
                     }
 
                     if ( pLocationData )
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
index 8f9ec50423a2..ec35118ceb0b 100644
--- a/sd/source/filter/html/buttonset.cxx
+++ b/sd/source/filter/html/buttonset.cxx
@@ -230,7 +230,7 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
 
         for( const Graphic& aGraphic : aGraphics )
         {
-            aGraphic.Draw( pDev, aPos );
+            aGraphic.Draw(*pDev, aPos);
 
             aPos.AdjustX(aGraphic.GetSizePixel().Width() + 3 );
         }
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 6f3b9f93b97e..6f40fd36b0d3 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -413,7 +413,7 @@ Reference<rendering::XBitmap> const & PresenterTextView::Implementation::GetBitm
         mpEditEngine->SetText(msText);
         mpEditEngine->SetPaperSize(maSize);
 
-        mpEditEngine->Draw(mpOutputDevice, aWindowBox, Point(0,mnTop));
+        mpEditEngine->Draw(*mpOutputDevice, aWindowBox, Point(0,mnTop));
 
         const BitmapEx aBitmap (mpOutputDevice->GetBitmapEx(Point(0,0), maSize));
         mxBitmap = cppcanvas::VCLFactory::createBitmap(
diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
index 52597482b5dd..2e961e45e4b2 100644
--- a/sd/source/ui/slideshow/showwin.cxx
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -484,9 +484,9 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly )
                              std::max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) );
 
         if( maLogo.IsAnimated() )
-            maLogo.StartAnimation( GetOutDev(), aGrfPos, aGrfSize, reinterpret_cast<sal_IntPtr>(this) );
+            maLogo.StartAnimation(*GetOutDev(), aGrfPos, aGrfSize, reinterpret_cast<sal_IntPtr>(this));
         else
-            maLogo.Draw( GetOutDev(), aGrfPos, aGrfSize );
+            maLogo.Draw(*GetOutDev(), aGrfPos, aGrfSize);
     }
 
     if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 7191b3565cc7..20f75eea71d3 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1133,7 +1133,7 @@ namespace {
             pOutliner->Clear();
             pOutliner->SetText(*mpParaObject);
 
-            pOutliner->Draw(&rPrinter, aOutRect);
+            pOutliner->Draw(rPrinter, aOutRect);
 
             PrintMessage(
                 rPrinter,
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index a7e9678adcdf..832079218bbb 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -89,7 +89,7 @@ void SfxPreviewWin_Impl::ImpPaint(vcl::RenderContext& rRenderContext, GDIMetaFil
         rRenderContext.SetFillColor(COL_WHITE);
         rRenderContext.DrawRect(tools::Rectangle(aPoint + Point(FRAME, FRAME), bPoint + Point(FRAME, FRAME)));
         pFile->WindStart();
-        pFile->Play(&rRenderContext, aPoint + Point(FRAME, FRAME), aSize);
+        pFile->Play(rRenderContext, aPoint + Point(FRAME, FRAME), aSize);
     }
 }
 
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index 220e047a84aa..315e3764524c 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -271,7 +271,6 @@ void GraphicRendererVCL::_getPropertyValues( const comphelper::PropertyMapEntry*
     }
 }
 
-
 void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphic >& rxGraphic )
 {
     if( mpOutDev && mxDevice.is() && rxGraphic.is() )
@@ -280,7 +279,7 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi
         if (!aGraphic.IsNone())
         {
             GraphicObject aGraphicObject(aGraphic);
-            aGraphicObject.Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() );
+            aGraphicObject.Draw(*mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize());
         }
     }
 }
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 616f8774050d..c61041949d14 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -147,7 +147,7 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
         if( pVDev->SetOutputSizePixel( aSizePix ) )
         {
             const Point aPt;
-            aTmpGrf.Draw( pVDev, aPt, aSizePix );
+            aTmpGrf.Draw(*pVDev, aPt, aSizePix);
             aBmp = pVDev->GetBitmap( aPt, aSizePix );
         }
 
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
index 593b459c5e5b..bfc0adb8cd97 100644
--- a/svx/source/dialog/contwnd.cxx
+++ b/svx/source/dialog/contwnd.cxx
@@ -240,7 +240,7 @@ void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
     rTarget.Pop();
 
     if (rGraphic.GetType() != GraphicType::NONE)
-        rGraphic.Draw(&rTarget, Point(), GetGraphicSize());
+        rGraphic.Draw(rTarget, Point(), GetGraphicSize());
 
     if (aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom())
     {
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index bf5ca03e7747..043ce60afbd5 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1178,7 +1178,7 @@ void SvxXLinePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
         Point aPos( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
         aPos.AdjustX( -(maSymbolSize.Width() / 2) );
         aPos.AdjustY( -(maSymbolSize.Height() / 2) );
-        mpGraphic->Draw(&getBufferDevice(), aPos, maSymbolSize);
+        mpGraphic->Draw(getBufferDevice(), aPos, maSymbolSize);
     }
 
     LocalPostPaint(rRenderContext);
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index f73e316cfa18..f23afd447cf7 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -176,7 +176,7 @@ void GraphCtrl::GraphicToVD()
     xVD->Erase();
     const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
     if (bGraphicValid)
-        aGraphic.Draw(xVD.get(), Point(), aGraphSize);
+        aGraphic.Draw(*xVD, Point(), aGraphSize);
 }
 
 void GraphCtrl::Resize()
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index a1deb9dcaceb..5698c99ba090 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -514,7 +514,7 @@ void SvxBmpNumValueSet::UserDraw(const UserDrawEvent& rUDEvt)
         {
             sal_uInt16 nY = 11 + i * 33;
             aPos.setY( aBLPos.Y() + nRectHeight  * nY / 100 );
-            aGraphic.Draw( pDev, aPos, aSize );
+            aGraphic.Draw(*pDev, aPos, aSize);
         }
     }
 }
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index 819f115cf3f4..bd17df54b737 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -122,9 +122,9 @@ void GalleryPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
         const Size  aSize( aPreviewRect.GetSize() );
 
         if( aGraphicObj.IsAnimated() )
-            aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize);
+            aGraphicObj.StartAnimation(rRenderContext, aPos, aSize);
         else
-            aGraphicObj.Draw(&rRenderContext, aPos, aSize);
+            aGraphicObj.Draw(rRenderContext, aPos, aSize);
     }
 }
 
@@ -266,9 +266,9 @@ void DialogGalleryPreview::Paint(vcl::RenderContext& rRenderContext, const tools
         const Size  aSize( aPreviewRect.GetSize() );
 
         if( aGraphicObj.IsAnimated() )
-            aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize);
+            aGraphicObj.StartAnimation(rRenderContext, aPos, aSize);
         else
-            aGraphicObj.Draw(&rRenderContext, aPos, aSize);
+            aGraphicObj.Draw(rRenderContext, aPos, aSize);
     }
 }
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c52ef1dff5ce..ef9cedaeedb5 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1818,7 +1818,7 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
     pRetval->Record(pBlackHole);
     Point aPaintPos = aPaintRect.TopLeft();
 
-    rOutliner.Draw(pBlackHole, aPaintPos);
+    rOutliner.Draw(*pBlackHole, aPaintPos);
 
     pRetval->Stop();
     pRetval->WindStart();
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 60e11abdba56..ef2b31716a2f 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -247,13 +247,13 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
 
                         pVDev->SetBackground( Wallpaper( COL_BLACK ) );
                         pVDev->Erase();
-                        rGraphic.Draw( pVDev.get(), aPt, aSize );
+                        rGraphic.Draw(*pVDev, aPt, aSize);
 
                         const Bitmap aBitmap( pVDev->GetBitmap( aPt, aSize ) );
 
                         pVDev->SetBackground( aWallpaper );
                         pVDev->Erase();
-                        rGraphic.Draw( pVDev.get(), aPt, aSize );
+                        rGraphic.Draw(*pVDev, aPt, aSize);
 
                         pVDev->SetRasterOp( RasterOp::Xor );
                         pVDev->DrawBitmap( aPt, aSize, aBitmap );
@@ -275,7 +275,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
 
                 if( pVDev->SetOutputSizePixel( aSize ) )
                 {
-                    rGraphic.Draw( pVDev.get(), Point(), aSize );
+                    rGraphic.Draw(*pVDev, Point(), aSize);
                     aGraphic = BitmapEx(pVDev->GetBitmap(Point(), aSize));
                 }
                 else
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index d9fd29e5c2eb..9397156bb078 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -84,7 +84,7 @@ public:
 
     /// wrappers for non-const calls at GraphicObject
     void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, tools::Long nExtraData, OutputDevice* pFirstFrameOutDev)
-    { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pFirstFrameOutDev); }
+    { maGrfObj.StartAnimation(*pOut, rPt, rSz, nExtraData, pFirstFrameOutDev); }
     void StopGraphicAnimation(const OutputDevice* pOut, tools::Long nExtraData) { maGrfObj.StopAnimation(pOut, nExtraData); }
 
     virtual Size GetTwipSize() const override;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 738ac7cc9dae..76fe94181f0f 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -141,7 +141,7 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
     aFont.SetColor( aCol );
 
     const BitmapEx& rBmp = const_cast<SwViewShell&>(rSh).GetReplacementBitmap(bDefect);
-    Graphic::DrawEx( rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize() );
+    Graphic::DrawEx(*rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize());
 }
 
 SwNoTextFrame::SwNoTextFrame(SwNoTextNode * const pNode, SwFrame* pSib )
@@ -200,7 +200,7 @@ static void lcl_ClearArea( const SwFrame &rFrame,
         {
             for( const auto &rRegion : aRegion )
             {
-                ::DrawGraphic( pItem, &rOut, aOrigRect, rRegion );
+                ::DrawGraphic(pItem, rOut, aOrigRect, rRegion);
             }
         }
     }
@@ -1380,7 +1380,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
 
             if ( pGraphic && pGraphic->GetType() != GraphicType::NONE )
             {
-                pGraphic->Draw( pOut, aPosition, aSize );
+                pGraphic->Draw(*pOut, aPosition, aSize);
 
                 // shade the representation if the object is activated outplace
                 uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 4f16f7df8f1f..bb6aa4a12654 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1246,7 +1246,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf )
 
                             GDIMetaFile aMtf;
                             aMtf.Record( pVirtDev.get() );
-                            aGrf.Draw( pVirtDev, aPt, aSz );
+                            aGrf.Draw(*pVirtDev, aPt, aSz);
                             aMtf.Stop();
                             aMtf.SetPrefMapMode( aTmp );
                             aMtf.SetPrefSize( aSz );
@@ -1270,7 +1270,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf )
                         pVirtDev->SetMapMode( aTmp );
                         if( pVirtDev->SetOutputSize( aSz ) )
                         {
-                            aGrf.Draw( pVirtDev.get(), Point(), aSz );
+                            aGrf.Draw(*pVirtDev, Point(), aSz);
                             rGrf = pVirtDev->GetBitmapEx( Point(), aSz );
                         }
                         else
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index b1cccfd2af4d..6481e6c0be6f 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -79,7 +79,7 @@ void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib);
 // transparency, saved in the color of the brush item.
 void DrawGraphic(
     const SvxBrushItem *,
-    vcl::RenderContext *,
+    vcl::RenderContext &,
     const SwRect &rOrg,
     const SwRect &rOut,
     const sal_uInt8 nGrfNum = GRFNUM_NO,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 1d3d046dee66..8dae637b7700 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1549,11 +1549,11 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
         gProp.pSRetoucheFly = nullptr;
 }
 
-static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
-                                 vcl::RenderContext* _pOut,
-                                 const SwRect& _rAlignedPaintRect,
-                                 const GraphicObject& _rGraphicObj,
-                                 SwPaintProperties const & properties)
+static void lcl_implDrawGraphicBackgrd(const SvxBrushItem& _rBackgrdBrush,
+                                       vcl::RenderContext& _rOut,
+                                       const SwRect& _rAlignedPaintRect,
+                                       const GraphicObject& _rGraphicObj,
+                                       SwPaintProperties const & properties)
 {
     /// determine color of background
     ///     If color of background brush is not "no fill"/"auto fill" or
@@ -1585,17 +1585,17 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
     if ( bDrawTransparent )
     {
         /// draw background transparent
-        if( _pOut->GetFillColor() != aColor.GetRGBColor() )
-            _pOut->SetFillColor( aColor.GetRGBColor() );
+        if( _rOut.GetFillColor() != aColor.GetRGBColor() )
+            _rOut.SetFillColor( aColor.GetRGBColor() );
         tools::PolyPolygon aPoly( _rAlignedPaintRect.SVRect() );
-        _pOut->DrawTransparent( aPoly, nTransparencyPercent );
+        _rOut.DrawTransparent( aPoly, nTransparencyPercent );
     }
     else
     {
         /// draw background opaque
-        if ( _pOut->GetFillColor() != aColor )
-            _pOut->SetFillColor( aColor );
-        _pOut->DrawRect( _rAlignedPaintRect.SVRect() );
+        if ( _rOut.GetFillColor() != aColor )
+            _rOut.SetFillColor( aColor );
+        _rOut.DrawRect( _rAlignedPaintRect.SVRect() );
     }
 }
 
@@ -1614,7 +1614,7 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
  * @param _rBackgrdBrush
  * background brush contain the color the background has to be drawn.
  *
- * @param _pOut
+ * @param _rOut
  * output device the background has to be drawn in.
  *
  * @param _rAlignedPaintRect
@@ -1632,7 +1632,7 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
  * boolean (optional; default: false) indicating, if the background is already drawn.
 */
 static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
-                                    OutputDevice* _pOut,
+                                    OutputDevice& _rOut,
                                     const SwRect& _rAlignedPaintRect,
                                     const GraphicObject& _rGraphicObj,
                                     bool _bNumberingGraphic,
@@ -1648,7 +1648,7 @@ static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
          ( _rGraphicObj.IsTransparent() || _rGraphicObj.GetType() == GraphicType::NONE  )
        )
     {
-        lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj, properties );
+        lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _rOut, _rAlignedPaintRect, _rGraphicObj, properties );
     }
 }
 
@@ -1667,7 +1667,7 @@ static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
  *
  * Also, change type of <bGrfNum> and <bClip> from <bool> to <bool>
  */
-static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOut,
+static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext &rOutDev,
                       SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
                       bool bGrfNum,
                       SwPaintProperties const & properties,
@@ -1678,24 +1678,24 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
     // Calculate align rectangle from parameter <rGrf> and use aligned
     // rectangle <aAlignedGrfRect> in the following code
     SwRect aAlignedGrfRect = rGrf;
-    ::SwAlignRect( aAlignedGrfRect, &rSh, pOut );
+    ::SwAlignRect( aAlignedGrfRect, &rSh, &rOutDev );
 
     // Change type from <bool> to <bool>.
     const bool bNotInside = !rOut.IsInside( aAlignedGrfRect );
     if ( bNotInside )
     {
-        pOut->Push( PushFlags::CLIPREGION );
-        pOut->IntersectClipRegion( rOut.SVRect() );
+        rOutDev.Push( PushFlags::CLIPREGION );
+        rOutDev.IntersectClipRegion( rOut.SVRect() );
     }
 
     GraphicObject *pGrf = const_cast<GraphicObject*>(rBrush.GetGraphicObject());
 
     // Outsource drawing of background with a background color
-    ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn );
+    ::lcl_DrawGraphicBackgrd( rBrush, rOutDev, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn );
 
     // Because for drawing a graphic left-top-corner and size coordinates are
     // used, these coordinates have to be determined on pixel level.
-    ::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
+    ::SwAlignGrfRect( &aAlignedGrfRect, rOutDev );
 
     const basegfx::B2DHomMatrix aGraphicTransform(
         basegfx::utils::createScaleTranslateB2DHomMatrix(
@@ -1703,7 +1703,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
             aAlignedGrfRect.Left(), aAlignedGrfRect.Top()));
 
     paintGraphicUsingPrimitivesHelper(
-        *pOut,
+        rOutDev,
         *pGrf,
         pGrf->GetAttr(),
         aGraphicTransform,
@@ -1712,7 +1712,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
         OUString());
 
     if ( bNotInside )
-        pOut->Pop();
+        rOutDev.Pop();
 }
 
 bool DrawFillAttributes(
@@ -1811,7 +1811,7 @@ bool DrawFillAttributes(
 
 void DrawGraphic(
     const SvxBrushItem *pBrush,
-    vcl::RenderContext *pOutDev,
+    vcl::RenderContext &rOutDev,
     const SwRect &rOrg,
     const SwRect &rOut,
     const sal_uInt8 nGrfNum,
@@ -1915,16 +1915,16 @@ void DrawGraphic(
             GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
             // calculate aligned paint rectangle
             SwRect aAlignedPaintRect = rOut;
-            ::SwAlignRect( aAlignedPaintRect, &rSh, pOutDev );
+            ::SwAlignRect( aAlignedPaintRect, &rSh, &rOutDev );
             // draw background color for aligned paint rectangle
-            lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum, gProp );
+            lcl_DrawGraphicBackgrd( *pBrush, rOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum, gProp );
 
             // set left-top-corner of background graphic to left-top-corner of the
             // area, from which the background brush is determined.
             aGrf.Pos() = rOrg.Pos();
             // setup clipping at output device
-            pOutDev->Push( PushFlags::CLIPREGION );
-            pOutDev->IntersectClipRegion( rOut.SVRect() );
+            rOutDev.Push( PushFlags::CLIPREGION );
+            rOutDev.IntersectClipRegion( rOut.SVRect() );
             // use new method <GraphicObject::DrawTiled(::)>
             {
                 // calculate paint offset
@@ -1954,14 +1954,14 @@ void DrawGraphic(
                 const Size      aSize( aAlignedPaintRect.SSize() );
                 const double    Abitmap( k1/k2 * static_cast<double>(aSize.Width())*aSize.Height() );
 
-                pGraphicObj->DrawTiled( pOutDev,
+                pGraphicObj->DrawTiled( rOutDev,
                                         aAlignedPaintRect.SVRect(),
                                         aGrf.SSize(),
                                         Size( aPaintOffset.X(), aPaintOffset.Y() ),
                                         std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
             }
             // reset clipping at output device
-            pOutDev->Pop();
+            rOutDev.Pop();
             // set <bDraw> and <bRetouche> to false, indicating that background
             // graphic and background are already drawn.
             bDraw = bRetouche = false;
@@ -1972,7 +1972,7 @@ void DrawGraphic(
         bDraw = false;
         break;
 
-    default: OSL_ENSURE( !pOutDev, "new Graphic position?" );
+    default: OSL_ENSURE( false, "new Graphic position?" );
     }
 
     /// init variable <bGrfBackgrdAlreadDrawn> to indicate, if background of
@@ -1980,8 +1980,8 @@ void DrawGraphic(
     bool bGrfBackgrdAlreadyDrawn = false;
     if ( bRetouche )
     {
-        pOutDev->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
-        pOutDev->SetLineColor();
+        rOutDev.Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+        rOutDev.SetLineColor();
 
         // check, if an existing background graphic (not filling the complete
         // background) is transparent drawn and the background color is
@@ -2044,11 +2044,11 @@ void DrawGraphic(
         }
 
         // #i75614# reset draw mode in high contrast mode in order to get fill color set
-        const DrawModeFlags nOldDrawMode = pOutDev->GetDrawMode();
+        const DrawModeFlags nOldDrawMode = rOutDev.GetDrawMode();
         if ( gProp.pSGlobalShell->GetWin() &&
              Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
         {
-            pOutDev->SetDrawMode( DrawModeFlags::Default );
+            rOutDev.SetDrawMode( DrawModeFlags::Default );
         }
 
         // If background region has to be drawn transparent, set only the RGB values of the background color as
@@ -2057,21 +2057,21 @@ void DrawGraphic(
         {
             case Transparent:
             {
-                if( pOutDev->GetFillColor() != aColor.GetRGBColor() )
-                    pOutDev->SetFillColor( aColor.GetRGBColor() );
+                if( rOutDev.GetFillColor() != aColor.GetRGBColor() )
+                    rOutDev.SetFillColor( aColor.GetRGBColor() );
                 break;
             }
             default:
             {
-                if( pOutDev->GetFillColor() != aColor )
-                    pOutDev->SetFillColor( aColor );
+                if( rOutDev.GetFillColor() != aColor )
+                    rOutDev.SetFillColor( aColor );
                 break;
             }
         }
 
         // #i75614#
         // restore draw mode
-        pOutDev->SetDrawMode( nOldDrawMode );
+        rOutDev.SetDrawMode( nOldDrawMode );
 
         switch (eDrawStyle)
         {
@@ -2107,7 +2107,7 @@ void DrawGraphic(
                   (( bTransparentGrfWithNoFillBackgrd ? nGrfTransparency : (255 - aColor.GetAlpha())
                    )*100 + 0x7F)/0xFF);
                 // draw poly-polygon transparent
-                pOutDev->DrawTransparent( aDrawPoly, nTransparencyPercent );
+                rOutDev.DrawTransparent( aDrawPoly, nTransparencyPercent );
 
                 break;
             }
@@ -2122,22 +2122,22 @@ void DrawGraphic(
                 // loop rectangles of background region, which has to be drawn
                 for( size_t i = 0; i < aRegion.size(); ++i )
                 {
-                    pOutDev->DrawRect( aRegion[i].SVRect() );
+                    rOutDev.DrawRect( aRegion[i].SVRect() );
                 }
             }
         }
-        pOutDev ->Pop();
+        rOutDev.Pop();
     }
 
     if( bDraw && aGrf.IsOver( rOut ) )
-        lcl_DrawGraphic( *pBrush, pOutDev, rSh, aGrf, rOut, bGrfNum, gProp,
+        lcl_DrawGraphic( *pBrush, rOutDev, rSh, aGrf, rOut, bGrfNum, gProp,
                          bGrfBackgrdAlreadyDrawn );
 
     if( bReplaceGrfNum )
     {
         const BitmapEx& rBmp = rSh.GetReplacementBitmap(false);
-        vcl::Font aTmp( pOutDev->GetFont() );
-        Graphic::DrawEx(pOutDev, OUString(), aTmp, rBmp, rOrg.Pos(), rOrg.SSize());
+        vcl::Font aTmp( rOutDev.GetFont() );
+        Graphic::DrawEx(rOutDev, OUString(), aTmp, rBmp, rOrg.Pos(), rOrg.SSize());
     }
 }
 
@@ -6445,7 +6445,7 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
                     //         - see declaration in /core/inc/frmtool.hxx.
                         ::DrawGraphic(
                                 pItem,
-                                pOut,
+                                *pOut,
                                 aOrigBackRect,
                                 aRegion[i],
                                 GRFNUM_NO,
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index fdb2e4442916..21ab8eecd351 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -959,8 +959,10 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
                 Graphic* pGraph = const_cast<Graphic*>(m_pBrush->GetGraphic());
                 if (pGraph)
                 {
+                    const OutputDevice* pOut = rInf.GetOut();
+                    assert(pOut);
                     pGraph->StartAnimation(
-                        const_cast<OutputDevice*>(rInf.GetOut()), aPos, aSize, m_nId );
+                        *const_cast<OutputDevice*>(pOut), aPos, aSize, m_nId);
                 }
             }
 
@@ -993,7 +995,9 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
 
     if( bDraw && aTmp.HasArea() )
     {
-        DrawGraphic( m_pBrush.get(), const_cast<OutputDevice*>(rInf.GetOut()),
+        const OutputDevice* pOut = rInf.GetOut();
+        assert(pOut);
+        DrawGraphic( m_pBrush.get(), *const_cast<OutputDevice*>(pOut),
             aTmp, aRepaint, m_bReplace ? GRFNUM_REPLACE : GRFNUM_YES );
     }
 }
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index bd243d2e074e..768ad00c8cd8 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -554,7 +554,7 @@ bool SwViewShell::PrintOrPDFExport(
             pMetaFile->WindStart();
 
             //play back the scaled page
-            pMetaFile->Play(pOutDev);
+            pMetaFile->Play(*pOutDev);
             pMetaFile.reset();
         }
     }
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index d3d9427751e0..e7c6b268ba2e 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2649,7 +2649,7 @@ void BmpWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
     }
     else if (bGraphic)  //draw unmirrored preview graphic
     {
-        aGraphic.Draw(&rRenderContext, aPntPos, aPntSz);
+        aGraphic.Draw(rRenderContext, aPntPos, aPntSz);
     }
     else    //draw unmirrored stock sample image
     {
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 9b65b575fbc4..69e2887c1af2 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -858,7 +858,7 @@ static tools::Long lcl_DrawBullet(vcl::RenderContext* pVDev, const SwNumFormat&
     return nRet;
 }
 
-static tools::Long lcl_DrawGraphic(vcl::RenderContext* pVDev, const SwNumFormat &rFormat, tools::Long nXStart, tools::Long nYStart, tools::Long nDivision)
+static tools::Long lcl_DrawGraphic(vcl::RenderContext& rVDev, const SwNumFormat &rFormat, tools::Long nXStart, tools::Long nYStart, tools::Long nDivision)
 {
     const SvxBrushItem* pBrushItem = rFormat.GetBrush();
     tools::Long nRet = 0;
@@ -871,7 +871,7 @@ static tools::Long lcl_DrawGraphic(vcl::RenderContext* pVDev, const SwNumFormat
             aGSize.setWidth( aGSize.Width() / nDivision );
             nRet = aGSize.Width();
             aGSize.setHeight( aGSize.Height() / nDivision );
-            pGraphic->Draw(pVDev, Point(nXStart, nYStart), pVDev->PixelToLogic(aGSize));
+            pGraphic->Draw(rVDev, Point(nXStart, nYStart), rVDev.PixelToLogic(aGSize));
         }
     }
     return nRet;
@@ -958,7 +958,7 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re
                 tools::Long nBulletWidth = 0;
                 if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
                 {
-                    nBulletWidth = lcl_DrawGraphic(pVDev.get(), rFormat, nNumberXPos,
+                    nBulletWidth = lcl_DrawGraphic(*pVDev, rFormat, nNumberXPos,
                                                    nYStart, nWidthRelation);
                 }
                 else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
@@ -1051,7 +1051,7 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re
                 tools::Long nTextOffset;
                 if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
                 {
-                    lcl_DrawGraphic(pVDev.get(), rFormat, nXStart, nYStart, nWidthRelation);
+                    lcl_DrawGraphic(*pVDev, rFormat, nXStart, nYStart, nWidthRelation);
                     nTextOffset = nLineHeight + nXStep;
                 }
                 else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index e9ce19243225..342f52086fc8 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list