basctl/source/basicide/baside2b.cxx                             |    8 
 basctl/source/basicide/baside3.cxx                              |    2 
 basctl/source/basicide/layout.cxx                               |    4 
 basctl/source/dlged/dlged.cxx                                   |    4 
 basctl/source/dlged/dlgedfunc.cxx                               |   18 
 basctl/source/dlged/dlgedobj.cxx                                |    2 
 basctl/source/dlged/dlgedview.cxx                               |    2 
 canvas/source/cairo/cairo_canvas.cxx                            |    2 
 canvas/source/cairo/cairo_spritecanvas.cxx                      |    2 
 canvas/source/cairo/cairo_spritedevicehelper.cxx                |    2 
 canvas/source/directx/dx_canvas.cxx                             |    1 
 canvas/source/vcl/canvas.cxx                                    |    1 
 canvas/source/vcl/outdevholder.hxx                              |    1 
 canvas/source/vcl/spritecanvashelper.cxx                        |    4 
 canvas/source/vcl/windowoutdevholder.hxx                        |    4 
 canvas/workben/canvasdemo.cxx                                   |    4 
 chart2/source/controller/accessibility/AccessibleTextHelper.cxx |    2 
 chart2/source/controller/main/ChartController.cxx               |    2 
 chart2/source/controller/main/ChartController_Window.cxx        |   12 
 chart2/source/controller/main/ChartWindow.cxx                   |    4 
 compilerplugins/clang/vclwidgets.cxx                            |   12 
 cppcanvas/qa/unit/test.cxx                                      |    2 
 cppcanvas/source/wrapper/vclfactory.cxx                         |    2 
 dbaccess/source/ui/app/AppView.cxx                              |    2 
 dbaccess/source/ui/querydesign/JoinTableView.cxx                |    2 
 dbaccess/source/ui/querydesign/TableWindow.cxx                  |    2 
 desktop/source/splash/splash.cxx                                |    6 
 editeng/source/editeng/editeng.cxx                              |    6 
 editeng/source/editeng/impedit.cxx                              |    8 
 editeng/source/editeng/impedit2.cxx                             |    2 
 editeng/source/editeng/impedit3.cxx                             |    3 
 editeng/source/uno/unoviwou.cxx                                 |    4 
 forms/source/richtext/richtextimplcontrol.cxx                   |    6 
 framework/source/helper/vclstatusindicator.cxx                  |    2 
 include/sfx2/LokControlHandler.hxx                              |    4 
 include/svtools/brwbox.hxx                                      |    4 
 include/toolkit/awt/vclxwindow.hxx                              |   10 
 include/vcl/outdev.hxx                                          |    5 
 include/vcl/toolbox.hxx                                         |    2 
 include/vcl/toolkit/ivctrl.hxx                                  |    2 
 include/vcl/window.hxx                                          |  179 ++++-
 qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java       |    3 
 reportdesign/source/ui/inc/UITools.hxx                          |    2 
 reportdesign/source/ui/misc/UITools.cxx                         |    2 
 reportdesign/source/ui/report/DesignView.cxx                    |    2 
 reportdesign/source/ui/report/EndMarker.cxx                     |    4 
 reportdesign/source/ui/report/FixedTextColor.cxx                |    2 
 reportdesign/source/ui/report/FormattedFieldBeautifier.cxx      |    2 
 reportdesign/source/ui/report/ReportController.cxx              |    6 
 reportdesign/source/ui/report/ReportSection.cxx                 |    2 
 reportdesign/source/ui/report/ScrollHelper.cxx                  |    2 
 reportdesign/source/ui/report/SectionView.cxx                   |    4 
 reportdesign/source/ui/report/StartMarker.cxx                   |    2 
 reportdesign/source/ui/report/dlgedfunc.cxx                     |    8 
 sc/source/ui/Accessibility/AccessibleEditObject.cxx             |    2 
 sc/source/ui/app/scmod.cxx                                      |    2 
 sc/source/ui/drawfunc/fuconpol.cxx                              |    6 
 sc/source/ui/drawfunc/fudraw.cxx                                |    4 
 sc/source/ui/drawfunc/fusel.cxx                                 |    2 
 sc/source/ui/drawfunc/futext.cxx                                |   10 
 sc/source/ui/drawfunc/futext2.cxx                               |    2 
 sc/source/ui/unoobj/viewuno.cxx                                 |    4 
 sc/source/ui/view/colrowba.cxx                                  |    4 
 sc/source/ui/view/drawview.cxx                                  |    2 
 sc/source/ui/view/gridwin.cxx                                   |   26 
 sc/source/ui/view/gridwin2.cxx                                  |    4 
 sc/source/ui/view/gridwin3.cxx                                  |    2 
 sc/source/ui/view/gridwin4.cxx                                  |   10 
 sc/source/ui/view/gridwin5.cxx                                  |    2 
 sc/source/ui/view/gridwin_dbgutil.cxx                           |    2 
 sc/source/ui/view/hdrcont.cxx                                   |   46 -
 sc/source/ui/view/notemark.cxx                                  |    8 
 sc/source/ui/view/olinewin.cxx                                  |   32 
 sc/source/ui/view/preview.cxx                                   |   82 +-
 sc/source/ui/view/prevwsh.cxx                                   |    4 
 sc/source/ui/view/spelldialog.cxx                               |    2 
 sc/source/ui/view/tabsplit.cxx                                  |    2 
 sc/source/ui/view/tabview5.cxx                                  |   10 
 sc/source/ui/view/tabvwsh2.cxx                                  |    2 
 sc/source/ui/view/viewdata.cxx                                  |    8 
 sc/source/ui/view/viewfun4.cxx                                  |    4 
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx       |    2 
 sd/source/ui/accessibility/AccessibleViewForwarder.cxx          |    3 
 sd/source/ui/animations/motionpathtag.cxx                       |    4 
 sd/source/ui/annotations/annotationtag.cxx                      |    5 
 sd/source/ui/dlg/animobjs.cxx                                   |    2 
 sd/source/ui/func/fuconbez.cxx                                  |    4 
 sd/source/ui/func/fudraw.cxx                                    |    6 
 sd/source/ui/func/fuediglu.cxx                                  |   10 
 sd/source/ui/func/fusnapln.cxx                                  |    2 
 sd/source/ui/func/futext.cxx                                    |    4 
 sd/source/ui/slideshow/showwin.cxx                              |   34 -
 sd/source/ui/slideshow/slideshow.cxx                            |    2 
 sd/source/ui/slideshow/slideshowimpl.cxx                        |    8 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx   |    6 
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx         |    8 
 sd/source/ui/slidesorter/view/SlideSorterView.cxx               |    4 
 sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx             |    2 
 sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx  |    2 
 sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx              |    8 
 sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx         |    2 
 sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx          |    2 
 sd/source/ui/unoidl/DrawController.cxx                          |    4 
 sd/source/ui/view/WindowUpdater.cxx                             |    4 
 sd/source/ui/view/drviews1.cxx                                  |    2 
 sd/source/ui/view/drviews2.cxx                                  |    2 
 sd/source/ui/view/drviews3.cxx                                  |    2 
 sd/source/ui/view/drviews4.cxx                                  |    4 
 sd/source/ui/view/drviews5.cxx                                  |   12 
 sd/source/ui/view/drviewsa.cxx                                  |    2 
 sd/source/ui/view/drviewsf.cxx                                  |    2 
 sd/source/ui/view/drviewsh.cxx                                  |    4 
 sd/source/ui/view/outlview.cxx                                  |    4 
 sd/source/ui/view/sdview.cxx                                    |    3 
 sd/source/ui/view/sdview4.cxx                                   |    2 
 sd/source/ui/view/sdwindow.cxx                                  |    6 
 sd/source/ui/view/viewoverlaymanager.cxx                        |    2 
 sd/source/ui/view/viewshe2.cxx                                  |   16 
 sd/source/ui/view/viewshel.cxx                                  |    4 
 sfx2/source/doc/doctemplates.cxx                                |    2 
 sfx2/source/sidebar/SidebarController.cxx                       |    2 
 starmath/source/document.cxx                                    |    2 
 svtools/source/brwbox/brwbox1.cxx                               |    6 
 svtools/source/brwbox/brwbox2.cxx                               |   18 
 svtools/source/brwbox/brwbox3.cxx                               |    2 
 svtools/source/brwbox/datwin.cxx                                |    6 
 svtools/source/brwbox/editbrowsebox.cxx                         |   10 
 svtools/source/control/ruler.cxx                                |   16 
 svtools/source/control/tabbar.cxx                               |   38 -
 svtools/source/table/tablecontrol.cxx                           |    2 
 svtools/source/table/tabledatawindow.cxx                        |    4 
 svx/source/accessibility/AccessibleControlShape.cxx             |    6 
 svx/source/accessibility/AccessibleShape.cxx                    |    4 
 svx/source/accessibility/GraphCtlAccessibleContext.cxx          |    2 
 svx/source/dialog/svxruler.cxx                                  |    4 
 svx/source/fmcomp/gridcell.cxx                                  |   12 
 svx/source/fmcomp/gridctrl.cxx                                  |    6 
 svx/source/form/fmshell.cxx                                     |    4 
 svx/source/form/fmshimp.cxx                                     |    2 
 svx/source/form/fmview.cxx                                      |    6 
 svx/source/form/fmvwimp.cxx                                     |   14 
 svx/source/form/navigatortree.cxx                               |    4 
 svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx       |    2 
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx        |    8 
 svx/source/sdr/overlay/overlaymanager.cxx                       |    2 
 svx/source/sdr/overlay/overlaymanagerbuffered.cxx               |   10 
 svx/source/svdraw/sdrpagewindow.cxx                             |    4 
 svx/source/svdraw/sdrpaintwindow.cxx                            |    6 
 svx/source/svdraw/svdedxv.cxx                                   |   47 -
 svx/source/svdraw/svdmrkv.cxx                                   |    9 
 svx/source/svdraw/svdpntv.cxx                                   |   18 
 svx/source/svdraw/svdview.cxx                                   |   16 
 svx/source/table/accessiblecell.cxx                             |    2 
 svx/source/table/tablecontroller.cxx                            |    2 
 svx/source/tbxctrls/tbxcolorupdate.cxx                          |    2 
 sw/source/core/access/accmap.cxx                                |    6 
 sw/source/core/crsr/viscrs.cxx                                  |    2 
 sw/source/core/doc/notxtfrm.cxx                                 |    4 
 sw/source/core/frmedt/fecopy.cxx                                |    2 
 sw/source/core/layout/layact.cxx                                |   10 
 sw/source/core/layout/paintfrm.cxx                              |    4 
 sw/source/core/text/itratr.cxx                                  |    2 
 sw/source/core/text/porrst.cxx                                  |    2 
 sw/source/core/text/txtdrop.cxx                                 |    2 
 sw/source/core/txtnode/fntcache.cxx                             |    4 
 sw/source/core/view/viewimp.cxx                                 |    3 
 sw/source/core/view/viewsh.cxx                                  |   32 
 sw/source/core/view/vnew.cxx                                    |   10 
 sw/source/filter/html/htmlform.cxx                              |    2 
 sw/source/filter/html/htmlforw.cxx                              |    2 
 sw/source/uibase/docvw/PageBreakWin.cxx                         |    2 
 sw/source/uibase/docvw/edtwin.cxx                               |   14 
 sw/source/uibase/docvw/edtwin2.cxx                              |    2 
 sw/source/uibase/docvw/srcedtw.cxx                              |    6 
 sw/source/uibase/inc/srcedtw.hxx                                |    1 
 sw/source/uibase/misc/swruler.cxx                               |    2 
 sw/source/uibase/shells/txtcrsr.cxx                             |    4 
 sw/source/uibase/uiview/pview.cxx                               |   14 
 sw/source/uibase/uiview/view.cxx                                |    2 
 sw/source/uibase/uiview/viewport.cxx                            |    4 
 sw/source/uibase/uno/unotxvw.cxx                                |    4 
 sw/source/uibase/utlui/shdwcrsr.cxx                             |   12 
 toolkit/source/awt/vclxcontainer.cxx                            |   10 
 toolkit/source/awt/vclxwindow.cxx                               |   23 
 toolkit/source/awt/vclxwindows.cxx                              |    8 
 toolkit/source/controls/unocontrol.cxx                          |    4 
 toolkit/source/helper/btndlg.cxx                                |    2 
 vcl/headless/svpgdi.cxx                                         |   13 
 vcl/inc/brdwin.hxx                                              |    1 
 vcl/inc/svdata.hxx                                              |    4 
 vcl/inc/window.h                                                |    5 
 vcl/inc/windowdev.hxx                                           |   82 ++
 vcl/qa/cppunit/complextext.cxx                                  |    4 
 vcl/qa/cppunit/outdev.cxx                                       |   11 
 vcl/source/app/help.cxx                                         |    8 
 vcl/source/app/salvtables.cxx                                   |   25 
 vcl/source/app/svapp.cxx                                        |   18 
 vcl/source/app/svdata.cxx                                       |    1 
 vcl/source/app/svmain.cxx                                       |    1 
 vcl/source/app/weldutils.cxx                                    |    6 
 vcl/source/control/PriorityHBox.cxx                             |    6 
 vcl/source/control/PriorityMergedHBox.cxx                       |    4 
 vcl/source/control/button.cxx                                   |   12 
 vcl/source/control/calendar.cxx                                 |    2 
 vcl/source/control/combobox.cxx                                 |    2 
 vcl/source/control/ctrl.cxx                                     |    6 
 vcl/source/control/edit.cxx                                     |   32 
 vcl/source/control/fixed.cxx                                    |   38 -
 vcl/source/control/fixedhyper.cxx                               |    4 
 vcl/source/control/imgctrl.cxx                                  |   18 
 vcl/source/control/imivctl1.cxx                                 |    6 
 vcl/source/control/imp_listbox.cxx                              |   26 
 vcl/source/control/ivctrl.cxx                                   |    6 
 vcl/source/control/listbox.cxx                                  |    6 
 vcl/source/control/notebookbar.cxx                              |    4 
 vcl/source/control/prgsbar.cxx                                  |    4 
 vcl/source/control/scrbar.cxx                                   |   46 -
 vcl/source/control/spinbtn.cxx                                  |   10 
 vcl/source/control/spinfld.cxx                                  |   24 
 vcl/source/control/tabctrl.cxx                                  |    6 
 vcl/source/edit/texteng.cxx                                     |    2 
 vcl/source/edit/textview.cxx                                    |    2 
 vcl/source/edit/vclmedit.cxx                                    |    2 
 vcl/source/gdi/gdimtf.cxx                                       |    6 
 vcl/source/gdi/impanmvw.cxx                                     |    4 
 vcl/source/gdi/virdev.cxx                                       |    2 
 vcl/source/outdev/font.cxx                                      |    8 
 vcl/source/toolkit/group.cxx                                    |    2 
 vcl/source/treelist/headbar.cxx                                 |   30 
 vcl/source/treelist/svimpbox.cxx                                |   24 
 vcl/source/treelist/svlbitm.cxx                                 |    8 
 vcl/source/treelist/svtabbx.cxx                                 |    2 
 vcl/source/treelist/treelistbox.cxx                             |    6 
 vcl/source/uitest/uiobject.cxx                                  |    4 
 vcl/source/window/accessibility.cxx                             |    2 
 vcl/source/window/brdwin.cxx                                    |   26 
 vcl/source/window/bubblewindow.cxx                              |   20 
 vcl/source/window/clipping.cxx                                  |   52 -
 vcl/source/window/cursor.cxx                                    |    4 
 vcl/source/window/decoview.cxx                                  |    8 
 vcl/source/window/dndeventdispatcher.cxx                        |    2 
 vcl/source/window/dockmgr.cxx                                   |    2 
 vcl/source/window/dockwin.cxx                                   |    2 
 vcl/source/window/event.cxx                                     |    4 
 vcl/source/window/floatwin.cxx                                  |    6 
 vcl/source/window/globalization.cxx                             |   17 
 vcl/source/window/layout.cxx                                    |    2 
 vcl/source/window/menu.cxx                                      |   18 
 vcl/source/window/menubarwindow.cxx                             |    8 
 vcl/source/window/menufloatingwindow.cxx                        |   12 
 vcl/source/window/menuwindow.cxx                                |    2 
 vcl/source/window/mouse.cxx                                     |   20 
 vcl/source/window/paint.cxx                                     |  183 ++---
 vcl/source/window/settings.cxx                                  |   30 
 vcl/source/window/split.cxx                                     |   12 
 vcl/source/window/stacking.cxx                                  |    2 
 vcl/source/window/status.cxx                                    |   10 
 vcl/source/window/syswin.cxx                                    |    2 
 vcl/source/window/toolbox.cxx                                   |   22 
 vcl/source/window/toolbox2.cxx                                  |    8 
 vcl/source/window/window.cxx                                    |  328 
