From 588857a86bcbc85e21b70ca95a9ab0c0b782a996 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Thu, 15 Dec 2011 12:02:29 +0100 Subject: fdo#43790: RTL PopupMenu position fixes Fixed the Writer PageBreak and Header/Footer indicator position. It also fixed the popup menu position in RTL UI for all PopupButton instances. --- sw/source/ui/docvw/HeaderFooterWin.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'sw/source/ui/docvw/HeaderFooterWin.cxx') diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index d3ce419bc65b..64e75e456d41 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -223,6 +223,11 @@ void SwHeaderFooterWin::SetOffset( Point aOffset, long nXLineStart, long nXLineE Point aBoxPos( aOffset.X() - aBoxSize.Width() - BOX_DISTANCE, aOffset.Y() - nYFooterOff ); + if ( Application::GetSettings().GetLayoutRTL() ) + { + aBoxPos.setX( aOffset.X() + BOX_DISTANCE ); + } + // Set the position & Size of the window SetPosSizePixel( aBoxPos, aBoxSize ); @@ -284,8 +289,6 @@ void SwHeaderFooterWin::Paint( const Rectangle& ) aSeq[1] = Primitive2DReference( new PolygonHairlinePrimitive2D( aPolygon, aLineColor ) ); - bool bRtl = Application::GetSettings().GetLayoutRTL(); - // Create the text primitive B2DVector aFontSize; FontAttribute aFontAttr = getFontAttributeFromVclFont( @@ -296,11 +299,7 @@ void SwHeaderFooterWin::Paint( const Rectangle& ) FontMetric aFontMetric = GetFontMetric( GetFont() ); double nTextOffsetY = aFontMetric.GetHeight() - aFontMetric.GetDescent() + TEXT_PADDING; - double nTextOffsetX = TEXT_PADDING; - if ( bRtl ) - nTextOffsetX = aRect.GetWidth( ) - aTextRect.GetWidth() - TEXT_PADDING; - - Point aTextPos( nTextOffsetX, nTextOffsetY ); + Point aTextPos( TEXT_PADDING, nTextOffsetY ); basegfx::B2DHomMatrix aTextMatrix( createScaleTranslateB2DHomMatrix( aFontSize.getX(), aFontSize.getY(), @@ -317,11 +316,8 @@ void SwHeaderFooterWin::Paint( const Rectangle& ) // Create the 'plus' or 'arrow' primitive if not readonly if ( !m_bReadonly ) { - double aSignPosX = aRect.Right() - BUTTON_WIDTH; - if ( bRtl ) - aSignPosX = aRect.Left(); - B2DRectangle aSignArea( B2DPoint( aSignPosX, 0.0 ), - B2DSize( aSignPosX + BUTTON_WIDTH, aRect.getHeight() ) ); + B2DRectangle aSignArea( B2DPoint( aRect.Right() - BUTTON_WIDTH, 0.0 ), + B2DSize( aRect.Right(), aRect.getHeight() ) ); B2DPolygon aSign; if ( IsEmptyHeaderFooter( ) ) -- cgit v1.2.3