summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornavin <patidar@kacst.edu.sa>2013-02-23 17:58:11 +0300
committerAhmad Harthi <aalharthi@kacst.edu.sa>2013-02-25 10:51:35 +0000
commit2738fa9fdc3aec9a64f2eab1d9d48942218c199e (patch)
treeeb090eff37fbb05b1c3979913927820ea688650b
parent27ff1d2eb970984ace3bff485f41b50ae66af576 (diff)
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@kacst.edu.sa> Tested-by: Ahmad Harthi <aalharthi@kacst.edu.sa>
-rw-r--r--editeng/inc/editeng/outliner.hxx2
-rw-r--r--editeng/source/outliner/outliner.cxx38
2 files changed, 4 insertions, 36 deletions
diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx
index fcc90bb5007b..61e6a411fbe8 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 57a21cfb1283..6294aeaa5af2 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: */