[Libreoffice-commits] core.git: sw/source
Mark Hung
marklh9 at gmail.com
Sat Apr 7 07:38:38 UTC 2018
sw/source/core/text/itrcrsr.cxx | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit a0bcbf72614344639235a46d1cc81483f93a3d61
Author: Mark Hung <marklh9 at gmail.com>
Date: Sun Apr 1 19:33:00 2018 +0800
tdf#116182: correct the index before using CalcSpacing.
Keep the index of pLastBidiPor when it is set,
then correct the index before invoking pLastBidiPor->CalSpacing,
otherwise we are invoking CalSpacing with SwTextSizeInfo that
has incorrect index.
Change-Id: Ifd6b598ea3c860dcf61fb2c47029ef8c1c912dd1
Reviewed-on: https://gerrit.libreoffice.org/52222
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 4abf0cb7a153..750492f7e83e 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -502,6 +502,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, const sal_Int32 nOfst,
SwTwips nTmpFirst = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
SwBidiPortion* pLastBidiPor = nullptr;
+ sal_Int32 nLastBidiIdx = -1;
SwTwips nLastBidiPorWidth = 0;
std::deque<sal_uInt16>* pKanaComp = m_pCurr->GetpKanaComp();
sal_uInt16 nSpaceIdx = 0;
@@ -646,6 +647,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, const sal_Int32 nOfst,
aInf.GetIdx() + pPor->GetLen() == nOfst )
{
pLastBidiPor = static_cast<SwBidiPortion*>(pPor);
+ nLastBidiIdx = aInf.GetIdx();
nLastBidiPorWidth = pLastBidiPor->Width() +
pLastBidiPor->CalcSpacing( nSpaceAdd, aInf );
}
@@ -1122,8 +1124,12 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, const sal_Int32 nOfst,
{
OSL_ENSURE( static_cast<const SwMultiPortion*>(pLast)->IsBidi(),
"Non-BidiPortion inside BidiPortion" );
+ sal_Int32 nIdx = aInf.GetIdx();
+ // correct the index before using CalcSpacing.
+ aInf.SetIdx(nLastBidiIdx);
pOrig->Pos().AdjustX(pLast->Width() +
pLast->CalcSpacing( nSpaceAdd, aInf ) );
+ aInf.SetIdx(nIdx);
}
}
}
More information about the Libreoffice-commits
mailing list