summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2016-12-10 11:23:38 +0000
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-12-10 12:44:42 +0000
commit8d52045853cecb716138d51b8b6ad0272a86af86 (patch)
tree1f53755d1db21f5237b5d2e92b07055da53b9fe5 /vcl
parent289124284f98bbea442871455cf7da5fe9ef3aae (diff)
tdf#93430: Return the right offsets for runs
MultiLineEdit is a special control which can have more text portions with different text attributes. Change-Id: Iab51dba0d0344fad4358f4961c968c031b1660b6 Reviewed-on: https://gerrit.libreoffice.org/31813 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/edit/texteng.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index a631effaeea8..f1f8992d621b 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1211,6 +1211,26 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_I
return nWidth;
}
+void TextEngine::GetTextPortionRange(const TextPaM& rPaM, sal_Int32& nStart, sal_Int32& nEnd)
+{
+ nStart = 0;
+ nEnd = 0;
+ TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( rPaM.GetPara() );
+ for ( size_t i = 0; i < pParaPortion->GetTextPortions().size(); ++i )
+ {
+ TETextPortion* pTextPortion = pParaPortion->GetTextPortions()[ i ];
+ if (nStart + pTextPortion->GetLen() > rPaM.GetIndex())
+ {
+ nEnd = nStart + pTextPortion->GetLen();
+ return;
+ }
+ else
+ {
+ nStart += pTextPortion->GetLen();
+ }
+ }
+}
+
sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const
{
SAL_WARN_IF( nParagraph >= mpTEParaPortions->Count(), "vcl", "GetLineCount: Out of range" );