[Libreoffice-commits] core.git: editeng/inc editeng/source

navin patidar at kacst.edu.sa
Mon Feb 25 02:51:54 PST 2013


 editeng/inc/editeng/outliner.hxx     |    2 -
 editeng/source/outliner/outliner.cxx |   38 ++---------------------------------
 2 files changed, 4 insertions(+), 36 deletions(-)

New commits:
commit 2738fa9fdc3aec9a64f2eab1d9d48942218c199e
Author: navin <patidar at kacst.edu.sa>
Date:   Sat Feb 23 17:58:11 2013 +0300

    fix fdo#38951, use paragraph’s writing direction.
    
    In case of RTL, we want bullet text e.g. “1. ,1)” to be reversed
    e.g. “.1,(1”, so we need to check only paragraph’s writing direction
    and pass that direction to DrawingText().
    and fix drawing position calculation logic.
    
    Change-Id: I303dc1b04ae5e66b1b5d25a40794be308f36668b
    Reviewed-on: https://gerrit.libreoffice.org/2348
    Reviewed-by: Ahmad Harthi <aalharthi at kacst.edu.sa>
    Tested-by: Ahmad Harthi <aalharthi at kacst.edu.sa>

diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx
index fcc90bb..61e6a41 100644
--- a/editeng/inc/editeng/outliner.hxx
+++ b/editeng/inc/editeng/outliner.hxx
@@ -389,7 +389,7 @@ public:
     unsigned            mbEndOfBullet : 1;
 
     sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
-    sal_Bool IsRTL() const;
+    sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; }
 
     DrawPortionInfo(
         const Point& rPos,
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 57a21cf..6294aea 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -946,7 +946,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
                     if ( !bRightToLeftPara )
                         aTextPos.X() = rStartPos.X() + aBulletArea.Left();
                     else
-                        aTextPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left();
+                        aTextPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right();
                 }
                 else
                 {
@@ -980,7 +980,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
                 sal_uLong nLayoutMode = pOutDev->GetLayoutMode();
                 nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG);
                 if ( bRightToLeftPara )
-                    nLayoutMode |= TEXT_LAYOUT_BIDI_RTL;
+                    nLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT;
                 pOutDev->SetLayoutMode( nLayoutMode );
 
                 if(bStrippingPortions)
@@ -997,7 +997,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
                     }
 
                     DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), pBuf,
-                        aSvxFont, nPara, 0xFFFF, 0xFF, 0, 0, false, false, true, 0, Color(), Color());
+                        aSvxFont, nPara, 0xFFFF, bRightToLeftPara, 0, 0, false, false, true, 0, Color(), Color());
 
                     delete[] pBuf;
                 }
@@ -2095,36 +2095,4 @@ bool Outliner::HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const
     return pPara && pPara->HasFlag( nFlag );
 }
 
-
-sal_Bool DrawPortionInfo::IsRTL() const
-{
-    if(0xFF == mnBiDiLevel)
-    {
-        // Use Bidi functions from icu 2.0 to calculate if this portion
-        // is RTL or not.
-        UErrorCode nError(U_ZERO_ERROR);
-        UBiDi* pBidi = ubidi_openSized(mrText.Len(), 0, &nError);
-        nError = U_ZERO_ERROR;
-
-        // I do not have this info here. Is it necessary? I'll have to ask MT.
-        const sal_uInt8 nDefaultDir = UBIDI_LTR; //IsRightToLeft( nPara ) ? UBIDI_RTL : UBIDI_LTR;
-
-        ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(mrText.GetBuffer()), mrText.Len(), nDefaultDir, NULL, &nError);    // UChar != sal_Unicode in MinGW
-        nError = U_ZERO_ERROR;
-
-        int32_t nStart(0);
-        int32_t nEnd;
-        UBiDiLevel nCurrDir;
-
-        ubidi_getLogicalRun(pBidi, nStart, &nEnd, &nCurrDir);
-
-        ubidi_close(pBidi);
-
-        // remember on-demand calculated state
-        ((DrawPortionInfo*)this)->mnBiDiLevel = nCurrDir;
-    }
-
-    return (1 == (mnBiDiLevel % 2));
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list