diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-02-03 19:11:40 +1100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-05 14:59:08 +0000 |
commit | 999a83b455b9db32116203fcc7337f9910d1d5f7 (patch) | |
tree | c3374db9848046dee76c600046af198819bb2bec | |
parent | c11b48d09f8ef31d3ec326e1dfda91a8e384ae81 (diff) |
fdo#74424 Use Window::GetOutDev() to access ImplHasMirroredGraphics()
Part of the decoupling of Window from OutputDevice. We now get
the Window's OutputDevice instance and manipulate this. Do not rely
on the inherited function.
Conflicts:
vcl/source/window/window.cxx
Change-Id: If429486dee4f7cc1e55ca48ab5d715d0c30578a3
Reviewed-on: https://gerrit.libreoffice.org/7794
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/window/dockmgr.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/floatwin.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/status.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 50 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 5 |
5 files changed, 39 insertions, 31 deletions
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 8aee080b850d..4980edbf282a 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -802,7 +802,8 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt ) { // get mouse pos at a static window to have a fixed reference point PointerState aState = GetParent()->GetPointerState(); - if (ImplHasMirroredGraphics() && IsRTLEnabled()) + const OutputDevice *pOutDev = GetOutDev(); + if (pOutDev->ImplHasMirroredGraphics() && IsRTLEnabled()) ImplMirrorFramePos(aState.maPos); maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel(); maDelta = aState.maPos - maTearOffPosition; @@ -827,7 +828,8 @@ void ImplPopupFloatWin::Tracking( const TrackingEvent& rTEvt ) { // move the window according to mouse pos PointerState aState = GetParent()->GetPointerState(); - if (ImplHasMirroredGraphics() && IsRTLEnabled()) + const OutputDevice *pOutDev = GetOutDev(); + if (pOutDev->ImplHasMirroredGraphics() && IsRTLEnabled()) ImplMirrorFramePos(aState.maPos); maTearOffPosition = aState.maPos - maDelta; GetWindow( WINDOW_BORDER )->SetPosPixel( maTearOffPosition ); diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index e01d5f18c31e..60f8d162c5a5 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -457,7 +457,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Poin const OutputDevice *pWindowOutDev = pReference->GetOutDev(); // compare coordinates in absolute screen coordinates - if( pReference->ImplHasMirroredGraphics() ) + if( pWindowOutDev->ImplHasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) // --- RTL --- re-mirror back to get device coordiantes @@ -690,7 +690,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) // compare coordinates in absolute screen coordinates // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 - if( pReference->ImplHasMirroredGraphics() ) + if( pParentWinOutDev->ImplHasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) // --- RTL --- re-mirror back to get device coordiantes diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index c47778923493..cf8794d19975 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -282,7 +282,9 @@ void StatusBar::ImplFormat() nExtraWidth2 = 0; } nX = STATUSBAR_OFFSET_X; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + + const OutputDevice *pOutDev = GetOutDev(); + if( pOutDev->ImplHasMirroredGraphics() && IsRTLEnabled() ) nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; } @@ -481,7 +483,6 @@ void StatusBar::ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDr } const OutputDevice *pOutDev = GetOutDev(); - if ( !pOutDev->ImplIsRecordLayout() ) ImplCallEventListeners( VCLEVENT_STATUSBAR_DRAWITEM, (void*) sal_IntPtr(pItem->mnId) ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 41f7ebeefbf5..3b50e1ec9037 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3338,7 +3338,8 @@ void Window::ImplPosSizeWindow( long nX, long nY, long nOrgX = nX; // --- RTL --- (compare the screen coordinates) Point aPtDev( Point( nX+mnOutOffX, 0 ) ); - if( ImplHasMirroredGraphics() ) + OutputDevice *pOutDev = GetOutDev(); + if( pOutDev->ImplHasMirroredGraphics() ) { mpGraphics->mirror( aPtDev.X(), this ); @@ -7090,25 +7091,29 @@ void Window::setPosSizePixel( long nX, long nY, { // --- RTL --- make sure the old right aligned position is not changed // system windows will always grow to the right - if( pParent && pParent->ImplHasMirroredGraphics() ) + if ( pParent ) { - long myWidth = nOldWidth; - if( !myWidth ) - myWidth = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth; - if( !myWidth ) - myWidth = nWidth; - nFlags |= WINDOW_POSSIZE_X; - nSysFlags |= SAL_FRAME_POSSIZE_X; - nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration; - nX = pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration + - pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX; - if(!(nFlags & WINDOW_POSSIZE_Y)) + OutputDevice *pParentOutDev = pParent->GetOutDev(); + if( pParentOutDev->ImplHasMirroredGraphics() ) { - nFlags |= WINDOW_POSSIZE_Y; - nSysFlags |= SAL_FRAME_POSSIZE_Y; - nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nTopDecoration; + long myWidth = nOldWidth; + if( !myWidth ) + myWidth = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth; + if( !myWidth ) + myWidth = nWidth; + nFlags |= WINDOW_POSSIZE_X; + nSysFlags |= SAL_FRAME_POSSIZE_X; + nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - + mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration; + nX = pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration + + pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX; + if(!(nFlags & WINDOW_POSSIZE_Y)) + { + nFlags |= WINDOW_POSSIZE_Y; + nSysFlags |= SAL_FRAME_POSSIZE_Y; + nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - + mpWindowImpl->mpFrame->GetUnmirroredGeometry().nTopDecoration; + } } } } @@ -7197,7 +7202,8 @@ long Window::ImplGetUnmirroredOutOffX() { // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow long offx = mnOutOffX; - if( ImplHasMirroredGraphics() ) + OutputDevice *pOutDev = GetOutDev(); + if( pOutDev->ImplHasMirroredGraphics() ) { if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) { @@ -7663,14 +7669,13 @@ void Window::EnableChildPointerOverwrite( bool bOverwrite ) void Window::SetPointerPosPixel( const Point& rPos ) { - Point aPos = ImplOutputToFrame( rPos ); - if( ImplHasMirroredGraphics() ) + const OutputDevice *pOutDev = GetOutDev(); + if( pOutDev->ImplHasMirroredGraphics() ) { if( !IsRTLEnabled() ) { // --- RTL --- (re-mirror mouse pos at this window) - const OutputDevice *pOutDev = GetOutDev(); pOutDev->ImplReMirror( aPos ); } // mirroring is required here, SetPointerPos bypasses SalGraphics @@ -7678,7 +7683,6 @@ void Window::SetPointerPosPixel( const Point& rPos ) } else if( ImplIsAntiparallel() ) { - const OutputDevice *pOutDev = GetOutDev(); pOutDev->ImplReMirror( aPos ); } mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() ); diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index a1a625f8fd9f..7fb2cf8092ce 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1025,8 +1025,9 @@ static bool ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, return false; // --- RTL --- mirror cursor keys + const OutputDevice *pChildOutDev = pChild->GetOutDev(); if( (aKeyCode.GetCode() == KEY_LEFT || aKeyCode.GetCode() == KEY_RIGHT) && - pChild->ImplHasMirroredGraphics() && pChild->IsRTLEnabled() ) + pChildOutDev->ImplHasMirroredGraphics() && pChild->IsRTLEnabled() ) aKeyCode = KeyCode( aKeyCode.GetCode() == KEY_LEFT ? KEY_RIGHT : KEY_LEFT, aKeyCode.GetModifier() ); // call handler @@ -2319,7 +2320,7 @@ static void ImplHandleSalQueryCharPosition( Window *pWindow, ImplWinData* pWinData = pChild->ImplGetWinData(); if ( pWinData->mpCompositionCharRects && pEvt->mnCharPos < static_cast<sal_uLong>( pWinData->mnCompositionCharRects ) ) { - OutputDevice *pChildOutDev = pChild->GetOutDev(); + const OutputDevice *pChildOutDev = pChild->GetOutDev(); const Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ]; Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect ); Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) ); |