Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #undef ENABLE_PANE_RESIZING
21 : //#define ENABLE_PANE_RESIZING
22 :
23 : #include "vcl/svapp.hxx"
24 : #include "vcl/settings.hxx"
25 : #include "PresenterWindowManager.hxx"
26 : #include "PresenterController.hxx"
27 : #include "PresenterGeometryHelper.hxx"
28 : #include "PresenterHelper.hxx"
29 : #include "PresenterPaintManager.hxx"
30 : #include "PresenterPaneBase.hxx"
31 : #include "PresenterPaneBorderManager.hxx"
32 : #include "PresenterPaneBorderPainter.hxx"
33 : #include "PresenterPaneContainer.hxx"
34 : #include "PresenterPaneFactory.hxx"
35 : #include "PresenterSprite.hxx"
36 : #include "PresenterToolBar.hxx"
37 : #include "PresenterViewFactory.hxx"
38 : #include "PresenterTheme.hxx"
39 : #include <com/sun/star/awt/InvalidateStyle.hpp>
40 : #include <com/sun/star/awt/PosSize.hpp>
41 : #include <com/sun/star/awt/SystemPointer.hpp>
42 : #include <com/sun/star/awt/XDevice.hpp>
43 : #include <com/sun/star/awt/XWindow2.hpp>
44 : #include <com/sun/star/awt/XWindowPeer.hpp>
45 : #include <com/sun/star/awt/WindowAttribute.hpp>
46 : #include <com/sun/star/container/XChild.hpp>
47 : #include <com/sun/star/drawing/framework/ResourceId.hpp>
48 : #include <com/sun/star/rendering/CompositeOperation.hpp>
49 : #include <com/sun/star/rendering/FillRule.hpp>
50 : #include <com/sun/star/rendering/PathCapType.hpp>
51 : #include <com/sun/star/rendering/PathJoinType.hpp>
52 : #include <com/sun/star/rendering/Texture.hpp>
53 : #include <com/sun/star/rendering/TexturingMode.hpp>
54 : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
55 : #include <math.h>
56 :
57 : using namespace ::com::sun::star;
58 : using namespace ::com::sun::star::uno;
59 : using namespace ::com::sun::star::drawing::framework;
60 :
61 : namespace sdext { namespace presenter {
62 :
63 : //===== PresenterWindowManager ================================================
64 :
65 0 : PresenterWindowManager::PresenterWindowManager (
66 : const Reference<XComponentContext>& rxContext,
67 : const ::rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
68 : const ::rtl::Reference<PresenterController>& rpPresenterController)
69 : : PresenterWindowManagerInterfaceBase(m_aMutex),
70 : mxComponentContext(rxContext),
71 : mpPresenterController(rpPresenterController),
72 : mxParentWindow(),
73 : mxParentCanvas(),
74 : mxPaneBorderManager(),
75 : mpPaneBorderPainter(),
76 : mpPaneContainer(rpPaneContainer),
77 : mbIsLayoutPending(true),
78 : mbIsLayouting(false),
79 : mpTheme(),
80 : mpBackgroundBitmap(),
81 : mxScaledBackgroundBitmap(),
82 : maPaneBackgroundColor(),
83 : mxClipPolygon(),
84 : meLayoutMode(LM_Generic),
85 : mbIsSlideSorterActive(false),
86 : mbIsHelpViewActive(false),
87 : maLayoutListeners(),
88 0 : mbIsMouseClickPending(false)
89 : {
90 0 : UpdateWindowList();
91 0 : }
92 :
93 0 : PresenterWindowManager::~PresenterWindowManager()
94 : {
95 0 : }
96 :
97 0 : void SAL_CALL PresenterWindowManager::disposing()
98 : {
99 0 : NotifyDisposing();
100 :
101 0 : SetParentPane(NULL);
102 :
103 0 : Reference<lang::XComponent> xComponent (mxPaneBorderManager, UNO_QUERY);
104 0 : if (xComponent.is())
105 0 : xComponent->dispose();
106 0 : mxPaneBorderManager = NULL;
107 :
108 0 : PresenterPaneContainer::PaneList::const_iterator iPane;
109 0 : PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end());
110 0 : for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane)
111 : {
112 0 : if ((*iPane)->mxBorderWindow.is())
113 : {
114 0 : (*iPane)->mxBorderWindow->removeWindowListener(this);
115 0 : (*iPane)->mxBorderWindow->removeFocusListener(this);
116 : #ifndef ENABLE_PANE_RESIZING
117 0 : (*iPane)->mxBorderWindow->removeMouseListener(this);
118 : #endif
119 : }
120 0 : }
121 0 : }
122 :
123 0 : void PresenterWindowManager::SetParentPane (
124 : const Reference<drawing::framework::XPane>& rxPane)
125 : {
126 0 : if (mxParentWindow.is())
127 : {
128 0 : mxParentWindow->removeWindowListener(this);
129 0 : mxParentWindow->removePaintListener(this);
130 0 : mxParentWindow->removeMouseListener(this);
131 0 : mxParentWindow->removeFocusListener(this);
132 : }
133 0 : mxParentWindow = NULL;
134 0 : mxParentCanvas = NULL;
135 :
136 0 : if (rxPane.is())
137 : {
138 0 : mxParentWindow = rxPane->getWindow();
139 0 : mxParentCanvas = rxPane->getCanvas();
140 : }
141 : else
142 : {
143 0 : mxParentWindow = NULL;
144 : }
145 :
146 0 : if (mxParentWindow.is())
147 : {
148 0 : mxParentWindow->addWindowListener(this);
149 0 : mxParentWindow->addPaintListener(this);
150 0 : mxParentWindow->addMouseListener(this);
151 0 : mxParentWindow->addFocusListener(this);
152 :
153 : // We paint our own background, make that of the parent window transparent.
154 0 : Reference<awt::XWindowPeer> xPeer (mxParentWindow, UNO_QUERY);
155 0 : if (xPeer.is())
156 0 : xPeer->setBackground(util::Color(0xff000000));
157 : }
158 0 : }
159 :
160 0 : void PresenterWindowManager::SetTheme (const ::boost::shared_ptr<PresenterTheme>& rpTheme)
161 : {
162 0 : mpTheme = rpTheme;
163 :
164 : // Get background bitmap or background color from the theme.
165 :
166 0 : if (mpTheme.get() != NULL)
167 : {
168 0 : mpBackgroundBitmap = mpTheme->GetBitmap(OUString(), "Background");
169 : }
170 0 : }
171 :
172 0 : void PresenterWindowManager::NotifyViewCreation (const Reference<XView>& rxView)
173 : {
174 : PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
175 0 : mpPaneContainer->FindPaneId(rxView->getResourceId()->getAnchor()));
176 : OSL_ASSERT(pDescriptor.get() != NULL);
177 0 : if (pDescriptor.get() != NULL)
178 : {
179 0 : Layout();
180 :
181 : mpPresenterController->GetPaintManager()->Invalidate(
182 0 : pDescriptor->mxContentWindow,
183 : (sal_Int16)(awt::InvalidateStyle::TRANSPARENT
184 0 : | awt::InvalidateStyle::CHILDREN));
185 0 : }
186 0 : }
187 :
188 0 : void PresenterWindowManager::SetPanePosSizeAbsolute (
189 : const OUString& rsPaneURL,
190 : const double nX,
191 : const double nY,
192 : const double nWidth,
193 : const double nHeight)
194 : {
195 : PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
196 0 : mpPaneContainer->FindPaneURL(rsPaneURL));
197 0 : if (pDescriptor.get() != NULL)
198 : {
199 0 : awt::Rectangle aParentBox = mxParentWindow->getPosSize();
200 0 : if (aParentBox.Width > 0 && aParentBox.Height > 0)
201 : {
202 0 : pDescriptor->mnLeft = nX / aParentBox.Width;
203 0 : pDescriptor->mnTop = nY / aParentBox.Height;
204 0 : pDescriptor->mnRight = (nX + nWidth) / aParentBox.Width;
205 0 : pDescriptor->mnBottom = (nY + nHeight) / aParentBox.Height;
206 : }
207 0 : if (pDescriptor->mxBorderWindow.is())
208 0 : pDescriptor->mxBorderWindow->setPosSize(
209 : ::sal::static_int_cast<sal_Int32>(nX),
210 : ::sal::static_int_cast<sal_Int32>(nY),
211 : ::sal::static_int_cast<sal_Int32>(nWidth),
212 : ::sal::static_int_cast<sal_Int32>(nHeight),
213 0 : awt::PosSize::POSSIZE);
214 0 : }
215 0 : }
216 :
217 0 : void PresenterWindowManager::SetPaneBorderPainter (
218 : const ::rtl::Reference<PresenterPaneBorderPainter>& rPainter)
219 : {
220 0 : mpPaneBorderPainter = rPainter;
221 0 : }
222 :
223 : //----- XWindowListener -------------------------------------------------------
224 :
225 0 : void SAL_CALL PresenterWindowManager::windowResized (const awt::WindowEvent& rEvent)
226 : throw (RuntimeException, std::exception)
227 : {
228 0 : ThrowIfDisposed();
229 0 : if (rEvent.Source == mxParentWindow)
230 : {
231 0 : Layout();
232 : }
233 : else
234 : {
235 0 : Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY);
236 0 : if (xWindow.is())
237 : {
238 0 : UpdateWindowSize(xWindow);
239 :
240 : // Make sure the background of a transparent window is painted.
241 0 : mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow);
242 0 : }
243 : }
244 0 : }
245 :
246 0 : void SAL_CALL PresenterWindowManager::windowMoved (const awt::WindowEvent& rEvent)
247 : throw (RuntimeException, std::exception)
248 : {
249 0 : ThrowIfDisposed();
250 0 : if (rEvent.Source != mxParentWindow)
251 : {
252 0 : Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY);
253 0 : UpdateWindowSize(xWindow);
254 :
255 : // Make sure the background of a transparent window is painted.
256 0 : mpPresenterController->GetPaintManager()->Invalidate(xWindow);
257 : }
258 0 : }
259 :
260 0 : void SAL_CALL PresenterWindowManager::windowShown (const lang::EventObject& rEvent)
261 : throw (RuntimeException, std::exception)
262 : {
263 : (void)rEvent;
264 0 : }
265 :
266 0 : void SAL_CALL PresenterWindowManager::windowHidden (const lang::EventObject& rEvent)
267 : throw (RuntimeException, std::exception)
268 : {
269 : (void)rEvent;
270 0 : }
271 :
272 : //----- XPaintListener --------------------------------------------------------
273 :
274 0 : void SAL_CALL PresenterWindowManager::windowPaint (const awt::PaintEvent& rEvent)
275 : throw (RuntimeException, std::exception)
276 : {
277 0 : ThrowIfDisposed();
278 :
279 0 : if ( ! mxParentWindow.is())
280 0 : return;
281 0 : if ( ! mxParentCanvas.is())
282 0 : return;
283 :
284 0 : if (mpTheme.get()!=NULL)
285 : {
286 : try
287 : {
288 0 : if (mbIsLayoutPending)
289 0 : Layout();
290 0 : PaintBackground(rEvent.UpdateRect);
291 0 : if ( ! PaintChildren(rEvent))
292 : {
293 0 : Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxParentCanvas, UNO_QUERY);
294 : // if (xSpriteCanvas.is())
295 : // xSpriteCanvas->updateScreen(sal_False);
296 : }
297 : }
298 0 : catch (RuntimeException&)
299 : {
300 : OSL_FAIL("paint failed!");
301 : }
302 : }
303 : }
304 :
305 : //----- XMouseListener --------------------------------------------------------
306 :
307 0 : void SAL_CALL PresenterWindowManager::mousePressed (const css::awt::MouseEvent& rEvent)
308 : throw(css::uno::RuntimeException, std::exception)
309 : {
310 : (void)rEvent;
311 0 : mbIsMouseClickPending = true;
312 0 : }
313 :
314 0 : void SAL_CALL PresenterWindowManager::mouseReleased (const css::awt::MouseEvent& rEvent)
315 : throw(css::uno::RuntimeException, std::exception)
316 : {
317 : #ifndef ENABLE_PANE_RESIZING
318 0 : if (mbIsMouseClickPending)
319 : {
320 0 : mbIsMouseClickPending = false;
321 0 : mpPresenterController->HandleMouseClick(rEvent);
322 : }
323 : #else
324 : (void)rEvent;
325 : #endif
326 0 : }
327 :
328 0 : void SAL_CALL PresenterWindowManager::mouseEntered (const css::awt::MouseEvent& rEvent)
329 : throw(css::uno::RuntimeException, std::exception)
330 : {
331 : (void)rEvent;
332 0 : mbIsMouseClickPending = false;
333 0 : }
334 :
335 0 : void SAL_CALL PresenterWindowManager::mouseExited (const css::awt::MouseEvent& rEvent)
336 : throw(css::uno::RuntimeException, std::exception)
337 : {
338 : (void)rEvent;
339 0 : mbIsMouseClickPending = false;
340 0 : }
341 :
342 : //----- XFocusListener --------------------------------------------------------
343 :
344 0 : void SAL_CALL PresenterWindowManager::focusGained (const css::awt::FocusEvent& rEvent)
345 : throw (css::uno::RuntimeException, std::exception)
346 : {
347 0 : ThrowIfDisposed();
348 : (void)rEvent;
349 : OSL_TRACE("PresenterWindowManager::focusGained window %p\n",
350 : rEvent.Source.get());
351 0 : }
352 :
353 0 : void SAL_CALL PresenterWindowManager::focusLost (const css::awt::FocusEvent& rEvent)
354 : throw (css::uno::RuntimeException, std::exception)
355 : {
356 0 : ThrowIfDisposed();
357 : (void)rEvent;
358 0 : }
359 :
360 : //----- XEventListener --------------------------------------------------------
361 :
362 0 : void SAL_CALL PresenterWindowManager::disposing (const lang::EventObject& rEvent)
363 : throw (RuntimeException, std::exception)
364 : {
365 0 : if (rEvent.Source == mxParentWindow)
366 0 : mxParentWindow = NULL;
367 : else
368 : {
369 0 : Reference<awt::XWindow> xWindow (rEvent.Source, UNO_QUERY);
370 : }
371 0 : }
372 :
373 :
374 :
375 0 : bool PresenterWindowManager::PaintChildren (const awt::PaintEvent& rEvent) const
376 : {
377 0 : bool bChildInvalidated (false);
378 :
379 : // Call windowPaint on all children that lie in or touch the
380 : // update rectangle.
381 0 : PresenterPaneContainer::PaneList::const_iterator iPane;
382 0 : PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end());
383 0 : for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane)
384 : {
385 : try
386 : {
387 : // Make sure that the pane shall and can be painted.
388 0 : if ( ! (*iPane)->mbIsActive)
389 0 : continue;
390 0 : if ((*iPane)->mbIsSprite)
391 0 : continue;
392 0 : if ( ! (*iPane)->mxPane.is())
393 0 : continue;
394 0 : if ( ! (*iPane)->mxBorderWindow.is())
395 0 : continue;
396 0 : Reference<awt::XWindow> xBorderWindow ((*iPane)->mxBorderWindow);
397 0 : if ( ! xBorderWindow.is())
398 0 : continue;
399 :
400 : // Get the area in which the border of the pane has to be painted.
401 0 : const awt::Rectangle aBorderBox (xBorderWindow->getPosSize());
402 : const awt::Rectangle aBorderUpdateBox(
403 : PresenterGeometryHelper::Intersection(
404 : rEvent.UpdateRect,
405 0 : aBorderBox));
406 0 : if (aBorderUpdateBox.Width<=0 || aBorderUpdateBox.Height<=0)
407 0 : continue;
408 :
409 : const awt::Rectangle aLocalBorderUpdateBox(
410 : PresenterGeometryHelper::TranslateRectangle(
411 : aBorderUpdateBox,
412 : -aBorderBox.X,
413 0 : -aBorderBox.Y));
414 :
415 : // Invalidate the area of the content window.
416 : mpPresenterController->GetPaintManager()->Invalidate(
417 : xBorderWindow,
418 : aLocalBorderUpdateBox,
419 : sal_Int16(awt::InvalidateStyle::CHILDREN
420 0 : | awt::InvalidateStyle::NOTRANSPARENT));
421 : }
422 0 : catch (RuntimeException&)
423 : {
424 : OSL_FAIL("paint children failed!");
425 : }
426 : }
427 :
428 0 : return bChildInvalidated;
429 : }
430 :
431 0 : void PresenterWindowManager::SetLayoutMode (const LayoutMode eMode)
432 : {
433 : OSL_ASSERT(mpPresenterController.get() != NULL);
434 :
435 0 : if (meLayoutMode != eMode
436 0 : || mbIsSlideSorterActive
437 0 : || mbIsHelpViewActive)
438 : {
439 0 : meLayoutMode = eMode;
440 0 : mbIsSlideSorterActive = false;
441 0 : mbIsHelpViewActive = false;
442 :
443 : mpPresenterController->RequestViews(
444 : mbIsSlideSorterActive,
445 : meLayoutMode==LM_Notes,
446 0 : mbIsHelpViewActive);
447 0 : Layout();
448 0 : NotifyLayoutModeChange();
449 : }
450 0 : }
451 :
452 0 : void PresenterWindowManager::SetSlideSorterState (bool bIsActive)
453 : {
454 0 : if (mbIsSlideSorterActive != bIsActive)
455 : {
456 0 : mbIsSlideSorterActive = bIsActive;
457 0 : if (mbIsSlideSorterActive)
458 0 : mbIsHelpViewActive = false;
459 0 : StoreViewMode(GetViewMode());
460 :
461 : mpPresenterController->RequestViews(
462 : mbIsSlideSorterActive,
463 : meLayoutMode==LM_Notes,
464 0 : mbIsHelpViewActive);
465 0 : Layout();
466 0 : NotifyLayoutModeChange();
467 : }
468 0 : }
469 :
470 0 : void PresenterWindowManager::SetHelpViewState (bool bIsActive)
471 : {
472 0 : if (mbIsHelpViewActive != bIsActive)
473 : {
474 0 : mbIsHelpViewActive = bIsActive;
475 0 : if (mbIsHelpViewActive)
476 0 : mbIsSlideSorterActive = false;
477 0 : StoreViewMode(GetViewMode());
478 :
479 : mpPresenterController->RequestViews(
480 : mbIsSlideSorterActive,
481 : meLayoutMode==LM_Notes,
482 0 : mbIsHelpViewActive);
483 0 : Layout();
484 0 : NotifyLayoutModeChange();
485 : }
486 0 : }
487 :
488 0 : void PresenterWindowManager::SetViewMode (const ViewMode eMode)
489 : {
490 0 : switch (eMode)
491 : {
492 : case VM_Standard:
493 0 : SetSlideSorterState(false);
494 0 : SetHelpViewState(false);
495 0 : SetLayoutMode(LM_Standard);
496 0 : break;
497 :
498 : case VM_Notes:
499 0 : SetSlideSorterState(false);
500 0 : SetHelpViewState(false);
501 0 : SetLayoutMode(LM_Notes);
502 0 : break;
503 :
504 : case VM_SlideOverview:
505 0 : SetHelpViewState(false);
506 0 : SetSlideSorterState(true);
507 0 : break;
508 :
509 : case VM_Help:
510 0 : SetHelpViewState(true);
511 0 : SetSlideSorterState(false);
512 0 : break;
513 : }
514 :
515 0 : StoreViewMode(eMode);
516 0 : }
517 :
518 0 : PresenterWindowManager::ViewMode PresenterWindowManager::GetViewMode() const
519 : {
520 0 : if (mbIsHelpViewActive)
521 0 : return VM_Help;
522 0 : else if (mbIsSlideSorterActive)
523 0 : return VM_SlideOverview;
524 0 : else if (meLayoutMode == LM_Notes)
525 0 : return VM_Notes;
526 : else
527 0 : return VM_Standard;
528 : }
529 :
530 0 : void PresenterWindowManager::RestoreViewMode()
531 : {
532 0 : sal_Int32 nMode (0);
533 : PresenterConfigurationAccess aConfiguration (
534 : mxComponentContext,
535 : OUString("/org.openoffice.Office.PresenterScreen/"),
536 0 : PresenterConfigurationAccess::READ_ONLY);
537 0 : aConfiguration.GetConfigurationNode("Presenter/InitialViewMode") >>= nMode;
538 0 : switch (nMode)
539 : {
540 : default:
541 : case 0:
542 0 : SetViewMode(VM_Standard);
543 0 : break;
544 :
545 : case 1:
546 0 : SetViewMode(VM_Notes);
547 0 : break;
548 :
549 : case 2:
550 0 : SetViewMode(VM_SlideOverview);
551 0 : break;
552 0 : }
553 0 : }
554 :
555 0 : void PresenterWindowManager::StoreViewMode (const ViewMode eViewMode)
556 : {
557 : try
558 : {
559 : PresenterConfigurationAccess aConfiguration (
560 : mxComponentContext,
561 : OUString("/org.openoffice.Office.PresenterScreen/"),
562 0 : PresenterConfigurationAccess::READ_WRITE);
563 0 : aConfiguration.GoToChild(OUString("Presenter"));
564 0 : Any aValue;
565 0 : switch (eViewMode)
566 : {
567 : default:
568 : case VM_Standard:
569 0 : aValue = Any(sal_Int32(0));
570 0 : break;
571 :
572 : case VM_Notes:
573 0 : aValue = Any(sal_Int32(1));
574 0 : break;
575 :
576 : case VM_SlideOverview:
577 0 : aValue = Any(sal_Int32(2));
578 0 : break;
579 : }
580 :
581 0 : aConfiguration.SetProperty ("InitialViewMode", aValue);
582 0 : aConfiguration.CommitChanges();
583 : }
584 0 : catch (Exception&)
585 : {
586 : }
587 0 : }
588 :
589 0 : void PresenterWindowManager::AddLayoutListener (
590 : const Reference<document::XEventListener>& rxListener)
591 : {
592 0 : maLayoutListeners.push_back(rxListener);
593 0 : }
594 :
595 0 : void PresenterWindowManager::RemoveLayoutListener (
596 : const Reference<document::XEventListener>& rxListener)
597 : {
598 0 : LayoutListenerContainer::iterator iListener (maLayoutListeners.begin());
599 0 : LayoutListenerContainer::iterator iEnd (maLayoutListeners.end());
600 0 : for ( ; iListener!=iEnd; ++iListener)
601 : {
602 0 : if (*iListener == rxListener)
603 : {
604 0 : maLayoutListeners.erase(iListener);
605 : // Assume that there are no multiple entries.
606 0 : break;
607 : }
608 : }
609 0 : }
610 :
611 0 : void PresenterWindowManager::Layout()
612 : {
613 0 : if (mxParentWindow.is() && ! mbIsLayouting)
614 : {
615 0 : mbIsLayoutPending = false;
616 0 : mbIsLayouting = true;
617 0 : mxScaledBackgroundBitmap = NULL;
618 0 : mxClipPolygon = NULL;
619 :
620 : try
621 : {
622 0 : if (mbIsSlideSorterActive)
623 0 : LayoutSlideSorterMode();
624 0 : else if (mbIsHelpViewActive)
625 0 : LayoutHelpMode();
626 : else
627 0 : switch (meLayoutMode)
628 : {
629 : case LM_Standard:
630 : default:
631 0 : LayoutStandardMode();
632 0 : break;
633 :
634 : case LM_Notes:
635 0 : LayoutNotesMode();
636 0 : break;
637 : }
638 : }
639 0 : catch (Exception&)
640 : {
641 : OSL_ASSERT(false);
642 0 : throw;
643 : }
644 :
645 0 : mbIsLayouting = false;
646 : }
647 0 : }
648 :
649 0 : void PresenterWindowManager::LayoutStandardMode()
650 : {
651 0 : awt::Rectangle aBox = mxParentWindow->getPosSize();
652 :
653 0 : const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
654 0 : const double nGap (20);
655 0 : const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio);
656 0 : double nSlidePreviewTop (0);
657 :
658 :
659 : // For the current slide view calculate the outer height from the outer
660 : // width. This takes into acount the slide aspect ratio and thus has to
661 : // go over the inner pane size.
662 : PresenterPaneContainer::SharedPaneDescriptor pPane (
663 0 : mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
664 0 : if (pPane.get() != NULL)
665 : {
666 : const awt::Size aCurrentSlideOuterBox(CalculatePaneSize(
667 : nHorizontalSlideDivide - 1.5*nGap,
668 0 : PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
669 0 : nSlidePreviewTop = (aBox.Height - aCurrentSlideOuterBox.Height) / 2;
670 0 : double Temp=nGap;
671 : /// check whether RTL interface or not
672 0 : if(AllSettings::GetLayoutRTL())
673 0 : Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap;
674 : SetPanePosSizeAbsolute (
675 : PresenterPaneFactory::msCurrentSlidePreviewPaneURL,
676 : Temp,
677 : nSlidePreviewTop,
678 : aCurrentSlideOuterBox.Width,
679 0 : aCurrentSlideOuterBox.Height);
680 : }
681 :
682 : // For the next slide view calculate the outer height from the outer
683 : // width. This takes into acount the slide aspect ratio and thus has to
684 : // go over the inner pane size.
685 0 : pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL);
686 0 : if (pPane.get() != NULL)
687 : {
688 : const awt::Size aNextSlideOuterBox (CalculatePaneSize(
689 0 : aBox.Width - nHorizontalSlideDivide - 1.5*nGap,
690 0 : PresenterPaneFactory::msNextSlidePreviewPaneURL));
691 0 : double Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
692 : /// check whether RTL interface or not
693 0 : if(AllSettings::GetLayoutRTL())
694 0 : Temp=nGap;
695 : SetPanePosSizeAbsolute (
696 : PresenterPaneFactory::msNextSlidePreviewPaneURL,
697 : Temp,
698 : nSlidePreviewTop,
699 : aNextSlideOuterBox.Width,
700 0 : aNextSlideOuterBox.Height);
701 : }
702 :
703 0 : LayoutToolBar();
704 0 : }
705 :
706 0 : void PresenterWindowManager::LayoutNotesMode()
707 : {
708 0 : awt::Rectangle aBox = mxParentWindow->getPosSize();
709 :
710 0 : const geometry::RealRectangle2D aToolBarBox (LayoutToolBar());
711 :
712 0 : const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
713 0 : const double nGap (20);
714 0 : const double nPrimaryWidth (aBox.Width / nGoldenRatio);
715 0 : const double nSecondaryWidth (aBox.Width - nPrimaryWidth);
716 0 : const double nTertiaryWidth (nSecondaryWidth / nGoldenRatio);
717 0 : double nSlidePreviewTop (0);
718 0 : double nNotesViewBottom (aToolBarBox.Y1 - nGap);
719 : /// check whether RTL interface or not
720 :
721 :
722 : // The notes view has no fixed aspect ratio.
723 : PresenterPaneContainer::SharedPaneDescriptor pPane (
724 0 : mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL));
725 0 : if (pPane.get() != NULL)
726 : {
727 : const geometry::RealSize2D aNotesViewOuterSize(
728 0 : nPrimaryWidth - 1.5*nGap + 0.5,
729 0 : nNotesViewBottom);
730 : nSlidePreviewTop = (aBox.Height
731 0 : - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2;
732 : /// check whether RTL interface or not
733 0 : double Temp=aBox.Width - aNotesViewOuterSize.Width - nGap;
734 0 : if(AllSettings::GetLayoutRTL())
735 0 : Temp=nGap;
736 : SetPanePosSizeAbsolute (
737 : PresenterPaneFactory::msNotesPaneURL,
738 : Temp,
739 : nSlidePreviewTop,
740 : aNotesViewOuterSize.Width,
741 0 : aNotesViewOuterSize.Height);
742 0 : nNotesViewBottom = nSlidePreviewTop + aNotesViewOuterSize.Height;
743 : }
744 :
745 : // For the current slide view calculate the outer height from the outer
746 : // width. This takes into acount the slide aspect ratio and thus has to
747 : // go over the inner pane size.
748 0 : pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL);
749 0 : if (pPane.get() != NULL)
750 : {
751 : const awt::Size aCurrentSlideOuterBox(CalculatePaneSize(
752 : nSecondaryWidth - 1.5*nGap,
753 0 : PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
754 : /// check whether RTL interface or not
755 0 : double Temp=nGap;
756 0 : if(AllSettings::GetLayoutRTL())
757 0 : Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap;
758 : SetPanePosSizeAbsolute (
759 : PresenterPaneFactory::msCurrentSlidePreviewPaneURL,
760 : Temp,
761 : nSlidePreviewTop,
762 : aCurrentSlideOuterBox.Width,
763 0 : aCurrentSlideOuterBox.Height);
764 : }
765 :
766 : // For the next slide view calculate the outer height from the outer
767 : // width. This takes into acount the slide aspect ratio and thus has to
768 : // go over the inner pane size.
769 0 : pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL);
770 0 : if (pPane.get() != NULL)
771 : {
772 : const awt::Size aNextSlideOuterBox (CalculatePaneSize(
773 : nTertiaryWidth,
774 0 : PresenterPaneFactory::msNextSlidePreviewPaneURL));
775 : /// check whether RTL interface or not
776 0 : double Temp=nGap;
777 0 : if(AllSettings::GetLayoutRTL())
778 0 : Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
779 : SetPanePosSizeAbsolute (
780 : PresenterPaneFactory::msNextSlidePreviewPaneURL,
781 : Temp,
782 : nNotesViewBottom - aNextSlideOuterBox.Height,
783 : aNextSlideOuterBox.Width,
784 0 : aNextSlideOuterBox.Height);
785 0 : }
786 :
787 :
788 :
789 0 : }
790 :
791 0 : void PresenterWindowManager::LayoutSlideSorterMode()
792 : {
793 0 : const geometry::RealRectangle2D aToolBarBox (LayoutToolBar());
794 :
795 0 : awt::Rectangle aWindowBox = mxParentWindow->getPosSize();
796 0 : const double nGap (20);
797 : SetPanePosSizeAbsolute(
798 : mpPaneContainer->GetPaneURLForViewURL(PresenterViewFactory::msSlideSorterURL),
799 : nGap,
800 : nGap,
801 : aWindowBox.Width - 2*nGap,
802 0 : aToolBarBox.Y1 - 2*nGap);
803 0 : }
804 :
805 0 : void PresenterWindowManager::LayoutHelpMode()
806 : {
807 0 : const geometry::RealRectangle2D aToolBarBox (LayoutToolBar());
808 :
809 0 : awt::Rectangle aWindowBox = mxParentWindow->getPosSize();
810 0 : const double nGap (20);
811 0 : const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
812 0 : const double nWidth = ::std::min(aWindowBox.Width - 2*nGap, aWindowBox.Width/nGoldenRatio);
813 : SetPanePosSizeAbsolute(
814 : mpPaneContainer->GetPaneURLForViewURL(PresenterViewFactory::msHelpViewURL),
815 0 : (aWindowBox.Width - nWidth)/2,
816 : nGap,
817 : nWidth,
818 0 : aToolBarBox.Y1 - 2*nGap);
819 0 : }
820 :
821 0 : geometry::RealRectangle2D PresenterWindowManager::LayoutToolBar()
822 : {
823 0 : double nToolBarWidth (400);
824 0 : double nToolBarHeight (80);
825 :
826 : // Get access to the tool bar.
827 : PresenterPaneContainer::SharedPaneDescriptor pDescriptor(
828 0 : mpPaneContainer->FindPaneURL(PresenterPaneFactory::msToolBarPaneURL));
829 0 : if (pDescriptor.get() != NULL)
830 : {
831 : PresenterToolBarView* pToolBarView
832 0 : = dynamic_cast<PresenterToolBarView*>(pDescriptor->mxView.get());
833 0 : if (pToolBarView != NULL && pToolBarView->GetPresenterToolBar().is())
834 : {
835 0 : geometry::RealSize2D aSize (pToolBarView->GetPresenterToolBar()->GetMinimalSize());
836 :
837 0 : if (mpPaneBorderPainter.is())
838 : {
839 0 : const awt::Rectangle aBox (mpPaneBorderPainter->addBorder (
840 : PresenterPaneFactory::msToolBarPaneURL,
841 : awt::Rectangle(
842 : 0,
843 : 0,
844 0 : PresenterGeometryHelper::Round(aSize.Width),
845 0 : PresenterGeometryHelper::Round(aSize.Height)),
846 0 : css::drawing::framework::BorderType_TOTAL_BORDER));
847 :
848 0 : nToolBarWidth = aBox.Width;
849 0 : nToolBarHeight = aBox.Height;
850 : }
851 : else
852 : {
853 0 : nToolBarWidth = aSize.Width + 20;
854 0 : nToolBarHeight = aSize.Height + 10;
855 : }
856 : }
857 : }
858 :
859 0 : const awt::Rectangle aBox = mxParentWindow->getPosSize();
860 0 : const double nToolBarX ((aBox.Width - nToolBarWidth) / 2);
861 0 : const double nToolBarY (aBox.Height - nToolBarHeight);
862 : SetPanePosSizeAbsolute(
863 : PresenterPaneFactory::msToolBarPaneURL,
864 : nToolBarX,
865 : nToolBarY,
866 : nToolBarWidth,
867 0 : nToolBarHeight);
868 :
869 : return geometry::RealRectangle2D(
870 : nToolBarX,
871 : nToolBarY,
872 0 : nToolBarX + nToolBarWidth - 1,
873 0 : nToolBarY + nToolBarHeight - 1);
874 : }
875 :
876 0 : awt::Size PresenterWindowManager::CalculatePaneSize (
877 : const double nOuterWidth,
878 : const OUString& rsPaneURL)
879 : {
880 : // Calculate the inner width by removing the pane border.
881 : awt::Rectangle aInnerBox (mpPaneBorderPainter->RemoveBorder (
882 : rsPaneURL,
883 : awt::Rectangle(0,0,
884 0 : sal_Int32(nOuterWidth+0.5),sal_Int32(nOuterWidth)),
885 0 : drawing::framework::BorderType_TOTAL_BORDER));
886 :
887 : // Calculate the inner height with the help of the slide aspect ratio.
888 : const double nCurrentSlideInnerHeight (
889 0 : aInnerBox.Width / mpPresenterController->GetSlideAspectRatio());
890 :
891 : // Add the pane border to get the outer box.
892 : awt::Rectangle aOuterBox (mpPaneBorderPainter->AddBorder (
893 : rsPaneURL,
894 : awt::Rectangle(0,0,
895 0 : aInnerBox.Width,sal_Int32(nCurrentSlideInnerHeight+0.5)),
896 0 : drawing::framework::BorderType_TOTAL_BORDER));
897 :
898 0 : return awt::Size(aOuterBox.Width, aOuterBox.Height);
899 : }
900 :
901 0 : void PresenterWindowManager::NotifyLayoutModeChange()
902 : {
903 0 : document::EventObject aEvent;
904 0 : aEvent.Source = Reference<XInterface>(static_cast<XWeak*>(this));
905 :
906 0 : LayoutListenerContainer aContainerCopy (maLayoutListeners);
907 0 : LayoutListenerContainer::iterator iListener (aContainerCopy.begin());
908 0 : LayoutListenerContainer::iterator iEnd (aContainerCopy.end());
909 0 : for ( ; iListener!=iEnd; ++iListener)
910 : {
911 0 : if (iListener->is())
912 : {
913 : try
914 : {
915 0 : (*iListener)->notifyEvent(aEvent);
916 : }
917 0 : catch (lang::DisposedException&)
918 : {
919 0 : RemoveLayoutListener(*iListener);
920 : }
921 0 : catch (RuntimeException&)
922 : {
923 : }
924 : }
925 0 : }
926 0 : }
927 :
928 0 : void PresenterWindowManager::NotifyDisposing()
929 : {
930 0 : lang::EventObject aEvent;
931 0 : aEvent.Source = static_cast<XWeak*>(this);
932 :
933 0 : LayoutListenerContainer aContainer;
934 0 : aContainer.swap(maLayoutListeners);
935 0 : LayoutListenerContainer::iterator iListener (aContainer.begin());
936 0 : LayoutListenerContainer::iterator iEnd (aContainer.end());
937 0 : for ( ; iListener!=iEnd; ++iListener)
938 : {
939 0 : if (iListener->is())
940 : {
941 : try
942 : {
943 0 : (*iListener)->disposing(aEvent);
944 : }
945 0 : catch (lang::DisposedException&)
946 : {
947 : }
948 0 : catch (RuntimeException&)
949 : {
950 : }
951 : }
952 0 : }
953 0 : }
954 :
955 0 : void PresenterWindowManager::UpdateWindowSize (const Reference<awt::XWindow>& rxBorderWindow)
956 : {
957 : PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
958 0 : mpPaneContainer->FindBorderWindow(rxBorderWindow));
959 0 : if (pDescriptor.get() != NULL)
960 : {
961 0 : mxClipPolygon = NULL;
962 :
963 0 : awt::Rectangle aParentBox = mxParentWindow->getPosSize();
964 0 : awt::Rectangle aBorderBox (pDescriptor->mxBorderWindow->getPosSize());
965 :
966 0 : if ( ! mbIsLayouting)
967 : {
968 0 : const double nWidth (aParentBox.Width);
969 0 : const double nHeight (aParentBox.Height);
970 0 : pDescriptor->mnLeft = double(aBorderBox.X) / nWidth;
971 0 : pDescriptor->mnTop = double(aBorderBox.Y) / nHeight;
972 0 : pDescriptor->mnRight = double(aBorderBox.X + aBorderBox.Width) / nWidth;
973 0 : pDescriptor->mnBottom = double(aBorderBox.Y + aBorderBox.Height) / nHeight;
974 : }
975 : else
976 : {
977 : // This update of the window size was initiated by
978 : // Layout(). Therefore the window size does not have to be
979 : // updated.
980 : }
981 :
982 : // ToTop is called last because it may invalidate the iterator.
983 0 : if ( ! mbIsLayouting)
984 0 : mpPaneContainer->ToTop(pDescriptor);
985 0 : }
986 0 : }
987 :
988 0 : void PresenterWindowManager::PaintBackground (const awt::Rectangle& rUpdateBox)
989 : {
990 : (void)rUpdateBox;
991 0 : if ( ! mxParentWindow.is())
992 0 : return;
993 :
994 0 : Reference<rendering::XGraphicDevice> xDevice (mxParentCanvas->getDevice());
995 0 : if ( ! xDevice.is())
996 0 : return;
997 :
998 : // Create a polygon for the background and for clipping.
999 : Reference<rendering::XPolyPolygon2D> xBackgroundPolygon (
1000 0 : PresenterGeometryHelper::CreatePolygon(mxParentWindow->getPosSize(), xDevice));
1001 0 : if ( ! mxClipPolygon.is())
1002 0 : mxClipPolygon = CreateClipPolyPolygon();
1003 :
1004 : // Create View- and RenderState structs.
1005 : const rendering::ViewState aViewState(
1006 : geometry::AffineMatrix2D(1,0,0, 0,1,0),
1007 0 : PresenterGeometryHelper::CreatePolygon(rUpdateBox, xDevice));
1008 : rendering::RenderState aRenderState (
1009 : geometry::AffineMatrix2D(1,0,0, 0,1,0),
1010 : mxClipPolygon,
1011 : Sequence<double>(4),
1012 0 : rendering::CompositeOperation::SOURCE);
1013 :
1014 : // Paint the background.
1015 0 : if (mpBackgroundBitmap.get() != NULL)
1016 : {
1017 0 : ProvideBackgroundBitmap();
1018 :
1019 0 : if (mxScaledBackgroundBitmap.is())
1020 : {
1021 0 : Sequence<rendering::Texture> aTextures (1);
1022 0 : const geometry::IntegerSize2D aBitmapSize(mxScaledBackgroundBitmap->getSize());
1023 0 : aTextures[0] = rendering::Texture (
1024 : geometry::AffineMatrix2D(
1025 : aBitmapSize.Width,0,0,
1026 : 0,aBitmapSize.Height,0),
1027 : 1,
1028 : 0,
1029 : mxScaledBackgroundBitmap,
1030 : NULL,
1031 : NULL,
1032 : rendering::StrokeAttributes(),
1033 : rendering::TexturingMode::REPEAT,
1034 0 : rendering::TexturingMode::REPEAT);
1035 :
1036 0 : mxParentCanvas->fillTexturedPolyPolygon(
1037 : xBackgroundPolygon,
1038 : aViewState,
1039 : aRenderState,
1040 0 : aTextures);
1041 : }
1042 : else
1043 : {
1044 0 : const util::Color aBackgroundColor (mpBackgroundBitmap->maReplacementColor);
1045 0 : aRenderState.DeviceColor[0] = ((aBackgroundColor >> 16) & 0x0ff) / 255.0;
1046 0 : aRenderState.DeviceColor[1] = ((aBackgroundColor >> 8) & 0x0ff) / 255.0;
1047 0 : aRenderState.DeviceColor[2] = ((aBackgroundColor >> 0) & 0x0ff) / 255.0;
1048 0 : aRenderState.DeviceColor[3] = ((aBackgroundColor >> 24) & 0x0ff) / 255.0;
1049 0 : mxParentCanvas->fillPolyPolygon(
1050 : xBackgroundPolygon,
1051 : aViewState,
1052 0 : aRenderState);
1053 : }
1054 0 : }
1055 : }
1056 :
1057 0 : void PresenterWindowManager::ProvideBackgroundBitmap()
1058 : {
1059 0 : if ( ! mxScaledBackgroundBitmap.is())
1060 : {
1061 0 : Reference<rendering::XBitmap> xBitmap (mpBackgroundBitmap->GetNormalBitmap());
1062 0 : if (xBitmap.is())
1063 : {
1064 0 : const bool bStretchVertical (mpBackgroundBitmap->meVerticalTexturingMode
1065 0 : == PresenterBitmapDescriptor::Stretch);
1066 0 : const bool bStretchHorizontal (mpBackgroundBitmap->meHorizontalTexturingMode
1067 0 : == PresenterBitmapDescriptor::Stretch);
1068 0 : if (bStretchHorizontal || bStretchVertical)
1069 : {
1070 0 : geometry::RealSize2D aSize;
1071 0 : if (bStretchVertical)
1072 0 : aSize.Height = mxParentWindow->getPosSize().Height;
1073 : else
1074 0 : aSize.Height = xBitmap->getSize().Height;
1075 0 : if (bStretchHorizontal)
1076 0 : aSize.Width = mxParentWindow->getPosSize().Width;
1077 : else
1078 0 : aSize.Width = xBitmap->getSize().Width;
1079 0 : mxScaledBackgroundBitmap = xBitmap->getScaledBitmap(aSize, sal_False);
1080 : }
1081 : else
1082 : {
1083 : mxScaledBackgroundBitmap
1084 0 : = Reference<rendering::XBitmap>(xBitmap, UNO_QUERY);
1085 : }
1086 0 : }
1087 : }
1088 0 : }
1089 :
1090 0 : Reference<rendering::XPolyPolygon2D> PresenterWindowManager::CreateClipPolyPolygon() const
1091 : {
1092 : // Create a clip polygon that includes the whole update area but has the
1093 : // content windows as holes.
1094 0 : const sal_Int32 nPaneCount (mpPaneContainer->maPanes.size());
1095 0 : ::std::vector<awt::Rectangle> aRectangles;
1096 0 : aRectangles.reserve(1+nPaneCount);
1097 0 : aRectangles.push_back(mxParentWindow->getPosSize());
1098 0 : PresenterPaneContainer::PaneList::const_iterator iPane;
1099 0 : PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end());
1100 0 : for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane)
1101 : {
1102 0 : PresenterPaneContainer::SharedPaneDescriptor pDescriptor (*iPane);
1103 0 : if ( ! pDescriptor->mbIsActive)
1104 0 : continue;
1105 0 : if ( ! pDescriptor->mbIsOpaque)
1106 0 : continue;
1107 0 : if ( ! pDescriptor->mxBorderWindow.is() || ! pDescriptor->mxContentWindow.is())
1108 0 : continue;
1109 0 : Reference<awt::XWindow2> xWindow (pDescriptor->mxBorderWindow, UNO_QUERY);
1110 0 : if (xWindow.is() && ! xWindow->isVisible())
1111 0 : continue;
1112 :
1113 0 : const awt::Rectangle aOuterBorderBox (pDescriptor->mxBorderWindow->getPosSize());
1114 0 : awt::Rectangle aInnerBorderBox (pDescriptor->mxContentWindow->getPosSize());
1115 0 : aInnerBorderBox.X += aOuterBorderBox.X;
1116 0 : aInnerBorderBox.Y += aOuterBorderBox.Y;
1117 0 : aRectangles.push_back(aInnerBorderBox);
1118 0 : }
1119 : Reference<rendering::XPolyPolygon2D> xPolyPolygon (
1120 : PresenterGeometryHelper::CreatePolygon(
1121 : aRectangles,
1122 0 : mxParentCanvas->getDevice()));
1123 0 : if (xPolyPolygon.is())
1124 0 : xPolyPolygon->setFillRule(rendering::FillRule_EVEN_ODD);
1125 0 : return xPolyPolygon;
1126 : }
1127 :
1128 0 : void PresenterWindowManager::UpdateWindowList()
1129 : {
1130 : #ifdef ENABLE_PANE_RESIZING
1131 : try
1132 : {
1133 : OSL_ASSERT(mxComponentContext.is());
1134 :
1135 : Reference<lang::XComponent> xComponent (mxPaneBorderManager, UNO_QUERY);
1136 : if (xComponent.is())
1137 : xComponent->dispose();
1138 :
1139 : Reference<lang::XMultiComponentFactory> xFactory (mxComponentContext->getServiceManager());
1140 : if (xFactory.is())
1141 : {
1142 : Sequence<Any> aArguments (1 + mpPaneContainer->maPanes.size()*2);
1143 : sal_Int32 nIndex (0);
1144 : aArguments[nIndex++] = Any(mxParentWindow);
1145 : for (sal_uInt32 nPaneIndex=0; nPaneIndex<mpPaneContainer->maPanes.size(); ++nPaneIndex)
1146 : {
1147 : if ( ! mpPaneContainer->maPanes[nPaneIndex]->mbIsActive)
1148 : continue;
1149 :
1150 : const Reference<awt::XWindow> xBorderWindow (
1151 : mpPaneContainer->maPanes[nPaneIndex]->mxBorderWindow);
1152 : const Reference<awt::XWindow> xContentWindow (
1153 : mpPaneContainer->maPanes[nPaneIndex]->mxContentWindow);
1154 : const Reference<awt::XWindow2> xBorderWindow2(xBorderWindow, UNO_QUERY);
1155 : if (xBorderWindow.is()
1156 : && xContentWindow.is()
1157 : && ( ! xBorderWindow2.is() || xBorderWindow2->isVisible()))
1158 : {
1159 : aArguments[nIndex++] = Any(xBorderWindow);
1160 : aArguments[nIndex++] = Any(xContentWindow);
1161 : }
1162 : }
1163 :
1164 : aArguments.realloc(nIndex);
1165 : rtl::Reference<PresenterPaneBorderManager> pManager (
1166 : new PresenterPaneBorderManager (
1167 : mxComponentContext,
1168 : mpPresenterController));
1169 : pManager->initialize(aArguments);
1170 : mxPaneBorderManager = Reference<XInterface>(static_cast<XWeak*>(pManager.get()));
1171 : }
1172 : }
1173 : catch (RuntimeException&)
1174 : {
1175 : }
1176 : #endif
1177 0 : }
1178 :
1179 0 : void PresenterWindowManager::Invalidate()
1180 : {
1181 0 : mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow);
1182 0 : }
1183 0 : void PresenterWindowManager::Update()
1184 : {
1185 0 : mxClipPolygon = NULL;
1186 0 : mbIsLayoutPending = true;
1187 :
1188 0 : UpdateWindowList();
1189 0 : Invalidate();
1190 0 : }
1191 :
1192 0 : void PresenterWindowManager::ThrowIfDisposed() const
1193 : throw (::com::sun::star::lang::DisposedException)
1194 : {
1195 0 : if (rBHelper.bDisposed || rBHelper.bInDispose)
1196 : {
1197 : throw lang::DisposedException (
1198 : "PresenterWindowManager has already been disposed",
1199 0 : const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
1200 : }
1201 0 : }
1202 :
1203 : } } // end of namespace ::sdext::presenter
1204 :
1205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|