diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-07-19 08:19:06 +0300 |
---|---|---|
committer | خالد حسني <khaled@libreoffice.org> | 2023-07-23 06:04:17 +0200 |
commit | ecf352701411fe178b51841b5714e27bef500206 (patch) | |
tree | acb0e410e4fca6c50d96f358ac1f950fa5dc37eb /sfx2 | |
parent | 2ce3398d3863114a8f5333a86b76f2520eb7c7d8 (diff) |
vcl: Use GetTextArray() when drawing mnemonics
Instead of using a different function to get the character width, use
the same function used for getting the character widths elsewhere.
Change-Id: I21428f34bb0f3a60fa17f5e8ecc3420545356337
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154609
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/thumbnailviewitem.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index b2c3ef75274b..ca8920acafd2 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -319,10 +319,11 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai { rSeq.resize(nFinalPrimCount + 1); - auto aCaretPositions = aTextDev.getCaretPositions(aText, nLineStart, nLineLength); + auto aTextArray = aTextDev.getTextArray(aText, nLineStart, nLineLength, true); - auto lc_x1 = aCaretPositions[2*(nMnemonicPos - nLineStart)]; - auto lc_x2 = aCaretPositions[2*(nMnemonicPos - nLineStart)+1]; + auto nPos = nMnemonicPos - nLineStart; + auto lc_x1 = nPos ? aTextArray[nPos - 1] : 0; + auto lc_x2 = aTextArray[nPos]; auto fMnemonicWidth = std::abs(lc_x1 - lc_x2); auto fMnemonicHeight = aTextDev.getUnderlineHeight(); |