+++++-----
 vcl/source/window/window2.cxx                                   |   35 -
 vcl/source/window/window3.cxx                                   |  244 +++++++
 vcl/source/window/winproc.cxx                                   |   12 
 vcl/source/window/wrkwin.cxx                                    |    2 
 vcl/unx/generic/gdi/salgdi.cxx                                  |    4 
 vcl/unx/gtk3/gtkframe.cxx                                       |    2 
 vcl/workben/mtfdemo.cxx                                         |    2 
 vcl/workben/svptest.cxx                                         |    2 
 vcl/workben/vcldemo.cxx                                         |   20 
 270 files changed, 1766 insertions(+), 1271 deletions(-)

New commits:
commit 9090dc1f3b27195f5defd35586ac79357992be21
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Jan 18 18:27:19 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon May 17 12:56:51 2021 +0200

    split OutputDevice from Window
    
    as part of a longer-term goal of doing our
    widget rendering only inside a top-level render-
    context.
    
    I moved all of the OutputDevice-related code that existed in vcl::Window
    into a new subclass of OutputDevice called WindowOutputDevice.
    
    Notes for further work
    
    (*) not sure why we are getting an 1x1 surface in
        SvpSalGraphics::releaseCairoContext, but to fix it I clamp
        the size there
    
    (*) might have to dump VCLXDevice, and move it's code down into VCLXWindow 
and VCLXVirtualDevice
    
    (*) can we remove use of VCLXDevice in other places, in favour of just 
talking to the VCL code?
    
    Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 5a1bae42fd93..7d06e117d072 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1239,13 +1239,13 @@ void EditorWindow::ImplSetFont()
     {
         vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DefaultFontType::FIXED,
                                                         
Application::GetSettings().GetUILanguageTag().getLanguageType(),
-                                                        
GetDefaultFontFlags::NONE, this));
+                                                        
GetDefaultFontFlags::NONE, GetOutDev()));
         sFontName = aTmpFont.GetFamilyName();
     }
     Size aFontSize(0, 
officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
     vcl::Font aFont(sFontName, aFontSize);
     aFont.SetColor(rModulWindow.GetLayout().GetFontColor());
-    SetPointFont(*this, aFont); // FIXME RenderContext
+    SetPointFont(*GetOutDev(), aFont); // FIXME RenderContext
     aFont = GetFont();
 
     rModulWindow.GetBreakPointWindow().SetFont(aFont);
@@ -1330,7 +1330,7 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong 
nPara, bool bInserted )
         rModulWindow.GetBreakPoints().AdjustBreakPoints( 
static_cast<sal_uInt16>(nPara)+1, bInserted );
 
         tools::Long nLineHeight = GetTextHeight();
-        Size aSz = rModulWindow.GetBreakPointWindow().GetOutputSize();
+        Size aSz = 
rModulWindow.GetBreakPointWindow().GetOutDev()->GetOutputSize();
         tools::Rectangle aInvRect( Point( 0, 0 ), aSz );
         tools::Long nY = nPara*nLineHeight - 
rModulWindow.GetBreakPointWindow().GetCurYOffset();
         aInvRect.SetTop( nY );
@@ -1417,7 +1417,7 @@ void BreakPointWindow::ShowMarker(vcl::RenderContext& 
rRenderContext)
     if (nMarkerPos == NoMarker)
         return;
 
-    Size const aOutSz = GetOutputSize();
+    Size const aOutSz = GetOutDev()->GetOutputSize();
     tools::Long const nLineHeight = GetTextHeight();
 
     Image aMarker = GetImage(OUString(bErrorMarker ? std::u16string_view(u"" 
RID_BMP_ERRORMARKER) : std::u16string_view(u"" RID_BMP_STEPMARKER)));
diff --git a/basctl/source/basicide/baside3.cxx 
b/basctl/source/basicide/baside3.cxx
index 69fc19b74329..b2ed314ebf25 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1232,7 +1232,7 @@ void DialogWindow::InitSettings()
     // FIXME RenderContext
     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     vcl::Font aFont = rStyleSettings.GetFieldFont();
-    SetPointFont(*this, aFont);
+    SetPointFont(*GetOutDev(), aFont);
 
     SetTextColor( rStyleSettings.GetFieldTextColor() );
     SetTextFillColor();
diff --git a/basctl/source/basicide/layout.cxx 
b/basctl/source/basicide/layout.cxx
index 8ec80e8e20a4..e6b6676ed6c6 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -420,8 +420,8 @@ void Layout::SplittedSide::InitSplitter (Splitter& 
rSplitter)
     rSplitter.SetSplitHdl(LINK(this, SplittedSide, SplitHdl));
     // color
     Color aColor = rLayout.GetSettings().GetStyleSettings().GetShadowColor();
-    rSplitter.SetLineColor(aColor);
-    rSplitter.SetFillColor(aColor);
+    rSplitter.GetOutDev()->SetLineColor(aColor);
+    rSplitter.GetOutDev()->SetFillColor(aColor);
 }
 
 
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 2d5154a6f8e0..34467260c140 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -198,7 +198,7 @@ DlgEditor::DlgEditor (
     ,m_xDocument( xModel )
 {
     pDlgEdModel->GetItemPool().FreezeIdRanges();
-    pDlgEdView.reset(new DlgEdView(*pDlgEdModel, rWindow_, *this));
+    pDlgEdView.reset(new DlgEdView(*pDlgEdModel, *rWindow_.GetOutDev(), 
*this));
     pDlgEdModel->SetScaleUnit( MapUnit::Map100thMM );
 
     SdrLayerAdmin& rAdmin = pDlgEdModel->GetLayerAdmin();
@@ -274,7 +274,7 @@ void DlgEditor::InitScrollBars()
     if ( !pHScroll || !pVScroll )
         return;
 
-    Size aOutSize = rWindow.GetOutputSize();
+    Size aOutSize = rWindow.GetOutDev()->GetOutputSize();
     Size aPgSize  = pDlgEdPage->GetSize();
 
     pHScroll->SetRange( Range( 0, aPgSize.Width()  ));
diff --git a/basctl/source/dlged/dlgedfunc.cxx 
b/basctl/source/dlged/dlgedfunc.cxx
index b16cf695a26a..593f0370f635 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -342,7 +342,7 @@ void DlgEdFuncInsert::MouseButtonDown( const MouseEvent& 
rMEvt )
 
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     Point aPos = rWindow.PixelToLogic( rMEvt.GetPosPixel() );
     sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
@@ -378,7 +378,7 @@ bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& 
rMEvt )
 
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     rWindow.ReleaseMouse();
 
@@ -408,7 +408,7 @@ void DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
 {
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     Point aPos = rWindow.PixelToLogic(rMEvt.GetPosPixel());
     sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
@@ -419,7 +419,7 @@ void DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
         rView.MovAction(aPos);
     }
 
-    rWindow.SetPointer( rView.GetPreferredPointer( aPos, &rWindow, nHitLog ) );
+    rWindow.SetPointer( rView.GetPreferredPointer( aPos, rWindow.GetOutDev(), 
nHitLog ) );
 }
 
 DlgEdFuncSelect::DlgEdFuncSelect (DlgEditor& rParent_) :
@@ -436,7 +436,7 @@ void DlgEdFuncSelect::MouseButtonDown( const MouseEvent& 
rMEvt )
     // get view from parent
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     sal_uInt16 nDrgLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
     sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
@@ -497,7 +497,7 @@ bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& 
rMEvt )
     // get view from parent
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel());
     sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
@@ -516,7 +516,7 @@ bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& 
rMEvt )
         }
     }
 
-    rWindow.SetPointer( rView.GetPreferredPointer( aPnt, &rWindow, nHitLog ) );
+    rWindow.SetPointer( rView.GetPreferredPointer( aPnt, rWindow.GetOutDev(), 
nHitLog ) );
     rWindow.ReleaseMouse();
 
     return true;
@@ -526,7 +526,7 @@ void DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
 {
     SdrView& rView  = rParent.GetView();
     vcl::Window& rWindow = rParent.GetWindow();
-    rView.SetActualWin(&rWindow);
+    rView.SetActualWin(rWindow.GetOutDev());
 
     Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel());
     sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 
0)).Width());
@@ -540,7 +540,7 @@ void DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
         rView.MovAction(aPnt_);
     }
 
-    rWindow.SetPointer( rView.GetPreferredPointer( aPnt, &rWindow, nHitLog ) );
+    rWindow.SetPointer( rView.GetPreferredPointer( aPnt, rWindow.GetOutDev(), 
nHitLog ) );
 }
 
 } // namespace basctl
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index e4047abace14..6353ddf9ecd6 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -152,7 +152,7 @@ uno::Reference< awt::XControl > DlgEdObj::GetControl() const
     if (DlgEdForm const* pForm = GetDlgEdForm())
     {
         DlgEditor const& rEditor = pForm->GetDlgEditor();
-        xControl = GetUnoControl(rEditor.GetView(), rEditor.GetWindow());
+        xControl = GetUnoControl(rEditor.GetView(), 
*rEditor.GetWindow().GetOutDev());
     }
     return xControl;
 }
diff --git a/basctl/source/dlged/dlgedview.cxx 
b/basctl/source/dlged/dlgedview.cxx
index f9371b10bac3..0878596d8f41 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -58,7 +58,7 @@ void DlgEdView::MakeVisible( const tools::Rectangle& rRect, 
vcl::Window& rWin )
     // visible area
     MapMode aMap( rWin.GetMapMode() );
     Point aOrg( aMap.GetOrigin() );
-    Size aVisSize( rWin.GetOutputSize() );
+    Size aVisSize( rWin.GetOutDev()->GetOutputSize() );
     tools::Rectangle RectTmp( Point(-aOrg.X(),-aOrg.Y()), aVisSize );
     tools::Rectangle aVisRect( RectTmp );
 
diff --git a/canvas/source/cairo/cairo_canvas.cxx 
b/canvas/source/cairo/cairo_canvas.cxx
index 10edc0681843..5b727905673a 100644
--- a/canvas/source/cairo/cairo_canvas.cxx
+++ b/canvas/source/cairo/cairo_canvas.cxx
@@ -26,6 +26,7 @@
 #include <tools/diagnose_ex.h>
 #include <vcl/sysdata.hxx>
 #include <vcl/skia/SkiaHelper.hxx>
+#include <vcl/window.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
 #include "cairo_canvas.hxx"
@@ -68,7 +69,6 @@ namespace cairocanvas
         sal_Int64 nPtr = 0;
         maArguments[0] >>= nPtr;
         OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr);
-
         ENSURE_ARG_OR_THROW( pOutDev != nullptr,
                              "Canvas::initialize: invalid OutDev pointer" );
 
diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx 
b/canvas/source/cairo/cairo_spritecanvas.cxx
index 91ac7c376b4d..562157f52c60 100644
--- a/canvas/source/cairo/cairo_spritecanvas.cxx
+++ b/canvas/source/cairo/cairo_spritecanvas.cxx
@@ -77,7 +77,7 @@ namespace cairocanvas
             throw lang::NoSupportException(
                 "Parent window not VCL window, or canvas out-of-process!", 
nullptr);
 
