summaryrefslogtreecommitdiff
path: root/vcl/source/app/help.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/app/help.cxx')
-rw-r--r--vcl/source/app/help.cxx170
1 files changed, 92 insertions, 78 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index f26b5d3cb400..41263675840f 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -37,6 +37,7 @@
#include "vcl/help.hxx"
#include "vcl/helpwin.hxx"
#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
#include "tools/time.hxx"
// =======================================================================
@@ -63,27 +64,20 @@ Help::~Help()
// -----------------------------------------------------------------------
-BOOL Help::Start( ULONG, const Window* )
-{
- return FALSE;
-}
-
-void Help::OpenHelpAgent( ULONG )
+void Help::OpenHelpAgent( const rtl::OString& )
{
}
// -----------------------------------------------------------------------
-BOOL Help::Start( const XubString&, const Window* )
+sal_Bool Help::Start( const XubString&, const Window* )
{
- return FALSE;
+ return sal_False;
}
-// -----------------------------------------------------------------------
-
-XubString Help::GetHelpText( ULONG, const Window* )
+sal_Bool Help::SearchKeyword( const XubString& )
{
- return ImplGetSVEmptyStr();
+ return sal_False;
}
// -----------------------------------------------------------------------
@@ -97,26 +91,26 @@ XubString Help::GetHelpText( const String&, const Window* )
void Help::EnableContextHelp()
{
- ImplGetSVData()->maHelpData.mbContextHelp = TRUE;
+ ImplGetSVData()->maHelpData.mbContextHelp = sal_True;
}
// -----------------------------------------------------------------------
void Help::DisableContextHelp()
{
- ImplGetSVData()->maHelpData.mbContextHelp = FALSE;
+ ImplGetSVData()->maHelpData.mbContextHelp = sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::IsContextHelpEnabled()
+sal_Bool Help::IsContextHelpEnabled()
{
return ImplGetSVData()->maHelpData.mbContextHelp;
}
// -----------------------------------------------------------------------
-BOOL Help::StartContextHelp()
+sal_Bool Help::StartContextHelp()
{
ImplSVData* pSVData = ImplGetSVData();
@@ -128,74 +122,74 @@ BOOL Help::StartContextHelp()
Point aMousePos = pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() );
HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT );
pWindow->RequestHelp( aHelpEvent );
- return TRUE;
+ return sal_True;
}
}
- return FALSE;
+ return sal_False;
}
// -----------------------------------------------------------------------
void Help::EnableExtHelp()
{
- ImplGetSVData()->maHelpData.mbExtHelp = TRUE;
+ ImplGetSVData()->maHelpData.mbExtHelp = sal_True;
}
// -----------------------------------------------------------------------
void Help::DisableExtHelp()
{
- ImplGetSVData()->maHelpData.mbExtHelp = FALSE;
+ ImplGetSVData()->maHelpData.mbExtHelp = sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::IsExtHelpEnabled()
+sal_Bool Help::IsExtHelpEnabled()
{
return ImplGetSVData()->maHelpData.mbExtHelp;
}
// -----------------------------------------------------------------------
-BOOL Help::StartExtHelp()
+sal_Bool Help::StartExtHelp()
{
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maHelpData.mbExtHelp && !pSVData->maHelpData.mbExtHelpMode )
{
- pSVData->maHelpData.mbExtHelpMode = TRUE;
+ pSVData->maHelpData.mbExtHelpMode = sal_True;
pSVData->maHelpData.mbOldBalloonMode = pSVData->maHelpData.mbBalloonHelp;
- pSVData->maHelpData.mbBalloonHelp = TRUE;
+ pSVData->maHelpData.mbBalloonHelp = sal_True;
if ( pSVData->maWinData.mpAppWin )
pSVData->maWinData.mpAppWin->ImplGenerateMouseMove();
- return TRUE;
+ return sal_True;
}
- return FALSE;
+ return sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::EndExtHelp()
+sal_Bool Help::EndExtHelp()
{
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maHelpData.mbExtHelp && pSVData->maHelpData.mbExtHelpMode )
{
- pSVData->maHelpData.mbExtHelpMode = FALSE;
+ pSVData->maHelpData.mbExtHelpMode = sal_False;
pSVData->maHelpData.mbBalloonHelp = pSVData->maHelpData.mbOldBalloonMode;
if ( pSVData->maWinData.mpAppWin )
pSVData->maWinData.mpAppWin->ImplGenerateMouseMove();
- return TRUE;
+ return sal_True;
}
- return FALSE;
+ return sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::IsExtHelpActive()
+sal_Bool Help::IsExtHelpActive()
{
return ImplGetSVData()->maHelpData.mbExtHelpMode;
}
@@ -204,101 +198,115 @@ BOOL Help::IsExtHelpActive()
void Help::EnableBalloonHelp()
{
- ImplGetSVData()->maHelpData.mbBalloonHelp = TRUE;
+ ImplGetSVData()->maHelpData.mbBalloonHelp = sal_True;
}
// -----------------------------------------------------------------------
void Help::DisableBalloonHelp()
{
- ImplGetSVData()->maHelpData.mbBalloonHelp = FALSE;
+ ImplGetSVData()->maHelpData.mbBalloonHelp = sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::IsBalloonHelpEnabled()
+sal_Bool Help::IsBalloonHelpEnabled()
{
return ImplGetSVData()->maHelpData.mbBalloonHelp;
}
// -----------------------------------------------------------------------
-BOOL Help::ShowBalloon( Window* pParent,
+sal_Bool Help::ShowBalloon( Window* pParent,
const Point& rScreenPos,
const XubString& rHelpText )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
rHelpText, ImplGetSVEmptyStr(), rScreenPos );
- return TRUE;
+ return sal_True;
}
// -----------------------------------------------------------------------
-BOOL Help::ShowBalloon( Window* pParent,
+sal_Bool Help::ShowBalloon( Window* pParent,
const Point& rScreenPos, const Rectangle& rRect,
const XubString& rHelpText )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
rHelpText, ImplGetSVEmptyStr(), rScreenPos, &rRect );
- return TRUE;
+ return sal_True;
}
// -----------------------------------------------------------------------
void Help::EnableQuickHelp()
{
- ImplGetSVData()->maHelpData.mbQuickHelp = TRUE;
+ ImplGetSVData()->maHelpData.mbQuickHelp = sal_True;
}
// -----------------------------------------------------------------------
void Help::DisableQuickHelp()
{
- ImplGetSVData()->maHelpData.mbQuickHelp = FALSE;
+ ImplGetSVData()->maHelpData.mbQuickHelp = sal_False;
}
// -----------------------------------------------------------------------
-BOOL Help::IsQuickHelpEnabled()
+sal_Bool Help::IsQuickHelpEnabled()
{
return ImplGetSVData()->maHelpData.mbQuickHelp;
}
// -----------------------------------------------------------------------
-BOOL Help::ShowQuickHelp( Window* pParent,
+sal_Bool Help::ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
const XubString& rLongHelpText,
- USHORT nStyle )
+ sal_uInt16 nStyle )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_QUICK, nStyle,
rHelpText, rLongHelpText,
pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect );
- return TRUE;
+ return sal_True;
}
// -----------------------------------------------------------------------
-ULONG Help::ShowTip( Window* pParent, const Rectangle& rRect,
- const XubString& rText, USHORT nStyle )
+sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect,
+ const XubString& rText, sal_uInt16 nStyle )
{
- USHORT nHelpWinStyle = HELPWINSTYLE_QUICK;
+ sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK;
HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
+ sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin );
+ UpdateTip( nId, pParent, rScreenRect, rText );
+
+ pHelpWin->ShowHelp( HELPDELAY_NONE );
+ return nId;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText )
+{
+ HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId );
+ ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" );
+
Size aSz = pHelpWin->CalcOutSize();
pHelpWin->SetOutputSizePixel( aSz );
- ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle,
- pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect );
- pHelpWin->ShowHelp( HELPDELAY_NONE );
- return (ULONG)pHelpWin;
+ ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(),
+ pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect );
+
+ pHelpWin->SetHelpText( rText );
}
// -----------------------------------------------------------------------
-void Help::HideTip( ULONG nId )
+void Help::HideTip( sal_uLong nId )
{
HelpTextWindow* pHelpWin = (HelpTextWindow*)nId;
Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
@@ -312,13 +320,13 @@ void Help::HideTip( ULONG nId )
// =======================================================================
-HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT nHelpWinStyle, USHORT nStyle ) :
+HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle ) :
//FloatingWindow( pParent->ImplGetFrameWindow(), WB_SYSTEMWINDOW ),
FloatingWindow( pParent, WB_SYSTEMWINDOW|WB_TOOLTIPWIN ), // #105827# if we change the parent, mirroring will not work correctly when positioning this window
maHelpText( rText )
{
SetType( WINDOW_HELPTEXTWINDOW );
- ImplSetMouseTransparent( TRUE );
+ ImplSetMouseTransparent( sal_True );
mnHelpWinStyle = nHelpWinStyle;
mnStyle = nStyle;
// on windows this will raise the application window, because help windows are system windows now
@@ -331,9 +339,9 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT
SetTextAlign( ALIGN_TOP );
if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) )
{
- EnableChildTransparentMode( TRUE );
+ EnableChildTransparentMode( sal_True );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
- SetPaintTransparent( TRUE );
+ SetPaintTransparent( sal_True );
SetBackground();
}
else
@@ -346,7 +354,7 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT
if( mnStyle & QUICKHELP_BIDI_RTL )
{
- ULONG nLayoutMode = GetLayoutMode();
+ sal_uLong nLayoutMode = GetLayoutMode();
nLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT;
SetLayoutMode( nLayoutMode );
}
@@ -355,7 +363,7 @@ HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maHelpData.mbSetKeyboardHelp )
- pSVData->maHelpData.mbKeyboardHelp = TRUE;
+ pSVData->maHelpData.mbKeyboardHelp = sal_True;
const HelpSettings& rHelpSettings = pParent->GetSettings().GetHelpSettings();
maShowTimer.SetTimeoutHdl( LINK( this, HelpTextWindow, TimerHdl ) );
@@ -392,13 +400,13 @@ void HelpTextWindow::SetHelpText( const String& rHelpText )
else // HELPWINSTYLE_BALLOON
{
Point aTmpPoint;
- USHORT nCharsInLine = 35 + ((maHelpText.Len()/100)*5);
+ sal_uInt16 nCharsInLine = 35 + ((maHelpText.Len()/100)*5);
XubString aXXX;
aXXX.Fill( nCharsInLine, 'x' ); // Durchschnittliche Breite, damit nicht jedes Fenster anders.
long nWidth = GetTextWidth( aXXX );
Size aTmpSize( nWidth, 0x7FFFFFFF );
Rectangle aTry1( aTmpPoint, aTmpSize );
- USHORT nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK |
+ sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK |
TEXT_DRAW_LEFT | TEXT_DRAW_TOP;
if ( mnStyle & QUICKHELP_CTRLTEXT )
nDrawFlags |= TEXT_DRAW_MNEMONIC;
@@ -420,7 +428,7 @@ void HelpTextWindow::SetHelpText( const String& rHelpText )
void HelpTextWindow::ImplShow()
{
ImplDelData aDogTag( this );
- Show( TRUE, SHOW_NOACTIVATE );
+ Show( sal_True, SHOW_NOACTIVATE );
if( !aDogTag.IsDelete() )
Update();
}
@@ -450,7 +458,7 @@ void HelpTextWindow::Paint( const Rectangle& )
}
else // HELPWINSTYLE_BALLOON
{
- USHORT nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK|
+ sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK|
TEXT_DRAW_LEFT|TEXT_DRAW_TOP;
if ( mnStyle & QUICKHELP_CTRLTEXT )
nDrawFlags |= TEXT_DRAW_MNEMONIC;
@@ -476,9 +484,9 @@ void HelpTextWindow::Paint( const Rectangle& )
// -----------------------------------------------------------------------
-void HelpTextWindow::ShowHelp( USHORT nDelayMode )
+void HelpTextWindow::ShowHelp( sal_uInt16 nDelayMode )
{
- ULONG nTimeout = 0;
+ sal_uLong nTimeout = 0;
if ( nDelayMode != HELPDELAY_NONE )
{
// Im ExtendedHelp-Fall die Hilfe schneller anzeigen
@@ -559,9 +567,9 @@ String HelpTextWindow::GetText() const
// -----------------------------------------------------------------------
-BOOL HelpTextWindow::RegisterAccessibleParent()
+sal_Bool HelpTextWindow::RegisterAccessibleParent()
{
- return FALSE;
+ return sal_False;
}
// -----------------------------------------------------------------------
@@ -572,7 +580,7 @@ void HelpTextWindow::RevokeAccessibleParent()
// =======================================================================
-void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle,
+void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
const XubString& rHelpText, const XubString& rStatusText,
const Point& rScreenPos, const Rectangle* pHelpArea )
{
@@ -582,15 +590,19 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle,
return;
HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
- USHORT nDelayMode = HELPDELAY_NORMAL;
+ sal_uInt16 nDelayMode = HELPDELAY_NORMAL;
if ( pHelpWin )
{
DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" );
- if ( (( pHelpWin->GetHelpText() != rHelpText ) ||
- ( pHelpWin->GetWinStyle() != nHelpWinStyle ) ||
- ( pHelpArea && ( pHelpWin->GetHelpArea() != *pHelpArea ) ) )
- && pSVData->maHelpData.mbRequestingHelp )
+ if ( ( ( pHelpWin->GetHelpText() != rHelpText )
+ || ( pHelpWin->GetWinStyle() != nHelpWinStyle )
+ || ( pHelpArea
+ && ( pHelpWin->GetHelpArea() != *pHelpArea )
+ )
+ )
+ && pSVData->maHelpData.mbRequestingHelp
+ )
{
// remove help window if no HelpText or other HelpText or
// other help mode. but keep it if we are scrolling, ie not requesting help
@@ -602,8 +614,8 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle,
}
else
{
- bool bTextChanged = rHelpText != pHelpWin->GetHelpText();
- if( bTextChanged )
+ bool const bTextChanged = rHelpText != pHelpWin->GetHelpText();
+ if ( bTextChanged || ( ( nStyle & QUICKHELP_FORCE_REPOSITION ) != 0 ) )
{
Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow ) );
@@ -621,8 +633,10 @@ void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle,
if ( !pHelpWin && rHelpText.Len() )
{
- ULONG nCurTime = Time::GetSystemTicks();
- if( (nCurTime - pSVData->maHelpData.mnLastHelpHideTime) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
+ sal_uLong nCurTime = Time::GetSystemTicks();
+ if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
+ || ( ( nStyle & QUICKHELP_NO_DELAY ) != 0 )
+ )
nDelayMode = HELPDELAY_NONE;
DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" );
@@ -657,7 +671,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
if( pHelpWin->IsVisible() )
pWindow->Invalidate( aInvRect );
pSVData->maHelpData.mpHelpWin = NULL;
- pSVData->maHelpData.mbKeyboardHelp = FALSE;
+ pSVData->maHelpData.mbKeyboardHelp = sal_False;
pHelpWin->Hide();
delete pHelpWin;
if( bUpdateHideTime )
@@ -667,7 +681,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
// -----------------------------------------------------------------------
-void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle,
+void ImplSetHelpWindowPos( Window* pHelpWin, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
const Point& rPos, const Rectangle* pHelpArea )
{
Point aPos = rPos;