Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "PresenterPane.hxx"
30 : : #include "PresenterController.hxx"
31 : : #include "PresenterPaintManager.hxx"
32 : : #include <com/sun/star/awt/XWindowPeer.hpp>
33 : : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
34 : : #include <com/sun/star/drawing/CanvasFeature.hpp>
35 : : #include <com/sun/star/rendering/CompositeOperation.hpp>
36 : : #include <osl/mutex.hxx>
37 : :
38 : : using namespace ::com::sun::star;
39 : : using namespace ::com::sun::star::uno;
40 : : using namespace ::com::sun::star::drawing::framework;
41 : : using ::rtl::OUString;
42 : :
43 : : namespace sdext { namespace presenter {
44 : :
45 : : //===== PresenterPane =========================================================
46 : :
47 : 0 : PresenterPane::PresenterPane (
48 : : const Reference<XComponentContext>& rxContext,
49 : : const ::rtl::Reference<PresenterController>& rpPresenterController)
50 : : : PresenterPaneBase(rxContext, rpPresenterController),
51 : 0 : maBoundingBox()
52 : : {
53 : : Reference<lang::XMultiComponentFactory> xFactory (
54 [ # # ][ # # ]: 0 : mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
[ # # ]
55 : : mxPresenterHelper = Reference<drawing::XPresenterHelper>(
56 [ # # ]: 0 : xFactory->createInstanceWithContext(
57 : : OUString("com.sun.star.comp.Draw.PresenterHelper"),
58 : 0 : mxComponentContext),
59 [ # # ][ # # ]: 0 : UNO_QUERY_THROW);
[ # # ]
60 : 0 : }
61 : :
62 : 0 : PresenterPane::~PresenterPane (void)
63 : : {
64 [ # # ]: 0 : }
65 : :
66 : : //----- XPane -----------------------------------------------------------------
67 : :
68 : 0 : Reference<awt::XWindow> SAL_CALL PresenterPane::getWindow (void)
69 : : throw (RuntimeException)
70 : : {
71 : 0 : ThrowIfDisposed();
72 : 0 : return mxContentWindow;
73 : : }
74 : :
75 : 0 : Reference<rendering::XCanvas> SAL_CALL PresenterPane::getCanvas (void)
76 : : throw (RuntimeException)
77 : : {
78 : 0 : ThrowIfDisposed();
79 : 0 : return mxContentCanvas;
80 : : }
81 : :
82 : : //----- XWindowListener -------------------------------------------------------
83 : :
84 : 0 : void SAL_CALL PresenterPane::windowResized (const awt::WindowEvent& rEvent)
85 : : throw (RuntimeException)
86 : : {
87 : : (void)rEvent;
88 : 0 : PresenterPaneBase::windowResized(rEvent);
89 : :
90 : 0 : Invalidate(maBoundingBox);
91 : :
92 : 0 : LayoutContextWindow();
93 : 0 : ToTop();
94 : :
95 : 0 : UpdateBoundingBox();
96 : 0 : Invalidate(maBoundingBox);
97 : 0 : }
98 : :
99 : 0 : void SAL_CALL PresenterPane::windowMoved (const awt::WindowEvent& rEvent)
100 : : throw (RuntimeException)
101 : : {
102 : : (void)rEvent;
103 : 0 : PresenterPaneBase::windowMoved(rEvent);
104 : :
105 : 0 : Invalidate(maBoundingBox);
106 : :
107 : 0 : ToTop();
108 : :
109 : 0 : UpdateBoundingBox();
110 : 0 : Invalidate(maBoundingBox);
111 : 0 : }
112 : :
113 : 0 : void SAL_CALL PresenterPane::windowShown (const lang::EventObject& rEvent)
114 : : throw (RuntimeException)
115 : : {
116 : : (void)rEvent;
117 : 0 : PresenterPaneBase::windowShown(rEvent);
118 : :
119 : 0 : ToTop();
120 : :
121 [ # # ]: 0 : if (mxContentWindow.is())
122 : : {
123 : 0 : LayoutContextWindow();
124 : 0 : mxContentWindow->setVisible(sal_True);
125 : : }
126 : :
127 : 0 : UpdateBoundingBox();
128 : 0 : Invalidate(maBoundingBox);
129 : 0 : }
130 : :
131 : 0 : void SAL_CALL PresenterPane::windowHidden (const lang::EventObject& rEvent)
132 : : throw (RuntimeException)
133 : : {
134 : : (void)rEvent;
135 : 0 : PresenterPaneBase::windowHidden(rEvent);
136 : :
137 [ # # ]: 0 : if (mxContentWindow.is())
138 : 0 : mxContentWindow->setVisible(sal_False);
139 : 0 : }
140 : :
141 : : //----- XPaintListener --------------------------------------------------------
142 : :
143 : 0 : void SAL_CALL PresenterPane::windowPaint (const awt::PaintEvent& rEvent)
144 : : throw (RuntimeException)
145 : : {
146 : : (void)rEvent;
147 : 0 : ThrowIfDisposed();
148 : :
149 : 0 : PaintBorder(rEvent.UpdateRect);
150 : 0 : }
151 : :
152 : : //-----------------------------------------------------------------------------
153 : :
154 : 0 : void PresenterPane::CreateCanvases (
155 : : const Reference<awt::XWindow>& rxParentWindow,
156 : : const Reference<rendering::XSpriteCanvas>& rxParentCanvas)
157 : : {
158 [ # # ]: 0 : if ( ! mxPresenterHelper.is())
159 : 0 : return;
160 [ # # ]: 0 : if ( ! rxParentWindow.is())
161 : 0 : return;
162 [ # # ]: 0 : if ( ! rxParentCanvas.is())
163 : 0 : return;
164 : :
165 : 0 : mxBorderCanvas = mxPresenterHelper->createSharedCanvas(
166 : : rxParentCanvas,
167 : : rxParentWindow,
168 : : Reference<rendering::XCanvas>(rxParentCanvas, UNO_QUERY),
169 : : rxParentWindow,
170 [ # # ][ # # ]: 0 : mxBorderWindow);
171 : 0 : mxContentCanvas = mxPresenterHelper->createSharedCanvas(
172 : : rxParentCanvas,
173 : : rxParentWindow,
174 : : Reference<rendering::XCanvas>(rxParentCanvas, UNO_QUERY),
175 : : rxParentWindow,
176 [ # # ][ # # ]: 0 : mxContentWindow);
177 : :
178 [ # # ]: 0 : PaintBorder(mxBorderWindow->getPosSize());
179 : : }
180 : :
181 : 0 : void PresenterPane::Invalidate (const css::awt::Rectangle& rRepaintBox)
182 : : {
183 : : // Invalidate the parent window to be able to invalidate an area outside
184 : : // the current window area.
185 [ # # ]: 0 : mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow, rRepaintBox);
186 : 0 : }
187 : :
188 : 0 : void PresenterPane::UpdateBoundingBox (void)
189 : : {
190 [ # # ][ # # ]: 0 : if (mxBorderWindow.is() && IsVisible())
[ # # ]
191 : 0 : maBoundingBox = mxBorderWindow->getPosSize();
192 : : else
193 : 0 : maBoundingBox = awt::Rectangle();
194 : 0 : }
195 : :
196 : : } } // end of namespace ::sd::presenter
197 : :
198 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|