-        bool bHasCairo = pParentWindow->SupportsCairo();
+        bool bHasCairo = pParentWindow->GetOutDev()->SupportsCairo();
         ENSURE_ARG_OR_THROW(bHasCairo,
                             "CairoSpriteCanvas::SpriteCanvas: No Cairo 
capability");
 
diff --git a/canvas/source/cairo/cairo_spritedevicehelper.cxx 
b/canvas/source/cairo/cairo_spritedevicehelper.cxx
index 825d6f343b43..f2d018937be2 100644
--- a/canvas/source/cairo/cairo_spritedevicehelper.cxx
+++ b/canvas/source/cairo/cairo_spritedevicehelper.cxx
@@ -46,7 +46,7 @@ namespace cairocanvas
                                    bool                      bFullscreen )
     {
         DeviceHelper::init(rSpriteCanvas,
-                           rOutputWindow);
+                           *rOutputWindow.GetOutDev());
 
         mpSpriteCanvas = &rSpriteCanvas;
         mbFullScreen = bFullscreen;
diff --git a/canvas/source/directx/dx_canvas.cxx 
b/canvas/source/directx/dx_canvas.cxx
index 3d5bda00288b..7f29813c953b 100644
--- a/canvas/source/directx/dx_canvas.cxx
+++ b/canvas/source/directx/dx_canvas.cxx
@@ -39,6 +39,7 @@
 #include <tools/diagnose_ex.h>
 #include <vcl/sysdata.hxx>
 #include <vcl/skia/SkiaHelper.hxx>
+#include <vcl/window.hxx>
 
 #include <canvas/canvastools.hxx>
 
diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx
index e9ebf85b3b3a..2ad0a61fc9fd 100644
--- a/canvas/source/vcl/canvas.cxx
+++ b/canvas/source/vcl/canvas.cxx
@@ -25,6 +25,7 @@
 #include <sal/log.hxx>
 #include <tools/diagnose_ex.h>
 #include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
 
 #include "outdevholder.hxx"
 
diff --git a/canvas/source/vcl/outdevholder.hxx 
b/canvas/source/vcl/outdevholder.hxx
index 78f3badf8bb6..28dfd4317fe0 100644
--- a/canvas/source/vcl/outdevholder.hxx
+++ b/canvas/source/vcl/outdevholder.hxx
@@ -35,6 +35,7 @@ public:
     explicit OutDevHolder(OutputDevice& rOutDev)
         : mrOutDev(rOutDev)
     {
+        assert(&rOutDev);
     }
 
 private:
diff --git a/canvas/source/vcl/spritecanvashelper.cxx 
b/canvas/source/vcl/spritecanvashelper.cxx
index 0c1a454c3260..1796c8ac7ffe 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -220,7 +220,7 @@ namespace vclcanvas
         vcl::Window* pTargetWindow = nullptr;
         if( rOutDev.GetOutDevType() == OUTDEV_WINDOW )
         {
-            pTargetWindow = &static_cast<vcl::Window&>(rOutDev); // TODO(Q3): 
Evil downcast.
+            pTargetWindow = rOutDev.GetOwnerWindow(); // TODO(Q3): Evil 
downcast.
 
             // we're double-buffered, thus no need for paint area-limiting
             // clips. besides that, will interfere with animations (as for
@@ -309,7 +309,7 @@ namespace vclcanvas
         if( pTargetWindow )
         {
             // commit to screen
-            pTargetWindow->Flush();
+            pTargetWindow->GetOutDev()->Flush();
         }
 
         return true;
diff --git a/canvas/source/vcl/windowoutdevholder.hxx 
b/canvas/source/vcl/windowoutdevholder.hxx
index d9d69e9a37c9..87138a8a9106 100644
--- a/canvas/source/vcl/windowoutdevholder.hxx
+++ b/canvas/source/vcl/windowoutdevholder.hxx
@@ -36,8 +36,8 @@ namespace vclcanvas
         explicit WindowOutDevHolder( const css::uno::Reference< 
css::awt::XWindow>& xWin );
 
     private:
-        virtual OutputDevice&       getOutDev() override { return 
mrOutputWindow; }
-        virtual const OutputDevice& getOutDev() const override { return 
mrOutputWindow; }
+        virtual OutputDevice&       getOutDev() override { return 
*mrOutputWindow.GetOutDev(); }
+        virtual const OutputDevice& getOutDev() const override { return 
*mrOutputWindow.GetOutDev(); }
 
         // TODO(Q2): Lifetime issue. Though WindowGraphicDeviceBase
         // now listens to the window component, I still consider
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index e19e1f45f2af..9d48b84132d6 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -536,7 +536,7 @@ void TestWindow::Paint(vcl::RenderContext&, const 
tools::Rectangle&)
 {
     try
     {
-        uno::Reference< rendering::XCanvas > xVDevCanvas( GetCanvas(),
+        uno::Reference< rendering::XCanvas > xVDevCanvas( 
GetOutDev()->GetCanvas(),
                                                           uno::UNO_SET_THROW );
         uno::Reference< rendering::XGraphicDevice > xVDevDevice( 
xVDevCanvas->getDevice(),
                                                                  
uno::UNO_SET_THROW );
@@ -551,7 +551,7 @@ void TestWindow::Paint(vcl::RenderContext&, const 
tools::Rectangle&)
         aVDevRenderer.drawArcs();
         aVDevRenderer.drawPolygons();
 
-        uno::Reference< rendering::XCanvas > xCanvas( GetSpriteCanvas(),
+        uno::Reference< rendering::XCanvas > xCanvas( 
GetOutDev()->GetSpriteCanvas(),
                                                           uno::UNO_QUERY_THROW 
);
         uno::Reference< rendering::XGraphicDevice > xDevice( 
xCanvas->getDevice(),
                                                              
uno::UNO_SET_THROW );
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx 
b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
index 620897210db1..d2b56b2b7364 100644
--- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -84,7 +84,7 @@ void SAL_CALL AccessibleTextHelper::initialize( const 
Sequence< uno::Any >& aArg
             SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID 
);
             if( pTextObj )
             {
-                m_pTextHelper.reset( new 
::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj,
 nullptr, *pView, *pWindow)) );
+                m_pTextHelper.reset( new 
::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj,
 nullptr, *pView, *pWindow->GetOutDev())) );
                 m_pTextHelper->SetEventSource( xEventSource );
             }
         }
diff --git a/chart2/source/controller/main/ChartController.cxx 
b/chart2/source/controller/main/ChartController.cxx
index 08b8c65c31f7..5adc15f78a09 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -718,7 +718,7 @@ void ChartController::impl_createDrawViewController()
     {
         if( m_pDrawModelWrapper )
         {
-            m_pDrawViewWrapper.reset( new 
DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()) );
+            m_pDrawViewWrapper.reset( new 
DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()->GetOutDev())
 );
             m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
         }
     }
diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index afd4de8a5e75..a63da0791c30 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -279,7 +279,7 @@ void SAL_CALL ChartController::setPosSize(
     //a correct work area is at least necessary for correct values in the 
position and  size dialog and for dragging area
     if(m_pDrawViewWrapper)
     {
-        tools::Rectangle aRect(Point(0,0), pChartWindow->GetOutputSize());
+        tools::Rectangle aRect(Point(0,0), 
pChartWindow->GetOutDev()->GetOutputSize());
         m_pDrawViewWrapper->SetWorkArea( aRect );
     }
     pChartWindow->Invalidate();
@@ -600,7 +600,7 @@ void ChartController::execute_MouseButtonDown( const 
MouseEvent& rMEvt )
              // #i12587# support for shapes in chart
              ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, 
SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SdrHitKind::MarkedObject ) )
         {
-            pDrawViewWrapper->MouseButtonDown(rMEvt, pChartWindow);
+            pDrawViewWrapper->MouseButtonDown(rMEvt, 
pChartWindow->GetOutDev());
             return;
         }
         else
@@ -725,7 +725,7 @@ void ChartController::execute_MouseMove( const MouseEvent& 
rMEvt )
 
     if( m_pDrawViewWrapper->IsTextEdit() )
     {
-        if( m_pDrawViewWrapper->MouseMove(rMEvt,pChartWindow) )
+        if( m_pDrawViewWrapper->MouseMove(rMEvt,pChartWindow->GetOutDev()) )
             return;
     }
 
@@ -771,7 +771,7 @@ void ChartController::execute_MouseButtonUp( const 
MouseEvent& rMEvt )
 
         if(pDrawViewWrapper->IsTextEdit())
         {
-            if( pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow) )
+            if( 
pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow->GetOutDev()) )
                 return;
         }
 
@@ -1925,7 +1925,7 @@ void ChartController::impl_SetMousePointer( const 
MouseEvent & rEvent )
         if( m_pDrawViewWrapper->IsTextEditHit( aMousePos ) )
         {
             pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer(
-                aMousePos, pChartWindow, nModifier, bLeftDown ) );
+                aMousePos, pChartWindow->GetOutDev(), nModifier, bLeftDown ) );
             return;
         }
     }
@@ -1941,7 +1941,7 @@ void ChartController::impl_SetMousePointer( const 
MouseEvent & rEvent )
     if( pHitSelectionHdl )
     {
         PointerStyle aPointer = m_pDrawViewWrapper->GetPreferredPointer(
-            aMousePos, pChartWindow, nModifier, bLeftDown );
+            aMousePos, pChartWindow->GetOutDev(), nModifier, bLeftDown );
         bool bForceArrowPointer = false;
 
         ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
diff --git a/chart2/source/controller/main/ChartWindow.cxx 
b/chart2/source/controller/main/ChartWindow.cxx
index 6ab1fae77b99..73e642446be1 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -61,7 +61,7 @@ ChartWindow::ChartWindow( ChartController* pController, 
vcl::Window* pParent, Wi
     SetMapMode( MapMode(MapUnit::Map100thMM) );
     adjustHighContrastMode();
     // chart does not depend on exact pixel painting => enable antialiased 
drawing
-    SetAntialiasing( AntialiasingFlags::Enable | GetAntialiasing() );
+    GetOutDev()->SetAntialiasing( AntialiasingFlags::Enable | 
GetOutDev()->GetAntialiasing() );
     EnableRTL( false );
     if( pParent )
         pParent->EnableRTL( false );// #i96215# necessary for a correct 
position of the context menu in rtl mode
@@ -252,7 +252,7 @@ void ChartWindow::adjustHighContrastMode()
         DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
 
     bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
-    SetDrawMode( bUseContrast ? nContrastMode : DrawModeFlags::Default );
+    GetOutDev()->SetDrawMode( bUseContrast ? nContrastMode : 
DrawModeFlags::Default );
 }
 
 void ChartWindow::ForceInvalidate()
diff --git a/compilerplugins/clang/vclwidgets.cxx 
b/compilerplugins/clang/vclwidgets.cxx
index 92bc4a0c3911..804b4cc26489 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -596,11 +596,13 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* 
functionDecl )
         // check the last thing that the dispose() method does, is to call 
into the superclass dispose method
         if (loplugin::DeclCheck(functionDecl).Function("dispose")) {
             if (!isDisposeCallingSuperclassDispose(pMethodDecl)) {
-                report(
-                    DiagnosticsEngine::Warning,
-                    BASE_REF_COUNTED_CLASS " subclass dispose() function MUST 
call dispose() of its superclass as the last thing it does",
-                    compat::getBeginLoc(functionDecl))
-                  << functionDecl->getSourceRange();
+                // We specifically have to clear a member variable AFTER 
calling super::dispose() here, unfortunately
+                if 
(!loplugin::DeclCheck(pMethodDecl->getParent()).Class("WindowOutputDevice"))
+                    report(
+                        DiagnosticsEngine::Warning,
+                        BASE_REF_COUNTED_CLASS " subclass dispose() function 
MUST call dispose() of its superclass as the last thing it does",
+                        compat::getBeginLoc(functionDecl))
+                      << functionDecl->getSourceRange();
            }
         }
     }
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
index c02d466dfedd..7c5ca6b9d2c6 100644
--- a/cppcanvas/qa/unit/test.cxx
+++ b/cppcanvas/qa/unit/test.cxx
@@ -37,7 +37,7 @@ void CanvasTest::testComposite()
 #ifdef LINUX
     ScopedVclPtrInstance<WorkWindow> pWin( nullptr, WB_STDWORK );
 
-    uno::Reference<rendering::XCanvas> xCanvas = pWin->GetCanvas ();
+    uno::Reference<rendering::XCanvas> xCanvas = pWin->GetOutDev()->GetCanvas 
();
     if( !xCanvas.is() )
         return; // can't get a canvas working at all - truly headless ?
 
diff --git a/cppcanvas/source/wrapper/vclfactory.cxx 
b/cppcanvas/source/wrapper/vclfactory.cxx
index a750b2e88066..825368859d1e 100644
--- a/cppcanvas/source/wrapper/vclfactory.cxx
+++ b/cppcanvas/source/wrapper/vclfactory.cxx
@@ -45,7 +45,7 @@ namespace cppcanvas
     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const vcl::Window& 
rVCLWindow )
     {
         return std::make_shared<internal::ImplSpriteCanvas>(
-                    rVCLWindow.GetSpriteCanvas() );
+                    rVCLWindow.GetOutDev()->GetSpriteCanvas() );
     }
 
     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const 
uno::Reference< rendering::XSpriteCanvas >& xCanvas )
diff --git a/dbaccess/source/ui/app/AppView.cxx 
b/dbaccess/source/ui/app/AppView.cxx
index 5873bc712404..b300df8dfe6c 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -462,7 +462,7 @@ void OApplicationView::ImplInitSettings()
 
     vcl::Font aFont = rStyleSettings.GetFieldFont();
     aFont.SetColor( rStyleSettings.GetWindowTextColor() );
-    SetPointFont(*this, aFont);
+    SetPointFont(*GetOutDev(), aFont);
 
     SetTextColor( rStyleSettings.GetFieldTextColor() );
     SetTextFillColor();
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx 
b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 2111cf0232dc..ff31bcefddc0 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1434,7 +1434,7 @@ void OJoinTableView::StateChanged( StateChangedType nType 
)
     vcl::Font aFont = rStyleSettings.GetGroupFont();
     if ( IsControlFont() )
         aFont.Merge( GetControlFont() );
