[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

Caolán McNamara caolanm at redhat.com
Wed Apr 12 16:03:56 UTC 2017


 sw/source/core/crsr/crstrvl.cxx |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 244d2abb6c1bcd89cedf773d8721f62451708c3f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 10 15:14:37 2017 +0100

    Resolves: tdf#106078 get bounding box of commented region for gtk3 tooltips
    
    Change-Id: I4fdc1f471c6c191be9c7c611926bd2b5b2b41308
    (cherry picked from commit eb433f83a5f66dd1ca8ed0c62ef9cc0761b7f0ac)
    Reviewed-on: https://gerrit.libreoffice.org/36383
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index c024e0eb7d69..9bdc9b932768 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1440,12 +1440,18 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 
                             if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
                             {
+                                //get bounding box of range
                                 SwRect aStart;
                                 SwPosition aStartPos(*pTextNd, nSt);
                                 pFrame->GetCharRect(aStart, aStartPos, &aTmpState);
                                 SwRect aEnd;
                                 SwPosition aEndPos(*pTextNd, nEnd);
                                 pFrame->GetCharRect(aEnd, aEndPos, &aTmpState);
+                                if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
+                                {
+                                    aStart.Left(pFrame->Frame().Left());
+                                    aEnd.Right(pFrame->Frame().Right());
+                                }
                                 *pFieldRect = aStart.Union(aEnd);
                             }
                         }
@@ -1463,7 +1469,19 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                         bRet = true;
 
                         if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
-                            pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
+                        {
+                            //get bounding box of range
+                            SwRect aStart;
+                            pFrame->GetCharRect(aStart, *pRedl->Start(), &aTmpState);
+                            SwRect aEnd;
+                            pFrame->GetCharRect(aEnd, *pRedl->End(), &aTmpState);
+                            if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
+                            {
+                                aStart.Left(pFrame->Frame().Left());
+                                aEnd.Right(pFrame->Frame().Right());
+                            }
+                            *pFieldRect = aStart.Union(aEnd);
+                        }
                     }
                 }
             }


More information about the Libreoffice-commits mailing list