1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: help.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #include "vcl/svdata.hxx"
35 #include "vcl/window.hxx"
36 #include "vcl/event.hxx"
37 #include "vcl/svapp.hxx"
38 #include "vcl/wrkwin.hxx"
39 #include "vcl/help.hxx"
40 #include "vcl/helpwin.hxx"
41 #include "tools/debug.hxx"
42 #include "tools/time.hxx"
44 // =======================================================================
46 #define HELPWINSTYLE_QUICK 0
47 #define HELPWINSTYLE_BALLOON 1
49 #define HELPTEXTMARGIN_QUICK 3
50 #define HELPTEXTMARGIN_BALLOON 6
52 #define HELPDELAY_NORMAL 1
53 #define HELPDELAY_SHORT 2
54 #define HELPDELAY_NONE 3
56 // =======================================================================
66 // -----------------------------------------------------------------------
68 BOOL
Help::Start( ULONG
, const Window
* )
73 // -----------------------------------------------------------------------
75 BOOL
Help::Start( const XubString
&, const Window
* )
80 // -----------------------------------------------------------------------
82 XubString
Help::GetHelpText( ULONG
, const Window
* )
84 return ImplGetSVEmptyStr();
87 // -----------------------------------------------------------------------
89 XubString
Help::GetHelpText( const String
&, const Window
* )
91 return ImplGetSVEmptyStr();
94 // -----------------------------------------------------------------------
96 void Help::EnableContextHelp()
98 ImplGetSVData()->maHelpData
.mbContextHelp
= TRUE
;
101 // -----------------------------------------------------------------------
103 void Help::DisableContextHelp()
105 ImplGetSVData()->maHelpData
.mbContextHelp
= FALSE
;
108 // -----------------------------------------------------------------------
110 BOOL
Help::IsContextHelpEnabled()
112 return ImplGetSVData()->maHelpData
.mbContextHelp
;
115 // -----------------------------------------------------------------------
117 BOOL
Help::StartContextHelp()
119 ImplSVData
* pSVData
= ImplGetSVData();
121 if ( pSVData
->maHelpData
.mbContextHelp
)
123 Window
* pWindow
= pSVData
->maWinData
.mpFocusWin
;
126 Point aMousePos
= pWindow
->OutputToScreenPixel( pWindow
->GetPointerPosPixel() );
127 HelpEvent
aHelpEvent( aMousePos
, HELPMODE_CONTEXT
);
128 pWindow
->RequestHelp( aHelpEvent
);
136 // -----------------------------------------------------------------------
138 void Help::EnableExtHelp()
140 ImplGetSVData()->maHelpData
.mbExtHelp
= TRUE
;
143 // -----------------------------------------------------------------------
145 void Help::DisableExtHelp()
147 ImplGetSVData()->maHelpData
.mbExtHelp
= FALSE
;
150 // -----------------------------------------------------------------------
152 BOOL
Help::IsExtHelpEnabled()
154 return ImplGetSVData()->maHelpData
.mbExtHelp
;
157 // -----------------------------------------------------------------------
159 BOOL
Help::StartExtHelp()
161 ImplSVData
* pSVData
= ImplGetSVData();
163 if ( pSVData
->maHelpData
.mbExtHelp
&& !pSVData
->maHelpData
.mbExtHelpMode
)
165 pSVData
->maHelpData
.mbExtHelpMode
= TRUE
;
166 pSVData
->maHelpData
.mbOldBalloonMode
= pSVData
->maHelpData
.mbBalloonHelp
;
167 pSVData
->maHelpData
.mbBalloonHelp
= TRUE
;
168 if ( pSVData
->maWinData
.mpAppWin
)
169 pSVData
->maWinData
.mpAppWin
->ImplGenerateMouseMove();
176 // -----------------------------------------------------------------------
178 BOOL
Help::EndExtHelp()
180 ImplSVData
* pSVData
= ImplGetSVData();
182 if ( pSVData
->maHelpData
.mbExtHelp
&& pSVData
->maHelpData
.mbExtHelpMode
)
184 pSVData
->maHelpData
.mbExtHelpMode
= FALSE
;
185 pSVData
->maHelpData
.mbBalloonHelp
= pSVData
->maHelpData
.mbOldBalloonMode
;
186 if ( pSVData
->maWinData
.mpAppWin
)
187 pSVData
->maWinData
.mpAppWin
->ImplGenerateMouseMove();
194 // -----------------------------------------------------------------------
196 BOOL
Help::IsExtHelpActive()
198 return ImplGetSVData()->maHelpData
.mbExtHelpMode
;
201 // -----------------------------------------------------------------------
203 void Help::EnableBalloonHelp()
205 ImplGetSVData()->maHelpData
.mbBalloonHelp
= TRUE
;
208 // -----------------------------------------------------------------------
210 void Help::DisableBalloonHelp()
212 ImplGetSVData()->maHelpData
.mbBalloonHelp
= FALSE
;
215 // -----------------------------------------------------------------------
217 BOOL
Help::IsBalloonHelpEnabled()
219 return ImplGetSVData()->maHelpData
.mbBalloonHelp
;
222 // -----------------------------------------------------------------------
224 BOOL
Help::ShowBalloon( Window
* pParent
,
225 const Point
& rScreenPos
,
226 const XubString
& rHelpText
)
228 ImplShowHelpWindow( pParent
, HELPWINSTYLE_BALLOON
, 0,
229 rHelpText
, ImplGetSVEmptyStr(), rScreenPos
);
234 // -----------------------------------------------------------------------
236 BOOL
Help::ShowBalloon( Window
* pParent
,
237 const Point
& rScreenPos
, const Rectangle
& rRect
,
238 const XubString
& rHelpText
)
240 ImplShowHelpWindow( pParent
, HELPWINSTYLE_BALLOON
, 0,
241 rHelpText
, ImplGetSVEmptyStr(), rScreenPos
, &rRect
);
246 // -----------------------------------------------------------------------
248 void Help::EnableQuickHelp()
250 ImplGetSVData()->maHelpData
.mbQuickHelp
= TRUE
;
253 // -----------------------------------------------------------------------
255 void Help::DisableQuickHelp()
257 ImplGetSVData()->maHelpData
.mbQuickHelp
= FALSE
;
260 // -----------------------------------------------------------------------
262 BOOL
Help::IsQuickHelpEnabled()
264 return ImplGetSVData()->maHelpData
.mbQuickHelp
;
267 // -----------------------------------------------------------------------
269 BOOL
Help::ShowQuickHelp( Window
* pParent
,
270 const Rectangle
& rScreenRect
,
271 const XubString
& rHelpText
,
272 const XubString
& rLongHelpText
,
275 ImplShowHelpWindow( pParent
, HELPWINSTYLE_QUICK
, nStyle
,
276 rHelpText
, rLongHelpText
,
277 pParent
->OutputToScreenPixel( pParent
->GetPointerPosPixel() ), &rScreenRect
);
281 // -----------------------------------------------------------------------
283 ULONG
Help::ShowTip( Window
* pParent
, const Rectangle
& rRect
,
284 const XubString
& rText
, USHORT nStyle
)
286 USHORT nHelpWinStyle
= HELPWINSTYLE_QUICK
;
287 HelpTextWindow
* pHelpWin
= new HelpTextWindow( pParent
, rText
, nHelpWinStyle
, nStyle
);
289 Size aSz
= pHelpWin
->CalcOutSize();
290 pHelpWin
->SetOutputSizePixel( aSz
);
291 ImplSetHelpWindowPos( pHelpWin
, nHelpWinStyle
, nStyle
,
292 pParent
->OutputToScreenPixel( pParent
->GetPointerPosPixel() ), &rRect
);
293 pHelpWin
->ShowHelp( HELPDELAY_NONE
);
294 return (ULONG
)pHelpWin
;
297 // -----------------------------------------------------------------------
299 void Help::HideTip( ULONG nId
)
301 HelpTextWindow
* pHelpWin
= (HelpTextWindow
*)nId
;
302 Window
* pFrameWindow
= pHelpWin
->ImplGetFrameWindow();
304 // Update ausloesen, damit ein Paint sofort ausgeloest wird, da
305 // wir den Hintergrund nicht sichern
306 pFrameWindow
->ImplUpdateAll();
308 ImplGetSVData()->maHelpData
.mnLastHelpHideTime
= Time::GetSystemTicks();
311 // =======================================================================
313 HelpTextWindow::HelpTextWindow( Window
* pParent
, const XubString
& rText
, USHORT nHelpWinStyle
, USHORT nStyle
) :
314 //FloatingWindow( pParent->ImplGetFrameWindow(), WB_SYSTEMWINDOW ),
315 FloatingWindow( pParent
, WB_SYSTEMWINDOW
|WB_TOOLTIPWIN
), // #105827# if we change the parent, mirroring will not work correctly when positioning this window
318 SetType( WINDOW_HELPTEXTWINDOW
);
319 ImplSetMouseTransparent( TRUE
);
320 mnHelpWinStyle
= nHelpWinStyle
;
322 // on windows this will raise the application window, because help windows are system windows now
323 // EnableAlwaysOnTop();
324 EnableSaveBackground();
326 const StyleSettings
& rStyleSettings
= GetSettings().GetStyleSettings();
327 SetPointFont( rStyleSettings
.GetHelpFont() );
328 SetTextColor( rStyleSettings
.GetHelpTextColor() );
329 SetTextAlign( ALIGN_TOP
);
330 if ( IsNativeControlSupported( CTRL_TOOLTIP
, PART_ENTIRE_CONTROL
) )
332 EnableChildTransparentMode( TRUE
);
333 SetParentClipMode( PARENTCLIPMODE_NOCLIP
);
334 SetPaintTransparent( TRUE
);
338 SetBackground( Wallpaper( rStyleSettings
.GetHelpColor() ) );
339 if( rStyleSettings
.GetHelpColor().IsDark() )
340 SetLineColor( COL_WHITE
);
342 SetLineColor( COL_BLACK
);
345 if( mnStyle
& QUICKHELP_BIDI_RTL
)
347 ULONG nLayoutMode
= GetLayoutMode();
348 nLayoutMode
|= TEXT_LAYOUT_BIDI_RTL
| TEXT_LAYOUT_TEXTORIGIN_LEFT
;
349 SetLayoutMode( nLayoutMode
);
351 SetHelpText( rText
);
352 Window::SetHelpText( rText
);
354 ImplSVData
* pSVData
= ImplGetSVData();
355 if ( pSVData
->maHelpData
.mbSetKeyboardHelp
)
356 pSVData
->maHelpData
.mbKeyboardHelp
= TRUE
;
358 const HelpSettings
& rHelpSettings
= pParent
->GetSettings().GetHelpSettings();
359 maShowTimer
.SetTimeoutHdl( LINK( this, HelpTextWindow
, TimerHdl
) );
360 maHideTimer
.SetTimeoutHdl( LINK( this, HelpTextWindow
, TimerHdl
) );
361 maHideTimer
.SetTimeout( rHelpSettings
.GetTipTimeout() );
364 // -----------------------------------------------------------------------
366 HelpTextWindow::~HelpTextWindow()
371 if( this == ImplGetSVData()->maHelpData
.mpHelpWin
)
372 ImplGetSVData()->maHelpData
.mpHelpWin
= NULL
;
374 if ( maStatusText
.Len() )
376 ImplSVData
* pSVData
= ImplGetSVData();
377 pSVData
->mpApp
->HideHelpStatusText();
381 // -----------------------------------------------------------------------
383 void HelpTextWindow::SetHelpText( const String
& rHelpText
)
385 maHelpText
= rHelpText
;
386 if ( mnHelpWinStyle
== HELPWINSTYLE_QUICK
)
389 aSize
.Height() = GetTextHeight();
390 if ( mnStyle
& QUICKHELP_CTRLTEXT
)
391 aSize
.Width() = GetCtrlTextWidth( maHelpText
);
393 aSize
.Width() = GetTextWidth( maHelpText
);
394 maTextRect
= Rectangle( Point( HELPTEXTMARGIN_QUICK
, HELPTEXTMARGIN_QUICK
), aSize
);
396 else // HELPWINSTYLE_BALLOON
399 USHORT nCharsInLine
= 35 + ((maHelpText
.Len()/100)*5);
401 aXXX
.Fill( nCharsInLine
, 'x' ); // Durchschnittliche Breite, damit nicht jedes Fenster anders.
402 long nWidth
= GetTextWidth( aXXX
);
403 Size
aTmpSize( nWidth
, 0x7FFFFFFF );
404 Rectangle
aTry1( aTmpPoint
, aTmpSize
);
405 USHORT nDrawFlags
= TEXT_DRAW_MULTILINE
| TEXT_DRAW_WORDBREAK
|
406 TEXT_DRAW_LEFT
| TEXT_DRAW_TOP
;
407 if ( mnStyle
& QUICKHELP_CTRLTEXT
)
408 nDrawFlags
|= TEXT_DRAW_MNEMONIC
;
409 Rectangle aTextRect
= GetTextRect( aTry1
, maHelpText
, nDrawFlags
);
411 // Spaeter mal eine geeignete Breite ermitteln...
412 maTextRect
= aTextRect
;
414 // Sicherheitsabstand...
415 maTextRect
.SetPos( Point( HELPTEXTMARGIN_BALLOON
, HELPTEXTMARGIN_BALLOON
) );
418 Size
aSize( CalcOutSize() );
419 SetOutputSizePixel( aSize
);
422 // -----------------------------------------------------------------------
424 void HelpTextWindow::ImplShow()
426 ImplDelData
aDogTag( this );
427 if ( maStatusText
.Len() )
429 ImplSVData
* pSVData
= ImplGetSVData();
430 pSVData
->mpApp
->ShowHelpStatusText( maStatusText
);
432 Show( TRUE
, SHOW_NOACTIVATE
);
433 if( !aDogTag
.IsDelete() )
437 // -----------------------------------------------------------------------
439 void HelpTextWindow::Paint( const Rectangle
& )
441 // paint native background
442 bool bNativeOK
= false;
443 if ( IsNativeControlSupported( CTRL_TOOLTIP
, PART_ENTIRE_CONTROL
) )
445 // #i46472# workaround gcc3.3 temporary problem
446 Region aCtrlRegion
= Region( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
447 ImplControlValue aControlValue
;
448 bNativeOK
= DrawNativeControl( CTRL_TOOLTIP
, PART_ENTIRE_CONTROL
, aCtrlRegion
,
449 0, aControlValue
, rtl::OUString() );
453 if ( mnHelpWinStyle
== HELPWINSTYLE_QUICK
)
455 if ( mnStyle
& QUICKHELP_CTRLTEXT
)
456 DrawCtrlText( maTextRect
.TopLeft(), maHelpText
);
458 DrawText( maTextRect
.TopLeft(), maHelpText
);
460 else // HELPWINSTYLE_BALLOON
462 USHORT nDrawFlags
= TEXT_DRAW_MULTILINE
|TEXT_DRAW_WORDBREAK
|
463 TEXT_DRAW_LEFT
|TEXT_DRAW_TOP
;
464 if ( mnStyle
& QUICKHELP_CTRLTEXT
)
465 nDrawFlags
|= TEXT_DRAW_MNEMONIC
;
466 DrawText( maTextRect
, maHelpText
, nDrawFlags
);
472 Size aSz
= GetOutputSizePixel();
473 DrawRect( Rectangle( Point(), aSz
) );
474 if ( mnHelpWinStyle
== HELPWINSTYLE_BALLOON
)
478 Color
aColor( GetLineColor() );
479 SetLineColor( ( COL_GRAY
) );
480 DrawRect( Rectangle( Point( 1, 1 ), aSz
) );
481 SetLineColor( aColor
);
486 // -----------------------------------------------------------------------
488 void HelpTextWindow::ShowHelp( USHORT nDelayMode
)
491 if ( nDelayMode
!= HELPDELAY_NONE
)
493 // Im ExtendedHelp-Fall die Hilfe schneller anzeigen
494 if ( ImplGetSVData()->maHelpData
.mbExtHelpMode
)
498 const HelpSettings
& rHelpSettings
= GetSettings().GetHelpSettings();
499 if ( mnHelpWinStyle
== HELPWINSTYLE_QUICK
)
500 nTimeout
= rHelpSettings
.GetTipDelay();
502 nTimeout
= rHelpSettings
.GetBalloonDelay();
505 if ( nDelayMode
== HELPDELAY_SHORT
)
509 maShowTimer
.SetTimeout( nTimeout
);
513 // -----------------------------------------------------------------------
515 IMPL_LINK( HelpTextWindow
, TimerHdl
, Timer
*, pTimer
)
517 if ( pTimer
== &maShowTimer
)
519 if ( mnHelpWinStyle
== HELPWINSTYLE_QUICK
)
521 // start auto-hide-timer for non-ShowTip windows
522 ImplSVData
* pSVData
= ImplGetSVData();
523 if ( this == pSVData
->maHelpData
.mpHelpWin
)
530 DBG_ASSERT( pTimer
== &maHideTimer
, "HelpTextWindow::TimerHdl with bad Timer" );
531 ImplDestroyHelpWindow( true );
537 // -----------------------------------------------------------------------
539 Size
HelpTextWindow::CalcOutSize() const
541 Size aSz
= maTextRect
.GetSize();
542 aSz
.Width() += 2*maTextRect
.Left();
543 aSz
.Height() += 2*maTextRect
.Top();
547 // -----------------------------------------------------------------------
549 void HelpTextWindow::RequestHelp( const HelpEvent
& /*rHEvt*/ )
551 // Nur damit nicht von Window::RequestHelp() ein
552 // ShowQuickHelp/ShowBalloonHelp am HelpTextWindow aufgerufen wird.
555 // -----------------------------------------------------------------------
557 String
HelpTextWindow::GetText() const
562 // -----------------------------------------------------------------------
564 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> HelpTextWindow::CreateAccessible()
566 return FloatingWindow::CreateAccessible();
569 // -----------------------------------------------------------------------
571 BOOL
HelpTextWindow::RegisterAccessibleParent()
576 // -----------------------------------------------------------------------
578 void HelpTextWindow::RevokeAccessibleParent()
582 // =======================================================================
584 void ImplShowHelpWindow( Window
* pParent
, USHORT nHelpWinStyle
, USHORT nStyle
,
585 const XubString
& rHelpText
, const XubString
& rStatusText
,
586 const Point
& rScreenPos
, const Rectangle
* pHelpArea
)
588 ImplSVData
* pSVData
= ImplGetSVData();
590 if( !rHelpText
.Len() && !pSVData
->maHelpData
.mbRequestingHelp
)
593 HelpTextWindow
* pHelpWin
= pSVData
->maHelpData
.mpHelpWin
;
594 USHORT nDelayMode
= HELPDELAY_NORMAL
;
597 DBG_ASSERT( pHelpWin
!= pParent
, "HelpInHelp ?!" );
599 if ( (( pHelpWin
->GetHelpText() != rHelpText
) ||
600 ( pHelpWin
->GetWinStyle() != nHelpWinStyle
) ||
601 ( pHelpArea
&& ( pHelpWin
->GetHelpArea() != *pHelpArea
) ) )
602 && pSVData
->maHelpData
.mbRequestingHelp
)
604 // remove help window if no HelpText or other HelpText or
605 // other help mode. but keep it if we are scrolling, ie not requesting help
606 bool bWasVisible
= pHelpWin
->IsVisible();
608 nDelayMode
= HELPDELAY_NONE
; // display it quickly if we were already in quick help mode
610 ImplDestroyHelpWindow( bWasVisible
);
614 bool bTextChanged
= rHelpText
!= pHelpWin
->GetHelpText();
617 Window
* pWindow
= pHelpWin
->GetParent()->ImplGetFrameWindow();
618 Rectangle
aInvRect( pHelpWin
->GetWindowExtentsRelative( pWindow
) );
619 if( pHelpWin
->IsVisible() )
620 pWindow
->Invalidate( aInvRect
);
622 pHelpWin
->SetHelpText( rHelpText
);
623 // approach mouse position
624 ImplSetHelpWindowPos( pHelpWin
, nHelpWinStyle
, nStyle
, rScreenPos
, pHelpArea
);
625 if( pHelpWin
->IsVisible() )
626 pHelpWin
->Invalidate();
631 if ( !pHelpWin
&& rHelpText
.Len() )
633 ULONG nCurTime
= Time::GetSystemTicks();
634 if( (nCurTime
- pSVData
->maHelpData
.mnLastHelpHideTime
) < pParent
->GetSettings().GetHelpSettings().GetTipDelay() )
635 nDelayMode
= HELPDELAY_NONE
;
637 DBG_ASSERT( !pHelpWin
, "Noch ein HelpWin ?!" );
638 pHelpWin
= new HelpTextWindow( pParent
, rHelpText
, nHelpWinStyle
, nStyle
);
639 pSVData
->maHelpData
.mpHelpWin
= pHelpWin
;
640 pHelpWin
->SetStatusText( rStatusText
);
642 pHelpWin
->SetHelpArea( *pHelpArea
);
645 Size aSz
= pHelpWin
->CalcOutSize();
646 pHelpWin
->SetOutputSizePixel( aSz
);
647 ImplSetHelpWindowPos( pHelpWin
, nHelpWinStyle
, nStyle
, rScreenPos
, pHelpArea
);
648 // if not called from Window::RequestHelp, then without delay...
649 if ( !pSVData
->maHelpData
.mbRequestingHelp
)
650 nDelayMode
= HELPDELAY_NONE
;
651 pHelpWin
->ShowHelp( nDelayMode
);
655 // -----------------------------------------------------------------------
657 void ImplDestroyHelpWindow( bool bUpdateHideTime
)
659 ImplSVData
* pSVData
= ImplGetSVData();
660 HelpTextWindow
* pHelpWin
= pSVData
->maHelpData
.mpHelpWin
;
663 Window
* pWindow
= pHelpWin
->GetParent()->ImplGetFrameWindow();
664 // find out screen area covered by system help window
665 Rectangle
aInvRect( pHelpWin
->GetWindowExtentsRelative( pWindow
) );
666 if( pHelpWin
->IsVisible() )
667 pWindow
->Invalidate( aInvRect
);
668 pSVData
->maHelpData
.mpHelpWin
= NULL
;
669 pSVData
->maHelpData
.mbKeyboardHelp
= FALSE
;
672 if( bUpdateHideTime
)
673 pSVData
->maHelpData
.mnLastHelpHideTime
= Time::GetSystemTicks();
677 // -----------------------------------------------------------------------
679 void ImplSetHelpWindowPos( Window
* pHelpWin
, USHORT nHelpWinStyle
, USHORT nStyle
,
680 const Point
& rPos
, const Rectangle
* pHelpArea
)
683 Size aSz
= pHelpWin
->GetSizePixel();
684 Rectangle aScreenRect
= pHelpWin
->ImplGetFrameWindow()->GetDesktopRectPixel();
685 aPos
= pHelpWin
->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( aPos
);
686 // get mouse screen coords
687 Point
mPos( pHelpWin
->GetParent()->ImplGetFrameWindow()->GetPointerPosPixel() );
688 mPos
= pHelpWin
->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( mPos
);
690 if ( nHelpWinStyle
== HELPWINSTYLE_QUICK
)
692 if ( !(nStyle
& QUICKHELP_NOAUTOPOS
) )
694 long nScreenHeight
= aScreenRect
.GetHeight();
696 if ( aPos
.Y() > aScreenRect
.Top()+nScreenHeight
-(nScreenHeight
/4) )
697 aPos
.Y() -= aSz
.Height()+4;
704 // If it's the mouse position, move the window slightly
705 // so the mouse pointer does not cover it
713 if ( nStyle
& QUICKHELP_NOAUTOPOS
)
717 // convert help area to screen coords
718 Rectangle
devHelpArea(
719 pHelpWin
->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( pHelpArea
->TopLeft() ),
720 pHelpWin
->GetParent()->ImplGetFrameWindow()->OutputToAbsoluteScreenPixel( pHelpArea
->BottomRight() ) );
722 // Welche Position vom Rechteck?
723 aPos
= devHelpArea
.Center();
725 if ( nStyle
& QUICKHELP_LEFT
)
726 aPos
.X() = devHelpArea
.Left();
727 else if ( nStyle
& QUICKHELP_RIGHT
)
728 aPos
.X() = devHelpArea
.Right();
730 if ( nStyle
& QUICKHELP_TOP
)
731 aPos
.Y() = devHelpArea
.Top();
732 else if ( nStyle
& QUICKHELP_BOTTOM
)
733 aPos
.Y() = devHelpArea
.Bottom();
737 if ( nStyle
& QUICKHELP_LEFT
)
739 else if ( nStyle
& QUICKHELP_RIGHT
)
740 aPos
.X() -= aSz
.Width();
742 aPos
.X() -= aSz
.Width()/2;
744 if ( nStyle
& QUICKHELP_TOP
)
746 else if ( nStyle
& QUICKHELP_BOTTOM
)
747 aPos
.Y() -= aSz
.Height();
749 aPos
.Y() -= aSz
.Height()/2;
752 if ( aPos
.X() < aScreenRect
.Left() )
753 aPos
.X() = aScreenRect
.Left();
754 else if ( ( aPos
.X() + aSz
.Width() ) > aScreenRect
.Right() )
755 aPos
.X() = aScreenRect
.Right() - aSz
.Width();
756 if ( aPos
.Y() < aScreenRect
.Top() )
757 aPos
.Y() = aScreenRect
.Top();
758 else if ( ( aPos
.Y() + aSz
.Height() ) > aScreenRect
.Bottom() )
759 aPos
.Y() = aScreenRect
.Bottom() - aSz
.Height();
761 // the popup must not appear under the mouse
762 // otherwise it would directly be closed due to a focus change...
763 Rectangle
aHelpRect( aPos
, aSz
);
764 if( aHelpRect
.IsInside( mPos
) )
767 Point
pSize( aSz
.Width(), aSz
.Height() );
768 Point
pTest( mPos
- pSize
- delta
);
769 if( pTest
.X() > aScreenRect
.Left() && pTest
.Y() > aScreenRect
.Top() )
775 Window
* pWindow
= pHelpWin
->GetParent()->ImplGetFrameWindow();
776 aPos
= pWindow
->AbsoluteScreenToOutputPixel( aPos
);
777 pHelpWin
->SetPosPixel( aPos
);