-    SetZoomedPointFont(*this, aFont);
+    SetZoomedPointFont(*GetOutDev(), aFont);
 
     for (auto const& elem : m_aTableMap)
     {
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx 
b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 8a523b467e5f..8660a503f1a4 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -509,7 +509,7 @@ void OTableWindow::StateChanged( StateChangedType nType )
     vcl::Font aFont = rStyleSettings.GetGroupFont();
     if ( IsControlFont() )
         aFont.Merge( GetControlFont() );
-    SetZoomedPointFont(*this, aFont);
+    SetZoomedPointFont(*GetOutDev(), aFont);
 
     m_xTitle->SetZoom(GetZoom());
     m_xListBox->SetZoom(GetZoom());
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 250765832cec..e61f87041207 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -122,7 +122,7 @@ public:
 SplashScreenWindow::SplashScreenWindow(SplashScreen *pSplash)
     : IntroWindow()
     , pSpl( pSplash )
-    , _vdev(VclPtr<VirtualDevice>::Create(*this))
+    , _vdev(VclPtr<VirtualDevice>::Create(*GetOutDev()))
 {
     _vdev->EnableRTL(IsRTLEnabled());
 }
@@ -138,8 +138,8 @@ void SplashScreenWindow::Redraw()
     Invalidate();
     // Trigger direct painting too - otherwise the splash screen won't be
     // shown in some cases (when the idle timer won't be hit).
-    Paint(*this, tools::Rectangle());
-    Flush();
+    Paint(*GetOutDev(), tools::Rectangle());
+    GetOutDev()->Flush();
 }
 
 SplashScreen::SplashScreen()
diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 992d3f3c515f..f42b494ab139 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1051,9 +1051,9 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, 
EditView* pEditView, v
                         Point P2( P1 );
                         P2.AdjustX(n20 );
                         P2.AdjustY(nH );
-                        pEditView->GetWindow()->SetLineColor();
-                        pEditView->GetWindow()->SetFillColor( (n%2) ? 
COL_YELLOW : COL_LIGHTGREEN );
-                        pEditView->GetWindow()->DrawRect( tools::Rectangle( 
P1, P2 ) );
+                        pEditView->GetWindow()->GetOutDev()->SetLineColor();
+                        pEditView->GetWindow()->GetOutDev()->SetFillColor( 
(n%2) ? COL_YELLOW : COL_LIGHTGREEN );
+                        pEditView->GetWindow()->GetOutDev()->DrawRect( 
tools::Rectangle( P1, P2 ) );
                         aPos.AdjustY(nH );
                     }
                 }
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 1d852ecec784..8e99f56156bc 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -349,7 +349,7 @@ void ImpEditView::lokSelectionCallback(const 
std::unique_ptr<tools::PolyPolygon>
     }
     else
     {
-        pOutWin->Push(PushFlags::MAPMODE);
+        pOutWin->GetOutDev()->Push(PushFlags::MAPMODE);
         if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip)
         {
             // Find the parent that is not right
@@ -442,7 +442,7 @@ void ImpEditView::lokSelectionCallback(const 
std::unique_ptr<tools::PolyPolygon>
             mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, 
"selection", sRectangle);
         }
 
-        pOutWin->Pop();
+        pOutWin->GetOutDev()->Pop();
     }
 }
 
@@ -705,7 +705,7 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice& 
rTarget, const Point& rDo
 
         if (pWindow)
         {
-            pWindow->Invert( aRect );
+            pWindow->GetOutDev()->Invert( aRect );
         }
         else
         {
@@ -822,7 +822,7 @@ OutputDevice& ImpEditView::GetOutputDevice() const
 {
     if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
         return pCallbacks->EditViewOutputDevice();
-    return *pOutWin;
+    return *pOutWin->GetOutDev();
 }
 
 weld::Widget* ImpEditView::GetPopupParent(tools::Rectangle& rRect) const
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 207de9d1ca30..012342ce4d06 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -582,7 +582,7 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, 
EditView* pView )
     {
         if ( ( rMEvt.GetClicks() == 1 ) && rMEvt.IsLeft() && !rMEvt.IsMod2() )
         {
-            const OutputDevice& rOutDev = pView->getEditViewCallbacks() ? 
pView->getEditViewCallbacks()->EditViewOutputDevice() : *pView->GetWindow();
+            const OutputDevice& rOutDev = pView->getEditViewCallbacks() ? 
pView->getEditViewCallbacks()->EditViewOutputDevice() : 
*pView->GetWindow()->GetOutDev();
             Point aLogicClick = rOutDev.PixelToLogic(rMEvt.GetPosPixel());
             if (const SvxFieldItem* pFld = pView->GetField(aLogicClick))
             {
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 6c3933c0ca54..ee9c0bb1a202 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -22,6 +22,7 @@
 #include <vcl/metaact.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/window.hxx>
 
 #include <editeng/tstpitem.hxx>
 #include <editeng/lspcitem.hxx>
@@ -3782,7 +3783,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const 
tools::Rectangle& rRect, Ou
     tools::Rectangle aClipRect( pView->GetOutputArea() );
     aClipRect.Intersection( rRect );
 
-    OutputDevice& rTarget = pTargetDevice ? *pTargetDevice : 
pView->GetOutputDevice();
+    OutputDevice& rTarget = pTargetDevice ? *pTargetDevice : 
*pView->GetWindow()->GetOutDev();
 
     Point aStartPos;
     if ( !IsVertical() )
diff --git a/editeng/source/uno/unoviwou.cxx b/editeng/source/uno/unoviwou.cxx
index d1d20110c75c..cbad84836610 100644
--- a/editeng/source/uno/unoviwou.cxx
+++ b/editeng/source/uno/unoviwou.cxx
@@ -52,7 +52,7 @@ bool SvxDrawOutlinerViewForwarder::IsValid() const
 
 Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const 
MapMode& rMapMode ) const
 {
-    OutputDevice* pOutDev = mrOutlinerView.GetWindow();
+    OutputDevice* pOutDev = mrOutlinerView.GetWindow()->GetOutDev();
 
     if( pOutDev )
     {
@@ -74,7 +74,7 @@ Point SvxDrawOutlinerViewForwarder::LogicToPixel( const 
Point& rPoint, const Map
 
 Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const 
MapMode& rMapMode ) const
 {
-    OutputDevice* pOutDev = mrOutlinerView.GetWindow();
+    OutputDevice* pOutDev = mrOutlinerView.GetWindow()->GetOutDev();
 
     if( pOutDev )
     {
diff --git a/forms/source/richtext/richtextimplcontrol.cxx 
b/forms/source/richtext/richtextimplcontrol.cxx
index 36c28323bd94..eb61fc60a78a 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -77,7 +77,7 @@ namespace frm
         }
 
         // ensure that it's initially scrolled to the upper left
-        m_pView->SetVisArea( tools::Rectangle( Point( ), 
m_pViewport->GetOutputSize() ) );
+        m_pView->SetVisArea( tools::Rectangle( Point( ), 
m_pViewport->GetOutDev()->GetOutputSize() ) );
 
         ensureScrollbars();
 
@@ -451,10 +451,10 @@ namespace frm
             tools::Long nFontWidth = 
m_pEngine->GetStandardFont(0).GetFontSize().Width();
             if ( !nFontWidth )
             {
-                m_pViewport->Push( PushFlags::FONT );
+                m_pViewport->GetOutDev()->Push( PushFlags::FONT );
                 m_pViewport->SetFont( m_pEngine->GetStandardFont(0) );
                 nFontWidth = m_pViewport->GetTextWidth( "x" );
-                m_pViewport->Pop();
+                m_pViewport->GetOutDev()->Pop();
             }
             // ... is the scroll size for the horizontal scrollbar
             m_pHScroll->SetLineSize( 5 * nFontWidth );
diff --git a/framework/source/helper/vclstatusindicator.cxx 
b/framework/source/helper/vclstatusindicator.cxx
index 8173c3b48e8b..b6729ffc7d08 100644
--- a/framework/source/helper/vclstatusindicator.cxx
+++ b/framework/source/helper/vclstatusindicator.cxx
@@ -58,7 +58,7 @@ void SAL_CALL VCLStatusIndicator::start(const OUString& sText 
,
     // force repaint!
     pParentWindow->Show();
     pParentWindow->Invalidate(InvalidateFlags::Children);
-    pParentWindow->Flush();
+    pParentWindow->GetOutDev()->Flush();
 
     m_nRange = nRange;
     m_nValue = 0;
diff --git a/include/sfx2/LokControlHandler.hxx 
b/include/sfx2/LokControlHandler.hxx
index 5617dae4b2f8..5a6d87529fb4 100644
--- a/include/sfx2/LokControlHandler.hxx
+++ b/include/sfx2/LokControlHandler.hxx
@@ -37,7 +37,7 @@ public:
                 if (aControlRectHMM.IsInside(aPointHmm))
                 {
                     css::uno::Reference<css::awt::XControl> xControl
-                        = pUnoObect->GetUnoControl(*pDrawView, rMainWindow);
+                        = pUnoObect->GetUnoControl(*pDrawView, 
*rMainWindow.GetOutDev());
                     if (!xControl.is())
                         return false;
 
@@ -73,7 +73,7 @@ public:
                                tools::Rectangle const& rTileRectHMM, double 
scaleX, double scaleY)
     {
         css::uno::Reference<css::awt::XControl> xControl
-            = pUnoObect->GetUnoControl(*pDrawView, rMainWindow);
+            = pUnoObect->GetUnoControl(*pDrawView, *rMainWindow.GetOutDev());
         if (!xControl.is())
             return;
 
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 8a016ac5eb26..004e939a7fbc 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -839,10 +839,6 @@ private:
     // upper module, you should investigate whether you really wanted to call 
base class methods,
     // or the versions at this class. In the latter case, use the renamed 
versions above.
 
-    // Set/GetLineColor - superseded by Set/GetGridLineColor
-    using OutputDevice::SetLineColor;
-    using OutputDevice::GetLineColor;
-
     // ToTop/ToBottom were never property implemented. If you currently call 
it, this is most probably wrong
     // and not doing as intended
     using Window::ToTop;
diff --git a/include/toolkit/awt/vclxwindow.hxx 
b/include/toolkit/awt/vclxwindow.hxx
index 5e5ac617a26a..24cefd4e5a6a 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -123,10 +123,14 @@ public:
 
     virtual void SetWindow( const VclPtr< vcl::Window > &pWindow );
     template< class derived_type > derived_type* GetAs() const {
-        return static_cast< derived_type * >( GetOutputDevice().get() ); }
+        return static_cast< derived_type * >( GetWindow() ); }
     template< class derived_type > derived_type* GetAsDynamic() const {
-        return dynamic_cast< derived_type * >( GetOutputDevice().get() ); }
-    vcl::Window* GetWindow() const { return GetAs<vcl::Window>(); }
+        return dynamic_cast< derived_type * >( GetWindow() ); }
+    vcl::Window* GetWindow() const
+    {
+        auto p = GetOutputDevice().get();
+        return p ? p->GetOwnerWindow() : nullptr;
+    }
 
     void    suspendVclEventListening( );
     void    resumeVclEventListening( );
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 90e2fda67918..7c5f28455b25 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -103,6 +103,7 @@ namespace vcl
     struct FontCapabilities;
     class TextLayoutCache;
     class Window;
+    class WindowOutputDevice;
     namespace font {
         struct Feature;
     }
@@ -163,6 +164,7 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC OutputDevice : public 
virtual VclReferenceBa
     friend class Printer;
     friend class VirtualDevice;
     friend class vcl::Window;
+    friend class vcl::WindowOutputDevice;
     friend class WorkWindow;
     friend void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, 
tools::Long nNewHeight );
 
@@ -1898,6 +1900,9 @@ public:
 public:
     virtual css::awt::DeviceInfo GetDeviceInfo() const;
 
+    /** Get the vcl::Window that this OutputDevice belongs to, if any */
+    virtual vcl::Window* GetOwnerWindow() const { return nullptr; }
+
 protected:
     css::awt::DeviceInfo GetCommonDeviceInfo(Size const& aDevSize) const;
 
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 649cc0fe3093..68a57930b2e0 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -227,6 +227,8 @@ public:
     SAL_DLLPRIVATE int ImplGetDragWidth() const;
     static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::RenderContext& 
rRenderContext,
                                                 bool bHorz );
+    static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::Window& rWindow,
+                                                bool bHorz );
     SAL_DLLPRIVATE void ImplUpdateDragArea() const;
     SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, tools::Long& 
rLeft, tools::Long& rTop,
                                                tools::Long& rRight, 
tools::Long& rBottom ) const;
diff --git a/include/vcl/toolkit/ivctrl.hxx b/include/vcl/toolkit/ivctrl.hxx
index e322631036a3..b572448e006f 100644
--- a/include/vcl/toolkit/ivctrl.hxx
+++ b/include/vcl/toolkit/ivctrl.hxx
@@ -220,7 +220,7 @@ public:
 
     void                SetClickHdl( const Link<SvtIconChoiceCtrl*,void>& 
rLink ) { _aClickIconHdl = rLink; }
 
-    using OutputDevice::SetBackground;
+    using Window::SetBackground;
     void                SetBackground( const Wallpaper& rWallpaper );
 
     void                ArrangeIcons();
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 17fbf4d876ed..3021bb95870a 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -389,6 +389,7 @@ const char* ImplDbgCheckWindow( const void* pObj );
 
 namespace vcl { class Window; }
 namespace vcl { class Cursor; }
+namespace vcl { class WindowOutputDevice; }
 class Dialog;
 class Edit;
 class WindowImpl;
@@ -449,9 +450,10 @@ public:
                                         Color const * pPaintColor = nullptr);
 };
 
