diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-01-18 18:27:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-17 12:56:51 +0200 |
commit | 9090dc1f3b27195f5defd35586ac79357992be21 (patch) | |
tree | d39f4b624ae337d5c9ce76eba8521b76e53afa05 /vcl/source/window | |
parent | c8cf2e0e088b74afa52564945a9c005b3b86bf7e (diff) |
split OutputDevice from Window
as part of a longer-term goal of doing our
widget rendering only inside a top-level render-
context.
I moved all of the OutputDevice-related code that existed in vcl::Window
into a new subclass of OutputDevice called WindowOutputDevice.
Notes for further work
(*) not sure why we are getting an 1x1 surface in
SvpSalGraphics::releaseCairoContext, but to fix it I clamp
the size there
(*) might have to dump VCLXDevice, and move it's code down into VCLXWindow and VCLXVirtualDevice
(*) can we remove use of VCLXDevice in other places, in favour of just talking to the VCL code?
Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window')
31 files changed, 685 insertions, 412 deletions
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 ); |