editeng/source/editeng/impedit2.cxx |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 1d1931b8904f1ed678c03a94ddbd91cc49dd9f81
Author:     Attila Szűcs <[email protected]>
AuthorDate: Mon Feb 23 23:06:59 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Wed Feb 25 08:08:27 2026 +0100

    tdf#159861 editeng: fix height of multiline hyperlinks
    
    Fixed the height calcualtion of paraportions.
    Wiothout it smaller bounding box size was calculated,
    and the text was outside of the box.
    This could cause some glitches, like we was not seen the cursor if
    it was outside of its rectangle, but in case of LOK, it may painted
    mispositioned parts.. if it aligned the rendered image to the bottom.
    
    Change-Id: I1be6d7a934a826b5043c5793263a45bad70afaba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200097
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index cdfc57053655..f960977b53e9 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4490,8 +4490,31 @@ void ImpEditEngine::CalcHeight(ParaPortion& rPortion)
         return;
 
     OSL_ENSURE(rPortion.GetLines().Count(), "Paragraph with no lines in 
ParaPortion::CalcHeight");
+    sal_Int32 nUrlYJump = 0;
     for (sal_Int32 nLine = 0; nLine < rPortion.GetLines().Count(); ++nLine)
-        rPortion.mnHeight += rPortion.GetLines()[nLine].GetHeight();
+    {
+        EditLine& rLine = rPortion.GetLines()[nLine];
+        if (nUrlYJump == 0)
+            rPortion.mnHeight += rLine.GetHeight();
+        else
+            nUrlYJump = 0;
+        for (sal_Int32 nPortion = rLine.GetStartPortion(); nPortion <= 
rLine.GetEndPortion();
+             nPortion++)
+        {
+            const TextPortion& rTextPortion = 
rPortion.GetTextPortions()[nPortion];
+            if (rTextPortion.GetKind() == PortionKind::FIELD)
+            {
+                ExtraPortionInfo* pExtraInfo = rTextPortion.GetExtraInfos();
+                if (pExtraInfo && pExtraInfo->lineBreaksList.size() > 1)
+                {
+                    // Use the same size calculation as in ImpEditEngine::Paint
+                    const sal_uInt16 nMaxAscent(rLine.GetMaxAscent());
+                    nUrlYJump = nMaxAscent * 
(pExtraInfo->lineBreaksList.size() - 1);
+                    rPortion.mnHeight += nUrlYJump;
+                }
+            }
+        }
+    }
 
     if (maStatus.IsOutliner())
         return;

Reply via email to