-class VCL_DLLPUBLIC Window : public ::OutputDevice
+class VCL_DLLPUBLIC Window : public virtual VclReferenceBase
 {
     friend class ::vcl::Cursor;
+    friend class ::vcl::WindowOutputDevice;
     friend class ::OutputDevice;
     friend class ::Application;
     friend class ::SystemWindow;
@@ -595,8 +597,6 @@ protected:
     SAL_DLLPRIVATE void                 PushPaintHelper(PaintHelper* pHelper, 
vcl::RenderContext& rRenderContext);
     SAL_DLLPRIVATE void                 PopPaintHelper(PaintHelper const * 
pHelper);
 
-    virtual css::uno::Reference< css::rendering::XCanvas > ImplGetCanvas( bool 
bSpriteCanvas ) const override;
-
 private:
 
     SAL_DLLPRIVATE void                 ImplSetFrameParent( const vcl::Window* 
pParent );
@@ -708,10 +708,6 @@ private:
 
     virtual void                        ImplPaintToDevice( ::OutputDevice* 
pTargetOutDev, const Point& rPos );
 
-public:
-    virtual vcl::Region                 GetActiveClipRegion() const override;
-    virtual vcl::Region                 GetOutputBoundsClipRegion() const 
override;
-
 protected:
     // Single argument ctors shall be explicit.
     explicit                            Window( WindowType nType );
@@ -720,24 +716,9 @@ protected:
 
             void                        CallEventListeners( VclEventId nEvent, 
void* pData = nullptr );
 
-    virtual bool                        AcquireGraphics() const override;
-    virtual void                        ReleaseGraphics( bool bRelease = true 
) override;
-
-    virtual void                        InitClipRegion() override;
-
-    void ImplClearFontData(bool bNewFontLists) override;
-    void ImplRefreshFontData(bool bNewFontLists) override;
-    void ImplInitMapModeObjects() override;
-
     // FIXME: this is a hack to workaround missing layout functionality
     virtual void                        ImplAdjustNWFSizes();
 
-    virtual void                        CopyDeviceArea( SalTwoRect& aPosAry, 
bool bWindowInvalidate) override;
-    virtual const OutputDevice*         DrawOutDevDirectCheck(const 
OutputDevice& rSrcDev) const override;
-    virtual void                        DrawOutDevDirectProcess(const 
OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
-    virtual void                        ClipToPaintRegion( tools::Rectangle& 
rDstRect ) override;
-    virtual bool                        UsePolyPolygonForComplexGradient() 
override;
-
     virtual void ApplySettings(vcl::RenderContext& rRenderContext);
 
 public:
@@ -749,12 +730,13 @@ public:
     ::OutputDevice const*               GetOutDev() const;
     ::OutputDevice*                     GetOutDev();
 
-    bool                                CanEnableNativeWidget() const override 
{ return IsNativeWidgetEnabled(); }
+    Color                               GetBackgroundColor() const;
+    const Wallpaper &                   GetBackground() const;
+    bool                                IsBackground() const;
+    const MapMode&                      GetMapMode() const;
+    void                                SetBackground();
+    void                                SetBackground( const Wallpaper& 
rBackground );
 
-    Color                               GetBackgroundColor() const override;
-
-    size_t                              GetSyncCount() const override { return 
0x000000ff; }
-    virtual void                        EnableRTL ( bool bEnable = true ) 
override;
     virtual void                        MouseMove( const MouseEvent& rMEvt );
     virtual void                        MouseButtonDown( const MouseEvent& 
rMEvt );
     virtual void                        MouseButtonUp( const MouseEvent& rMEvt 
);
@@ -764,7 +746,6 @@ public:
     virtual void                        Paint(vcl::RenderContext& 
rRenderContext, const tools::Rectangle& rRect);
     virtual void                        PostPaint(vcl::RenderContext& 
rRenderContext);
 
-    using OutputDevice::Erase;
     void                                Erase(vcl::RenderContext& 
rRenderContext);
 
     virtual void                        Draw( ::OutputDevice* pDev, const 
Point& rPos, DrawFlags nFlags );
@@ -865,9 +846,6 @@ public:
 
     void                                SetCompositionCharRect( const 
tools::Rectangle* pRect, tools::Long nCompositionLength, bool bVertical = false 
);
 
-    using                               ::OutputDevice::SetSettings;
-    virtual void                        SetSettings( const AllSettings& 
rSettings ) override;
-    void                                SetSettings( const AllSettings& 
rSettings, bool bChild );
     void                                UpdateSettings( const AllSettings& 
rSettings, bool bChild = false );
     void                                NotifyAllChildren( DataChangedEvent& 
rDCEvt );
 
@@ -1013,7 +991,6 @@ public:
     void                                Validate();
     bool                                HasPaintEvent() const;
     void                                PaintImmediately();
-    void                                Flush() override;
 
     // toggles new docking support, enabled via toolkit
     void                                EnableDocking( bool bEnable = true );
@@ -1123,9 +1100,6 @@ public:
                                                              ScrollBar* pHScrl,
                                                              ScrollBar* pVScrl 
);
 
-    void                                SaveBackground(VirtualDevice& 
rSaveDevice,
-                                                       const Point& rPos, 
const Size& rSize, const Size&) const override;
-
     virtual const SystemEnvData*        GetSystemData() const;
 
     // API to set/query the component interfaces
@@ -1510,7 +1484,140 @@ public:
     void SetModalHierarchyHdl(const Link<bool, void>& rLink);
     void SetDumpAsPropertyTreeHdl(const Link<tools::JsonWriter&, void>& rLink);
 
-    css::awt::DeviceInfo GetDeviceInfo() const override;
+    Size                        GetOutputSizePixel() const;
+    tools::Rectangle            GetOutputRectPixel() const;
+
+    Point                       LogicToPixel( const Point& rLogicPt ) const;
+    Size                        LogicToPixel( const Size& rLogicSize ) const;
+    tools::Rectangle            LogicToPixel( const tools::Rectangle& 
rLogicRect ) const;
+    tools::Polygon              LogicToPixel( const tools::Polygon& rLogicPoly 
) const;
+    tools::PolyPolygon          LogicToPixel( const tools::PolyPolygon& 
rLogicPolyPoly ) const;
+    basegfx::B2DPolyPolygon     LogicToPixel( const basegfx::B2DPolyPolygon& 
rLogicPolyPoly ) const;
+    vcl::Region                 LogicToPixel( const vcl::Region& rLogicRegion 
)const;
+    Point                       LogicToPixel( const Point& rLogicPt,
+                                              const MapMode& rMapMode ) const;
+    Size                        LogicToPixel( const Size& rLogicSize,
+                                              const MapMode& rMapMode ) const;
+    tools::Rectangle            LogicToPixel( const tools::Rectangle& 
rLogicRect,
+                                              const MapMode& rMapMode ) const;
+    tools::Polygon              LogicToPixel( const tools::Polygon& rLogicPoly,
+                                              const MapMode& rMapMode ) const;
+    basegfx::B2DPolyPolygon     LogicToPixel( const basegfx::B2DPolyPolygon& 
rLogicPolyPoly,
+                                              const MapMode& rMapMode ) const;
+
+    Point                       PixelToLogic( const Point& rDevicePt ) const;
+    Size                        PixelToLogic( const Size& rDeviceSize ) const;
+    tools::Rectangle                   PixelToLogic( const tools::Rectangle& 
rDeviceRect ) const;
+    tools::Polygon              PixelToLogic( const tools::Polygon& 
rDevicePoly ) const;
+    tools::PolyPolygon          PixelToLogic( const tools::PolyPolygon& 
rDevicePolyPoly ) const;
+    basegfx::B2DPolyPolygon     PixelToLogic( const basegfx::B2DPolyPolygon& 
rDevicePolyPoly ) const;
+    vcl::Region                 PixelToLogic( const vcl::Region& rDeviceRegion 
) const;
+    Point                       PixelToLogic( const Point& rDevicePt,
+                                              const MapMode& rMapMode ) const;
+    Size                        PixelToLogic( const Size& rDeviceSize,
+                                              const MapMode& rMapMode ) const;
+    tools::Rectangle            PixelToLogic( const tools::Rectangle& 
rDeviceRect,
+                                              const MapMode& rMapMode ) const;
+    tools::Polygon              PixelToLogic( const tools::Polygon& 
rDevicePoly,
+                                              const MapMode& rMapMode ) const;
+    basegfx::B2DPolygon         PixelToLogic( const basegfx::B2DPolygon& 
rDevicePoly,
+                                              const MapMode& rMapMode ) const;
+    basegfx::B2DPolyPolygon     PixelToLogic( const basegfx::B2DPolyPolygon& 
rDevicePolyPoly,
+                                              const MapMode& rMapMode ) const;
+
+    Point                       LogicToLogic( const Point&      rPtSource,
+                                              const MapMode*    pMapModeSource,
+                                              const MapMode*    pMapModeDest ) 
const;
+    Size                        LogicToLogic( const Size&       rSzSource,
+                                              const MapMode*    pMapModeSource,
+                                              const MapMode*    pMapModeDest ) 
const;
+    tools::Rectangle            LogicToLogic( const tools::Rectangle&  
rRectSource,
+                                              const MapMode*    pMapModeSource,
+                                              const MapMode*    pMapModeDest ) 
const;
+
+    const AllSettings&          GetSettings() const;
+    void SetSettings( const AllSettings& rSettings );
+    void SetSettings( const AllSettings& rSettings, bool bChild );
+
+    tools::Rectangle            GetTextRect( const tools::Rectangle& rRect,
+                                             const OUString& rStr, 
DrawTextFlags nStyle = DrawTextFlags::WordBreak,
+                                             TextRectInfo* pInfo = nullptr,
+                                             const vcl::ITextLayout* 
_pTextLayout = nullptr ) const;
+    float                       GetDPIScaleFactor() const;
+    sal_Int32                   GetDPIScalePercentage() const;
+    tools::Long                 GetOutOffXPixel() const;
+    tools::Long                 GetOutOffYPixel() const;
+    void                        SetOutOffXPixel(tools::Long nOutOffX);
+    void                        SetOutOffYPixel(tools::Long nOutOffY);
+
+    void                        EnableMapMode( bool bEnable = true );
+    bool                        IsMapModeEnabled() const;
+    void                        SetMapMode();
+    void                        SetMapMode( const MapMode& rNewMapMode );
+
+    // Enabling/disabling RTL only makes sense for OutputDevices that use a 
mirroring SalGraphicsLayout
+    virtual void                EnableRTL( bool bEnable = true);
+    bool                        IsRTLEnabled() const;
+
+    void                        SetFont( const vcl::Font& rNewFont );
+    const vcl::Font&            GetFont() const;
+
+    /** Width of the text.
+
+        See also GetTextBoundRect() for more explanation + code examples.
+    */
+    tools::Long                 GetTextWidth( const OUString& rStr, sal_Int32 
nIndex = 0, sal_Int32 nLen = -1,
+                                    vcl::TextLayoutCache const* = nullptr,
+                                    SalLayoutGlyphs const*const pLayoutCache = 
nullptr) const;
+
+    /** Height where any character of the current font fits; in logic 
coordinates.
+
+        See also GetTextBoundRect() for more explanation + code examples.
+    */
+    tools::Long                 GetTextHeight() const;
+    float                       approximate_digit_width() const;
+
+    void                        SetTextColor( const Color& rColor );
+    const Color&                GetTextColor() const;
+
+    void                        SetTextFillColor();
+    void                        SetTextFillColor( const Color& rColor );
+    Color                       GetTextFillColor() const;
+    bool                        IsTextFillColor() const;
+
+    void                        SetTextLineColor();
+    void                        SetTextLineColor( const Color& rColor );
+    const Color&                GetTextLineColor() const;
+    bool                        IsTextLineColor() const;
+
+    void                        SetOverlineColor();
+    void                        SetOverlineColor( const Color& rColor );
+    const Color&                GetOverlineColor() const;
+    bool                        IsOverlineColor() const;
+
+    void                        SetTextAlign( TextAlign eAlign );
+    TextAlign                   GetTextAlign() const;
+
+    /** Query the platform layer for control support
+     */
+    bool                        IsNativeControlSupported( ControlType nType, 
ControlPart nPart ) const;
+
+    static OUString             GetNonMnemonicString(const OUString& rStr) { 
return OutputDevice::GetNonMnemonicString(rStr); }
+
+    /** Query the native control's actual drawing region (including adornment)
+     */
+    bool                        GetNativeControlRegion(
+                                    ControlType nType,
+                                    ControlPart nPart,
+                                    const tools::Rectangle& rControlRegion,
+                                    ControlState nState,
+                                    const ImplControlValue& aValue,
+                                    tools::Rectangle &rNativeBoundingRegion,
+                                    tools::Rectangle &rNativeContentRegion ) 
const;
+protected:
+    SAL_DLLPRIVATE float        approximate_char_width() const;
+private:
+    SAL_DLLPRIVATE void         ImplEnableRTL(bool bEnable);
 };
 
 }
diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java 
b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java
index 0fc71d679153..f7a756685b80 100644
--- a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java
+++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java
@@ -183,6 +183,7 @@ public class AccessibleFixedText extends TestCase {
     @Override
     protected void cleanup(TestParameters Param, PrintWriter log) {
         log.println("    Closing dialog ... ");
-        xWinDlg.dispose();
+        if (xWinDlg != null)
+            xWinDlg.dispose();
     }
 }
diff --git a/reportdesign/source/ui/inc/UITools.hxx 
b/reportdesign/source/ui/inc/UITools.hxx
index 5fe175440e61..13aafb14fc90 100644
--- a/reportdesign/source/ui/inc/UITools.hxx
+++ b/reportdesign/source/ui/inc/UITools.hxx
@@ -174,7 +174,7 @@ namespace rptui
         @param  _aZoom      the zoom scale
         @param  _rWindow    where to set the map mode
     */
-    void setZoomFactor(const Fraction& _aZoom, OutputDevice& _rWindow);
+    void setZoomFactor(const Fraction& _aZoom, vcl::Window& _rWindow);
 }
 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
 
