xref: /trunk/main/sdext/source/presenter/PresenterPaneBase.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 SD_PRESENTER_PRESENTER_PANE_BASE_HXX
25 #define SD_PRESENTER_PRESENTER_PANE_BASE_HXX
26 
27 #include "PresenterTheme.hxx"
28 #include <cppuhelper/basemutex.hxx>
29 #include <cppuhelper/compbase4.hxx>
30 #include <com/sun/star/awt/Point.hpp>
31 #include <com/sun/star/awt/XMouseListener.hpp>
32 #include <com/sun/star/awt/XMouseMotionListener.hpp>
33 #include <com/sun/star/awt/XWindowListener.hpp>
34 #include <com/sun/star/container/XChild.hpp>
35 #include <com/sun/star/drawing/XPresenterHelper.hpp>
36 #include <com/sun/star/drawing/framework/XPane.hpp>
37 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/uno/XComponentContext.hpp>
40 #include <com/sun/star/util/Color.hpp>
41 #include <com/sun/star/rendering/XCanvas.hpp>
42 #include <rtl/ref.hxx>
43 #include <boost/noncopyable.hpp>
44 
45 namespace css = ::com::sun::star;
46 namespace cssu = ::com::sun::star::uno;
47 
48 
49 namespace sdext { namespace presenter {
50 
51 class PresenterController;
52 class PresenterTextView;
53 
54 namespace {
55     typedef ::cppu::WeakComponentImplHelper4 <
56         css::drawing::framework::XPane,
57         css::lang::XInitialization,
58         css::awt::XWindowListener,
59         css::awt::XPaintListener
60     > PresenterPaneBaseInterfaceBase;
61 }
62 
63 
64 /** Base class of the panes used by the presenter screen.  Pane objects are
65     stored in the PresenterPaneContainer.  Sizes and positions are
66     controlled by the PresenterWindowManager.  Interactive positioning and
67     resizing is managed by the PresenterPaneBorderManager.  Borders around
68     panes are painted by the PresenterPaneBorderPainter.
69 */
70 class PresenterPaneBase
71     : protected ::cppu::BaseMutex,
72       private ::boost::noncopyable,
73       public PresenterPaneBaseInterfaceBase
74 {
75 public:
76     PresenterPaneBase (
77         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
78         const ::rtl::Reference<PresenterController>& rpPresenterController);
79     virtual ~PresenterPaneBase (void);
80 
81     virtual void SAL_CALL disposing (void);
82 
83     css::uno::Reference<css::awt::XWindow> GetBorderWindow (void) const;
84     void SetBackground (const SharedBitmapDescriptor& rpBackground);
85     void SetTitle (const ::rtl::OUString& rsTitle);
86     ::rtl::OUString GetTitle (void) const;
87     css::uno::Reference<css::drawing::framework::XPaneBorderPainter> GetPaneBorderPainter (void) const;
88     void SetCalloutAnchor (const css::awt::Point& rAnchorPosition);
89     css::awt::Point GetCalloutAnchor (void) const;
90 
91     ::boost::shared_ptr<PresenterTextView> GetTextViewForTitle (void);
92 
93     // XInitialization
94 
95     virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments);
96 
97 
98     // XResourceId
99 
100     virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void);
101 
102     virtual sal_Bool SAL_CALL isAnchorOnly (void);
103 
104 
105     // XWindowListener
106 
107     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent);
108 
109     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent);
110 
111     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent);
112 
113     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent);
114 
115 
116     // lang::XEventListener
117 
118     virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent);
119 
120 
121 protected:
122     ::rtl::Reference<PresenterController> mpPresenterController;
123     css::uno::Reference<css::awt::XWindow> mxParentWindow;
124     css::uno::Reference<css::awt::XWindow> mxBorderWindow;
125     css::uno::Reference<css::rendering::XCanvas> mxBorderCanvas;
126     css::uno::Reference<css::awt::XWindow> mxContentWindow;
127     css::uno::Reference<css::rendering::XCanvas> mxContentCanvas;
128     css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
129     css::uno::Reference<css::drawing::framework::XPaneBorderPainter> mxBorderPainter;
130     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
131     ::rtl::OUString msTitle;
132     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
133     SharedBitmapDescriptor mpViewBackground;
134     bool mbHasCallout;
135     css::awt::Point maCalloutAnchor;
136 
137     virtual void CreateCanvases (
138         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
139         const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas) = 0;
140 
141     void CreateWindows (
142         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
143         const bool bIsWindowVisibleOnCreation);
144     void PaintBorderBackground (
145         const css::awt::Rectangle& rCenterBox,
146         const css::awt::Rectangle& rUpdateBox);
147     void PaintBorder (const css::awt::Rectangle& rUpdateRectangle);
148     void ToTop (void);
149     void LayoutContextWindow (void);
150     bool IsVisible (void) const;
151 
152     /** This method throws a DisposedException when the object has already been
153         disposed.
154     */
155     void ThrowIfDisposed (void);
156 };
157 
158 } } // end of namespace ::sd::presenter
159 
160 #endif
161