[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - basctl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 30 13:07:37 UTC 2019


 basctl/source/basicide/baside2b.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 45d2f8a4bdd2c805b11ab374fb4946a2c079e7ee
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Apr 28 16:28:49 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Apr 30 15:06:49 2019 +0200

    Resolves: tdf#124704 need to state the area the tooltip is for
    
    to make it work under gtk3
    
    Change-Id: I4c895181af233a16292ce16b194f0a60994446fb
    Reviewed-on: https://gerrit.libreoffice.org/71479
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 99208550315b..e307250ba663 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -337,7 +337,7 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt )
         else if ( rHEvt.GetMode() & HelpEventMode::QUICK )
         {
             OUString aHelpText;
-            Point aTopLeft;
+            tools::Rectangle aHelpRect;
             if ( StarBASIC::IsRunning() )
             {
                 Point aWindowPos = rHEvt.GetMousePosPixel();
@@ -371,15 +371,20 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt )
                     }
                     if ( !aHelpText.isEmpty() )
                     {
-                        aTopLeft = GetEditView()->GetTextEngine()->PaMtoEditCursor( aStartOfWord ).BottomLeft();
-                        aTopLeft = GetEditView()->GetWindowPos( aTopLeft );
-                        aTopLeft.AdjustX(5 );
-                        aTopLeft.AdjustY(5 );
-                        aTopLeft = OutputToScreenPixel( aTopLeft );
+                        tools::Rectangle aStartWordRect(GetEditView()->GetTextEngine()->PaMtoEditCursor(aStartOfWord));
+                        TextPaM aEndOfWord(aStartOfWord.GetPara(), aStartOfWord.GetIndex() + aWord.getLength());
+                        tools::Rectangle aEndWordRect(GetEditView()->GetTextEngine()->PaMtoEditCursor(aEndOfWord));
+                        aHelpRect = aStartWordRect.GetUnion(aEndWordRect);
+
+                        Point aTopLeft = GetEditView()->GetWindowPos(aHelpRect.TopLeft());
+                        aTopLeft = GetEditView()->GetWindow()->OutputToScreenPixel(aTopLeft);
+
+                        aHelpRect.setX(aTopLeft.X());
+                        aHelpRect.setY(aTopLeft.Y());
                     }
                 }
             }
-            Help::ShowQuickHelp( this, tools::Rectangle( aTopLeft, Size( 1, 1 ) ), aHelpText, QuickHelpFlags::Top|QuickHelpFlags::Left);
+            Help::ShowQuickHelp( this, aHelpRect, aHelpText, QuickHelpFlags::NONE);
             bDone = true;
         }
     }


More information about the Libreoffice-commits mailing list