1*c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c142477cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c142477cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c142477cSAndrew Rist  * distributed with this work for additional information
6*c142477cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c142477cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c142477cSAndrew Rist  * "License"); you may not use this file except in compliance
9*c142477cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c142477cSAndrew Rist  *
11*c142477cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c142477cSAndrew Rist  *
13*c142477cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c142477cSAndrew Rist  * software distributed under the License is distributed on an
15*c142477cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c142477cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c142477cSAndrew Rist  * specific language governing permissions and limitations
18*c142477cSAndrew Rist  * under the License.
19*c142477cSAndrew Rist  *
20*c142477cSAndrew Rist  *************************************************************/
21*c142477cSAndrew Rist 
22*c142477cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "PresenterPaneBase.hxx"
28cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx"
29cdf0e10cSrcweir #include "PresenterController.hxx"
30cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx"
31cdf0e10cSrcweir #include "PresenterPaintManager.hxx"
32cdf0e10cSrcweir #include "PresenterTextView.hxx"
33cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/XWindow2.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp>
37cdf0e10cSrcweir #include <com/sun/star/drawing/CanvasFeature.hpp>
38cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp>
39cdf0e10cSrcweir #include <com/sun/star/rendering/TexturingMode.hpp>
40cdf0e10cSrcweir #include <osl/mutex.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir using namespace ::com::sun::star;
43cdf0e10cSrcweir using namespace ::com::sun::star::uno;
44cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
45cdf0e10cSrcweir using ::rtl::OUString;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace sdext { namespace presenter {
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //===== PresenterPaneBase =====================================================
50cdf0e10cSrcweir 
PresenterPaneBase(const Reference<XComponentContext> & rxContext,const::rtl::Reference<PresenterController> & rpPresenterController)51cdf0e10cSrcweir PresenterPaneBase::PresenterPaneBase (
52cdf0e10cSrcweir     const Reference<XComponentContext>& rxContext,
53cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController)
54cdf0e10cSrcweir     : PresenterPaneBaseInterfaceBase(m_aMutex),
55cdf0e10cSrcweir       mpPresenterController(rpPresenterController),
56cdf0e10cSrcweir       mxParentWindow(),
57cdf0e10cSrcweir       mxBorderWindow(),
58cdf0e10cSrcweir       mxBorderCanvas(),
59cdf0e10cSrcweir       mxContentWindow(),
60cdf0e10cSrcweir       mxContentCanvas(),
61cdf0e10cSrcweir       mxPaneId(),
62cdf0e10cSrcweir       mxBorderPainter(),
63cdf0e10cSrcweir       mxPresenterHelper(),
64cdf0e10cSrcweir       msTitle(),
65cdf0e10cSrcweir       mxComponentContext(rxContext),
66cdf0e10cSrcweir       mpViewBackground(),
67cdf0e10cSrcweir       mbHasCallout(false),
68cdf0e10cSrcweir       maCalloutAnchor()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     if (mpPresenterController.get() != NULL)
71cdf0e10cSrcweir         mxPresenterHelper = mpPresenterController->GetPresenterHelper();
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
~PresenterPaneBase(void)77cdf0e10cSrcweir PresenterPaneBase::~PresenterPaneBase (void)
78cdf0e10cSrcweir {
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
disposing(void)84cdf0e10cSrcweir void PresenterPaneBase::disposing (void)
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     if (mxBorderWindow.is())
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         mxBorderWindow->removeWindowListener(this);
89cdf0e10cSrcweir         mxBorderWindow->removePaintListener(this);
90cdf0e10cSrcweir     }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     {
93cdf0e10cSrcweir         Reference<XComponent> xComponent (mxContentCanvas, UNO_QUERY);
94cdf0e10cSrcweir         mxContentCanvas = NULL;
95cdf0e10cSrcweir         if (xComponent.is())
96cdf0e10cSrcweir             xComponent->dispose();
97cdf0e10cSrcweir     }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     {
100cdf0e10cSrcweir         Reference<XComponent> xComponent (mxContentWindow, UNO_QUERY);
101cdf0e10cSrcweir         mxContentWindow = NULL;
102cdf0e10cSrcweir         if (xComponent.is())
103cdf0e10cSrcweir             xComponent->dispose();
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir         Reference<XComponent> xComponent (mxBorderCanvas, UNO_QUERY);
108cdf0e10cSrcweir         mxBorderCanvas = NULL;
109cdf0e10cSrcweir         if (xComponent.is())
110cdf0e10cSrcweir             xComponent->dispose();
111cdf0e10cSrcweir     }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     {
114cdf0e10cSrcweir         Reference<XComponent> xComponent (mxBorderWindow, UNO_QUERY);
115cdf0e10cSrcweir         mxBorderWindow = NULL;
116cdf0e10cSrcweir         if (xComponent.is())
117cdf0e10cSrcweir             xComponent->dispose();
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     mxComponentContext = NULL;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
SetTitle(const OUString & rsTitle)126cdf0e10cSrcweir void PresenterPaneBase::SetTitle (const OUString& rsTitle)
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     msTitle = rsTitle;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     OSL_ASSERT(mpPresenterController.get()!=NULL);
131cdf0e10cSrcweir     OSL_ASSERT(mpPresenterController->GetPaintManager().get()!=NULL);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     mpPresenterController->GetPaintManager()->Invalidate(mxBorderWindow);
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 
GetTitle(void) const139cdf0e10cSrcweir ::rtl::OUString PresenterPaneBase::GetTitle (void) const
140cdf0e10cSrcweir {
141cdf0e10cSrcweir     return msTitle;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 
147cdf0e10cSrcweir Reference<drawing::framework::XPaneBorderPainter>
GetPaneBorderPainter(void) const148cdf0e10cSrcweir     PresenterPaneBase::GetPaneBorderPainter (void) const
149cdf0e10cSrcweir {
150cdf0e10cSrcweir     return mxBorderPainter;
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 
SetCalloutAnchor(const css::awt::Point & rCalloutAnchor)156cdf0e10cSrcweir void PresenterPaneBase::SetCalloutAnchor (const css::awt::Point& rCalloutAnchor)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir     mbHasCallout = true;
159cdf0e10cSrcweir     // Anchor is given in the coorindate system of the parent window.
160cdf0e10cSrcweir     // Transform it into the local coordinate system.
161cdf0e10cSrcweir     maCalloutAnchor = rCalloutAnchor;
162cdf0e10cSrcweir     const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize());
163cdf0e10cSrcweir     maCalloutAnchor.X -= aBorderBox.X;
164cdf0e10cSrcweir     maCalloutAnchor.Y -= aBorderBox.Y;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     // Move the bottom of the border window so that it goes through the
167cdf0e10cSrcweir     // callout anchor (special case for bottom callout).
168cdf0e10cSrcweir     sal_Int32 nHeight (rCalloutAnchor.Y - aBorderBox.Y);
169cdf0e10cSrcweir     if (mxBorderPainter.is() && mxPaneId.is())
170cdf0e10cSrcweir         nHeight += mxBorderPainter->getCalloutOffset(mxPaneId->getResourceURL()).Y;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     if (nHeight != aBorderBox.Height)
173cdf0e10cSrcweir     {
174cdf0e10cSrcweir         mxBorderWindow->setPosSize(
175cdf0e10cSrcweir             aBorderBox.X,
176cdf0e10cSrcweir             aBorderBox.Y,
177cdf0e10cSrcweir             aBorderBox.Width,
178cdf0e10cSrcweir             nHeight,
179cdf0e10cSrcweir             awt::PosSize::HEIGHT);
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     mpPresenterController->GetPaintManager()->Invalidate(mxBorderWindow);
183cdf0e10cSrcweir }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 
GetCalloutAnchor(void) const188cdf0e10cSrcweir awt::Point PresenterPaneBase::GetCalloutAnchor (void) const
189cdf0e10cSrcweir {
190cdf0e10cSrcweir     return maCalloutAnchor;
191cdf0e10cSrcweir }
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 
GetTextViewForTitle(void)196cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView> PresenterPaneBase::GetTextViewForTitle (void)
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     ::boost::shared_ptr<PresenterTextView> pTextView(
199cdf0e10cSrcweir         new PresenterTextView(
200cdf0e10cSrcweir             mxComponentContext,
201cdf0e10cSrcweir             mxBorderCanvas));
202cdf0e10cSrcweir     pTextView->SetText(msTitle);
203cdf0e10cSrcweir     return pTextView;
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 
209cdf0e10cSrcweir //----- XInitialization -------------------------------------------------------
210cdf0e10cSrcweir 
initialize(const Sequence<Any> & rArguments)211cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments)
212cdf0e10cSrcweir     throw (Exception, RuntimeException)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir     ThrowIfDisposed();
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     if ( ! mxComponentContext.is())
217cdf0e10cSrcweir     {
218cdf0e10cSrcweir         throw RuntimeException(
219cdf0e10cSrcweir             OUString::createFromAscii("PresenterSpritePane: missing component context"),
220cdf0e10cSrcweir             static_cast<XWeak*>(this));
221cdf0e10cSrcweir     }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     if (rArguments.getLength() == 5 || rArguments.getLength() == 6)
224cdf0e10cSrcweir     {
225cdf0e10cSrcweir         try
226cdf0e10cSrcweir         {
227cdf0e10cSrcweir             // Get the resource id from the first argument.
228cdf0e10cSrcweir             if ( ! (rArguments[0] >>= mxPaneId))
229cdf0e10cSrcweir             {
230cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
231cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid pane id"),
232cdf0e10cSrcweir                     static_cast<XWeak*>(this),
233cdf0e10cSrcweir                     0);
234cdf0e10cSrcweir             }
235cdf0e10cSrcweir 
236cdf0e10cSrcweir             if ( ! (rArguments[1] >>= mxParentWindow))
237cdf0e10cSrcweir             {
238cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
239cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid parent window"),
240cdf0e10cSrcweir                     static_cast<XWeak*>(this),
241cdf0e10cSrcweir                     1);
242cdf0e10cSrcweir             }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir             Reference<rendering::XSpriteCanvas> xParentCanvas;
245cdf0e10cSrcweir             if ( ! (rArguments[2] >>= xParentCanvas))
246cdf0e10cSrcweir             {
247cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
248cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid parent canvas"),
249cdf0e10cSrcweir                     static_cast<XWeak*>(this),
250cdf0e10cSrcweir                     2);
251cdf0e10cSrcweir             }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir             if ( ! (rArguments[3] >>= msTitle))
254cdf0e10cSrcweir             {
255cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
256cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid title"),
257cdf0e10cSrcweir                     static_cast<XWeak*>(this),
258cdf0e10cSrcweir                     3);
259cdf0e10cSrcweir             }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir             if ( ! (rArguments[4] >>= mxBorderPainter))
262cdf0e10cSrcweir             {
263cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
264cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid border painter"),
265cdf0e10cSrcweir                     static_cast<XWeak*>(this),
266cdf0e10cSrcweir                     4);
267cdf0e10cSrcweir             }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir             bool bIsWindowVisibleOnCreation (true);
270cdf0e10cSrcweir             if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation))
271cdf0e10cSrcweir             {
272cdf0e10cSrcweir                 throw lang::IllegalArgumentException(
273cdf0e10cSrcweir                     OUString::createFromAscii("PresenterPane: invalid window visibility flag"),
274cdf0e10cSrcweir                     static_cast<XWeak*>(this),
275cdf0e10cSrcweir                     5);
276cdf0e10cSrcweir             }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir             CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir             if (mxBorderWindow.is())
281cdf0e10cSrcweir             {
282cdf0e10cSrcweir                 mxBorderWindow->addWindowListener(this);
283cdf0e10cSrcweir                 mxBorderWindow->addPaintListener(this);
284cdf0e10cSrcweir             }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir             CreateCanvases(mxParentWindow, xParentCanvas);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir             // Raise new windows.
289cdf0e10cSrcweir             ToTop();
290cdf0e10cSrcweir         }
291cdf0e10cSrcweir         catch (Exception&)
292cdf0e10cSrcweir         {
293cdf0e10cSrcweir             mxContentWindow = NULL;
294cdf0e10cSrcweir             mxComponentContext = NULL;
295cdf0e10cSrcweir             throw;
296cdf0e10cSrcweir         }
297cdf0e10cSrcweir     }
298cdf0e10cSrcweir     else
299cdf0e10cSrcweir     {
300cdf0e10cSrcweir         throw RuntimeException(
301cdf0e10cSrcweir             OUString::createFromAscii("PresenterSpritePane: invalid number of arguments"),
302cdf0e10cSrcweir                 static_cast<XWeak*>(this));
303cdf0e10cSrcweir     }
304cdf0e10cSrcweir }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 
309cdf0e10cSrcweir //----- XResourceId -----------------------------------------------------------
310cdf0e10cSrcweir 
getResourceId(void)311cdf0e10cSrcweir Reference<XResourceId> SAL_CALL PresenterPaneBase::getResourceId (void)
312cdf0e10cSrcweir     throw (RuntimeException)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir     ThrowIfDisposed();
315cdf0e10cSrcweir     return mxPaneId;
316cdf0e10cSrcweir }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 
isAnchorOnly(void)321cdf0e10cSrcweir sal_Bool SAL_CALL PresenterPaneBase::isAnchorOnly (void)
322cdf0e10cSrcweir     throw (RuntimeException)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     return true;
325cdf0e10cSrcweir }
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 
330cdf0e10cSrcweir //----- XWindowListener -------------------------------------------------------
331cdf0e10cSrcweir 
windowResized(const awt::WindowEvent & rEvent)332cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowResized (const awt::WindowEvent& rEvent)
333cdf0e10cSrcweir     throw (RuntimeException)
334cdf0e10cSrcweir {
335cdf0e10cSrcweir     (void)rEvent;
336cdf0e10cSrcweir     ThrowIfDisposed();
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 
windowMoved(const awt::WindowEvent & rEvent)343cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowMoved (const awt::WindowEvent& rEvent)
344cdf0e10cSrcweir     throw (RuntimeException)
345cdf0e10cSrcweir {
346cdf0e10cSrcweir     (void)rEvent;
347cdf0e10cSrcweir     ThrowIfDisposed();
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 
windowShown(const lang::EventObject & rEvent)353cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowShown (const lang::EventObject& rEvent)
354cdf0e10cSrcweir     throw (RuntimeException)
355cdf0e10cSrcweir {
356cdf0e10cSrcweir     (void)rEvent;
357cdf0e10cSrcweir     ThrowIfDisposed();
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 
windowHidden(const lang::EventObject & rEvent)363cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::windowHidden (const lang::EventObject& rEvent)
364cdf0e10cSrcweir     throw (RuntimeException)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     (void)rEvent;
367cdf0e10cSrcweir     ThrowIfDisposed();
368cdf0e10cSrcweir }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 
373cdf0e10cSrcweir //----- lang::XEventListener --------------------------------------------------
374cdf0e10cSrcweir 
disposing(const lang::EventObject & rEvent)375cdf0e10cSrcweir void SAL_CALL PresenterPaneBase::disposing (const lang::EventObject& rEvent)
376cdf0e10cSrcweir     throw (RuntimeException)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir     if (rEvent.Source == mxBorderWindow)
379cdf0e10cSrcweir     {
380cdf0e10cSrcweir         mxBorderWindow = NULL;
381cdf0e10cSrcweir     }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 
387cdf0e10cSrcweir //-----------------------------------------------------------------------------
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 
CreateWindows(const Reference<awt::XWindow> & rxParentWindow,const bool bIsWindowVisibleOnCreation)390cdf0e10cSrcweir void PresenterPaneBase::CreateWindows (
391cdf0e10cSrcweir     const Reference<awt::XWindow>& rxParentWindow,
392cdf0e10cSrcweir     const bool bIsWindowVisibleOnCreation)
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     if (mxPresenterHelper.is() && rxParentWindow.is())
395cdf0e10cSrcweir     {
396cdf0e10cSrcweir 
397cdf0e10cSrcweir         mxBorderWindow = mxPresenterHelper->createWindow(
398cdf0e10cSrcweir             rxParentWindow,
399cdf0e10cSrcweir             sal_False,
400cdf0e10cSrcweir             bIsWindowVisibleOnCreation,
401cdf0e10cSrcweir             sal_False,
402cdf0e10cSrcweir             sal_False);
403cdf0e10cSrcweir         mxContentWindow = mxPresenterHelper->createWindow(
404cdf0e10cSrcweir             mxBorderWindow,
405cdf0e10cSrcweir             sal_False,
406cdf0e10cSrcweir             bIsWindowVisibleOnCreation,
407cdf0e10cSrcweir             sal_False,
408cdf0e10cSrcweir             sal_False);
409cdf0e10cSrcweir     }
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 
GetBorderWindow(void) const415cdf0e10cSrcweir Reference<awt::XWindow> PresenterPaneBase::GetBorderWindow (void) const
416cdf0e10cSrcweir {
417cdf0e10cSrcweir     return mxBorderWindow;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 
ToTop(void)423cdf0e10cSrcweir void PresenterPaneBase::ToTop (void)
424cdf0e10cSrcweir {
425cdf0e10cSrcweir     if (mxPresenterHelper.is())
426cdf0e10cSrcweir         mxPresenterHelper->toTop(mxContentWindow);
427cdf0e10cSrcweir }
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 
SetBackground(const SharedBitmapDescriptor & rpBackground)432cdf0e10cSrcweir void PresenterPaneBase::SetBackground (const SharedBitmapDescriptor& rpBackground)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir     mpViewBackground = rpBackground;
435cdf0e10cSrcweir }
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 
PaintBorderBackground(const awt::Rectangle & rBorderBox,const awt::Rectangle & rUpdateBox)440cdf0e10cSrcweir void PresenterPaneBase::PaintBorderBackground (
441cdf0e10cSrcweir     const awt::Rectangle& rBorderBox,
442cdf0e10cSrcweir     const awt::Rectangle& rUpdateBox)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir     (void)rBorderBox;
445cdf0e10cSrcweir     (void)rUpdateBox;
446cdf0e10cSrcweir     /*
447cdf0e10cSrcweir     // The outer box of the border is given.  We need the center and inner
448cdf0e10cSrcweir     // box as well.
449cdf0e10cSrcweir     awt::Rectangle aCenterBox (
450cdf0e10cSrcweir         mxBorderPainter->removeBorder(
451cdf0e10cSrcweir             mxPaneId->getResourceURL(),
452cdf0e10cSrcweir             rBorderBox,
453cdf0e10cSrcweir             drawing::framework::BorderType_OUTER_BORDER));
454cdf0e10cSrcweir     awt::Rectangle aInnerBox (
455cdf0e10cSrcweir         mxBorderPainter->removeBorder(
456cdf0e10cSrcweir             mxPaneId->getResourceURL(),
457cdf0e10cSrcweir             rBorderBox,
458cdf0e10cSrcweir             drawing::framework::BorderType_TOTAL_BORDER));
459cdf0e10cSrcweir     mpPresenterController->GetCanvasHelper()->Paint(
460cdf0e10cSrcweir         mpViewBackground,
461cdf0e10cSrcweir         mxBorderCanvas,
462cdf0e10cSrcweir         rUpdateBox,
463cdf0e10cSrcweir         aCenterBox,
464cdf0e10cSrcweir         aInnerBox);
465cdf0e10cSrcweir     */
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 
PaintBorder(const awt::Rectangle & rUpdateBox)471cdf0e10cSrcweir void PresenterPaneBase::PaintBorder (const awt::Rectangle& rUpdateBox)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir     OSL_ASSERT(mxPaneId.is());
474cdf0e10cSrcweir 
475cdf0e10cSrcweir     if (mxBorderPainter.is() && mxBorderWindow.is() && mxBorderCanvas.is())
476cdf0e10cSrcweir     {
477cdf0e10cSrcweir         awt::Rectangle aBorderBox (mxBorderWindow->getPosSize());
478cdf0e10cSrcweir         awt::Rectangle aLocalBorderBox (0,0, aBorderBox.Width, aBorderBox.Height);
479cdf0e10cSrcweir 
480cdf0e10cSrcweir         PaintBorderBackground(aLocalBorderBox, rUpdateBox);
481cdf0e10cSrcweir 
482cdf0e10cSrcweir         if (mbHasCallout)
483cdf0e10cSrcweir             mxBorderPainter->paintBorderWithCallout(
484cdf0e10cSrcweir                 mxPaneId->getResourceURL(),
485cdf0e10cSrcweir                 mxBorderCanvas,
486cdf0e10cSrcweir                 aLocalBorderBox,
487cdf0e10cSrcweir                 rUpdateBox,
488cdf0e10cSrcweir                 msTitle,
489cdf0e10cSrcweir                 maCalloutAnchor);
490cdf0e10cSrcweir         else
491cdf0e10cSrcweir             mxBorderPainter->paintBorder(
492cdf0e10cSrcweir                 mxPaneId->getResourceURL(),
493cdf0e10cSrcweir                 mxBorderCanvas,
494cdf0e10cSrcweir                 aLocalBorderBox,
495cdf0e10cSrcweir                 rUpdateBox,
496cdf0e10cSrcweir                 msTitle);
497cdf0e10cSrcweir     }
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 
LayoutContextWindow(void)503cdf0e10cSrcweir void PresenterPaneBase::LayoutContextWindow (void)
504cdf0e10cSrcweir {
505cdf0e10cSrcweir     OSL_ASSERT(mxPaneId.is());
506cdf0e10cSrcweir     OSL_ASSERT(mxBorderWindow.is());
507cdf0e10cSrcweir     OSL_ASSERT(mxContentWindow.is());
508cdf0e10cSrcweir     if (mxBorderPainter.is() && mxPaneId.is() && mxBorderWindow.is() && mxContentWindow.is())
509cdf0e10cSrcweir     {
510cdf0e10cSrcweir         const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize());
511cdf0e10cSrcweir         const awt::Rectangle aInnerBox (mxBorderPainter->removeBorder(
512cdf0e10cSrcweir             mxPaneId->getResourceURL(),
513cdf0e10cSrcweir             aBorderBox,
514cdf0e10cSrcweir             drawing::framework::BorderType_TOTAL_BORDER));
515cdf0e10cSrcweir         mxContentWindow->setPosSize(
516cdf0e10cSrcweir             aInnerBox.X - aBorderBox.X,
517cdf0e10cSrcweir             aInnerBox.Y - aBorderBox.Y,
518cdf0e10cSrcweir             aInnerBox.Width,
519cdf0e10cSrcweir             aInnerBox.Height,
520cdf0e10cSrcweir             awt::PosSize::POSSIZE);
521cdf0e10cSrcweir     }
522cdf0e10cSrcweir }
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 
IsVisible(void) const527cdf0e10cSrcweir bool PresenterPaneBase::IsVisible (void) const
528cdf0e10cSrcweir {
529cdf0e10cSrcweir     Reference<awt::XWindow2> xWindow2 (mxBorderPainter, UNO_QUERY);
530cdf0e10cSrcweir     if (xWindow2.is())
531cdf0e10cSrcweir         return xWindow2->isVisible();
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     return false;
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 
ThrowIfDisposed(void)539cdf0e10cSrcweir void PresenterPaneBase::ThrowIfDisposed (void)
540cdf0e10cSrcweir     throw (::com::sun::star::lang::DisposedException)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir 	if (rBHelper.bDisposed || rBHelper.bInDispose)
543cdf0e10cSrcweir 	{
544cdf0e10cSrcweir         throw lang::DisposedException (
545cdf0e10cSrcweir             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
546cdf0e10cSrcweir                 "PresenterPane object has already been disposed")),
547cdf0e10cSrcweir             static_cast<uno::XWeak*>(this));
548cdf0e10cSrcweir     }
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 
554cdf0e10cSrcweir } } // end of namespace ::sd::presenter
555