diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-14 14:05:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-14 14:36:09 +0000 |
commit | 01ef12d173fb2c54a49186c8eb4fa40288b82945 (patch) | |
tree | 83c5266da0d4b14b2ccc23e21b3f973c6b7f7523 | |
parent | e0ae7c786b8e1a2422c8c28ca3a2a35d93e018d1 (diff) |
Related: rhbz#1289394 always provide the screen area the tip applies to
this will make it easier to implement native help tips
Change-Id: I984dfadaf02e9b7bf542ba82cf070911c89cb699
-rw-r--r-- | cui/source/customize/acccfg.cxx | 2 | ||||
-rw-r--r-- | cui/source/customize/selector.cxx | 10 | ||||
-rw-r--r-- | include/vcl/help.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/draw/dpage.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin2.cxx | 17 | ||||
-rw-r--r-- | vcl/inc/helpwin.hxx | 4 | ||||
-rw-r--r-- | vcl/source/app/help.cxx | 68 | ||||
-rw-r--r-- | vcl/source/window/menuwindow.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 9 |
10 files changed, 58 insertions, 65 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 2d42b3c392fb..ee07d7e05e77 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -1108,7 +1108,7 @@ IMPL_LINK_NOARG_TYPED(SfxAcceleratorConfigPage, RemoveHdl, Button*, void) IMPL_LINK_TYPED( SfxAcceleratorConfigPage, SelectHdl, SvTreeListBox*, pListBox, void ) { // disable help - Help::ShowBalloon( this, Point(), OUString() ); + Help::ShowBalloon( this, Point(), Rectangle(), OUString() ); if (pListBox == m_pEntriesBox) { sal_uLong nPos = SvTreeList::GetRelPos( m_pEntriesBox->FirstSelected() ); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 7f4c65e1221e..28fbd8716661 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -131,7 +131,8 @@ void SvxConfigFunctionListBox::MouseMove( const MouseEvent& rMEvt ) aTimer.Start(); else { - Help::ShowBalloon( this, aMousePos, OUString() ); + Rectangle aRect(GetPosPixel(), GetSizePixel()); + Help::ShowBalloon( this, aMousePos, aRect, OUString() ); aTimer.Stop(); } } @@ -143,7 +144,10 @@ IMPL_LINK_NOARG_TYPED(SvxConfigFunctionListBox, TimerHdl, Timer *, void) Point aMousePos = GetPointerPosPixel(); SvTreeListEntry *pEntry = GetCurEntry(); if ( pEntry && GetEntry( aMousePos ) == pEntry && pCurEntry == pEntry ) - Help::ShowBalloon( this, OutputToScreenPixel( aMousePos ), GetHelpText( pEntry ) ); + { + Rectangle aRect(GetPosPixel(), GetSizePixel()); + Help::ShowBalloon( this, OutputToScreenPixel(aMousePos), aRect, GetHelpText( pEntry ) ); + } } void SvxConfigFunctionListBox::ClearAll() @@ -178,7 +182,7 @@ OUString SvxConfigFunctionListBox::GetHelpText( SvTreeListEntry *pEntry ) void SvxConfigFunctionListBox::FunctionSelected() { - Help::ShowBalloon( this, Point(), OUString() ); + Help::ShowBalloon( this, Point(), Rectangle(), OUString() ); } // drag and drop support diff --git a/include/vcl/help.hxx b/include/vcl/help.hxx index 40dfcf2e4e0e..4d226a8122f8 100644 --- a/include/vcl/help.hxx +++ b/include/vcl/help.hxx @@ -86,9 +86,6 @@ public: static bool IsBalloonHelpEnabled(); static bool ShowBalloon( vcl::Window* pParent, const Point& rScreenPos, - const OUString& rHelpText ); - static bool ShowBalloon( vcl::Window* pParent, - const Point& rScreenPos, const Rectangle&, const OUString& rHelpText ); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 0577ad4618a5..bc3fa4bb51a3 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1366,7 +1366,7 @@ void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt ) Size aSize( GetSizePixel() ); Rectangle aItemRect( rHEvt.GetMousePosPixel(), aSize ); if (Help::IsBalloonHelpEnabled()) - Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), GetText() ); + Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aItemRect, GetText() ); else Help::ShowQuickHelp( this, aItemRect, GetText(), QuickHelpFlags::Left|QuickHelpFlags::VCenter ); diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index f8ad9f6253cf..c8773e8c7192 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -237,14 +237,14 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView* pView, sText = SwViewShell::GetShellRes()->aLinkClick + ": " + sText; } + // then display the help: + Rectangle aRect( rEvt.GetMousePosPixel(), Size(1,1) ); if( rEvt.GetMode() & HelpEventMode::BALLOON ) { - Help::ShowBalloon( pWindow, rEvt.GetMousePosPixel(), sText ); + Help::ShowBalloon( pWindow, rEvt.GetMousePosPixel(), aRect, sText ); } else { - // then display the help: - Rectangle aRect( rEvt.GetMousePosPixel(), Size(1,1) ); Help::ShowQuickHelp( pWindow, aRect, sText ); } bContinue = false; diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index ba05744a930f..a15a681cbc03 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -364,18 +364,19 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } if (!sText.isEmpty()) { + Rectangle aRect( aFieldRect.SVRect() ); + Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() ))); + aRect.Left() = aPt.X(); + aRect.Top() = aPt.Y(); + aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() )); + aRect.Right() = aPt.X(); + aRect.Bottom() = aPt.Y(); + if( bBalloon ) - Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sText ); + Help::ShowBalloon( this, rEvt.GetMousePosPixel(), aRect, sText ); else { // the show the help - Rectangle aRect( aFieldRect.SVRect() ); - Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() ))); - aRect.Left() = aPt.X(); - aRect.Top() = aPt.Y(); - aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() )); - aRect.Right() = aPt.X(); - aRect.Bottom() = aPt.Y(); OUString sDisplayText(ClipLongToolTip(sText)); Help::ShowQuickHelp(this, aRect, sDisplayText, nStyle); } diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index e37296269398..cf35423e262b 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -75,10 +75,10 @@ public: void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const OUString& rHelpText, const OUString& rStatusText, - const Point& rScreenPos, const Rectangle* pHelpArea = nullptr ); + const Point& rScreenPos, const Rectangle& rHelpArea ); void ImplDestroyHelpWindow( bool bUpdateHideTime ); void ImplSetHelpWindowPos( vcl::Window* pHelpWindow, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, - const Point& rPos, const Rectangle* pHelpArea ); + const Point& rPos, const Rectangle& rHelpArea ); #endif // INCLUDED_VCL_INC_HELPWIN_HXX diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 912607d788b5..51a9e31ff2f3 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -147,21 +147,11 @@ bool Help::IsBalloonHelpEnabled() } bool Help::ShowBalloon( vcl::Window* pParent, - const Point& rScreenPos, - const OUString& rHelpText ) -{ - ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, QuickHelpFlags::NONE, - rHelpText, OUString(), rScreenPos ); - - return true; -} - -bool Help::ShowBalloon( vcl::Window* pParent, const Point& rScreenPos, const Rectangle& rRect, const OUString& rHelpText ) { ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, QuickHelpFlags::NONE, - rHelpText, OUString(), rScreenPos, &rRect ); + rHelpText, OUString(), rScreenPos, rRect ); return true; } @@ -189,7 +179,7 @@ bool Help::ShowQuickHelp( vcl::Window* pParent, { ImplShowHelpWindow( pParent, HELPWINSTYLE_QUICK, nStyle, rHelpText, rLongHelpText, - pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); + pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), rScreenRect ); return true; } @@ -221,7 +211,7 @@ void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rS Size aSz = pHelpWin->CalcOutSize(); pHelpWin->SetOutputSizePixel( aSz ); ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(), - pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); + pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), rScreenRect ); pHelpWin->SetHelpText( rText ); pHelpWin->Invalidate(); @@ -470,7 +460,7 @@ OUString HelpTextWindow::GetText() const void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const OUString& rHelpText, const OUString& rStatusText, - const Point& rScreenPos, const Rectangle* pHelpArea ) + const Point& rScreenPos, const Rectangle& rHelpArea ) { ImplSVData* pSVData = ImplGetSVData(); @@ -485,9 +475,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe if ( ( ( pHelpWin->GetHelpText() != rHelpText ) || ( pHelpWin->GetWinStyle() != nHelpWinStyle ) - || ( pHelpArea - && ( pHelpWin->GetHelpArea() != *pHelpArea ) - ) + || ( pHelpWin->GetHelpArea() != rHelpArea ) ) && pSVData->maHelpData.mbRequestingHelp ) @@ -512,7 +500,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe pHelpWin->SetHelpText( rHelpText ); // approach mouse position - ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, pHelpArea ); + ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, rHelpArea ); if( pHelpWin->IsVisible() ) pHelpWin->Invalidate(); } @@ -531,13 +519,12 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle ); pSVData->maHelpData.mpHelpWin = pHelpWin; pHelpWin->SetStatusText( rStatusText ); - if ( pHelpArea ) - pHelpWin->SetHelpArea( *pHelpArea ); + pHelpWin->SetHelpArea( rHelpArea ); // positioning Size aSz = pHelpWin->CalcOutSize(); pHelpWin->SetOutputSizePixel( aSz ); - ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, pHelpArea ); + ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, rHelpArea ); // if not called from Window::RequestHelp, then without delay... if ( !pSVData->maHelpData.mbRequestingHelp ) nDelayMode = HELPDELAY_NONE; @@ -566,7 +553,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime ) } void ImplSetHelpWindowPos( vcl::Window* pHelpWin, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, - const Point& rPos, const Rectangle* pHelpArea ) + const Point& rPos, const Rectangle& rHelpArea ) { Point aPos = rPos; Size aSz = pHelpWin->GetSizePixel(); @@ -601,26 +588,23 @@ void ImplSetHelpWindowPos( vcl::Window* pHelpWin, sal_uInt16 nHelpWinStyle, Quic if ( nStyle & QuickHelpFlags::NoAutoPos ) { - if ( pHelpArea ) - { - // convert help area to screen coords - Rectangle devHelpArea( - pHelpWin->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( pHelpArea->TopLeft() ), - pHelpWin->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( pHelpArea->BottomRight() ) ); - - // Welche Position vom Rechteck? - aPos = devHelpArea.Center(); - - if ( nStyle & QuickHelpFlags::Left ) - aPos.X() = devHelpArea.Left(); - else if ( nStyle & QuickHelpFlags::Right ) - aPos.X() = devHelpArea.Right(); - - if ( nStyle & QuickHelpFlags::Top ) - aPos.Y() = devHelpArea.Top(); - else if ( nStyle & QuickHelpFlags::Bottom ) - aPos.Y() = devHelpArea.Bottom(); - } + // convert help area to screen coords + Rectangle devHelpArea( + pHelpWin->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( rHelpArea.TopLeft() ), + pHelpWin->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( rHelpArea.BottomRight() ) ); + + // Welche Position vom Rechteck? + aPos = devHelpArea.Center(); + + if ( nStyle & QuickHelpFlags::Left ) + aPos.X() = devHelpArea.Left(); + else if ( nStyle & QuickHelpFlags::Right ) + aPos.X() = devHelpArea.Right(); + + if ( nStyle & QuickHelpFlags::Top ) + aPos.Y() = devHelpArea.Top(); + else if ( nStyle & QuickHelpFlags::Bottom ) + aPos.Y() = devHelpArea.Bottom(); // which direction? if ( nStyle & QuickHelpFlags::Left ) diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx index 72a1baecbb3f..83ca0b610975 100644 --- a/vcl/source/window/menuwindow.cxx +++ b/vcl/source/window/menuwindow.cxx @@ -63,7 +63,7 @@ bool MenuWindow::ImplHandleHelpEvent(vcl::Window* pMenuWindow, Menu* pMenu, sal_ Rectangle aRect( aPos, Size() ); if (!pMenu->GetHelpText(nId).isEmpty()) - Help::ShowBalloon( pMenuWindow, aPos, pMenu->GetHelpText( nId ) ); + Help::ShowBalloon( pMenuWindow, aPos, aRect, pMenu->GetHelpText( nId ) ); else { // give user a chance to read the full filename diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 89015128c4c8..c988af633fb7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2007,7 +2007,14 @@ void Window::RequestHelp( const HelpEvent& rHEvt ) if ( rStr.isEmpty() && ImplGetParent() && !ImplIsOverlapWindow() ) ImplGetParent()->RequestHelp( rHEvt ); else - Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), rStr ); + { + Point aPos = GetPosPixel(); + if ( ImplGetParent() && !ImplIsOverlapWindow() ) + aPos = ImplGetParent()->OutputToScreenPixel( aPos ); + Rectangle aRect( aPos, GetSizePixel() ); + + Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aRect, rStr ); + } } else if ( rHEvt.GetMode() & HelpEventMode::QUICK ) { |