[Libreoffice-commits] core.git: vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Wed Feb 5 06:24:44 PST 2014


 vcl/source/control/ilstbox.cxx |    7 +++-
 vcl/source/window/dndevdis.cxx |    5 ++-
 vcl/source/window/floatwin.cxx |    7 +++-
 vcl/source/window/window.cxx   |   65 ++++++++++++++++++++++++++---------------
 vcl/source/window/window2.cxx  |    6 ++-
 vcl/source/window/winproc.cxx  |    3 +
 6 files changed, 62 insertions(+), 31 deletions(-)

New commits:
commit fba46c6efd08d50fee92cc11546f3ed253a57af8
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Feb 3 16:46:04 2014 +1100

    fdo#74424 Use Window::GetOutDev() to access ImplReMirrored()
    
    Part of the decoupling of Window from OutputDevice. We now get
    he Window's OutputDevice instance and manipulate this. Do not rely
    on the inherited function.
    
    Conflicts:
    	include/vcl/window.hxx
    
    Change-Id: Ie422df837e1596881b61d34a1627b0ecc668a54e
    Reviewed-on: https://gerrit.libreoffice.org/7793
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index c72a294..4b07372 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -3265,8 +3265,11 @@ void ImplListBoxFloatingWindow::StartFloat( sal_Bool bStartTracking )
         // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI
         // where the document is unmirrored
         // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror
-        if( GetParent()->GetParent()->ImplIsAntiparallel() )
-            GetParent()->GetParent()->ImplReMirror( aRect );
+        Window *pGrandparent = GetParent()->GetParent();
+        const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev();
+
+        if( pGrandparent->ImplIsAntiparallel() )
+            pGrandparentOutDev->ImplReMirror( aRect );
 
         StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN );
 
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx
index 74101c6..e278e95 100644
--- a/vcl/source/window/dndevdis.cxx
+++ b/vcl/source/window/dndevdis.cxx
@@ -67,7 +67,10 @@ Window* DNDEventDispatcher::findTopLevelWindow(Point location)
         pChildWindow = pChildWindow->ImplGetClientWindow();
 
     if( pChildWindow->ImplIsAntiparallel() )
-        pChildWindow->ImplReMirror( location );
+    {
+        const OutputDevice *pChildWinOutDev = pChildWindow->GetOutDev();
+        pChildWinOutDev->ImplReMirror( location );
+    }
 
     return pChildWindow;
 }
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 8f614f3..e01d5f1 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -454,12 +454,14 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Poin
 
     Point aAbsolute( rPos );
 
+    const OutputDevice *pWindowOutDev = pReference->GetOutDev();
+
     // compare coordinates in absolute screen coordinates
     if( pReference->ImplHasMirroredGraphics()  )
     {
         if(!pReference->IsRTLEnabled() )
             // --- RTL --- re-mirror back to get device coordiantes
-            pReference->ImplReMirror( aAbsolute );
+            pWindowOutDev->ImplReMirror( aAbsolute );
 
         Rectangle aRect( pReference->ScreenToOutputPixel(aAbsolute), Size(1,1) ) ;
         aRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect );
@@ -684,6 +686,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags )
     maFloatRect             = rRect;
 
     Window *pReference =  GetParent();
+    const OutputDevice *pParentWinOutDev = pReference->GetOutDev();
 
     // compare coordinates in absolute screen coordinates
     // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509
@@ -691,7 +694,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags )
     {
         if(!pReference->IsRTLEnabled() )
             // --- RTL --- re-mirror back to get device coordiantes
-            pReference->ImplReMirror(maFloatRect);
+            pParentWinOutDev->ImplReMirror(maFloatRect);
 
         maFloatRect.SetPos(pReference->ScreenToOutputPixel(maFloatRect.TopLeft()));
         maFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(maFloatRect);
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index a836fc5..0833331 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1452,7 +1452,8 @@ sal_uInt16 Window::ImplHitTest( const Point& rFramePos )
     if( ImplIsAntiparallel() )
     {
         // - RTL - re-mirror frame pos at this window
-        ImplReMirror( aFramePos );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aFramePos );
     }
     Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
     if ( !aRect.IsInside( aFramePos ) )
