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