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_HXX
25 #define SD_PRESENTER_PRESENTER_PANE_HXX
26 
27 #include "PresenterPaneBase.hxx"
28 #include <com/sun/star/awt/XMouseListener.hpp>
29 #include <com/sun/star/awt/XMouseMotionListener.hpp>
30 #include <com/sun/star/awt/XWindowListener.hpp>
31 #include <com/sun/star/container/XChild.hpp>
32 #include <com/sun/star/drawing/XPresenterHelper.hpp>
33 #include <com/sun/star/drawing/framework/XPane.hpp>
34 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/rendering/XCanvas.hpp>
38 #include <rtl/ref.hxx>
39 #include <boost/noncopyable.hpp>
40 
41 namespace css = ::com::sun::star;
42 
43 
44 namespace sdext { namespace presenter {
45 
46 /** Pane used by the presenter screen.  Pane objects are stored in the
47     PresenterPaneContainer.  Sizes and positions are controlled
48     by the PresenterWindowManager.  Interactive positioning and resizing is
49     managed by the PresenterPaneBorderManager.  Borders around panes are
50     painted by the PresenterPaneBorderPainter.
51 */
52 class PresenterPane : public PresenterPaneBase
53 {
54 public:
55     PresenterPane (
56         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
57         const ::rtl::Reference<PresenterController>& rpPresenterController);
58     virtual ~PresenterPane (void);
59 
60     static ::rtl::OUString getImplementationName_static (void);
61     static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
62     static css::uno::Reference<css::uno::XInterface> Create(
63         const css::uno::Reference<css::uno::XComponentContext>& rxContext)
64         SAL_THROW((css::uno::Exception));
65 
66 
67     // XPane
68 
69     css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow (void)
70         throw (css::uno::RuntimeException);
71 
72     css::uno::Reference<css::rendering::XCanvas> SAL_CALL getCanvas (void)
73         throw (css::uno::RuntimeException);
74 
75 
76     // XWindowListener
77 
78     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
79         throw (css::uno::RuntimeException);
80 
81     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
82         throw (css::uno::RuntimeException);
83 
84     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
85         throw (css::uno::RuntimeException);
86 
87     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
88         throw (css::uno::RuntimeException);
89 
90 
91     // XPaintListener
92 
93     virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
94         throw (css::uno::RuntimeException);
95 
96 
97 private:
98     /** Store the bounding box so that when the window is resized or moved
99         we still know the old position and size.
100     */
101     css::awt::Rectangle maBoundingBox;
102 
103     virtual void CreateCanvases (
104         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
105         const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas);
106 
107     void Invalidate (
108         const css::awt::Rectangle& rRepaintBox);
109     void UpdateBoundingBox (void);
110 };
111 
112 } } // end of namespace ::sd::presenter
113 
114 #endif
115