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

Chris Sherlock chris.sherlock79 at gmail.com
Wed Feb 5 06:59:36 PST 2014


 vcl/source/window/dockmgr.cxx  |    6 +++-
 vcl/source/window/floatwin.cxx |    4 +--
 vcl/source/window/status.cxx   |    5 ++--
 vcl/source/window/window.cxx   |   50 ++++++++++++++++++++++-------------------
 vcl/source/window/winproc.cxx  |    5 ++--
 5 files changed, 39 insertions(+), 31 deletions(-)

New commits:
commit 999a83b455b9db32116203fcc7337f9910d1d5f7
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Feb 3 19:11:40 2014 +1100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 8aee080..4980edb 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 e01d5f1..60f8d16 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 c477789..cf8794d 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 41f7ebe..3b50e1e 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 a1a625f..7fb2cf8 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()) );


More information about the Libreoffice-commits mailing list