xref: /trunk/main/vcl/inc/helpwin.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_HELPWIN_HXX
29 #define _SV_HELPWIN_HXX
30 
31 #include <vcl/floatwin.hxx>
32 #include <vcl/timer.hxx>
33 
34 // ------------------
35 // - HelpTextWindow -
36 // ------------------
37 
38 class HelpTextWindow : public FloatingWindow
39 {
40 private:
41     Point               maPos;
42     Rectangle           maHelpArea; // Wenn naechste Hilfe fuers gleiche Rectangle, gleicher Text, dann Fenster stehen lassen
43 
44     Rectangle           maTextRect; // Bei umgebrochenen Text in QuickHelp
45 
46     String              maHelpText;
47     String              maStatusText;
48 
49     Timer               maShowTimer;
50     Timer               maHideTimer;
51 
52     sal_uInt16              mnHelpWinStyle;
53     sal_uInt16              mnStyle;
54 
55 protected:
56                         DECL_LINK( TimerHdl, Timer* );
57     virtual void        Paint( const Rectangle& );
58     virtual void        RequestHelp( const HelpEvent& rHEvt );
59     virtual String      GetText() const;
60     void                ImplShow();
61 
62 public:
63                         HelpTextWindow( Window* pParent, const String& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle );
64                         ~HelpTextWindow();
65 
66     const String&       GetHelpText() const { return maHelpText; }
67     void                SetHelpText( const String& rHelpText );
68     sal_uInt16          GetWinStyle() const { return mnHelpWinStyle; }
69     sal_uInt16          GetStyle() const { return mnStyle; }
70 
71     // Nur merken:
72     void                SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; }
73     void                SetHelpArea( const Rectangle& rRect ) { maHelpArea = rRect; }
74 
75     void                ShowHelp( sal_uInt16 nDelayMode );
76 
77     Size                CalcOutSize() const;
78     const Rectangle&    GetHelpArea() const { return maHelpArea; }
79 
80     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
81 
82     sal_Bool                RegisterAccessibleParent();
83     void                RevokeAccessibleParent();
84 };
85 
86 void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
87         const String& rHelpText, const String& rStatusText,
88         const Point& rScreenPos, const Rectangle* pHelpArea = NULL );
89 void ImplDestroyHelpWindow( bool bUpdateHideTime );
90 void ImplSetHelpWindowPos( Window* pHelpWindow, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
91                             const Point& rPos, const Rectangle* pHelpArea );
92 
93 #endif // _SV_HELPWIN_HXX
94