[Libreoffice-commits] core.git: 2 commits - sw/source

Caolán McNamara caolanm at redhat.com
Mon Apr 10 14:16:33 UTC 2017


 sw/source/core/crsr/crstrvl.cxx   |   20 +++++++++++++++++++-
 sw/source/uibase/docvw/edtwin.cxx |    3 +--
 2 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit eb433f83a5f66dd1ca8ed0c62ef9cc0761b7f0ac
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

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index f120dfcb9453..56850d04753c 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1439,12 +1439,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);
                             }
                         }
@@ -1462,7 +1468,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);
+                        }
                     }
                 }
             }
commit 94e6a847e877f73a1aedca5d7f1604e13005b840
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 10 14:45:48 2017 +0100

    we don't use the SwRect FieldRect in this case
    
    Change-Id: If58745a27e76cc4bf4063c9b0ba6f14fa59cf6d9

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 208530981e44..b50bdd97b72e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4164,9 +4164,8 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
             }
             // change ui if mouse is over SwPostItField
             // TODO: do the same thing for redlines IsAttrAtPos::Redline
-            SwRect aFieldRect;
             SwContentAtPos aContentAtPos( IsAttrAtPos::Field);
-            if( rSh.GetContentAtPos( aDocPt, aContentAtPos, false, &aFieldRect ) )
+            if (rSh.GetContentAtPos(aDocPt, aContentAtPos, false))
             {
                 const SwField* pField = aContentAtPos.aFnd.pField;
                 if (pField->Which()== SwFieldIds::Postit)


More information about the Libreoffice-commits mailing list