diff --git a/reportdesign/source/ui/misc/UITools.cxx 
b/reportdesign/source/ui/misc/UITools.cxx
index 773e4d24a034..2b806af28aeb 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -1018,7 +1018,7 @@ void correctOverlapping(SdrObject* 
_pControl,OReportSection const & _aReportSect
         
rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(), 
SdrInsertFlags::ADDMARK);
 }
 
-void setZoomFactor(const Fraction& _aZoom, OutputDevice& _rWindow)
+void setZoomFactor(const Fraction& _aZoom, vcl::Window& _rWindow)
 {
     MapMode aMapMode( _rWindow.GetMapMode() );
     aMapMode.SetScaleX(_aZoom);
diff --git a/reportdesign/source/ui/report/DesignView.cxx 
b/reportdesign/source/ui/report/DesignView.cxx
index 6accf6c82559..a3027c61287d 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -393,7 +393,7 @@ void ODesignView::GetFocus()
 void ODesignView::ImplInitSettings()
 {
     SetBackground( Wallpaper( 
Application::GetSettings().GetStyleSettings().GetFaceColor() ));
-    SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() 
);
+    GetOutDev()->SetFillColor( 
Application::GetSettings().GetStyleSettings().GetFaceColor() );
     SetTextFillColor( 
Application::GetSettings().GetStyleSettings().GetFaceColor() );
 }
 
diff --git a/reportdesign/source/ui/report/EndMarker.cxx 
b/reportdesign/source/ui/report/EndMarker.cxx
index ae79c968f12c..fdd28f4db5e6 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -71,7 +71,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, 
const tools::Rectangl
         tools::Rectangle aRect(Point(-nCornerSpace, nCornerSpace),
                          Size(aSize.Width() - nCornerSpace,
                               aSize.Height() - nCornerSpace - nCornerSpace));
-        ColorChanger aColors(this, COL_WHITE, COL_WHITE);
+        ColorChanger aColors(GetOutDev(), COL_WHITE, COL_WHITE);
         rRenderContext.DrawPolyLine( tools::Polygon(PixelToLogic(aRect)), 
LineInfo(LineStyle::Solid, 2));
     }
 }
@@ -83,7 +83,7 @@ void OEndMarker::ImplInitSettings()
     SetPaintTransparent( true );
 
     SetBackground( Wallpaper( 
svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor)  );
-    SetFillColor( 
Application::GetSettings().GetStyleSettings().GetShadowColor() );
+    GetOutDev()->SetFillColor( 
Application::GetSettings().GetStyleSettings().GetShadowColor() );
 }
 
 void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt )
diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx 
b/reportdesign/source/ui/report/FixedTextColor.cxx
index 4815dbbc412a..17f8ce20d1b7 100644
--- a/reportdesign/source/ui/report/FixedTextColor.cxx
+++ b/reportdesign/source/ui/report/FixedTextColor.cxx
@@ -168,7 +168,7 @@ namespace rptui
                     {
                         OReportSection& aOutputDevice = 
pSectionWindow->getReportSection(); // OutputDevice
                         OSectionView& aSdrView = 
aOutputDevice.getSectionView(); // SdrView
-                        xControl = pUnoObj->GetUnoControl(aSdrView, 
aOutputDevice);
+                        xControl = pUnoObj->GetUnoControl(aSdrView, 
*aOutputDevice.GetOutDev());
                     }
                 }
             }
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx 
b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
index eacd4a83c305..b4af3352c21b 100644
--- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -164,7 +164,7 @@ namespace rptui
                     {
                         OReportSection& aOutputDevice = 
pSectionWindow->getReportSection(); // OutputDevice
                         OSectionView& aSdrView = 
aOutputDevice.getSectionView();            // SdrView
-                        uno::Reference<awt::XControl> xControl = 
pUnoObj->GetUnoControl(aSdrView, aOutputDevice);
+                        uno::Reference<awt::XControl> xControl = 
pUnoObj->GetUnoControl(aSdrView, *aOutputDevice.GetOutDev());
                         xVclWindowPeer.set( xControl->getPeer(), 
uno::UNO_QUERY);
                     }
                 }
diff --git a/reportdesign/source/ui/report/ReportController.cxx 
b/reportdesign/source/ui/report/ReportController.cxx
index de4be54c181e..03bfb73160a1 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3152,7 +3152,7 @@ void OReportController::createControl(const Sequence< 
PropertyValue >& _aArgs,co
         std::unique_ptr<SdrUnoObj, SdrObjectFreeOp> pControl;
 
         FmFormView::createControlLabelPair(
-            getDesignView(),
+            getDesignView()->GetOutDev(),
             nLeftMargin,
             0,
             nullptr,
@@ -3459,7 +3459,7 @@ void OReportController::addPairControls(const Sequence< 
PropertyValue >& aArgs)
 
             // find this in svx
             FmFormView::createControlLabelPair(
-                getDesignView(),
+                getDesignView()->GetOutDev(),
                 nLeftMargin,
                 0,
                 xField,
@@ -4115,7 +4115,7 @@ void OReportController::impl_fillState_nothrow(const 
OUString& _sProperty,dbaui:
 void OReportController::impl_zoom_nothrow()
 {
     Fraction aZoom(m_nZoomValue,100);
-    setZoomFactor( aZoom,*getDesignView() );
+    setZoomFactor( aZoom, *getDesignView() );
     getDesignView()->zoom(aZoom);
     InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(), true);
     InvalidateFeature(SID_ATTR_ZOOMSLIDER,Reference< XStatusListener >(), 
true);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index acc0f7d0190c..e74ba7739fa5 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -145,7 +145,7 @@ void OReportSection::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rec
     // mark repaint start
     if (pPgView)
     {
-        pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(this, 
aPaintRectRegion);
+        pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(GetOutDev(), 
aPaintRectRegion);
         OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow 
(!)");
         // draw background self using wallpaper
         OutputDevice& rTargetOutDev = 
pTargetPaintWindow->GetTargetOutputDevice();
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx 
b/reportdesign/source/ui/report/ScrollHelper.cxx
index bb9691e8eabf..07dd4fd50016 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -353,7 +353,7 @@ void 
OScrollWindowHelper::alignMarkedObjects(ControlModification _nControlModifi
 void OScrollWindowHelper::ImplInitSettings()
 {
     SetBackground( Wallpaper( 
Application::GetSettings().GetStyleSettings().GetFaceColor() ));
-    SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() 
);
+    GetOutDev()->SetFillColor( 
Application::GetSettings().GetStyleSettings().GetFaceColor() );
     SetTextFillColor( 
Application::GetSettings().GetStyleSettings().GetFaceColor() );
 }
 
diff --git a/reportdesign/source/ui/report/SectionView.cxx 
b/reportdesign/source/ui/report/SectionView.cxx
index 3b5694c997dd..b711b13dff33 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -35,7 +35,7 @@ OSectionView::OSectionView(
     SdrModel& rSdrModel,
     OReportSection* _pSectionWindow,
     OReportWindow* pEditor)
-:   SdrView(rSdrModel, _pSectionWindow)
+:   SdrView(rSdrModel, _pSectionWindow->GetOutDev())
     ,m_pReportWindow( pEditor )
     ,m_pSectionWindow(_pSectionWindow)
 {
@@ -71,7 +71,7 @@ void OSectionView::MakeVisible( const tools::Rectangle& 
rRect, vcl::Window& rWin
     // visible area
     MapMode aMap( rWin.GetMapMode() );
     const Point aOrg( aMap.GetOrigin() );
-    const Size aVisSize( rWin.GetOutputSize() );
+    const Size aVisSize( rWin.GetOutDev()->GetOutputSize() );
     const tools::Rectangle aVisRect( Point(-aOrg.X(),-aOrg.Y()), aVisSize );
 
     // check, if rectangle is inside visible area
diff --git a/reportdesign/source/ui/report/StartMarker.cxx 
b/reportdesign/source/ui/report/StartMarker.cxx
index 60b6b50c53e1..a5871fc52524 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -211,7 +211,7 @@ void OStartMarker::ApplySettings(vcl::RenderContext& 
rRenderContext)
 
 void OStartMarker::ImplInitSettings()
 {
-    ApplySettings(*this);
+    ApplySettings(*GetOutDev());
 }
 
 void OStartMarker::Resize()
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx 
b/reportdesign/source/ui/report/dlgedfunc.cxx
index d2be2d012406..961927174959 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -117,7 +117,7 @@ DlgEdFunc::DlgEdFunc( OReportSection* _pParent )
     , m_bShowPropertyBrowser(false)
 {
     aScrollTimer.SetInvokeHandler( LINK( this, DlgEdFunc, ScrollTimeout ) );
-    m_rView.SetActualWin( m_pParent);
+    m_rView.SetActualWin( m_pParent->GetOutDev() );
     aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
 }
 
@@ -758,7 +758,7 @@ bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
     }
 
     if ( !bIsSetPoint )
-        m_pParent->SetPointer( m_rView.GetPreferredPointer( aPos, m_pParent) );
+        m_pParent->SetPointer( m_rView.GetPreferredPointer( aPos, 
m_pParent->GetOutDev()) );
 
     return true;
 }
@@ -834,7 +834,7 @@ bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& 
rMEvt )
     m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
     checkTwoClicks(rMEvt);
 
-    m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent) );
+    m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, 
m_pParent->GetOutDev() ) );
 
     if ( !m_bUiActive )
         
m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
@@ -878,7 +878,7 @@ bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
 
     if ( !bIsSetPoint )
     {
-        m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, m_pParent) );
+        m_pParent->SetPointer( m_rView.GetPreferredPointer( aPnt, 
m_pParent->GetOutDev() ) );
 
         // restore color
         unColorizeOverlappedObj();
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx 
b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index 2f0c28998723..57780c4335d2 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -353,7 +353,7 @@ bool ScAccessibleEditObject::IsDefunc(
 
 OutputDevice* ScAccessibleEditObject::GetOutputDeviceForView()
 {
-    return mpWindow;
+    return mpWindow->GetOutDev();
 }
 
 void ScAccessibleEditObject::CreateTextHelper()
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index d8a25bd3a152..bdd66a15db47 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -266,7 +266,7 @@ void ScModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* p, Configura
             {
                 ScPreview* pPreview = pPreviewSh->GetPreview();
 
-                pPreview->SetDigitLanguage( GetOptDigitLanguage() );
+                pPreview->GetOutDev()->SetDigitLanguage( GetOptDigitLanguage() 
);
                 pPreview->Invalidate();
             }
 
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx 
b/sc/source/ui/drawfunc/fuconpol.cxx
index 712b12a2bddf..3504154d7b99 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -58,7 +58,7 @@ bool FuConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
         pView->EnableExtendedMouseEventDispatcher(true);
     }
 
-    if ( pView->MouseButtonDown(rMEvt, pWindow) )
+    if ( pView->MouseButtonDown(rMEvt, pWindow->GetOutDev()) )
         bReturn = true;
 
     return bReturn;
@@ -66,7 +66,7 @@ bool FuConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
 
 bool FuConstPolygon::MouseMove(const MouseEvent& rMEvt)
 {
-    pView->MouseMove(rMEvt, pWindow);
+    pView->MouseMove(rMEvt, pWindow->GetOutDev());
     return FuConstruct::MouseMove(rMEvt);
 }
 
@@ -81,7 +81,7 @@ bool FuConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
     SdrViewEvent aVEvt;
     (void)pView->PickAnything(rMEvt, SdrMouseEventKind::BUTTONUP, aVEvt);
 
-    pView->MouseButtonUp(rMEvt, pWindow);
+    pView->MouseButtonUp(rMEvt, pWindow->GetOutDev());
 
     if (aVEvt.eEvent == SdrEventKind::EndCreate)
     {
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 04d31cd6c8b3..2069bace5936 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -655,7 +655,7 @@ static bool lcl_UrlHit( const SdrView* pView, const Point& 
rPosPixel, const vcl:
     if ( eHit != SdrHitKind::NONE && aVEvt.pObj != nullptr )
     {
         if ( SvxIMapInfo::GetIMapInfo( aVEvt.pObj ) && 
SvxIMapInfo::GetHitIMapObject(
-                                aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), 
pWindow ) )
+                                aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), 
pWindow->GetOutDev() ) )
             return true;
 
         if ( aVEvt.eEvent == SdrEventKind::ExecuteUrl )
