xref: /trunk/main/vcl/inc/vcl/help.hxx (revision cdf0e10c)
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_HELP_HXX
29 #define _SV_HELP_HXX
30 
31 #include <tools/string.hxx>
32 #include <vcl/sv.h>
33 #include <vcl/dllapi.h>
34 
35 class Point;
36 class Rectangle;
37 class Window;
38 
39 // --------------
40 // - Help-Types -
41 // --------------
42 
43 #define QUICKHELP_LEFT		        ((sal_uInt16)0x0001)
44 #define QUICKHELP_CENTER	        ((sal_uInt16)0x0002)
45 #define QUICKHELP_RIGHT 	        ((sal_uInt16)0x0004)
46 #define QUICKHELP_TOP		        ((sal_uInt16)0x0008)
47 #define QUICKHELP_VCENTER	        ((sal_uInt16)0x0010)
48 #define QUICKHELP_BOTTOM	        ((sal_uInt16)0x0020)
49 #define QUICKHELP_NOAUTOPOS         (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
50 #define QUICKHELP_CTRLTEXT	        ((sal_uInt16)0x0040)
51 /// force the existent tip window to be re-positioned, even if the previous incarnation has the same text. Applies to ShowBallon and ShowQuickHelp.
52 #define QUICKHELP_FORCE_REPOSITION  ((sal_uInt16)0x0080)
53 /// no delay when opening the quick help. Applies to ShowBallon and ShowQuickHelp
54 #define QUICKHELP_NO_DELAY          ((sal_uInt16)0x0100)
55 /// force balloon-style in ShowTip
56 #define QUICKHELP_TIP_STYLE_BALLOON ((sal_uInt16)0x0200)
57 #define QUICKHELP_NOEVADEPOINTER    ((sal_uInt16)0x4000)
58 #define QUICKHELP_BIDI_RTL	        ((sal_uInt16)0x8000)
59 
60 // By changes you must also change: rsc/vclrsc.hxx
61 #define OOO_HELP_INDEX			".help:index"
62 #define OOO_HELP_HELPONHELP 	".help:helponhelp"
63 
64 // --------
65 // - Help -
66 // --------
67 
68 class VCL_DLLPUBLIC Help
69 {
70 private:
71 	String				maHelpFile;
72 
73 public:
74 						Help();
75 	virtual				~Help();
76 
77 	void				SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; }
78 	const String&		GetHelpFile() const { return maHelpFile; }
79 
80 	virtual sal_Bool	Start( const XubString& rHelpId, const Window* pWindow );
81 	virtual sal_Bool	SearchKeyword( const XubString& rKeyWord );
82 	virtual void		OpenHelpAgent( const rtl::OString& rHelpId );
83 	virtual XubString   GetHelpText( const String& aHelpURL, const Window* pWindow );
84 
85 	static void 		EnableContextHelp();
86 	static void 		DisableContextHelp();
87 	static sal_Bool 	IsContextHelpEnabled();
88 	static sal_Bool 	StartContextHelp();
89 
90 	static void 		EnableExtHelp();
91 	static void 		DisableExtHelp();
92 	static sal_Bool 	IsExtHelpEnabled();
93 	static sal_Bool 	StartExtHelp();
94 	static sal_Bool 	EndExtHelp();
95 	static sal_Bool 	IsExtHelpActive();
96 
97 	static void 		EnableBalloonHelp();
98 	static void 		DisableBalloonHelp();
99 	static sal_Bool 	IsBalloonHelpEnabled();
100 	static sal_Bool 	ShowBalloon( Window* pParent,
101 									 const Point& rScreenPos,
102 									 const XubString& rHelpText );
103 	static sal_Bool     ShowBalloon( Window* pParent,
104 									 const Point& rScreenPos,
105 									 const Rectangle&,
106 									 const XubString& rHelpText );
107 
108 	static void 		EnableQuickHelp();
109 	static void 		DisableQuickHelp();
110 	static sal_Bool 	IsQuickHelpEnabled();
111 	static sal_Bool 	ShowQuickHelp( Window* pParent,
112 									   const Rectangle& rScreenRect,
113 									   const XubString& rHelpText,
114 									   const XubString& rLongHelpText,
115 									   sal_uInt16 nStyle = 0 );
116 	static sal_Bool 	ShowQuickHelp( Window* pParent,
117 									   const Rectangle& rScreenRect,
118 									   const XubString& rHelpText,
119 									   sal_uInt16 nStyle = 0 )
120 							{ return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); }
121 
122     static void         HideBalloonAndQuickHelp();
123 
124 	static sal_uLong	ShowTip( Window* pParent,
125 								 const Rectangle& rScreenRect,
126 								 const XubString& rText, sal_uInt16 nStyle = 0 );
127     static void         UpdateTip( sal_uLong nId,
128                                    Window* pParent,
129 								   const Rectangle& rScreenRect,
130 								   const XubString& rText );
131 	static void 		HideTip( sal_uLong nId );
132 };
133 
134 #endif	// _SV_HELP_HXX
135