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