xref: /trunk/main/sdext/source/presenter/PresenterHelpView.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 SDEXT_PRESENTER_HELP_VIEW_HXX
25 #define SDEXT_PRESENTER_HELP_VIEW_HXX
26 
27 #include "PresenterController.hxx"
28 #include <cppuhelper/basemutex.hxx>
29 #include <cppuhelper/compbase3.hxx>
30 #include <com/sun/star/awt/XPaintListener.hpp>
31 #include <com/sun/star/awt/XWindowListener.hpp>
32 #include <com/sun/star/drawing/framework/XView.hpp>
33 #include <com/sun/star/drawing/framework/XResourceId.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
36 
37 namespace css = ::com::sun::star;
38 
39 namespace {
40     typedef cppu::WeakComponentImplHelper3<
41         css::drawing::framework::XView,
42         css::awt::XWindowListener,
43         css::awt::XPaintListener
44         > PresenterHelpViewInterfaceBase;
45 }
46 
47 namespace sdext { namespace presenter {
48 
49 class PresenterButton;
50 
51 /** Show help text that describes the defined keys.
52 */
53 class PresenterHelpView
54     : private ::cppu::BaseMutex,
55       public PresenterHelpViewInterfaceBase
56 {
57 public:
58     explicit PresenterHelpView (
59         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
60         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
61         const css::uno::Reference<css::frame::XController>& rxController,
62         const ::rtl::Reference<PresenterController>& rpPresenterController);
63     virtual ~PresenterHelpView (void);
64 
65     virtual void SAL_CALL disposing (void);
66 
67     // lang::XEventListener
68 
69     virtual void SAL_CALL
70         disposing (const css::lang::EventObject& rEventObject);
71 
72 
73     // XWindowListener
74 
75     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent);
76 
77     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent);
78 
79     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent);
80 
81     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent);
82 
83 
84     // XPaintListener
85 
86     virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent);
87 
88 
89     // XResourceId
90 
91     virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void);
92 
93     virtual sal_Bool SAL_CALL isAnchorOnly (void);
94 
95 private:
96     class TextContainer;
97 
98     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
99     css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
100     css::uno::Reference<css::drawing::framework::XPane> mxPane;
101     css::uno::Reference<css::awt::XWindow> mxWindow;
102     css::uno::Reference<css::rendering::XCanvas> mxCanvas;
103     ::rtl::Reference<PresenterController> mpPresenterController;
104     PresenterTheme::SharedFontDescriptor mpFont;
105     ::boost::scoped_ptr<TextContainer> mpTextContainer;
106     ::rtl::Reference<PresenterButton> mpCloseButton;
107     sal_Int32 mnSeparatorY;
108     sal_Int32 mnMaximalWidth;
109 
110     void ProvideCanvas (void);
111     void Resize (void);
112     void Paint (const css::awt::Rectangle& rRedrawArea);
113     void ReadHelpStrings (void);
114     void ProcessString (
115         const css::uno::Reference<css::beans::XPropertySet>& rsProperties);
116 
117     /** Find a font size, so that all text can be displayed at the same
118         time.
119     */
120     void CheckFontSize (void);
121 
122     /** This method throws a DisposedException when the object has already been
123         disposed.
124     */
125     void ThrowIfDisposed (void);
126 };
127 
128 } } // end of namespace ::sdext::presenter
129 
130 #endif
131