summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2011-12-15 12:02:29 +0100
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2011-12-16 16:53:13 +0100
commitf6b679e831ebf4a85b3baf37ea0198959f58fa1f (patch)
tree477e103c012ca69ba62c161ecf35671697adf96b /sw
parent8cb10ca24623d9c12185c62c9eda5e03a673d94a (diff)
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.
Diffstat (limited to 'sw')
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/ui/docvw/HeaderFooterWin.cxx20
-rw-r--r--sw/source/ui/docvw/PageBreakWin.cxx16
3 files changed, 22 insertions, 18 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ec104f5ce274..c33da2817166 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3470,6 +3470,8 @@ void SwPageFrm::PaintDecorators( ) const
!pGlobalShell->IsPreView() &&
pGlobalShell->IsShowHeaderFooterSeparator( ) )
{
+ bool bRtl = Application::GetSettings().GetLayoutRTL();
+
// Header
const SwFrm* pHeaderFrm = Lower();
if ( !pHeaderFrm->IsHeaderFrm() )
@@ -3477,6 +3479,8 @@ void SwPageFrm::PaintDecorators( ) const
const SwRect& rVisArea = pGlobalShell->VisArea();
long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() );
+ if ( bRtl )
+ nXOff = std::max( aBodyRect.Left(), rVisArea.Left() );
long nHeaderYOff = aBodyRect.Top();
Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) );
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( ) )
diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx
index 2194bd92dba4..9279c00c8a07 100644
--- a/sw/source/ui/docvw/PageBreakWin.cxx
+++ b/sw/source/ui/docvw/PageBreakWin.cxx
@@ -68,7 +68,7 @@ using namespace drawinglayer::primitive2d;
namespace
{
- B2DPolygon lcl_CreatePolygon( B2DRectangle aBounds, bool bShowOnRight )
+ B2DPolygon lcl_CreatePolygon( B2DRectangle aBounds, bool bMirror )
{
B2DPolygon aRetval;
const double nRadius = 1;
@@ -144,7 +144,7 @@ namespace
aRetval.setClosed( true );
- if ( bShowOnRight )
+ if ( bMirror )
{
B2DHomMatrix bRotMatrix = createRotateAroundPoint(
aBounds.getCenterX(), aBounds.getCenterY(), M_PI );
@@ -233,11 +233,13 @@ void SwPageBreakWin::Paint( const Rectangle& )
}
bool bShowOnRight = ShowOnRight( );
+ bool bRtl = Application::GetSettings().GetLayoutRTL();
Primitive2DSequence aSeq( 3 );
B2DRectangle aBRect( double( aRect.Left() ), double( aRect.Top( ) ),
double( aRect.Right() ), double( aRect.Bottom( ) ) );
- B2DPolygon aPolygon = lcl_CreatePolygon( aBRect, bShowOnRight );
+ bool bMirror = ( bShowOnRight && !bRtl ) || ( !bShowOnRight && bRtl );
+ B2DPolygon aPolygon = lcl_CreatePolygon( aBRect, bMirror );
// Create the polygon primitives
aSeq[0] = Primitive2DReference( new PolyPolygonColorPrimitive2D(
@@ -248,7 +250,7 @@ void SwPageBreakWin::Paint( const Rectangle& )
// Create the primitive for the image
Image aImg( SW_RES( IMG_PAGE_BREAK ) );
double nImgOfstX = 3.0;
- if ( bShowOnRight )
+ if ( bMirror )
nImgOfstX = aRect.Right() - aImg.GetSizePixel().Width() - 3.0;
aSeq[2] = Primitive2DReference( new DiscreteBitmapPrimitive2D(
aImg.GetBitmapEx(), B2DPoint( nImgOfstX, 1.0 ) ) );
@@ -259,7 +261,7 @@ void SwPageBreakWin::Paint( const Rectangle& )
double nTop = double( aRect.getHeight() ) / 2.0;
double nBottom = nTop + 4.0;
double nLeft = aRect.getWidth( ) - ARROW_WIDTH - 6.0;
- if ( bShowOnRight )
+ if ( bMirror )
nLeft = ARROW_WIDTH - 2.0;
double nRight = nLeft + 8.0;
@@ -403,7 +405,9 @@ bool SwPageBreakWin::ShowOnRight( )
if ( bBookMode )
bOnRight = GetPageFrame()->SidebarPosition( ) == sw::sidebarwindows::SIDEBAR_RIGHT;
- // TODO Handle the RTL case
+ // Handle the RTL case
+ if ( !bBookMode && Application::GetSettings().GetLayoutRTL() )
+ bOnRight = !bOnRight;
return bOnRight;
}