diff options
270 files changed, 1766 insertions, 1271 deletions
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 ); for ( nEntry = 0; nEntry < nEntryCount; ++nEntry ) { const ScOutlineEntry* pEntry = pArray->GetEntry( sal::static_int_cast<sal_uInt16>(nLevel), @@ -717,7 +717,7 @@ void ScOutlineWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools } } - SetClipRegion(); + GetOutDev()->SetClipRegion(); if ( !mbDontDrawFocus ) ShowFocus(); diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index b4b5e4d3ea80..f5477989f73f 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -124,12 +124,12 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* nHeaderHeight ( 0 ), nFooterHeight ( 0 ) { - SetOutDevViewType( OutDevViewType::PrintPreview ); + GetOutDev()->SetOutDevViewType( OutDevViewType::PrintPreview ); SetBackground(); SetHelpId( HID_SC_WIN_PREVIEW ); - SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); + GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); } ScPreview::~ScPreview() @@ -160,7 +160,7 @@ void ScPreview::UpdateDrawView() // nTab must be right if ( !pDrawView ) // New Drawing? { - pDrawView.reset( new FmFormView( *pModel, this) ); + pDrawView.reset( new FmFormView( *pModel, GetOutDev()) ); // The DrawView takes over the Design-Mode from the Model // (Settings "In opening Draftmode"), therefore to restore here @@ -259,7 +259,7 @@ void ScPreview::CalcPages() tools::Long nAttrPage = i > 0 ? nFirstAttr[i-1] : 1; tools::Long nThisStart = nTotalPages; - ScPrintFunc aPrintFunc( this, pDocShell, i, nAttrPage, 0, nullptr, &aOptions ); + ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, i, nAttrPage, 0, nullptr, &aOptions ); tools::Long nThisTab = aPrintFunc.GetTotalPages(); if (!aPrintFunc.HasPrintRange()) mbHasEmptyRangeTable = true; @@ -357,14 +357,14 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if ( bDoPrint && ( aOffset.X() < 0 || aOffset.Y() < 0 ) && bValidPage ) { SetMapMode( aMMMode ); - SetLineColor(); - SetFillColor(aBackColor); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor(aBackColor); - Size aWinSize = GetOutputSize(); + Size aWinSize = GetOutDev()->GetOutputSize(); if ( aOffset.X() < 0 ) - DrawRect(tools::Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() )); + GetOutDev()->DrawRect(tools::Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() )); if ( aOffset.Y() < 0 ) - DrawRect(tools::Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); + GetOutDev()->DrawRect(tools::Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); } tools::Long nLeftMargin = 0; @@ -384,9 +384,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc; if (bStateValid) - pPrintFunc.reset(new ScPrintFunc(this, pDocShell, aState, &aOptions)); + pPrintFunc.reset(new ScPrintFunc(GetOutDev(), pDocShell, aState, &aOptions)); else - pPrintFunc.reset(new ScPrintFunc(this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions)); + pPrintFunc.reset(new ScPrintFunc(GetOutDev(), pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions)); pPrintFunc->SetOffset(aOffset); pPrintFunc->SetManualZoom(nZoom); @@ -484,7 +484,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if ( !bValidPage ) nPageEndX = nPageEndY = 0; - Size aWinSize = GetOutputSize(); + Size aWinSize = GetOutDev()->GetOutputSize(); Point aWinEnd( aWinSize.Width(), aWinSize.Height() ); bool bRight = nPageEndX <= aWinEnd.X(); bool bBottom = nPageEndY <= aWinEnd.Y(); @@ -497,9 +497,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) SetMapMode(aMMMode); // Draw background first. - SetLineColor(); - SetFillColor(aBackColor); - DrawRect(tools::Rectangle(0, 0, aWinEnd.X(), aWinEnd.Y())); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor(aBackColor); + GetOutDev()->DrawRect(tools::Rectangle(0, 0, aWinEnd.X(), aWinEnd.Y())); const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN); @@ -530,7 +530,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) (aWinEnd.X() - pEditEng->CalcTextWidth())/2, (aWinEnd.Y() - pEditEng->GetTextHeight())/2); - pEditEng->Draw(this, aCenter); + pEditEng->Draw(GetOutDev(), aCenter); return; } @@ -538,7 +538,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if( bPageMargin && bValidPage ) { SetMapMode(aMMMode); - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); DrawInvert( static_cast<tools::Long>( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar ); DrawInvert( static_cast<tools::Long>(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar ); DrawInvert( static_cast<tools::Long>( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar ); @@ -556,10 +556,10 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) { Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); - SetLineColor( COL_BLACK ); - SetFillColor( COL_BLACK ); - DrawRect( tools::Rectangle( Point( mvRight[i] - 2, aColumnTop.Y() ),Point( mvRight[i] + 2 , 4 + aColumnTop.Y()) )); - DrawLine( Point( mvRight[i], aColumnTop.Y() ), Point( mvRight[i], 10 + aColumnTop.Y()) ); + GetOutDev()->SetLineColor( COL_BLACK ); + GetOutDev()->SetFillColor( COL_BLACK ); + GetOutDev()->DrawRect( tools::Rectangle( Point( mvRight[i] - 2, aColumnTop.Y() ),Point( mvRight[i] + 2 , 4 + aColumnTop.Y()) )); + GetOutDev()->DrawLine( Point( mvRight[i], aColumnTop.Y() ), Point( mvRight[i], 10 + aColumnTop.Y()) ); } SetMapMode( aMMMode ); } @@ -567,16 +567,16 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if (bRight || bBottom) { SetMapMode(aMMMode); - SetLineColor(); - SetFillColor(aBackColor); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor(aBackColor); if (bRight) - DrawRect(tools::Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y())); + GetOutDev()->DrawRect(tools::Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y())); if (bBottom) { if (bRight) - DrawRect(tools::Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Corner not duplicated + GetOutDev()->DrawRect(tools::Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Corner not duplicated else - DrawRect(tools::Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y())); + GetOutDev()->DrawRect(tools::Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y())); } } @@ -589,19 +589,19 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if ( aOffset.X() <= 0 || aOffset.Y() <= 0 || bRight || bBottom ) { - SetLineColor( aBorderColor ); - SetFillColor(); + GetOutDev()->SetLineColor( aBorderColor ); + GetOutDev()->SetFillColor(); tools::Rectangle aPixel( LogicToPixel( tools::Rectangle( -aOffset.X(), -aOffset.Y(), nPageEndX, nPageEndY ) ) ); aPixel.AdjustRight( -1 ); aPixel.AdjustBottom( -1 ); - DrawRect( PixelToLogic( aPixel ) ); + GetOutDev()->DrawRect( PixelToLogic( aPixel ) ); } // draw shadow - SetLineColor(); - SetFillColor( aBorderColor ); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor( aBorderColor ); tools::Rectangle aPixel; @@ -609,13 +609,13 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) aPixel.AdjustTop(SC_PREVIEW_SHADOWSIZE ); aPixel.AdjustRight(SC_PREVIEW_SHADOWSIZE - 1 ); aPixel.AdjustBottom(SC_PREVIEW_SHADOWSIZE - 1 ); - DrawRect( PixelToLogic( aPixel ) ); + GetOutDev()->DrawRect( PixelToLogic( aPixel ) ); aPixel = LogicToPixel( tools::Rectangle( -aOffset.X(), nPageEndY, nPageEndX, nPageEndY ) ); aPixel.AdjustLeft(SC_PREVIEW_SHADOWSIZE ); aPixel.AdjustRight(SC_PREVIEW_SHADOWSIZE - 1 ); aPixel.AdjustBottom(SC_PREVIEW_SHADOWSIZE - 1 ); - DrawRect( PixelToLogic( aPixel ) ); + GetOutDev()->DrawRect( PixelToLogic( aPixel ) ); } void ScPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /* rRect */ ) @@ -678,7 +678,7 @@ const ScPreviewLocationData& ScPreview::GetLocationData() { if ( !pLocationData ) { - pLocationData.reset( new ScPreviewLocationData( &pDocShell->GetDocument(), this ) ); + pLocationData.reset( new ScPreviewLocationData( &pDocShell->GetDocument(), GetOutDev() ) ); bLocationValid = false; } if ( !bLocationValid ) @@ -1117,7 +1117,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( this, pDocShell, nTab ); + ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab ); aPrintFunc.UpdatePages(); } @@ -1219,7 +1219,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( this, pDocShell, nTab ); + ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab ); aPrintFunc.UpdatePages(); } @@ -1279,7 +1279,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( this, pDocShell, nTab ); + ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab ); aPrintFunc.UpdatePages(); } tools::Rectangle aRect(0, 0, 10000, 10000); @@ -1311,9 +1311,9 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt ) std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc; if (bStateValid) - pPrintFunc.reset(new ScPrintFunc( this, pDocShell, aState, &aOptions )); + pPrintFunc.reset(new ScPrintFunc( GetOutDev(), pDocShell, aState, &aOptions )); else - pPrintFunc.reset(new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions )); + pPrintFunc.reset(new ScPrintFunc( GetOutDev(), pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions )); nLeftMargin = o3tl::convert(pPrintFunc->GetLeftMargin(), o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X(); nRightMargin = o3tl::convert(pPrintFunc->GetRightMargin(), o3tl::Length::twip, o3tl::Length::mm100); @@ -1562,12 +1562,12 @@ void ScPreview::DrawInvert( tools::Long nDragPos, PointerStyle nFlags ) if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit ) { tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1, o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y()); - Invert( aRect, InvertFlags::N50 ); + GetOutDev()->Invert( aRect, InvertFlags::N50 ); } else if( nFlags == PointerStyle::VSizeBar ) { tools::Rectangle aRect( -aOffset.X(), nDragPos, o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X(), nDragPos + 1 ); - Invert( aRect, InvertFlags::N50 ); + GetOutDev()->Invert( aRect, InvertFlags::N50 ); } } diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 62de4f07ebd7..c2495c24386f 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -287,7 +287,7 @@ void ScPreviewShell::UpdateNeededScrollBars( bool bFromZoom ) // for centering, page size without the shadow is used bool bVert = pVerScroll->IsVisible(); bool bHori = pHorScroll->IsVisible(); - Size aWindowSize = pPreview->GetOutputSize(); + Size aWindowSize = pPreview->GetOutDev()->GetOutputSize(); Point aPos = pPreview->GetPosPixel(); Size aWindowPixelSize = pPreview->GetOutputSizePixel(); @@ -349,7 +349,7 @@ void ScPreviewShell::UpdateScrollBars() // for centering, page size without the shadow is used - Size aWindowSize = pPreview->GetOutputSize(); + Size aWindowSize = pPreview->GetOutDev()->GetOutputSize(); Point aOfs = pPreview->GetOffset(); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index aa535aca0aa2..c3644c2a26b4 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -246,7 +246,7 @@ void ScSpellDialogChildWindow::Init() mxEngine.reset( new ScSpellingEngine( mpDoc->GetEnginePool(), *mpViewData, mxUndoDoc.get(), mxRedoDoc.get(), LinguMgr::GetSpellChecker() ) ); - mxEngine->SetRefDevice( mpViewData->GetActiveWin() ); + mxEngine->SetRefDevice( mpViewData->GetActiveWin()->GetOutDev() ); mpViewShell->MakeEditView( mxEngine.get(), nCol, nRow ); EditView* pEditView = mpViewData->GetEditView( mpViewData->GetActivePart() ); diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx index 8f0bd7a0e5af..e2ed5f86c265 100644 --- a/sc/source/ui/view/tabsplit.cxx +++ b/sc/source/ui/view/tabsplit.cxx @@ -106,7 +106,7 @@ void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const tools::Rect const tools::Long w4 = rRect.GetWidth() / 4; // First yc fraction is truncated, second one is rounded. This will draw a centered line // in handlers with odd height and a centered rectangle in those with even height. - DrawRect(tools::Rectangle(Point(rRect.Left() + w4, yc / 2), + GetOutDev()->DrawRect(tools::Rectangle(Point(rRect.Left() + w4, yc / 2), Point(rRect.Right() - w4, (yc + 1) / 2))); break; } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index d2158ebe6529..fde36dce68cd 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -186,7 +186,7 @@ ScTabView::~ScTabView() for (i=0; i<4; i++) if (pGridWin[i]) { - pDrawView->DeleteWindowFromPaintView(pGridWin[i]); + pDrawView->DeleteWindowFromPaintView(pGridWin[i]->GetOutDev()); } pDrawView->HideSdrPage(); @@ -235,12 +235,12 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) OSL_ENSURE(pLayer, "Where is the Draw Layer ??"); sal_uInt16 i; - pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData ) ); + pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT]->GetOutDev(), &aViewData ) ); for (i=0; i<4; i++) if (pGridWin[i]) { if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) ) - pDrawView->AddWindowToPaintView(pGridWin[i], nullptr); + pDrawView->AddWindowToPaintView(pGridWin[i]->GetOutDev(), nullptr); } pDrawView->RecalcScale(); for (i=0; i<4; i++) @@ -273,7 +273,7 @@ void ScTabView::DoAddWin( ScGridWindow* pWin ) { if (pDrawView) { - pDrawView->AddWindowToPaintView(pWin, nullptr); + pDrawView->AddWindowToPaintView(pWin->GetOutDev(), nullptr); pWin->DrawLayerCreated(); } pWin->SetAutoSpellContext(mpSpellCheckCxt); @@ -535,7 +535,7 @@ void ScTabView::DigitLanguageChanged() LanguageType eNewLang = SC_MOD()->GetOptDigitLanguage(); for (VclPtr<ScGridWindow> & pWin : pGridWin) if ( pWin ) - pWin->SetDigitLanguage( eNewLang ); + pWin->GetOutDev()->SetDigitLanguage( eNewLang ); } void ScTabView::ScrollToObject( const SdrObject* pDrawObj ) diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 652482ec5d6f..af00b3bdb76d 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -57,7 +57,7 @@ void ScTabViewShell::WindowChanged() ScDrawView* pDrView = GetScDrawView(); if (pDrView) - pDrView->SetActualWin(pWin); + pDrView->SetActualWin(pWin->GetOutDev()); FuPoor* pFunc = GetDrawFuncPtr(); if (pFunc) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 015083828bb1..233ea9206e2e 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1453,7 +1453,7 @@ tools::Rectangle ScViewData::GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW Point aCellTopLeft = bInPrintTwips ? GetPrintTwipsPos(nPosX, nPosY) : GetScrPos(nPosX, nPosY, eWhich, true); return ScEditUtil(&mrDoc, nPosX, nPosY, nTabNo, aCellTopLeft, - pWin, nPPTX, nPPTY, GetZoomX(), GetZoomY(), bInPrintTwips ). + pWin->GetOutDev(), nPPTX, nPPTY, GetZoomX(), GetZoomY(), bInPrintTwips ). GetEditArea( pPattern, bForceToTop ); } @@ -1537,14 +1537,14 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, bool bAsianVertical = pNewEngine->IsVertical(); // set by InputHandler tools::Rectangle aPixRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, GetScrPos(nNewX, nNewY, eWhich), - pWin, nPPTX,nPPTY,GetZoomX(),GetZoomY() ). + pWin->GetOutDev(), nPPTX,nPPTY,GetZoomX(),GetZoomY() ). GetEditArea( pPattern, true ); tools::Rectangle aPTwipsRect; if (bLOKPrintTwips) { aPTwipsRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, GetPrintTwipsPos(nNewX, nNewY), - pWin, nPPTX, nPPTY, GetZoomX(), GetZoomY(), true /* bInPrintTwips */). + pWin->GetOutDev(), nPPTX, nPPTY, GetZoomX(), GetZoomY(), true /* bInPrintTwips */). GetEditArea(pPattern, true); } @@ -1672,7 +1672,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // (and same line breaks) as for output. Fraction aFract(1,1); - tools::Rectangle aUtilRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, Point(0, 0), pWin, + tools::Rectangle aUtilRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, Point(0, 0), pWin->GetOutDev(), HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false ); aPaperSize.setWidth( aUtilRect.GetWidth() ); if (bLOKPrintTwips) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index c151099b098f..da38a099826b 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -359,7 +359,7 @@ void ScViewFunc::DoThesaurus() pThesaurusEngine.reset(new ScEditEngineDefaulter(rDoc.GetEnginePool())); pThesaurusEngine->SetEditTextObjectPool( rDoc.GetEditPool() ); - pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()); + pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()->GetOutDev()); pThesaurusEngine->SetSpeller(xSpeller); MakeEditView(pThesaurusEngine.get(), nCol, nRow ); std::unique_ptr<SfxItemSet> pEditDefaults( @@ -522,7 +522,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam ) } MakeEditView( pEngine.get(), nCol, nRow ); - pEngine->SetRefDevice( rViewData.GetActiveWin() ); + pEngine->SetRefDevice( rViewData.GetActiveWin()->GetOutDev() ); // simulate dummy cell: pEditView = rViewData.GetEditView( rViewData.GetActivePart() ); rViewData.SetSpellingView( pEditView ); diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index 8436e88f9bc5..ef1d1240c315 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -69,7 +69,7 @@ AccessibleDocumentViewBase::AccessibleDocumentViewBase ( mxController (rxController), maViewForwarder ( static_cast<SdrPaintView*>(pViewShell->GetView()), - *pSdWindow) + *pSdWindow->GetOutDev()) { if (mxController.is()) mxModel = mxController->getModel(); diff --git a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx index cc0900a836de..9cebb322f006 100644 --- a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx +++ b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx @@ -79,8 +79,7 @@ Point AccessibleViewForwarder::LogicToPixel(const Point& rPoint) const { SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId)); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - ::tools::Rectangle aBBox( - static_cast<vcl::Window&>(rOutDev).GetWindowExtentsRelative(nullptr)); + ::tools::Rectangle aBBox(rOutDev.GetOwnerWindow()->GetWindowExtentsRelative(nullptr)); return rOutDev.LogicToPixel(rPoint) + aBBox.TopLeft(); } else diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index dab0e22cf251..cf683aafd74d 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -445,7 +445,7 @@ bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl ) } else if( rMEvt.IsLeft() ) { - OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); + OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow()->GetOutDev(); Point aMDPos( pOut->PixelToLogic( rMEvt.GetPosPixel() ) ); if( !mrView.IsFrameDragSingles() && mrView.IsInsObjPointMode() && (rHdl.GetObjHdlNum() == SMART_TAG_HDL_NUM) ) @@ -686,7 +686,7 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt ) if(rKEvt.GetKeyCode().IsMod2()) { - OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); + OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow()->GetOutDev(); Size aLogicSizeOnePixel = pOut ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); nX *= aLogicSizeOnePixel.Width(); nY *= aLogicSizeOnePixel.Height(); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 052245ac15fd..cfd632dcc2bd 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -414,7 +414,7 @@ bool AnnotationTag::OnMove( const KeyEvent& rKEvt ) if(rKEvt.GetKeyCode().IsMod2()) { - OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); + OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow()->GetOutDev(); Size aLogicSizeOnePixel = pOut ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); nX *= aLogicSizeOnePixel.Width(); nY *= aLogicSizeOnePixel.Height(); @@ -574,7 +574,8 @@ void AnnotationTag::OpenPopup( bool bEdit ) if( !mpAnnotationWindow ) { - vcl::Window* pWindow = dynamic_cast< vcl::Window* >( getView().GetFirstOutputDevice() ); + OutputDevice* pOut = getView().GetFirstOutputDevice(); + vcl::Window* pWindow = pOut ? pOut->GetOwnerWindow() : nullptr; if( pWindow ) { RealPoint2D aPosition( mxAnnotation->getPosition() ); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 1ef08386396b..2ab345103a52 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -864,7 +864,7 @@ void AnimationWindow::AddObj (::sd::View& rView ) void AnimationWindow::CreateAnimObj (::sd::View& rView ) { - vcl::Window* pOutWin = static_cast< vcl::Window*>(rView.GetFirstOutputDevice()); // GetWin( 0 ); + vcl::Window* pOutWin = rView.GetFirstOutputDevice()->GetOwnerWindow(); // GetWin( 0 ); DBG_ASSERT( pOutWin, "Window does not exist!" ); // find window center diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index f88c0d6bf463..e9eb1b2bacef 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -172,7 +172,7 @@ bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt) } else { - mpView->MouseButtonDown(rMEvt, mpWindow); + mpView->MouseButtonDown(rMEvt, mpWindow->GetOutDev()); SdrObject* pObj = mpView->GetCreateObj(); @@ -204,7 +204,7 @@ bool FuConstructBezierPolygon::MouseButtonUp(const MouseEvent& rMEvt ) } else { - mpView->MouseButtonUp(rMEvt, mpWindow); + mpView->MouseButtonUp(rMEvt, mpWindow->GetOutDev()); } if (aVEvt.eEvent == SdrEventKind::EndCreate) diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 2156624f4508..18cd90fb77e6 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -193,7 +193,7 @@ bool FuDraw::MouseButtonDown(const MouseEvent& rMEvt) // look only for HelpLines when they are visible (!) bool bHelpLine(false); if(mpView->IsHlplVisible()) - bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow, nHelpLine, pPV); + bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow->GetOutDev(), nHelpLine, pPV); bool bHitHdl = (mpView->PickHandle(aMDPos) != nullptr); if ( bHelpLine @@ -257,7 +257,7 @@ bool FuDraw::MouseMove(const MouseEvent& rMEvt) mpView->MovDragHelpLine(aPos); } - bool bReturn = mpView->MouseMove(rMEvt, mpWindow); + bool bReturn = mpView->MouseMove(rMEvt, mpWindow->GetOutDev()); if (mpView->IsAction()) { @@ -571,7 +571,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) if (bDefPointer) { mpWindow->SetPointer(mpView->GetPreferredPointer( - aPnt, mpWindow, nModifier, bLeftDown)); + aPnt, mpWindow->GetOutDev(), nModifier, bLeftDown)); } } diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx index efbf255f3ef2..25f4b9cf4b66 100644 --- a/sd/source/ui/func/fuediglu.cxx +++ b/sd/source/ui/func/fuediglu.cxx @@ -74,7 +74,7 @@ FuEditGluePoints::~FuEditGluePoints() bool FuEditGluePoints::MouseButtonDown(const MouseEvent& rMEvt) { - mpView->SetActualWin( mpWindow ); + mpView->SetActualWin( mpWindow->GetOutDev() ); bool bReturn = FuDraw::MouseButtonDown(rMEvt); @@ -196,7 +196,7 @@ bool FuEditGluePoints::MouseButtonDown(const MouseEvent& rMEvt) bool FuEditGluePoints::MouseMove(const MouseEvent& rMEvt) { - mpView->SetActualWin( mpWindow ); + mpView->SetActualWin( mpWindow->GetOutDev() ); FuDraw::MouseMove(rMEvt); @@ -215,7 +215,7 @@ bool FuEditGluePoints::MouseMove(const MouseEvent& rMEvt) bool FuEditGluePoints::MouseButtonUp(const MouseEvent& rMEvt) { - mpView->SetActualWin( mpWindow ); + mpView->SetActualWin( mpWindow->GetOutDev() ); bool bReturn = false; @@ -255,7 +255,7 @@ bool FuEditGluePoints::MouseButtonUp(const MouseEvent& rMEvt) */ bool FuEditGluePoints::KeyInput(const KeyEvent& rKEvt) { - mpView->SetActualWin( mpWindow ); + mpView->SetActualWin( mpWindow->GetOutDev() ); //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, //and SHIFT+ENTER key to decide the position and draw the new insert point @@ -362,7 +362,7 @@ void FuEditGluePoints::ForcePointer(const MouseEvent* pMEvt) bool FuEditGluePoints::Command(const CommandEvent& rCEvt) { - mpView->SetActualWin( mpWindow ); + mpView->SetActualWin( mpWindow->GetOutDev() ); return FuPoor::Command( rCEvt ); } diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx index 9913f9635181..b4e93d7b41e1 100644 --- a/sd/source/ui/func/fusnapln.cxx +++ b/sd/source/ui/func/fusnapln.cxx @@ -84,7 +84,7 @@ void FuSnapLine::DoExecute( SfxRequest& rReq ) { aLinePos = mpWindow->PixelToLogic(aLinePos); sal_uInt16 nHitLog = static_cast<sal_uInt16>(mpWindow->PixelToLogic(Size(HITPIX,0)).Width()); - bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow, nHelpLine, pPV); + bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow->GetOutDev(), nHelpLine, pPV); if ( bLineExist ) aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos(); else diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 11e97a3bc7ed..ec04594d3d95 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -278,7 +278,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) if (eHit == SdrHitKind::TextEdit) { // hit text -> SdrView handles event - if (mpView->MouseButtonDown(rMEvt, mpWindow)) + if (mpView->MouseButtonDown(rMEvt, mpWindow->GetOutDev())) return true; } @@ -626,7 +626,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow)) || rMEvt.GetClicks() == 2 ) + if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow->GetOutDev())) || rMEvt.GetClicks() == 2 ) return true; // handle event from SdrView bool bEmptyTextObj = false; diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index c142dcba0945..52597482b5dd 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -56,7 +56,7 @@ ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, vc , mnFirstMouseMove(0) , mxController( xController ) { - SetOutDevViewType( OutDevViewType::SlideShow ); + GetOutDev()->SetOutDevViewType( OutDevViewType::SlideShow ); // Do never mirror the preview window. This explicitly includes right // to left writing environments. @@ -271,7 +271,7 @@ void ShowWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const ::tools::Re } else { - DrawWallpaper( rRect, maShowBackground ); + GetOutDev()->DrawWallpaper( rRect, maShowBackground ); if( SHOWWINDOWMODE_END == meShowWindowMode ) { @@ -385,7 +385,7 @@ void ShowWindow::TerminateShow() maLogo.Clear(); maPauseTimer.Stop(); maMouseTimer.Stop(); - Erase(); + GetOutDev()->Erase(); maShowBackground = Wallpaper( COL_BLACK ); meShowWindowMode = SHOWWINDOWMODE_NORMAL; mnPauseTimeout = SLIDE_NO_TIMEOUT; @@ -417,7 +417,7 @@ void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart ) maLogo.Clear(); maPauseTimer.Stop(); - Erase(); + GetOutDev()->Erase(); maShowBackground = Wallpaper( COL_BLACK ); meShowWindowMode = SHOWWINDOWMODE_NORMAL; mnPauseTimeout = SLIDE_NO_TIMEOUT; @@ -457,9 +457,9 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) { const MapMode& rMap = GetMapMode(); const Point aOutOrg( PixelToLogic( Point() ) ); - const Size aOutSize( GetOutputSize() ); - const Size aTextSize(LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), rMap)); - const Size aOffset(LogicToLogic(Size(1000, 1000), MapMode(MapUnit::Map100thMM), rMap)); + const Size aOutSize( GetOutDev()->GetOutputSize() ); + const Size aTextSize(OutputDevice::LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), rMap)); + const Size aOffset(OutputDevice::LogicToLogic(Size(1000, 1000), MapMode(MapUnit::Map100thMM), rMap)); OUString aText( SdResId( STR_PRES_PAUSE ) ); bool bDrawn = false; @@ -478,21 +478,21 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) if (maLogo.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel) aGrfSize = PixelToLogic( maLogo.GetPrefSize() ); else - aGrfSize = LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap ); + aGrfSize = OutputDevice::LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap ); const Point aGrfPos( std::max( aOutOrg.X() + aOutSize.Width() - aGrfSize.Width() - aOffset.Width(), aOutOrg.X() ), std::max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) ); if( maLogo.IsAnimated() ) - maLogo.StartAnimation( this, aGrfPos, aGrfSize, reinterpret_cast<sal_IntPtr>(this) ); + maLogo.StartAnimation( GetOutDev(), aGrfPos, aGrfSize, reinterpret_cast<sal_IntPtr>(this) ); else - maLogo.Draw( this, aGrfPos, aGrfSize ); + maLogo.Draw( GetOutDev(), aGrfPos, aGrfSize ); } if( SLIDE_NO_TIMEOUT != mnPauseTimeout ) { MapMode aVMap( rMap ); - ScopedVclPtrInstance< VirtualDevice > pVDev( *this ); + ScopedVclPtrInstance< VirtualDevice > pVDev( *GetOutDev() ); aVMap.SetOrigin( Point() ); pVDev->SetMapMode( aVMap ); @@ -511,7 +511,7 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) aText += " ( " + aLocaleData.getDuration( ::tools::Time( 0, 0, mnPauseTimeout ) ) + " )"; pVDev->DrawText( Point( aOffset.Width(), 0 ), aText ); - DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev ); + GetOutDev()->DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev ); bDrawn = true; } } @@ -519,7 +519,7 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) if( !bDrawn ) { SetFont( aFont ); - DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText ); + GetOutDev()->DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText ); SetFont( aOldFont ); } } @@ -530,7 +530,7 @@ void ShowWindow::DrawEndScene() vcl::Font aFont( GetSettings().GetStyleSettings().GetMenuFont() ); const Point aOutOrg( PixelToLogic( Point() ) ); - const Size aTextSize(LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), GetMapMode())); + const Size aTextSize(OutputDevice::LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), GetMapMode())); const OUString aText( SdResId( STR_PRES_SOFTEND ) ); aFont.SetFontSize( aTextSize ); @@ -538,7 +538,7 @@ void ShowWindow::DrawEndScene() aFont.SetCharSet( aOldFont.GetCharSet() ); aFont.SetLanguage( aOldFont.GetLanguage() ); SetFont( aFont ); - DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText ); + GetOutDev()->DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText ); SetFont( aOldFont ); } @@ -584,7 +584,7 @@ IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent&, rEvent, void ) void ShowWindow::DeleteWindowFromPaintView() { if( mpViewShell->GetView() ) - mpViewShell->GetView()->DeleteWindowFromPaintView( this ); + mpViewShell->GetView()->DeleteWindowFromPaintView( GetOutDev() ); sal_uInt16 nChild = GetChildCount(); while( nChild-- ) @@ -594,7 +594,7 @@ void ShowWindow::DeleteWindowFromPaintView() void ShowWindow::AddWindowToPaintView() { if( mpViewShell->GetView() ) - mpViewShell->GetView()->AddWindowToPaintView( this, nullptr ); + mpViewShell->GetView()->AddWindowToPaintView( GetOutDev(), nullptr ); sal_uInt16 nChild = GetChildCount(); while( nChild-- ) diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index e9917f16b467..ac63931689b5 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -929,7 +929,7 @@ void SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Ref OutputDevice* SlideShow::getShowWindow() { - return mxController.is() ? mxController->mpShowWindow.get() : nullptr; + return mxController.is() ? mxController->mpShowWindow->GetOutDev() : nullptr; } int SlideShow::getAnimationMode() const diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b52fb82a9d22..b0b8163ff57d 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -631,7 +631,7 @@ void SAL_CALL SlideshowImpl::disposing() // take DrawView from presentation window, but give the old window back if( mpShowWindow && mpView ) - mpView->DeleteWindowFromPaintView( mpShowWindow ); + mpView->DeleteWindowFromPaintView( mpShowWindow->GetOutDev() ); if( mpView ) mpView->SetAnimationPause( false ); @@ -702,7 +702,7 @@ void SAL_CALL SlideshowImpl::disposing() ::tools::Rectangle aVisAreaWin = pActWin->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel) ); mpViewShell->VisAreaChanged(aVisAreaWin); if (mpView) - mpView->VisAreaChanged(pActWin); + mpView->VisAreaChanged(pActWin->GetOutDev()); pActWin->GrabFocus(); } } @@ -784,7 +784,7 @@ bool SlideshowImpl::startPreview( if( mpView ) { - mpView->AddWindowToPaintView( mpShowWindow, nullptr ); + mpView->AddWindowToPaintView( mpShowWindow->GetOutDev(), nullptr ); mpView->SetAnimationPause( true ); } @@ -969,7 +969,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings ) if( mpView ) { - mpView->AddWindowToPaintView( mpShowWindow, nullptr ); + mpView->AddWindowToPaintView( mpShowWindow->GetOutDev(), nullptr ); mpView->SetAnimationPause( true ); } diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 6ae302375449..4dfad09947a0 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -261,7 +261,7 @@ void SlideSorterController::Paint ( try { - mrView.CompleteRedraw(pWindow, vcl::Region(rBBox)); + mrView.CompleteRedraw(pWindow->GetOutDev(), vcl::Region(rBBox)); } catch (const Exception&) { @@ -552,7 +552,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, vo if (mrSlideSorter.GetViewShell() != nullptr) mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode); if (pActiveWindow != nullptr) - pActiveWindow->SetDrawMode(nDrawMode); + pActiveWindow->GetOutDev()->SetDrawMode(nDrawMode); mrView.HandleDrawModeChange(); // When the system font has changed a layout has to be done. @@ -596,7 +596,7 @@ void SlideSorterController::GetCtrlState (SfxItemSet& rSet) { if (mrSlideSorter.GetContentWindow()) { - DrawModeFlags nMode = mrSlideSorter.GetContentWindow()->GetDrawMode(); + DrawModeFlags nMode = mrSlideSorter.GetContentWindow()->GetOutDev()->GetDrawMode(); sal_uInt16 nQuality = 0; if (nMode == sd::OUTPUT_DRAWMODE_COLOR) { diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 1780554f74e9..dfa667984a12 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -540,8 +540,8 @@ void SlideSorterViewShell::ReadFrameViewData (FrameView* pFrameView) mpSlideSorter->GetController().Rearrange(true); // DrawMode for 'main' window - if (GetActiveWindow()->GetDrawMode() != pFrameView->GetDrawMode() ) - GetActiveWindow()->SetDrawMode( pFrameView->GetDrawMode() ); + if (GetActiveWindow()->GetOutDev()->GetDrawMode() != pFrameView->GetDrawMode() ) + GetActiveWindow()->GetOutDev()->SetDrawMode( pFrameView->GetDrawMode() ); } // When this slide sorter is not displayed in the main window then we do @@ -566,8 +566,8 @@ void SlideSorterViewShell::WriteFrameViewData() mpFrameView->SetSlidesPerRow(static_cast<sal_uInt16>(rView.GetLayouter().GetColumnCount())); // DrawMode for 'main' window - if( mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode() ) - mpFrameView->SetDrawMode( GetActiveWindow()->GetDrawMode() ); + if( mpFrameView->GetDrawMode() != GetActiveWindow()->GetOutDev()->GetDrawMode() ) + mpFrameView->SetDrawMode( GetActiveWindow()->GetOutDev()->GetDrawMode() ); SdPage* pActualPage = GetActualPage(); if (pActualPage != nullptr) diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index c56bd41cff83..c1eaf8302d08 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -114,7 +114,7 @@ private: SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter) : ::sd::View ( *rSlideSorter.GetModel().GetDocument(), - rSlideSorter.GetContentWindow(), + rSlideSorter.GetContentWindow()->GetOutDev(), rSlideSorter.GetViewShell()), mrSlideSorter(rSlideSorter), mrModel(rSlideSorter.GetModel()), @@ -576,7 +576,7 @@ void SlideSorterView::CompleteRedraw ( if (comphelper::LibreOfficeKit::isActive()) return; - if (pDevice == nullptr || pDevice!=mrSlideSorter.GetContentWindow()) + if (pDevice == nullptr || pDevice!=mrSlideSorter.GetContentWindow()->GetOutDev()) return; #ifdef DEBUG_TIMING diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx index 63f89b9ca1c1..9e1eae75778a 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx @@ -424,7 +424,7 @@ void PageObjectRun::operator () (const double nGlobalTime) // a) animations a bit more smooth and // b) on Mac without the Flush a Reset of the page locations is not properly // visualized when the mouse leaves the window during drag-and-drop. - mrAnimatorAccess.GetContentWindow()->Flush(); + mrAnimatorAccess.GetContentWindow()->GetOutDev()->Flush(); } } // end of namespace ::sd::slidesorter::view diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 6c17152faa9b..6b674f4f7302 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -130,7 +130,7 @@ void InsertionIndicatorOverlay::Create ( // Create virtual devices for bitmap and mask whose bitmaps later be // combined to form the BitmapEx of the icon. ScopedVclPtrInstance<VirtualDevice> pContent( - *mrSlideSorter.GetContentWindow(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); + *mrSlideSorter.GetContentWindow()->GetOutDev(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); pContent->SetOutputSizePixel(aIconSize); pContent->SetFillColor(); diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx index 4ae4ecdeeb60..9c2ce78303c7 100644 --- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx @@ -161,7 +161,7 @@ private: LayeredDevice::LayeredDevice (const VclPtr<sd::Window>& pTargetWindow) : mpTargetWindow(pTargetWindow), mpLayers(new LayerContainer()), - mpBackBuffer(VclPtr<VirtualDevice>::Create(*mpTargetWindow)), + mpBackBuffer(VclPtr<VirtualDevice>::Create(*mpTargetWindow->GetOutDev())), maSavedMapMode(pTargetWindow->GetMapMode()) { mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel()); @@ -273,7 +273,7 @@ void LayeredDevice::RepaintRectangle (const ::tools::Rectangle& rRepaintRectangl else if (mpLayers->size() == 1) { // Just copy the main layer into the target device. - (*mpLayers)[0]->Repaint(*mpTargetWindow, rRepaintRectangle); + (*mpLayers)[0]->Repaint(*mpTargetWindow->GetOutDev(), rRepaintRectangle); } else { @@ -285,7 +285,7 @@ void LayeredDevice::RepaintRectangle (const ::tools::Rectangle& rRepaintRectangl { it->Repaint(*mpBackBuffer, rRepaintRectangle); } - DeviceCopy(*mpTargetWindow, *mpBackBuffer, rRepaintRectangle); + DeviceCopy(*mpTargetWindow->GetOutDev(), *mpBackBuffer, rRepaintRectangle); } } @@ -387,7 +387,7 @@ void Layer::Initialize (sd::Window *pTargetWindow) #else if ( ! mpLayerDevice) { - mpLayerDevice.disposeAndReset(VclPtr<VirtualDevice>::Create(*pTargetWindow)); + mpLayerDevice.disposeAndReset(VclPtr<VirtualDevice>::Create(*pTargetWindow->GetOutDev())); mpLayerDevice->SetOutputSizePixel(pTargetWindow->GetSizePixel()); } #endif diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx index 6c90634e7c96..928c60306a7c 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx @@ -48,7 +48,7 @@ PageObjectLayouter::PageObjectLayouter ( maTransitionEffectBoundingBox(), maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)), maCustomAnimationEffectIcon(IconCache::Instance().GetIcon(BMP_CUSTOM_ANIMATION_INDICATOR)), - mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *pWindow)) + mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *pWindow->GetOutDev())) { const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount)); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index be6ce4b3ef2c..7b22240abfdd 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -45,7 +45,7 @@ PageObjectPainter::PageObjectPainter ( : mrLayouter(rSlideSorter.GetView().GetLayouter()), mpCache(rSlideSorter.GetView().GetPreviewCache()), mpTheme(rSlideSorter.GetTheme()), - mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rSlideSorter.GetContentWindow())), + mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rSlideSorter.GetContentWindow()->GetOutDev())), mpShadowPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_RawShadow))), mpFocusBorderPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_FocusBorder))) { diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index fdd2e0f78378..6cf3fdb3a5a5 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -666,7 +666,7 @@ uno::Reference< form::runtime::XFormController > SAL_CALL DrawController::getFor uno::Reference< form::runtime::XFormController > xController; if ( pFormShell && pSdrView && pWindow ) - xController = FmFormShell::GetFormController( Form, *pSdrView, *pWindow ); + xController = FmFormShell::GetFormController( Form, *pSdrView, *pWindow->GetOutDev() ); return xController; } @@ -703,7 +703,7 @@ uno::Reference< awt::XControl > SAL_CALL DrawController::getControl( const uno:: uno::Reference< awt::XControl > xControl; if ( pFormShell && pSdrView && pWindow ) - pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xControl ); + pFormShell->GetFormControl( xModel, *pSdrView, *pWindow->GetOutDev(), xControl ); return xControl; } diff --git a/sd/source/ui/view/WindowUpdater.cxx b/sd/source/ui/view/WindowUpdater.cxx index 410a0470f68d..c3f1bb53e337 100644 --- a/sd/source/ui/view/WindowUpdater.cxx +++ b/sd/source/ui/view/WindowUpdater.cxx @@ -49,7 +49,7 @@ void WindowUpdater::RegisterWindow (vcl::Window* pWindow) if (aWindowIterator == maWindowList.end()) { // Update the device once right now and add it to the list. - Update (pWindow); + Update (pWindow->GetOutDev()); maWindowList.emplace_back(pWindow); } } @@ -115,7 +115,7 @@ void WindowUpdater::ConfigurationChanged( utl::ConfigurationBroadcaster*, Config { // Set the current state at all registered output devices. for (auto& rxWindow : maWindowList) - Update (rxWindow); + Update (rxWindow->GetOutDev()); // Reformat the document for the modified state to take effect. if (mpDocument != nullptr) diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index db7cd452d860..be985ede217a 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -1169,7 +1169,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus) Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel) ); VisAreaChanged(aVisAreaWin); - mpDrawView->VisAreaChanged(GetActiveWindow()); + mpDrawView->VisAreaChanged(GetActiveWindow()->GetOutDev()); // so navigator (and effect window) notice that SfxBindings& rBindings = GetViewFrame()->GetBindings(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 273da605c81e..01120a842903 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1338,7 +1338,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) FuPoor::HITPIX, 0 ) ).Width()); sal_uInt16 nHelpLine; - if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) + if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) ) { pPV->DeleteHelpLine( nHelpLine ); } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 545c7befeca4..fd5ecd53e008 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -1105,7 +1105,7 @@ void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) Size(FuPoor::HITPIX,0)).Width()); sal_uInt16 nHelpLine; - if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) + if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) ) return; const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 01d9d88ac24a..2baed5669dae 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -442,7 +442,7 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) { for( ::tools::Long nX = nStartX; nX <= nEndX; nX++ ) { - const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); + const Color aCol( pWin->GetOutDev()->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); nRed += aCol.GetRed(); nGreen += aCol.GetGreen(); @@ -572,7 +572,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) pFldItem = pOLV->GetFieldAtSelection(); // helper line - if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) + if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) ) { ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); return; diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 7d92475aac0e..7347eefbbb84 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -284,8 +284,8 @@ void DrawViewShell::ReadFrameViewData(FrameView* pView) SwitchPage(nSelectedPage); // restore DrawMode for 'normal' window - if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode()) - GetActiveWindow()->SetDrawMode(pView->GetDrawMode()); + if(GetActiveWindow()->GetOutDev()->GetDrawMode() != pView->GetDrawMode()) + GetActiveWindow()->GetOutDev()->SetDrawMode(pView->GetDrawMode()); if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() ) { @@ -387,8 +387,8 @@ void DrawViewShell::WriteFrameViewData() mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() ); // store DrawMode for 'normal' window - if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode()) - mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode()); + if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetOutDev()->GetDrawMode()) + mpFrameView->SetDrawMode(GetActiveWindow()->GetOutDev()->GetDrawMode()); } void DrawViewShell::PrePaint() @@ -417,7 +417,7 @@ void DrawViewShell::Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) character in a symbol font */ GetDoc()->GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() ); - mpDrawView->CompleteRedraw( pWin, vcl::Region( rRect ) ); + mpDrawView->CompleteRedraw( pWin->GetOutDev(), vcl::Region( rRect ) ); } /** @@ -555,7 +555,7 @@ void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence < css::beans if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } SetZoomRect(aVisArea); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 92174788cfc6..30acb21ca00f 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -214,7 +214,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) GetDoc()->CreateFirstPages(); - mpDrawView.reset( new DrawView(pDocSh, GetActiveWindow(), this) ); + mpDrawView.reset( new DrawView(pDocSh, GetActiveWindow()->GetOutDev(), this) ); mpView = mpDrawView.get(); // Pointer of base class ViewShell mpDrawView->SetSwapAsynchron(); // Asynchronous load of graphics diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index c9cbbbd0b77d..52955fc247cf 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -179,7 +179,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) SfxItemState::DEFAULT == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) || SfxItemState::DEFAULT == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) ) { - const sal_uLong nMode = static_cast<sal_Int32>(GetActiveWindow()->GetDrawMode()); + const sal_uLong nMode = static_cast<sal_Int32>(GetActiveWindow()->GetOutDev()->GetDrawMode()); rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, sal_uLong(OUTPUT_DRAWMODE_COLOR) == nMode ) ); rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, static_cast<sal_uLong>(OUTPUT_DRAWMODE_GRAYSCALE) == nMode ) ); rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, static_cast<sal_uLong>(OUTPUT_DRAWMODE_BLACKWHITE) == nMode ) ); diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx index 72013d5fd99d..e6c3cc8e7f20 100644 --- a/sd/source/ui/view/drviewsh.cxx +++ b/sd/source/ui/view/drviewsh.cxx @@ -75,12 +75,12 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW bool bTiledRendering = comphelper::LibreOfficeKit::isActive() && !rWin.IsMapModeEnabled(); if (bTiledRendering) { - rWin.Push(PushFlags::MAPMODE); + rWin.GetOutDev()->Push(PushFlags::MAPMODE); rWin.EnableMapMode(); } ::tools::Rectangle aVisArea(rWin.PixelToLogic(::tools::Rectangle(Point(0,0), aVisSizePixel))); if (bTiledRendering) - rWin.Pop(); + rWin.GetOutDev()->Pop(); Size aVisAreaSize(aVisArea.GetSize()); if ( aVisArea.IsInside(rRect) ) diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 9c0c16ed9462..210df149cd8a 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -70,7 +70,7 @@ namespace sd { #define PROCESS_WITH_PROGRESS_THRESHOLD 5 OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineViewShell& rOutlineViewShell) -: ::sd::View(*rDocSh.GetDoc(), pWindow, &rOutlineViewShell) +: ::sd::View(*rDocSh.GetDoc(), pWindow->GetOutDev(), &rOutlineViewShell) , mrOutlineViewShell(rOutlineViewShell) , mrOutliner(*mrDoc.GetOutliner()) , mnPagesToProcess(0) @@ -243,7 +243,7 @@ void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin) { pWindow = mpOutlinerViews[nView]->GetWindow(); - if (pWindow == pWin) + if (pWindow->GetOutDev() == pWin) { mrOutliner.RemoveView( mpOutlinerViews[nView].get() ); mpOutlinerViews[nView].reset(); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 5a2a0be72ce7..d36f81b1a604 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1256,7 +1256,8 @@ void View::ChangeMarkedObjectsBulletsNumbering( const SvxNumRule* pNumRule ) { SdrModel* pSdrModel = GetModel(); - vcl::Window* pWindow = dynamic_cast< vcl::Window* >(GetFirstOutputDevice()); + OutputDevice* pOut = GetFirstOutputDevice(); + vcl::Window* pWindow = pOut ? pOut->GetOwnerWindow() : nullptr; if (!pSdrModel || !pWindow) return; diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 882258bd9231..6a7c49224052 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -177,7 +177,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, { ::OutputDevice* pOutDev = nullptr; if( mpViewSh ) - pOutDev = mpViewSh->GetActiveWindow(); + pOutDev = mpViewSh->GetActiveWindow()->GetOutDev(); if( !pOutDev ) pOutDev = Application::GetDefaultDevice(); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index eceb4254a1fe..765bf7bed661 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -84,7 +84,7 @@ Window::Window(vcl::Window* pParent) // adjust contrast mode initially bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - SetDrawMode( bUseContrast + GetOutDev()->SetDrawMode( bUseContrast ? sd::OUTPUT_DRAWMODE_CONTRAST : sd::OUTPUT_DRAWMODE_COLOR ); @@ -353,7 +353,7 @@ void Window::SetCenterAllowed (bool bIsAllowed) // Update the view's snapping to the new zoom factor. if ( auto pDrawViewShell = dynamic_cast< DrawViewShell *>( mpViewShell ) ) - pDrawViewShell->GetView()->RecalcLogicSnapMagnetic(*this); + pDrawViewShell->GetView()->RecalcLogicSnapMagnetic(*GetOutDev()); // Return the zoom factor just in case it has been changed above to lie // inside the valid range. @@ -797,7 +797,7 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { - SetDrawMode( nOutputMode ); + GetOutDev()->SetDrawMode( nOutputMode ); mpViewShell->GetFrameView()->SetDrawMode( nOutputMode ); Invalidate(); } diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 95c34d0655bd..3e7f187ea506 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -202,7 +202,7 @@ void ImageButtonHdl::ShowTip() else if (mnHighlightId == 3) aHelpPos.Move(maImageSize.Width(), maImageSize.Height()); ::tools::Rectangle aLogicPix(aHelpPos, maImageSize); - vcl::Window* pWindow = static_cast<vcl::Window*>(pHdlList->GetView()->GetFirstOutputDevice()); + vcl::Window* pWindow = pHdlList->GetView()->GetFirstOutputDevice()->GetOwnerWindow(); ::tools::Rectangle aScreenRect(pWindow->OutputToScreenPixel(aLogicPix.TopLeft()), pWindow->OutputToScreenPixel(aLogicPix.BottomRight())); Help::ShowQuickHelp(pWindow, aScreenRect, aHelpText); diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 818cc4e8d298..0837c0ecbb8a 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -164,7 +164,7 @@ void ViewShell::VirtHScrollHdl(ScrollBar* pHScroll) if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } if (pOLV) @@ -221,7 +221,7 @@ void ViewShell::VirtVScrollHdl(ScrollBar* pVScroll) if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } if (pOLV) @@ -300,7 +300,7 @@ void ViewShell::Scroll(::tools::Long nScrollX, ::tools::Long nScrollY) ::sd::View* pView = GetView(); if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } if (mbHasRulers) @@ -342,7 +342,7 @@ void ViewShell::SetZoom(::tools::Long nZoom) ::sd::View* pView = GetView(); if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } UpdateScrollBars(); @@ -398,7 +398,7 @@ void ViewShell::SetZoomRect(const ::tools::Rectangle& rZoomRect) ::sd::View* pView = GetView(); if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } UpdateScrollBars(); @@ -430,7 +430,7 @@ void ViewShell::InitWindows(const Point& rViewOrigin, const Size& rViewSize, ::sd::View* pView = GetView(); if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } } @@ -579,7 +579,7 @@ void ViewShell::SetActiveWindow (::sd::Window* pWin) ::sd::View* pView = GetView(); if (pView) { - pView->SetActualWin(pWin); + pView->SetActualWin(pWin->GetOutDev()); } if(HasCurrentFunction()) { @@ -939,7 +939,7 @@ void ViewShell::SetWinViewPos(const Point& rWinPos) ::sd::View* pView = GetView(); if (pView) { - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } } diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index eeec0ad78447..890b9ddde1b2 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -896,7 +896,7 @@ void ViewShell::Resize() ::sd::View* pView = GetView(); if (pView) - pView->VisAreaChanged(GetActiveWindow()); + pView->VisAreaChanged(GetActiveWindow()->GetOutDev()); } SvBorder ViewShell::GetBorder() @@ -1351,7 +1351,7 @@ void ViewShell::ExecReq( SfxRequest& rReq ) case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break; } - GetActiveWindow()->SetDrawMode( nMode ); + GetActiveWindow()->GetOutDev()->SetDrawMode( nMode ); mpFrameView->SetDrawMode( nMode ); GetActiveWindow()->Invalidate(); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 13aa0f09a2e6..4d9d521eeaa1 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2267,7 +2267,7 @@ WaitWindow_Impl::WaitWindow_Impl() : WorkWindow(nullptr, WB_BORDER | WB_3DLOOK) Show(); PaintImmediately(); - Flush(); + GetOutDev()->Flush(); } diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 95b664b8b96f..c363e4980cb2 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -993,7 +993,7 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this)))); if (bWantsCanvas) { - Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas()); + Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetOutDev()->GetSpriteCanvas()); aCreationArguments.put("Canvas", makeAny(xCanvas)); } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ccf07fb6127b..2b924341265f 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -342,7 +342,7 @@ void SmDocShell::DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSel DrawModeFlags nOldDrawMode = DrawModeFlags::Default; bool bRestoreDrawMode = false; if (OUTDEV_WINDOW == rDev.GetOutDevType() && - static_cast<vcl::Window &>(rDev).GetSettings().GetStyleSettings().GetHighContrastMode()) + rDev.GetOwnerWindow()->GetSettings().GetStyleSettings().GetHighContrastMode()) { nOldDrawMode = rDev.GetDrawMode(); rDev.SetDrawMode( DrawModeFlags::Default ); diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index f815556553a9..e42dad407478 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -620,7 +620,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) } // actually scroll+invalidate - pDataWin->SetClipRegion(); + pDataWin->GetOutDev()->SetClipRegion(); bool bSelVis = bSelectionIsVisible; bSelectionIsVisible = false; if( GetBackground().IsScrollable() ) @@ -1165,7 +1165,7 @@ void BrowseBox::RowInserted( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint, if ( !bLastRow ) { // scroll down the rows behind the new row - pDataWin->SetClipRegion(); + pDataWin->GetOutDev()->SetClipRegion(); if( pDataWin->GetBackground().IsScrollable() ) { pDataWin->Scroll( 0, GetDataRowHeight() * nNumRows, @@ -1311,7 +1311,7 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) if (nRow < nRowCount) { tools::Long nY = (nRow-nTopRow) * GetDataRowHeight(); - pDataWin->SetClipRegion(); + pDataWin->GetOutDev()->SetClipRegion(); if( pDataWin->GetBackground().IsScrollable() ) { pDataWin->Scroll( 0, - static_cast<short>(GetDataRowHeight()) * nNumRows, diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index e52421f9cdcd..ea1472c05f6a 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -353,14 +353,14 @@ void BrowseBox::DrawCursor() } else { - Color rCol = bReallyHide ? pDataWin->GetFillColor() : m_aCursorColor; - Color aOldFillColor = pDataWin->GetFillColor(); - Color aOldLineColor = pDataWin->GetLineColor(); - pDataWin->SetFillColor(); - pDataWin->SetLineColor( rCol ); - pDataWin->DrawRect( aCursor ); - pDataWin->SetLineColor( aOldLineColor ); - pDataWin->SetFillColor( aOldFillColor ); + Color rCol = bReallyHide ? pDataWin->GetOutDev()->GetFillColor() : m_aCursorColor; + Color aOldFillColor = pDataWin->GetOutDev()->GetFillColor(); + Color aOldLineColor = pDataWin->GetOutDev()->GetLineColor(); + pDataWin->GetOutDev()->SetFillColor(); + pDataWin->GetOutDev()->SetLineColor( rCol ); + pDataWin->GetOutDev()->DrawRect( aCursor ); + pDataWin->GetOutDev()->SetLineColor( aOldLineColor ); + pDataWin->GetOutDev()->SetFillColor( aOldFillColor ); } } @@ -1317,7 +1317,7 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) nDragX = nResizeX = rEvtPos.X(); SetPointer( PointerStyle::HSplit ); CaptureMouse(); - pDataWin->DrawLine( Point( nDragX, 0 ), + pDataWin->GetOutDev()->DrawLine( Point( nDragX, 0 ), Point( nDragX, pDataWin->GetSizePixel().Height() ) ); nMinResizeX = nX + MIN_COLUMNWIDTH; return; diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 9e7f77a2cb6a..d6bcdfeb4fc1 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -528,7 +528,7 @@ OUString BrowseBox::GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos) bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) { - return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); + return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); } tools::Rectangle BrowseBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index a8a20fae8918..a7bbde76fe28 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -235,9 +235,9 @@ void InitSettings_Impl(vcl::Window* pWin) { const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); - pWin->ApplyControlFont(*pWin, rStyleSettings.GetFieldFont()); - pWin->ApplyControlForeground(*pWin, rStyleSettings.GetWindowTextColor()); - pWin->ApplyControlBackground(*pWin, rStyleSettings.GetWindowColor()); + pWin->ApplyControlFont(*pWin->GetOutDev(), rStyleSettings.GetFieldFont()); + pWin->ApplyControlForeground(*pWin->GetOutDev(), rStyleSettings.GetWindowTextColor()); + pWin->ApplyControlBackground(*pWin->GetOutDev(), rStyleSettings.GetWindowColor()); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 236897d0d96e..60946af94032 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -219,7 +219,7 @@ namespace svt else { // don't paint the current cell - if (&rDev == &GetDataWindow()) + if (rDev.GetOwnerWindow() == &GetDataWindow()) // but only if we're painting onto our data win (which is the usual painting) if (nPaintRow == nEditRow) { @@ -738,7 +738,7 @@ namespace svt else GetDataWindow().SetControlFont(); - GetDataWindow().SetZoomedPointFont(GetDataWindow(), aFont); + GetDataWindow().SetZoomedPointFont(*GetDataWindow().GetOutDev(), aFont); } if (bFont || bForeground) @@ -762,13 +762,13 @@ namespace svt { GetDataWindow().SetControlBackground(GetControlBackground()); GetDataWindow().SetBackground(GetDataWindow().GetControlBackground()); - GetDataWindow().SetFillColor(GetDataWindow().GetControlBackground()); + GetDataWindow().GetOutDev()->SetFillColor(GetDataWindow().GetControlBackground()); } else { GetDataWindow().SetControlBackground(); GetDataWindow().SetBackground(rStyleSettings.GetFieldColor()); - GetDataWindow().SetFillColor(rStyleSettings.GetFieldColor()); + GetDataWindow().GetOutDev()->SetFillColor(rStyleSettings.GetFieldColor()); } } @@ -1196,7 +1196,7 @@ namespace svt aBoxSize); pCheckBoxPaint->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize()); - pCheckBoxPaint->Draw(&GetDataWindow(), aRect.TopLeft(), DrawFlags::NONE); + pCheckBoxPaint->Draw(GetDataWindow().GetOutDev(), aRect.TopLeft(), DrawFlags::NONE); } void EditBrowseBox::AsynchGetFocus() diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 61b5b60d539f..df3f981af0d7 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -231,7 +231,7 @@ void Ruler::ImplInit( WinBits nWinBits ) // Setup the default size tools::Rectangle aRect; - GetTextBoundRect( aRect, "0123456789" ); + GetOutDev()->GetTextBoundRect( aRect, "0123456789" ); tools::Long nDefHeight = aRect.GetHeight() + RULER_OFF * 2 + ruler_tab.textoff * 2 + mnBorderWidth; Size aDefSize; @@ -245,7 +245,7 @@ void Ruler::ImplInit( WinBits nWinBits ) Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) : Window( pParent, nWinStyle & WB_3DLOOK ), - maVirDev( VclPtr<VirtualDevice>::Create(*this) ), + maVirDev( VclPtr<VirtualDevice>::Create(*GetOutDev()) ), maMapMode( MapUnit::Map100thMM ), mpSaveData(new ImplRulerData), mpData(nullptr), @@ -410,7 +410,7 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext) aTempRect.SetLeft( aTempRect.Right() - RULER_OFF + 1 ); } rRenderContext.Erase(aTempRect); - Invert(aRect); + GetOutDev()->Invert(aRect); } } mnUpdateFlags = 0; @@ -988,7 +988,7 @@ void Ruler::ApplySettings(vcl::RenderContext& rRenderContext) ApplyControlFont(rRenderContext, aFont); - ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor()); + ApplyControlForeground(*GetOutDev(), rStyleSettings.GetDarkShadowColor()); SetTextFillColor(); Color aColor; @@ -1008,12 +1008,12 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) Size aSize(adjustSize(aFont.GetFontSize().Width()), adjustSize(aFont.GetFontSize().Height())); aFont.SetFontSize(aSize); - ApplyControlFont(*this, aFont); + ApplyControlFont(*GetOutDev(), aFont); } if (bForeground || bFont) { - ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor()); + ApplyControlForeground(*GetOutDev(), rStyleSettings.GetDarkShadowColor()); SetTextFillColor(); } @@ -1022,7 +1022,7 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) Color aColor; svtools::ColorConfig aColorConfig; aColor = aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor; - ApplyControlBackground(*this, aColor); + ApplyControlBackground(*GetOutDev(), aColor); } maVirDev->SetSettings( GetSettings() ); @@ -2247,7 +2247,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType ) if (!IsReallyVisible()) { // set mpData for ImplDocHitTest() - ImplFormat(*this); + ImplFormat(*GetOutDev()); } Invalidate(InvalidateFlags::NoErase); diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 445dd838202f..c7c777c9085f 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -586,7 +586,7 @@ void TabBar::ImplInitSettings( bool bFont, bool bBackground ) { vcl::Font aToolFont = rStyleSettings.GetToolFont(); aToolFont.SetWeight( WEIGHT_BOLD ); - ApplyControlFont(*this, aToolFont); + ApplyControlFont(*GetOutDev(), aToolFont); // Adapt font size if window too small? while (GetTextHeight() > (GetOutputSizePixel().Height() - 1)) @@ -601,7 +601,7 @@ void TabBar::ImplInitSettings( bool bFont, bool bBackground ) if (bBackground) { - ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); + ApplyControlBackground(*GetOutDev(), rStyleSettings.GetFaceColor()); } } @@ -2021,7 +2021,7 @@ bool TabBar::StartEditMode(sal_uInt16 nPageId) weld::Entry& rEntry = mpImpl->mxEdit->get_widget(); rEntry.set_text(GetPageText(mnEditId)); mpImpl->mxEdit->SetPosSizePixel(Point(nX, aRect.Top() + mnOffY + 1), Size(nWidth, aRect.GetHeight() - 3)); - vcl::Font aFont = GetPointFont(*this); // FIXME RenderContext + vcl::Font aFont = GetPointFont(*GetOutDev()); // FIXME RenderContext Color aForegroundColor; Color aBackgroundColor; @@ -2308,8 +2308,8 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) if (nOldFirstPos != mnFirstPos) { tools::Rectangle aRect(mnOffX, 0, mnLastOffX, maWinSize.Height()); - SetFillColor(GetBackground().GetColor()); - DrawRect(aRect); + GetOutDev()->SetFillColor(GetBackground().GetColor()); + GetOutDev()->DrawRect(aRect); Invalidate(aRect); } } @@ -2324,8 +2324,8 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) if (mnDropPos < nItemCount) { - SetLineColor(aBlackColor); - SetFillColor(aBlackColor); + GetOutDev()->SetLineColor(aBlackColor); + GetOutDev()->SetFillColor(aBlackColor); auto& pItem = mpImpl->mpItemList[mnDropPos]; nX = pItem->maRect.Left(); @@ -2336,20 +2336,20 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) if (!pItem->IsDefaultTabBgColor() && !pItem->mbSelect) { - SetLineColor(pItem->maTabTextColor); - SetFillColor(pItem->maTabTextColor); + GetOutDev()->SetLineColor(pItem->maTabTextColor); + GetOutDev()->SetFillColor(pItem->maTabTextColor); } tools::Polygon aPoly(3); aPoly.SetPoint(Point(nX, nY), 0); aPoly.SetPoint(Point(nX + nTriangleWidth, nY - nTriangleWidth), 1); aPoly.SetPoint(Point(nX + nTriangleWidth, nY + nTriangleWidth), 2); - DrawPolygon(aPoly); + GetOutDev()->DrawPolygon(aPoly); } if (mnDropPos > 0 && mnDropPos < nItemCount + 1) { - SetLineColor(aBlackColor); - SetFillColor(aBlackColor); + GetOutDev()->SetLineColor(aBlackColor); + GetOutDev()->SetFillColor(aBlackColor); auto& pItem = mpImpl->mpItemList[mnDropPos - 1]; nX = pItem->maRect.Right(); @@ -2357,14 +2357,14 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) nX++; if (!pItem->IsDefaultTabBgColor() && !pItem->mbSelect) { - SetLineColor(pItem->maTabTextColor); - SetFillColor(pItem->maTabTextColor); + GetOutDev()->SetLineColor(pItem->maTabTextColor); + GetOutDev()->SetFillColor(pItem->maTabTextColor); } tools::Polygon aPoly(3); aPoly.SetPoint(Point(nX, nY), 0); aPoly.SetPoint(Point(nX - nTriangleWidth, nY - nTriangleWidth), 1); aPoly.SetPoint(Point(nX - nTriangleWidth, nY + nTriangleWidth), 2); - DrawPolygon(aPoly); + GetOutDev()->DrawPolygon(aPoly); } return mnDropPos; @@ -2387,9 +2387,9 @@ void TabBar::HideDropPos() // immediately call Paint, as it is not possible during drag and drop tools::Rectangle aRect( nX-1, nY1, nX+3, nY2 ); vcl::Region aRegion( aRect ); - SetClipRegion( aRegion ); + GetOutDev()->SetClipRegion( aRegion ); Invalidate(aRect); - SetClipRegion(); + GetOutDev()->SetClipRegion(); } if (mnDropPos > 0 && mnDropPos < nItemCount + 1) { @@ -2398,9 +2398,9 @@ void TabBar::HideDropPos() // immediately call Paint, as it is not possible during drag and drop tools::Rectangle aRect(nX - 2, nY1, nX + 1, nY2); vcl::Region aRegion(aRect); - SetClipRegion(aRegion); + GetOutDev()->SetClipRegion(aRegion); Invalidate(aRect); - SetClipRegion(); + GetOutDev()->SetClipRegion(); } mbDropPos = false; diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 433535a07e1e..a2d49695c540 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -57,7 +57,7 @@ namespace svt::table // by default, use the background as determined by the style settings const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); SetBackground( Wallpaper( aWindowColor ) ); - SetFillColor( aWindowColor ); + GetOutDev()->SetFillColor( aWindowColor ); SetCompoundControl( true ); } diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 837097516eda..06e6902b0444 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -38,7 +38,7 @@ namespace svt::table // by default, use the background as determined by the style settings const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); SetBackground( Wallpaper( aWindowColor ) ); - SetFillColor( aWindowColor ); + GetOutDev()->SetFillColor( aWindowColor ); } TableDataWindow::~TableDataWindow() @@ -97,7 +97,7 @@ namespace svt::table tools::Rectangle const aCellRect( aCell.getRect() ); PTableRenderer const pRenderer = pTableModel->getRenderer(); - if ( pRenderer->FitsIntoCell( aCellToolTip, *this, aCellRect ) ) + if ( pRenderer->FitsIntoCell( aCellToolTip, *GetOutDev(), aCellRect ) ) aCellToolTip.clear(); } diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index 5875601d45b9..c23cb16faeca 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -195,7 +195,7 @@ void AccessibleControlShape::Init() if ( pView && pViewWindow && pUnoObjectImpl ) { // get the context of the control - it will be our "inner" context - m_xUnoControl = pUnoObjectImpl->GetUnoControl( *pView, *pViewWindow ); + m_xUnoControl = pUnoObjectImpl->GetUnoControl( *pView, *pViewWindow->GetOutDev() ); if ( !m_xUnoControl.is() ) { @@ -207,7 +207,7 @@ void AccessibleControlShape::Init() // Okay, we will add as listener to the control container where we expect our control to appear. OSL_ENSURE( !m_bWaitingForControl, "AccessibleControlShape::Init: already waiting for the control!" ); - Reference< XContainer > xControlContainer = lcl_getControlContainer( pViewWindow, maShapeTreeInfo.GetSdrView() ); + Reference< XContainer > xControlContainer = lcl_getControlContainer( pViewWindow->GetOutDev(), maShapeTreeInfo.GetSdrView() ); OSL_ENSURE( xControlContainer.is(), "AccessibleControlShape::Init: unable to find my ControlContainer!" ); if ( xControlContainer.is() ) { @@ -632,7 +632,7 @@ void SAL_CALL AccessibleControlShape::disposing() if ( m_bWaitingForControl ) { OSL_FAIL( "AccessibleControlShape::disposing: this should never happen!" ); - Reference< XContainer > xContainer = lcl_getControlContainer( maShapeTreeInfo.GetWindow(), maShapeTreeInfo.GetSdrView() ); + Reference< XContainer > xContainer = lcl_getControlContainer( maShapeTreeInfo.GetWindow()->GetOutDev(), maShapeTreeInfo.GetSdrView() ); if ( xContainer.is() ) { m_bWaitingForControl = false; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 8264e40f98bb..28cb6b7b768f 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -160,12 +160,12 @@ void AccessibleShape::Init() if( !hasOutlinerParaObject ) { // empty text -> use proxy edit source to delay creation of EditEngine - mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow->GetOutDev()) ) ); } else { // non-empty text -> use full-fledged edit source right away - mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow->GetOutDev()) ) ); } if( pWindow->HasFocus() ) mpText->SetFocus(); diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 660aebfd18e4..98484033820e 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -92,7 +92,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext( } maTreeInfo.SetSdrView( mpView ); - maTreeInfo.SetWindow(&dynamic_cast<vcl::Window&>(mpControl->GetDrawingArea()->get_ref_device())); + maTreeInfo.SetWindow(mpControl->GetDrawingArea()->get_ref_device().GetOwnerWindow()); maTreeInfo.SetViewForwarder( this ); } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 4b5f42e1eb10..e6b57aac5fb7 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -1511,7 +1511,7 @@ void SvxRuler::DrawLine_Impl(tools::Long& lTabPosition, int nNew, bool bHorizont */ if(bHorizontal) { - const tools::Long nHeight = pEditWin->GetOutputSize().Height(); + const tools::Long nHeight = pEditWin->GetOutDev()->GetOutputSize().Height(); Point aZero = pEditWin->GetMapMode().GetOrigin(); if(lTabPosition != -1) { @@ -1535,7 +1535,7 @@ void SvxRuler::DrawLine_Impl(tools::Long& lTabPosition, int nNew, bool bHorizont } else { - const tools::Long nWidth = pEditWin->GetOutputSize().Width(); + const tools::Long nWidth = pEditWin->GetOutDev()->GetOutputSize().Width(); Point aZero = pEditWin->GetMapMode().GetOrigin(); if(lTabPosition != -1) { diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 1946da09341c..212a06a30aca 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -445,7 +445,7 @@ void DbGridColumn::Paint(OutputDevice& rDev, const Reference< XNumberFormatter >& xFormatter) { bool bEnabled = ( rDev.GetOutDevType() != OUTDEV_WINDOW ) - || ( static_cast< vcl::Window& >( rDev ).IsEnabled() ); + || ( rDev.GetOwnerWindow()->IsEnabled() ); FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell.get() ); if (pDataCell) @@ -725,7 +725,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo else pWindow->SetControlFont(); - pWindow->SetZoomedPointFont(*pWindow, aFont); // FIXME RenderContext + pWindow->SetZoomedPointFont(*pWindow->GetOutDev(), aFont); // FIXME RenderContext } } @@ -769,7 +769,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo pWindow->SetBackground(aColor); pWindow->SetControlBackground(aColor); } - pWindow->SetFillColor(aColor); + pWindow->GetOutDev()->SetFillColor(aColor); } } } @@ -781,7 +781,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo m_pPainter->SetBackground(); else m_pPainter->SetBackground(rParent.GetBackground()); - m_pPainter->SetFillColor(rParent.GetFillColor()); + m_pPainter->GetOutDev()->SetFillColor(rParent.GetOutDev()->GetFillColor()); } if (m_pWindow) @@ -789,7 +789,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo if (isTransparent()) m_pWindow->SetBackground(rParent.GetBackground()); else - m_pWindow->SetFillColor(rParent.GetFillColor()); + m_pWindow->GetOutDev()->SetFillColor(rParent.GetOutDev()->GetFillColor()); } } } @@ -3489,7 +3489,7 @@ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, } DrawTextFlags nStyle = DrawTextFlags::Clip | DrawTextFlags::VCenter; - if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !static_cast< vcl::Window& >( rDev ).IsEnabled() ) + if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !rDev.GetOwnerWindow()->IsEnabled() ) nStyle |= DrawTextFlags::Disable; switch (m_pColumn->GetAlignment()) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 1d1108a1a88d..b31c065d6826 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -877,12 +877,12 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { GetDataWindow().SetBackground(GetControlBackground()); GetDataWindow().SetControlBackground(GetControlBackground()); - GetDataWindow().SetFillColor(GetControlBackground()); + GetDataWindow().GetOutDev()->SetFillColor(GetControlBackground()); } else { GetDataWindow().SetControlBackground(); - GetDataWindow().SetFillColor(GetFillColor()); + GetDataWindow().GetOutDev()->SetFillColor(GetOutDev()->GetFillColor()); } } @@ -1382,7 +1382,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, DbGridCo void DbGridControl::RemoveColumns() { - if ( IsEditing() ) + if ( !isDisposed() && IsEditing() ) DeactivateCell(); m_aColumns.clear(); diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 572b4d59d155..9bbe292ffe90 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -512,7 +512,7 @@ void FmFormShell::Execute(SfxRequest &rReq) if (m_pFormView) { const OutputDevice* pDevice = m_pFormView->GetActualOutDev(); - vcl::Window* pWindow = dynamic_cast< vcl::Window* >( const_cast< OutputDevice* >( pDevice ) ); + vcl::Window* pWindow = pDevice->GetOwnerWindow(); if ( pWindow ) pWindow->GrabFocus(); } @@ -1276,7 +1276,7 @@ void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrVi if ( bHasControlFocus ) { - vcl::Window* pWindow( dynamic_cast< vcl::Window* >( &i_rDevice ) ); + vcl::Window* pWindow = i_rDevice.GetOwnerWindow(); OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); if ( pWindow ) pWindow->GrabFocus(); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index f0162740f8c6..a83625b68479 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2827,7 +2827,7 @@ Reference< XControl> FmXFormShell::impl_getControl_Lock(const Reference<XControl const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : nullptr; ENSURE_OR_THROW( pSdrView, "no current view" ); - xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_SET_THROW ); + xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow->GetOutDev() ), UNO_SET_THROW ); } } catch( const Exception& ) diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index a77ab010c070..46461728482a 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -252,7 +252,7 @@ void FmFormView::ChangeDesignMode(bool bDesign) { if ( GetActualOutDev() && GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW ) { - const vcl::Window* pWindow = static_cast< const vcl::Window* >( GetActualOutDev() ); + const vcl::Window* pWindow = GetActualOutDev()->GetOwnerWindow(); const_cast< vcl::Window* >( pWindow )->GrabFocus(); } @@ -470,7 +470,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) FmFormObj* pObj = getMarkedGrid(); if ( pObj ) { - Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin ), UNO_QUERY ); + Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin->GetOutDev() ), UNO_QUERY ); if ( xWindow.is() ) { pImpl->m_pMarkedGrid = pObj; @@ -509,7 +509,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (!pFormObject) continue; - Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin); + Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin->GetOutDev()); if (!xControl.is()) continue; const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 0a2440cbab1c..790b41ce25b5 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -152,7 +152,7 @@ FormViewPageWindowAdapter::FormViewPageWindowAdapter( const css::uno::Reference< : m_xControlContainer( _rWindow.GetControlContainer() ), m_xContext( _rContext ), m_pViewImpl( _pViewImpl ), - m_pWindow( dynamic_cast< vcl::Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) ) + m_pWindow( _rWindow.GetPaintWindow().GetOutputDevice().GetOwnerWindow() ) { // create an XFormController for every form @@ -694,7 +694,7 @@ IMPL_LINK_NOARG(FmXFormView, OnActivate, void*, void) find_active_databaseform fad(pShImpl->getActiveController_Lock()); - vcl::Window* pWindow = const_cast<vcl::Window*>(static_cast<const vcl::Window*>(m_pView->GetActualOutDev())); + vcl::Window* pWindow = m_pView->GetActualOutDev()->GetOwnerWindow(); rtl::Reference< FormViewPageWindowAdapter > pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; for (const auto& rpPageWindowAdapter : m_aPageWindowAdapters) { @@ -861,7 +861,7 @@ namespace if ( xNormalizedForm.get() != xModelParent.get() ) continue; - pFormObject->GetUnoControl( _rView, _rWindow ); + pFormObject->GetUnoControl( _rView, *_rWindow.GetOutDev() ); } } catch (const Exception&) @@ -884,7 +884,7 @@ Reference< XFormController > FmXFormView::getFormController( const Reference< XF continue; } - if ( pAdapter->getWindow() != &_rDevice ) + if ( pAdapter->getWindow() != _rDevice.GetOwnerWindow() ) // wrong device continue; @@ -949,7 +949,8 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) // ensure that the control is visible // 80210 - 12/07/00 - FS - const vcl::Window* pCurrentWindow = m_pView ? dynamic_cast<const vcl::Window*>(m_pView->GetActualOutDev()) : nullptr; + const OutputDevice* pOut = m_pView ? m_pView->GetActualOutDev() : nullptr; + const vcl::Window* pCurrentWindow = pOut ? pOut->GetOwnerWindow() : nullptr; if ( pCurrentWindow ) { awt::Rectangle aRect = xControlWindow->getPosSize(); @@ -1012,7 +1013,8 @@ void FmXFormView::breakCreateFormObject() Reference<XWindow> FmXFormView::GetParentWindow() const { - const vcl::Window* pCurrentWindow = m_pView ? dynamic_cast<const vcl::Window*>(m_pView->GetActualOutDev()) : nullptr; + const OutputDevice* pOut = m_pView ? m_pView->GetActualOutDev() : nullptr; + const vcl::Window* pCurrentWindow = pOut ? pOut->GetOwnerWindow() : nullptr; return VCLUnoHelper::GetInterface(const_cast<vcl::Window*>(pCurrentWindow)); } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 42947238be2d..29b43c597a39 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1964,7 +1964,7 @@ namespace svxform OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() ) { - pFormView->MakeVisible( aMarkRect, static_cast<vcl::Window&>(rOutDev) ); + pFormView->MakeVisible( aMarkRect, *rOutDev.GetOwnerWindow() ); } } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i ) } @@ -2032,7 +2032,7 @@ namespace svxform OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) { - pFormView->MakeVisible( aMarkRect, static_cast<vcl::Window&>(rOutDev) ); + pFormView->MakeVisible( aMarkRect, *rOutDev.GetOwnerWindow() ); } } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i ) } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index 16faa132a7a4..27768ff0777f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -62,7 +62,7 @@ vcl::Window* ViewObjectContactOfSdrMediaObj::getWindow() const { if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType()) { - pRetval = static_cast< vcl::Window* >(&const_cast<OutputDevice&>(*oPageOutputDev)); + pRetval = oPageOutputDev->GetOwnerWindow(); } } diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index dd8ba8d97b96..681ce37ac7da 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -432,7 +432,7 @@ namespace sdr::contact { { if ( !m_rControlContainer.is() ) { - const vcl::Window* pWindow = dynamic_cast< const vcl::Window* >( &_rDevice ); + const vcl::Window* pWindow = _rDevice.GetOwnerWindow(); OSL_ENSURE( pWindow, "InvisibleControlViewAccess::getControlContainer: expected to be called for a window only!" ); if ( pWindow ) m_rControlContainer = VCLUnoHelper::CreateControlContainer( const_cast< vcl::Window* >( pWindow ) ); @@ -1053,7 +1053,7 @@ namespace sdr::contact { m_xContainer.set(_rPageView.getControlContainer( _rDevice ), css::uno::UNO_QUERY); DBG_ASSERT( ( m_xContainer.is() // either have a XControlContainer || ( ( !_rPageView.getControlContainer( _rDevice ).is() ) // or don't have any container, - && ( dynamic_cast< const vcl::Window* >( &_rDevice ) == nullptr ) // which is allowed for non-Window instances only + && ( _rDevice.GetOwnerWindow() == nullptr ) // which is allowed for non-Window instances only ) ), "ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow: no XContainer at the ControlContainer!" ); @@ -1600,8 +1600,8 @@ namespace sdr::contact { ControlHolder aControl; InvisibleControlViewAccess aSimulatePageView( _inout_ControlContainer ); - OSL_VERIFY( ViewObjectContactOfUnoControl_Impl::createControlForDevice( aSimulatePageView, _rWindow, _rUnoObject, - _rWindow.GetViewTransformation(), _rWindow.GetInverseViewTransformation(), aControl ) ); + OSL_VERIFY( ViewObjectContactOfUnoControl_Impl::createControlForDevice( aSimulatePageView, *_rWindow.GetOutDev(), _rUnoObject, + _rWindow.GetOutDev()->GetViewTransformation(), _rWindow.GetOutDev()->GetInverseViewTransformation(), aControl ) ); return aControl.getControl(); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index b3cdf0151792..edf2852c8eef 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -310,7 +310,7 @@ namespace sdr::overlay { tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange)); // simply invalidate - static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); + getOutputDevice().GetOwnerWindow()->Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); } } diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 3052246cbadb..71c8d6f73f47 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -146,13 +146,13 @@ namespace sdr::overlay // but always the exact redraw area if(OUTDEV_WINDOW == rSource.GetOutDevType()) { - vcl::Window& rWindow = static_cast<vcl::Window&>(rSource); + vcl::Window& rWindow = *rSource.GetOwnerWindow(); vcl::Region aPaintRegionPixel = rWindow.LogicToPixel(rWindow.GetPaintRegion()); aRegion.Intersect(aPaintRegionPixel); // #i72754# Make sure content is completely rendered, the window // will be used as source of a DrawOutDev soon - rWindow.Flush(); + rWindow.GetOutDev()->Flush(); } // also limit to buffer size @@ -210,7 +210,7 @@ namespace sdr::overlay // #i80730# switch off VCL cursor during overlay refresh if(bTargetIsWindow) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); vcl::Cursor* pCursor = rWindow.GetCursor(); if(pCursor && pCursor->IsVisible()) @@ -318,7 +318,7 @@ namespace sdr::overlay // To get the update, the windows in question are updated manually here. if(bTargetIsWindow) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); const tools::Rectangle aRegionRectanglePixel( maBufferRememberedRangePixel.getMinX(), @@ -331,7 +331,7 @@ namespace sdr::overlay // #i80730# restore visibility of VCL cursor if(bCursorWasEnabled) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); vcl::Cursor* pCursor = rWindow.GetCursor(); if(pCursor) diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 59c672b9ba7a..788d47ab79e5 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -71,8 +71,8 @@ uno::Reference<awt::XControlContainer> const & SdrPageWindow::GetControlContaine const SdrPaintWindow& rPaintWindow( GetOriginalPaintWindow() ? *GetOriginalPaintWindow() : GetPaintWindow() ); if ( rPaintWindow.OutputToWindow() && !rView.IsPrintPreview() ) { - vcl::Window& rWindow = dynamic_cast< vcl::Window& >( rPaintWindow.GetOutputDevice() ); - const_cast< SdrPageWindow* >( this )->mpImpl->mxControlContainer = VCLUnoHelper::CreateControlContainer( &rWindow ); + vcl::Window* pWindow = rPaintWindow.GetOutputDevice().GetOwnerWindow(); + const_cast< SdrPageWindow* >( this )->mpImpl->mxControlContainer = VCLUnoHelper::CreateControlContainer( pWindow ); // #100394# xC->setVisible triggers window->Show() and this has // problems when the view is not completely constructed which may diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index c0a46d49d0b6..c3dcee32b4f7 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -195,9 +195,9 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( // is it a window? if (OUTDEV_WINDOW == rOutputDevice.GetOutDevType()) { - vcl::Window& rWindow = dynamic_cast<vcl::Window&>(rOutputDevice); + vcl::Window* pWindow = rOutputDevice.GetOwnerWindow(); // decide which OverlayManager to use - if (IsBufferedOverlayAllowed() && !rWindow.SupportsDoubleBuffering()) + if (IsBufferedOverlayAllowed() && !pWindow->SupportsDoubleBuffering()) { // buffered OverlayManager, buffers its background and refreshes from there // for pure overlay changes (no system redraw). The 3rd parameter specifies @@ -222,7 +222,7 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( // updates. if (!comphelper::LibreOfficeKit::isActive()) { - rWindow.Invalidate(); + pWindow->Invalidate(); } InitOverlayManager(xOverlayManager); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index bb56488428db..a8da538afbb4 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -146,8 +146,8 @@ SdrPageView* SdrObjEditView::ShowSdrPage(SdrPage* pPage) // Call GetSfxViewShell() to make sure ImpMakeOutlinerView() // registers the view shell of this draw view, and not the view // shell of pView. - OutlinerView* pOutlinerView = pView->ImpMakeOutlinerView( - static_cast<vcl::Window*>(pOutDev), nullptr, GetSfxViewShell()); + OutlinerView* pOutlinerView + = pView->ImpMakeOutlinerView(pOutDev->GetOwnerWindow(), nullptr, GetSfxViewShell()); pOutlinerView->HideCursor(); pView->GetTextEditOutliner()->InsertView(pOutlinerView); } @@ -181,7 +181,7 @@ void lcl_RemoveTextEditOutlinerViews(SdrObjEditView const* pThis, SdrPageView co for (size_t nView = 0; nView < pOutliner->GetViewCount(); ++nView) { OutlinerView* pOutlinerView = pOutliner->GetView(nView); - if (pOutlinerView->GetWindow() != pOutputDevice) + if (pOutlinerView->GetWindow()->GetOutDev() != pOutputDevice) continue; pOutliner->RemoveView(pOutlinerView); @@ -364,7 +364,7 @@ void SdrObjEditView::ModelHasChanged() aTmpRect.AdjustRight(aMore.Width()); aTmpRect.AdjustTop(-(aMore.Height())); aTmpRect.AdjustBottom(aMore.Height()); - InvalidateOneWin(*pWin, aTmpRect); + InvalidateOneWin(*pWin->GetOutDev(), aTmpRect); } if (bAnchorChg) pOLV->SetAnchorMode(eNewAnchor); @@ -658,7 +658,7 @@ void SdrObjEditView::EditViewSelectionChange() } } -OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWin; } +OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWin->GetOutDev(); } Point SdrObjEditView::EditViewPointerPosPixel() const { return pTextEditWin->GetPointerPosPixel(); } @@ -724,9 +724,9 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) // compare against that; that's how double-buffering can // still find the matching OutlinerView. OutputDevice* pOutputDevice = rPaintWindow.GetWindow() - ? rPaintWindow.GetWindow() + ? rPaintWindow.GetWindow()->GetOutDev() : &rPaintWindow.GetOutputDevice(); - if (pOLV->GetWindow() == pOutputDevice + if (pOLV->GetWindow()->GetOutDev() == pOutputDevice || comphelper::LibreOfficeKit::isActive()) { ImpPaintOutlinerView(*pOLV, aCheckRect, @@ -1102,7 +1102,7 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W if (OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType()) { - pWin = static_cast<vcl::Window*>(&pPaintWindow->GetOutputDevice()); + pWin = pPaintWindow->GetOutputDevice().GetOwnerWindow(); } } @@ -1290,10 +1290,10 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W SdrPaintWindow* pPaintWindow = GetPaintWindow(i); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) + if (&rOutDev != pWin->GetOutDev() && OUTDEV_WINDOW == rOutDev.GetOutDevType()) { OutlinerView* pOutlView - = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr); + = ImpMakeOutlinerView(rOutDev.GetOwnerWindow(), nullptr); pTextEditOutliner->InsertView(pOutlView, static_cast<sal_uInt16>(i)); } } @@ -1315,12 +1315,13 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W SdrPaintWindow* pPaintWindow = pView->GetPaintWindow(nViewPaintWindow); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) + if (&rOutDev != pWin->GetOutDev() + && OUTDEV_WINDOW == rOutDev.GetOutDevType()) { - OutlinerView* pOutlView = ImpMakeOutlinerView( - static_cast<vcl::Window*>(&rOutDev), nullptr); + OutlinerView* pOutlView + = ImpMakeOutlinerView(rOutDev.GetOwnerWindow(), nullptr); pOutlView->HideCursor(); - static_cast<vcl::Window*>(&rOutDev)->SetCursor(nullptr); + rOutDev.GetOwnerWindow()->SetCursor(nullptr); pTextEditOutliner->InsertView(pOutlView); } } @@ -1630,9 +1631,9 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) aRect.AdjustRight(nMorePix); aRect.AdjustBottom(nMorePix); aRect = pWin->PixelToLogic(aRect); - InvalidateOneWin(*pWin, aRect); - pWin->SetFillColor(); - pWin->SetLineColor(COL_BLACK); + InvalidateOneWin(*pWin->GetOutDev(), aRect); + pWin->GetOutDev()->SetFillColor(); + pWin->GetOutDev()->SetLineColor(COL_BLACK); } // and now the Outliner itself if (!bTextEditDontDelete) @@ -1862,9 +1863,9 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin rMEvt.GetModifier()); if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) { - if (pWin != nullptr && pWin != pTextEditWin + if (pWin != nullptr && pWin != pTextEditWin->GetOutDev() && pWin->GetOutDevType() == OUTDEV_WINDOW) - SetTextEditWin(static_cast<vcl::Window*>(pWin)); + SetTextEditWin(pWin->GetOwnerWindow()); ImpMakeTextCursorAreaVisible(); return true; } @@ -2325,7 +2326,7 @@ void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pW if (mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType() == OUTDEV_WINDOW) { - OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast<vcl::Window*>(pNewWin), nullptr); + OutlinerView* pOutlView = ImpMakeOutlinerView(pNewWin->GetOwnerWindow(), nullptr); pTextEditOutliner->InsertView(pOutlView); } } @@ -2340,7 +2341,7 @@ void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin) { i--; OutlinerView* pOLV = pTextEditOutliner->GetView(i); - if (pOLV && pOLV->GetWindow() == static_cast<vcl::Window*>(pOldWin)) + if (pOLV && pOLV->GetWindow() == pOldWin->GetOwnerWindow()) { pTextEditOutliner->RemoveView(i); } @@ -2383,7 +2384,7 @@ void SdrObjEditView::ImpMacroUp(const Point& rUpPos) aHitRec.nTol = nMacroTol; aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers(); aHitRec.pPageView = pMacroPV; - pMacroObj->PaintMacro(*pMacroWin, tools::Rectangle(), aHitRec); + pMacroObj->PaintMacro(*pMacroWin->GetOutDev(), tools::Rectangle(), aHitRec); bMacroDown = false; } } @@ -2397,7 +2398,7 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos) aHitRec.nTol = nMacroTol; aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers(); aHitRec.pPageView = pMacroPV; - pMacroObj->PaintMacro(*pMacroWin, tools::Rectangle(), aHitRec); + pMacroObj->PaintMacro(*pMacroWin->GetOutDev(), tools::Rectangle(), aHitRec); bMacroDown = true; } } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index a7f5ba78c4a3..eef111ce4103 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -242,7 +242,8 @@ void SdrMarkView::ModelHasChanged() sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); if (nTotalPaintWindows == 1) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; if (pWin && pWin->IsChart()) { const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj(); @@ -758,7 +759,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); if (nTotalPaintWindows == 1) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; if (pWin && pWin->IsChart()) { bIsChart = true; @@ -930,7 +932,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0); if (sal_uInt32 nPolySize = aPolygon.count()) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj(); if (pWin && pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin)) { diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 9074036a3edc..d67108df38de 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -502,7 +502,7 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, s if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType()) { - vcl::Window* pWindow = static_cast<vcl::Window*>(pOut); + vcl::Window* pWindow = pOut->GetOwnerWindow(); if(pWindow->IsInPaint()) { @@ -737,7 +737,7 @@ vcl::Region SdrPaintView::OptimizeDrawLayersRegion(OutputDevice* pOut, const vcl // would be set. if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect) { - vcl::Window* pWindow = static_cast<vcl::Window*>(pOut); + vcl::Window* pWindow = pOut->GetOwnerWindow(); if(pWindow->IsInPaint()) { @@ -803,7 +803,7 @@ void SdrPaintView::GlueInvalidate() const const SdrObject* pObj=pOL->GetObj(nObjNum); const SdrGluePointList* pGPL=pObj->GetGluePointList(); if (pGPL!=nullptr && pGPL->GetCount()!=0) { - pGPL->Invalidate(static_cast<vcl::Window&>(rOutDev), pObj); + pGPL->Invalidate(*rOutDev.GetOwnerWindow(), pObj); } } } @@ -854,16 +854,14 @@ void SdrPaintView::InvalidateAllWin(const tools::Rectangle& rRect) void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice) { - vcl::Window& rWin(static_cast<vcl::Window&>(rDevice)); // do not erase background, that causes flicker (!) - rWin.Invalidate(InvalidateFlags::NoErase); + rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase); } void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice, const tools::Rectangle& rRect) { - vcl::Window& rWin(static_cast<vcl::Window&>(rDevice)); // do not erase background, that causes flicker (!) - rWin.Invalidate(rRect, InvalidateFlags::NoErase); + rDevice.GetOwnerWindow()->Invalidate(rRect, InvalidateFlags::NoErase); } void SdrPaintView::LeaveOneGroup() @@ -1012,7 +1010,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) } MapMode aMap(rWin.GetMapMode()); - Size aActualSize(rWin.GetOutputSize()); + Size aActualSize(rWin.GetOutDev()->GetOutputSize()); if( aActualSize.IsEmpty() ) return; @@ -1033,7 +1031,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) aMap.SetScaleX(aXFact); aMap.SetScaleY(aYFact); rWin.SetMapMode(aMap); - aActualSize=rWin.GetOutputSize(); + aActualSize=rWin.GetOutDev()->GetOutputSize(); } Point aOrg(aMap.GetOrigin()); tools::Long dx=0,dy=0; @@ -1054,7 +1052,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) } } else { rWin.SetMapMode(aMap); - InvalidateOneWin(rWin); + InvalidateOneWin(*rWin.GetOutDev()); } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index dbb4c405bb10..a2e6861556ad 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -163,7 +163,7 @@ SdrView::~SdrView() bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) { - SetActualWin(pWin); + SetActualWin(pWin->GetOutDev()); bool bRet = SdrCreateView::KeyInput(rKEvt,pWin); if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) { bRet = true; @@ -190,7 +190,7 @@ bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (bRet && pWin!=nullptr) { pWin->SetPointer(GetPreferredPointer( pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ), - pWin, + pWin->GetOutDev(), rKEvt.GetKeyCode().GetModifier())); } } @@ -240,7 +240,7 @@ bool SdrView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) bool SdrView::Command(const CommandEvent& rCEvt, vcl::Window* pWin) { - SetActualWin(pWin); + SetActualWin(pWin->GetOutDev()); bool bRet = SdrCreateView::Command(rCEvt,pWin); return bRet; } @@ -811,7 +811,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) if (eHit==SdrHitKind::TextEdit) { bool bRet2(mpActualOutDev && OUTDEV_WINDOW == mpActualOutDev->GetOutDevType() && - SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, static_cast<vcl::Window*>(mpActualOutDev.get()))); + SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, mpActualOutDev->GetOwnerWindow())); if(bRet2) { @@ -897,7 +897,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) } else bRet=BegCreateObj(aLogicPos); } break; case SdrEventKind::BeginMacroObj: { - BegMacroObj(aLogicPos,mnHitTolLog,rVEvt.pObj,rVEvt.pPV,static_cast<vcl::Window*>(mpActualOutDev.get())); + BegMacroObj(aLogicPos,mnHitTolLog,rVEvt.pObj,rVEvt.pPV,mpActualOutDev->GetOwnerWindow()); bRet=false; } break; case SdrEventKind::BeginTextEdit: { @@ -907,7 +907,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) } bRet = mpActualOutDev && OUTDEV_WINDOW == mpActualOutDev->GetOutDevType()&& - SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, static_cast<vcl::Window*>(mpActualOutDev.get())); + SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, mpActualOutDev->GetOwnerWindow()); if(bRet) { @@ -920,14 +920,14 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) default: break; } // switch if (bRet && mpActualOutDev && mpActualOutDev->GetOutDevType()==OUTDEV_WINDOW) { - vcl::Window* pWin=static_cast<vcl::Window*>(mpActualOutDev.get()); + vcl::Window* pWin=mpActualOutDev->GetOwnerWindow(); // left mouse button pressed? bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown; // left mouse button released? bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp; // left mouse button pressed or held? bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp; - pWin->SetPointer(GetPreferredPointer(rVEvt.aLogicPos,pWin, + pWin->SetPointer(GetPreferredPointer(rVEvt.aLogicPos,pWin->GetOutDev(), rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1)); bool bAction=IsAction(); if (bLeftDown && bAction) diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 0ba064368878..53304962303a 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -79,7 +79,7 @@ void AccessibleCell::Init() { // non-empty text -> use full-fledged edit source right away - mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow->GetOutDev()) ) ); if( mxCell.is() && mxCell->IsActiveCell() ) mpText->SetFocus(); mpText->SetEventSource(this); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index cab8570871dc..0f8faaa0fc6d 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -277,7 +277,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* if (OutputDevice* pOutputDevice = mrView.GetFirstOutputDevice()) { if (pOutputDevice->GetOutDevType() == OUTDEV_WINDOW) - pWindow = static_cast<vcl::Window*>(pOutputDevice); + pWindow = pOutputDevice->GetOwnerWindow(); } } diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index bb6a8fa95016..cc36596a90e8 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -106,7 +106,7 @@ namespace svx VclPtr<VirtualDevice> VclToolboxButtonColorUpdater::CreateVirtualDevice() const { - auto xRet = VclPtr<VirtualDevice>::Create(*mpTbx, + auto xRet = VclPtr<VirtualDevice>::Create(*mpTbx->GetOutDev(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); xRet->SetBackground(mpTbx->GetControlBackground()); return xRet; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 5605d23ca75d..8217e0500ce7 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -3063,7 +3063,7 @@ Size SwAccessibleMap::LogicToPixel( const Size& rSize ) const MapMode aSrc( MapUnit::Map100thMM ); MapMode aDest( MapUnit::MapTwip ); Size aSize( OutputDevice::LogicToLogic( rSize, aSrc, aDest ) ); - if (const OutputDevice* pWin = GetShell()->GetWin()) + if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev()) { MapMode aMapMode; GetMapMode( Point(0,0), aMapMode ); @@ -3182,7 +3182,7 @@ css::uno::Reference< XAccessible > Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const { Point aPoint; - if (const OutputDevice* pWin = GetShell()->GetWin()) + if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev()) { MapMode aMapMode; GetMapMode( rPoint, aMapMode ); @@ -3227,7 +3227,7 @@ static void lcl_CorrectRectangle(tools::Rectangle & rRect, tools::Rectangle SwAccessibleMap::CoreToPixel( const tools::Rectangle& rRect ) const { tools::Rectangle aRect; - if (const OutputDevice* pWin = GetShell()->GetWin()) + if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev()) { MapMode aMapMode; GetMapMode( rRect.TopLeft(), aMapMode ); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 4777b767deb3..adcb0aa4bc4a 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -592,7 +592,7 @@ void SwSelPaintRects::Invalidate( const SwRect& rRect ) void SwSelPaintRects::Get1PixelInLogic( const SwViewShell& rSh, tools::Long* pX, tools::Long* pY ) { - const OutputDevice* pOut = rSh.GetWin(); + const OutputDevice* pOut = rSh.GetWin()->GetOutDev(); if ( ! pOut ) pOut = rSh.GetOut(); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index c0b8984e6cf4..738ac7cc9dae 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1212,7 +1212,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr else if( pShell->GetWin() && pOut->IsVirtual() ) { pVout = pOut; - pOut = pShell->GetWin(); + pOut = pShell->GetWin()->GetOutDev(); } else pVout = nullptr; @@ -1260,7 +1260,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr : nullptr); // tdf#130951 caution - target may be Window, use the correct OutputDevice OutputDevice* pTarget(pShell->isOutputToWindow() - ? pShell->GetWin() + ? pShell->GetWin()->GetOutDev() : pShell->GetOut()); SdrPageWindow* pPageWindow(nullptr != pPageView && nullptr != pTarget ? pPageView->FindPageWindow(*pTarget) diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 99fad85445a4..4f16f7df8f1f 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1264,7 +1264,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) // Otherwise it could happen that for vector graphics // many MB's of memory are allocated. const Size aSz( GetSelectedFlyFrame()->getFramePrintArea().SSize() ); - ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin()); + ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin()->GetOutDev()); MapMode aTmp( MapUnit::MapTwip ); pVirtDev->SetMapMode( aTmp ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 10d5cf065d3a..0ab451c111a0 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2154,11 +2154,11 @@ void SwLayIdle::ShowIdle( Color eColor ) tools::Rectangle aRect( 0, 0, 5, 5 ); aRect = pWin->PixelToLogic( aRect ); // Depending on if idle layout is in progress or not, draw a "red square" or a "green square". - pWin->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR ); - pWin->SetFillColor( eColor ); - pWin->SetLineColor(); - pWin->DrawRect( aRect ); - pWin->Pop(); + pWin->GetOutDev()->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR ); + pWin->GetOutDev()->SetFillColor( eColor ); + pWin->GetOutDev()->SetLineColor(); + pWin->GetOutDev()->DrawRect( aRect ); + pWin->GetOutDev()->Pop(); } } #define SHOW_IDLE( Color ) ShowIdle( Color ) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 27cbf1b4a997..1d3d046dee66 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3012,7 +3012,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& if ( pSh->GetWin() ) { - if ( pSh->GetOut() == pSh->GetWin() && !pSh->GetWin()->IsVisible() ) + if ( pSh->GetOut() == pSh->GetWin()->GetOutDev() && !pSh->GetWin()->IsVisible() ) { return; } @@ -7502,7 +7502,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom(); ::SetOutDevAndWin( pSh, pDev, nullptr, 100 ); gProp.bSFlyMetafile = true; - gProp.pSFlyMetafileOut = pWin; + gProp.pSFlyMetafileOut = pWin->GetOutDev(); SwViewShellImp *pImp = pSh->Imp(); gProp.pSFlyOnlyDraw = pFly; diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index a0ae8073c27b..f6e298b2d3e0 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -1009,7 +1009,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM SwViewShell const * pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); OutputDevice* pOut = nullptr; if( pSh ) - pOut = pSh->GetWin(); + pOut = pSh->GetWin()->GetOutDev(); if( !pOut ) pOut = Application::GetDefaultDevice(); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 6f578e0744cd..1164a0fcb183 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -455,7 +455,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true ); if( pSh && !pOut ) - pOut = pSh->GetWin(); + pOut = pSh->GetWin()->GetOutDev(); if( !pOut ) pOut = Application::GetDefaultDevice(); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 312eb4dd71ba..54c60551f7bb 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -793,7 +793,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf OutputDevice* pOut = rInf.GetOut(); OutputDevice* pWin; if( rInf.GetVsh() && rInf.GetVsh()->GetWin() ) - pWin = rInf.GetVsh()->GetWin(); + pWin = rInf.GetVsh()->GetWin()->GetOutDev(); else pWin = Application::GetDefaultDevice(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 508f5ff81cfc..5e3afe0fce96 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -611,7 +611,7 @@ void SwFntObj::GuessLeading( const SwViewShell& #if defined(_WIN32) OutputDevice *pWin = rSh.GetWin() ? - rSh.GetWin() : + rSh.GetWin()->GetOutDev() : Application::GetDefaultDevice(); if ( pWin ) { @@ -876,7 +876,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) OSL_ENSURE( rInf.GetShell(), "SwFntObj::DrawText without shell" ); OutputDevice& rRefDev = rInf.GetShell()->GetRefDev(); - OutputDevice* pWin = rInf.GetShell()->GetWin(); + vcl::Window* pWin = rInf.GetShell()->GetWin(); // true if pOut is the printer and the printer has been used for formatting const bool bPrt = OUTDEV_PRINTER == rInf.GetOut().GetOutDevType() && diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 317480500eac..3cadcfd3556a 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -213,7 +213,8 @@ void SwViewShellImp::MakeDrawView() // to use GetOut() and check the existing cases. // Check worked well. Took a look at viewing, printing, PDF export and print preview with a test // document which has an empty 2nd page (right page, see bug) - OutputDevice* pOutDevForDrawView = GetShell()->GetWin(); + auto pWin = GetShell()->GetWin(); + OutputDevice* pOutDevForDrawView = pWin ? pWin->GetOutDev() : nullptr; if(!pOutDevForDrawView) { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 9d4ab60ceba0..e0f12b18b7a1 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -182,7 +182,7 @@ void SwViewShell::DLPrePaint2(const vcl::Region& rRegion) // Prefer window; if not available, get mpOut (e.g. printer) const bool bWindow = GetWin() && !comphelper::LibreOfficeKit::isActive() && !isOutputToWindow(); - mpPrePostOutDev = bWindow ? GetWin(): GetOut(); + mpPrePostOutDev = bWindow ? GetWin()->GetOutDev() : GetOut(); // #i74769# use SdrPaintWindow now direct mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion); @@ -285,7 +285,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) if ( mnLockPaint ) aAction.SetPaint( false ); aAction.SetInputType( VclInputFlags::KEYBOARD ); - aAction.Action(GetWin()); + aAction.Action(GetWin()->GetOutDev()); } if ( bIsShellForCheckViewLayout ) @@ -1078,7 +1078,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) //First get the old visible page, so we don't have to look //for it afterwards. - const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin()); + const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin()->GetOutDev()); const SwRect aPrevArea( VisArea() ); const bool bFull = aPrevArea.IsEmpty(); @@ -1125,11 +1125,11 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) while ( pPage && pPage->getFrameArea().Top() <= nBottom ) { - SwRect aPageRect( pPage->GetBoundRect(GetWin()) ); + SwRect aPageRect( pPage->GetBoundRect(GetWin()->GetOutDev()) ); if ( bBookMode ) { const SwPageFrame& rFormatPage = pPage->GetFormatPage(); - aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()).SSize() ); + aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()->GetOutDev()).SSize() ); } // #i9719# - consider new border and shadow width @@ -1218,8 +1218,8 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) if ( HasDrawView() ) { - Imp()->GetDrawView()->VisAreaChanged( GetWin() ); - Imp()->GetDrawView()->SetActualWin( GetWin() ); + Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() ); + Imp()->GetDrawView()->SetActualWin( GetWin()->GetOutDev() ); } GetWin()->PaintImmediately(); @@ -1273,9 +1273,9 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to //create virtual device and set. const Size aPixSz = GetWin()->PixelToLogic(Size(1,1)); - VclPtrInstance<VirtualDevice> pVout( *GetWin() ); - pVout->SetLineColor( GetWin()->GetLineColor() ); - pVout->SetFillColor( GetWin()->GetFillColor() ); + VclPtrInstance<VirtualDevice> pVout( *GetWin()->GetOutDev() ); + pVout->SetLineColor( GetWin()->GetOutDev()->GetLineColor() ); + pVout->SetFillColor( GetWin()->GetOutDev()->GetFillColor() ); MapMode aMapMode( GetWin()->GetMapMode() ); pVout->SetMapMode( aMapMode ); Size aSize( maVisArea.Width()+2*aPixSz.Width(), std::abs(lYDiff)+(2*aPixSz.Height()) ); @@ -1394,7 +1394,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to GetWin()->SetMapMode( aTmpMapMode ); if ( Imp()->HasDrawView() ) - Imp()->GetDrawView()->VisAreaChanged( GetWin() ); + Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() ); SetFirstVisPageInvalid(); if ( !Imp()->m_bStopSmooth ) @@ -1636,7 +1636,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) // can't format frames which are locked by the outer action. This may // cause and endless loop. ++mnStartAction; - aAction.Action(GetWin()); + aAction.Action(GetWin()->GetOutDev()); --mnStartAction; SwRegionRects *pRegion = Imp()->GetRegion(); @@ -1720,7 +1720,7 @@ public: { pRef = pValue; - if (pValue == pShell->GetWin()) + if (pValue == pShell->GetWin()->GetOutDev()) return; SdrView* pDrawView(pShell->Imp()->GetDrawView()); @@ -1732,7 +1732,7 @@ public: if (nullptr != pSdrPageView) { - m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin()); + m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin()->GetOutDev()); if (nullptr != m_pPatchedPageWindow) { @@ -1869,7 +1869,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang //aRegion.EndEnumRects( hHdl ); } else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) && - GetOut() == GetWin() ) + GetOut() == GetWin()->GetOutDev() ) { // #i68597# const vcl::Region aDLRegion(rRect); @@ -2075,7 +2075,7 @@ vcl::RenderContext& SwViewShell::GetRefDev() const if ( GetWin() && GetViewOptions()->getBrowseMode() && !GetViewOptions()->IsPrtFormat() ) - pTmpOut = GetWin(); + pTmpOut = GetWin()->GetOutDev(); else pTmpOut = GetDoc()->getIDocumentDeviceAccess().getReferenceDevice( true ); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 24c7ed35ff03..6ca815c0890c 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -104,10 +104,10 @@ void SwViewShell::Init( const SwViewOption *pNewOpt ) SAL_INFO( "sw.core", "View::Init - after InitPrt" ); if( GetWin() ) { - SwViewOption::Init( GetWin() ); - GetWin()->SetFillColor(); + SwViewOption::Init( GetWin()->GetOutDev() ); + GetWin()->GetOutDev()->SetFillColor(); GetWin()->SetBackground(); - GetWin()->SetLineColor(); + GetWin()->GetOutDev()->SetLineColor(); } // Create a new layout, if there is no one available @@ -150,7 +150,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, mpImp( new SwViewShellImp( this ) ), mpWin( pWindow ), mpOut( pOutput ? pOutput - : pWindow ? static_cast<OutputDevice*>(pWindow) + : pWindow ? pWindow->GetOutDev() : static_cast<OutputDevice*>(rDocument.getIDocumentDeviceAccess().getPrinter( true ))), mpAccOptions( new SwAccessibilityOptions ), mbShowHeaderSeparator( false ), @@ -220,7 +220,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, mpImp( new SwViewShellImp( this ) ), mpWin( pWindow ), mpOut( pOutput ? pOutput - : pWindow ? static_cast<OutputDevice*>(pWindow) + : pWindow ? pWindow->GetOutDev() : static_cast<OutputDevice*>(rShell.GetDoc()->getIDocumentDeviceAccess().getPrinter( true ))), mpAccOptions( new SwAccessibilityOptions ), mbShowHeaderSeparator( false ), diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index bb51694df012..3c064d600bee 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -671,7 +671,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha const SdrUnoObj *pFormObj = dynamic_cast<const SdrUnoObj*>( pObj ); uno::Reference< awt::XControl > xControl; if ( pDrawView && pVSh->GetWin() && pFormObj ) - xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() ); + xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin()->GetOutDev() ); awt::Size aSz( rShape->getSize() ); awt::Size aNewSz( 0, 0 ); diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 38c0418060e1..64d1beb7de46 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -664,7 +664,7 @@ static void GetControlSize(const SdrUnoObj& rFormObj, Size& rSz, SwDoc *pDoc) SdrView* pDrawView = pVSh->GetDrawView(); OSL_ENSURE( pDrawView && pVSh->GetWin(), "no DrawView or window!" ); if ( pDrawView && pVSh->GetWin() ) - xControl = rFormObj.GetUnoControl( *pDrawView, *pVSh->GetWin() ); + xControl = rFormObj.GetUnoControl( *pDrawView, *pVSh->GetWin()->GetOutDev() ); uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, uno::UNO_QUERY ); OSL_ENSURE( xLC.is(), "no XTextLayoutConstrains" ); if( !xLC.is() ) diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 7a9022e01778..582ff2701933 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -364,7 +364,7 @@ void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt) while ( pPrevPage && ( ( pPrevPage->getFrameArea().Top( ) == pPageFrame->getFrameArea().Top( ) ) || static_cast< const SwPageFrame* >( pPrevPage )->IsEmptyPage( ) ) ); - ::tools::Rectangle aBoundRect = GetEditWin()->LogicToPixel( pPageFrame->GetBoundRect(GetEditWin()).SVRect() ); + ::tools::Rectangle aBoundRect = GetEditWin()->LogicToPixel( pPageFrame->GetBoundRect(GetEditWin()->GetOutDev()).SVRect() ); ::tools::Rectangle aFrameRect = GetEditWin()->LogicToPixel( pPageFrame->getFrameArea().SVRect() ); tools::Long nYLineOffset = ( aBoundRect.Top() + aFrameRect.Top() ) / 2; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 752de942539b..ec09f3c07f12 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -2958,7 +2958,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SdrView *pSdrView = rSh.GetDrawView(); if ( pSdrView ) { - if (pSdrView->MouseButtonDown(aMEvt, this)) + if (pSdrView->MouseButtonDown(aMEvt, GetOutDev())) { rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(false); return; // SdrView's event evaluated @@ -3955,7 +3955,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) const SwCallMouseEvent aLastCallEvent( m_aSaveCallEvent ); m_aSaveCallEvent.Clear(); - if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,this) ) + if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,GetOutDev()) ) { SetPointer( PointerStyle::Text ); return; // evaluate SdrView's event @@ -4349,7 +4349,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) !rSh.GetViewOptions()->getBrowseMode() && rSh.GetViewOptions()->IsShadowCursor() && !(rMEvt.GetModifier() + rMEvt.GetButtons()) && - !rSh.HasSelection() && !GetConnectMetaFile() ) + !rSh.HasSelection() && !GetOutDev()->GetConnectMetaFile() ) { SwRect aRect; sal_Int16 eOrient; @@ -4426,7 +4426,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if (pSdrView->GetDragMode() != SdrDragMode::Crop && !rMEvt.IsShift()) pSdrView->SetOrtho(false); - if ( pSdrView->MouseButtonUp( rMEvt,this ) ) + if ( pSdrView->MouseButtonUp( rMEvt,GetOutDev() ) ) { rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(false); return; // SdrView's event evaluated @@ -4836,7 +4836,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) rSh.GetViewOptions()->IsShadowCursor() && MOUSE_LEFT == (rMEvt.GetModifier() + rMEvt.GetButtons()) && !rSh.HasSelection() && - !GetConnectMetaFile() && + !GetOutDev()->GetConnectMetaFile() && rSh.VisArea().IsInside( aDocPt )) { SwUndoId nLastUndoId(SwUndoId::EMPTY); @@ -5777,9 +5777,9 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) } - if (pSdrView->MouseButtonDown( aMEvt, this ) ) + if (pSdrView->MouseButtonDown( aMEvt, GetOutDev() ) ) { - pSdrView->MouseButtonUp( aMEvt, this ); + pSdrView->MouseButtonUp( aMEvt, GetOutDev() ); rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(false); return; } diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 0f4a2e1250d8..c2c196c329b8 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -94,7 +94,7 @@ OUString SwEditWin::ClipLongToolTip(const OUString& rText) tools::Long nMaxWidth = GetDesktopRectPixel().GetWidth() * 2 / 3; nMaxWidth = PixelToLogic(Size(nMaxWidth, 0)).Width(); if (nTextWidth > nMaxWidth) - sDisplayText = GetEllipsisString(sDisplayText, nMaxWidth, DrawTextFlags::CenterEllipsis); + sDisplayText = GetOutDev()->GetEllipsisString(sDisplayText, nMaxWidth, DrawTextFlags::CenterEllipsis); return sDisplayText; } diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 042dcc727eaa..a06b700b12f0 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -523,7 +523,7 @@ void SwSrcEditWindow::CreateTextEngine() vcl::Font aFont; aFont.SetTransparent( false ); aFont.SetFillColor( rCol ); - SetPointFont(*this, aFont); + SetPointFont(*GetOutDev(), aFont); aFont = GetFont(); aFont.SetFillColor( rCol ); m_pOutWin->SetFont( aFont ); @@ -963,11 +963,11 @@ void SwSrcEditWindow::SetFont() if(lcl_GetLanguagesForEncoding(m_eSourceEncoding, aLanguages)) { //TODO: check for multiple languages - aFont = OutputDevice::GetDefaultFont(DefaultFontType::FIXED, aLanguages[0], GetDefaultFontFlags::NONE, this); + aFont = OutputDevice::GetDefaultFont(DefaultFontType::FIXED, aLanguages[0], GetDefaultFontFlags::NONE, GetOutDev()); } else aFont = OutputDevice::GetDefaultFont(DefaultFontType::SANS_UNICODE, - Application::GetSettings().GetLanguageTag().getLanguageType(), GetDefaultFontFlags::NONE, this); + Application::GetSettings().GetLanguageTag().getLanguageType(), GetDefaultFontFlags::NONE, GetOutDev()); sFontName = aFont.GetFamilyName(); } const SvxFontListItem* pFontListItem = diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index 2cdefb908f41..7a989b4bff39 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -86,7 +86,6 @@ private: void ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineOff ); - using OutputDevice::SetFont; void SetFont(); DECL_LINK( SyntaxTimerHdl, Timer *, void ); diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx index ca3c19239011..1f94564df88e 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -85,7 +85,7 @@ SwCommentRuler::SwCommentRuler(SwViewShell* pViewSh, vcl::Window* pParent, SwEdi , mpSwWin(pWin) , mbIsHighlighted(false) , mnFadeRate(0) - , maVirDev(VclPtr<VirtualDevice>::Create(*this)) + , maVirDev(VclPtr<VirtualDevice>::Create(*GetOutDev())) { // Set fading timeout: 5 x 40ms = 200ms maFadeTimer.SetTimeout(40); diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index d49d3d1433ef..bc1c86fe1a2b 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -335,7 +335,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) break; std::unique_ptr< svx::ISdrObjectFilter > pFilter( FmFormShell::CreateFocusableControlFilter( - *pDrawView, *pWindow ) ); + *pDrawView, *pWindow->GetOutDev() ) ); if (!pFilter) break; @@ -348,7 +348,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) if ( !pUnoObject ) break; - pFormShell->ToggleControlFocus( *pUnoObject, *pDrawView, *pWindow ); + pFormShell->ToggleControlFocus( *pUnoObject, *pDrawView, *pWindow->GetOutDev() ); } break; case FN_CNTNT_TO_NEXT_FRAME: diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 856dc09f9db3..04ff8a593306 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -170,10 +170,10 @@ SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView , maPaintedPreviewDocRect(tools::Rectangle(0,0,0,0)) , mpPgPreviewLayout(nullptr) { - SetOutDevViewType( OutDevViewType::PrintPreview ); + GetOutDev()->SetOutDevViewType( OutDevViewType::PrintPreview ); SetHelpId(HID_PAGEPREVIEW); - SetFillColor( GetBackground().GetColor() ); - SetLineColor( GetBackground().GetColor()); + GetOutDev()->SetFillColor( GetBackground().GetColor() ); + GetOutDev()->SetLineColor( GetBackground().GetColor()); SetMapMode( MapMode(MapUnit::MapTwip) ); const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(false); @@ -610,7 +610,7 @@ void SwPagePreview::ExecPgUpAndPgDown( const bool _bPgUp, nNewSelectedPageNum = 1; } else - nScrollAmount = - std::min( m_pViewWin->GetOutputSize().Height(), + nScrollAmount = - std::min( m_pViewWin->GetOutDev()->GetOutputSize().Height(), m_pViewWin->GetPaintedPreviewDocRect().Top() ); } else @@ -624,7 +624,7 @@ void SwPagePreview::ExecPgUpAndPgDown( const bool _bPgUp, nNewSelectedPageNum = mnPageCount; } else - nScrollAmount = std::min( m_pViewWin->GetOutputSize().Height(), + nScrollAmount = std::min( m_pViewWin->GetOutDev()->GetOutputSize().Height(), ( pPagePreviewLay->GetPreviewDocSize().Height() - m_pViewWin->GetPaintedPreviewDocRect().Bottom() ) ); } @@ -1304,7 +1304,7 @@ void SwPagePreview::InnerResizePixel( const Point &rOfst, const Size &rSize, bo CalcAndSetBorderPixel( aBorder ); tools::Rectangle aRect( rOfst, rSize ); aRect += aBorder; - ViewResizePixel( *m_pViewWin, aRect.TopLeft(), aRect.GetSize(), + ViewResizePixel( *m_pViewWin->GetOutDev(), aRect.TopLeft(), aRect.GetSize(), m_pViewWin->GetOutputSizePixel(), *m_pVScrollbar, *m_pHScrollbar, *m_pScrollFill ); @@ -1333,7 +1333,7 @@ void SwPagePreview::OuterResizePixel( const Point &rOfst, const Size &rSize ) SvBorder aBorderNew; CalcAndSetBorderPixel( aBorderNew ); - ViewResizePixel( *m_pViewWin, rOfst, rSize, m_pViewWin->GetOutputSizePixel(), + ViewResizePixel( *m_pViewWin->GetOutDev(), rOfst, rSize, m_pViewWin->GetOutputSizePixel(), *m_pVScrollbar, *m_pHScrollbar, *m_pScrollFill ); } diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 3091e5af3bc6..56af6085b6af 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1501,7 +1501,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > Point aTopLeft(aVis.TopLeft()); // make sure the document is still centered const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER; - SwTwips nEditWidth = GetEditWin().GetOutputSize().Width(); + SwTwips nEditWidth = GetEditWin().GetOutDev()->GetOutputSize().Width(); if(nEditWidth > (m_aDocSz.Width() + lBorder )) aTopLeft.setX( ( m_aDocSz.Width() + lBorder - nEditWidth ) / 2 ); else diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 6e20aaedf7f6..eaaa780cf02c 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -985,7 +985,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize, bool ) } Size aEditSz( GetEditWin().GetOutputSizePixel() ); - ViewResizePixel( GetEditWin(), rOfst, aSz, aEditSz, *m_pVScrollbar, + ViewResizePixel( *GetEditWin().GetOutDev(), rOfst, aSz, aEditSz, *m_pVScrollbar, *m_pHScrollbar, *m_pScrollFill, m_pVRuler, m_pHRuler, m_pWrtShell->GetViewOptions()->IsVRulerRight()); if ( m_bShowAtResize ) @@ -1081,7 +1081,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize ) SvBorder aBorder; CalcAndSetBorderPixel( aBorder ); const Size aEditSz( GetEditWin().GetOutputSizePixel() ); - ViewResizePixel( GetEditWin(), rOfst, rSize, aEditSz, *m_pVScrollbar, + ViewResizePixel( *GetEditWin().GetOutDev(), rOfst, rSize, aEditSz, *m_pVScrollbar, *m_pHScrollbar, *m_pScrollFill, m_pVRuler, m_pHRuler, m_pWrtShell->GetViewOptions()->IsVRulerRight() ); if ( m_bShowAtResize ) diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 3059016abdfe..17e29ec02ade 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -463,7 +463,7 @@ SdrObject* SwXTextView::GetControl( SdrObject* pControl = nullptr; if ( pFormShell && pDrawView && pWindow ) - pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow, xToFill ); + pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow->GetOutDev(), xToFill ); return pControl; } @@ -487,7 +487,7 @@ uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormCo uno::Reference< form::runtime::XFormController > xController; if ( pFormShell && pDrawView && pWindow ) - xController = FmFormShell::GetFormController( Form, *pDrawView, *pWindow ); + xController = FmFormShell::GetFormController( Form, *pDrawView, *pWindow->GetOutDev() ); return xController; } diff --git a/sw/source/uibase/utlui/shdwcrsr.cxx b/sw/source/uibase/utlui/shdwcrsr.cxx index 2a9b2a9f3d99..cd208e5b3a08 100644 --- a/sw/source/uibase/utlui/shdwcrsr.cxx +++ b/sw/source/uibase/utlui/shdwcrsr.cxx @@ -57,7 +57,7 @@ void SwShadowCursor::DrawTri( const Point& rPt, tools::Long nHeight, bool bLeft tools::Long nDiff = bLeft ? -1 : 1; while( aPt1.Y() <= aPt2.Y() ) { - pWin->DrawLine( aPt1, aPt2 ); + pWin->GetOutDev()->DrawLine( aPt1, aPt2 ); aPt1.AdjustY( 1 ); aPt2.AdjustY( -1 ); aPt2.setX( aPt1.AdjustX(nDiff ) ); @@ -68,15 +68,15 @@ void SwShadowCursor::DrawCursor( const Point& rPt, tools::Long nHeight, sal_uInt { nHeight = (((nHeight / 4)+1) * 4) + 1; - pWin->Push(); + pWin->GetOutDev()->Push(); pWin->SetMapMode(MapMode(MapUnit::MapPixel)); - pWin->SetRasterOp( RasterOp::Xor ); + pWin->GetOutDev()->SetRasterOp( RasterOp::Xor ); - pWin->SetLineColor( Color( ColorTransparency, sal_uInt32(aCol) ^ sal_uInt32(COL_WHITE) ) ); + pWin->GetOutDev()->SetLineColor( Color( ColorTransparency, sal_uInt32(aCol) ^ sal_uInt32(COL_WHITE) ) ); // 1. The Line: - pWin->DrawLine( Point( rPt.X(), rPt.Y() + 1), + pWin->GetOutDev()->DrawLine( Point( rPt.X(), rPt.Y() + 1), Point( rPt.X(), rPt.Y() - 2 + nHeight )); // 2. The Triangle @@ -85,7 +85,7 @@ void SwShadowCursor::DrawCursor( const Point& rPt, tools::Long nHeight, sal_uInt if( text::HoriOrientation::RIGHT == nMode || text::HoriOrientation::CENTER == nMode ) // Arrow to the left DrawTri( rPt, nHeight, true ); - pWin->Pop(); + pWin->GetOutDev()->Pop(); } void SwShadowCursor::Paint() diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx index e070c3239ab7..082cdacaa786 100644 --- a/toolkit/source/awt/vclxcontainer.cxx +++ b/toolkit/source/awt/vclxcontainer.cxx @@ -254,15 +254,7 @@ void SAL_CALL VCLXContainer::setProperty( TabPage* pScrollTabPage = dynamic_cast< TabPage* >( pWindow.get() ); if ( pWindow && (pScrollable || pScrollTabPage) ) { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - // shouldn't happen but it appears pDev can be NULL - // #FIXME ( find out how/why ) - if ( !pDev ) - break; - - aSize = pDev->LogicToPixel( aSize, aMode ); + aSize = pWindow->LogicToPixel( aSize, aMode ); switch ( nPropType ) { case BASEPROPERTY_SCROLLHEIGHT: diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 2a90325ef9a3..215fdbaf2d88 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -351,7 +351,7 @@ void VCLXWindow::SetWindow( const VclPtr<vcl::Window> &pWindow ) // GetWindow()->DbgAssertNoEventListeners(); } - SetOutputDevice( pWindow ); + SetOutputDevice( pWindow ? pWindow->GetOutDev() : nullptr ); if ( GetWindow() ) { @@ -910,15 +910,14 @@ void VCLXWindow::dispose( ) mpImpl->disposing(); - if ( auto pWindow = GetWindow() ) + if ( VclPtr<vcl::Window> pWindow = GetWindow() ) { pWindow->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); pWindow->SetWindowPeer( nullptr, nullptr ); pWindow->SetAccessible( nullptr ); - VclPtr<OutputDevice> pOutDev = GetOutputDevice(); SetOutputDevice( nullptr ); - pOutDev.disposeAndClear(); + pWindow.disposeAndClear(); } // #i14103# dispose the accessible context after the window has been destroyed, @@ -1674,22 +1673,22 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& break; case BASEPROPERTY_FILLCOLOR: if ( bVoid ) - pWindow->SetFillColor(); + pWindow->GetOutDev()->SetFillColor(); else { Color nColor; if ( Value >>= nColor ) - pWindow->SetFillColor( nColor ); + pWindow->GetOutDev()->SetFillColor( nColor ); } break; case BASEPROPERTY_LINECOLOR: if ( bVoid ) - pWindow->SetLineColor(); + pWindow->GetOutDev()->SetLineColor(); else { Color nColor; if ( Value >>= nColor ) - pWindow->SetLineColor( nColor ); + pWindow->GetOutDev()->SetLineColor( nColor ); } break; case BASEPROPERTY_BORDER: @@ -2012,10 +2011,10 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName ) aProp <<= GetWindow()->GetTextLineColor(); break; case BASEPROPERTY_FILLCOLOR: - aProp <<= GetWindow()->GetFillColor(); + aProp <<= GetWindow()->GetOutDev()->GetFillColor(); break; case BASEPROPERTY_LINECOLOR: - aProp <<= GetWindow()->GetLineColor(); + aProp <<= GetWindow()->GetOutDev()->GetLineColor(); break; case BASEPROPERTY_BORDER: { @@ -2227,7 +2226,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); if (!pDev) - pDev = pWindow->GetParent(); + pDev = pWindow->GetParent()->GetOutDev(); TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow.get() ); if ( pTabPage ) { @@ -2239,7 +2238,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) Point aPos( nX, nY ); - if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) ) + if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent()->GetOutDev() == pDev ) ) { // #i40647# don't draw here if this is a recursive call // sometimes this is called recursively, because the Update call on the parent diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index e53f334de303..ce81e68fdd2e 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2387,7 +2387,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) { OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) - pDev = pWindow->GetParent(); + pDev = pWindow->GetParent()->GetOutDev(); Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); pWindow->Draw( pDev, aPos, DrawFlags::NoControls ); @@ -2508,7 +2508,7 @@ void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY ) { OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) - pDev = pWindow->GetParent(); + pDev = pWindow->GetParent()->GetOutDev(); Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); pWindow->Draw( pDev, aPos, DrawFlags::NoControls ); @@ -2753,7 +2753,7 @@ void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY ) { OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) - pDev = pWindow->GetParent(); + pDev = pWindow->GetParent()->GetOutDev(); Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); pWindow->Draw( pDev, aPos, DrawFlags::NoControls ); @@ -6241,7 +6241,7 @@ void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY ) { OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) - pDev = pWindow->GetParent(); + pDev = pWindow->GetParent()->GetOutDev(); Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); pWindow->Draw( pDev, aPos, DrawFlags::NoControls ); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index a97cb2229942..e669e7e9889e 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -183,7 +183,9 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer() vcl::Window* pParentWindow( nullptr ); { SolarMutexGuard aGuard; - pParentWindow = dynamic_cast< vcl::Window* >( Application::GetDefaultDevice() ); + auto pDefaultDevice = Application::GetDefaultDevice(); + if (pDefaultDevice) + pParentWindow = pDefaultDevice->GetOwnerWindow(); ENSURE_OR_THROW( pParentWindow != nullptr, "could obtain a default parent window!" ); } try diff --git a/toolkit/source/helper/btndlg.cxx b/toolkit/source/helper/btndlg.cxx index 64124928babc..a2471c3f92cd 100644 --- a/toolkit/source/helper/btndlg.cxx +++ b/toolkit/source/helper/btndlg.cxx @@ -100,7 +100,7 @@ tools::Long ButtonDialog::ImplGetButtonSize() { nSepSize += nLastSepSize; - tools::Long nTxtWidth = it->mpPushButton->GetCtrlTextWidth(it->mpPushButton->GetText()); + tools::Long nTxtWidth = it->mpPushButton->GetOutDev()->GetCtrlTextWidth(it->mpPushButton->GetText()); nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH; if ( nTxtWidth > maCtrlSize.Width() ) diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 84d0d3b02d2c..c756c79ae60a 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -2583,6 +2583,19 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons sal_Int32 nUnscaledExtentsRight = nExtentsRight * m_fScale; sal_Int32 nUnscaledExtentsTop = nExtentsTop * m_fScale; sal_Int32 nUnscaledExtentsBottom = nExtentsBottom * m_fScale; + + // not sure why this happens + int target_surface_width = cairo_image_surface_get_width(target_surface); + if (nUnscaledExtentsLeft > target_surface_width) + nUnscaledExtentsLeft = target_surface_width; + if (nUnscaledExtentsRight > target_surface_width) + nUnscaledExtentsRight = target_surface_width; + int target_surface_height = cairo_image_surface_get_height(target_surface); + if (nUnscaledExtentsTop > target_surface_height) + nUnscaledExtentsTop = target_surface_height; + if (nUnscaledExtentsBottom > target_surface_height) + nUnscaledExtentsBottom = target_surface_height; + vcl::bitmap::lookup_table const & unpremultiply_table = vcl::bitmap::get_unpremultiply_table(); vcl::bitmap::lookup_table const & premultiply_table = vcl::bitmap::get_premultiply_table(); diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index a1be28112799..1c94fd12c30d 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -76,6 +76,7 @@ namespace o3tl { class ImplBorderWindow : public vcl::Window { friend class vcl::Window; + friend class vcl::WindowOutputDevice; friend class ImplBorderWindowView; friend class ImplSmallBorderWindowView; friend class ImplStdBorderWindowView; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 01010f1e61e7..105fe8f91cfc 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -209,8 +209,8 @@ struct ImplSVGDIData { ~ImplSVGDIData(); - VclPtr<vcl::Window> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics - VclPtr<vcl::Window> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics + VclPtr<vcl::WindowOutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics + VclPtr<vcl::WindowOutputDevice> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics VclPtr<OutputDevice> mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics VclPtr<OutputDevice> mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics VclPtr<Printer> mpFirstPrnGraphics; // First OutputDevice with an InfoPrinter Graphics diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 6ca9b9a37031..cce17f47fb60 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -30,6 +30,8 @@ #include <vcl/settings.hxx> #include <o3tl/deleter.hxx> #include <o3tl/typed_flags_set.hxx> +#include <cppuhelper/weakref.hxx> +#include "windowdev.hxx" #include <optional> #include <list> @@ -213,9 +215,10 @@ private: WindowImpl(const WindowImpl&) = delete; WindowImpl& operator=(const WindowImpl&) = delete; public: - WindowImpl( WindowType ); + WindowImpl( vcl::Window& rWindow, WindowType ); ~WindowImpl(); + VclPtr<vcl::WindowOutputDevice> mxOutDev; std::unique_ptr<ImplWinData> mpWinData; ImplFrameData* mpFrameData; SalFrame* mpFrame; diff --git a/vcl/inc/windowdev.hxx b/vcl/inc/windowdev.hxx new file mode 100644 index 000000000000..a3d535646ccf --- /dev/null +++ b/vcl/inc/windowdev.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/outdev.hxx> + +namespace vcl +{ +class WindowOutputDevice final : public ::OutputDevice +{ +public: + WindowOutputDevice(vcl::Window& rOwnerWindow); + virtual ~WindowOutputDevice() override; + virtual void dispose() override; + + size_t GetSyncCount() const override { return 0x000000ff; } + virtual void EnableRTL(bool bEnable = true) override; + + void Flush() override; + + void SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, + const Size&) const override; + + css::awt::DeviceInfo GetDeviceInfo() const override; + + virtual vcl::Region GetActiveClipRegion() const override; + virtual vcl::Region GetOutputBoundsClipRegion() const override; + + virtual bool AcquireGraphics() const override; + virtual void ReleaseGraphics(bool bRelease = true) override; + + Color GetBackgroundColor() const override; + + using ::OutputDevice::SetSettings; + virtual void SetSettings(const AllSettings& rSettings) override; + void SetSettings(const AllSettings& rSettings, bool bChild); + + bool CanEnableNativeWidget() const override; + + /** Get the vcl::Window that this OutputDevice belongs to, if any */ + virtual vcl::Window* GetOwnerWindow() const override { return mxOwnerWindow.get(); } + + virtual css::uno::Reference<css::rendering::XCanvas> + ImplGetCanvas(bool bSpriteCanvas) const override; + +private: + virtual void InitClipRegion() override; + + void ImplClearFontData(bool bNewFontLists) override; + void ImplRefreshFontData(bool bNewFontLists) override; + void ImplInitMapModeObjects() override; + + 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; + + VclPtr<vcl::Window> mxOwnerWindow; +}; + +}; // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index f37324ab05e4..558a80d7cd46 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -67,7 +67,7 @@ void VclComplexTextTest::testArabic() vcl::Font aFont("DejaVu Sans", "Book", Size(0, 12)); - OutputDevice *pOutDev = pWin.get(); + OutputDevice *pOutDev = pWin->GetOutDev(); pOutDev->SetFont( aFont ); // absolute character widths AKA text array. @@ -153,7 +153,7 @@ void VclComplexTextTest::testTdf95650() ScopedVclPtrInstance<WorkWindow> pWin(static_cast<vcl::Window *>(nullptr)); CPPUNIT_ASSERT(pWin); - OutputDevice *pOutDev = pWin.get(); + OutputDevice *pOutDev = pWin->GetOutDev(); // Check that the following executes without failing assertion pOutDev->ImplLayout(aTxt, 9, 1, Point(), 0, nullptr, SalLayoutFlags::BiDiRtl); } diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 6385ec384e60..efb4d402cda4 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -63,9 +63,12 @@ void VclOutdevTest::testGetReadableFontColorPrinter() void VclOutdevTest::testGetReadableFontColorWindow() { ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); - CPPUNIT_ASSERT_EQUAL(pWindow->GetReadableFontColor(COL_WHITE, COL_BLACK), COL_WHITE); - CPPUNIT_ASSERT_EQUAL(pWindow->GetReadableFontColor(COL_WHITE, COL_WHITE), COL_BLACK); - CPPUNIT_ASSERT_EQUAL(pWindow->GetReadableFontColor(COL_BLACK, COL_BLACK), COL_WHITE); + CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_BLACK), + COL_WHITE); + CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_WHITE), + COL_BLACK); + CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_BLACK, COL_BLACK), + COL_WHITE); } void VclOutdevTest::testPrinterBackgroundColor() @@ -270,7 +273,7 @@ void VclOutdevTest::testRTL() { ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); pWindow->EnableRTL(); - vcl::RenderContext& rRenderContext = *pWindow; + vcl::RenderContext& rRenderContext = *pWindow->GetOutDev(); vcl::BufferDevice pBuffer(pWindow, rRenderContext); // Without the accompanying fix in place, this test would have failed, because the RTL status diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index b630bc086aee..662cfa26ac6b 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -264,9 +264,9 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal if( mnStyle & QuickHelpFlags::BiDiRtl ) { - ComplexTextLayoutFlags nLayoutMode = GetLayoutMode(); + ComplexTextLayoutFlags nLayoutMode = GetOutDev()->GetLayoutMode(); nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft; - SetLayoutMode( nLayoutMode ); + GetOutDev()->SetLayoutMode( nLayoutMode ); } SetHelpText( rText ); Window::SetHelpText( rText ); @@ -326,13 +326,13 @@ void HelpTextWindow::dispose() void HelpTextWindow::SetHelpText( const OUString& rHelpText ) { maHelpText = rHelpText; - ApplySettings(*this); + ApplySettings(*GetOutDev()); if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN && maHelpText.indexOf('\n') < 0) { Size aSize; aSize.setHeight( GetTextHeight() ); if ( mnStyle & QuickHelpFlags::CtrlText ) - aSize.setWidth( GetCtrlTextWidth( maHelpText ) ); + aSize.setWidth( GetOutDev()->GetCtrlTextWidth( maHelpText ) ); else aSize.setWidth( GetTextWidth( maHelpText ) ); maTextRect = tools::Rectangle( Point( HELPTEXTMARGIN_QUICK, HELPTEXTMARGIN_QUICK ), aSize ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 20ad4154d23f..813d74470139 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -321,7 +321,7 @@ Size SalInstanceWidget::get_pixel_size(const OUString& rText) const return Size(m_xWidget->GetTextWidth(rText), m_xWidget->GetTextHeight()); } -vcl::Font SalInstanceWidget::get_font() { return m_xWidget->GetPointFont(*m_xWidget); } +vcl::Font SalInstanceWidget::get_font() { return m_xWidget->GetPointFont(*m_xWidget->GetOutDev()); } OString SalInstanceWidget::get_buildable_name() const { return m_xWidget->get_id().toUtf8(); } @@ -1251,7 +1251,7 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRenderLogicPos, OutputDevice& rOutput) { - pWindow->Push(); + rOutput.Push(); bool bOldMapModeEnabled = pWindow->IsMapModeEnabled(); if (pWindow->GetMapMode().GetMapUnit() != rOutput.GetMapMode().GetMapUnit()) @@ -1297,7 +1297,7 @@ void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRen xOutput.disposeAndClear(); pWindow->EnableMapMode(bOldMapModeEnabled); - pWindow->Pop(); + rOutput.Pop(); for (vcl::Window* pChild = pWindow->GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next)) @@ -3303,7 +3303,7 @@ void SalInstanceEntry::set_message_type(weld::EntryMessageType eType) void SalInstanceEntry::set_font(const vcl::Font& rFont) { - m_xEntry->SetPointFont(*m_xEntry, rFont); + m_xEntry->SetPointFont(*m_xEntry->GetOutDev(), rFont); m_xEntry->Invalidate(); } @@ -5765,8 +5765,9 @@ void SalInstanceTextView::set_monospace(bool bMonospace) vcl::Font aOrigFont = m_xTextView->GetControlFont(); vcl::Font aFont; if (bMonospace) - aFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, LANGUAGE_DONTKNOW, - GetDefaultFontFlags::OnlyOne, m_xTextView); + aFont + = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, LANGUAGE_DONTKNOW, + GetDefaultFontFlags::OnlyOne, m_xTextView->GetOutDev()); else aFont = Application::GetSettings().GetStyleSettings().GetFieldFont(); aFont.SetFontHeight(aOrigFont.GetFontHeight()); @@ -6062,7 +6063,7 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea() Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>()); } -OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea; } +OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea->GetOutDev(); } void SalInstanceDrawingArea::click(const Point& rPos) { @@ -6384,7 +6385,7 @@ void SalInstanceComboBoxWithEdit::set_entry_font(const vcl::Font& rFont) { Edit* pEdit = m_xComboBox->GetSubEdit(); assert(pEdit); - pEdit->SetPointFont(*pEdit, rFont); + pEdit->SetPointFont(*pEdit->GetOutDev(), rFont); m_xComboBox->SetControlFont(rFont); // tdf#134601 set it as control font to take effect properly pEdit->Invalidate(); } @@ -6393,7 +6394,7 @@ vcl::Font SalInstanceComboBoxWithEdit::get_entry_font() { Edit* pEdit = m_xComboBox->GetSubEdit(); assert(pEdit); - return pEdit->GetPointFont(*pEdit); + return pEdit->GetPointFont(*pEdit->GetOutDev()); } void SalInstanceComboBoxWithEdit::set_custom_renderer(bool bOn) @@ -6438,7 +6439,7 @@ void SalInstanceComboBoxWithEdit::HandleEventListener(VclWindowEvent& rEvent) { if (rEvent.GetId() == VclEventId::DropdownPreOpen) { - Size aRowSize(signal_custom_get_size(*m_xComboBox)); + Size aRowSize(signal_custom_get_size(*m_xComboBox->GetOutDev())); m_xComboBox->SetUserItemSize(aRowSize); } CallHandleEventListener(rEvent); @@ -6520,14 +6521,14 @@ public: virtual void set_entry_font(const vcl::Font& rFont) override { Edit& rEntry = m_pEntry->getEntry(); - rEntry.SetPointFont(rEntry, rFont); + rEntry.SetPointFont(*rEntry.GetOutDev(), rFont); rEntry.Invalidate(); } virtual vcl::Font get_entry_font() override { Edit& rEntry = m_pEntry->getEntry(); - return rEntry.GetPointFont(rEntry); + return rEntry.GetPointFont(*rEntry.GetOutDev()); } virtual void set_entry_placeholder_text(const OUString& rText) override diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 963a2a2f9457..0e74c7b8ee7e 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -670,8 +670,8 @@ void Application::SetSettings( const AllSettings& rSettings ) tools::Long nOldDPIY = 0; if ( pFirstFrame ) { - nOldDPIX = pFirstFrame->GetDPIX(); - nOldDPIY = pFirstFrame->GetDPIY(); + nOldDPIX = pFirstFrame->GetOutDev()->GetDPIX(); + nOldDPIY = pFirstFrame->GetOutDev()->GetDPIY(); vcl::Window::ImplInitAppFontData(pFirstFrame); } vcl::Window* pFrame = pFirstFrame; @@ -702,8 +702,8 @@ void Application::SetSettings( const AllSettings& rSettings ) pFirstFrame = pSVData->maFrameData.mpFirstFrame; if ( pFirstFrame ) { - if ( (pFirstFrame->GetDPIX() != nOldDPIX) || - (pFirstFrame->GetDPIY() != nOldDPIY) ) + if ( (pFirstFrame->GetOutDev()->GetDPIX() != nOldDPIX) || + (pFirstFrame->GetOutDev()->GetDPIY() != nOldDPIY) ) { VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev; while ( pVirDev ) @@ -712,8 +712,8 @@ void Application::SetSettings( const AllSettings& rSettings ) (pVirDev->GetDPIX() == nOldDPIX) && (pVirDev->GetDPIY() == nOldDPIY) ) { - pVirDev->SetDPIX( pFirstFrame->GetDPIX() ); - pVirDev->SetDPIY( pFirstFrame->GetDPIY() ); + pVirDev->SetDPIX( pFirstFrame->GetOutDev()->GetDPIX() ); + pVirDev->SetDPIY( pFirstFrame->GetOutDev()->GetDPIY() ); if ( pVirDev->IsMapModeEnabled() ) { MapMode aMapMode = pVirDev->GetMapMode(); @@ -1037,10 +1037,6 @@ ImplSVEvent * Application::PostUserEvent( const Link<void*,void>& rLink, void* p if (bReferenceLink) { SolarMutexGuard aGuard; - // Double check that this is indeed a vcl::Window instance. - assert(dynamic_cast<vcl::Window *>( - static_cast<OutputDevice *>(rLink.GetInstance())) == - static_cast<vcl::Window *>(rLink.GetInstance())); pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance()); } @@ -1072,7 +1068,7 @@ vcl::Window* Application::GetFocusWindow() OutputDevice* Application::GetDefaultDevice() { - return ImplGetDefaultWindow(); + return ImplGetDefaultWindow()->GetOutDev(); } vcl::Window* Application::GetFirstTopLevelWindow() diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index a0a52b91e591..ba5fce26278a 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -44,6 +44,7 @@ #include <salgdi.hxx> #include <svdata.hxx> #include <salsys.hxx> +#include <windowdev.hxx> #include <units.hrc> #include <print.h> diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 7eb83ab10ecf..d5a305103faa 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -51,6 +51,7 @@ #include <vcl/print.hxx> #include <debugevent.hxx> #include <scrwnd.hxx> +#include <windowdev.hxx> #ifdef _WIN32 #include <svsys.h> diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index b35121b78850..e9d557430b42 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -615,8 +615,10 @@ weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect) void SetPointFont(OutputDevice& rDevice, const vcl::Font& rFont) { - if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice())) - pDefaultDevice->SetPointFont(rDevice, rFont); + auto pDefaultDevice = Application::GetDefaultDevice(); + if (pDefaultDevice) + if (vcl::Window* pDefaultWindow = pDefaultDevice->GetOwnerWindow()) + pDefaultWindow->SetPointFont(rDevice, rFont); } } diff --git a/vcl/source/control/PriorityHBox.cxx b/vcl/source/control/PriorityHBox.cxx index cb3219bf5a5c..c3477d23f30d 100644 --- a/vcl/source/control/PriorityHBox.cxx +++ b/vcl/source/control/PriorityHBox.cxx @@ -128,10 +128,10 @@ void PriorityHBox::Resize() if (pWindow && pWindow->GetParent() == this) { - nCurrentWidth -= pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); pWindow->Show(); pPrioritable->HideContent(); - nCurrentWidth += pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth += pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); } } @@ -150,7 +150,7 @@ void PriorityHBox::Resize() if (pWindow) { - nCurrentWidth -= pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); pWindow->Show(); pPrioritable->ShowContent(); nCurrentWidth += getLayoutRequisition(*pWindow).Width() + get_spacing(); diff --git a/vcl/source/control/PriorityMergedHBox.cxx b/vcl/source/control/PriorityMergedHBox.cxx index 43b13b5175f8..b67368d87628 100644 --- a/vcl/source/control/PriorityMergedHBox.cxx +++ b/vcl/source/control/PriorityMergedHBox.cxx @@ -69,8 +69,8 @@ void PriorityMergedHBox::Resize() if (pWindow && pWindow->GetParent() == this && pWindow->IsVisible()) { - if (pWindow->GetOutputWidthPixel()) - nCurrentWidth -= pWindow->GetOutputWidthPixel(); + if (pWindow->GetOutDev()->GetOutputWidthPixel()) + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel(); else nCurrentWidth -= DUMMY_WIDTH; pWindow->Hide(); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index d6529c8bf311..42d3da20c2a2 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2823,7 +2823,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags void RadioButton::ImplAdjustNWFSizes() { - Push( PushFlags::MAPMODE ); + GetOutDev()->Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); ImplControlValue aControlValue; @@ -2845,7 +2845,7 @@ void RadioButton::ImplAdjustNWFSizes() } } - Pop(); + GetOutDev()->Pop(); } Size RadioButton::CalcMinimumSize(tools::Long nMaxWidth) const @@ -2910,7 +2910,7 @@ void RadioButton::ShowFocus(const tools::Rectangle& rRect) aInRect.SetLeft( rRect.Left() ); // exclude the radio element itself from the focusrect - DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect, + GetOutDev()->DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect, ControlState::FOCUSED, aControlValue, OUString()); } Button::ShowFocus(rRect); @@ -3613,7 +3613,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl void CheckBox::ImplAdjustNWFSizes() { - Push( PushFlags::MAPMODE ); + GetOutDev()->Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); ImplControlValue aControlValue; @@ -3635,7 +3635,7 @@ void CheckBox::ImplAdjustNWFSizes() } } - Pop(); + GetOutDev()->Pop(); } Size CheckBox::CalcMinimumSize( tools::Long nMaxWidth ) const @@ -3686,7 +3686,7 @@ void CheckBox::ShowFocus(const tools::Rectangle& rRect) aInRect.SetLeft( rRect.Left() ); // exclude the checkbox itself from the focusrect - DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect, + GetOutDev()->DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect, ControlState::FOCUSED, aControlValue, OUString()); } Button::ShowFocus(rRect); diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx index 7b8f9a061eb8..c03740f3063c 100644 --- a/vcl/source/control/calendar.cxx +++ b/vcl/source/control/calendar.cxx @@ -125,7 +125,7 @@ void Calendar::ImplInitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); maSelColor = rStyleSettings.GetHighlightTextColor(); - SetPointFont(*this, rStyleSettings.GetToolFont()); + SetPointFont(*GetOutDev(), rStyleSettings.GetToolFont()); SetTextColor(rStyleSettings.GetFieldTextColor()); SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f749e7ab9d36..2f8143028422 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -703,7 +703,7 @@ void ComboBox::DataChanged( const DataChangedEvent& rDCEvt ) if (m_pImpl->m_pBtn) { - m_pImpl->m_pBtn->SetSettings( GetSettings() ); + m_pImpl->m_pBtn->GetOutDev()->SetSettings( GetSettings() ); ImplInitDropDownButton( m_pImpl->m_pBtn ); } Resize(); diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 4f89e19b66ef..f0c01cdc4b0c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -65,10 +65,10 @@ void Control::dispose() void Control::EnableRTL( bool bEnable ) { // convenience: for controls also switch layout mode - SetLayoutMode( bEnable ? ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft : + GetOutDev()->SetLayoutMode( bEnable ? ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft : ComplexTextLayoutFlags::TextOriginLeft ); CompatStateChanged( StateChangedType::Mirroring ); - OutputDevice::EnableRTL(bEnable); + Window::EnableRTL(bEnable); } void Control::Resize() @@ -427,7 +427,7 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) void Control::ImplInitSettings() { - ApplySettings(*this); + ApplySettings(*GetOutDev()); } tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& rRect, const OUString& _rStr, diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 87aafd4bcb3b..f7ebe26568e6 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -327,7 +327,7 @@ void Edit::ImplInit(vcl::Window* pParent, WinBits nStyle) SetCursor( new vcl::Cursor ); SetPointer( PointerStyle::Text ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY ); uno::Reference< datatransfer::dnd::XDragGestureRecognizer > xDGR = GetDragGestureRecognizer(); @@ -484,7 +484,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl pDX = pDXBuffer.get(); } - GetCaretPositions(aText, pDX, 0, nLen); + GetOutDev()->GetCaretPositions(aText, pDX, 0, nLen); } tools::Long nTH = GetTextHeight(); @@ -1045,16 +1045,16 @@ void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext) aClipRgn.Move(aBorderOffs.X(), aBorderOffs.Y()); } - vcl::Region oldRgn(pBorder->GetClipRegion()); - pBorder->SetClipRegion(aClipRgn); + vcl::Region oldRgn(pBorder->GetOutDev()->GetClipRegion()); + pBorder->GetOutDev()->SetClipRegion(aClipRgn); - pBorder->Paint(*pBorder, tools::Rectangle()); + pBorder->Paint(*pBorder->GetOutDev(), tools::Rectangle()); - pBorder->SetClipRegion(oldRgn); + pBorder->GetOutDev()->SetClipRegion(oldRgn); } else { - pBorder->Paint(*pBorder, tools::Rectangle()); + pBorder->Paint(*pBorder->GetOutDev(), tools::Rectangle()); } } @@ -1080,7 +1080,7 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) pDX = pDXBuffer.get(); } - GetCaretPositions( aText, pDX, 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, pDX, 0, aText.getLength() ); if( maSelection.Max() < aText.getLength() ) nTextPos = pDX[ 2*maSelection.Max() ]; @@ -1201,7 +1201,7 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const pDX = pDXBuffer.get(); } - GetCaretPositions( aText, pDX, 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, pDX, 0, aText.getLength() ); tools::Long nX = rWindowPos.X() - mnXOffset - ImplGetExtraXOffset(); for (sal_Int32 i = 0; i < aText.getLength(); aText.iterateCodePoints(&i)) { @@ -2133,7 +2133,7 @@ void Edit::Command( const CommandEvent& rCEvt ) OUString aText = ImplGetText(); std::vector<tools::Long> aDX(2*(aText.getLength()+1)); - GetCaretPositions( aText, aDX.data(), 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, aDX.data(), 0, aText.getLength() ); tools::Long nTH = GetTextHeight(); Point aPos( mnXOffset, ImplGetTextYPosition() ); @@ -2193,12 +2193,12 @@ void Edit::StateChanged( StateChangedType nType ) if (GetParent()->GetStyle() & WB_LEFT) mnAlign = EDIT_ALIGN_RIGHT; if (nType == StateChangedType::Mirroring) - SetLayoutMode(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft); + GetOutDev()->SetLayoutMode(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft); } else if (mbIsSubEdit && !GetParent()->IsRTLEnabled()) { if (nType == StateChangedType::Mirroring) - SetLayoutMode(ComplexTextLayoutFlags::TextOriginLeft); + GetOutDev()->SetLayoutMode(ComplexTextLayoutFlags::TextOriginLeft); } if (nStyle & WB_RIGHT) @@ -2216,7 +2216,7 @@ void Edit::StateChanged( StateChangedType nType ) { if (!mpSubEdit) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplShowCursor(); Invalidate(); } @@ -2225,7 +2225,7 @@ void Edit::StateChanged( StateChangedType nType ) { if (!mpSubEdit) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -2242,7 +2242,7 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt ) { if ( !mpSubEdit ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplShowCursor(); Invalidate(); } @@ -2257,7 +2257,7 @@ void Edit::ImplShowDDCursor() { tools::Long nTextWidth = GetTextWidth( maText.toString(), 0, mpDDInfo->nDropPos ); tools::Long nTextHeight = GetTextHeight(); - tools::Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) ); + tools::Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutDev()->GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) ); mpDDInfo->aCursor.SetWindow( this ); mpDDInfo->aCursor.SetPos( aCursorRect.TopLeft() ); mpDDInfo->aCursor.SetSize( aCursorRect.GetSize() ); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 82675d720c9a..6ed615dd6259 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -72,7 +72,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedText::ImplInitStyle( WinBits nStyle ) @@ -257,24 +257,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -288,7 +288,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -349,7 +349,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - ImplDraw(const_cast<FixedText*>(this), DrawFlags::NONE, Point(), GetOutputSizePixel(), true); + ImplDraw(const_cast<FixedText*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true); //const_cast<FixedText*>(this)->Invalidate(); } @@ -456,7 +456,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedLine::ImplInitStyle( WinBits nStyle ) @@ -535,7 +535,7 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext) if (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono) nStyle |= DrawTextFlags::Mono; - aRect = DrawControlText(*this, aRect, aText, nStyle, nullptr, nullptr); + aRect = DrawControlText(*GetOutDev(), aRect, aText, nStyle, nullptr, nullptr); tools::Long nTop = aRect.Top() + ((aRect.GetHeight() - 1) / 2); aDecoView.DrawSeparator(Point(aRect.Right() + FIXEDLINE_TEXT_BORDER, nTop), Point(aOutSize.Width() - 1, nTop), false); @@ -619,17 +619,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == StateChangedType::Style) || (nType == StateChangedType::ControlFont) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -643,7 +643,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -664,7 +664,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) @@ -770,7 +770,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -782,7 +782,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -798,7 +798,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedImage::ImplInitStyle( WinBits nStyle ) @@ -917,7 +917,7 @@ void FixedImage::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -929,7 +929,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx index b7f3500fc029..01baaf575b16 100644 --- a/vcl/source/control/fixedhyper.cxx +++ b/vcl/source/control/fixedhyper.cxx @@ -53,7 +53,7 @@ void FixedHyperlink::Initialize() // changes the color to link color SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() ); // calculates text len - m_nTextLen = GetCtrlTextWidth( GetText() ); + m_nTextLen = GetOutDev()->GetCtrlTextWidth( GetText() ); SetClickHdl(LINK(this, FixedHyperlink, HandleClick)); } @@ -147,7 +147,7 @@ void FixedHyperlink::SetURL( const OUString& rNewURL ) void FixedHyperlink::SetText(const OUString& rNewDescription) { FixedText::SetText(rNewDescription); - m_nTextLen = GetCtrlTextWidth(GetText()); + m_nTextLen = GetOutDev()->GetCtrlTextWidth(GetText()); } bool FixedHyperlink::set_property(const OString &rKey, const OUString &rValue) diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 73094dfcc454..b904b73c66e8 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -133,19 +133,19 @@ void ImageControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan bool bFlat = (GetBorderStyle() == WindowBorderStyle::MONO); tools::Rectangle aRect(Point(0,0), pBorderWindow->GetOutputSizePixel()); - Color oldLineCol = pBorderWindow->GetLineColor(); - Color oldFillCol = pBorderWindow->GetFillColor(); - pBorderWindow->SetFillColor(); - pBorderWindow->SetLineColor(bFlat ? COL_WHITE : COL_BLACK); - pBorderWindow->DrawRect(aRect); + Color oldLineCol = pBorderWindow->GetOutDev()->GetLineColor(); + Color oldFillCol = pBorderWindow->GetOutDev()->GetFillColor(); + pBorderWindow->GetOutDev()->SetFillColor(); + pBorderWindow->GetOutDev()->SetLineColor(bFlat ? COL_WHITE : COL_BLACK); + pBorderWindow->GetOutDev()->DrawRect(aRect); aRect.AdjustLeft( 1 ); aRect.AdjustRight( -1 ); aRect.AdjustTop( 1 ); aRect.AdjustBottom( -1 ); - pBorderWindow->SetLineColor(bFlat ? COL_BLACK : COL_WHITE); - pBorderWindow->DrawRect(aRect); - pBorderWindow->SetLineColor(oldLineCol); - pBorderWindow->SetFillColor(oldFillCol); + pBorderWindow->GetOutDev()->SetLineColor(bFlat ? COL_BLACK : COL_WHITE); + pBorderWindow->GetOutDev()->DrawRect(aRect); + pBorderWindow->GetOutDev()->SetLineColor(oldLineCol); + pBorderWindow->GetOutDev()->SetFillColor(oldFillCol); } diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 4f4ae02cdfaa..2eae406b4299 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -2260,10 +2260,10 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty()); bool bResetClipRegion = false; - if( !pView->IsClipRegion() ) + if( !pView->GetOutDev()->IsClipRegion() ) { bResetClipRegion = true; - pView->SetClipRegion(vcl::Region(GetOutputRect())); + pView->GetOutDev()->SetClipRegion(vcl::Region(GetOutputRect())); } for( size_t nPos = 0; nPos < nCount; nPos++ ) @@ -2334,7 +2334,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd pView->PaintImmediately(); if( bResetClipRegion ) - pView->SetClipRegion(); + pView->GetOutDev()->SetClipRegion(); } void SvxIconChoiceCtrl_Impl::SelectRange( diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index a97d0f42c18c..e8315f85aec0 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -472,11 +472,11 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; - SetLineColor(); + GetOutDev()->SetLineColor(); SetTextFillColor(); SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); } @@ -629,7 +629,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) else { // normal single line case - const SalLayoutGlyphs* pGlyphs = rEntry.GetTextGlyphs(this); + const SalLayoutGlyphs* pGlyphs = rEntry.GetTextGlyphs(GetOutDev()); aMetrics.nTextWidth = static_cast<sal_uInt16>(GetTextWidth(rEntry.maStr, 0, -1, nullptr, pGlyphs)); if( aMetrics.nTextWidth > mnMaxTxtWidth ) @@ -1745,7 +1745,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 void ImplListBoxWindow::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutputSize())); + const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutDev()->GetOutputSize())); } void ImplListBoxWindow::ImplDoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) @@ -1962,7 +1962,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) if ( nType == StateChangedType::Zoom ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } @@ -1973,18 +1973,18 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlFont ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if( nType == StateChangedType::Enable ) @@ -2005,7 +2005,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { ImplClearLayoutData(); - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } @@ -2497,7 +2497,7 @@ void ImplWin::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); ImplWin* pThis = const_cast<ImplWin*>(this); - pThis->ImplDraw(*pThis, true); + pThis->ImplDraw(*pThis->GetOutDev(), true); } bool ImplWin::PreNotify( NotifyEvent& rNEvt ) @@ -2572,7 +2572,7 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) if( ! (nParentStyle & WB_BORDER) || (nParentStyle & WB_NOBORDER) ) { tools::Rectangle aParentRect( Point( 0, 0 ), pWin->GetSizePixel() ); - pWin->DrawNativeControl( ControlType::Listbox, ControlPart::Entire, aParentRect, + pWin->GetOutDev()->DrawNativeControl( ControlType::Listbox, ControlPart::Entire, aParentRect, nState, aControlValue, OUString() ); } @@ -2771,7 +2771,7 @@ void ImplWin::ShowFocus(const tools::Rectangle& rRect) vcl::Window *pWin = GetParent(); tools::Rectangle aParentRect(Point(0, 0), pWin->GetSizePixel()); - pWin->DrawNativeControl(ControlType::Listbox, ControlPart::Focus, aParentRect, + pWin->GetOutDev()->DrawNativeControl(ControlType::Listbox, ControlPart::Focus, aParentRect, ControlState::FOCUSED, aControlValue, OUString()); } Control::ShowFocus(rRect); @@ -2983,7 +2983,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking ) vcl::Window *pGrandparent = GetParent()->GetParent(); const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev(); - if( pGrandparent->ImplIsAntiparallel() ) + if( pGrandparent->GetOutDev()->ImplIsAntiparallel() ) pGrandparentOutDev->ReMirror( aRect ); // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795 diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index c96e133a506f..3091d62fe9ab 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -92,7 +92,7 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle ) _pImpl ( new SvxIconChoiceCtrl_Impl( this, nWinStyle ) ) { - SetLineColor(); + GetOutDev()->SetLineColor(); _pImpl->InitSettings(); _pImpl->SetPositionMode( SvxIconChoiceCtrlPositionMode::AutoArrange ); } @@ -234,9 +234,9 @@ void SvtIconChoiceCtrl::SetFont(const vcl::Font& rFont) void SvtIconChoiceCtrl::SetPointFont(const vcl::Font& rFont) { - if (rFont != GetPointFont(*this)) //FIXME + if (rFont != GetPointFont(*GetOutDev())) //FIXME { - Control::SetPointFont(*this, rFont); //FIXME + Control::SetPointFont(*GetOutDev(), rFont); //FIXME _pImpl->FontModified(); } } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 0f7528c8a5f4..43576679338b 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -483,10 +483,10 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( mpImplWin ) { - mpImplWin->SetSettings( GetSettings() ); // If not yet set... - mpImplWin->ApplySettings(*mpImplWin); + mpImplWin->GetOutDev()->SetSettings( GetSettings() ); // If not yet set... + mpImplWin->ApplySettings(*mpImplWin->GetOutDev()); - mpBtn->SetSettings( GetSettings() ); + mpBtn->GetOutDev()->SetSettings( GetSettings() ); ImplInitDropDownButton( mpBtn ); } diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index d27214bc9015..42fb8231327d 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -294,13 +294,13 @@ void NotebookBar::UpdateBackground() { SetBackground(aWallpaper); UpdatePersonaSettings(); - SetSettings( PersonaSettings ); + GetOutDev()->SetSettings( PersonaSettings ); } else { SetBackground(rStyleSettings.GetDialogColor()); UpdateDefaultSettings(); - SetSettings( DefaultSettings ); + GetOutDev()->SetSettings( DefaultSettings ); } Invalidate(tools::Rectangle(Point(0,0), GetSizePixel())); diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx index ef8d2867018a..eabd2b29e942 100644 --- a/vcl/source/control/prgsbar.cxx +++ b/vcl/source/control/prgsbar.cxx @@ -105,8 +105,8 @@ void ProgressBar::ImplInitSettings( bool bFont, else aColor.IncreaseLuminance( 64 ); } - SetLineColor(); - SetFillColor( aColor ); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor( aColor ); /* FIXME: !!! We do not support text output at the moment SetTextColor( aColor ); SetTextFillColor(); diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 848260b4b9b5..8b812b6e2a01 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -728,7 +728,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) switch ( meScrollType ) { case ScrollType::LineUp: - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn1Rect.IsInside( rMousePos ) ) @@ -741,7 +741,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) break; case ScrollType::LineDown: - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn2Rect.IsInside( rMousePos ) ) @@ -755,7 +755,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) case ScrollType::PageUp: // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) @@ -769,7 +769,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) case ScrollType::PageDown: // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, maPage2Rect, rMousePos, bIsInside )? bIsInside: maPage2Rect.IsInside( rMousePos ) ) @@ -822,7 +822,7 @@ void ScrollBar::ImplDragThumb( const Point& rMousePos ) PaintImmediately(); } else - ImplDraw(*this); + ImplDraw(*GetOutDev()); mnDelta = mnThumbPos-nOldPos; Scroll(); @@ -843,13 +843,13 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rMEvt coordinates are in twips. - Push(PushFlags::MAPMODE); + GetOutDev()->Push(PushFlags::MAPMODE); EnableMapMode(); MapMode aMapMode = GetMapMode(); aMapMode.SetOrigin(Point(0, 0)); SetMapMode(aMapMode); aPosPixel = LogicToPixel(rMEvt.GetPosPixel()); - Pop(); + GetOutDev()->Pop(); } const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel); StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; @@ -860,7 +860,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) Point aPoint( 0, 0 ); tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn1Rect.IsInside( rMousePos ) ) @@ -871,7 +871,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) meScrollType = ScrollType::LineUp; } } - else if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + else if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn2Rect.IsInside( rMousePos ) ) @@ -884,7 +884,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) } else { - bool bThumbHit = HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert, + bool bThumbHit = GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rMousePos, bIsInside ) ? bIsInside : maThumbRect.IsInside( rMousePos ); @@ -929,14 +929,14 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) Invalidate(); } } - else if(bPage && (!HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea, + else if(bPage && (!GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea, aControlRegion, rMousePos, bIsInside ) || bIsInside) ) { nTrackFlags = StartTrackingFlags::ButtonRepeat; // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) @@ -1016,13 +1016,13 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rTEvt coordinates are in twips. - Push(PushFlags::MAPMODE); + GetOutDev()->Push(PushFlags::MAPMODE); EnableMapMode(); MapMode aMapMode = GetMapMode(); aMapMode.SetOrigin(Point(0, 0)); SetMapMode(aMapMode); aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel()); - Pop(); + GetOutDev()->Pop(); } const Point rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); @@ -1129,7 +1129,7 @@ void ScrollBar::ImplInvert() aRect.AdjustBottom( -2 ); } - Invert( aRect ); + GetOutDev()->Invert( aRect ); } void ScrollBar::GetFocus() @@ -1217,30 +1217,30 @@ tools::Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) Point aPoint( 0, 0 ); tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); - if( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rPt, bIsInside )? bIsInside: maBtn1Rect.IsInside( rPt ) ) return &maBtn1Rect; - else if( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rPt, bIsInside )? bIsInside: maBtn2Rect.IsInside( rPt ) ) return &maBtn2Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rPt, bIsInside)? bIsInside: maPage1Rect.IsInside( rPt ) ) return &maPage1Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower, maPage2Rect, rPt, bIsInside)? bIsInside: maPage2Rect.IsInside( rPt ) ) return &maPage2Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rPt, bIsInside)? bIsInside: maThumbRect.IsInside( rPt ) ) @@ -1263,7 +1263,7 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); if( pRect != pLastRect || pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() ) { - vcl::Region aRgn( GetActiveClipRegion() ); + vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() ); vcl::Region aClipRegion; if ( pRect ) @@ -1278,10 +1278,10 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) aClipRegion.Union( maBtn2Rect ); } - SetClipRegion( aClipRegion ); + GetOutDev()->SetClipRegion( aClipRegion ); Invalidate(aClipRegion.GetBoundRect()); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } } } diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index 90e2676eda52..4e0689ecbfe1 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -443,18 +443,18 @@ bool SpinButton::PreNotify( NotifyEvent& rNEvt ) tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); if (pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow())) { - vcl::Region aRgn(GetActiveClipRegion()); + vcl::Region aRgn(GetOutDev()->GetActiveClipRegion()); if (pLastRect) { - SetClipRegion(vcl::Region(*pLastRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } if (pRect) { - SetClipRegion(vcl::Region(*pRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); - SetClipRegion(aRgn); + GetOutDev()->SetClipRegion(aRgn); } } } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index bc47d369d7ae..faeed4062e32 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -106,10 +106,10 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window con // convert from screen space to borderwin space aClipRect.SetPos(pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft()))); - oldRgn = pBorder->GetClipRegion(); - pBorder->SetClipRegion(vcl::Region(aClipRect)); + oldRgn = pBorder->GetOutDev()->GetClipRegion(); + pBorder->GetOutDev()->SetClipRegion(vcl::Region(aClipRect)); - pContext = pBorder; + pContext = pBorder->GetOutDev(); } tools::Rectangle aBound, aContent; @@ -132,7 +132,7 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window con ControlState::ENABLED, rSpinbuttonValue, OUString()); if (!pWin->SupportsDoubleBuffering()) - pBorder->SetClipRegion(oldRgn); + pBorder->GetOutDev()->SetClipRegion(oldRgn); } } return bNativeOK; @@ -313,7 +313,7 @@ void SpinField::ImplInit(vcl::Window* pParent, WinBits nWinStyle) // Some themes want external spin buttons, therefore the main // spinfield should not overdraw the border between its encapsulated // edit field and the spin buttons - if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*this, nWinStyle)) + if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*GetOutDev(), nWinStyle)) { SetBackground(); mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER)); @@ -641,7 +641,7 @@ void SpinField::ImplCalcButtonAreas(OutputDevice* pDev, const Size& rOutSz, tool ! (GetStyle() & WB_DROPDOWN) && IsNativeControlSupported(ControlType::Spinbox, ControlPart::Entire)) { - vcl::Window *pWin = static_cast<vcl::Window*>(pDev); + vcl::Window *pWin = pDev->GetOwnerWindow(); vcl::Window *pBorder = pWin->GetWindow( GetWindowType::Border ); // get the system's spin button size @@ -698,7 +698,7 @@ void SpinField::Resize() if (GetStyle() & (WB_SPIN | WB_DROPDOWN)) { - ImplCalcButtonAreas( this, aSize, maDropDownRect, maUpperRect, maLowerRect ); + ImplCalcButtonAreas( GetOutDev(), aSize, maDropDownRect, maUpperRect, maLowerRect ); ImplControlValue aControlValue; Point aPoint; @@ -854,18 +854,18 @@ bool SpinField::PreNotify(NotifyEvent& rNEvt) else { // paint directly - vcl::Region aRgn( GetActiveClipRegion() ); + vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() ); if (pLastRect) { - SetClipRegion(vcl::Region(*pLastRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } if (pRect) { - SetClipRegion(vcl::Region(*pRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } } } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 6ac2762f3022..14e2510d33d0 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -226,7 +226,7 @@ ImplTabItem* TabControl::ImplGetItem( sal_uInt16 nId ) const Size TabControl::ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth ) { pItem->maFormatText = pItem->maText; - Size aSize( GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() ); + Size aSize( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() ); Size aImageSize( 0, 0 ); if( !!pItem->maTabImage ) { @@ -267,7 +267,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth ) { if (pItem->maFormatText.getLength() > aAppendStr.getLength()) pItem->maFormatText = pItem->maFormatText.replaceAt( pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, "" ); - aSize.setWidth( GetCtrlTextWidth( pItem->maFormatText ) ); + aSize.setWidth( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText ) ); aSize.AdjustWidth(aImageSize.Width() ); aSize.AdjustWidth(TAB_TABOFFSET_X*2 ); } @@ -756,7 +756,7 @@ void TabControl::ImplShowFocus() Size aTabSize = aRect.GetSize(); Size aImageSize( 0, 0 ); tools::Long nTextHeight = GetTextHeight(); - tools::Long nTextWidth = GetCtrlTextWidth( rItem.maFormatText ); + tools::Long nTextWidth = GetOutDev()->GetCtrlTextWidth( rItem.maFormatText ); sal_uInt16 nOff; if ( !(GetSettings().GetStyleSettings().GetOptions() & StyleSettingsOptions::Mono) ) diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index aa4940e33eba..5c6926d09129 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1879,7 +1879,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, tools: if ( !IsFormatted() ) FormatDoc(); - vcl::Window* const pOutWin = dynamic_cast<vcl::Window*>(pOutDev); + vcl::Window* const pOutWin = pOutDev ? pOutDev->GetOwnerWindow() : nullptr; const bool bTransparent = (pOutWin && pOutWin->IsPaintTransparent()); tools::Long nY = rStartPos.Y(); diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index aef67e174cfb..fb5e1cb6aa9f 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -174,7 +174,7 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) : pWindow->SetCursor( mpImpl->mpCursor.get() ); pWindow->SetInputContext( InputContext( pEng->GetFont(), InputContextFlags::Text|InputContextFlags::ExtText ) ); - pWindow->SetLineColor(); + pWindow->GetOutDev()->SetLineColor(); if ( pWindow->GetDragGestureRecognizer().is() ) { diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 7e90c4b59de3..18fad279898b 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -972,7 +972,7 @@ void VclMultiLineEdit::ImplInitSettings(bool bBackground) vcl::Font aFont = rStyleSettings.GetFieldFont(); aFont.SetTransparent(IsPaintTransparent()); - ApplyControlFont(*this, aFont); + ApplyControlFont(*GetOutDev(), aFont); vcl::Font TheFont = GetFont(); TheFont.SetColor(aTextColor); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index a31f8e768ece..fd7e13bc30df 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -374,7 +374,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) // flush output from time to time if( i++ > nSyncCount ) { - static_cast<vcl::Window*>( pOut )->Flush(); + pOut->Flush(); i = 0; } } @@ -392,7 +392,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S Size rDestSize( pOut->LogicToPixel( rLogicDestSize ) ); - const vcl::Window* win = dynamic_cast <vcl::Window*> ( pOut ); + const vcl::Window* win = pOut ? pOut->GetOwnerWindow() : nullptr; if (!win) win = Application::GetActiveTopWindow(); @@ -404,7 +404,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S try { - uno::Reference<rendering::XCanvas> xCanvas = win->GetCanvas (); + uno::Reference<rendering::XCanvas> xCanvas = win->GetOutDev()->GetCanvas (); if (!xCanvas.is()) return false; diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index 0091f6878182..b7329c073ef1 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -145,7 +145,7 @@ void ImplAnimView::drawToPos( sal_uLong nPos ) vcl::PaintBufferGuardPtr pGuard; if (mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { - vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); + vcl::Window* pWindow = static_cast<vcl::WindowOutputDevice*>(mpRenderContext.get())->GetOwnerWindow(); pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } @@ -177,7 +177,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) vcl::PaintBufferGuardPtr pGuard; if (!pVDev && mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { - vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); + vcl::Window* pWindow = static_cast<vcl::WindowOutputDevice*>(mpRenderContext.get())->GetOwnerWindow(); pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 35d7088fee7e..f6b7d443b307 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -137,7 +137,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, ImplSVData* pSVData = ImplGetSVData(); if ( !pOutDev ) - pOutDev = ImplGetDefaultWindow(); + pOutDev = ImplGetDefaultWindow()->GetOutDev(); if( !pOutDev ) return; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index a7047fa8d93a..b6c7fcff82e3 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -514,9 +514,9 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists) vcl::Window * pFrame = pSVData->maFrameData.mpFirstFrame; if ( pFrame ) { - if ( pFrame->AcquireGraphics() ) + if ( pFrame->GetOutDev()->AcquireGraphics() ) { - OutputDevice *pDevice = pFrame; + OutputDevice *pDevice = pFrame->GetOutDev(); pDevice->mpGraphics->ClearDevFontCache(); pDevice->mpGraphics->GetDevFontList(pFrame->mpWindowImpl->mpFrameData->mxFontCollection.get()); } @@ -542,12 +542,12 @@ void OutputDevice::ImplUpdateFontDataForAllFrames( const FontUpdateHandler_t pHd vcl::Window* pFrame = pSVData->maFrameData.mpFirstFrame; while ( pFrame ) { - ( pFrame->*pHdl )( bNewFontLists ); + ( pFrame->GetOutDev()->*pHdl )( bNewFontLists ); vcl::Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap; while ( pSysWin ) { - ( pSysWin->*pHdl )( bNewFontLists ); + ( pSysWin->GetOutDev()->*pHdl )( bNewFontLists ); pSysWin = pSysWin->mpWindowImpl->mpNextOverlap; } diff --git a/vcl/source/toolkit/group.cxx b/vcl/source/toolkit/group.cxx index 29d11b8eadc1..040befebbdfb 100644 --- a/vcl/source/toolkit/group.cxx +++ b/vcl/source/toolkit/group.cxx @@ -170,7 +170,7 @@ void GroupBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, void GroupBox::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - const_cast<GroupBox*>(this)->ImplDraw( const_cast<GroupBox*>(this), DrawFlags::NONE, Point(), GetOutputSizePixel(), true ); + const_cast<GroupBox*>(this)->ImplDraw( const_cast<GroupBox*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true ); } void GroupBox::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx index 882015e02a84..91cb86cc73ca 100644 --- a/vcl/source/treelist/headbar.cxx +++ b/vcl/source/treelist/headbar.cxx @@ -130,16 +130,16 @@ void HeaderBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (bFont) - ApplyControlFont(*this, rStyleSettings.GetToolFont()); + ApplyControlFont(*GetOutDev(), rStyleSettings.GetToolFont()); if (bForeground || bFont) { - ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); + ApplyControlForeground(*GetOutDev(), rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } if (bBackground) - ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); + ApplyControlBackground(*GetOutDev(), rStyleSettings.GetFaceColor()); } tools::Long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const @@ -239,30 +239,30 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) aEndPos.setX( aRect2.Left()+6 ); } - SetRasterOp( RasterOp::Invert ); - DrawRect( aStartRect ); - DrawLine( aStartPos, aEndPos ); + GetOutDev()->SetRasterOp( RasterOp::Invert ); + GetOutDev()->DrawRect( aStartRect ); + GetOutDev()->DrawLine( aStartPos, aEndPos ); if ( nEndPos > nStartPos ) { - DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ), Point( aEndPos.X()+1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ), Point( aEndPos.X()+2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ), Point( aEndPos.X()+3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) ); + GetOutDev()->DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) ); } else { - DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ), Point( aEndPos.X()-1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ), Point( aEndPos.X()-2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ), Point( aEndPos.X()-3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) ); + GetOutDev()->DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) ); } - SetRasterOp( RasterOp::OverPaint ); + GetOutDev()->SetRasterOp( RasterOp::OverPaint ); } void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 7397305e0aba..60b8a5962e42 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -259,7 +259,7 @@ void SvImpLBox::Clear() m_pView->Control::SetMapMode( aMapMode ); m_aHorSBar->SetRange( aRange ); m_aHorSBar->SetSizePixel(Size(m_aOutputSize.Width(),m_nHorSBarHeight)); - m_pView->SetClipRegion(); + m_pView->GetOutDev()->SetClipRegion(); if( GetUpdateMode() ) m_pView->Invalidate( GetVisibleArea() ); m_nFlags |= LBoxFlags::Filling; @@ -563,11 +563,11 @@ void SvImpLBox::RecalcFocusRect() m_pView->HideFocus(); tools::Long nY = GetEntryLine( m_pCursor ); tools::Rectangle aRect = m_pView->GetFocusRect( m_pCursor, nY ); - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->ShowFocus( aRect ); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } } @@ -646,21 +646,21 @@ void SvImpLBox::ShowCursor( bool bShow ) { if( !bShow || !m_pCursor || !m_pView->HasFocus() ) { - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->HideFocus(); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } else { tools::Long nY = GetEntryLine( m_pCursor ); tools::Rectangle aRect = m_pView->GetFocusRect( m_pCursor, nY ); - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->ShowFocus( aRect ); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } } @@ -2803,7 +2803,7 @@ void SvImpLBox::PaintDDCursor(SvTreeListEntry* pEntry, bool bShow) pViewData->SetDragTarget(bShow); #ifdef MACOSX // in MacOS we need to draw directly (as we are synchronous) or no invalidation happens - m_pView->PaintEntry1(*pEntry, GetEntryLine(pEntry), *m_pView); + m_pView->PaintEntry1(*pEntry, GetEntryLine(pEntry), *m_pView->GetOutDev()); #else InvalidateEntry(pEntry); #endif @@ -2842,7 +2842,7 @@ tools::Rectangle SvImpLBox::GetVisibleArea() const void SvImpLBox::Invalidate() { - m_pView->SetClipRegion(); + m_pView->GetOutDev()->SetClipRegion(); } void SvImpLBox::SetCurEntry( SvTreeListEntry* pEntry ) diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx index aaf9124765aa..0736ee65109c 100644 --- a/vcl/source/treelist/svlbitm.cxx +++ b/vcl/source/treelist/svlbitm.cxx @@ -292,7 +292,7 @@ void SvLBoxString::InitViewData( if (mbEmphasized) { - pView->Push(); + pView->GetOutDev()->Push(); vcl::Font aFont( pView->GetFont()); aFont.SetWeight(WEIGHT_BOLD); pView->Control::SetFont( aFont ); @@ -300,7 +300,7 @@ void SvLBoxString::InitViewData( if (mbCustom) { - Size aSize = pView->MeasureCustomEntry(*pView, *pEntry); + Size aSize = pView->MeasureCustomEntry(*pView->GetOutDev(), *pEntry); pViewData->mnWidth = aSize.Width(); pViewData->mnHeight = aSize.Height(); } @@ -311,7 +311,7 @@ void SvLBoxString::InitViewData( } if (mbEmphasized) - pView->Pop(); + pView->GetOutDev()->Pop(); } int SvLBoxString::CalcWidth(const SvTreeListBox* pView) const @@ -443,7 +443,7 @@ void SvLBoxButton::InitViewData(SvTreeListBox* pView,SvTreeListEntry* pEntry, Sv ControlType eCtrlType = (pData->IsRadio())? ControlType::Radiobutton : ControlType::Checkbox; if ( pView ) - ImplAdjustBoxSize(aSize, eCtrlType, *pView); + ImplAdjustBoxSize(aSize, eCtrlType, *pView->GetOutDev()); pViewData->mnWidth = aSize.Width(); pViewData->mnHeight = aSize.Height(); } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index e653edf73b04..5ebe086708ac 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -1053,7 +1053,7 @@ void SvHeaderTabListBox::GrabTableFocus() bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) { - return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); + return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); } tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 1fc5feaf21fc..f2357b890fe2 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1275,7 +1275,7 @@ void SvTreeListBox::InitTreeView() AdjustEntryHeightAndRecalc(); SetSpaceBetweenEntries( 0 ); - SetLineColor(); + GetOutDev()->SetLineColor(); InitSettings(); ImplInitStyle(); SetTabs(); @@ -3432,7 +3432,7 @@ void SvTreeListBox::StateChanged( StateChangedType eType ) void SvTreeListBox::ApplySettings(vcl::RenderContext& rRenderContext) { - SetPointFont(rRenderContext, GetPointFont(*this)); + SetPointFont(rRenderContext, GetPointFont(*GetOutDev())); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); @@ -3448,7 +3448,7 @@ void SvTreeListBox::InitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont = rStyleSettings.GetFieldFont(); - SetPointFont(*this, aFont); + SetPointFont(*GetOutDev(), aFont); AdjustEntryHeightAndRecalc(); SetTextColor(rStyleSettings.GetFieldTextColor()); diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 36af49a38afe..7b713cf8d043 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1757,8 +1757,8 @@ void DrawingAreaUIObject::execute(const OUString& rAction, const StringMap& rPar double fPosX = std::atof(sPosX2.getStr()); double fPosY = std::atof(sPoxY2.getStr()); - fPosX = fPosX * mxDrawingArea->GetOutputWidthPixel(); - fPosY = fPosY * mxDrawingArea->GetOutputHeightPixel(); + fPosX = fPosX * mxDrawingArea->GetOutDev()->GetOutputWidthPixel(); + fPosY = fPosY * mxDrawingArea->GetOutDev()->GetOutputHeightPixel(); MouseEvent aEvent(Point(fPosX, fPosY), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0); mxDrawingArea->MouseButtonDown(aEvent); diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 4e3768286554..ad432c33cfb4 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -437,7 +437,7 @@ OUString Window::getDefaultAccessibleName() const break; } - return GetNonMnemonicString( aAccessibleName ); + return OutputDevice::GetNonMnemonicString( aAccessibleName ); } void Window::SetAccessibleDescription( const OUString& rDescription ) diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index ec1e95c9db46..e343a7bd4ae1 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -155,13 +155,13 @@ void ImplBorderWindowView::ImplInitTitle(ImplBorderFrameData* pData) { if (pData->mnTitleType == BorderWindowTitleType::Small) { - pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetFloatTitleFont() ); + pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetFloatTitleFont() ); pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight(); } else // pData->mnTitleType == BorderWindowTitleType::Normal { // FIXME RenderContext - pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetTitleFont()); + pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetTitleFont()); pData->mnTitleHeight = rStyleSettings.GetTitleHeight(); } tools::Long nTextHeight = pBorderWindow->GetTextHeight(); @@ -398,10 +398,8 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, tools::Long nWidth, to mnHeight = nHeight; mbNWFBorder = false; - vcl::Window *pWin = nullptr, *pCtrl = nullptr; - if (mpOutDev->GetOutDevType() == OUTDEV_WINDOW) - pWin = static_cast<vcl::Window*>(mpOutDev.get()); - + vcl::Window *pWin = mpOutDev->GetOwnerWindow(); + vcl::Window *pCtrl = nullptr; if (pWin) pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client); @@ -705,7 +703,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c { Edit* pEdit = static_cast<Edit*>(pCtrl)->GetSubEdit(); if (pEdit && !pEdit->SupportsDoubleBuffering()) - pCtrl->Paint(*pCtrl, tools::Rectangle()); // make sure the buttons are also drawn as they might overwrite the border + pCtrl->Paint(*pCtrl->GetOutDev(), tools::Rectangle()); // make sure the buttons are also drawn as they might overwrite the border } } @@ -1735,7 +1733,7 @@ void ImplBorderWindow::Resize() PosSizeFlags::Width | PosSizeFlags::Height ); // UpdateView - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); Window::Resize(); @@ -1783,7 +1781,7 @@ void ImplBorderWindow::InitView() else mpBorderView.reset(new ImplStdBorderWindowView( this )); Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); } void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize ) @@ -1806,7 +1804,7 @@ void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize ) mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); aSize.AdjustWidth(nLeftBorder+nRightBorder ); aSize.AdjustHeight(nTopBorder+nBottomBorder ); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); } vcl::Window* pClientWindow = ImplGetClientWindow(); @@ -1887,7 +1885,7 @@ void ImplBorderWindow::SetCloseButton() { SetStyle( GetStyle() | WB_CLOSEABLE ); Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1895,7 +1893,7 @@ void ImplBorderWindow::SetDockButton( bool bDockButton ) { mbDockBtn = bDockButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1903,7 +1901,7 @@ void ImplBorderWindow::SetHideButton( bool bHideButton ) { mbHideBtn = bHideButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1911,7 +1909,7 @@ void ImplBorderWindow::SetMenuButton( bool bMenuButton ) { mbMenuBtn = bMenuButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } diff --git a/vcl/source/window/bubblewindow.cxx b/vcl/source/window/bubblewindow.cxx index a1b97c3d49c3..f4e491242c52 100644 --- a/vcl/source/window/bubblewindow.cxx +++ b/vcl/source/window/bubblewindow.cxx @@ -87,26 +87,26 @@ void BubbleWindow::SetTitleAndText( const OUString& rTitle, Resize(); } -void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /*rRect*/) +void BubbleWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { LineInfo aThickLine( LineStyle::Solid, 2 ); - DrawPolyLine( maRectPoly, aThickLine ); - DrawPolyLine( maTriPoly ); + rRenderContext.DrawPolyLine( maRectPoly, aThickLine ); + rRenderContext.DrawPolyLine( maTriPoly ); - Color aOldLine = GetLineColor(); + Color aOldLine = rRenderContext.GetLineColor(); Size aSize = GetSizePixel(); tools::Long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); - DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), + rRenderContext.SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); + rRenderContext.DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), Point( nTipOffset + TIP_WIDTH -1 , TIP_HEIGHT ), aThickLine ); - SetLineColor( aOldLine ); + rRenderContext.SetLineColor( aOldLine ); Size aImgSize = maBubbleImage.GetSizePixel(); - DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); + rRenderContext.DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); vcl::Font aOldFont = GetFont(); vcl::Font aBoldFont = aOldFont; @@ -115,12 +115,12 @@ void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Re SetFont( aBoldFont ); tools::Rectangle aTitleRect = maTitleRect; aTitleRect.Move( aImgSize.Width(), 0 ); - DrawText( aTitleRect, maBubbleTitle, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); + rRenderContext.DrawText( aTitleRect, maBubbleTitle, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); SetFont( aOldFont ); tools::Rectangle aTextRect = maTextRect; aTextRect.Move( aImgSize.Width(), 0 ); - DrawText( aTextRect, maBubbleText, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); + rRenderContext.DrawText( aTextRect, maBubbleText, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); } void BubbleWindow::MouseButtonDown( const MouseEvent& ) diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index b5c262df2c1a..f55283cff886 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -27,7 +27,7 @@ namespace vcl { -vcl::Region Window::GetOutputBoundsClipRegion() const +vcl::Region WindowOutputDevice::GetOutputBoundsClipRegion() const { vcl::Region aClip(GetClipRegion()); aClip.Intersect(tools::Rectangle(Point(), GetOutputSize())); @@ -35,17 +35,17 @@ vcl::Region Window::GetOutputBoundsClipRegion() const return aClip; } -void Window::InitClipRegion() +void WindowOutputDevice::InitClipRegion() { DBG_TESTSOLARMUTEX(); vcl::Region aRegion; - if ( mpWindowImpl->mbInPaint ) - aRegion = *(mpWindowImpl->mpPaintRegion); + if ( mxOwnerWindow->mpWindowImpl->mbInPaint ) + aRegion = *(mxOwnerWindow->mpWindowImpl->mpPaintRegion); else { - aRegion = ImplGetWinChildClipRegion(); + aRegion = mxOwnerWindow->ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! if( ImplIsAntiparallel() ) @@ -94,11 +94,11 @@ void Window::ExpandPaintClipRegion( const vcl::Region& rRegion ) return; vcl::Region aPixRegion = LogicToPixel( rRegion ); - vcl::Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion ); + vcl::Region aDevPixRegion = GetOutDev()->ImplPixelToDevicePixel( aPixRegion ); vcl::Region aWinChildRegion = ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aWinChildRegion ); @@ -108,7 +108,7 @@ void Window::ExpandPaintClipRegion( const vcl::Region& rRegion ) if( ! aDevPixRegion.IsEmpty() ) { mpWindowImpl->mpPaintRegion->Union( aDevPixRegion ); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; } } @@ -125,19 +125,19 @@ vcl::Region Window::GetWindowClipRegionPixel() const if ( aWinRegion == aWinClipRegion ) aWinClipRegion.SetNull(); - aWinClipRegion.Move( -mnOutOffX, -mnOutOffY ); + aWinClipRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); return aWinClipRegion; } -vcl::Region Window::GetActiveClipRegion() const +vcl::Region WindowOutputDevice::GetActiveClipRegion() const { vcl::Region aRegion(true); - if ( mpWindowImpl->mbInPaint ) + if ( mxOwnerWindow->mpWindowImpl->mbInPaint ) { - aRegion = *(mpWindowImpl->mpPaintRegion); + aRegion = *(mxOwnerWindow->mpWindowImpl->mpPaintRegion); aRegion.Move( -mnOutOffX, -mnOutOffY ); } @@ -147,9 +147,9 @@ vcl::Region Window::GetActiveClipRegion() const return PixelToLogic( aRegion ); } -void Window::ClipToPaintRegion(tools::Rectangle& rDstRect) +void WindowOutputDevice::ClipToPaintRegion(tools::Rectangle& rDstRect) { - const vcl::Region aPaintRgn(GetPaintRegion()); + const vcl::Region aPaintRgn(mxOwnerWindow->GetPaintRegion()); if (!aPaintRgn.IsNull()) rDstRect.Intersection(LogicToPixel(aPaintRgn.GetBoundRect())); @@ -251,7 +251,7 @@ void Window::ImplInitWinClipRegion() // Build Window Region mpWindowImpl->maWinClipRegion = GetOutputRectPixel(); if ( mpWindowImpl->mbWinRegion ) - mpWindowImpl->maWinClipRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + mpWindowImpl->maWinClipRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); // ClipSiblings if ( mpWindowImpl->mbClipSiblings && !ImplIsOverlapWindow() ) @@ -325,7 +325,7 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) mpWindowImpl->mpSysObj->ResetClipRegion(); else { - aRegion.Move( -mnOutOffX, -mnOutOffY ); + aRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); // set/update clip region RectangleVector aRectangles; @@ -410,7 +410,7 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion ) pOldRegion.reset(new vcl::Region( mpWindowImpl->maWinClipRegion )); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; vcl::Window* pWindow = mpWindowImpl->mpFirstChild; @@ -423,14 +423,14 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) if ( !ImplSysObjClip( pOldRegion.get() ) ) { - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; bUpdate = false; } } else { - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; vcl::Window* pWindow = mpWindowImpl->mpFirstChild; @@ -469,7 +469,7 @@ bool Window::ImplSetClipFlag( bool bSysObjOnlySmaller ) if ( pParent && ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mpWindowImpl->mnParentClipMode & ParentClipMode::Clip)) ) { - pParent->mbInitClipRegion = true; + pParent->GetOutDev()->mbInitClipRegion = true; pParent->mpWindowImpl->mbInitChildRegion = true; } @@ -503,7 +503,7 @@ void Window::ImplIntersectWindowRegion( vcl::Region& rRegion ) { rRegion.Intersect( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) - rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + rRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); } void Window::ImplExcludeWindowRegion( vcl::Region& rRegion ) @@ -511,7 +511,7 @@ void Window::ImplExcludeWindowRegion( vcl::Region& rRegion ) if ( mpWindowImpl->mbWinRegion ) { vcl::Region aRegion( GetOutputRectPixel() ); - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); rRegion.Exclude( aRegion ); } else @@ -603,7 +603,7 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re { vcl::Region aRegion( rSourceRect ); if ( mpWindowImpl->mbWinRegion ) - rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + rRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); vcl::Region aTempRegion; vcl::Window* pWindow; @@ -665,15 +665,15 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re } } -void Window::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size&) const +void WindowOutputDevice::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size&) const { MapMode aTempMap(GetMapMode()); aTempMap.SetOrigin(Point()); rSaveDevice.SetMapMode(aTempMap); - if ( mpWindowImpl->mpPaintRegion ) + if ( mxOwnerWindow->mpWindowImpl->mpPaintRegion ) { - vcl::Region aClip( *mpWindowImpl->mpPaintRegion ); + vcl::Region aClip( *mxOwnerWindow->mpWindowImpl->mpPaintRegion ); const Point aPixPos( LogicToPixel( rPos ) ); aClip.Move( -mnOutOffX, -mnOutOffY ); diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index d7f2b56aab28..90ac32298784 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -123,7 +123,7 @@ static void ImplCursorInvert(vcl::Window* pWindow, ImplCursorData const * pData) if (bDoubleBuffering) pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); - vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow; + vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow->GetOutDev(); tools::Rectangle aPaintRect = ImplCursorInvert(pRenderContext, pData); if (bDoubleBuffering) @@ -155,7 +155,7 @@ void vcl::Cursor::ImplDraw() if (mpData && mpData->mpWindow) { // calculate output area - if (ImplPrepForDraw(mpData->mpWindow, *mpData)) + if (ImplPrepForDraw(mpData->mpWindow->GetOutDev(), *mpData)) { // display ImplCursorInvert(mpData->mpWindow, mpData.get()); diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 20529e4a1aa6..b43b13788f09 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -566,7 +566,7 @@ void ImplDrawButton( OutputDevice *const pDev, tools::Rectangle aFillRect, void ImplDrawFrame( OutputDevice *const pDev, tools::Rectangle& rRect, const StyleSettings& rStyleSettings, DrawFrameStyle nStyle, DrawFrameFlags nFlags ) { - vcl::Window *const pWin = (pDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(pDev) : nullptr; + vcl::Window * pWin = pDev->GetOwnerWindow(); const bool bMenuStyle(nFlags & DrawFrameFlags::Menu); @@ -610,7 +610,7 @@ void ImplDrawFrame( OutputDevice *const pDev, tools::Rectangle& rRect, // if bNoDraw is true then don't call the drawing routine // but just update the target rectangle if( bNoDraw || - pWin->DrawNativeControl( ControlType::Frame, ControlPart::Border, aBound, ControlState::ENABLED, + pWin->GetOutDev()->DrawNativeControl( ControlType::Frame, ControlPart::Border, aBound, ControlState::ENABLED, aControlValue, OUString()) ) { rRect = aContent; @@ -998,14 +998,14 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo { Point aStart( rStart ), aStop( rStop ); const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings(); - vcl::Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(mpOutDev.get()) : nullptr; + vcl::Window *const pWin = mpOutDev->GetOwnerWindow(); if(pWin) { ControlPart nPart = ( bVertical ? ControlPart::SeparatorVert : ControlPart::SeparatorHorz ); bool nativeSupported = pWin->IsNativeControlSupported( ControlType::Fixedline, nPart ); ImplControlValue aValue; tools::Rectangle aRect(rStart,rStop); - if(nativeSupported && pWin->DrawNativeControl(ControlType::Fixedline,nPart,aRect,ControlState::NONE,aValue,OUString())) + if(nativeSupported && pWin->GetOutDev()->DrawNativeControl(ControlType::Fixedline,nPart,aRect,ControlState::NONE,aValue,OUString())) return; } diff --git a/vcl/source/window/dndeventdispatcher.cxx b/vcl/source/window/dndeventdispatcher.cxx index 47adfcf87d5a..0afa4501eb71 100644 --- a/vcl/source/window/dndeventdispatcher.cxx +++ b/vcl/source/window/dndeventdispatcher.cxx @@ -58,7 +58,7 @@ vcl::Window* DNDEventDispatcher::findTopLevelWindow(Point location) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplIsAntiparallel() ) + if( pChildWindow->GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pChildWinOutDev = pChildWindow->GetOutDev(); pChildWinOutDev->ReMirror( location ); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index a7abd42b168b..a03e2146d944 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -80,7 +80,7 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits, // copy state of DockingWindow if ( pDockingWin ) { - SetSettings( pDockingWin->GetWindow()->GetSettings() ); + GetOutDev()->SetSettings( pDockingWin->GetWindow()->GetSettings() ); Enable( pDockingWin->GetWindow()->IsEnabled(), false ); EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), false ); AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), false ); diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 3b622cf1cd73..68b0ccb9916a 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -92,7 +92,7 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits, // copy settings of DockingWindow if ( pDockingWin ) { - SetSettings( pDockingWin->GetSettings() ); + GetOutDev()->SetSettings( pDockingWin->GetSettings() ); Enable( pDockingWin->IsEnabled(), false ); EnableInput( pDockingWin->IsInputEnabled(), false ); AlwaysEnableInput( pDockingWin->IsAlwaysEnableInput(), false ); diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 2a831a0ec995..4a01c3823110 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -340,10 +340,6 @@ ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCalle pSVEvent->mbCall = true; if (bReferenceLink) { - // Double check that this is indeed a vcl::Window instance. - assert(dynamic_cast<vcl::Window *>( - static_cast<OutputDevice *>(rLink.GetInstance())) == - static_cast<vcl::Window *>(rLink.GetInstance())); pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance()); } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 1bc1b2a9a3cd..0b333f87df76 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -485,7 +485,7 @@ Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& const OutputDevice *pWindowOutDev = pReference->GetOutDev(); // compare coordinates in absolute screen coordinates - if( pReference->HasMirroredGraphics() ) + if( pWindowOutDev->HasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) pWindowOutDev->ReMirror( aAbsolute ); @@ -509,7 +509,7 @@ tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co // compare coordinates in absolute screen coordinates // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 - if( pReference->HasMirroredGraphics() ) + if( pParentWinOutDev->HasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) pParentWinOutDev->ReMirror(aFloatRect); @@ -531,7 +531,7 @@ tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, co // compare coordinates in absolute screen coordinates // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 - if( pReference->HasMirroredGraphics() ) + if( pParentWinOutDev->HasMirroredGraphics() ) { aFloatRect = pReference->ImplUnmirroredAbsoluteScreenToOutputPixel(aFloatRect); aFloatRect.SetPos(pReference->OutputToScreenPixel(aFloatRect.TopLeft())); diff --git a/vcl/source/window/globalization.cxx b/vcl/source/window/globalization.cxx index d5ae5c5747ad..9521829785cf 100644 --- a/vcl/source/window/globalization.cxx +++ b/vcl/source/window/globalization.cxx @@ -19,13 +19,24 @@ #include <vcl/window.hxx> #include <vcl/outdev.hxx> +#include <windowdev.hxx> +#include <window.h> namespace vcl { -void Window::EnableRTL ( bool bEnable ) +void WindowOutputDevice::EnableRTL ( bool bEnable ) { - CompatStateChanged( StateChangedType::Mirroring ); - OutputDevice::EnableRTL(bEnable); + if (mbEnableRTL != bEnable) + mxOwnerWindow->ImplEnableRTL(bEnable); +} + +void Window::ImplEnableRTL( bool bEnable ) +{ + if (mpWindowImpl->mxOutDev->mbEnableRTL != bEnable) + { + CompatStateChanged( StateChangedType::Mirroring ); + mpWindowImpl->mxOutDev->OutputDevice::EnableRTL(bEnable); + } } } /* namespace vcl */ diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 79a843e5d30d..2a76145e9247 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1812,7 +1812,7 @@ VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent) StyleSettings aStyle = aAllSettings.GetStyleSettings(); aStyle.SetMonoColor(aStyle.GetShadowColor()); aAllSettings.SetStyleSettings(aStyle); - SetSettings(aAllSettings); + GetOutDev()->SetSettings(aAllSettings); Link<ScrollBar*,void> aLink( LINK( this, VclScrolledWindow, ScrollBarHdl ) ); m_pVScroll->SetScrollHdl(aLink); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 8f4019dd9d52..531e2ccae77f 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1446,7 +1446,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) tools::Long nMinMenuItemHeight = nFontHeight; tools::Long nCheckHeight = 0, nRadioHeight = 0; - Size aMaxSize = ImplGetNativeCheckAndRadioSize(*pWin, nCheckHeight, nRadioHeight); // FIXME + Size aMaxSize = ImplGetNativeCheckAndRadioSize(*pWin->GetOutDev(), nCheckHeight, nRadioHeight); // FIXME if( aMaxSize.Height() > nMinMenuItemHeight ) nMinMenuItemHeight = aMaxSize.Height(); @@ -1524,8 +1524,8 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // Text: if ( (pData->eType == MenuItemType::STRING) || (pData->eType == MenuItemType::STRINGIMAGE) ) { - const SalLayoutGlyphs* pGlyphs = pData->GetTextGlyphs(pWin); - tools::Long nTextWidth = pWin->GetCtrlTextWidth(pData->aText, pGlyphs); + const SalLayoutGlyphs* pGlyphs = pData->GetTextGlyphs(pWin->GetOutDev()); + tools::Long nTextWidth = pWin->GetOutDev()->GetCtrlTextWidth(pData->aText, pGlyphs); tools::Long nTextHeight = pWin->GetTextHeight(); if (IsMenuBar()) @@ -1575,21 +1575,21 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) nTitleHeight = 0; if (!IsMenuBar() && aTitleText.getLength() > 0) { // Set expected font - pWin->Push(PushFlags::FONT); + pWin->GetOutDev()->Push(PushFlags::FONT); vcl::Font aFont = pWin->GetFont(); aFont.SetWeight(WEIGHT_BOLD); pWin->SetFont(aFont); // Compute text bounding box tools::Rectangle aTextBoundRect; - pWin->GetTextBoundRect(aTextBoundRect, aTitleText); + pWin->GetOutDev()->GetTextBoundRect(aTextBoundRect, aTitleText); // Vertically, one height of char + extra space for decoration nTitleHeight = aTextBoundRect.GetSize().Height() + 4 * SPACE_AROUND_TITLE ; aSz.AdjustHeight(nTitleHeight ); tools::Long nWidth = aTextBoundRect.GetSize().Width() + 4 * SPACE_AROUND_TITLE; - pWin->Pop(); + pWin->GetOutDev()->Pop(); if ( nWidth > nMaxWidth ) nMaxWidth = nWidth; } @@ -2247,12 +2247,12 @@ void Menu::ImplFillLayoutData() const mpLayoutData.reset(new MenuLayoutData); if (IsMenuBar()) { - ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME + ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME } else { MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get()); - ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), + ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), nullptr, false, true); //FIXME } } @@ -2725,7 +2725,7 @@ int MenuBar::GetMenuBarHeight() const else { vcl::Window* pMenubarWin = GetWindow(); - nMenubarHeight = pMenubarWin ? pMenubarWin->GetOutputHeightPixel() : 0; + nMenubarHeight = pMenubarWin ? pMenubarWin->GetOutDev()->GetOutputHeightPixel() : 0; } return nMenubarHeight; } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index b3c78549dd49..1f945e0a95c3 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -1015,7 +1015,7 @@ void MenuBarWindow::StateChanged( StateChangedType nType ) if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if (nType == StateChangedType::Enable) @@ -1033,7 +1033,7 @@ void MenuBarWindow::LayoutChanged() if (!m_pMenu) return; - ApplySettings(*this); + ApplySettings(*GetOutDev()); // if the font was changed. tools::Long nHeight = m_pMenu->ImplCalcSize(this).Height(); @@ -1107,7 +1107,7 @@ void MenuBarWindow::ImplInitStyleSettings() aStyle.SetMenuHighlightTextColor(aHighlightTextColor); } aSettings.SetStyleSettings(aStyle); - OutputDevice::SetSettings(aSettings); + GetOutDev()->SetSettings(aSettings); } void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -1119,7 +1119,7 @@ void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplInitStyleSettings(); LayoutChanged(); } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index dd1e2c6ea557..d4d59e90d5c2 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -46,7 +46,7 @@ MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, vcl::Window* pParent, WinBit { mpWindowImpl->mbMenuFloatingWindow= true; - ApplySettings(*this); + ApplySettings(*GetOutDev()); SetPopupModeEndHdl( LINK( this, MenuFloatingWindow, PopupEnd ) ); @@ -130,7 +130,7 @@ void MenuFloatingWindow::dispose() void MenuFloatingWindow::Resize() { - InitMenuClipRegion(*this); // FIXME + InitMenuClipRegion(*GetOutDev()); // FIXME } void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext) @@ -149,7 +149,7 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext) aStyle.SetMenuHighlightTextColor(aHighlightTextColor); } aSettings.SetStyleSettings(aStyle); - OutputDevice::SetSettings(aSettings); + GetOutDev()->SetSettings(aSettings); } const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); @@ -405,7 +405,7 @@ void MenuFloatingWindow::EnableScrollMenu( bool b ) bScrollMenu = b; nScrollerHeight = b ? static_cast<sal_uInt16>(GetSettings().GetStyleSettings().GetScrollBarSize()) /2 : 0; bScrollDown = true; - InitMenuClipRegion(*this); + InitMenuClipRegion(*GetOutDev()); } void MenuFloatingWindow::Start() @@ -1289,7 +1289,7 @@ void MenuFloatingWindow::StateChanged( StateChangedType nType ) if ( ( nType == StateChangedType::ControlForeground ) || ( nType == StateChangedType::ControlBackground ) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -1303,7 +1303,7 @@ void MenuFloatingWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx index fae4746a689e..a3412e0778b3 100644 --- a/vcl/source/window/menuwindow.cxx +++ b/vcl/source/window/menuwindow.cxx @@ -33,7 +33,7 @@ static sal_uLong ImplChangeTipTimeout( sal_uLong nTimeout, vcl::Window *pWindow sal_uLong nRet = aHelpSettings.GetTipTimeout(); aHelpSettings.SetTipTimeout( nTimeout ); aAllSettings.SetHelpSettings( aHelpSettings ); - pWindow->SetSettings( aAllSettings ); + pWindow->GetOutDev()->SetSettings( aAllSettings ); return nRet; } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 7a6afc56c79d..101a586b9b68 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -56,7 +56,7 @@ namespace vcl { WindowHitTest Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aFramePos ); @@ -66,8 +66,8 @@ WindowHitTest Window::ImplHitTest( const Point& rFramePos ) if ( mpWindowImpl->mbWinRegion ) { Point aTempPos = aFramePos; - aTempPos.AdjustX( -mnOutOffX ); - aTempPos.AdjustY( -mnOutOffY ); + aTempPos.AdjustX( -GetOutDev()->mnOutOffX ); + aTempPos.AdjustY( -GetOutDev()->mnOutOffY ); if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) ) return WindowHitTest::NONE; } @@ -144,8 +144,8 @@ void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged ) bool bLeave; // check for MouseLeave bLeave = ((nX < 0) || (nY < 0) || - (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || - (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && + (nX >= mpWindowImpl->mpFrameWindow->GetOutDev()->mnOutWidth) || + (nY >= mpWindowImpl->mpFrameWindow->GetOutDev()->mnOutHeight)) && !ImplGetSVData()->mpWinData->mpCaptureWin; nMode |= MouseEventModifiers::SYNTHETIC; if ( bModChanged ) @@ -528,9 +528,9 @@ void Window::SetPointerPosPixel( const Point& rPos ) pOutDev->ReMirror( aPos ); } // mirroring is required here, SetPointerPos bypasses SalGraphics - aPos.setX( mpGraphics->mirror2( aPos.X(), *this ) ); + aPos.setX( GetOutDev()->mpGraphics->mirror2( aPos.X(), *GetOutDev() ) ); } - else if( ImplIsAntiparallel() ) + else if( GetOutDev()->ImplIsAntiparallel() ) { pOutDev->ReMirror( aPos ); } @@ -550,7 +550,7 @@ Point Window::GetPointerPosPixel() { Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aPos ); @@ -562,7 +562,7 @@ Point Window::GetLastPointerPosPixel() { Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aPos ); @@ -591,7 +591,7 @@ Window::PointerState Window::GetPointerState() if (mpWindowImpl->mpFrame) { SalFrame::SalPointerState aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aSalPointerState.maPos ); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index f692bc64342f..d132b034dfe5 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -82,21 +82,22 @@ PaintBufferGuard::PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWind nFlags |= PushFlags::TEXTLAYOUTMODE; nFlags |= PushFlags::TEXTLANGUAGE; pFrameData->mpBuffer->Push(nFlags); - pFrameData->mpBuffer->SetClipRegion(pWindow->GetClipRegion()); - pFrameData->mpBuffer->SetFillColor(pWindow->GetFillColor()); + auto& rDev = *pWindow->GetOutDev(); + pFrameData->mpBuffer->SetClipRegion(rDev.GetClipRegion()); + pFrameData->mpBuffer->SetFillColor(rDev.GetFillColor()); pFrameData->mpBuffer->SetFont(pWindow->GetFont()); - pFrameData->mpBuffer->SetLineColor(pWindow->GetLineColor()); + pFrameData->mpBuffer->SetLineColor(rDev.GetLineColor()); pFrameData->mpBuffer->SetMapMode(pWindow->GetMapMode()); - pFrameData->mpBuffer->SetRefPoint(pWindow->GetRefPoint()); + pFrameData->mpBuffer->SetRefPoint(rDev.GetRefPoint()); pFrameData->mpBuffer->SetSettings(pWindow->GetSettings()); pFrameData->mpBuffer->SetTextColor(pWindow->GetTextColor()); pFrameData->mpBuffer->SetTextLineColor(pWindow->GetTextLineColor()); pFrameData->mpBuffer->SetOverlineColor(pWindow->GetOverlineColor()); pFrameData->mpBuffer->SetTextFillColor(pWindow->GetTextFillColor()); pFrameData->mpBuffer->SetTextAlign(pWindow->GetTextAlign()); - pFrameData->mpBuffer->SetRasterOp(pWindow->GetRasterOp()); - pFrameData->mpBuffer->SetLayoutMode(pWindow->GetLayoutMode()); - pFrameData->mpBuffer->SetDigitLanguage(pWindow->GetDigitLanguage()); + pFrameData->mpBuffer->SetRasterOp(rDev.GetRasterOp()); + pFrameData->mpBuffer->SetLayoutMode(rDev.GetLayoutMode()); + pFrameData->mpBuffer->SetDigitLanguage(rDev.GetDigitLanguage()); mnOutOffX = pFrameData->mpBuffer->GetOutOffXPixel(); mnOutOffY = pFrameData->mpBuffer->GetOutOffYPixel(); @@ -131,7 +132,7 @@ PaintBufferGuard::~PaintBufferGuard() COVERITY_NOEXCEPT_FALSE aPaintRectSize = m_pWindow->PixelToLogic(aRectanglePixel.GetSize()); } - m_pWindow->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *mpFrameData->mpBuffer); + m_pWindow->GetOutDev()->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *mpFrameData->mpBuffer); } } @@ -157,7 +158,7 @@ vcl::RenderContext* PaintBufferGuard::GetRenderContext() if (mpFrameData->mpBuffer) return mpFrameData->mpBuffer; else - return m_pWindow; + return m_pWindow->GetOutDev(); } } @@ -302,14 +303,14 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) { // direct painting Wallpaper aBackground = m_pWindow->GetBackground(); - m_pWindow->ApplySettings(*m_pWindow); + m_pWindow->ApplySettings(*m_pWindow->GetOutDev()); // Restore bitmap background if it was lost. if (aBackground.IsBitmap() && !m_pWindow->GetBackground().IsBitmap()) { m_pWindow->SetBackground(aBackground); } - m_pWindow->PushPaintHelper(this, *m_pWindow); - m_pWindow->Paint(*m_pWindow, m_aPaintRect); + m_pWindow->PushPaintHelper(this, *m_pWindow->GetOutDev()); + m_pWindow->Paint(*m_pWindow->GetOutDev(), m_aPaintRect); } #if HAVE_FEATURE_OPENGL VCL_GL_INFO("PaintHelper::DoPaint end on " << @@ -479,7 +480,7 @@ void Window::PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext& rRenderCo if ( mpWindowImpl->mpCursor ) pHelper->SetRestoreCursor(mpWindowImpl->mpCursor->ImplSuspend()); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInPaint = true; // restore Paint-Region @@ -488,12 +489,12 @@ void Window::PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext& rRenderCo tools::Rectangle aPaintRect = rPaintRegion.GetBoundRect(); // RTL: re-mirror paint rect and region at this window - if (ImplIsAntiparallel()) + if (GetOutDev()->ImplIsAntiparallel()) { rRenderContext.ReMirror(aPaintRect); rRenderContext.ReMirror(rPaintRegion); } - aPaintRect = ImplDevicePixelToLogic(aPaintRect); + aPaintRect = GetOutDev()->ImplDevicePixelToLogic(aPaintRect); mpWindowImpl->mpPaintRegion = &rPaintRegion; mpWindowImpl->maInvalidateRegion.SetEmpty(); @@ -524,7 +525,7 @@ void Window::PopPaintHelper(PaintHelper const *pHelper) ImplInvertFocus(*mpWindowImpl->mpWinData->mpFocusRect); } mpWindowImpl->mbInPaint = false; - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mpPaintRegion = nullptr; if (mpWindowImpl->mpCursor) mpWindowImpl->mpCursor->ImplResume(pHelper->GetRestoreCursor()); @@ -579,7 +580,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag { // call PrePaint. PrePaint may add to the invalidate region as well as // other parameters used below. - PrePaint(*this); + PrePaint(*GetOutDev()); mpWindowImpl->mbPaintFrame = false; @@ -602,7 +603,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag Invalidate(*pRegion, InvalidateFlags::NoChildren | InvalidateFlags::NoErase | InvalidateFlags::NoTransparent | InvalidateFlags::NoClipChildren); // call PostPaint before returning - PostPaint(*this); + PostPaint(*GetOutDev()); return; } @@ -617,7 +618,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag mpWindowImpl->mnPaintFlags = ImplPaintFlags::NONE; // call PostPaint - PostPaint(*this); + PostPaint(*GetOutDev()); } void Window::ImplCallOverlapPaint() @@ -820,7 +821,7 @@ void Window::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags if ( pRegion ) { // RTL: remirror region before intersecting it - if ( ImplIsAntiparallel() ) + if ( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); @@ -1003,7 +1004,7 @@ void Window::ImplUpdateAll() pWindow->ImplCallOverlapPaint(); if ( bFlush ) - Flush(); + GetOutDev()->Flush(); } void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/) @@ -1127,7 +1128,7 @@ vcl::Region Window::GetPaintRegion() const if ( mpWindowImpl->mpPaintRegion ) { vcl::Region aRegion = *mpWindowImpl->mpPaintRegion; - aRegion.Move( -mnOutOffX, -mnOutOffY ); + aRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); return PixelToLogic( aRegion ); } else @@ -1139,7 +1140,7 @@ vcl::Region Window::GetPaintRegion() const void Window::Invalidate( InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; ImplInvalidate( nullptr, nFlags ); @@ -1148,7 +1149,7 @@ void Window::Invalidate( InvalidateFlags nFlags ) void Window::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; OutputDevice *pOutDev = GetOutDev(); @@ -1164,7 +1165,7 @@ void Window::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags ) void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; if ( rRegion.IsNull() ) @@ -1174,7 +1175,7 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags ) } else { - vcl::Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); + vcl::Region aRegion = GetOutDev()->ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); if ( !aRegion.IsEmpty() ) { ImplInvalidate( &aRegion, nFlags ); @@ -1228,7 +1229,7 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) void Window::Validate() { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; ImplValidate(); @@ -1333,7 +1334,7 @@ void Window::PaintImmediately() } if ( bFlush ) - Flush(); + GetOutDev()->Flush(); } void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) @@ -1351,13 +1352,13 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP pDevice->SetFont(aCopyFont); pDevice->SetTextColor(GetTextColor()); - if (IsLineColor()) - pDevice->SetLineColor(GetLineColor()); + if (GetOutDev()->IsLineColor()) + pDevice->SetLineColor(GetOutDev()->GetLineColor()); else pDevice->SetLineColor(); - if (IsFillColor()) - pDevice->SetFillColor(GetFillColor()); + if (GetOutDev()->IsFillColor()) + pDevice->SetFillColor(GetOutDev()->GetFillColor()); else pDevice->SetFillColor(); @@ -1377,11 +1378,11 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP pDevice->SetTextFillColor(); pDevice->SetTextAlign(GetTextAlign()); - pDevice->SetRasterOp(GetRasterOp()); + pDevice->SetRasterOp(GetOutDev()->GetRasterOp()); tools::Rectangle aPaintRect(Point(), GetOutputSizePixel()); - vcl::Region aClipRegion(GetClipRegion()); + vcl::Region aClipRegion(GetOutDev()->GetClipRegion()); pDevice->SetClipRegion(); aClipRegion.Intersect(aPaintRect); pDevice->SetClipRegion(aClipRegion); @@ -1403,8 +1404,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX; - tools::Long nDeltaY = pChild->mnOutOffY - mnOutOffY; + tools::Long nDeltaX = pChild->GetOutDev()->mnOutOffX - GetOutDev()->mnOutOffX; + tools::Long nDeltaY = pChild->GetOutDev()->mnOutOffY - GetOutDev()->mnOutOffY; Point aPos( i_rPos ); aPos += Point(nDeltaX, nDeltaY); @@ -1418,49 +1419,49 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP bool bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; - bool bDevOutput = mbDevOutput; - mbDevOutput = true; + bool bDevOutput = GetOutDev()->mbDevOutput; + GetOutDev()->mbDevOutput = true; const OutputDevice *pOutDev = GetOutDev(); tools::Long nOldDPIX = pOutDev->GetDPIX(); tools::Long nOldDPIY = pOutDev->GetDPIY(); - mnDPIX = i_pTargetOutDev->GetDPIX(); - mnDPIY = i_pTargetOutDev->GetDPIY(); - bool bOutput = IsOutputEnabled(); - EnableOutput(); + GetOutDev()->mnDPIX = i_pTargetOutDev->GetDPIX(); + GetOutDev()->mnDPIY = i_pTargetOutDev->GetDPIY(); + bool bOutput = GetOutDev()->IsOutputEnabled(); + GetOutDev()->EnableOutput(); SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" ); if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel ) return; // preserve graphicsstate - Push(); - vcl::Region aClipRegion( GetClipRegion() ); - SetClipRegion(); + GetOutDev()->Push(); + vcl::Region aClipRegion( GetOutDev()->GetClipRegion() ); + GetOutDev()->SetClipRegion(); - GDIMetaFile* pOldMtf = GetConnectMetaFile(); + GDIMetaFile* pOldMtf = GetOutDev()->GetConnectMetaFile(); GDIMetaFile aMtf; - SetConnectMetaFile( &aMtf ); + GetOutDev()->SetConnectMetaFile( &aMtf ); // put a push action to metafile - Push(); + GetOutDev()->Push(); // copy graphics state to metafile vcl::Font aCopyFont = GetFont(); - if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY ) + if( nOldDPIX != GetOutDev()->mnDPIX || nOldDPIY != GetOutDev()->mnDPIY ) { - aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * mnDPIY / nOldDPIY ); - aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * mnDPIX / nOldDPIX ); + aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * GetOutDev()->mnDPIY / nOldDPIY ); + aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * GetOutDev()->mnDPIX / nOldDPIX ); } SetFont( aCopyFont ); SetTextColor( GetTextColor() ); - if( IsLineColor() ) - SetLineColor( GetLineColor() ); + if( GetOutDev()->IsLineColor() ) + GetOutDev()->SetLineColor( GetOutDev()->GetLineColor() ); else - SetLineColor(); - if( IsFillColor() ) - SetFillColor( GetFillColor() ); + GetOutDev()->SetLineColor(); + if( GetOutDev()->IsFillColor() ) + GetOutDev()->SetFillColor( GetOutDev()->GetFillColor() ); else - SetFillColor(); + GetOutDev()->SetFillColor(); if( IsTextLineColor() ) SetTextLineColor( GetTextLineColor() ); else @@ -1474,32 +1475,32 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP else SetTextFillColor(); SetTextAlign( GetTextAlign() ); - SetRasterOp( GetRasterOp() ); - if( IsRefPoint() ) - SetRefPoint( GetRefPoint() ); + GetOutDev()->SetRasterOp( GetOutDev()->GetRasterOp() ); + if( GetOutDev()->IsRefPoint() ) + GetOutDev()->SetRefPoint( GetOutDev()->GetRefPoint() ); else - SetRefPoint(); - SetLayoutMode( GetLayoutMode() ); + GetOutDev()->SetRefPoint(); + GetOutDev()->SetLayoutMode( GetOutDev()->GetLayoutMode() ); - SetDigitLanguage( GetDigitLanguage() ); + GetOutDev()->SetDigitLanguage( GetOutDev()->GetDigitLanguage() ); tools::Rectangle aPaintRect(Point(0, 0), GetOutputSizePixel()); aClipRegion.Intersect( aPaintRect ); - SetClipRegion( aClipRegion ); + GetOutDev()->SetClipRegion( aClipRegion ); // do the actual paint // background if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & ParentClipMode::NoClip ) ) { - Erase(*this); + Erase(*GetOutDev()); } // foreground - Paint(*this, aPaintRect); + Paint(*GetOutDev(), aPaintRect); // put a pop action to metafile - Pop(); + GetOutDev()->Pop(); - SetConnectMetaFile( pOldMtf ); - EnableOutput( bOutput ); + GetOutDev()->SetConnectMetaFile( pOldMtf ); + GetOutDev()->EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; // paint metafile to VDev @@ -1520,10 +1521,10 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX; + tools::Long nDeltaX = pChild->GetOutDev()->mnOutOffX - GetOutDev()->mnOutOffX; if( pOutDev->HasMirroredGraphics() ) - nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; + nDeltaX = GetOutDev()->mnOutWidth - nDeltaX - pChild->GetOutDev()->mnOutWidth; tools::Long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); Point aPos( i_rPos ); Point aDelta( nDeltaX, nDeltaY ); @@ -1533,13 +1534,13 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP } // restore graphics state - Pop(); + GetOutDev()->Pop(); - EnableOutput( bOutput ); + GetOutDev()->EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; - mbDevOutput = bDevOutput; - mnDPIX = nOldDPIX; - mnDPIY = nOldDPIY; + GetOutDev()->mbDevOutput = bDevOutput; + GetOutDev()->mnDPIX = nOldDPIX; + GetOutDev()->mnDPIY = nOldDPIY; } void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos) @@ -1575,7 +1576,7 @@ void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos) void Window::Erase(vcl::RenderContext& rRenderContext) { - if (!IsDeviceOutputNecessary() || ImplIsRecordLayout()) + if (!GetOutDev()->IsDeviceOutputNecessary() || GetOutDev()->ImplIsRecordLayout()) return; bool bNativeOK = false; @@ -1599,28 +1600,28 @@ void Window::Erase(vcl::RenderContext& rRenderContext) nState, ImplControlValue(), OUString()); } - if (mbBackground && !bNativeOK) + if (GetOutDev()->mbBackground && !bNativeOK) { - RasterOp eRasterOp = GetRasterOp(); + RasterOp eRasterOp = GetOutDev()->GetRasterOp(); if (eRasterOp != RasterOp::OverPaint) - SetRasterOp(RasterOp::OverPaint); - rRenderContext.DrawWallpaper(0, 0, mnOutWidth, mnOutHeight, maBackground); + GetOutDev()->SetRasterOp(RasterOp::OverPaint); + rRenderContext.DrawWallpaper(0, 0, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight, GetOutDev()->maBackground); if (eRasterOp != RasterOp::OverPaint) rRenderContext.SetRasterOp(eRasterOp); } - if (mpAlphaVDev) - mpAlphaVDev->Erase(); + if (GetOutDev()->mpAlphaVDev) + GetOutDev()->mpAlphaVDev->Erase(); } void Window::ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags ) { - if ( !IsDeviceOutputNecessary() ) + if ( !GetOutDev()->IsDeviceOutputNecessary() ) return; - nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll ); - nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll ); + nHorzScroll = GetOutDev()->ImplLogicWidthToDevicePixel( nHorzScroll ); + nVertScroll = GetOutDev()->ImplLogicHeightToDevicePixel( nVertScroll ); if ( !nHorzScroll && !nVertScroll ) return; @@ -1646,7 +1647,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, OutputDevice *pOutDev = GetOutDev(); // RTL: check if this window requires special action - bool bReMirror = ImplIsAntiparallel(); + bool bReMirror = GetOutDev()->ImplIsAntiparallel(); tools::Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -1686,7 +1687,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, if ( nFlags & ScrollFlags::Clip ) aRegion.Intersect( rRect ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); aRegion.Exclude( aInvalidateRegion ); @@ -1698,8 +1699,8 @@ void Window::ImplScroll( const tools::Rectangle& rRect, else ImplClipChildren( aRegion ); } - if ( mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) ) - aRegion.Intersect( maRegion ); + if ( GetOutDev()->mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) ) + aRegion.Intersect( GetOutDev()->maRegion ); if ( !aRegion.IsEmpty() ) { if ( mpWindowImpl->mpWinData ) @@ -1734,7 +1735,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll, rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight(), - *this ); + *GetOutDev() ); } #endif if ( mpWindowImpl->mpWinData ) diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx index d7fee9b1b755..f9af6982a0d4 100644 --- a/vcl/source/window/settings.cxx +++ b/vcl/source/window/settings.cxx @@ -37,20 +37,20 @@ namespace vcl { -void Window::SetSettings( const AllSettings& rSettings ) +void WindowOutputDevice::SetSettings( const AllSettings& rSettings ) { SetSettings( rSettings, false ); } -void Window::SetSettings( const AllSettings& rSettings, bool bChild ) +void WindowOutputDevice::SetSettings( const AllSettings& rSettings, bool bChild ) { - if ( mpWindowImpl->mpBorderWindow ) + if ( auto pBorderWindow = mxOwnerWindow->mpWindowImpl->mpBorderWindow.get() ) { - mpWindowImpl->mpBorderWindow->SetSettings( rSettings, false ); - if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) && - static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow ) - static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->SetSettings( rSettings, true ); + static_cast<vcl::WindowOutputDevice*>(pBorderWindow->GetOutDev())->SetSettings( rSettings, false ); + if ( (pBorderWindow->GetType() == WindowType::BORDERWINDOW) && + static_cast<ImplBorderWindow*>(pBorderWindow)->mpMenuBarWindow ) + static_cast<vcl::WindowOutputDevice*>(static_cast<ImplBorderWindow*>(pBorderWindow)->mpMenuBarWindow->GetOutDev())->SetSettings( rSettings, true ); } AllSettings aOldSettings(*mxSettings); @@ -58,20 +58,20 @@ void Window::SetSettings( const AllSettings& rSettings, bool bChild ) AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); // recalculate AppFont-resolution and DPI-resolution - ImplInitResolutionSettings(); + mxOwnerWindow->ImplInitResolutionSettings(); if ( bool(nChangeFlags) ) { DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &aOldSettings, nChangeFlags ); - DataChanged( aDCEvt ); + mxOwnerWindow->DataChanged( aDCEvt ); } if ( bChild ) { - vcl::Window* pChild = mpWindowImpl->mpFirstChild; + vcl::Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; while ( pChild ) { - pChild->SetSettings( rSettings, bChild ); + static_cast<vcl::WindowOutputDevice*>(pChild->GetOutDev())->SetSettings( rSettings, bChild ); pChild = pChild->mpWindowImpl->mpNext; } } @@ -88,8 +88,8 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->UpdateSettings( rSettings, true ); } - AllSettings aOldSettings(*mxSettings); - AllSettingsFlags nChangeFlags = mxSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); + AllSettings aOldSettings(*mpWindowImpl->mxOutDev->mxSettings); + AllSettingsFlags nChangeFlags = mpWindowImpl->mxOutDev->mxSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); // recalculate AppFont-resolution and DPI-resolution ImplInitResolutionSettings(); @@ -101,9 +101,9 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) * so we can spare all our users the hassle of reacting on * this in their respective DataChanged. */ - MouseSettings aSet( mxSettings->GetMouseSettings() ); + MouseSettings aSet( mpWindowImpl->mxOutDev->mxSettings->GetMouseSettings() ); aSet.SetWheelBehavior( aOldSettings.GetMouseSettings().GetWheelBehavior() ); - mxSettings->SetMouseSettings( aSet ); + mpWindowImpl->mxOutDev->mxSettings->SetMouseSettings( aSet ); if( (nChangeFlags & AllSettingsFlags::STYLE) && IsBackground() ) { diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index 394fec0f34c2..7c4a31dde9c8 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -140,8 +140,8 @@ Splitter::Splitter( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); - SetLineColor(); - SetFillColor(); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor(); } Splitter::~Splitter() @@ -201,7 +201,7 @@ bool Splitter::ImplSplitterActive() tools::Long nA = rSettings.GetScrollBarSize(); tools::Long nB = StyleSettings::GetSplitSize(); - Size aSize = GetOutputSize(); + Size aSize = GetOutDev()->GetOutputSize(); if ( mbHorzSplit ) { if( aSize.Width() == nB && aSize.Height() == nA ) @@ -349,7 +349,7 @@ void Splitter::ImplKbdTracking( vcl::KeyCode aKeyCode ) else { Point aNewPos; - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos = GetPosPixel(); // depending on the position calc allows continuous moves or snaps to row/columns // continuous mode is active when position is at the origin or end of the splitter @@ -492,7 +492,7 @@ void Splitter::ImplStartKbdSplitting() // because we have no mouse position we take either the position // of the splitter window or the last split position // the other coordinate is just the center of the reference window - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos = GetPosPixel(); if( mbHorzSplit ) maDragPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aSize.Height()/2 ); @@ -509,7 +509,7 @@ void Splitter::ImplRestoreSplitter() { // set splitter in the center of the ref window StartSplit(); - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos( aSize.Width()/2 , aSize.Height()/2); if ( mnLastSplitPos != mnSplitPos && mnLastSplitPos > 5 ) { diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index 60f7303f33bc..3a04e3c8f8d1 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -707,7 +707,7 @@ void Window::ImplResetReallyVisible() { bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible; - mbDevOutput = false; + GetOutDev()->mbDevOutput = false; mpWindowImpl->mbReallyVisible = false; mpWindowImpl->mbReallyShown = false; diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 73b6ea80515a..4be4b722111d 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -112,7 +112,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) Window::ImplInit( pParent, nStyle & ~WB_BORDER, nullptr ); // remember WinBits - mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this ); + mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *GetOutDev() ); mnCurItemId = 0; mbFormat = true; mbProgressMode = false; @@ -194,7 +194,7 @@ void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext) void StatusBar::ImplInitSettings() { - ApplySettings(*this); + ApplySettings(*GetOutDev()); mpImplData->mpVirDev->SetFont(GetFont()); mpImplData->mpVirDev->SetTextColor(GetTextColor()); @@ -286,7 +286,7 @@ void StatusBar::ImplFormat() } nX = STATUSBAR_OFFSET_X; - if( HasMirroredGraphics() && IsRTLEnabled() ) + if( GetOutDev()->HasMirroredGraphics() && IsRTLEnabled() ) nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; } @@ -1139,14 +1139,14 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCha tools::Long nWidth; if (nCharsWidth != -1) { - std::unique_ptr<SalLayout> pSalLayout = ImplLayout("0",0,-1); + std::unique_ptr<SalLayout> pSalLayout = GetOutDev()->ImplLayout("0",0,-1); const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs(); nWidth = GetTextWidth("0",0,-1,nullptr,pSalLayout ? &glyphs : nullptr); nWidth = nWidth * nCharsWidth + nFudge; } else { - std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1); + std::unique_ptr<SalLayout> pSalLayout = GetOutDev()->ImplLayout(pItem->maText,0,-1); const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs(); nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout ? &glyphs : nullptr) + nFudge; // Store the calculated layout. diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index ecba89c0aac1..ab8be281c3a4 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -1125,7 +1125,7 @@ VclPtr<VirtualDevice> SystemWindow::createScreenshot() xOutput->SetOutputSizePixel(aSize); Point aPos; - xOutput->DrawOutDev(aPos, aSize, aPos, aSize, *this); + xOutput->DrawOutDev(aPos, aSize, aPos, aSize, *GetOutDev()); return xOutput; } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 5b9a956edb7a..0e67a1f10d0b 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -118,6 +118,10 @@ static ImplTBDragMgr* ImplGetTBDragMgr() return pSVData->maCtrlData.mpTBDragMgr; } +int ToolBox::ImplGetDragWidth( const vcl::Window& rWindow, bool bHorz ) +{ + return ImplGetDragWidth(*rWindow.GetOutDev(), bHorz); +} int ToolBox::ImplGetDragWidth( const vcl::RenderContext& rRenderContext, bool bHorz ) { int nWidth = TB_DRAGWIDTH; @@ -478,7 +482,7 @@ void ToolBox::ImplDrawBackground(vcl::RenderContext& rRenderContext, const tools // make sure we do not invalidate/erase too much if (IsInPaint()) - aPaintRegion.Intersect(GetActiveClipRegion()); + aPaintRegion.Intersect(GetOutDev()->GetActiveClipRegion()); rRenderContext.Push(PushFlags::CLIPREGION); rRenderContext.IntersectClipRegion( aPaintRegion ); @@ -1244,12 +1248,12 @@ void ToolBox::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (bFont) - ApplyControlFont(*this, rStyleSettings.GetToolFont()); + ApplyControlFont(*GetOutDev(), rStyleSettings.GetToolFont()); if (bForeground || bFont) - ApplyForegroundSettings(*this, rStyleSettings); + ApplyForegroundSettings(*GetOutDev(), rStyleSettings); if (bBackground) { - ApplyBackgroundSettings(*this, rStyleSettings); + ApplyBackgroundSettings(*GetOutDev(), rStyleSettings); EnableChildTransparentMode(IsPaintTransparent()); } } @@ -1477,7 +1481,7 @@ bool ToolBox::ImplCalcItem() } else { - item.maItemSize = Size( GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, + item.maItemSize = Size( GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, GetTextHeight() ); item.mbVisibleText = true; } @@ -1487,7 +1491,7 @@ bool ToolBox::ImplCalcItem() // we're drawing text only if ( bText || !bImage ) { - item.maItemSize = Size( GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, + item.maItemSize = Size( GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, GetTextHeight() ); item.mbVisibleText = true; } @@ -1499,7 +1503,7 @@ bool ToolBox::ImplCalcItem() else { // we're drawing images and text - item.maItemSize.setWidth( bText ? GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET : 0 ); + item.maItemSize.setWidth( bText ? GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET : 0 ); item.maItemSize.setHeight( bText ? GetTextHeight() : 0 ); if ( meTextPosition == ToolBoxTextPosition::Right ) @@ -2691,7 +2695,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si bool bRotate = false; if ( bText ) { - const Size aTxtSize(GetCtrlTextWidth(pItem->maText), GetTextHeight()); + const Size aTxtSize(GetOutDev()->GetCtrlTextWidth(pItem->maText), GetTextHeight()); tools::Long nTextOffX = nOffX; tools::Long nTextOffY = nOffY; @@ -3003,7 +3007,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) if ( mnCurPos != ITEM_NOTFOUND ) { InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); } } } diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index a9dd9142f47a..fd338243ee22 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1049,10 +1049,10 @@ void ToolBox::SetItemText( ToolBoxItemId nItemId, const OUString& rText ) if ( !mbCalc && ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) ) { - tools::Long nOldWidth = GetCtrlTextWidth( pItem->maText ); + tools::Long nOldWidth = GetOutDev()->GetCtrlTextWidth( pItem->maText ); pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText); mpData->ImplClearLayoutData(); - if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) ) + if ( nOldWidth != GetOutDev()->GetCtrlTextWidth( pItem->maText ) ) ImplInvalidate( true ); else ImplUpdateItem( nPos ); @@ -1135,7 +1135,7 @@ void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown ) { mnCurPos = nPos; InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); } } else @@ -1143,7 +1143,7 @@ void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown ) if ( nPos == mnCurPos ) { InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); mnCurPos = ITEM_NOTFOUND; } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c0a9bf8b141b..0a279983d02d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -90,19 +90,17 @@ using namespace ::com::sun::star::datatransfer::dnd; namespace vcl { Window::Window( WindowType nType ) - : OutputDevice(OUTDEV_WINDOW) - , mpWindowImpl(new WindowImpl( nType )) + : mpWindowImpl(new WindowImpl( *this, nType )) { // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); } Window::Window( vcl::Window* pParent, WinBits nStyle ) - : OutputDevice(OUTDEV_WINDOW) - , mpWindowImpl(new WindowImpl( WindowType::WINDOW )) + : mpWindowImpl(new WindowImpl( *this, WindowType::WINDOW )) { // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); ImplInit( pParent, nStyle, nullptr ); } @@ -154,7 +152,7 @@ void Window::dispose() // Dispose of the canvas implementation (which, currently, has an // own wrapper window as a child to this one. - ImplDisposeCanvas(); + GetOutDev()->ImplDisposeCanvas(); mpWindowImpl->mbInDispose = true; @@ -484,7 +482,7 @@ void Window::dispose() } // release SalGraphics - OutputDevice *pOutDev = GetOutDev(); + VclPtr<OutputDevice> pOutDev = GetOutDev(); pOutDev->ReleaseGraphics(); // remove window from the lists @@ -553,7 +551,9 @@ void Window::dispose() // should be the last statements mpWindowImpl.reset(); - OutputDevice::dispose(); + pOutDev.disposeAndClear(); + // just to make loplugin:vclwidgets happy + VclReferenceBase::dispose(); } Window::~Window() @@ -569,23 +569,29 @@ Window::~Window() ::OutputDevice const* Window::GetOutDev() const { - return this; + return mpWindowImpl->mxOutDev.get(); } ::OutputDevice* Window::GetOutDev() { - return this; + return mpWindowImpl->mxOutDev.get(); +} + +Color WindowOutputDevice::GetBackgroundColor() const +{ + return mxOwnerWindow->GetDisplayBackground().GetColor(); } -Color Window::GetBackgroundColor() const +bool WindowOutputDevice::CanEnableNativeWidget() const { - return GetDisplayBackground().GetColor(); + return mxOwnerWindow->IsNativeWidgetEnabled(); } } /* namespace vcl */ -WindowImpl::WindowImpl( WindowType nType ) +WindowImpl::WindowImpl( vcl::Window& rWindow, WindowType nType ) { + mxOutDev = VclPtr<vcl::WindowOutputDevice>::Create(rWindow); maZoom = Fraction( 1, 1 ); maWinRegion = vcl::Region(true); maWinClipRegion = vcl::Region(true); @@ -809,11 +815,14 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow ) namespace vcl { -bool Window::AcquireGraphics() const +bool WindowOutputDevice::AcquireGraphics() const { DBG_TESTSOLARMUTEX(); - if ( mpGraphics ) + if (isDisposed()) + return false; + + if (mpGraphics) return true; mbInitLineColor = true; @@ -824,17 +833,17 @@ bool Window::AcquireGraphics() const ImplSVData* pSVData = ImplGetSVData(); - mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics(); + mpGraphics = mxOwnerWindow->mpWindowImpl->mpFrame->AcquireGraphics(); // try harder if no wingraphics was available directly if ( !mpGraphics ) { // find another output device in the same frame - OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics; + vcl::WindowOutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics.get(); while ( pReleaseOutDev ) { - if ( static_cast<vcl::Window*>(pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame ) + if ( pReleaseOutDev->mxOwnerWindow && pReleaseOutDev->mxOwnerWindow->mpWindowImpl->mpFrame == mxOwnerWindow->mpWindowImpl->mpFrame ) break; - pReleaseOutDev = pReleaseOutDev->mpPrevGraphics; + pReleaseOutDev = static_cast<vcl::WindowOutputDevice*>(pReleaseOutDev->mpPrevGraphics.get()); } if ( pReleaseOutDev ) @@ -851,7 +860,7 @@ bool Window::AcquireGraphics() const if ( !pSVData->maGDIData.mpLastWinGraphics ) break; pSVData->maGDIData.mpLastWinGraphics->ReleaseGraphics(); - mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics(); + mpGraphics = mxOwnerWindow->mpWindowImpl->mpFrame->AcquireGraphics(); } } } @@ -859,12 +868,12 @@ bool Window::AcquireGraphics() const if ( mpGraphics ) { // update global LRU list of wingraphics - mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics; - pSVData->maGDIData.mpFirstWinGraphics = const_cast<vcl::Window*>(this); + mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics.get(); + pSVData->maGDIData.mpFirstWinGraphics = const_cast<vcl::WindowOutputDevice*>(this); if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = const_cast<vcl::Window*>(this); + mpNextGraphics->mpPrevGraphics = const_cast<vcl::WindowOutputDevice*>(this); if ( !pSVData->maGDIData.mpLastWinGraphics ) - pSVData->maGDIData.mpLastWinGraphics = const_cast<vcl::Window*>(this); + pSVData->maGDIData.mpLastWinGraphics = const_cast<vcl::WindowOutputDevice*>(this); mpGraphics->SetXORMode( (RasterOp::Invert == meRasterOp) || (RasterOp::Xor == meRasterOp), RasterOp::Invert == meRasterOp ); mpGraphics->setAntiAlias(bool(mnAntialiasing & AntialiasingFlags::Enable)); @@ -873,7 +882,7 @@ bool Window::AcquireGraphics() const return mpGraphics != nullptr; } -void Window::ReleaseGraphics( bool bRelease ) +void WindowOutputDevice::ReleaseGraphics( bool bRelease ) { DBG_TESTSOLARMUTEX(); @@ -886,7 +895,9 @@ void Window::ReleaseGraphics( bool bRelease ) ImplSVData* pSVData = ImplGetSVData(); - vcl::Window* pWindow = this; + vcl::Window* pWindow = mxOwnerWindow.get(); + if (!pWindow) + return; if ( bRelease ) pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics ); @@ -894,11 +905,11 @@ void Window::ReleaseGraphics( bool bRelease ) if ( mpPrevGraphics ) mpPrevGraphics->mpNextGraphics = mpNextGraphics; else - pSVData->maGDIData.mpFirstWinGraphics = static_cast<vcl::Window*>(mpNextGraphics.get()); + pSVData->maGDIData.mpFirstWinGraphics = static_cast<vcl::WindowOutputDevice*>(mpNextGraphics.get()); if ( mpNextGraphics ) mpNextGraphics->mpPrevGraphics = mpPrevGraphics; else - pSVData->maGDIData.mpLastWinGraphics = static_cast<vcl::Window*>(mpPrevGraphics.get()); + pSVData->maGDIData.mpLastWinGraphics = static_cast<vcl::WindowOutputDevice*>(mpPrevGraphics.get()); mpGraphics = nullptr; mpPrevGraphics = nullptr; @@ -969,7 +980,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mnStyle = nStyle; if( pParent && ! mpWindowImpl->mbFrame ) - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); // test for frame creation if ( mpWindowImpl->mbFrame ) @@ -1064,8 +1075,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mpRealParent = pRealParent; // #99318: make sure fontcache and list is available before call to SetSettings - mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection; - mxFontCache = mpWindowImpl->mpFrameData->mxFontCache; + mpWindowImpl->mxOutDev->mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection; + mpWindowImpl->mxOutDev->mxFontCache = mpWindowImpl->mpFrameData->mxFontCache; if ( mpWindowImpl->mbFrame ) { @@ -1079,7 +1090,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p OutputDevice *pOutDev = GetOutDev(); if ( pOutDev->AcquireGraphics() ) { - mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); + mpWindowImpl->mxOutDev->mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); } } @@ -1096,7 +1107,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p { // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); - OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); + mpWindowImpl->mxOutDev->SetSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = true; } @@ -1104,7 +1115,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p // size directly, because we want resize all Controls to // the correct size before we display the window if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) ) - mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight ); + mpWindowImpl->mpFrame->GetClientSize( mpWindowImpl->mxOutDev->mnOutWidth, mpWindowImpl->mxOutDev->mnOutHeight ); } else { @@ -1118,20 +1129,24 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p } if (!utl::ConfigManager::IsFuzzing()) - OutputDevice::SetSettings( pParent->GetSettings() ); + { + // we don't want to call the WindowOutputDevice override of this because + // it calls back into us. + mpWindowImpl->mxOutDev->OutputDevice::SetSettings( pParent->GetSettings() ); + } } } // setup the scale factor for HiDPI displays - mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; - mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; + mpWindowImpl->mxOutDev->mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); + mpWindowImpl->mxOutDev->mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; + mpWindowImpl->mxOutDev->mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; if (!utl::ConfigManager::IsFuzzing()) { - const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); - maFont = rStyleSettings.GetAppFont(); + const StyleSettings& rStyleSettings = mpWindowImpl->mxOutDev->mxSettings->GetStyleSettings(); + mpWindowImpl->mxOutDev->maFont = rStyleSettings.GetAppFont(); if ( nStyle & WB_3DLOOK ) { @@ -1146,10 +1161,10 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p } else { - maFont = GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE ); + mpWindowImpl->mxOutDev->maFont = OutputDevice::GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE ); } - ImplPointToLogic(*this, maFont); + ImplPointToLogic(*GetOutDev(), mpWindowImpl->mxOutDev->maFont); (void)ImplUpdatePos(); @@ -1214,7 +1229,7 @@ ImplWinData* Window::ImplGetWinData() const } -void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) +void WindowOutputDevice::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) { if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0) return; @@ -1224,7 +1239,7 @@ void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) const tools::Rectangle aSrcRect(Point(aPosAry.mnSrcX, aPosAry.mnSrcY), Size(aPosAry.mnSrcWidth, aPosAry.mnSrcHeight)); - ImplMoveAllInvalidateRegions(aSrcRect, + mxOwnerWindow->ImplMoveAllInvalidateRegions(aSrcRect, aPosAry.mnDestX-aPosAry.mnSrcX, aPosAry.mnDestY-aPosAry.mnSrcY, false); @@ -1240,14 +1255,14 @@ void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) OutputDevice::CopyDeviceArea(aPosAry, bWindowInvalidate); } -const OutputDevice* Window::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const +const OutputDevice* WindowOutputDevice::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const { const OutputDevice* pSrcDevChecked; if ( this == &rSrcDev ) pSrcDevChecked = nullptr; else if (GetOutDevType() != rSrcDev.GetOutDevType()) pSrcDevChecked = &rSrcDev; - else if (this->mpWindowImpl->mpFrameWindow == static_cast<const vcl::Window&>(rSrcDev).mpWindowImpl->mpFrameWindow) + else if (mxOwnerWindow->mpWindowImpl->mpFrameWindow == static_cast<const vcl::WindowOutputDevice&>(rSrcDev).mxOwnerWindow->mpWindowImpl->mpFrameWindow) pSrcDevChecked = nullptr; else pSrcDevChecked = &rSrcDev; @@ -1255,7 +1270,7 @@ const OutputDevice* Window::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) c return pSrcDevChecked; } -void Window::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) +void WindowOutputDevice::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) { if (pSrcGraphics) mpGraphics->CopyBits(rPosAry, *pSrcGraphics, *this, rSrcDev); @@ -1265,20 +1280,20 @@ void Window::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& r SalGraphics* Window::ImplGetFrameGraphics() const { - if ( mpWindowImpl->mpFrameWindow->mpGraphics ) + if ( mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics ) { - mpWindowImpl->mpFrameWindow->mbInitClipRegion = true; + mpWindowImpl->mpFrameWindow->GetOutDev()->mbInitClipRegion = true; } else { - OutputDevice* pFrameWinOutDev = mpWindowImpl->mpFrameWindow; + OutputDevice* pFrameWinOutDev = mpWindowImpl->mpFrameWindow->GetOutDev(); if ( ! pFrameWinOutDev->AcquireGraphics() ) { return nullptr; } } - mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion(); - return mpWindowImpl->mpFrameWindow->mpGraphics; + mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics->ResetClipRegion(); + return mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics; } void Window::ImplSetReallyVisible() @@ -1291,7 +1306,7 @@ void Window::ImplSetReallyVisible() bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible; - mbDevOutput = true; + GetOutDev()->mbDevOutput = true; mpWindowImpl->mbReallyVisible = true; mpWindowImpl->mbReallyShown = true; @@ -1326,19 +1341,19 @@ void Window::ImplInitResolutionSettings() // recalculate AppFont-resolution and DPI-resolution if (mpWindowImpl->mbFrame) { - mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; - mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; + GetOutDev()->mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; + GetOutDev()->mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; // setup the scale factor for HiDPI displays - mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); - SetPointFont(*this, rStyleSettings.GetAppFont()); + GetOutDev()->mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); + const StyleSettings& rStyleSettings = GetOutDev()->mxSettings->GetStyleSettings(); + SetPointFont(*GetOutDev(), rStyleSettings.GetAppFont()); } else if ( mpWindowImpl->mpParent ) { - mnDPIX = mpWindowImpl->mpParent->mnDPIX; - mnDPIY = mpWindowImpl->mpParent->mnDPIY; - mnDPIScalePercentage = mpWindowImpl->mpParent->mnDPIScalePercentage; + GetOutDev()->mnDPIX = mpWindowImpl->mpParent->GetOutDev()->mnDPIX; + GetOutDev()->mnDPIY = mpWindowImpl->mpParent->GetOutDev()->mnDPIY; + GetOutDev()->mnDPIScalePercentage = mpWindowImpl->mpParent->GetOutDev()->mnDPIScalePercentage; } // update the recalculated values for logical units @@ -1397,15 +1412,15 @@ bool Window::ImplUpdatePos() if ( ImplIsOverlapWindow() ) { - mnOutOffX = mpWindowImpl->mnX; - mnOutOffY = mpWindowImpl->mnY; + GetOutDev()->mnOutOffX = mpWindowImpl->mnX; + GetOutDev()->mnOutOffY = mpWindowImpl->mnY; } else { vcl::Window* pParent = ImplGetParent(); - mnOutOffX = mpWindowImpl->mnX + pParent->mnOutOffX; - mnOutOffY = mpWindowImpl->mnY + pParent->mnOutOffY; + GetOutDev()->mnOutOffX = mpWindowImpl->mnX + pParent->GetOutDev()->mnOutOffX; + GetOutDev()->mnOutOffY = mpWindowImpl->mnY + pParent->GetOutDev()->mnOutOffY; } VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; @@ -1425,7 +1440,7 @@ bool Window::ImplUpdatePos() void Window::ImplUpdateSysObjPos() { if ( mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight ); VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; while ( pChild ) @@ -1441,10 +1456,10 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, bool bNewPos = false; bool bNewSize = false; bool bCopyBits = false; - tools::Long nOldOutOffX = mnOutOffX; - tools::Long nOldOutOffY = mnOutOffY; - tools::Long nOldOutWidth = mnOutWidth; - tools::Long nOldOutHeight = mnOutHeight; + tools::Long nOldOutOffX = GetOutDev()->mnOutOffX; + tools::Long nOldOutOffY = GetOutDev()->mnOutOffY; + tools::Long nOldOutWidth = GetOutDev()->mnOutWidth; + tools::Long nOldOutHeight = GetOutDev()->mnOutHeight; std::unique_ptr<vcl::Region> pOverlapRegion; std::unique_ptr<vcl::Region> pOldRegion; @@ -1454,9 +1469,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, Size( nOldOutWidth, nOldOutHeight ) ); pOldRegion.reset( new vcl::Region( aOldWinRect ) ); if ( mpWindowImpl->mbWinRegion ) - pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + pOldRegion->Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); - if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent && + if ( GetOutDev()->mnOutWidth && GetOutDev()->mnOutHeight && !mpWindowImpl->mbPaintTransparent && !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() && !HasPaintEvent() ) bCopyBits = true; @@ -1474,9 +1489,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( nWidth < 0 ) nWidth = 0; - if ( nWidth != mnOutWidth ) + if ( nWidth != GetOutDev()->mnOutWidth ) { - mnOutWidth = nWidth; + GetOutDev()->mnOutWidth = nWidth; bNewSize = true; bCopyBits = false; } @@ -1485,9 +1500,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { if ( nHeight < 0 ) nHeight = 0; - if ( nHeight != mnOutHeight ) + if ( nHeight != GetOutDev()->mnOutHeight ) { - mnOutHeight = nHeight; + GetOutDev()->mnOutHeight = nHeight; bNewSize = true; bCopyBits = false; } @@ -1496,35 +1511,35 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( nFlags & PosSizeFlags::X ) { tools::Long nOrgX = nX; - Point aPtDev( Point( nX+mnOutOffX, 0 ) ); + Point aPtDev( Point( nX+GetOutDev()->mnOutOffX, 0 ) ); OutputDevice *pOutDev = GetOutDev(); if( pOutDev->HasMirroredGraphics() ) { - aPtDev.setX( mpGraphics->mirror2( aPtDev.X(), *this ) ); + aPtDev.setX( GetOutDev()->mpGraphics->mirror2( aPtDev.X(), *GetOutDev() ) ); // #106948# always mirror our pos if our parent is not mirroring, even // if we are also not mirroring // RTL: check if parent is in different coordinates - if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { - nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX; } /* #i99166# An LTR window in RTL UI that gets sized only would be expected to not moved its upper left point */ if( bnXRecycled ) { - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { aPtDev.setX( mpWindowImpl->mnAbsScreenX ); nOrgX = mpWindowImpl->maPos.X(); } } } - else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { // mirrored window in LTR UI - nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX; } // check maPos as well, as it could have been changed for client windows (ImplCallMove()) @@ -1574,8 +1589,8 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder, mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder, - mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder, - mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder, + GetOutDev()->mnOutWidth - mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder, + GetOutDev()->mnOutHeight - mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder, PosSizeFlags::X | PosSizeFlags::Y | PosSizeFlags::Width | PosSizeFlags::Height ); // If we have a client window, then this is the position @@ -1625,7 +1640,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, } // invalidate window content ? - if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) ) + if ( bNewPos || (GetOutDev()->mnOutWidth > nOldOutWidth) || (GetOutDev()->mnOutHeight > nOldOutHeight) ) { if ( bNewPos ) { @@ -1637,11 +1652,11 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { vcl::Region aRegion( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); ImplClipBoundaries( aRegion, false, true ); if ( !pOverlapRegion->IsEmpty() ) { - pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY ); + pOverlapRegion->Move( GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY ); aRegion.Exclude( *pOverlapRegion ); } if ( !aRegion.IsEmpty() ) @@ -1649,7 +1664,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, // adapt Paint areas ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ), Size( nOldOutWidth, nOldOutHeight ) ), - mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY, + GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY, true ); SalGraphics* pGraphics = ImplGetFrameGraphics(); if ( pGraphics ) @@ -1659,10 +1674,10 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics ); if ( bSelectClipRegion ) { - pGraphics->CopyArea( mnOutOffX, mnOutOffY, + pGraphics->CopyArea( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, nOldOutOffX, nOldOutOffY, nOldOutWidth, nOldOutHeight, - *this ); + *GetOutDev() ); } else bInvalidate = true; @@ -1688,7 +1703,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, vcl::Region aRegion( GetOutputRectPixel() ); aRegion.Exclude( *pOldRegion ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); ImplClipBoundaries( aRegion, false, true ); if ( !aRegion.IsEmpty() ) ImplInvalidateFrameRegion( &aRegion, InvalidateFlags::Children ); @@ -1697,7 +1712,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, // invalidate Parent or Overlaps if ( bNewPos || - (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) ) + (GetOutDev()->mnOutWidth < nOldOutWidth) || (GetOutDev()->mnOutHeight < nOldOutHeight) ) { vcl::Region aRegion( *pOldRegion ); if ( !mpWindowImpl->mbPaintTransparent ) @@ -1714,7 +1729,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( bUpdateSysObjPos ) ImplUpdateSysObjPos(); if ( bNewSize && mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight ); } void Window::ImplNewInputContext() @@ -1747,10 +1762,11 @@ void Window::ImplNewInputContext() if ( rFont.GetFontSize().Height() ) aSize.setHeight( 1 ); else - aSize.setHeight( (12*pFocusWin->mnDPIY)/72 ); + aSize.setHeight( (12*pFocusWin->GetOutDev()->mnDPIY)/72 ); } - pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mxFontCollection.get(), - rFont, aSize, static_cast<float>(aSize.Height()) ); + pFontInstance = pFocusWin->GetOutDev()->mxFontCache->GetFontInstance( + pFocusWin->GetOutDev()->mxFontCollection.get(), + rFont, aSize, static_cast<float>(aSize.Height()) ); if ( pFontInstance ) aNewContext.mpFont = pFontInstance; } @@ -2046,7 +2062,7 @@ tools::Long Window::CalcTitleWidth() const // border of external dialogs const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont = GetFont(); - const_cast<vcl::Window*>(this)->SetPointFont(*const_cast<Window*>(this), rStyleSettings.GetTitleFont()); + const_cast<vcl::Window*>(this)->SetPointFont(const_cast<::OutputDevice&>(*GetOutDev()), rStyleSettings.GetTitleFont()); tools::Long nTitleWidth = GetTextWidth( GetText() ); const_cast<vcl::Window*>(this)->SetFont( aFont ); nTitleWidth += rStyleSettings.GetTitleHeight() * 3; @@ -2401,8 +2417,8 @@ Size Window::GetSizePixel() const return Size(0,0); } - return Size( mnOutWidth+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder, - mnOutHeight+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ); + return Size( GetOutDev()->mnOutWidth + mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder, + GetOutDev()->mnOutHeight + mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ); } void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, @@ -2667,12 +2683,12 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, // Note: if we're positioning a frame, the coordinates are interpreted // as being the top-left corner of the window's client area and NOT // as the position of the border ! (due to limitations of several UNIX window managers) - tools::Long nOldWidth = pWindow->mnOutWidth; + tools::Long nOldWidth = pWindow->GetOutDev()->mnOutWidth; if ( !(nFlags & PosSizeFlags::Width) ) - nWidth = pWindow->mnOutWidth; + nWidth = pWindow->GetOutDev()->mnOutWidth; if ( !(nFlags & PosSizeFlags::Height) ) - nHeight = pWindow->mnOutHeight; + nHeight = pWindow->GetOutDev()->mnOutHeight; sal_uInt16 nSysFlags=0; VclPtr<vcl::Window> pParent = GetParent(); @@ -2687,9 +2703,9 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, nSysFlags |= SAL_FRAME_POSSIZE_X; if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nX += pWinParent->mnOutOffX; + nX += pWinParent->GetOutDev()->mnOutOffX; } - if( pParent && pParent->ImplIsAntiparallel() ) + if( pParent && pParent->GetOutDev()->ImplIsAntiparallel() ) { tools::Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); const OutputDevice *pParentOutDev = pParent->GetOutDev(); @@ -2726,7 +2742,7 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, nSysFlags |= SAL_FRAME_POSSIZE_Y; if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nY += pWinParent->mnOutOffY; + nY += pWinParent->GetOutDev()->mnOutOffY; } } @@ -2787,31 +2803,31 @@ tools::Rectangle Window::GetDesktopRectPixel() const Point Window::OutputToScreenPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY ); + return Point( rPos.X() + GetOutDev()->mnOutOffX, rPos.Y() + GetOutDev()->mnOutOffY ); } Point Window::ScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY ); + return Point( rPos.X() - GetOutDev()->mnOutOffX, rPos.Y() - GetOutDev()->mnOutOffY ); } tools::Long Window::ImplGetUnmirroredOutOffX() { // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow - tools::Long offx = mnOutOffX; + tools::Long offx = GetOutDev()->mnOutOffX; OutputDevice *pOutDev = GetOutDev(); if( pOutDev->HasMirroredGraphics() ) { - if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { if ( !ImplIsOverlapWindow() ) - offx -= mpWindowImpl->mpParent->mnOutOffX; + offx -= mpWindowImpl->mpParent->GetOutDev()->mnOutOffX; - offx = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - offx; + offx = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - offx; if ( !ImplIsOverlapWindow() ) - offx += mpWindowImpl->mpParent->mnOutOffX; + offx += mpWindowImpl->mpParent->GetOutDev()->mnOutOffX; } } @@ -2823,14 +2839,14 @@ Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX(); - return Point( rPos.X()+offx, rPos.Y()+mnOutOffY ); + return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->mnOutOffY ); } Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX(); - return Point( rPos.X()-offx, rPos.Y()-mnOutOffY ); + return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->mnOutOffY ); } Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const @@ -2942,10 +2958,10 @@ void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags ); } -void Window::Flush() +void WindowOutputDevice::Flush() { - if (mpWindowImpl) - mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() ); + if (mxOwnerWindow->mpWindowImpl) + mxOwnerWindow->mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() ); } void Window::SetUpdateMode( bool bUpdate ) @@ -3422,11 +3438,11 @@ Reference< XClipboard > Window::GetClipboard() void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect ) { - assert(mpOutDevData); - mpOutDevData->mpRecordLayout = pLayout; - mpOutDevData->maRecordRect = rRect; - Paint(*this, rRect); - mpOutDevData->mpRecordLayout = nullptr; + assert(GetOutDev()->mpOutDevData); + GetOutDev()->mpOutDevData->mpRecordLayout = pLayout; + GetOutDev()->mpOutDevData->maRecordRect = rRect; + Paint(*GetOutDev(), rRect); + GetOutDev()->mpOutDevData->mpRecordLayout = nullptr; } void Window::DrawSelectionBackground( const tools::Rectangle& rRect, @@ -3462,13 +3478,13 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, } tools::Rectangle aRect( rRect ); - Color oldFillCol = GetFillColor(); - Color oldLineCol = GetLineColor(); + Color oldFillCol = GetOutDev()->GetFillColor(); + Color oldLineCol = GetOutDev()->GetLineColor(); if( bDrawBorder ) - SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) ); + GetOutDev()->SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) ); else - SetLineColor(); + GetOutDev()->SetLineColor(); sal_uInt16 nPercent = 0; if( !highlight ) @@ -3487,7 +3503,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); nPercent = 0; } else @@ -3500,7 +3516,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); nPercent = 0; } else @@ -3513,7 +3529,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); if( highlight == 3 ) nPercent = 80; else @@ -3524,21 +3540,21 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, } } - SetFillColor( aSelectionFillCol ); + GetOutDev()->SetFillColor( aSelectionFillCol ); if( bDark ) { - DrawRect( aRect ); + GetOutDev()->DrawRect( aRect ); } else { tools::Polygon aPoly( aRect ); tools::PolyPolygon aPolyPoly( aPoly ); - DrawTransparent( aPolyPoly, nPercent ); + GetOutDev()->DrawTransparent( aPolyPoly, nPercent ); } - SetFillColor( oldFillCol ); - SetLineColor( oldLineCol ); + GetOutDev()->SetFillColor( oldFillCol ); + GetOutDev()->SetLineColor( oldLineCol ); } bool Window::IsScrollable() const @@ -3657,7 +3673,7 @@ void Window::EnableNativeWidget( bool bEnable ) // send datachanged event to allow for internal changes required for NWF // like clipmode, transparency, etc. - DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, mxSettings.get(), AllSettingsFlags::STYLE ); + DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, GetOutDev()->mxSettings.get(), AllSettingsFlags::STYLE ); CompatDataChanged( aDCEvt ); // sometimes the borderwindow is queried, so keep it in sync @@ -3679,7 +3695,7 @@ bool Window::IsNativeWidgetEnabled() const return ImplGetWinData()->mbEnableNativeWidget; } -Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) const +Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSpriteCanvas ) const { Sequence< Any > aArg(5); @@ -3688,9 +3704,9 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) // common: first any is VCL pointer to window (for VCL canvas) aArg[ 0 ] <<= reinterpret_cast<sal_Int64>(this); aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); - aArg[ 2 ] <<= mpWindowImpl->mbAlwaysOnTop; + aArg[ 2 ] <<= mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop; aArg[ 3 ] <<= Reference< css::awt::XWindow >( - const_cast<vcl::Window*>(this)->GetComponentInterface(), + mxOwnerWindow->GetComponentInterface(), UNO_QUERY ); aArg[ 4 ] = GetSystemGfxDataAny(); @@ -3711,7 +3727,7 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) // implementation (not DX5 canvas, as it cannot cope with // surfaces spanning multiple displays). Note: canvas // (without sprite) stays the same) - const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; + const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mxOwnerWindow->mpWindowImpl->mpFrame )->mnDisplay; if( nDisplay >= Application::GetScreenCount() ) { xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext( @@ -3809,7 +3825,7 @@ bool Window::DeleteSurroundingText(const Selection& rSelection) return false; } -bool Window::UsePolyPolygonForComplexGradient() +bool WindowOutputDevice::UsePolyPolygonForComplexGradient() { return meRasterOp != RasterOp::OverPaint; } @@ -3909,13 +3925,35 @@ FactoryFunction Window::GetUITestFactory() const return WindowUIObject::create; } -css::awt::DeviceInfo Window::GetDeviceInfo() const +WindowOutputDevice::WindowOutputDevice(vcl::Window& rOwnerWindow) : + ::OutputDevice(OUTDEV_WINDOW), + mxOwnerWindow(&rOwnerWindow) { - css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(GetSizePixel()); - GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset); + assert(mxOwnerWindow); +} + +WindowOutputDevice::~WindowOutputDevice() +{ + disposeOnce(); +} + +void WindowOutputDevice::dispose() +{ + assert((!mxOwnerWindow || mxOwnerWindow->isDisposed()) && "This belongs to the associated window and must be disposed after it"); + ::OutputDevice::dispose(); + // need to do this after OutputDevice::dispose so that the call to WindowOutputDevice::ReleaseGraphics + // can release the graphics properly + mxOwnerWindow.clear(); +} + +css::awt::DeviceInfo WindowOutputDevice::GetDeviceInfo() const +{ + css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(mxOwnerWindow->GetSizePixel()); + mxOwnerWindow->GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset); return aInfo; } + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index f52478299a9b..19eb432a73ec 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -168,24 +168,23 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag if ( nFlags & ShowTrackFlags::TrackWindow ) { - if ( !IsDeviceOutputNecessary() ) + if ( !GetOutDev()->IsDeviceOutputNecessary() ) return; // we need a graphics - if ( !mpGraphics ) + if ( !GetOutDev()->mpGraphics ) { if ( !pOutDev->AcquireGraphics() ) return; } - assert(mpGraphics); - if ( mbInitClipRegion ) - InitClipRegion(); + if ( GetOutDev()->mbInitClipRegion ) + GetOutDev()->InitClipRegion(); - if ( mbOutputClipped ) + if ( GetOutDev()->mbOutputClipped ) return; - pGraphics = mpGraphics; + pGraphics = GetOutDev()->mpGraphics; } else { @@ -201,18 +200,18 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag ShowTrackFlags nStyle = nFlags & ShowTrackFlags::StyleMask; if ( nStyle == ShowTrackFlags::Object ) - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::TrackFrame, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::TrackFrame, *GetOutDev() ); else if ( nStyle == ShowTrackFlags::Split ) - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::N50, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::N50, *GetOutDev() ); else { tools::Long nBorder = 1; if ( nStyle == ShowTrackFlags::Big ) nBorder = 5; - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SalInvert::N50, *this ); - pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SalInvert::N50, *this ); - pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *this ); - pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() ); } } @@ -226,7 +225,7 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer, void ) // create Tracking-Event Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pOutDev = GetOutDev(); @@ -288,7 +287,7 @@ void Window::EndTracking( TrackingEventFlags nFlags ) // call EndTracking if required { Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pOutDev = GetOutDev(); @@ -551,7 +550,7 @@ Size Window::CalcOutputSize( const Size& rWinSz ) const vcl::Font Window::GetDrawPixelFont(OutputDevice const * pDev) const { - vcl::Font aFont = GetPointFont(*const_cast<Window*>(this)); + vcl::Font aFont = GetPointFont(*GetOutDev()); Size aFontSize = aFont.GetFontSize(); MapMode aPtMapMode(MapUnit::MapPoint); aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode ); @@ -935,12 +934,12 @@ void Window::ImplSetMouseTransparent( bool bTransparent ) Point Window::ImplOutputToFrame( const Point& rPos ) { - return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY ); + return Point( rPos.X()+GetOutDev()->mnOutOffX, rPos.Y()+GetOutDev()->mnOutOffY ); } Point Window::ImplFrameToOutput( const Point& rPos ) { - return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY ); + return Point( rPos.X()-GetOutDev()->mnOutOffX, rPos.Y()-GetOutDev()->mnOutOffY ); } void Window::SetCompoundControl( bool bCompound ) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index c06e8d0eb54b..6640cbbed3ce 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -32,27 +32,253 @@ void Window::ImplAdjustNWFSizes() pWin->ImplAdjustNWFSizes(); } -void Window::ImplClearFontData(bool bNewFontLists) +void WindowOutputDevice::ImplClearFontData(bool bNewFontLists) { OutputDevice::ImplClearFontData(bNewFontLists); - for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext) - pChild->ImplClearFontData(bNewFontLists); + for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild; + pChild = pChild->mpWindowImpl->mpNext) + pChild->GetOutDev()->ImplClearFontData(bNewFontLists); } -void Window::ImplRefreshFontData(bool bNewFontLists) +void WindowOutputDevice::ImplRefreshFontData(bool bNewFontLists) { OutputDevice::ImplRefreshFontData(bNewFontLists); - for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext) - pChild->ImplRefreshFontData(bNewFontLists); + for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild; + pChild = pChild->mpWindowImpl->mpNext) + pChild->GetOutDev()->ImplRefreshFontData(bNewFontLists); } -void Window::ImplInitMapModeObjects() +void WindowOutputDevice::ImplInitMapModeObjects() { OutputDevice::ImplInitMapModeObjects(); - if (mpWindowImpl->mpCursor) - mpWindowImpl->mpCursor->ImplNew(); + if (mxOwnerWindow->mpWindowImpl->mpCursor) + mxOwnerWindow->mpWindowImpl->mpCursor->ImplNew(); } +const Font& Window::GetFont() const { return GetOutDev()->GetFont(); } +void Window::SetFont(Font const& font) { return GetOutDev()->SetFont(font); } + +float Window::approximate_char_width() const { return GetOutDev()->approximate_char_width(); } + +const Wallpaper& Window::GetBackground() const { return GetOutDev()->GetBackground(); } +bool Window::IsBackground() const { return GetOutDev()->IsBackground(); } +tools::Long Window::GetTextHeight() const { return GetOutDev()->GetTextHeight(); } +tools::Long Window::GetTextWidth(const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen, + vcl::TextLayoutCache const* pCache, + SalLayoutGlyphs const* const pLayoutCache) const +{ + return GetOutDev()->GetTextWidth(rStr, nIndex, nLen, pCache, pLayoutCache); +} +float Window::approximate_digit_width() const { return GetOutDev()->approximate_digit_width(); } + +bool Window::IsNativeControlSupported(ControlType nType, ControlPart nPart) const +{ + return GetOutDev()->IsNativeControlSupported(nType, nPart); +} + +bool Window::GetNativeControlRegion(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion) const +{ + return GetOutDev()->GetNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, + rNativeBoundingRegion, rNativeContentRegion); +} + +Size Window::GetOutputSizePixel() const { return GetOutDev()->GetOutputSizePixel(); } + +tools::Rectangle Window::GetOutputRectPixel() const { return GetOutDev()->GetOutputRectPixel(); } + +void Window::SetTextLineColor() { GetOutDev()->SetTextLineColor(); } +void Window::SetTextLineColor(const Color& rColor) { GetOutDev()->SetTextLineColor(rColor); } +void Window::SetOverlineColor() { GetOutDev()->SetOverlineColor(); } +void Window::SetOverlineColor(const Color& rColor) { GetOutDev()->SetOverlineColor(rColor); } +void Window::SetTextFillColor() { GetOutDev()->SetTextFillColor(); } +void Window::SetTextFillColor(const Color& rColor) { GetOutDev()->SetTextFillColor(rColor); } +const MapMode& Window::GetMapMode() const { return GetOutDev()->GetMapMode(); } +void Window::SetBackground() { GetOutDev()->SetBackground(); } +void Window::SetBackground(const Wallpaper& rBackground) +{ + GetOutDev()->SetBackground(rBackground); +} +void Window::EnableMapMode(bool bEnable) { GetOutDev()->EnableMapMode(bEnable); } +bool Window::IsMapModeEnabled() const { return GetOutDev()->IsMapModeEnabled(); } + +void Window::SetTextColor(const Color& rColor) { GetOutDev()->SetTextColor(rColor); } +const Color& Window::GetTextColor() const { return GetOutDev()->GetTextColor(); } +const Color& Window::GetTextLineColor() const { return GetOutDev()->GetTextLineColor(); } + +bool Window::IsTextLineColor() const { return GetOutDev()->IsTextLineColor(); } + +Color Window::GetTextFillColor() const { return GetOutDev()->GetTextFillColor(); } + +bool Window::IsTextFillColor() const { return GetOutDev()->IsTextFillColor(); } + +const Color& Window::GetOverlineColor() const { return GetOutDev()->GetOverlineColor(); } +bool Window::IsOverlineColor() const { return GetOutDev()->IsOverlineColor(); } +void Window::SetTextAlign(TextAlign eAlign) { GetOutDev()->SetTextAlign(eAlign); } + +float Window::GetDPIScaleFactor() const { return GetOutDev()->GetDPIScaleFactor(); } +sal_Int32 Window::GetDPIScalePercentage() const { return GetOutDev()->GetDPIScalePercentage(); } +tools::Long Window::GetOutOffXPixel() const { return GetOutDev()->GetOutOffXPixel(); } +tools::Long Window::GetOutOffYPixel() const { return GetOutDev()->GetOutOffYPixel(); } +void Window::SetOutOffXPixel(tools::Long nOutOffX) +{ + return GetOutDev()->SetOutOffXPixel(nOutOffX); +} +void Window::SetOutOffYPixel(tools::Long nOutOffY) +{ + return GetOutDev()->SetOutOffXPixel(nOutOffY); +} +void Window::SetMapMode() { GetOutDev()->SetMapMode(); } +void Window::SetMapMode(const MapMode& rNewMapMode) { GetOutDev()->SetMapMode(rNewMapMode); } +bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); } +TextAlign Window::GetTextAlign() const { return GetOutDev()->GetTextAlign(); } +const AllSettings& Window::GetSettings() const { return GetOutDev()->GetSettings(); } + +Point Window::LogicToPixel(const Point& rLogicPt) const +{ + return GetOutDev()->LogicToPixel(rLogicPt); +} +Size Window::LogicToPixel(const Size& rLogicSize) const +{ + return GetOutDev()->LogicToPixel(rLogicSize); +} +tools::Rectangle Window::LogicToPixel(const tools::Rectangle& rLogicRect) const +{ + return GetOutDev()->LogicToPixel(rLogicRect); +} +tools::Polygon Window::LogicToPixel(const tools::Polygon& rLogicPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly); +} +tools::PolyPolygon Window::LogicToPixel(const tools::PolyPolygon& rLogicPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly); +} +basegfx::B2DPolyPolygon Window::LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPolyPoly); +} +vcl::Region Window::LogicToPixel(const vcl::Region& rLogicRegion) const +{ + return GetOutDev()->LogicToPixel(rLogicRegion); +} +Point Window::LogicToPixel(const Point& rLogicPt, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPt, rMapMode); +} +Size Window::LogicToPixel(const Size& rLogicSize, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicSize, rMapMode); +} +tools::Rectangle Window::LogicToPixel(const tools::Rectangle& rLogicRect, + const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicRect, rMapMode); +} +tools::Polygon Window::LogicToPixel(const tools::Polygon& rLogicPoly, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly, rMapMode); +} +basegfx::B2DPolyPolygon Window::LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPolyPoly, rMapMode); +} + +Point Window::PixelToLogic(const Point& rDevicePt) const +{ + return GetOutDev()->PixelToLogic(rDevicePt); +} +Size Window::PixelToLogic(const Size& rDeviceSize) const +{ + return GetOutDev()->PixelToLogic(rDeviceSize); +} +tools::Rectangle Window::PixelToLogic(const tools::Rectangle& rDeviceRect) const +{ + return GetOutDev()->PixelToLogic(rDeviceRect); +} +tools::Polygon Window::PixelToLogic(const tools::Polygon& rDevicePoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly); +} +tools::PolyPolygon Window::PixelToLogic(const tools::PolyPolygon& rDevicePolyPoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly); +} +basegfx::B2DPolyPolygon Window::PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly); +} +vcl::Region Window::PixelToLogic(const vcl::Region& rDeviceRegion) const +{ + return GetOutDev()->PixelToLogic(rDeviceRegion); +} +Point Window::PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePt, rMapMode); +} +Size Window::PixelToLogic(const Size& rDeviceSize, const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDeviceSize, rMapMode); +} +tools::Rectangle Window::PixelToLogic(const tools::Rectangle& rDeviceRect, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDeviceRect, rMapMode); +} +tools::Polygon Window::PixelToLogic(const tools::Polygon& rDevicePoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly, rMapMode); +} +basegfx::B2DPolygon Window::PixelToLogic(const basegfx::B2DPolygon& rDevicePoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly, rMapMode); +} +basegfx::B2DPolyPolygon Window::PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly, rMapMode); +} + +Point Window::LogicToLogic(const Point& rPtSource, const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rPtSource, pMapModeSource, pMapModeDest); +} +Size Window::LogicToLogic(const Size& rSzSource, const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rSzSource, pMapModeSource, pMapModeDest); +} +tools::Rectangle Window::LogicToLogic(const tools::Rectangle& rRectSource, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rRectSource, pMapModeSource, pMapModeDest); +} + +tools::Rectangle Window::GetTextRect(const tools::Rectangle& rRect, const OUString& rStr, + DrawTextFlags nStyle, TextRectInfo* pInfo, + const vcl::ITextLayout* _pTextLayout) const +{ + return GetOutDev()->GetTextRect(rRect, rStr, nStyle, pInfo, _pTextLayout); +} + +void Window::SetSettings(const AllSettings& rSettings) { GetOutDev()->SetSettings(rSettings); } +void Window::SetSettings(const AllSettings& rSettings, bool bChild) +{ + static_cast<vcl::WindowOutputDevice*>(GetOutDev())->SetSettings(rSettings, bChild); +} + +Color Window::GetBackgroundColor() const { return GetOutDev()->GetBackgroundColor(); } + +void Window::EnableRTL(bool bEnable) { GetOutDev()->EnableRTL(bEnable); } + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 03c73072c5a5..3ab39d314f05 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -363,7 +363,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent // execute a few tests and catch the message or implement the status if ( pChild ) { - if( pChild->ImplIsAntiparallel() ) + if( pChild->GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pChildWinOutDev = pChild->GetOutDev(); @@ -1033,7 +1033,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, // TipHelp via Keyboard (Shift-F2 or Ctrl-F1) // simulate mouseposition at center of window - Size aSize = pChild->GetOutputSize(); + Size aSize = pChild->GetOutDev()->GetOutputSize(); Point aPos( aSize.getWidth()/2, aSize.getHeight()/2 ); aPos = pChild->OutputToScreenPixel( aPos ); @@ -1258,7 +1258,7 @@ static void ImplHandleExtTextInputPos( vcl::Window* pWindow, else rRect = tools::Rectangle( Point( pChild->GetOutOffXPixel(), pChild->GetOutOffYPixel() ), Size() ); } - rInputWidth = pChild->ImplLogicWidthToDevicePixel( pChild->GetCursorExtTextInputWidth() ); + rInputWidth = pChild->GetOutDev()->ImplLogicWidthToDevicePixel( pChild->GetCursorExtTextInputWidth() ); if ( !rInputWidth ) rInputWidth = rRect.GetWidth(); } @@ -1633,7 +1633,7 @@ static void KillOwnPopups( vcl::Window const * pWindow ) void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight ) { - const bool bChanged = (nNewWidth != pWindow->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutputHeightPixel()); + const bool bChanged = (nNewWidth != pWindow->GetOutDev()->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutDev()->GetOutputHeightPixel()); if (bChanged && pWindow->GetStyle() & (WB_MOVEABLE|WB_SIZEABLE)) { KillOwnPopups( pWindow ); @@ -1648,8 +1648,8 @@ void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long { if (bChanged) { - pWindow->mnOutWidth = nNewWidth; - pWindow->mnOutHeight = nNewHeight; + pWindow->GetOutDev()->mnOutWidth = nNewWidth; + pWindow->GetOutDev()->mnOutHeight = nNewHeight; pWindow->ImplGetWindowImpl()->mbWaitSystemResize = false; if ( pWindow->IsReallyVisible() ) pWindow->ImplSetClipFlag(); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index beaa1d48dbd8..d7066f7a9b90 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -145,7 +145,7 @@ void WorkWindow::ShowFullScreenMode( bool bFullScreenMode, sal_Int32 nDisplayScr // Dispose of the canvas implementation, which might rely on // screen-specific system data. - ImplDisposeCanvas(); + GetOutDev()->ImplDisposeCanvas(); mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = true; ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplayScreen ); diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 62a47b074d2f..544882fe6dc4 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -533,7 +533,7 @@ cairo::SurfaceSharedPtr X11SalGraphics::CreateSurface( const OutputDevice& rRefD int x, int y, int width, int height ) const { if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW ) - return std::make_shared<cairo::X11Surface>(getSysData(static_cast<const vcl::Window&>(rRefDevice)), + return std::make_shared<cairo::X11Surface>(getSysData(*rRefDevice.GetOwnerWindow()), x,y,width,height); if( rRefDevice.IsVirtual() ) return std::make_shared<cairo::X11Surface>(getSysData(static_cast<const VirtualDevice&>(rRefDevice)), @@ -551,7 +551,7 @@ cairo::SurfaceSharedPtr X11SalGraphics::CreateBitmapSurface( const OutputDevice& if ( rData.mnWidth == rSize.Width() && rData.mnHeight == rSize.Height() ) { if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW ) - return std::make_shared<cairo::X11Surface>(getSysData(static_cast<const vcl::Window&>(rRefDevice)), rData ); + return std::make_shared<cairo::X11Surface>(getSysData(*rRefDevice.GetOwnerWindow()), rData ); else if( rRefDevice.IsVirtual() ) return std::make_shared<cairo::X11Surface>(getSysData(static_cast<const VirtualDevice&>(rRefDevice)), rData ); } diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 938ff3a61ab3..2ef7a8ffb02a 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -3492,7 +3492,7 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame) } VclPtr<vcl::Window> pVclParent = pThis->GetWindow()->GetParent(); - if (pVclParent->HasMirroredGraphics() && pVclParent->IsRTLEnabled()) + if (pVclParent->GetOutDev()->HasMirroredGraphics() && pVclParent->IsRTLEnabled()) { swapDirection(rect_anchor); swapDirection(menu_anchor); diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx index ea987186ceb2..ef5db6a8e5c7 100644 --- a/vcl/workben/mtfdemo.cxx +++ b/vcl/workben/mtfdemo.cxx @@ -61,7 +61,7 @@ public: void DemoMtfWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { - maMtf.Play(this, maMtf.GetActionSize()); + maMtf.Play(GetOutDev(), maMtf.GetActionSize()); WorkWindow::Paint(rRenderContext, rRect); } diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 6bab8611149f..988b0d9d164f 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -248,7 +248,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR } rRenderContext.SetFillColor(); - DrawRect(tools::Rectangle(Point(aPaperSize.Width() - 4000, 1000), + rRenderContext.DrawRect(tools::Rectangle(Point(aPaperSize.Width() - 4000, 1000), Size(3000, 3000))); rRenderContext.DrawBitmap(Point(aPaperSize.Width() - 4000, 1000), Size( 3000,3000 ), diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index d4a5defed4e6..45d541c35546 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1983,7 +1983,7 @@ public: rRenderContext.DrawWallpaper(aWholeSize, aWallpaper); rRenderContext.Pop(); - ScopedVclPtrInstance< VirtualDevice > pDev(*this); + ScopedVclPtrInstance< VirtualDevice > pDev(*GetOutDev()); pDev->EnableRTL(IsRTLEnabled()); pDev->SetOutputSizePixel(aExclude.GetSize()); @@ -2027,26 +2027,26 @@ class DemoPopup : public FloatingWindow PaintImmediately(); } - virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle&) override + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override { Size aSize = GetOutputSizePixel(); tools::Rectangle aTextRect(Point(6, 6), aSize); SetTextColor(COL_BLACK); SetTextAlign(ALIGN_TOP); - DrawText(aTextRect, "This is a standalone help text test", + rRenderContext.DrawText(aTextRect, "This is a standalone help text test", DrawTextFlags::MultiLine|DrawTextFlags::WordBreak| DrawTextFlags::Left|DrawTextFlags::Top); - SetLineColor(COL_BLACK); - SetFillColor(); - DrawRect( tools::Rectangle( Point(), aSize ) ); + rRenderContext.SetLineColor(COL_BLACK); + rRenderContext.SetFillColor(); + rRenderContext.DrawRect( tools::Rectangle( Point(), aSize ) ); aSize.AdjustWidth( -2 ); aSize.AdjustHeight( -2 ); - Color aColor( GetLineColor() ); - SetLineColor( COL_GRAY ); - DrawRect( tools::Rectangle( Point( 1, 1 ), aSize ) ); - SetLineColor( aColor ); + Color aColor( rRenderContext.GetLineColor() ); + rRenderContext.SetLineColor( COL_GRAY ); + rRenderContext.DrawRect( tools::Rectangle( Point( 1, 1 ), aSize ) ); + rRenderContext.SetLineColor( aColor ); } virtual void MouseButtonDown( const MouseEvent & ) override |