summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authornavin <patidar@kacst.edu.sa>2013-02-23 17:58:11 +0300
committerLior Kaplan <kaplanlior@gmail.com>2013-03-14 15:16:55 +0200
commitc1ab08f2559d3996ba595cfbdad287e5a7038f81 (patch)
treed904ff49aefae19536a961c5dc7aa1049c275b3e /editeng
parentc388bdf4d29e282f3ba8152c581a9c8670d7b33d (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> (cherry picked from commit 2738fa9fdc3aec9a64f2eab1d9d48942218c199e) Signed-off-by: Lior Kaplan <kaplanlior@gmail.com>
Diffstat (limited to 'editeng')
-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 4fa52bded5fe..9688e8909c3e 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -950,7 +950,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
{
@@ -984,7 +984,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)
@@ -1001,7 +1001,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;
}
@@ -2099,36 +2099,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: */