@@ -2463,8 +2464,9 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
             // - RTL - re-mirror paint rect and region at this window
             if( ImplIsAntiparallel() )
             {
-                ImplReMirror( aPaintRect );
-                ImplReMirror( aPaintRegion );
+                const OutputDevice *pOutDev = GetOutDev();
+                pOutDev->ImplReMirror( aPaintRect );
+                pOutDev->ImplReMirror( aPaintRegion );
             }
             aPaintRect = ImplDevicePixelToLogic( aPaintRect);
             mpWindowImpl->mpPaintRegion = &aPaintRegion;
@@ -2761,8 +2763,10 @@ void Window::ImplInvalidate( const Region* pRegion, sal_uInt16 nFlags )
             // --- RTL --- remirror region before intersecting it
             if ( ImplIsAntiparallel() )
             {
+                const OutputDevice *pOutDev = GetOutDev();
+
                 Region aRgn( *pRegion );
-                ImplReMirror( aRgn );
+                pOutDev->ImplReMirror( aRgn );
                 aRegion.Intersect( aRgn );
             }
             else
@@ -2985,7 +2989,8 @@ void Window::ImplScroll( const Rectangle& rRect,
     {
         // --- RTL --- make sure the invalidate region of this window is
         // computed in the same coordinate space as the one from the overlap windows
-        ImplReMirror( aRectMirror );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aRectMirror );
     }
 
     // adapt paint areas
@@ -3051,7 +3056,8 @@ void Window::ImplScroll( const Rectangle& rRect,
             if( bReMirror )
             {
                 // --- RTL --- frame coordinates require re-mirroring
-                ImplReMirror( aRegion );
+                const OutputDevice *pOutDev = GetOutDev();
+                pOutDev->ImplReMirror( aRegion );
             }
 
             ImplSelectClipRegion( aRegion, pGraphics );
@@ -5970,7 +5976,10 @@ Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const
         aWinClipRegion = *pWinChildClipRegion;
         // --- RTL --- remirror clip region before passing it to somebody
         if( ImplIsAntiparallel() )
-            ImplReMirror( aWinClipRegion );
+        {
+            const OutputDevice *pOutDev = GetOutDev();
+            pOutDev->ImplReMirror( aWinClipRegion );
+        }
     }
 
     if ( nFlags & WINDOW_GETCLIPREGION_NULL )
@@ -6017,7 +6026,11 @@ void Window::ExpandPaintClipRegion( const Region& rRegion )
         Region aWinChildRegion = *ImplGetWinChildClipRegion();
         // --- RTL -- only this region is in frame coordinates, so re-mirror it
         if( ImplIsAntiparallel() )
