diff options
Diffstat (limited to 'vcl/source/edit/texteng.cxx')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index df1de5bf900a..1a91f99ec2b7 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1223,6 +1223,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 { DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); |