[Libreoffice-commits] .: sdext/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 02:53:53 PST 2012


 sdext/source/presenter/PresenterHelpView.cxx |  106 ++++++++++++++++++---------
 1 file changed, 73 insertions(+), 33 deletions(-)

New commits:
commit a77fa7ee84424a5844d836e83978ab0197716bef
Author: Faisal M. Al-Otaibi <fmalotaibi at kacst.edu.sa>
Date:   Wed Dec 12 10:34:19 2012 +0300

    fdo#57422 - presenter console RTL support needs completion
    
    This patch will fix the RTL layout on Help view
    
    Change-Id: I1cba5691649a0494efb9db63b8292525ff0c3656
    Reviewed-on: https://gerrit.libreoffice.org/1302
    Reviewed-by: Michael Meeks <michael.meeks at suse.com>
    Tested-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx
index ee6729f..25308b4 100644
--- a/sdext/source/presenter/PresenterHelpView.cxx
+++ b/sdext/source/presenter/PresenterHelpView.cxx
@@ -16,7 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
+#include "vcl/svapp.hxx"
 #include "PresenterHelpView.hxx"
 #include "PresenterButton.hxx"
 #include "PresenterCanvasHelper.hxx"
@@ -311,29 +311,59 @@ void PresenterHelpView::Paint (const awt::Rectangle& rUpdateBox)
     TextContainer::const_iterator iBlockEnd (mpTextContainer->end());
     for ( ; iBlock!=iBlockEnd; ++iBlock)
     {
-        const double nLeftHeight (
-            (*iBlock)->maLeft.Paint(mxCanvas,
-                geometry::RealRectangle2D(
-                    gnHorizontalGap,
-                    nY,
-                    aWindowBox.Width/2 - gnHorizontalGap,
-                    aWindowBox.Height - gnVerticalBorder),
-                false,
-                aViewState,
-                aRenderState,
-                mpFont->mxFont));
-        const double nRightHeight (
-            (*iBlock)->maRight.Paint(mxCanvas,
-                geometry::RealRectangle2D(
-                    aWindowBox.Width/2 + gnHorizontalGap,
-                    nY,
-                    aWindowBox.Width - gnHorizontalGap,
-                    aWindowBox.Height - gnVerticalBorder),
-                true,
-                aViewState,
-                aRenderState,
-                mpFont->mxFont));
-        nY += ::std::max(nLeftHeight,nRightHeight);
+        /// check whether RTL interface or not
+        if(!Application::GetSettings().GetLayoutRTL())
+        {
+            const double nLeftHeight (
+                (*iBlock)->maLeft.Paint(mxCanvas,
+                    geometry::RealRectangle2D(
+                        gnHorizontalGap,
+                        nY,
+                        aWindowBox.Width/2 - gnHorizontalGap,
+                        aWindowBox.Height - gnVerticalBorder),
+                    false,
+                    aViewState,
+                    aRenderState,
+                    mpFont->mxFont));
+            const double nRightHeight (
+                (*iBlock)->maRight.Paint(mxCanvas,
+                    geometry::RealRectangle2D(
+                        aWindowBox.Width/2 + gnHorizontalGap,
+                        nY,
+                        aWindowBox.Width - gnHorizontalGap,
+                        aWindowBox.Height - gnVerticalBorder),
+                    true,
+                    aViewState,
+                    aRenderState,
+                    mpFont->mxFont));
+            nY += ::std::max(nLeftHeight,nRightHeight);
+        }
+        else
+        {
+            const double nLeftHeight (
+                (*iBlock)->maLeft.Paint(mxCanvas,
+                    geometry::RealRectangle2D(
+                        aWindowBox.Width/2 + gnHorizontalGap,
+                        nY,
+                        aWindowBox.Width - gnHorizontalGap,
+                        aWindowBox.Height - gnVerticalBorder),
+                    false,
+                    aViewState,
+                    aRenderState,
+                    mpFont->mxFont));
+            const double nRightHeight (
+                (*iBlock)->maRight.Paint(mxCanvas,
+                    geometry::RealRectangle2D(
+                        gnHorizontalGap,
+                        nY,
+                        aWindowBox.Width/2 - gnHorizontalGap,
+                        aWindowBox.Height - gnVerticalBorder),
+                    true,
+                    aViewState,
+                    aRenderState,
+                    mpFont->mxFont));
+            nY += ::std::max(nLeftHeight,nRightHeight);
+        }
     }
 
     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY);
@@ -567,20 +597,30 @@ double LineDescriptorList::Paint(
     vector<LineDescriptor>::const_iterator iEnd (mpLineDescriptors->end());
     for ( ; iLine!=iEnd; ++iLine)
     {
-        double nX (rBBox.X1);
-        if ( ! bFlushLeft)
-            nX = rBBox.X2 - iLine->maSize.Width;
+        double nX;
+        /// check whether RTL interface or not
+        if(!Application::GetSettings().GetLayoutRTL())
+        {
+            nX = rBBox.X1;
+            if ( ! bFlushLeft)
+                nX = rBBox.X2 - iLine->maSize.Width;
+        }
+        else
+        {
+            nX=rBBox.X2 - iLine->maSize.Width;
+            if ( ! bFlushLeft)
+                nX = rBBox.X1;
+        }
         rRenderState.AffineTransform.m02 = nX;
         rRenderState.AffineTransform.m12 = nY + iLine->maSize.Height - iLine->mnVerticalOffset;
 
         const rendering::StringContext aContext (iLine->msLine, 0, iLine->msLine.getLength());
-
-        rxCanvas->drawText (
-            aContext,
-            rxFont,
+        Reference<rendering::XTextLayout> xLayout (
+        rxFont->createTextLayout(aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 0));
+        rxCanvas->drawTextLayout (
+            xLayout,
             rViewState,
-            rRenderState,
-            rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
+            rRenderState);
 
         nY += iLine->maSize.Height * 1.2;
     }


More information about the Libreoffice-commits mailing list