From 9090dc1f3b27195f5defd35586ac79357992be21 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 18 Jan 2021 18:27:19 +0200 Subject: split OutputDevice from Window as part of a longer-term goal of doing our widget rendering only inside a top-level render- context. I moved all of the OutputDevice-related code that existed in vcl::Window into a new subclass of OutputDevice called WindowOutputDevice. Notes for further work (*) not sure why we are getting an 1x1 surface in SvpSalGraphics::releaseCairoContext, but to fix it I clamp the size there (*) might have to dump VCLXDevice, and move it's code down into VCLXWindow and VCLXVirtualDevice (*) can we remove use of VCLXDevice in other places, in favour of just talking to the VCL code? Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/source/ui/inc/UITools.hxx | 2 +- reportdesign/source/ui/misc/UITools.cxx | 2 +- reportdesign/source/ui/report/DesignView.cxx | 2 +- reportdesign/source/ui/report/EndMarker.cxx | 4 ++-- reportdesign/source/ui/report/FixedTextColor.cxx | 2 +- reportdesign/source/ui/report/FormattedFieldBeautifier.cxx | 2 +- reportdesign/source/ui/report/ReportController.cxx | 6 +++--- reportdesign/source/ui/report/ReportSection.cxx | 2 +- reportdesign/source/ui/report/ScrollHelper.cxx | 2 +- reportdesign/source/ui/report/SectionView.cxx | 4 ++-- reportdesign/source/ui/report/StartMarker.cxx | 2 +- reportdesign/source/ui/report/dlgedfunc.cxx | 8 ++++---- 12 files changed, 19 insertions(+), 19 deletions(-) (limited to 'reportdesign') 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 xControl = pUnoObj->GetUnoControl(aSdrView, aOutputDevice); + uno::Reference 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 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(); -- cgit