[Libreoffice-commits] .: Branch 'libreoffice-3-5' - vcl/source vcl/win

Andras Timar timar at kemper.freedesktop.org
Tue Apr 17 07:55:56 PDT 2012


 vcl/source/window/menu.cxx                   |    5 +++-
 vcl/win/source/gdi/salnativewidgets-luna.cxx |   33 ++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 9 deletions(-)

New commits:
commit 672071c02622c8ad4b9f23f2a5b885cfe7f72669
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Wed Apr 11 21:34:06 2012 +0400

    fdo#42537: fix RTL menu rendering on Windows
    
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 3da96c2..92803a9 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2775,7 +2775,10 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
                             aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2;
 
                             Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) );
-                            MenupopupValue aVal( nTextPos-GUTTERBORDER, Rectangle( aPos, pData->aSz ) );
+                            Size aSz( pData->aSz );
+                            aSz.Width() = aOutSz.Width() - 2*nOuterSpace;
+                            Rectangle aItemRect( aPos, aSz );
+                            MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect );
                             pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart,
                                                      aCheckRect,
                                                      nState,
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index a4f094f..17b8517 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -989,8 +989,16 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
             if( nPart == PART_ENTIRE_CONTROL )
             {
                 RECT aGutterRC = rc;
-                aGutterRC.left += aValue.getNumericVal();
-                aGutterRC.right = aGutterRC.left+3;
+                if( Application::GetSettings().GetLayoutRTL() )
+                {
+                    aGutterRC.right -= aValue.getNumericVal()+1;
+                    aGutterRC.left = aGutterRC.right-3;
+                }
+                else
+                {
+                    aGutterRC.left += aValue.getNumericVal();
+                    aGutterRC.right = aGutterRC.left+3;
+                }
                 return
                 ImplDrawTheme( hTheme, hDC, MENU_POPUPBACKGROUND, 0, rc, aCaption ) &&
                 ImplDrawTheme( hTheme, hDC, MENU_POPUPGUTTER, 0, aGutterRC, aCaption )
@@ -1012,13 +1020,18 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
                     if( aValue.getType() == CTRL_MENU_POPUP )
                     {
                         const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) );
-                        aBGRect.left   = rMVal.maItemRect.Left();
                         aBGRect.top    = rMVal.maItemRect.Top();
                         aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl
-                        aBGRect.right  = rMVal.getNumericVal();
-
-                        // FIXME: magic
-                        aBGRect.left += 1; aBGRect.top += 1; aBGRect.bottom +=1;
+                        if( Application::GetSettings().GetLayoutRTL() )
+                        {
+                            aBGRect.right = rMVal.maItemRect.Right()+1;
+                            aBGRect.left = aBGRect.right - (rMVal.getNumericVal()-rMVal.maItemRect.Left());
+                        }
+                        else
+                        {
+                            aBGRect.right = rMVal.getNumericVal();
+                            aBGRect.left  = rMVal.maItemRect.Left();
+                        }
                     }
                     iState = (nState & CTRL_STATE_ENABLED) ? MCB_NORMAL : MCB_DISABLED;
                     ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, iState, aBGRect, aCaption );
@@ -1033,7 +1046,11 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
             }
             else if( nPart == PART_MENU_SEPARATOR )
             {
-                rc.left += aValue.getNumericVal(); // adjust for gutter position
+                // adjust for gutter position
+                if( Application::GetSettings().GetLayoutRTL() )
+                    rc.right -= aValue.getNumericVal()+1;
+                else
+                    rc.left += aValue.getNumericVal()+1;
                 Rectangle aRect( ImplGetThemeRect( hTheme, hDC,
                     MENU_POPUPSEPARATOR, 0, Rectangle( rc.left, rc.top, rc.right, rc.bottom ) ) );
                 // center the separator inside the passed rectangle


More information about the Libreoffice-commits mailing list