1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_HELP_HXX
21 #define INCLUDED_VCL_HELP_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include <vcl/dllapi.h>
25 #include <o3tl/typed_flags_set.hxx>
26 
27 class Point;
28 namespace tools { class Rectangle; }
29 namespace vcl { class Window; }
30 
31 
32 enum class QuickHelpFlags
33 {
34     NONE              = 0x0000,
35     Left              = 0x0001,
36     Center            = 0x0002,
37     Right             = 0x0004,
38     Top               = 0x0008,
39     VCenter           = 0x0010,
40     Bottom            = 0x0020,
41     NoAutoPos         = Left | Center | Right | Top | VCenter | Bottom,
42     CtrlText          = 0x0040,
43 /// force balloon-style in ShowPopover and ShowQuickHelp
44     TipStyleBalloon   = 0x0100,
45     NoEvadePointer    = 0x0200,
46     BiDiRtl           = 0x0400,
47 };
48 namespace o3tl
49 {
50     template<> struct typed_flags<QuickHelpFlags> : is_typed_flags<QuickHelpFlags, 0x77f> {};
51 }
52 
53 #define OOO_HELP_INDEX          ".help:index"
54 
55 namespace weld
56 {
57     class Widget;
58 }
59 
60 class VCL_DLLPUBLIC Help
61 {
62 public:
63                         Help();
64     virtual             ~Help();
65 
66     virtual bool        Start(const OUString& rHelpId, weld::Widget* pWidget = nullptr);
67     virtual void        SearchKeyword( const OUString& rKeyWord );
68     virtual OUString    GetHelpText(const OUString& aHelpURL, const weld::Widget* pWidget);
69 
70     virtual bool        Start(const OUString& rHelpId, const vcl::Window* pWindow);
71     virtual OUString    GetHelpText(const OUString& aHelpURL, const vcl::Window* pWindow);
72 
73     static void         EnableContextHelp();
74     static void         DisableContextHelp();
75     static bool         IsContextHelpEnabled();
76 
77     static void         EnableExtHelp();
78     static void         DisableExtHelp();
79     static bool         IsExtHelpEnabled();
80     static bool         StartExtHelp();
81     static bool         EndExtHelp();
82 
83     static void         EnableBalloonHelp();
84     static void         DisableBalloonHelp();
85     static bool         IsBalloonHelpEnabled();
86     static void         ShowBalloon( vcl::Window* pParent,
87                                      const Point& rScreenPos,
88                                      const tools::Rectangle&,
89                                      const OUString& rHelpText );
90 
91     static void         EnableQuickHelp();
92     static void         DisableQuickHelp();
93     static bool         IsQuickHelpEnabled();
94     static void         ShowQuickHelp( vcl::Window* pParent,
95                                        const tools::Rectangle& rScreenRect,
96                                        const OUString& rHelpText,
97                                        QuickHelpFlags nStyle = QuickHelpFlags::NONE );
98 
99     static void         HideBalloonAndQuickHelp();
100 
101     static void*        ShowPopover(vcl::Window* pParent,
102                                     const tools::Rectangle& rScreenRect,
103                                     const OUString& rText,
104                                     QuickHelpFlags nStyle);
105     static void         UpdatePopover(void* nId,
106                                       vcl::Window* pParent,
107                                       const tools::Rectangle& rScreenRect,
108                                       const OUString& rText);
109     static void         HidePopover(vcl::Window const * pParent, void* nId);
110 };
111 
112 #endif // INCLUDED_VCL_HELP_HXX
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
115