1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef SD_PRESENTER_PRESENTER_PANE_BASE_HXX
25*b1cdbd2cSJim Jagielski #define SD_PRESENTER_PRESENTER_PANE_BASE_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include "PresenterTheme.hxx"
28*b1cdbd2cSJim Jagielski #include <cppuhelper/basemutex.hxx>
29*b1cdbd2cSJim Jagielski #include <cppuhelper/compbase4.hxx>
30*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/Point.hpp>
31*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/XMouseListener.hpp>
32*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/XMouseMotionListener.hpp>
33*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/XWindowListener.hpp>
34*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XChild.hpp>
35*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/XPresenterHelper.hpp>
36*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/framework/XPane.hpp>
37*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
38*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XInitialization.hpp>
39*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/XComponentContext.hpp>
40*b1cdbd2cSJim Jagielski #include <com/sun/star/util/Color.hpp>
41*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XCanvas.hpp>
42*b1cdbd2cSJim Jagielski #include <rtl/ref.hxx>
43*b1cdbd2cSJim Jagielski #include <boost/noncopyable.hpp>
44*b1cdbd2cSJim Jagielski 
45*b1cdbd2cSJim Jagielski namespace css = ::com::sun::star;
46*b1cdbd2cSJim Jagielski namespace cssu = ::com::sun::star::uno;
47*b1cdbd2cSJim Jagielski 
48*b1cdbd2cSJim Jagielski 
49*b1cdbd2cSJim Jagielski namespace sdext { namespace presenter {
50*b1cdbd2cSJim Jagielski 
51*b1cdbd2cSJim Jagielski class PresenterController;
52*b1cdbd2cSJim Jagielski class PresenterTextView;
53*b1cdbd2cSJim Jagielski 
54*b1cdbd2cSJim Jagielski namespace {
55*b1cdbd2cSJim Jagielski     typedef ::cppu::WeakComponentImplHelper4 <
56*b1cdbd2cSJim Jagielski         css::drawing::framework::XPane,
57*b1cdbd2cSJim Jagielski         css::lang::XInitialization,
58*b1cdbd2cSJim Jagielski         css::awt::XWindowListener,
59*b1cdbd2cSJim Jagielski         css::awt::XPaintListener
60*b1cdbd2cSJim Jagielski     > PresenterPaneBaseInterfaceBase;
61*b1cdbd2cSJim Jagielski }
62*b1cdbd2cSJim Jagielski 
63*b1cdbd2cSJim Jagielski 
64*b1cdbd2cSJim Jagielski /** Base class of the panes used by the presenter screen.  Pane objects are
65*b1cdbd2cSJim Jagielski     stored in the PresenterPaneContainer.  Sizes and positions are
66*b1cdbd2cSJim Jagielski     controlled by the PresenterWindowManager.  Interactive positioning and
67*b1cdbd2cSJim Jagielski     resizing is managed by the PresenterPaneBorderManager.  Borders around
68*b1cdbd2cSJim Jagielski     panes are painted by the PresenterPaneBorderPainter.
69*b1cdbd2cSJim Jagielski */
70*b1cdbd2cSJim Jagielski class PresenterPaneBase
71*b1cdbd2cSJim Jagielski     : protected ::cppu::BaseMutex,
72*b1cdbd2cSJim Jagielski       private ::boost::noncopyable,
73*b1cdbd2cSJim Jagielski       public PresenterPaneBaseInterfaceBase
74*b1cdbd2cSJim Jagielski {
75*b1cdbd2cSJim Jagielski public:
76*b1cdbd2cSJim Jagielski     PresenterPaneBase (
77*b1cdbd2cSJim Jagielski         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
78*b1cdbd2cSJim Jagielski         const ::rtl::Reference<PresenterController>& rpPresenterController);
79*b1cdbd2cSJim Jagielski     virtual ~PresenterPaneBase (void);
80*b1cdbd2cSJim Jagielski 
81*b1cdbd2cSJim Jagielski     virtual void SAL_CALL disposing (void);
82*b1cdbd2cSJim Jagielski 
83*b1cdbd2cSJim Jagielski     css::uno::Reference<css::awt::XWindow> GetBorderWindow (void) const;
84*b1cdbd2cSJim Jagielski     void SetBackground (const SharedBitmapDescriptor& rpBackground);
85*b1cdbd2cSJim Jagielski     void SetTitle (const ::rtl::OUString& rsTitle);
86*b1cdbd2cSJim Jagielski     ::rtl::OUString GetTitle (void) const;
87*b1cdbd2cSJim Jagielski     css::uno::Reference<css::drawing::framework::XPaneBorderPainter> GetPaneBorderPainter (void) const;
88*b1cdbd2cSJim Jagielski     void SetCalloutAnchor (const css::awt::Point& rAnchorPosition);
89*b1cdbd2cSJim Jagielski     css::awt::Point GetCalloutAnchor (void) const;
90*b1cdbd2cSJim Jagielski 
91*b1cdbd2cSJim Jagielski     ::boost::shared_ptr<PresenterTextView> GetTextViewForTitle (void);
92*b1cdbd2cSJim Jagielski 
93*b1cdbd2cSJim Jagielski     // XInitialization
94*b1cdbd2cSJim Jagielski 
95*b1cdbd2cSJim Jagielski     virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
96*b1cdbd2cSJim Jagielski         throw (css::uno::Exception, css::uno::RuntimeException);
97*b1cdbd2cSJim Jagielski 
98*b1cdbd2cSJim Jagielski 
99*b1cdbd2cSJim Jagielski     // XResourceId
100*b1cdbd2cSJim Jagielski 
101*b1cdbd2cSJim Jagielski     virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
102*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
103*b1cdbd2cSJim Jagielski 
104*b1cdbd2cSJim Jagielski     virtual sal_Bool SAL_CALL isAnchorOnly (void)
105*b1cdbd2cSJim Jagielski         throw (com::sun::star::uno::RuntimeException);
106*b1cdbd2cSJim Jagielski 
107*b1cdbd2cSJim Jagielski 
108*b1cdbd2cSJim Jagielski     // XWindowListener
109*b1cdbd2cSJim Jagielski 
110*b1cdbd2cSJim Jagielski     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
111*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
112*b1cdbd2cSJim Jagielski 
113*b1cdbd2cSJim Jagielski     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
114*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
115*b1cdbd2cSJim Jagielski 
116*b1cdbd2cSJim Jagielski     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
117*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
118*b1cdbd2cSJim Jagielski 
119*b1cdbd2cSJim Jagielski     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
120*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
121*b1cdbd2cSJim Jagielski 
122*b1cdbd2cSJim Jagielski 
123*b1cdbd2cSJim Jagielski     // lang::XEventListener
124*b1cdbd2cSJim Jagielski 
125*b1cdbd2cSJim Jagielski     virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
126*b1cdbd2cSJim Jagielski         throw (css::uno::RuntimeException);
127*b1cdbd2cSJim Jagielski 
128*b1cdbd2cSJim Jagielski 
129*b1cdbd2cSJim Jagielski protected:
130*b1cdbd2cSJim Jagielski     ::rtl::Reference<PresenterController> mpPresenterController;
131*b1cdbd2cSJim Jagielski     css::uno::Reference<css::awt::XWindow> mxParentWindow;
132*b1cdbd2cSJim Jagielski     css::uno::Reference<css::awt::XWindow> mxBorderWindow;
133*b1cdbd2cSJim Jagielski     css::uno::Reference<css::rendering::XCanvas> mxBorderCanvas;
134*b1cdbd2cSJim Jagielski     css::uno::Reference<css::awt::XWindow> mxContentWindow;
135*b1cdbd2cSJim Jagielski     css::uno::Reference<css::rendering::XCanvas> mxContentCanvas;
136*b1cdbd2cSJim Jagielski     css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
137*b1cdbd2cSJim Jagielski     css::uno::Reference<css::drawing::framework::XPaneBorderPainter> mxBorderPainter;
138*b1cdbd2cSJim Jagielski     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
139*b1cdbd2cSJim Jagielski     ::rtl::OUString msTitle;
140*b1cdbd2cSJim Jagielski     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
141*b1cdbd2cSJim Jagielski     SharedBitmapDescriptor mpViewBackground;
142*b1cdbd2cSJim Jagielski     bool mbHasCallout;
143*b1cdbd2cSJim Jagielski     css::awt::Point maCalloutAnchor;
144*b1cdbd2cSJim Jagielski 
145*b1cdbd2cSJim Jagielski     virtual void CreateCanvases (
146*b1cdbd2cSJim Jagielski         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
147*b1cdbd2cSJim Jagielski         const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas) = 0;
148*b1cdbd2cSJim Jagielski 
149*b1cdbd2cSJim Jagielski     void CreateWindows (
150*b1cdbd2cSJim Jagielski         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
151*b1cdbd2cSJim Jagielski         const bool bIsWindowVisibleOnCreation);
152*b1cdbd2cSJim Jagielski     void PaintBorderBackground (
153*b1cdbd2cSJim Jagielski         const css::awt::Rectangle& rCenterBox,
154*b1cdbd2cSJim Jagielski         const css::awt::Rectangle& rUpdateBox);
155*b1cdbd2cSJim Jagielski     void PaintBorder (const css::awt::Rectangle& rUpdateRectangle);
156*b1cdbd2cSJim Jagielski     void ToTop (void);
157*b1cdbd2cSJim Jagielski     void LayoutContextWindow (void);
158*b1cdbd2cSJim Jagielski     bool IsVisible (void) const;
159*b1cdbd2cSJim Jagielski 
160*b1cdbd2cSJim Jagielski     /** This method throws a DisposedException when the object has already been
161*b1cdbd2cSJim Jagielski         disposed.
162*b1cdbd2cSJim Jagielski     */
163*b1cdbd2cSJim Jagielski     void ThrowIfDisposed (void)
164*b1cdbd2cSJim Jagielski         throw (css::lang::DisposedException);
165*b1cdbd2cSJim Jagielski };
166*b1cdbd2cSJim Jagielski 
167*b1cdbd2cSJim Jagielski } } // end of namespace ::sd::presenter
168*b1cdbd2cSJim Jagielski 
169*b1cdbd2cSJim Jagielski #endif
170