@@ -696,7 +696,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
     else if ( pHdl )
     {
         rViewShell.SetActivePointer(
-            pView->GetPreferredPointer( aPnt, pWindow ) );
+            pView->GetPreferredPointer( aPnt, pWindow->GetOutDev() ) );
     }
     else if ( pView->IsMarkedHit(aPnt) )
     {
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index b42979a3ba56..52a5b9a4be17 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -208,7 +208,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
                     if ( SvxIMapInfo::GetIMapInfo( aVEvt.pObj ) )       // 
ImageMap
                     {
                         const IMapObject* pIMapObj =
-                                SvxIMapInfo::GetHitIMapObject( aVEvt.pObj, 
aMDPos, pWindow );
+                                SvxIMapInfo::GetHitIMapObject( aVEvt.pObj, 
aMDPos, pWindow->GetOutDev() );
                         if ( pIMapObj && !pIMapObj->GetURL().isEmpty() )
                         {
                             sURL = pIMapObj->GetURL();
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 8174506255a7..27eeab0e09e9 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -116,7 +116,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
     SetMouseButtonCode(rMEvt.GetButtons());
     bool bStraightEnter = true;
 
-    if ( pView->MouseButtonDown(rMEvt, pWindow) )
+    if ( pView->MouseButtonDown(rMEvt, pWindow->GetOutDev()) )
         return true;                 // event handled from SdrView
 
     if ( pView->IsTextEdit() )
@@ -318,7 +318,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
     }
 
     rViewShell.SetActivePointer(pView->GetPreferredPointer(
-                    pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
+                    pWindow->PixelToLogic(rMEvt.GetPosPixel()), 
pWindow->GetOutDev() ));
     if (!bStraightEnter)
     {
             pView->UnmarkAll();
@@ -332,7 +332,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
 bool FuText::MouseMove(const MouseEvent& rMEvt)
 {
     rViewShell.SetActivePointer(pView->GetPreferredPointer(
-                    pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
+                    pWindow->PixelToLogic(rMEvt.GetPosPixel()), 
pWindow->GetOutDev() ));
 
     if (aDragTimer.IsActive() )
     {
@@ -346,7 +346,7 @@ bool FuText::MouseMove(const MouseEvent& rMEvt)
     Point aPix(rMEvt.GetPosPixel());
     Point aPnt(pWindow->PixelToLogic(aPix));
 
-    if ( pView->MouseMove(rMEvt, pWindow) )
+    if ( pView->MouseMove(rMEvt, pWindow->GetOutDev()) )
         return true; // event handled from SdrView
 
     if ( pView->IsAction() )
@@ -372,7 +372,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
 
     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
-    if ( pView->MouseButtonUp(rMEvt, pWindow) )
+    if ( pView->MouseButtonUp(rMEvt, pWindow->GetOutDev()) )
         return true; // Event evaluated by SdrView
 
     if ( pView->IsDragObj() )
diff --git a/sc/source/ui/drawfunc/futext2.cxx 
b/sc/source/ui/drawfunc/futext2.cxx
index b4e91150d970..8f30cb4a6f86 100644
--- a/sc/source/ui/drawfunc/futext2.cxx
+++ b/sc/source/ui/drawfunc/futext2.cxx
@@ -37,7 +37,7 @@ std::unique_ptr<SdrOutliner> FuText::MakeOutliner()
     //  #i10426# The ref device isn't set to the EditEngine before 
SdrBeginTextEdit now,
     //  so the device must be taken from the model here.
     OutputDevice* pRef = pDrDoc->GetRefDevice();
-    if (pRef && pRef != pWindow)
+    if (pRef && pRef != pWindow->GetOutDev())
         pRef->SetMapMode(MapMode(MapUnit::Map100thMM));
 
     return pOutl;
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 9a2932ca1e12..a758a9054600 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -317,7 +317,7 @@ uno::Reference< form::runtime::XFormController > SAL_CALL 
ScViewPaneBase::getFor
     SdrView* pSdrView( nullptr );
     FmFormShell* pFormShell( nullptr );
     if ( lcl_prepareFormShellCall( pViewShell, nPane, pFormShell, pWindow, 
pSdrView ) )
-        xController = FmFormShell::GetFormController( Form, *pSdrView, 
*pWindow );
+        xController = FmFormShell::GetFormController( Form, *pSdrView, 
*pWindow->GetOutDev() );
 
     return xController;
 }
@@ -359,7 +359,7 @@ uno::Reference<awt::XControl> SAL_CALL 
ScViewPaneBase::getControl(
     SdrView* pSdrView( nullptr );
     FmFormShell* pFormShell( nullptr );
     if ( lcl_prepareFormShellCall( pViewShell, nPane, pFormShell, pWindow, 
pSdrView ) )
-        pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xRet );
+        pFormShell->GetFormControl( xModel, *pSdrView, *pWindow->GetOutDev(), 
xRet );
 
     if ( !xRet.is() )
         throw container::NoSuchElementException();      // no control found
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 4851d861e888..c380b0ff168b 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -195,7 +195,7 @@ void ScColBar::DrawInvert( tools::Long nDragPosP )
 {
     tools::Rectangle aRect( nDragPosP,0, 
nDragPosP+HDR_SLIDERSIZE-1,GetOutputSizePixel().Width()-1 );
     PaintImmediately();
-    Invert(aRect);
+    GetOutDev()->Invert(aRect);
 
     pTabView->GetViewData().GetView()->InvertVertical(meWhich,nDragPosP);
 }
@@ -355,7 +355,7 @@ void ScRowBar::DrawInvert( tools::Long nDragPosP )
 {
     tools::Rectangle aRect( 0,nDragPosP, 
GetOutputSizePixel().Width()-1,nDragPosP+HDR_SLIDERSIZE-1 );
     PaintImmediately();
-    Invert(aRect);
+    GetOutDev()->Invert(aRect);
 
     pTabView->GetViewData().GetView()->InvertHorizontal(meWhich,nDragPosP);
 }
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 9d23c064664f..c8829737f589 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -515,7 +515,7 @@ void ScDrawView::MarkListHasChanged()
 
         if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
         {
-            static_cast<vcl::Window&>(rOutDev).PaintImmediately();
+            rOutDev.GetOwnerWindow()->PaintImmediately();
         }
     }
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 92b3e31d75fe..166bdd265e09 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -376,7 +376,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
             nDragEndX( -1 ),
             nDragEndY( -1 ),
             meDragInsertMode( INS_NONE ),
-            aComboButton( this ),
+            aComboButton( GetOutDev() ),
             aCurMousePos( 0,0 ),
             nPaintCount( 0 ),
             aRFSelectedCorned( NONE ),
@@ -422,7 +422,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
 
     SetHelpId( HID_SC_WIN_GRIDWIN );
 
-    SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
+    GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
     EnableRTL( false );
 }
 
@@ -1500,7 +1500,7 @@ bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW 
nPosY, SCTAB nTab, SCC
 
     Fraction aZoomX = mrViewData.GetZoomX();
     Fraction aZoomY = mrViewData.GetZoomY();
-    ScOutputData aOutputData(this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
+    ScOutputData aOutputData(GetOutDev(), OUTTYPE_WINDOW, aTabInfo, &rDoc, 
nTab,
             0, 0, 0, nPosY, nPosX, nPosY, nPPTX, nPPTY,
             &aZoomX, &aZoomY);
 
@@ -3173,8 +3173,8 @@ void ScGridWindow::SelectForContextMenu( const Point& 
rPosPixel, SCCOL nCellX, S
                 // clicked outside the selected text - deselect and move text 
cursor
                 // use DrawView to allow extra handling there (none currently)
                 MouseEvent aEvent( rPosPixel );
-                pDrawView->MouseButtonDown( aEvent, this );
-                pDrawView->MouseButtonUp( aEvent, this );
+                pDrawView->MouseButtonDown( aEvent, GetOutDev() );
+                pDrawView->MouseButtonUp( aEvent, GetOutDev() );
             }
 
             return;     // clicked within the edit area - keep edit mode
@@ -4754,7 +4754,7 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, 
SCCOL nX2, SCROW nY2)
 
     Fraction aZoomX = mrViewData.GetZoomX();
     Fraction aZoomY = mrViewData.GetZoomY();
-    ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
+    ScOutputData aOutputData( GetOutDev(), OUTTYPE_WINDOW, aTabInfo, &rDoc, 
nTab,
                                 nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
                                 &aZoomX, &aZoomY );
     aOutputData.SetMirrorWidth( nMirrorWidth );
@@ -6188,7 +6188,7 @@ void ScGridWindow::UpdateCursorOverlay()
                     // non-active pane uses a different color.
                     aCursorColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
                 std::vector< basegfx::B2DRange > aRanges;
-                const basegfx::B2DHomMatrix 
aTransform(GetInverseViewTransformation());
+                const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
 
                 for(const tools::Rectangle & rRA : aPixelRects)
                 {
@@ -6259,7 +6259,7 @@ void ScGridWindow::UpdateSelectionOverlay()
         else if (xOverlayManager.is())
         {
             std::vector< basegfx::B2DRange > aRanges;
-            const basegfx::B2DHomMatrix 
aTransform(GetInverseViewTransformation());
+            const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
             ScDocument& rDoc = mrViewData.GetDocument();
             SCTAB nTab = mrViewData.GetTabNo();
             bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
@@ -6384,7 +6384,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
             // non-active pane uses a different color.
             aHandleColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
         std::vector< basegfx::B2DRange > aRanges;
-        const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+        const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
         basegfx::B2DRange aRB = 
vcl::unotools::b2DRectangleFromRectangle(aFillRect);
 
         aRB.transform(aTransform);
@@ -6507,7 +6507,7 @@ void ScGridWindow::UpdateDragRectOverlay()
         if (xOverlayManager.is() && !comphelper::LibreOfficeKit::isActive())
         {
             std::vector< basegfx::B2DRange > aRanges;
-            const basegfx::B2DHomMatrix 
aTransform(GetInverseViewTransformation());
+            const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
 
             for(const tools::Rectangle & rRA : aPixelRects)
             {
@@ -6556,7 +6556,7 @@ void ScGridWindow::UpdateHeaderOverlay()
         {
             // Color aHighlight = 
GetSettings().GetStyleSettings().GetHighlightColor();
             std::vector< basegfx::B2DRange > aRanges;
-            const basegfx::B2DHomMatrix 
aTransform(GetInverseViewTransformation());
+            const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
             basegfx::B2DRange aRB(aInvertRect.Left(), aInvertRect.Top(), 
aInvertRect.Right() + 1, aInvertRect.Bottom() + 1);
 
             aRB.transform(aTransform);
@@ -6623,7 +6623,7 @@ void ScGridWindow::UpdateShrinkOverlay()
         if (xOverlayManager.is() && !comphelper::LibreOfficeKit::isActive())
         {
             std::vector< basegfx::B2DRange > aRanges;
-            const basegfx::B2DHomMatrix 
aTransform(GetInverseViewTransformation());
+            const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
             basegfx::B2DRange aRB(aPixRect.Left(), aPixRect.Top(), 
aPixRect.Right() + 1, aPixRect.Bottom() + 1);
 
             aRB.transform(aTransform);
@@ -6652,7 +6652,7 @@ rtl::Reference<sdr::overlay::OverlayManager> 
ScGridWindow::getOverlayManager() c
 
     if(pPV)
     {
-        SdrPageWindow* pPageWin = pPV->FindPageWindow( *this );
+        SdrPageWindow* pPageWin = pPV->FindPageWindow( *GetOutDev() );
 
         if ( pPageWin )
         {
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 06b9a88bdaaf..bf1b7597b185 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -120,7 +120,7 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW 
nRow, const MouseEvent&
     Size aScrSize(nSizeX-1, nSizeY-1);
 
     // Check if the mouse cursor is clicking on the popup arrow box.
-    mpFilterButton.reset(new ScDPFieldButton(this, 
&GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc));
+    mpFilterButton.reset(new ScDPFieldButton(GetOutDev(), 
&GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc));
     mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
     mpFilterButton->setPopupLeft(bLayoutRTL);   // #i114944# AutoFilter button 
is left-aligned in RTL
     Point aPopupPos;
@@ -351,7 +351,7 @@ bool ScGridWindow::DPTestFieldPopupArrow(
     Size aScrSize(nSizeX-1, nSizeY-1);
 
     // Check if the mouse cursor is clicking on the popup arrow box.
-    ScDPFieldButton aBtn(this, &GetSettings().GetStyleSettings(), 
&GetMapMode().GetScaleY());
+    ScDPFieldButton aBtn(GetOutDev(), &GetSettings().GetStyleSettings(), 
&GetMapMode().GetScaleY());
     aBtn.setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
     aBtn.setPopupLeft(false);   // DataPilot popup is always right-aligned for 
now
     Point aPopupPos;
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index cb8bc5393dc3..ae60b18a5cbf 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -281,7 +281,7 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
             rDoc.GetTableArea( nTab, nEndCol, nEndRow );
             if (nEndCol<20) nEndCol = 20;
             if (nEndRow<20) nEndRow = 1000;
-            ScDrawUtil::CalcScale( rDoc, nTab, 0,0, nEndCol,nEndRow, this,
+            ScDrawUtil::CalcScale( rDoc, nTab, 0,0, nEndCol,nEndRow, 
GetOutDev(),
                                    mrViewData.GetZoomX(),mrViewData.GetZoomY(),
                                    mrViewData.GetPPTX(),mrViewData.GetPPTY(),
                                    aScaleX,aScaleY );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index bfee8d45eb15..a32ca723b446 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -551,7 +551,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, 
SCROW nY2, ScUpdateMod
 
     Fraction aZoomX = mrViewData.GetZoomX();
     Fraction aZoomY = mrViewData.GetZoomY();
-    ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
+    ScOutputData aOutputData( GetOutDev(), OUTTYPE_WINDOW, aTabInfo, &rDoc, 
nTab,
                                nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
                                &aZoomX, &aZoomY );
 
@@ -581,7 +581,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, 
SCROW nY2, ScUpdateMod
         bLogicText = true; // use logic MapMode
     }
 
-    DrawContent(*this, aTabInfo, aOutputData, bLogicText);
+    DrawContent(*GetOutDev(), aTabInfo, aOutputData, bLogicText);
 
     // If something was inverted during the Paint (selection changed from 
Basic Macro)
     // then this is now mixed up and has to be repainted
@@ -1230,7 +1230,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
 
                 aBGAbs.AdjustLeft(1);
                 aBGAbs.AdjustTop(1);
-                aCursorRect = OutputDevice::PixelToLogic(aBGAbs, aMM);
+                aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
                 aCursorRect.setWidth(0);
                 aCursorRect.Move(aCursPos.getX(), 0);
                 // Sends view cursor position to views of all matching zooms 
if needed (avoids duplicates).
@@ -1978,7 +1978,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, 
const ScTableInfo& rTabInfo
     }
 
     pQueryParam.reset();
-    aComboButton.SetOutputDevice( this );
+    aComboButton.SetOutputDevice( GetOutDev() );
 }
 
 tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& 
rButtonPos )
@@ -1988,7 +1988,7 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( 
const ScAddress& rButtonPos
     bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
     tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 
-    ScDDComboBoxButton aButton( this );             // for optimal size
+    ScDDComboBoxButton aButton( GetOutDev() );             // for optimal size
     Size aBtnSize = aButton.GetSizePixel();
 
     SCCOL nCol = rButtonPos.Col();
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 47e77a788357..01a1db0d5fe6 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -259,7 +259,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
                 {
                     Point aLogicPos = PixelToLogic( aPosPixel );
                     IMapObject* pIMapObj = SvxIMapInfo::GetHitIMapObject(
-                                                    aVEvt.pObj, aLogicPos, 
this );
+                                                    aVEvt.pObj, aLogicPos, 
GetOutDev() );
 
                     if ( pIMapObj )
                     {
diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx 
b/sc/source/ui/view/gridwin_dbgutil.cxx
index f9c2209bda88..5c1bcce7095e 100644
--- a/sc/source/ui/view/gridwin_dbgutil.cxx
+++ b/sc/source/ui/view/gridwin_dbgutil.cxx
@@ -58,7 +58,7 @@ void ScGridWindow::dumpColumnInformationHmm()
     for (SCCOL nCol = 0; nCol <= 20; ++nCol)
     {
         sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab);
-        tools::Long nPixel = LogicToLogic(Point(nWidth, 0), 
MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)).getX();
+        tools::Long nPixel = OutputDevice::LogicToLogic(Point(nWidth, 0), 
MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)).getX();
         std::cout << "Column: " << nCol << ", Width: " << nPixel << "hmm" << 
std::endl;
     }
 }
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index e322394d2025..c1fe53b96485 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -319,26 +319,26 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
     //  background is different for entry area and behind the entries
 
     tools::Rectangle aFillRect;
-    SetLineColor();
+    GetOutDev()->SetLineColor();
 
     if ( nLineEnd * nLayoutSign >= nInitScrPos * nLayoutSign )
     {
-        SetFillColor( rStyleSettings.GetFaceColor() );
+        GetOutDev()->SetFillColor( rStyleSettings.GetFaceColor() );
         if ( bVertical )
             aFillRect = tools::Rectangle( 0, nInitScrPos, nBarSize-1, nLineEnd 
);
         else
             aFillRect = tools::Rectangle( nInitScrPos, 0, nLineEnd, nBarSize-1 
);
-        DrawRect( aFillRect );
+        GetOutDev()->DrawRect( aFillRect );
     }
 
     if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign )
     {
-        SetFillColor( 
SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor );
+        GetOutDev()->SetFillColor( 
SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor );
         if ( bVertical )
             aFillRect = tools::Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-1, 
nPEnd );
         else
             aFillRect = tools::Rectangle( nLineEnd+nLayoutSign, 0, nPEnd, 
nBarSize-1 );
-        DrawRect( aFillRect );
+        GetOutDev()->DrawRect( aFillRect );
     }
 
     if ( nLineEnd * nLayoutSign >= nPStart * nLayoutSign )
@@ -355,40 +355,40 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
                 if ( bDark )
                 {
                     //  solid grey background for dark face color is drawn 
before lines
-                    SetLineColor();
-                    SetFillColor( COL_LIGHTGRAY );
-                    DrawRect( aFillRect );
+                    GetOutDev()->SetLineColor();
+                    GetOutDev()->SetFillColor( COL_LIGHTGRAY );
+                    GetOutDev()->DrawRect( aFillRect );
                 }
             }
             else
             {
                 // background for selection
-                SetLineColor();
-                SetFillColor( rStyleSettings.GetHighlightColor() );
-                DrawRect( aFillRect );
+                GetOutDev()->SetLineColor();
+                GetOutDev()->SetFillColor( rStyleSettings.GetHighlightColor() 
);
+                GetOutDev()->DrawRect( aFillRect );
             }
         }
 
-        SetLineColor( rStyleSettings.GetDarkShadowColor() );
+        GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() );
         if (bVertical)
         {
             tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
-            DrawLine( Point( nDarkPos, nPStart ), Point( nDarkPos, nLineEnd ) 
);
+            GetOutDev()->DrawLine( Point( nDarkPos, nPStart ), Point( 
nDarkPos, nLineEnd ) );
         }
         else
