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 "PresenterPaneContainer.hxx"
28cdf0e10cSrcweir #include "PresenterPaneBase.hxx"
29cdf0e10cSrcweir #include <com/sun/star/awt/XGraphics.hpp>
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ResourceId.hpp>
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using namespace ::com::sun::star;
36cdf0e10cSrcweir using namespace ::com::sun::star::uno;
37cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
38cdf0e10cSrcweir using ::rtl::OUString;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace sdext { namespace presenter {
41cdf0e10cSrcweir 
PresenterPaneContainer(const Reference<XComponentContext> & rxContext)42cdf0e10cSrcweir PresenterPaneContainer::PresenterPaneContainer (
43cdf0e10cSrcweir     const Reference<XComponentContext>& rxContext)
44cdf0e10cSrcweir     : PresenterPaneContainerInterfaceBase(m_aMutex),
45cdf0e10cSrcweir       maPanes(),
46cdf0e10cSrcweir       mxPresenterHelper()
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
49cdf0e10cSrcweir     if (xFactory.is())
50cdf0e10cSrcweir     {
51cdf0e10cSrcweir         mxPresenterHelper = Reference<drawing::XPresenterHelper>(
52cdf0e10cSrcweir             xFactory->createInstanceWithContext(
53cdf0e10cSrcweir                 OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
54cdf0e10cSrcweir                 rxContext),
55cdf0e10cSrcweir             UNO_QUERY_THROW);
56cdf0e10cSrcweir     }
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
~PresenterPaneContainer(void)62cdf0e10cSrcweir PresenterPaneContainer::~PresenterPaneContainer (void)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
PreparePane(const Reference<XResourceId> & rxPaneId,const OUString & rsViewURL,const OUString & rsTitle,const OUString & rsAccessibleTitle,const bool bIsOpaque,const ViewInitializationFunction & rViewInitialization,const double nLeft,const double nTop,const double nRight,const double nBottom)69cdf0e10cSrcweir void PresenterPaneContainer::PreparePane (
70cdf0e10cSrcweir     const Reference<XResourceId>& rxPaneId,
71cdf0e10cSrcweir     const OUString& rsViewURL,
72cdf0e10cSrcweir     const OUString& rsTitle,
73cdf0e10cSrcweir     const OUString& rsAccessibleTitle,
74cdf0e10cSrcweir     const bool bIsOpaque,
75cdf0e10cSrcweir     const ViewInitializationFunction& rViewInitialization,
76cdf0e10cSrcweir     const double nLeft,
77cdf0e10cSrcweir     const double nTop,
78cdf0e10cSrcweir     const double nRight,
79cdf0e10cSrcweir     const double nBottom)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     if ( ! rxPaneId.is())
82cdf0e10cSrcweir         return;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     SharedPaneDescriptor pPane (FindPaneURL(rxPaneId->getResourceURL()));
85cdf0e10cSrcweir     if (pPane.get() == NULL)
86cdf0e10cSrcweir     {
87cdf0e10cSrcweir         // No entry found for the given pane id.  Create a new one.
88cdf0e10cSrcweir         SharedPaneDescriptor pDescriptor (new PaneDescriptor());
89cdf0e10cSrcweir         pDescriptor->mxPaneId = rxPaneId;
90cdf0e10cSrcweir         pDescriptor->msViewURL = rsViewURL;
91cdf0e10cSrcweir         pDescriptor->mxPane = NULL;
92cdf0e10cSrcweir         if (rsTitle.indexOf('%') < 0)
93cdf0e10cSrcweir         {
94cdf0e10cSrcweir             pDescriptor->msTitle = rsTitle;
95cdf0e10cSrcweir             pDescriptor->msTitleTemplate = OUString();
96cdf0e10cSrcweir         }
97cdf0e10cSrcweir         else
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             pDescriptor->msTitleTemplate = rsTitle;
100cdf0e10cSrcweir             pDescriptor->msTitle = OUString();
101cdf0e10cSrcweir         }
102cdf0e10cSrcweir         pDescriptor->msAccessibleTitleTemplate = rsAccessibleTitle;
103cdf0e10cSrcweir         pDescriptor->maViewInitialization = rViewInitialization;
104cdf0e10cSrcweir         pDescriptor->mnLeft = nLeft;
105cdf0e10cSrcweir         pDescriptor->mnTop = nTop;
106cdf0e10cSrcweir         pDescriptor->mnRight = nRight;
107cdf0e10cSrcweir         pDescriptor->mnBottom = nBottom;
108cdf0e10cSrcweir         pDescriptor->mbIsActive = true;
109cdf0e10cSrcweir         pDescriptor->mbIsOpaque = bIsOpaque;
110cdf0e10cSrcweir         pDescriptor->maSpriteProvider = PaneDescriptor::SpriteProvider();
111cdf0e10cSrcweir         pDescriptor->mbIsSprite = false;
112cdf0e10cSrcweir         pDescriptor->maCalloutAnchorLocation = awt::Point(-1,-1);
113cdf0e10cSrcweir         pDescriptor->mbHasCalloutAnchor = false;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir         maPanes.push_back(pDescriptor);
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
disposing(void)122cdf0e10cSrcweir void SAL_CALL PresenterPaneContainer::disposing (void)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir     PaneList::iterator iPane (maPanes.begin());
125cdf0e10cSrcweir     PaneList::const_iterator iEnd (maPanes.end());
126cdf0e10cSrcweir     for ( ; iPane!=iEnd; ++iPane)
127cdf0e10cSrcweir         if ((*iPane)->mxPaneId.is())
128cdf0e10cSrcweir             RemovePane((*iPane)->mxPaneId);
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 
134cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor
StorePane(const rtl::Reference<PresenterPaneBase> & rxPane)135cdf0e10cSrcweir     PresenterPaneContainer::StorePane (const rtl::Reference<PresenterPaneBase>& rxPane)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     if (rxPane.is())
140cdf0e10cSrcweir     {
141cdf0e10cSrcweir         OUString sPaneURL;
142cdf0e10cSrcweir         Reference<XResourceId> xPaneId (rxPane->getResourceId());
143cdf0e10cSrcweir         if (xPaneId.is())
144cdf0e10cSrcweir             sPaneURL = xPaneId->getResourceURL();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         pDescriptor = FindPaneURL(sPaneURL);
147cdf0e10cSrcweir         if (pDescriptor.get() == NULL)
148cdf0e10cSrcweir             PreparePane(xPaneId, OUString(), OUString(), OUString(),
149cdf0e10cSrcweir                 false, ViewInitializationFunction(), 0,0,0,0);
150cdf0e10cSrcweir         pDescriptor = FindPaneURL(sPaneURL);
151cdf0e10cSrcweir         if (pDescriptor.get() != NULL)
152cdf0e10cSrcweir         {
153cdf0e10cSrcweir             Reference<awt::XWindow> xWindow (rxPane->getWindow());
154cdf0e10cSrcweir             pDescriptor->mxContentWindow = xWindow;
155cdf0e10cSrcweir             pDescriptor->mxPaneId = xPaneId;
156cdf0e10cSrcweir             pDescriptor->mxPane = rxPane;
157cdf0e10cSrcweir             pDescriptor->mxPane->SetTitle(pDescriptor->msTitle);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir             // When there is a call out anchor location set then tell the
160cdf0e10cSrcweir             // window about it.
161cdf0e10cSrcweir             if (pDescriptor->mbHasCalloutAnchor)
162cdf0e10cSrcweir                 pDescriptor->mxPane->SetCalloutAnchor(pDescriptor->maCalloutAnchorLocation);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir             if (xWindow.is())
165cdf0e10cSrcweir                 xWindow->addEventListener(this);
166cdf0e10cSrcweir         }
167cdf0e10cSrcweir     }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     return pDescriptor;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 
175cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor
StoreBorderWindow(const Reference<XResourceId> & rxPaneId,const Reference<awt::XWindow> & rxBorderWindow)176cdf0e10cSrcweir     PresenterPaneContainer::StoreBorderWindow(
177cdf0e10cSrcweir         const Reference<XResourceId>& rxPaneId,
178cdf0e10cSrcweir         const Reference<awt::XWindow>& rxBorderWindow)
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     // The content window may not be present.  Use the resource URL of the
181cdf0e10cSrcweir     // pane id as key.
182cdf0e10cSrcweir     OUString sPaneURL;
183cdf0e10cSrcweir     if (rxPaneId.is())
184cdf0e10cSrcweir         sPaneURL = rxPaneId->getResourceURL();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor (FindPaneURL(sPaneURL));
187cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
188cdf0e10cSrcweir     {
189cdf0e10cSrcweir         pDescriptor->mxBorderWindow = rxBorderWindow;
190cdf0e10cSrcweir         return pDescriptor;
191cdf0e10cSrcweir     }
192cdf0e10cSrcweir     else
193cdf0e10cSrcweir         return SharedPaneDescriptor();
194cdf0e10cSrcweir }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor
StoreView(const Reference<XView> & rxView,const SharedBitmapDescriptor & rpViewBackground)200cdf0e10cSrcweir     PresenterPaneContainer::StoreView (
201cdf0e10cSrcweir         const Reference<XView>& rxView,
202cdf0e10cSrcweir         const SharedBitmapDescriptor& rpViewBackground)
203cdf0e10cSrcweir {
204cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor;
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     if (rxView.is())
207cdf0e10cSrcweir     {
208cdf0e10cSrcweir         OUString sPaneURL;
209cdf0e10cSrcweir         Reference<XResourceId> xViewId (rxView->getResourceId());
210cdf0e10cSrcweir         if (xViewId.is())
211cdf0e10cSrcweir         {
212cdf0e10cSrcweir             Reference<XResourceId> xPaneId (xViewId->getAnchor());
213cdf0e10cSrcweir             if (xPaneId.is())
214cdf0e10cSrcweir                 sPaneURL = xPaneId->getResourceURL();
215cdf0e10cSrcweir         }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         pDescriptor = FindPaneURL(sPaneURL);
218cdf0e10cSrcweir         if (pDescriptor.get() != NULL)
219cdf0e10cSrcweir         {
220cdf0e10cSrcweir             pDescriptor->mxView = rxView;
221cdf0e10cSrcweir             pDescriptor->mpViewBackground = rpViewBackground;
222cdf0e10cSrcweir             pDescriptor->mxPane->SetBackground(rpViewBackground);
223cdf0e10cSrcweir             try
224cdf0e10cSrcweir             {
225cdf0e10cSrcweir                 if ( ! pDescriptor->maViewInitialization.empty())
226cdf0e10cSrcweir                     pDescriptor->maViewInitialization(rxView);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir                 // Activate or deactivate the pane/view.
229cdf0e10cSrcweir                 if ( ! pDescriptor->maActivator.empty())
230cdf0e10cSrcweir                     pDescriptor->maActivator(pDescriptor->mbIsActive);
231cdf0e10cSrcweir             }
232cdf0e10cSrcweir             catch (RuntimeException&)
233cdf0e10cSrcweir             {
234cdf0e10cSrcweir                 OSL_ASSERT(false);
235cdf0e10cSrcweir             }
236cdf0e10cSrcweir         }
237cdf0e10cSrcweir     }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     return pDescriptor;
240cdf0e10cSrcweir }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 
245cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor
RemovePane(const Reference<XResourceId> & rxPaneId)246cdf0e10cSrcweir     PresenterPaneContainer::RemovePane (const Reference<XResourceId>& rxPaneId)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor (FindPaneId(rxPaneId));
249cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
250cdf0e10cSrcweir     {
251cdf0e10cSrcweir         if (pDescriptor->mxContentWindow.is())
252cdf0e10cSrcweir             pDescriptor->mxContentWindow->removeEventListener(this);
253cdf0e10cSrcweir         pDescriptor->mxContentWindow = NULL;
254cdf0e10cSrcweir         pDescriptor->mxBorderWindow = NULL;
255cdf0e10cSrcweir         pDescriptor->mxPane = NULL;
256cdf0e10cSrcweir         pDescriptor->mxView = NULL;
257cdf0e10cSrcweir         pDescriptor->mbIsActive = false;
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir     return pDescriptor;
260cdf0e10cSrcweir }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 
266cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor
RemoveView(const Reference<XView> & rxView)267cdf0e10cSrcweir     PresenterPaneContainer::RemoveView (const Reference<XView>& rxView)
268cdf0e10cSrcweir {
269cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor;
270cdf0e10cSrcweir 
271cdf0e10cSrcweir     if (rxView.is())
272cdf0e10cSrcweir     {
273cdf0e10cSrcweir         OUString sPaneURL;
274cdf0e10cSrcweir         Reference<XResourceId> xViewId (rxView->getResourceId());
275cdf0e10cSrcweir         if (xViewId.is())
276cdf0e10cSrcweir         {
277cdf0e10cSrcweir             Reference<XResourceId> xPaneId (xViewId->getAnchor());
278cdf0e10cSrcweir             if (xPaneId.is())
279cdf0e10cSrcweir                 sPaneURL = xPaneId->getResourceURL();
280cdf0e10cSrcweir         }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         pDescriptor = FindPaneURL(sPaneURL);
283cdf0e10cSrcweir         if (pDescriptor.get() != NULL)
284cdf0e10cSrcweir         {
285cdf0e10cSrcweir             pDescriptor->mxView = NULL;
286cdf0e10cSrcweir             pDescriptor->mpViewBackground = SharedBitmapDescriptor();
287cdf0e10cSrcweir         }
288cdf0e10cSrcweir     }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     return pDescriptor;
291cdf0e10cSrcweir }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
FindBorderWindow(const Reference<awt::XWindow> & rxBorderWindow)296cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterPaneContainer::FindBorderWindow (
297cdf0e10cSrcweir     const Reference<awt::XWindow>& rxBorderWindow)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     PaneList::const_iterator iPane;
300cdf0e10cSrcweir     PaneList::iterator iEnd (maPanes.end());
301cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
302cdf0e10cSrcweir     {
303cdf0e10cSrcweir         if ((*iPane)->mxBorderWindow == rxBorderWindow)
304cdf0e10cSrcweir             return *iPane;
305cdf0e10cSrcweir     }
306cdf0e10cSrcweir     return SharedPaneDescriptor();
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 
FindContentWindow(const Reference<awt::XWindow> & rxContentWindow)312cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterPaneContainer::FindContentWindow (
313cdf0e10cSrcweir     const Reference<awt::XWindow>& rxContentWindow)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir     PaneList::const_iterator iPane;
316cdf0e10cSrcweir     PaneList::iterator iEnd (maPanes.end());
317cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir         if ((*iPane)->mxContentWindow == rxContentWindow)
320cdf0e10cSrcweir             return *iPane;
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir     return SharedPaneDescriptor();
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 
FindPaneURL(const OUString & rsPaneURL)328cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterPaneContainer::FindPaneURL (
329cdf0e10cSrcweir     const OUString& rsPaneURL)
330cdf0e10cSrcweir {
331cdf0e10cSrcweir     PaneList::const_iterator iPane;
332cdf0e10cSrcweir     PaneList::const_iterator iEnd (maPanes.end());
333cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
334cdf0e10cSrcweir     {
335cdf0e10cSrcweir         if ((*iPane)->mxPaneId->getResourceURL() == rsPaneURL)
336cdf0e10cSrcweir             return *iPane;
337cdf0e10cSrcweir     }
338cdf0e10cSrcweir     return SharedPaneDescriptor();
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 
FindPaneId(const Reference<XResourceId> & rxPaneId)344cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterPaneContainer::FindPaneId (
345cdf0e10cSrcweir     const Reference<XResourceId>& rxPaneId)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir     PaneList::iterator iEnd (maPanes.end());
348cdf0e10cSrcweir 
349cdf0e10cSrcweir     if ( ! rxPaneId.is())
350cdf0e10cSrcweir         return SharedPaneDescriptor();
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     PaneList::iterator iPane;
353cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
354cdf0e10cSrcweir     {
355cdf0e10cSrcweir         if (rxPaneId->compareTo((*iPane)->mxPaneId) == 0)
356cdf0e10cSrcweir             return *iPane;
357cdf0e10cSrcweir     }
358cdf0e10cSrcweir     return SharedPaneDescriptor();
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 
FindViewURL(const OUString & rsViewURL)364cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterPaneContainer::FindViewURL (
365cdf0e10cSrcweir     const OUString& rsViewURL)
366cdf0e10cSrcweir {
367cdf0e10cSrcweir     PaneList::iterator iEnd (maPanes.end());
368cdf0e10cSrcweir     PaneList::iterator iPane;
369cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
370cdf0e10cSrcweir     {
371cdf0e10cSrcweir         if (rsViewURL == (*iPane)->msViewURL)
372cdf0e10cSrcweir             return *iPane;
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir     return SharedPaneDescriptor();
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 
GetPaneURLForViewURL(const::rtl::OUString & rsViewURL)380cdf0e10cSrcweir ::rtl::OUString PresenterPaneContainer::GetPaneURLForViewURL (const ::rtl::OUString& rsViewURL)
381cdf0e10cSrcweir {
382cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor (FindViewURL(rsViewURL));
383cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
384cdf0e10cSrcweir         if (pDescriptor->mxPaneId.is())
385cdf0e10cSrcweir             return pDescriptor->mxPaneId->getResourceURL();
386cdf0e10cSrcweir     return OUString();
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 
ToTop(const SharedPaneDescriptor & rpDescriptor)392cdf0e10cSrcweir void PresenterPaneContainer::ToTop (const SharedPaneDescriptor& rpDescriptor)
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     if (rpDescriptor.get() != NULL)
395cdf0e10cSrcweir     {
396cdf0e10cSrcweir         // Find iterator for pDescriptor.
397cdf0e10cSrcweir         PaneList::iterator iPane;
398cdf0e10cSrcweir         PaneList::iterator iEnd (maPanes.end());
399cdf0e10cSrcweir         for (iPane=maPanes.begin(); iPane!=iEnd; ++iPane)
400cdf0e10cSrcweir             if (iPane->get() == rpDescriptor.get())
401cdf0e10cSrcweir                 break;
402cdf0e10cSrcweir         OSL_ASSERT(iPane!=iEnd);
403cdf0e10cSrcweir         if (iPane == iEnd)
404cdf0e10cSrcweir             return;
405cdf0e10cSrcweir 
406cdf0e10cSrcweir         if (mxPresenterHelper.is())
407cdf0e10cSrcweir             mxPresenterHelper->toTop(rpDescriptor->mxBorderWindow);
408cdf0e10cSrcweir 
409cdf0e10cSrcweir         maPanes.erase(iPane);
410cdf0e10cSrcweir         maPanes.push_back(rpDescriptor);
411cdf0e10cSrcweir     }
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 
417cdf0e10cSrcweir //----- XEventListener --------------------------------------------------------
418cdf0e10cSrcweir 
disposing(const com::sun::star::lang::EventObject & rEvent)419cdf0e10cSrcweir void SAL_CALL PresenterPaneContainer::disposing (
420cdf0e10cSrcweir     const com::sun::star::lang::EventObject& rEvent)
421cdf0e10cSrcweir     throw (com::sun::star::uno::RuntimeException)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir     SharedPaneDescriptor pDescriptor (
424cdf0e10cSrcweir         FindContentWindow(Reference<awt::XWindow>(rEvent.Source, UNO_QUERY)));
425cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
426cdf0e10cSrcweir     {
427cdf0e10cSrcweir         RemovePane(pDescriptor->mxPaneId);
428cdf0e10cSrcweir     }
429cdf0e10cSrcweir }
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 
434cdf0e10cSrcweir //===== PresenterPaneContainer::PaneDescriptor ================================
435cdf0e10cSrcweir 
SetActivationState(const bool bIsActive)436cdf0e10cSrcweir void PresenterPaneContainer::PaneDescriptor::SetActivationState (const bool bIsActive)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir     mbIsActive = bIsActive;
439cdf0e10cSrcweir     if ( ! maActivator.empty())
440cdf0e10cSrcweir         maActivator(mbIsActive);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir } } // end of namespace ::sdext::presenter
444