-            ImplReMirror( aWinChildRegion );
+        {
+            const OutputDevice *pOutDev = GetOutDev();
+            pOutDev->ImplReMirror( aWinChildRegion );
+        }
+
         aDevPixRegion.Intersect( aWinChildRegion );
         if( ! aDevPixRegion.IsEmpty() )
         {
@@ -7038,6 +7051,8 @@ void Window::setPosSizePixel( long nX, long nY,
 
 
         sal_uInt16 nSysFlags=0;
+        Window *pParent = GetParent();
+
         if( nFlags & WINDOW_POSSIZE_WIDTH )
             nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
         if( nFlags & WINDOW_POSSIZE_HEIGHT )
@@ -7045,16 +7060,16 @@ void Window::setPosSizePixel( long nX, long nY,
         if( nFlags & WINDOW_POSSIZE_X )
         {
             nSysFlags |= SAL_FRAME_POSSIZE_X;
-            if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
+            if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
             {
-                Window* pParent = pWindow->GetParent();
                 nX += pParent->mnOutOffX;
             }
-            if( GetParent() && GetParent()->ImplIsAntiparallel() )
+            if( pParent && pParent->ImplIsAntiparallel() )
             {
                 // --- RTL --- (re-mirror at parent window)
                 Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) );
-                GetParent()->ImplReMirror( aRect );
+                const OutputDevice *pParentOutDev = pParent->GetOutDev();
+                pParentOutDev->ImplReMirror( aRect );
                 nX = aRect.Left();
             }
         }
@@ -7062,7 +7077,7 @@ 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( pWindow->GetParent() && pWindow->GetParent()->ImplHasMirroredGraphics() )
+            if( pParent && pParent->ImplHasMirroredGraphics() )
             {
                 long myWidth = nOldWidth;
                 if( !myWidth )
@@ -7071,10 +7086,10 @@ void Window::setPosSizePixel( long nX, long nY,
                     myWidth = nWidth;
                 nFlags |= WINDOW_POSSIZE_X;
                 nSysFlags |= SAL_FRAME_POSSIZE_X;
-                nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX -
+                nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX -
                     mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration;
-                nX = pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
-                    pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
+                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;
@@ -7087,9 +7102,8 @@ void Window::setPosSizePixel( long nX, long nY,
         if( nFlags & WINDOW_POSSIZE_Y )
         {
             nSysFlags |= SAL_FRAME_POSSIZE_Y;
-            if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
+            if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
             {
-                Window* pParent = pWindow->GetParent();
                 nY += pParent->mnOutOffY;
             }
         }
@@ -7640,14 +7654,16 @@ void Window::SetPointerPosPixel( const Point& rPos )
         if( !IsRTLEnabled() )
         {
             // --- RTL --- (re-mirror mouse pos at this window)
-            ImplReMirror( aPos );
+            const OutputDevice *pOutDev = GetOutDev();
+            pOutDev->ImplReMirror( aPos );
         }
         // mirroring is required here, SetPointerPos bypasses SalGraphics
         mpGraphics->mirror( aPos.X(), this );
     }
     else if( ImplIsAntiparallel() )
     {
-        ImplReMirror( aPos );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aPos );
     }
     mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() );
 }
@@ -7661,7 +7677,8 @@ Point Window::GetPointerPosPixel()
     if( ImplIsAntiparallel() )
     {
         // --- RTL --- (re-mirror mouse pos at this window)
-        ImplReMirror( aPos );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aPos );
     }
     return ImplFrameToOutput( aPos );
 }
@@ -7675,7 +7692,8 @@ Point Window::GetLastPointerPosPixel()
     if( ImplIsAntiparallel() )
     {
         // --- RTL --- (re-mirror mouse pos at this window)
-        ImplReMirror( aPos );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aPos );
     }
     return ImplFrameToOutput( aPos );
 }
@@ -7710,7 +7728,8 @@ Window::PointerState Window::GetPointerState()
         if( ImplIsAntiparallel() )
         {
             // --- RTL --- (re-mirror mouse pos at this window)
-            ImplReMirror( aSalPointerState.maPos );
+            const OutputDevice *pOutDev = GetOutDev();
+            pOutDev->ImplReMirror( aSalPointerState.maPos );
         }
         aState.maPos = ImplFrameToOutput( aSalPointerState.maPos );
         aState.mnState = aSalPointerState.mnState;
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 37aaa82..ecbd0d6 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -611,7 +611,8 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer )
     if( ImplIsAntiparallel() )
     {
         // - RTL - re-mirror frame pos at pChild
-        ImplReMirror( aMousePos );
+        const OutputDevice *pOutDev = GetOutDev();
+        pOutDev->ImplReMirror( aMousePos );
     }
     MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
                            mpWindowImpl->mpFrameData->mnClickCount, 0,
@@ -681,7 +682,8 @@ void Window::EndTracking( sal_uInt16 nFlags )
             if( ImplIsAntiparallel() )
             {
                 // - RTL - re-mirror frame pos at pChild
-                ImplReMirror( aMousePos );
+                const OutputDevice *pOutDev = GetOutDev();
+                pOutDev->ImplReMirror( aMousePos );
             }
 
             MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index f494b5a..7d68061 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -386,7 +386,8 @@ bool ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse
         if( pChild->ImplIsAntiparallel() )
         {
             // - RTL - re-mirror frame pos at pChild
-            pChild->ImplReMirror( aMousePos );
+            const OutputDevice *pChildWinOutDev = pChild->GetOutDev();
+            pChildWinOutDev->ImplReMirror( aMousePos );
         }
         // no mouse messages to system object windows ?
         // !!!KA: Is it OK to comment this out? !!!


More information about the Libreoffice-commits mailing list