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 SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
29 #define SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
30 
31 #include "SlideSorter.hxx"
32 #include "model/SlsSharedPageDescriptor.hxx"
33 
34 namespace sd { namespace slidesorter { namespace view {
35 
36 /** Manage the display of tool tips.  The tool tip text changes when the
37     mouse is moved from slide to slide or from button to button.
38     After the mouse enters a slide the first display of the tool tip is
39     delayed for a short time in order to not draw attention from the slide
40     or its button bar.
41 */
42 class ToolTip
43 {
44 public:
45     ToolTip (SlideSorter& rSlideSorter);
46     ~ToolTip (void);
47 
48     /** Set a new page.  This modifies the default help text.  After a page
49         change a timer is started to delay the display of the tool tip for
50         the new page.
51         @param rpPage
52             When this is empty then the tool tip is hidden.
53     */
54     void SetPage (const model::SharedPageDescriptor& rpPage);
55 
56     /** Set and show the default help text.
57     */
58     void ShowDefaultHelpText (const ::rtl::OUString& rsHelpText);
59 
60     /** Show a previously set default help text.
61     */
62     void ShowDefaultHelpText (void);
63 
64     /** Show a temporary help text.
65     */
66     void ShowHelpText (const ::rtl::OUString& rsHelpText);
67 
68     /** Hide the tool tip.
69         @return
70             Returns whether the tool tip was visible at the time this method
71             was called.
72     */
73     bool Hide (void);
74 
75 private:
76     SlideSorter& mrSlideSorter;
77     model::SharedPageDescriptor mpDescriptor;
78     ::rtl::OUString msDefaultHelpText;
79     ::rtl::OUString msCurrentHelpText;
80     sal_uLong mnHelpWindowHandle;
81     Timer maTimer;
82 
83     /** Request to show the tool tip.
84         @param bForce
85             When <TRUE/> then the tool tip is show right away.  Otherwise it
86             is shown after a short delay.
87     */
88     void Show (const bool bForce);
89     void DoShow (void);
90 
91     DECL_LINK(DelayTrigger, void*);
92 };
93 
94 
95 } } } // end of namespace ::sd::slidesorter::view
96 
97 #endif
98