-            DrawLine( Point( nPStart, nBarSize-1 ), Point( nLineEnd, 
nBarSize-1 ) );
+            GetOutDev()->DrawLine( Point( nPStart, nBarSize-1 ), Point( 
nLineEnd, nBarSize-1 ) );
 
         // line in different color for selection
         if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && 
!bHighContrast )
         {
-            SetLineColor( aSelLineColor );
+            GetOutDev()->SetLineColor( aSelLineColor );
             if (bVertical)
             {
                 tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
-                DrawLine( Point( nDarkPos, nTransStart ), Point( nDarkPos, 
nTransEnd ) );
+                GetOutDev()->DrawLine( Point( nDarkPos, nTransStart ), Point( 
nDarkPos, nTransEnd ) );
             }
             else
-                DrawLine( Point( nTransStart, nBarSize-1 ), Point( nTransEnd, 
nBarSize-1 ) );
+                GetOutDev()->DrawLine( Point( nTransStart, nBarSize-1 ), 
Point( nTransEnd, nBarSize-1 ) );
         }
     }
 
@@ -446,7 +446,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
     //  loop through entries several times to avoid changing the line color 
too often
     //  and to allow merging of lines
 
-    ScGridMerger aGrid( this, 1, 1 );
+    ScGridMerger aGrid( GetOutDev(), 1, 1 );
 
     //  start at SC_HDRPAINT_BOTTOM instead of 0 - selection doesn't get 
different
     //  borders, light border at top isn't used anymore
@@ -459,10 +459,10 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
         {
             case SC_HDRPAINT_SEL_BOTTOM:
                 // same as non-selected for high contrast
-                SetLineColor( bHighContrast ? 
rStyleSettings.GetDarkShadowColor() : aSelLineColor );
+                GetOutDev()->SetLineColor( bHighContrast ? 
rStyleSettings.GetDarkShadowColor() : aSelLineColor );
                 break;
             case SC_HDRPAINT_BOTTOM:
-                SetLineColor( rStyleSettings.GetDarkShadowColor() );
+                GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() 
);
                 break;
             case SC_HDRPAINT_TEXT:
                 // DrawSelectionBackground is used only for high contrast on 
light background
@@ -538,10 +538,10 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
                                     if ( GetEntrySize(nEntryNo+1)==0 )
                                     {
                                         if (bVertical)
-                                            DrawLine( 
Point(aScrPos.X(),aEndPos.Y()-nLayoutSign),
+                                            GetOutDev()->DrawLine( 
Point(aScrPos.X(),aEndPos.Y()-nLayoutSign),
                                                       
Point(aEndPos.X(),aEndPos.Y()-nLayoutSign) );
                                         else
-                                            DrawLine( 
Point(aEndPos.X()-nLayoutSign,aScrPos.Y()),
+                                            GetOutDev()->DrawLine( 
Point(aEndPos.X()-nLayoutSign,aScrPos.Y()),
                                                       
Point(aEndPos.X()-nLayoutSign,aEndPos.Y()) );
                                     }
                             }
@@ -603,7 +603,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
                                     
aTxtPos.AdjustX((nSizePix*nLayoutSign-aTextSize.Width()+1)/2 );
                                     
aTxtPos.AdjustY((nBarSize-aTextSize.Height())/2 );
                                 }
-                                DrawText( aTxtPos, aString );
+                                GetOutDev()->DrawText( aTxtPos, aString );
                             }
                             break;
                     }
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index 7b8dd7f6aef2..fd9ce3b406e0 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -149,19 +149,19 @@ void ScNoteMarker::Draw()
     if ( !(m_xObject && m_bVisible) )
         return;
 
-    lcl_DrawWin( m_xObject.get(), m_pWindow, m_aMapMode );
+    lcl_DrawWin( m_xObject.get(), m_pWindow->GetOutDev(), m_aMapMode );
 
     if ( m_pRightWin || m_pBottomWin )
     {
         Size aWinSize = m_pWindow->PixelToLogic( 
m_pWindow->GetOutputSizePixel(), m_aMapMode );
         if ( m_pRightWin )
-            lcl_DrawWin( m_xObject.get(), m_pRightWin,
+            lcl_DrawWin( m_xObject.get(), m_pRightWin->GetOutDev(),
                             lcl_MoveMapMode( m_aMapMode, Size( 
aWinSize.Width(), 0 ) ) );
         if ( m_pBottomWin )
-            lcl_DrawWin( m_xObject.get(), m_pBottomWin,
+            lcl_DrawWin( m_xObject.get(), m_pBottomWin->GetOutDev(),
                             lcl_MoveMapMode( m_aMapMode, Size( 0, 
aWinSize.Height() ) ) );
         if ( m_pDiagWin )
-            lcl_DrawWin( m_xObject.get(), m_pDiagWin, lcl_MoveMapMode( 
m_aMapMode, aWinSize ) );
+            lcl_DrawWin( m_xObject.get(), m_pDiagWin->GetOutDev(), 
lcl_MoveMapMode( m_aMapMode, aWinSize ) );
     }
 }
 
diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx
index 97b7682d8fad..c6a5aac8488f 100644
--- a/sc/source/ui/view/olinewin.cxx
+++ b/sc/source/ui/view/olinewin.cxx
@@ -513,7 +513,7 @@ void ScOutlineWindow::DataChanged( const DataChangedEvent& 
rDCEvt )
 
 void ScOutlineWindow::SetEntryAreaClipRegion()
 {
-    SetClipRegion( vcl::Region(tools::Rectangle(
+    GetOutDev()->SetClipRegion( vcl::Region(tools::Rectangle(
         GetPoint( 0, mnMainFirstPos ),
         GetPoint( GetOutputSizeLevel() - 1, mnMainLastPos ))));
 }
@@ -521,13 +521,13 @@ void ScOutlineWindow::SetEntryAreaClipRegion()
 void ScOutlineWindow::DrawLineRel(
         tools::Long nLevelStart, tools::Long nEntryStart, tools::Long 
nLevelEnd, tools::Long nEntryEnd )
 {
-    DrawLine( GetPoint( nLevelStart, nEntryStart ), GetPoint( nLevelEnd, 
nEntryEnd ) );
+    GetOutDev()->DrawLine( GetPoint( nLevelStart, nEntryStart ), GetPoint( 
nLevelEnd, nEntryEnd ) );
 }
 
 void ScOutlineWindow::DrawRectRel(
         tools::Long nLevelStart, tools::Long nEntryStart, tools::Long 
nLevelEnd, tools::Long nEntryEnd )
 {
-    DrawRect( GetRectangle( nLevelStart, nEntryStart, nLevelEnd, nEntryEnd ) );
+    GetOutDev()->DrawRect( GetRectangle( nLevelStart, nEntryStart, nLevelEnd, 
nEntryEnd ) );
 }
 
 namespace
@@ -541,11 +541,11 @@ namespace
 void ScOutlineWindow::DrawImageRel(tools::Long nLevelPos, tools::Long 
nEntryPos, const OUString& rId)
 {
     const Image& rImage = GetImage(rId);
-    SetLineColor();
-    SetFillColor( GetBackground().GetColor() );
+    GetOutDev()->SetLineColor();
+    GetOutDev()->SetFillColor( GetBackground().GetColor() );
     Point aPos( GetPoint( nLevelPos, nEntryPos ) );
-    DrawRect( tools::Rectangle( aPos, rImage.GetSizePixel() ) );
-    DrawImage( aPos, rImage );
+    GetOutDev()->DrawRect( tools::Rectangle( aPos, rImage.GetSizePixel() ) );
+    GetOutDev()->DrawImage( aPos, rImage );
 }
 
 void ScOutlineWindow::DrawBorderRel( size_t nLevel, size_t nEntry, bool 
bPressed )
@@ -557,9 +557,9 @@ void ScOutlineWindow::DrawBorderRel( size_t nLevel, size_t 
nEntry, bool bPressed
         bool bClip = (nEntry != SC_OL_HEADERENTRY);
         if ( bClip )
             SetEntryAreaClipRegion();
-        DrawImage(aPos, GetImage(sId));
+        GetOutDev()->DrawImage(aPos, GetImage(sId));
         if ( bClip )
-            SetClipRegion();
+            GetOutDev()->SetClipRegion();
     }
     mbMTPressed = bPressed;
 }
@@ -585,7 +585,7 @@ void ScOutlineWindow::ShowFocus()
             SetEntryAreaClipRegion();
         InvertTracking( maFocusRect, ShowTrackFlags::Small | 
ShowTrackFlags::TrackWindow );
         if ( bClip )
-            SetClipRegion();
+            GetOutDev()->SetClipRegion();
     }
 }
 
@@ -598,7 +598,7 @@ void ScOutlineWindow::HideFocus()
             SetEntryAreaClipRegion();
         InvertTracking( maFocusRect, ShowTrackFlags::Small | 
ShowTrackFlags::TrackWindow );
         if ( bClip )
-            SetClipRegion();
+            GetOutDev()->SetClipRegion();
         maFocusRect.SetEmpty();
     }
 }
@@ -624,7 +624,7 @@ void ScOutlineWindow::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
     tools::Long nLevelEnd = (mbHoriz ? aSize.Height() : aSize.Width()) - 1;
     tools::Long nEntryEnd = (mbHoriz ? aSize.Width() : aSize.Height()) - 1;
 
-    SetLineColor( maLineColor );
+    GetOutDev()->SetLineColor( maLineColor );
     tools::Long nBorderPos = mbMirrorLevels ? 0 : nLevelEnd;
     DrawLineRel( nBorderPos, 0, nBorderPos, nEntryEnd );
 
@@ -641,7 +641,7 @@ void ScOutlineWindow::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
         for ( size_t nLevel = 0; nLevel < nLevelCount; ++nLevel )
             DrawImageRel(GetLevelPos(nLevel), nEntryPos, 
OUString(aLevelBmps[nLevel]));
 
-        SetLineColor( maLineColor );
+        GetOutDev()->SetLineColor( maLineColor );
         tools::Long nLinePos = mnHeaderPos + (mbMirrorEntries ? 0 : 
(mnHeaderSize - 1));
         DrawLineRel( 0, nLinePos, nLevelEnd, nLinePos );
     }
@@ -662,8 +662,8 @@ void ScOutlineWindow::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
         size_t nEntry;
 
         // first draw all lines in the current level
-        SetLineColor();
-        SetFillColor( maLineColor );
+        GetOutDev()->SetLineColor();
+        GetOutDev()->SetFillColor( maLineColor );

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to