xref: /AOO41X/main/vcl/inc/vcl/help.hxx (revision 0d63794c5b3715d9f8da2f4b7b451b7426ee7897)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_HELP_HXX
25 #define _SV_HELP_HXX
26 
27 #include <tools/string.hxx>
28 #include <vcl/sv.h>
29 #include <vcl/dllapi.h>
30 
31 class Point;
32 class Rectangle;
33 class Window;
34 
35 // --------------
36 // - Help-Types -
37 // --------------
38 
39 #define QUICKHELP_LEFT              ((sal_uInt16)0x0001)
40 #define QUICKHELP_CENTER            ((sal_uInt16)0x0002)
41 #define QUICKHELP_RIGHT             ((sal_uInt16)0x0004)
42 #define QUICKHELP_TOP               ((sal_uInt16)0x0008)
43 #define QUICKHELP_VCENTER           ((sal_uInt16)0x0010)
44 #define QUICKHELP_BOTTOM            ((sal_uInt16)0x0020)
45 #define QUICKHELP_NOAUTOPOS         (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM)
46 #define QUICKHELP_CTRLTEXT          ((sal_uInt16)0x0040)
47 /// force the existent tip window to be re-positioned, even if the previous incarnation has the same text. Applies to ShowBallon and ShowQuickHelp.
48 #define QUICKHELP_FORCE_REPOSITION  ((sal_uInt16)0x0080)
49 /// no delay when opening the quick help. Applies to ShowBallon and ShowQuickHelp
50 #define QUICKHELP_NO_DELAY          ((sal_uInt16)0x0100)
51 /// force balloon-style in ShowTip
52 #define QUICKHELP_TIP_STYLE_BALLOON ((sal_uInt16)0x0200)
53 #define QUICKHELP_NOEVADEPOINTER    ((sal_uInt16)0x4000)
54 #define QUICKHELP_BIDI_RTL          ((sal_uInt16)0x8000)
55 
56 // By changes you must also change: rsc/vclrsc.hxx
57 #define OOO_HELP_INDEX          ".help:index"
58 #define OOO_HELP_HELPONHELP     ".help:helponhelp"
59 
60 // --------
61 // - Help -
62 // --------
63 
64 class VCL_DLLPUBLIC Help
65 {
66 private:
67     String              maHelpFile;
68 
69 public:
70                         Help();
71     virtual             ~Help();
72 
SetHelpFile(const String & rFileName)73     void                SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; }
GetHelpFile() const74     const String&       GetHelpFile() const { return maHelpFile; }
75 
76     virtual sal_Bool    Start( const XubString& rHelpId, const Window* pWindow );
77     virtual sal_Bool    SearchKeyword( const XubString& rKeyWord );
78     virtual void        OpenHelpAgent( const rtl::OString& rHelpId );
79     virtual XubString   GetHelpText( const String& aHelpURL, const Window* pWindow );
80 
81     static void         EnableContextHelp();
82     static void         DisableContextHelp();
83     static sal_Bool     IsContextHelpEnabled();
84     static sal_Bool     StartContextHelp();
85 
86     static void         EnableExtHelp();
87     static void         DisableExtHelp();
88     static sal_Bool     IsExtHelpEnabled();
89     static sal_Bool     StartExtHelp();
90     static sal_Bool     EndExtHelp();
91     static sal_Bool     IsExtHelpActive();
92 
93     static void         EnableBalloonHelp();
94     static void         DisableBalloonHelp();
95     static sal_Bool     IsBalloonHelpEnabled();
96     static sal_Bool     ShowBalloon( Window* pParent,
97                                      const Point& rScreenPos,
98                                      const XubString& rHelpText );
99     static sal_Bool     ShowBalloon( Window* pParent,
100                                      const Point& rScreenPos,
101                                      const Rectangle&,
102                                      const XubString& rHelpText );
103 
104     static void         EnableQuickHelp();
105     static void         DisableQuickHelp();
106     static sal_Bool     IsQuickHelpEnabled();
107     static sal_Bool     ShowQuickHelp( Window* pParent,
108                                        const Rectangle& rScreenRect,
109                                        const XubString& rHelpText,
110                                        const XubString& rLongHelpText,
111                                        sal_uInt16 nStyle = 0 );
ShowQuickHelp(Window * pParent,const Rectangle & rScreenRect,const XubString & rHelpText,sal_uInt16 nStyle=0)112     static sal_Bool     ShowQuickHelp( Window* pParent,
113                                        const Rectangle& rScreenRect,
114                                        const XubString& rHelpText,
115                                        sal_uInt16 nStyle = 0 )
116                             { return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); }
117 
118     static void         HideBalloonAndQuickHelp();
119 
120     static sal_uLong    ShowTip( Window* pParent,
121                                  const Rectangle& rScreenRect,
122                                  const XubString& rText, sal_uInt16 nStyle = 0 );
123     static void         UpdateTip( sal_uLong nId,
124                                    Window* pParent,
125                                    const Rectangle& rScreenRect,
126                                    const XubString& rText );
127     static void         HideTip( sal_uLong nId );
128 };
129 
130 #endif  // _SV_HELP_HXX
131