1c142477cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c142477cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c142477cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c142477cSAndrew Rist * distributed with this work for additional information 6c142477cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c142477cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c142477cSAndrew Rist * "License"); you may not use this file except in compliance 9c142477cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11c142477cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13c142477cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c142477cSAndrew Rist * software distributed under the License is distributed on an 15c142477cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c142477cSAndrew Rist * KIND, either express or implied. See the License for the 17c142477cSAndrew Rist * specific language governing permissions and limitations 18c142477cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20c142477cSAndrew Rist *************************************************************/ 21c142477cSAndrew Rist 22c142477cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sdext.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #undef ENABLE_PANE_RESIZING 28cdf0e10cSrcweir //#define ENABLE_PANE_RESIZING 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "PresenterWindowManager.hxx" 31cdf0e10cSrcweir #include "PresenterAnimation.hxx" 32cdf0e10cSrcweir #include "PresenterAnimator.hxx" 33cdf0e10cSrcweir #include "PresenterController.hxx" 34cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx" 35cdf0e10cSrcweir #include "PresenterHelper.hxx" 36cdf0e10cSrcweir #include "PresenterPaintManager.hxx" 37cdf0e10cSrcweir #include "PresenterPaneBase.hxx" 38cdf0e10cSrcweir #include "PresenterPaneBorderManager.hxx" 39cdf0e10cSrcweir #include "PresenterPaneBorderPainter.hxx" 40cdf0e10cSrcweir #include "PresenterPaneContainer.hxx" 41cdf0e10cSrcweir #include "PresenterPaneFactory.hxx" 42cdf0e10cSrcweir #include "PresenterSprite.hxx" 43cdf0e10cSrcweir #include "PresenterToolBar.hxx" 44cdf0e10cSrcweir #include "PresenterViewFactory.hxx" 45cdf0e10cSrcweir #include "PresenterTheme.hxx" 46cdf0e10cSrcweir #include <com/sun/star/awt/InvalidateStyle.hpp> 47cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp> 48cdf0e10cSrcweir #include <com/sun/star/awt/SystemPointer.hpp> 49cdf0e10cSrcweir #include <com/sun/star/awt/XDevice.hpp> 50cdf0e10cSrcweir #include <com/sun/star/awt/XWindow2.hpp> 51cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 52cdf0e10cSrcweir #include <com/sun/star/awt/WindowAttribute.hpp> 53cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 54cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ResourceId.hpp> 55cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 56cdf0e10cSrcweir #include <com/sun/star/rendering/FillRule.hpp> 57cdf0e10cSrcweir #include <com/sun/star/rendering/PathCapType.hpp> 58cdf0e10cSrcweir #include <com/sun/star/rendering/PathJoinType.hpp> 59cdf0e10cSrcweir #include <com/sun/star/rendering/Texture.hpp> 60cdf0e10cSrcweir #include <com/sun/star/rendering/TexturingMode.hpp> 61cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp> 62cdf0e10cSrcweir #include <boost/bind.hpp> 63cdf0e10cSrcweir #include <boost/bind/protect.hpp> 64cdf0e10cSrcweir #include <math.h> 65cdf0e10cSrcweir 66cdf0e10cSrcweir using namespace ::com::sun::star; 67cdf0e10cSrcweir using namespace ::com::sun::star::uno; 68cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 69cdf0e10cSrcweir using ::rtl::OUString; 70cdf0e10cSrcweir 71cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 72cdf0e10cSrcweir 73cdf0e10cSrcweir namespace sdext { namespace presenter { 74cdf0e10cSrcweir 75cdf0e10cSrcweir namespace { 76cdf0e10cSrcweir 77cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1< 78cdf0e10cSrcweir css::drawing::framework::XConfigurationChangeListener 79cdf0e10cSrcweir > ModeChangeAnimationStarterInterfaceBase; 80cdf0e10cSrcweir 81cdf0e10cSrcweir class ModeChangeAnimationStarter 82cdf0e10cSrcweir : protected ::cppu::BaseMutex, 83cdf0e10cSrcweir public ModeChangeAnimationStarterInterfaceBase 84cdf0e10cSrcweir { 85cdf0e10cSrcweir public: 86cdf0e10cSrcweir ModeChangeAnimationStarter ( 87cdf0e10cSrcweir const Reference<drawing::framework::XConfigurationController>& rxConfigurationController, 88cdf0e10cSrcweir const Reference<awt::XWindow>& rxWindow, 89cdf0e10cSrcweir const Reference<rendering::XSpriteCanvas>& rxCanvas, 90cdf0e10cSrcweir const ::boost::shared_ptr<PresenterAnimator>& rpAnimator); 91cdf0e10cSrcweir virtual ~ModeChangeAnimationStarter (void); 92cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XConfigurationChangeListener 95cdf0e10cSrcweir 96cdf0e10cSrcweir virtual void SAL_CALL notifyConfigurationChange ( 97cdf0e10cSrcweir const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent) 98cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir // XEventListener 102cdf0e10cSrcweir 103cdf0e10cSrcweir virtual void SAL_CALL disposing ( 104cdf0e10cSrcweir const com::sun::star::lang::EventObject& rEvent) 105cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir 107cdf0e10cSrcweir private: 108cdf0e10cSrcweir Reference<drawing::framework::XConfigurationController> mxConfigurationController; 109cdf0e10cSrcweir ::boost::shared_ptr<PresenterAnimator> mpAnimator; 110cdf0e10cSrcweir ::boost::shared_ptr<PresenterSprite> mpSprite; 111cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> mxCanvas; 112cdf0e10cSrcweir }; 113cdf0e10cSrcweir 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir //===== PresenterWindowManager ================================================ 120cdf0e10cSrcweir 121cdf0e10cSrcweir PresenterWindowManager::PresenterWindowManager ( 122cdf0e10cSrcweir const Reference<XComponentContext>& rxContext, 123cdf0e10cSrcweir const ::rtl::Reference<PresenterPaneContainer>& rpPaneContainer, 124cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController) 125cdf0e10cSrcweir : PresenterWindowManagerInterfaceBase(m_aMutex), 126cdf0e10cSrcweir mxComponentContext(rxContext), 127cdf0e10cSrcweir mpPresenterController(rpPresenterController), 128cdf0e10cSrcweir mxParentWindow(), 129cdf0e10cSrcweir mxParentCanvas(), 130cdf0e10cSrcweir mxPaneBorderManager(), 131cdf0e10cSrcweir mpPaneBorderPainter(), 132cdf0e10cSrcweir mpPaneContainer(rpPaneContainer), 133cdf0e10cSrcweir mbIsLayoutPending(true), 134cdf0e10cSrcweir mbIsLayouting(false), 135cdf0e10cSrcweir mpTheme(), 136cdf0e10cSrcweir mpBackgroundBitmap(), 137cdf0e10cSrcweir mxScaledBackgroundBitmap(), 138cdf0e10cSrcweir maPaneBackgroundColor(), 139cdf0e10cSrcweir mxClipPolygon(), 140cdf0e10cSrcweir meLayoutMode(LM_Generic), 141cdf0e10cSrcweir mbIsSlideSorterActive(false), 142cdf0e10cSrcweir mbIsHelpViewActive(false), 143cdf0e10cSrcweir maLayoutListeners(), 144cdf0e10cSrcweir mbIsMouseClickPending(false) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir UpdateWindowList(); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir 151cdf0e10cSrcweir 152cdf0e10cSrcweir PresenterWindowManager::~PresenterWindowManager (void) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir 159cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::disposing (void) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir NotifyDisposing(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir SetParentPane(NULL); 164cdf0e10cSrcweir 165cdf0e10cSrcweir Reference<lang::XComponent> xComponent (mxPaneBorderManager, UNO_QUERY); 166cdf0e10cSrcweir if (xComponent.is()) 167cdf0e10cSrcweir xComponent->dispose(); 168cdf0e10cSrcweir mxPaneBorderManager = NULL; 169cdf0e10cSrcweir 170cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 171cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end()); 172cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir if ((*iPane)->mxBorderWindow.is()) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir (*iPane)->mxBorderWindow->removeWindowListener(this); 177cdf0e10cSrcweir (*iPane)->mxBorderWindow->removeFocusListener(this); 178cdf0e10cSrcweir #ifndef ENABLE_PANE_RESIZING 179cdf0e10cSrcweir (*iPane)->mxBorderWindow->removeMouseListener(this); 180cdf0e10cSrcweir #endif 181cdf0e10cSrcweir } 182cdf0e10cSrcweir } 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir 186cdf0e10cSrcweir 187cdf0e10cSrcweir 188cdf0e10cSrcweir void PresenterWindowManager::SetParentPane ( 189cdf0e10cSrcweir const Reference<drawing::framework::XPane>& rxPane) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir if (mxParentWindow.is()) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir mxParentWindow->removeWindowListener(this); 194cdf0e10cSrcweir mxParentWindow->removePaintListener(this); 195cdf0e10cSrcweir mxParentWindow->removeMouseListener(this); 196cdf0e10cSrcweir mxParentWindow->removeFocusListener(this); 197cdf0e10cSrcweir } 198cdf0e10cSrcweir mxParentWindow = NULL; 199cdf0e10cSrcweir mxParentCanvas = NULL; 200cdf0e10cSrcweir 201cdf0e10cSrcweir if (rxPane.is()) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir mxParentWindow = rxPane->getWindow(); 204cdf0e10cSrcweir mxParentCanvas = rxPane->getCanvas(); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir else 207cdf0e10cSrcweir { 208cdf0e10cSrcweir mxParentWindow = NULL; 209cdf0e10cSrcweir } 210cdf0e10cSrcweir 211cdf0e10cSrcweir if (mxParentWindow.is()) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir mxParentWindow->addWindowListener(this); 214cdf0e10cSrcweir mxParentWindow->addPaintListener(this); 215cdf0e10cSrcweir mxParentWindow->addMouseListener(this); 216cdf0e10cSrcweir mxParentWindow->addFocusListener(this); 217cdf0e10cSrcweir 218cdf0e10cSrcweir // We paint our own background, make that of the parent window transparent. 219cdf0e10cSrcweir Reference<awt::XWindowPeer> xPeer (mxParentWindow, UNO_QUERY); 220cdf0e10cSrcweir if (xPeer.is()) 221cdf0e10cSrcweir xPeer->setBackground(util::Color(0xff000000)); 222cdf0e10cSrcweir } 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir 226cdf0e10cSrcweir 227cdf0e10cSrcweir 228cdf0e10cSrcweir void PresenterWindowManager::SetTheme (const ::boost::shared_ptr<PresenterTheme>& rpTheme) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir mpTheme = rpTheme; 231cdf0e10cSrcweir 232cdf0e10cSrcweir // Get background bitmap or background color from the theme. 233cdf0e10cSrcweir 234cdf0e10cSrcweir if (mpTheme.get() != NULL) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir mpBackgroundBitmap = mpTheme->GetBitmap(OUString(), A2S("Background")); 237cdf0e10cSrcweir } 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir 241cdf0e10cSrcweir 242cdf0e10cSrcweir 243cdf0e10cSrcweir void PresenterWindowManager::NotifyPaneCreation ( 244cdf0e10cSrcweir const PresenterPaneContainer::SharedPaneDescriptor& rpDescriptor) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir if (rpDescriptor.get()==NULL) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir OSL_ASSERT(rpDescriptor.get()!=NULL); 249cdf0e10cSrcweir return; 250cdf0e10cSrcweir } 251cdf0e10cSrcweir if ( ! rpDescriptor->mxContentWindow.is()) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir OSL_ASSERT(rpDescriptor->mxContentWindow.is()); 254cdf0e10cSrcweir return; 255cdf0e10cSrcweir } 256cdf0e10cSrcweir 257cdf0e10cSrcweir mbIsLayoutPending = true; 258cdf0e10cSrcweir 259cdf0e10cSrcweir Reference<awt::XWindow> xBorderWindow (rpDescriptor->mxBorderWindow); 260cdf0e10cSrcweir OSL_ASSERT(xBorderWindow.is()); 261cdf0e10cSrcweir if (xBorderWindow.is() && ! rpDescriptor->mbIsSprite) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir Invalidate(); 264cdf0e10cSrcweir 265cdf0e10cSrcweir xBorderWindow->addWindowListener(this); 266cdf0e10cSrcweir xBorderWindow->addFocusListener(this); 267cdf0e10cSrcweir #ifndef ENABLE_PANE_RESIZING 268cdf0e10cSrcweir xBorderWindow->addMouseListener(this); 269cdf0e10cSrcweir #endif 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir UpdateWindowList(); 273cdf0e10cSrcweir Layout(); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir 277cdf0e10cSrcweir 278cdf0e10cSrcweir 279cdf0e10cSrcweir void PresenterWindowManager::NotifyViewCreation (const Reference<XView>& rxView) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 282cdf0e10cSrcweir mpPaneContainer->FindPaneId(rxView->getResourceId()->getAnchor())); 283cdf0e10cSrcweir OSL_ASSERT(pDescriptor.get() != NULL); 284cdf0e10cSrcweir if (pDescriptor.get() != NULL) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir Layout(); 287cdf0e10cSrcweir 288cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate( 289cdf0e10cSrcweir pDescriptor->mxContentWindow, 290cdf0e10cSrcweir (sal_Int16)(awt::InvalidateStyle::TRANSPARENT 291cdf0e10cSrcweir | awt::InvalidateStyle::CHILDREN)); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir 296cdf0e10cSrcweir 297cdf0e10cSrcweir 298cdf0e10cSrcweir void PresenterWindowManager::SetPanePosSizeRelative ( 299cdf0e10cSrcweir const Reference<XResourceId>& rxPaneId, 300cdf0e10cSrcweir const double nRelativeX, 301cdf0e10cSrcweir const double nRelativeY, 302cdf0e10cSrcweir const double nRelativeWidth, 303cdf0e10cSrcweir const double nRelativeHeight) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 306cdf0e10cSrcweir mpPaneContainer->FindPaneId(rxPaneId)); 307cdf0e10cSrcweir if (pDescriptor.get() != NULL) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir pDescriptor->mnLeft = nRelativeX; 310cdf0e10cSrcweir pDescriptor->mnTop = nRelativeY; 311cdf0e10cSrcweir pDescriptor->mnRight = nRelativeX + nRelativeWidth; 312cdf0e10cSrcweir pDescriptor->mnBottom = nRelativeY + nRelativeHeight; 313cdf0e10cSrcweir 314cdf0e10cSrcweir mpPaneContainer->ToTop(pDescriptor); 315cdf0e10cSrcweir } 316cdf0e10cSrcweir } 317cdf0e10cSrcweir 318cdf0e10cSrcweir 319cdf0e10cSrcweir 320cdf0e10cSrcweir 321cdf0e10cSrcweir void PresenterWindowManager::SetPanePosSizeAbsolute ( 322cdf0e10cSrcweir const OUString& rsPaneURL, 323cdf0e10cSrcweir const double nX, 324cdf0e10cSrcweir const double nY, 325cdf0e10cSrcweir const double nWidth, 326cdf0e10cSrcweir const double nHeight) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 329cdf0e10cSrcweir mpPaneContainer->FindPaneURL(rsPaneURL)); 330cdf0e10cSrcweir if (pDescriptor.get() != NULL) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir awt::Rectangle aParentBox = mxParentWindow->getPosSize(); 333cdf0e10cSrcweir if (aParentBox.Width > 0 && aParentBox.Height > 0) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir pDescriptor->mnLeft = nX / aParentBox.Width; 336cdf0e10cSrcweir pDescriptor->mnTop = nY / aParentBox.Height; 337cdf0e10cSrcweir pDescriptor->mnRight = (nX + nWidth) / aParentBox.Width; 338cdf0e10cSrcweir pDescriptor->mnBottom = (nY + nHeight) / aParentBox.Height; 339cdf0e10cSrcweir } 340cdf0e10cSrcweir if (pDescriptor->mxBorderWindow.is()) 341cdf0e10cSrcweir pDescriptor->mxBorderWindow->setPosSize( 342cdf0e10cSrcweir ::sal::static_int_cast<sal_Int32>(nX), 343cdf0e10cSrcweir ::sal::static_int_cast<sal_Int32>(nY), 344cdf0e10cSrcweir ::sal::static_int_cast<sal_Int32>(nWidth), 345cdf0e10cSrcweir ::sal::static_int_cast<sal_Int32>(nHeight), 346cdf0e10cSrcweir awt::PosSize::POSSIZE); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir 351cdf0e10cSrcweir 352cdf0e10cSrcweir 353cdf0e10cSrcweir void PresenterWindowManager::SetPaneBorderPainter ( 354cdf0e10cSrcweir const ::rtl::Reference<PresenterPaneBorderPainter>& rPainter) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir mpPaneBorderPainter = rPainter; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir 360cdf0e10cSrcweir 361cdf0e10cSrcweir 362cdf0e10cSrcweir //----- XWindowListener ------------------------------------------------------- 363cdf0e10cSrcweir 364cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::windowResized (const awt::WindowEvent& rEvent) 365cdf0e10cSrcweir throw (RuntimeException) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir ThrowIfDisposed(); 368cdf0e10cSrcweir if (rEvent.Source == mxParentWindow) 369cdf0e10cSrcweir { 370cdf0e10cSrcweir Layout(); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir else 373cdf0e10cSrcweir { 374cdf0e10cSrcweir Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY); 375cdf0e10cSrcweir if (xWindow.is()) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir UpdateWindowSize(xWindow); 378cdf0e10cSrcweir 379cdf0e10cSrcweir // Make sure the background of a transparent window is painted. 380cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow); 381cdf0e10cSrcweir } 382cdf0e10cSrcweir } 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir 386cdf0e10cSrcweir 387cdf0e10cSrcweir 388cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::windowMoved (const awt::WindowEvent& rEvent) 389cdf0e10cSrcweir throw (RuntimeException) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir ThrowIfDisposed(); 392cdf0e10cSrcweir if (rEvent.Source != mxParentWindow) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY); 395cdf0e10cSrcweir UpdateWindowSize(xWindow); 396cdf0e10cSrcweir 397cdf0e10cSrcweir // Make sure the background of a transparent window is painted. 398cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(xWindow); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402cdf0e10cSrcweir 403cdf0e10cSrcweir 404cdf0e10cSrcweir 405cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::windowShown (const lang::EventObject& rEvent) 406cdf0e10cSrcweir throw (RuntimeException) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir (void)rEvent; 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir 412cdf0e10cSrcweir 413cdf0e10cSrcweir 414cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::windowHidden (const lang::EventObject& rEvent) 415cdf0e10cSrcweir throw (RuntimeException) 416cdf0e10cSrcweir { 417cdf0e10cSrcweir (void)rEvent; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir 420cdf0e10cSrcweir 421cdf0e10cSrcweir 422cdf0e10cSrcweir 423cdf0e10cSrcweir //----- XPaintListener -------------------------------------------------------- 424cdf0e10cSrcweir 425cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::windowPaint (const awt::PaintEvent& rEvent) 426cdf0e10cSrcweir throw (RuntimeException) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir ThrowIfDisposed(); 429cdf0e10cSrcweir 430cdf0e10cSrcweir if ( ! mxParentWindow.is()) 431cdf0e10cSrcweir return; 432cdf0e10cSrcweir if ( ! mxParentCanvas.is()) 433cdf0e10cSrcweir return; 434cdf0e10cSrcweir 435cdf0e10cSrcweir if (mpTheme.get()!=NULL) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir try 438cdf0e10cSrcweir { 439cdf0e10cSrcweir if (mbIsLayoutPending) 440cdf0e10cSrcweir Layout(); 441cdf0e10cSrcweir PaintBackground(rEvent.UpdateRect); 442cdf0e10cSrcweir if ( ! PaintChildren(rEvent)) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxParentCanvas, UNO_QUERY); 445cdf0e10cSrcweir // if (xSpriteCanvas.is()) 446cdf0e10cSrcweir // xSpriteCanvas->updateScreen(sal_False); 447cdf0e10cSrcweir } 448cdf0e10cSrcweir } 449cdf0e10cSrcweir catch (RuntimeException&) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir OSL_ASSERT(sal_False); 452cdf0e10cSrcweir } 453cdf0e10cSrcweir } 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir 457cdf0e10cSrcweir 458cdf0e10cSrcweir 459cdf0e10cSrcweir //----- XMouseListener -------------------------------------------------------- 460cdf0e10cSrcweir 461cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::mousePressed (const css::awt::MouseEvent& rEvent) 462cdf0e10cSrcweir throw(css::uno::RuntimeException) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir (void)rEvent; 465cdf0e10cSrcweir mbIsMouseClickPending = true; 466cdf0e10cSrcweir } 467cdf0e10cSrcweir 468cdf0e10cSrcweir 469cdf0e10cSrcweir 470cdf0e10cSrcweir 471cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::mouseReleased (const css::awt::MouseEvent& rEvent) 472cdf0e10cSrcweir throw(css::uno::RuntimeException) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir #ifndef ENABLE_PANE_RESIZING 475cdf0e10cSrcweir if (mbIsMouseClickPending) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir mbIsMouseClickPending = false; 478cdf0e10cSrcweir mpPresenterController->HandleMouseClick(rEvent); 479cdf0e10cSrcweir } 480cdf0e10cSrcweir #else 481cdf0e10cSrcweir (void)rEvent; 482cdf0e10cSrcweir #endif 483cdf0e10cSrcweir } 484cdf0e10cSrcweir 485cdf0e10cSrcweir 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::mouseEntered (const css::awt::MouseEvent& rEvent) 489cdf0e10cSrcweir throw(css::uno::RuntimeException) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir (void)rEvent; 492cdf0e10cSrcweir mbIsMouseClickPending = false; 493cdf0e10cSrcweir } 494cdf0e10cSrcweir 495cdf0e10cSrcweir 496cdf0e10cSrcweir 497cdf0e10cSrcweir 498cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::mouseExited (const css::awt::MouseEvent& rEvent) 499cdf0e10cSrcweir throw(css::uno::RuntimeException) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir (void)rEvent; 502cdf0e10cSrcweir mbIsMouseClickPending = false; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir 506cdf0e10cSrcweir 507cdf0e10cSrcweir 508cdf0e10cSrcweir //----- XFocusListener -------------------------------------------------------- 509cdf0e10cSrcweir 510cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::focusGained (const css::awt::FocusEvent& rEvent) 511cdf0e10cSrcweir throw (css::uno::RuntimeException) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir ThrowIfDisposed(); 514cdf0e10cSrcweir (void)rEvent; 515cdf0e10cSrcweir OSL_TRACE("PresenterWindowManager::focusGained window %x\n", 516cdf0e10cSrcweir rEvent.Source.get()); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir 520cdf0e10cSrcweir 521cdf0e10cSrcweir 522cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::focusLost (const css::awt::FocusEvent& rEvent) 523cdf0e10cSrcweir throw (css::uno::RuntimeException) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir ThrowIfDisposed(); 526cdf0e10cSrcweir (void)rEvent; 527cdf0e10cSrcweir } 528cdf0e10cSrcweir 529cdf0e10cSrcweir 530cdf0e10cSrcweir 531cdf0e10cSrcweir 532cdf0e10cSrcweir //----- XEventListener -------------------------------------------------------- 533cdf0e10cSrcweir 534cdf0e10cSrcweir void SAL_CALL PresenterWindowManager::disposing (const lang::EventObject& rEvent) 535cdf0e10cSrcweir throw (RuntimeException) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir if (rEvent.Source == mxParentWindow) 538cdf0e10cSrcweir mxParentWindow = NULL; 539cdf0e10cSrcweir else 540cdf0e10cSrcweir { 541cdf0e10cSrcweir Reference<awt::XWindow> xWindow (rEvent.Source, UNO_QUERY); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir } 544cdf0e10cSrcweir 545cdf0e10cSrcweir 546cdf0e10cSrcweir 547cdf0e10cSrcweir 548cdf0e10cSrcweir //----------------------------------------------------------------------------- 549cdf0e10cSrcweir 550cdf0e10cSrcweir bool PresenterWindowManager::PaintChildren (const awt::PaintEvent& rEvent) const 551cdf0e10cSrcweir { 552cdf0e10cSrcweir bool bChildInvalidated (false); 553cdf0e10cSrcweir 554cdf0e10cSrcweir // Call windowPaint on all children that lie in or touch the 555cdf0e10cSrcweir // update rectangle. 556cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 557cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end()); 558cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir try 561cdf0e10cSrcweir { 562cdf0e10cSrcweir // Make sure that the pane shall and can be painted. 563cdf0e10cSrcweir if ( ! (*iPane)->mbIsActive) 564cdf0e10cSrcweir continue; 565cdf0e10cSrcweir if ((*iPane)->mbIsSprite) 566cdf0e10cSrcweir continue; 567cdf0e10cSrcweir if ( ! (*iPane)->mxPane.is()) 568cdf0e10cSrcweir continue; 569cdf0e10cSrcweir if ( ! (*iPane)->mxBorderWindow.is()) 570cdf0e10cSrcweir continue; 571cdf0e10cSrcweir Reference<awt::XWindow> xBorderWindow ((*iPane)->mxBorderWindow); 572cdf0e10cSrcweir if ( ! xBorderWindow.is()) 573cdf0e10cSrcweir continue; 574cdf0e10cSrcweir 575cdf0e10cSrcweir // Get the area in which the border of the pane has to be painted. 576cdf0e10cSrcweir const awt::Rectangle aBorderBox (xBorderWindow->getPosSize()); 577cdf0e10cSrcweir const awt::Rectangle aBorderUpdateBox( 578cdf0e10cSrcweir PresenterGeometryHelper::Intersection( 579cdf0e10cSrcweir rEvent.UpdateRect, 580cdf0e10cSrcweir aBorderBox)); 581cdf0e10cSrcweir if (aBorderUpdateBox.Width<=0 || aBorderUpdateBox.Height<=0) 582cdf0e10cSrcweir continue; 583cdf0e10cSrcweir 584cdf0e10cSrcweir const awt::Rectangle aLocalBorderUpdateBox( 585cdf0e10cSrcweir PresenterGeometryHelper::TranslateRectangle( 586cdf0e10cSrcweir aBorderUpdateBox, 587cdf0e10cSrcweir -aBorderBox.X, 588cdf0e10cSrcweir -aBorderBox.Y)); 589cdf0e10cSrcweir 590cdf0e10cSrcweir // Invalidate the area of the content window. 591cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate( 592cdf0e10cSrcweir xBorderWindow, 593cdf0e10cSrcweir aLocalBorderUpdateBox, 594cdf0e10cSrcweir sal_Int16(awt::InvalidateStyle::CHILDREN 595cdf0e10cSrcweir | awt::InvalidateStyle::NOTRANSPARENT)); 596cdf0e10cSrcweir } 597cdf0e10cSrcweir catch (RuntimeException&) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir OSL_ASSERT(sal_False); 600cdf0e10cSrcweir } 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir return bChildInvalidated; 604cdf0e10cSrcweir } 605cdf0e10cSrcweir 606cdf0e10cSrcweir 607cdf0e10cSrcweir 608cdf0e10cSrcweir 609cdf0e10cSrcweir void PresenterWindowManager::SetLayoutMode (const LayoutMode eMode) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir OSL_ASSERT(mpPresenterController.get() != NULL); 612cdf0e10cSrcweir 613cdf0e10cSrcweir if (meLayoutMode != eMode 614cdf0e10cSrcweir || mbIsSlideSorterActive 615cdf0e10cSrcweir || mbIsHelpViewActive) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir meLayoutMode = eMode; 618cdf0e10cSrcweir mbIsSlideSorterActive = false; 619cdf0e10cSrcweir mbIsHelpViewActive = false; 620cdf0e10cSrcweir 621cdf0e10cSrcweir mpPresenterController->RequestViews( 622cdf0e10cSrcweir mbIsSlideSorterActive, 623cdf0e10cSrcweir meLayoutMode==LM_Notes, 624cdf0e10cSrcweir mbIsHelpViewActive); 625cdf0e10cSrcweir Layout(); 626cdf0e10cSrcweir NotifyLayoutModeChange(); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir } 629cdf0e10cSrcweir 630cdf0e10cSrcweir 631cdf0e10cSrcweir 632cdf0e10cSrcweir 633cdf0e10cSrcweir PresenterWindowManager::LayoutMode PresenterWindowManager::GetLayoutMode (void) const 634cdf0e10cSrcweir { 635cdf0e10cSrcweir return meLayoutMode; 636cdf0e10cSrcweir } 637cdf0e10cSrcweir 638cdf0e10cSrcweir 639cdf0e10cSrcweir 640cdf0e10cSrcweir 641cdf0e10cSrcweir void PresenterWindowManager::SetSlideSorterState (bool bIsActive) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir if (mbIsSlideSorterActive != bIsActive) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir mbIsSlideSorterActive = bIsActive; 646cdf0e10cSrcweir if (mbIsSlideSorterActive) 647cdf0e10cSrcweir mbIsHelpViewActive = false; 648cdf0e10cSrcweir StoreViewMode(GetViewMode()); 649cdf0e10cSrcweir 650cdf0e10cSrcweir mpPresenterController->RequestViews( 651cdf0e10cSrcweir mbIsSlideSorterActive, 652cdf0e10cSrcweir meLayoutMode==LM_Notes, 653cdf0e10cSrcweir mbIsHelpViewActive); 654cdf0e10cSrcweir Layout(); 655cdf0e10cSrcweir NotifyLayoutModeChange(); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir 660cdf0e10cSrcweir 661cdf0e10cSrcweir 662cdf0e10cSrcweir bool PresenterWindowManager::IsSlideSorterActive (void) const 663cdf0e10cSrcweir { 664cdf0e10cSrcweir return mbIsSlideSorterActive; 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir 668cdf0e10cSrcweir 669cdf0e10cSrcweir 670cdf0e10cSrcweir void PresenterWindowManager::SetHelpViewState (bool bIsActive) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir if (mbIsHelpViewActive != bIsActive) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir mbIsHelpViewActive = bIsActive; 675cdf0e10cSrcweir if (mbIsHelpViewActive) 676cdf0e10cSrcweir mbIsSlideSorterActive = false; 677cdf0e10cSrcweir StoreViewMode(GetViewMode()); 678cdf0e10cSrcweir 679cdf0e10cSrcweir mpPresenterController->RequestViews( 680cdf0e10cSrcweir mbIsSlideSorterActive, 681cdf0e10cSrcweir meLayoutMode==LM_Notes, 682cdf0e10cSrcweir mbIsHelpViewActive); 683cdf0e10cSrcweir Layout(); 684cdf0e10cSrcweir NotifyLayoutModeChange(); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir } 687cdf0e10cSrcweir 688cdf0e10cSrcweir 689cdf0e10cSrcweir 690cdf0e10cSrcweir 691cdf0e10cSrcweir bool PresenterWindowManager::IsHelpViewActive (void) const 692cdf0e10cSrcweir { 693cdf0e10cSrcweir return mbIsHelpViewActive; 694cdf0e10cSrcweir } 695cdf0e10cSrcweir 696cdf0e10cSrcweir 697cdf0e10cSrcweir 698cdf0e10cSrcweir 699cdf0e10cSrcweir void PresenterWindowManager::SetViewMode (const ViewMode eMode) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir switch (eMode) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir case VM_Standard: 704cdf0e10cSrcweir SetSlideSorterState(false); 705cdf0e10cSrcweir SetHelpViewState(false); 706cdf0e10cSrcweir SetLayoutMode(LM_Standard); 707cdf0e10cSrcweir break; 708cdf0e10cSrcweir 709cdf0e10cSrcweir case VM_Notes: 710cdf0e10cSrcweir SetSlideSorterState(false); 711cdf0e10cSrcweir SetHelpViewState(false); 712cdf0e10cSrcweir SetLayoutMode(LM_Notes); 713cdf0e10cSrcweir break; 714cdf0e10cSrcweir 715cdf0e10cSrcweir case VM_SlideOverview: 716cdf0e10cSrcweir SetHelpViewState(false); 717cdf0e10cSrcweir SetSlideSorterState(true); 718cdf0e10cSrcweir break; 719cdf0e10cSrcweir 720cdf0e10cSrcweir case VM_Help: 721cdf0e10cSrcweir SetHelpViewState(true); 722cdf0e10cSrcweir SetSlideSorterState(false); 723cdf0e10cSrcweir break; 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir StoreViewMode(eMode); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir 730cdf0e10cSrcweir 731cdf0e10cSrcweir 732cdf0e10cSrcweir PresenterWindowManager::ViewMode PresenterWindowManager::GetViewMode (void) const 733cdf0e10cSrcweir { 734cdf0e10cSrcweir if (mbIsHelpViewActive) 735cdf0e10cSrcweir return VM_Help; 736cdf0e10cSrcweir else if (mbIsSlideSorterActive) 737cdf0e10cSrcweir return VM_SlideOverview; 738cdf0e10cSrcweir else if (meLayoutMode == LM_Notes) 739cdf0e10cSrcweir return VM_Notes; 740cdf0e10cSrcweir else 741cdf0e10cSrcweir return VM_Standard; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir 745cdf0e10cSrcweir 746cdf0e10cSrcweir 747cdf0e10cSrcweir void PresenterWindowManager::RestoreViewMode (void) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir sal_Int32 nMode (0); 750cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration ( 751cdf0e10cSrcweir mxComponentContext, 752*79e0a548SAriel Constenla-Haile OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"), 753cdf0e10cSrcweir PresenterConfigurationAccess::READ_ONLY); 754cdf0e10cSrcweir aConfiguration.GetConfigurationNode(A2S("Presenter/InitialViewMode")) >>= nMode; 755cdf0e10cSrcweir switch (nMode) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir default: 758cdf0e10cSrcweir case 0: 759cdf0e10cSrcweir SetViewMode(VM_Standard); 760cdf0e10cSrcweir break; 761cdf0e10cSrcweir 762cdf0e10cSrcweir case 1: 763cdf0e10cSrcweir SetViewMode(VM_Notes); 764cdf0e10cSrcweir break; 765cdf0e10cSrcweir 766cdf0e10cSrcweir case 2: 767cdf0e10cSrcweir SetViewMode(VM_SlideOverview); 768cdf0e10cSrcweir break; 769cdf0e10cSrcweir } 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir 773cdf0e10cSrcweir 774cdf0e10cSrcweir 775cdf0e10cSrcweir void PresenterWindowManager::StoreViewMode (const ViewMode eViewMode) 776cdf0e10cSrcweir { 777cdf0e10cSrcweir try 778cdf0e10cSrcweir { 779cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration ( 780cdf0e10cSrcweir mxComponentContext, 781*79e0a548SAriel Constenla-Haile OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"), 782cdf0e10cSrcweir PresenterConfigurationAccess::READ_WRITE); 783cdf0e10cSrcweir aConfiguration.GoToChild(A2S("Presenter")); 784cdf0e10cSrcweir Any aValue; 785cdf0e10cSrcweir switch (eViewMode) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir default: 788cdf0e10cSrcweir case VM_Standard: 789cdf0e10cSrcweir aValue = Any(sal_Int32(0)); 790cdf0e10cSrcweir break; 791cdf0e10cSrcweir 792cdf0e10cSrcweir case VM_Notes: 793cdf0e10cSrcweir aValue = Any(sal_Int32(1)); 794cdf0e10cSrcweir break; 795cdf0e10cSrcweir 796cdf0e10cSrcweir case VM_SlideOverview: 797cdf0e10cSrcweir aValue = Any(sal_Int32(2)); 798cdf0e10cSrcweir break; 799cdf0e10cSrcweir } 800cdf0e10cSrcweir 801cdf0e10cSrcweir aConfiguration.SetProperty (A2S("InitialViewMode"), aValue); 802cdf0e10cSrcweir aConfiguration.CommitChanges(); 803cdf0e10cSrcweir } 804cdf0e10cSrcweir catch (Exception&) 805cdf0e10cSrcweir { 806cdf0e10cSrcweir } 807cdf0e10cSrcweir } 808cdf0e10cSrcweir 809cdf0e10cSrcweir 810cdf0e10cSrcweir 811cdf0e10cSrcweir 812cdf0e10cSrcweir void PresenterWindowManager::AddLayoutListener ( 813cdf0e10cSrcweir const Reference<document::XEventListener>& rxListener) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir maLayoutListeners.push_back(rxListener); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir 818cdf0e10cSrcweir 819cdf0e10cSrcweir 820cdf0e10cSrcweir 821cdf0e10cSrcweir void PresenterWindowManager::RemoveLayoutListener ( 822cdf0e10cSrcweir const Reference<document::XEventListener>& rxListener) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir LayoutListenerContainer::iterator iListener (maLayoutListeners.begin()); 825cdf0e10cSrcweir LayoutListenerContainer::iterator iEnd (maLayoutListeners.end()); 826cdf0e10cSrcweir for ( ; iListener!=iEnd; ++iListener) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir if (*iListener == rxListener) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir maLayoutListeners.erase(iListener); 831cdf0e10cSrcweir // Assume that there are no multiple entries. 832cdf0e10cSrcweir break; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir } 835cdf0e10cSrcweir } 836cdf0e10cSrcweir 837cdf0e10cSrcweir 838cdf0e10cSrcweir 839cdf0e10cSrcweir 840cdf0e10cSrcweir void PresenterWindowManager::Layout (void) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir if (mxParentWindow.is() && ! mbIsLayouting) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir mbIsLayoutPending = false; 845cdf0e10cSrcweir mbIsLayouting = true; 846cdf0e10cSrcweir mxScaledBackgroundBitmap = NULL; 847cdf0e10cSrcweir mxClipPolygon = NULL; 848cdf0e10cSrcweir 849cdf0e10cSrcweir try 850cdf0e10cSrcweir { 851cdf0e10cSrcweir if (mbIsSlideSorterActive) 852cdf0e10cSrcweir LayoutSlideSorterMode(); 853cdf0e10cSrcweir else if (mbIsHelpViewActive) 854cdf0e10cSrcweir LayoutHelpMode(); 855cdf0e10cSrcweir else 856cdf0e10cSrcweir switch (meLayoutMode) 857cdf0e10cSrcweir { 858cdf0e10cSrcweir case LM_Standard: 859cdf0e10cSrcweir default: 860cdf0e10cSrcweir LayoutStandardMode(); 861cdf0e10cSrcweir break; 862cdf0e10cSrcweir 863cdf0e10cSrcweir case LM_Notes: 864cdf0e10cSrcweir LayoutNotesMode(); 865cdf0e10cSrcweir break; 866cdf0e10cSrcweir } 867cdf0e10cSrcweir } 868cdf0e10cSrcweir catch (Exception&) 869cdf0e10cSrcweir { 870cdf0e10cSrcweir OSL_ASSERT(false); 871cdf0e10cSrcweir throw; 872cdf0e10cSrcweir } 873cdf0e10cSrcweir 874cdf0e10cSrcweir mbIsLayouting = false; 875cdf0e10cSrcweir } 876cdf0e10cSrcweir } 877cdf0e10cSrcweir 878cdf0e10cSrcweir 879cdf0e10cSrcweir 880cdf0e10cSrcweir 881cdf0e10cSrcweir void PresenterWindowManager::LayoutStandardMode (void) 882cdf0e10cSrcweir { 883cdf0e10cSrcweir awt::Rectangle aBox = mxParentWindow->getPosSize(); 884cdf0e10cSrcweir 885cdf0e10cSrcweir const double nGoldenRatio ((1 + sqrt(5.0)) / 2); 886cdf0e10cSrcweir const double nGap (20); 887cdf0e10cSrcweir const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio); 888cdf0e10cSrcweir double nSlidePreviewTop (0); 889cdf0e10cSrcweir 890cdf0e10cSrcweir // For the current slide view calculate the outer height from the outer 891cdf0e10cSrcweir // width. This takes into acount the slide aspect ratio and thus has to 892cdf0e10cSrcweir // go over the inner pane size. 893cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pPane ( 894cdf0e10cSrcweir mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); 895cdf0e10cSrcweir if (pPane.get() != NULL) 896cdf0e10cSrcweir { 897cdf0e10cSrcweir const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( 898cdf0e10cSrcweir nHorizontalSlideDivide - 1.5*nGap, 899cdf0e10cSrcweir PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); 900cdf0e10cSrcweir nSlidePreviewTop = (aBox.Height - aCurrentSlideOuterBox.Height) / 2; 901cdf0e10cSrcweir SetPanePosSizeAbsolute ( 902cdf0e10cSrcweir PresenterPaneFactory::msCurrentSlidePreviewPaneURL, 903cdf0e10cSrcweir nGap, 904cdf0e10cSrcweir nSlidePreviewTop, 905cdf0e10cSrcweir aCurrentSlideOuterBox.Width, 906cdf0e10cSrcweir aCurrentSlideOuterBox.Height); 907cdf0e10cSrcweir } 908cdf0e10cSrcweir 909cdf0e10cSrcweir 910cdf0e10cSrcweir // For the next slide view calculate the outer height from the outer 911cdf0e10cSrcweir // width. This takes into acount the slide aspect ratio and thus has to 912cdf0e10cSrcweir // go over the inner pane size. 913cdf0e10cSrcweir pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); 914cdf0e10cSrcweir if (pPane.get() != NULL) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir const awt::Size aNextSlideOuterBox (CalculatePaneSize( 917cdf0e10cSrcweir aBox.Width - nHorizontalSlideDivide - 1.5*nGap, 918cdf0e10cSrcweir PresenterPaneFactory::msNextSlidePreviewPaneURL)); 919cdf0e10cSrcweir SetPanePosSizeAbsolute ( 920cdf0e10cSrcweir PresenterPaneFactory::msNextSlidePreviewPaneURL, 921cdf0e10cSrcweir aBox.Width - aNextSlideOuterBox.Width - nGap, 922cdf0e10cSrcweir nSlidePreviewTop, 923cdf0e10cSrcweir aNextSlideOuterBox.Width, 924cdf0e10cSrcweir aNextSlideOuterBox.Height); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir LayoutToolBar(); 928cdf0e10cSrcweir } 929cdf0e10cSrcweir 930cdf0e10cSrcweir 931cdf0e10cSrcweir 932cdf0e10cSrcweir 933cdf0e10cSrcweir void PresenterWindowManager::LayoutNotesMode (void) 934cdf0e10cSrcweir { 935cdf0e10cSrcweir awt::Rectangle aBox = mxParentWindow->getPosSize(); 936cdf0e10cSrcweir 937cdf0e10cSrcweir const geometry::RealRectangle2D aToolBarBox (LayoutToolBar()); 938cdf0e10cSrcweir 939cdf0e10cSrcweir const double nGoldenRatio ((1 + sqrt(5.0)) / 2); 940cdf0e10cSrcweir const double nGap (20); 941cdf0e10cSrcweir const double nPrimaryWidth (aBox.Width / nGoldenRatio); 942cdf0e10cSrcweir const double nSecondaryWidth (aBox.Width - nPrimaryWidth); 943cdf0e10cSrcweir const double nTertiaryWidth (nSecondaryWidth / nGoldenRatio); 944cdf0e10cSrcweir double nSlidePreviewTop (0); 945cdf0e10cSrcweir double nNotesViewBottom (aToolBarBox.Y1 - nGap); 946cdf0e10cSrcweir 947cdf0e10cSrcweir // The notes view has no fixed aspect ratio. 948cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pPane ( 949cdf0e10cSrcweir mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL)); 950cdf0e10cSrcweir if (pPane.get() != NULL) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir const geometry::RealSize2D aNotesViewOuterSize( 953cdf0e10cSrcweir nPrimaryWidth - 1.5*nGap + 0.5, 954cdf0e10cSrcweir nNotesViewBottom); 955cdf0e10cSrcweir nSlidePreviewTop = (aBox.Height 956cdf0e10cSrcweir - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2; 957cdf0e10cSrcweir SetPanePosSizeAbsolute ( 958cdf0e10cSrcweir PresenterPaneFactory::msNotesPaneURL, 959cdf0e10cSrcweir aBox.Width - aNotesViewOuterSize.Width - nGap, 960cdf0e10cSrcweir nSlidePreviewTop, 961cdf0e10cSrcweir aNotesViewOuterSize.Width, 962cdf0e10cSrcweir aNotesViewOuterSize.Height); 963cdf0e10cSrcweir nNotesViewBottom = nSlidePreviewTop + aNotesViewOuterSize.Height; 964cdf0e10cSrcweir } 965cdf0e10cSrcweir 966cdf0e10cSrcweir // For the current slide view calculate the outer height from the outer 967cdf0e10cSrcweir // width. This takes into acount the slide aspect ratio and thus has to 968cdf0e10cSrcweir // go over the inner pane size. 969cdf0e10cSrcweir pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL); 970cdf0e10cSrcweir if (pPane.get() != NULL) 971cdf0e10cSrcweir { 972cdf0e10cSrcweir const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( 973cdf0e10cSrcweir nSecondaryWidth - 1.5*nGap, 974cdf0e10cSrcweir PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); 975cdf0e10cSrcweir SetPanePosSizeAbsolute ( 976cdf0e10cSrcweir PresenterPaneFactory::msCurrentSlidePreviewPaneURL, 977cdf0e10cSrcweir nGap, 978cdf0e10cSrcweir nSlidePreviewTop, 979cdf0e10cSrcweir aCurrentSlideOuterBox.Width, 980cdf0e10cSrcweir aCurrentSlideOuterBox.Height); 981cdf0e10cSrcweir } 982cdf0e10cSrcweir 983cdf0e10cSrcweir 984cdf0e10cSrcweir // For the next slide view calculate the outer height from the outer 985cdf0e10cSrcweir // width. This takes into acount the slide aspect ratio and thus has to 986cdf0e10cSrcweir // go over the inner pane size. 987cdf0e10cSrcweir pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); 988cdf0e10cSrcweir if (pPane.get() != NULL) 989cdf0e10cSrcweir { 990cdf0e10cSrcweir const awt::Size aNextSlideOuterBox (CalculatePaneSize( 991cdf0e10cSrcweir nTertiaryWidth, 992cdf0e10cSrcweir PresenterPaneFactory::msNextSlidePreviewPaneURL)); 993cdf0e10cSrcweir SetPanePosSizeAbsolute ( 994cdf0e10cSrcweir PresenterPaneFactory::msNextSlidePreviewPaneURL, 995cdf0e10cSrcweir nGap, 996cdf0e10cSrcweir nNotesViewBottom - aNextSlideOuterBox.Height, 997cdf0e10cSrcweir aNextSlideOuterBox.Width, 998cdf0e10cSrcweir aNextSlideOuterBox.Height); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir void PresenterWindowManager::LayoutSlideSorterMode (void) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir const geometry::RealRectangle2D aToolBarBox (LayoutToolBar()); 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir awt::Rectangle aWindowBox = mxParentWindow->getPosSize(); 1010cdf0e10cSrcweir const double nGap (20); 1011cdf0e10cSrcweir SetPanePosSizeAbsolute( 1012cdf0e10cSrcweir mpPaneContainer->GetPaneURLForViewURL(PresenterViewFactory::msSlideSorterURL), 1013cdf0e10cSrcweir nGap, 1014cdf0e10cSrcweir nGap, 1015cdf0e10cSrcweir aWindowBox.Width - 2*nGap, 1016cdf0e10cSrcweir aToolBarBox.Y1 - 2*nGap); 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir void PresenterWindowManager::LayoutHelpMode (void) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir const geometry::RealRectangle2D aToolBarBox (LayoutToolBar()); 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir awt::Rectangle aWindowBox = mxParentWindow->getPosSize(); 1027cdf0e10cSrcweir const double nGap (20); 1028cdf0e10cSrcweir const double nGoldenRatio ((1 + sqrt(5.0)) / 2); 1029cdf0e10cSrcweir const double nWidth = ::std::min(aWindowBox.Width - 2*nGap, aWindowBox.Width/nGoldenRatio); 1030cdf0e10cSrcweir SetPanePosSizeAbsolute( 1031cdf0e10cSrcweir mpPaneContainer->GetPaneURLForViewURL(PresenterViewFactory::msHelpViewURL), 1032cdf0e10cSrcweir (aWindowBox.Width - nWidth)/2, 1033cdf0e10cSrcweir nGap, 1034cdf0e10cSrcweir nWidth, 1035cdf0e10cSrcweir aToolBarBox.Y1 - 2*nGap); 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir geometry::RealRectangle2D PresenterWindowManager::LayoutToolBar (void) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir double nToolBarWidth (400); 1044cdf0e10cSrcweir double nToolBarHeight (80); 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir // Get access to the tool bar. 1047cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor( 1048cdf0e10cSrcweir mpPaneContainer->FindPaneURL(PresenterPaneFactory::msToolBarPaneURL)); 1049cdf0e10cSrcweir if (pDescriptor.get() != NULL) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir PresenterToolBarView* pToolBarView 1052cdf0e10cSrcweir = dynamic_cast<PresenterToolBarView*>(pDescriptor->mxView.get()); 1053cdf0e10cSrcweir if (pToolBarView != NULL && pToolBarView->GetPresenterToolBar().is()) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir geometry::RealSize2D aSize (pToolBarView->GetPresenterToolBar()->GetMinimalSize()); 1056cdf0e10cSrcweir 1057cdf0e10cSrcweir if (mpPaneBorderPainter.is()) 1058cdf0e10cSrcweir { 1059cdf0e10cSrcweir const awt::Rectangle aBox (mpPaneBorderPainter->addBorder ( 1060cdf0e10cSrcweir PresenterPaneFactory::msToolBarPaneURL, 1061cdf0e10cSrcweir awt::Rectangle( 1062cdf0e10cSrcweir 0, 1063cdf0e10cSrcweir 0, 1064cdf0e10cSrcweir PresenterGeometryHelper::Round(aSize.Width), 1065cdf0e10cSrcweir PresenterGeometryHelper::Round(aSize.Height)), 1066cdf0e10cSrcweir css::drawing::framework::BorderType_TOTAL_BORDER)); 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir nToolBarWidth = aBox.Width; 1069cdf0e10cSrcweir nToolBarHeight = aBox.Height; 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir else 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir nToolBarWidth = aSize.Width + 20; 1074cdf0e10cSrcweir nToolBarHeight = aSize.Height + 10; 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir const awt::Rectangle aBox = mxParentWindow->getPosSize(); 1080cdf0e10cSrcweir const double nToolBarX ((aBox.Width - nToolBarWidth) / 2); 1081cdf0e10cSrcweir const double nToolBarY (aBox.Height - nToolBarHeight); 1082cdf0e10cSrcweir SetPanePosSizeAbsolute( 1083cdf0e10cSrcweir PresenterPaneFactory::msToolBarPaneURL, 1084cdf0e10cSrcweir nToolBarX, 1085cdf0e10cSrcweir nToolBarY, 1086cdf0e10cSrcweir nToolBarWidth, 1087cdf0e10cSrcweir nToolBarHeight); 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir return geometry::RealRectangle2D( 1090cdf0e10cSrcweir nToolBarX, 1091cdf0e10cSrcweir nToolBarY, 1092cdf0e10cSrcweir nToolBarX + nToolBarWidth - 1, 1093cdf0e10cSrcweir nToolBarY + nToolBarHeight - 1); 1094cdf0e10cSrcweir } 1095cdf0e10cSrcweir 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir awt::Size PresenterWindowManager::CalculatePaneSize ( 1100cdf0e10cSrcweir const double nOuterWidth, 1101cdf0e10cSrcweir const OUString& rsPaneURL) 1102cdf0e10cSrcweir { 1103cdf0e10cSrcweir // Calculate the inner width by removing the pane border. 1104cdf0e10cSrcweir awt::Rectangle aInnerBox (mpPaneBorderPainter->RemoveBorder ( 1105cdf0e10cSrcweir rsPaneURL, 1106cdf0e10cSrcweir awt::Rectangle(0,0, 1107cdf0e10cSrcweir sal_Int32(nOuterWidth+0.5),sal_Int32(nOuterWidth)), 1108cdf0e10cSrcweir drawing::framework::BorderType_TOTAL_BORDER)); 1109cdf0e10cSrcweir 1110cdf0e10cSrcweir // Calculate the inner height with the help of the slide aspect ratio. 1111cdf0e10cSrcweir const double nCurrentSlideInnerHeight ( 1112cdf0e10cSrcweir aInnerBox.Width / mpPresenterController->GetSlideAspectRatio()); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir // Add the pane border to get the outer box. 1115cdf0e10cSrcweir awt::Rectangle aOuterBox (mpPaneBorderPainter->AddBorder ( 1116cdf0e10cSrcweir rsPaneURL, 1117cdf0e10cSrcweir awt::Rectangle(0,0, 1118cdf0e10cSrcweir aInnerBox.Width,sal_Int32(nCurrentSlideInnerHeight+0.5)), 1119cdf0e10cSrcweir drawing::framework::BorderType_TOTAL_BORDER)); 1120cdf0e10cSrcweir 1121cdf0e10cSrcweir return awt::Size(aOuterBox.Width, aOuterBox.Height); 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir void PresenterWindowManager::NotifyLayoutModeChange (void) 1128cdf0e10cSrcweir { 1129cdf0e10cSrcweir document::EventObject aEvent; 1130cdf0e10cSrcweir aEvent.Source = Reference<XInterface>(static_cast<XWeak*>(this)); 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir LayoutListenerContainer aContainerCopy (maLayoutListeners); 1133cdf0e10cSrcweir LayoutListenerContainer::iterator iListener (aContainerCopy.begin()); 1134cdf0e10cSrcweir LayoutListenerContainer::iterator iEnd (aContainerCopy.end()); 1135cdf0e10cSrcweir for ( ; iListener!=iEnd; ++iListener) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir if (iListener->is()) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir try 1140cdf0e10cSrcweir { 1141cdf0e10cSrcweir (*iListener)->notifyEvent(aEvent); 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir catch (lang::DisposedException&) 1144cdf0e10cSrcweir { 1145cdf0e10cSrcweir RemoveLayoutListener(*iListener); 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir catch (RuntimeException&) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir } 1150cdf0e10cSrcweir } 1151cdf0e10cSrcweir } 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir void PresenterWindowManager::NotifyDisposing (void) 1158cdf0e10cSrcweir { 1159cdf0e10cSrcweir lang::EventObject aEvent; 1160cdf0e10cSrcweir aEvent.Source = static_cast<XWeak*>(this); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir LayoutListenerContainer aContainer; 1163cdf0e10cSrcweir aContainer.swap(maLayoutListeners); 1164cdf0e10cSrcweir LayoutListenerContainer::iterator iListener (aContainer.begin()); 1165cdf0e10cSrcweir LayoutListenerContainer::iterator iEnd (aContainer.end()); 1166cdf0e10cSrcweir for ( ; iListener!=iEnd; ++iListener) 1167cdf0e10cSrcweir { 1168cdf0e10cSrcweir if (iListener->is()) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir try 1171cdf0e10cSrcweir { 1172cdf0e10cSrcweir (*iListener)->disposing(aEvent); 1173cdf0e10cSrcweir } 1174cdf0e10cSrcweir catch (lang::DisposedException&) 1175cdf0e10cSrcweir { 1176cdf0e10cSrcweir } 1177cdf0e10cSrcweir catch (RuntimeException&) 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir } 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir } 1183cdf0e10cSrcweir 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir void PresenterWindowManager::LayoutUnknownMode (void) 1188cdf0e10cSrcweir { 1189cdf0e10cSrcweir awt::Rectangle aBox = mxParentWindow->getPosSize(); 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 1192cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end()); 1193cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir const PresenterPaneContainer::SharedPaneDescriptor& pDescriptor (*iPane); 1196cdf0e10cSrcweir if ( ! pDescriptor->mxBorderWindow.is()) 1197cdf0e10cSrcweir continue; 1198cdf0e10cSrcweir 1199cdf0e10cSrcweir // Layout the border window. 1200cdf0e10cSrcweir const sal_Int32 nX = (sal_Int32)(pDescriptor->mnLeft * aBox.Width); 1201cdf0e10cSrcweir const sal_Int32 nY = (sal_Int32)(pDescriptor->mnTop * aBox.Height); 1202cdf0e10cSrcweir const sal_Int32 nWidth = (sal_Int32)(pDescriptor->mnRight * aBox.Width) - nX; 1203cdf0e10cSrcweir const sal_Int32 nHeight = (sal_Int32)(pDescriptor->mnBottom * aBox.Height) - nY; 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir pDescriptor->mxBorderWindow->setPosSize( 1206cdf0e10cSrcweir nX,nY,nWidth,nHeight, 1207cdf0e10cSrcweir awt::PosSize::POSSIZE); 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir void PresenterWindowManager::UpdateWindowSize (const Reference<awt::XWindow>& rxBorderWindow) 1215cdf0e10cSrcweir { 1216cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 1217cdf0e10cSrcweir mpPaneContainer->FindBorderWindow(rxBorderWindow)); 1218cdf0e10cSrcweir if (pDescriptor.get() != NULL) 1219cdf0e10cSrcweir { 1220cdf0e10cSrcweir mxClipPolygon = NULL; 1221cdf0e10cSrcweir 1222cdf0e10cSrcweir awt::Rectangle aParentBox = mxParentWindow->getPosSize(); 1223cdf0e10cSrcweir awt::Rectangle aBorderBox (pDescriptor->mxBorderWindow->getPosSize()); 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir if ( ! mbIsLayouting) 1226cdf0e10cSrcweir { 1227cdf0e10cSrcweir const double nWidth (aParentBox.Width); 1228cdf0e10cSrcweir const double nHeight (aParentBox.Height); 1229cdf0e10cSrcweir pDescriptor->mnLeft = double(aBorderBox.X) / nWidth; 1230cdf0e10cSrcweir pDescriptor->mnTop = double(aBorderBox.Y) / nHeight; 1231cdf0e10cSrcweir pDescriptor->mnRight = double(aBorderBox.X + aBorderBox.Width) / nWidth; 1232cdf0e10cSrcweir pDescriptor->mnBottom = double(aBorderBox.Y + aBorderBox.Height) / nHeight; 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir else 1235cdf0e10cSrcweir { 1236cdf0e10cSrcweir // This update of the window size was initiated by 1237cdf0e10cSrcweir // Layout(). Therefore the window size does not have to be 1238cdf0e10cSrcweir // updated. 1239cdf0e10cSrcweir } 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir // ToTop is called last because it may invalidate the iterator. 1242cdf0e10cSrcweir if ( ! mbIsLayouting) 1243cdf0e10cSrcweir mpPaneContainer->ToTop(pDescriptor); 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir void PresenterWindowManager::PaintBackground (const awt::Rectangle& rUpdateBox) 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir (void)rUpdateBox; 1253cdf0e10cSrcweir if ( ! mxParentWindow.is()) 1254cdf0e10cSrcweir return; 1255cdf0e10cSrcweir 1256cdf0e10cSrcweir Reference<rendering::XGraphicDevice> xDevice (mxParentCanvas->getDevice()); 1257cdf0e10cSrcweir if ( ! xDevice.is()) 1258cdf0e10cSrcweir return; 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir // Create a polygon for the background and for clipping. 1261cdf0e10cSrcweir Reference<rendering::XPolyPolygon2D> xBackgroundPolygon ( 1262cdf0e10cSrcweir PresenterGeometryHelper::CreatePolygon(mxParentWindow->getPosSize(), xDevice)); 1263cdf0e10cSrcweir if ( ! mxClipPolygon.is()) 1264cdf0e10cSrcweir mxClipPolygon = CreateClipPolyPolygon(); 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir // Create View- and RenderState structs. 1267cdf0e10cSrcweir const rendering::ViewState aViewState( 1268cdf0e10cSrcweir geometry::AffineMatrix2D(1,0,0, 0,1,0), 1269cdf0e10cSrcweir PresenterGeometryHelper::CreatePolygon(rUpdateBox, xDevice)); 1270cdf0e10cSrcweir rendering::RenderState aRenderState ( 1271cdf0e10cSrcweir geometry::AffineMatrix2D(1,0,0, 0,1,0), 1272cdf0e10cSrcweir mxClipPolygon, 1273cdf0e10cSrcweir Sequence<double>(4), 1274cdf0e10cSrcweir rendering::CompositeOperation::SOURCE); 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir // Paint the background. 1277cdf0e10cSrcweir if (mpBackgroundBitmap.get() != NULL) 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir ProvideBackgroundBitmap(); 1280cdf0e10cSrcweir 1281cdf0e10cSrcweir if (mxScaledBackgroundBitmap.is()) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir Sequence<rendering::Texture> aTextures (1); 1284cdf0e10cSrcweir const geometry::IntegerSize2D aBitmapSize(mxScaledBackgroundBitmap->getSize()); 1285cdf0e10cSrcweir aTextures[0] = rendering::Texture ( 1286cdf0e10cSrcweir geometry::AffineMatrix2D( 1287cdf0e10cSrcweir aBitmapSize.Width,0,0, 1288cdf0e10cSrcweir 0,aBitmapSize.Height,0), 1289cdf0e10cSrcweir 1, 1290cdf0e10cSrcweir 0, 1291cdf0e10cSrcweir mxScaledBackgroundBitmap, 1292cdf0e10cSrcweir NULL, 1293cdf0e10cSrcweir NULL, 1294cdf0e10cSrcweir rendering::StrokeAttributes(), 1295cdf0e10cSrcweir rendering::TexturingMode::REPEAT, 1296cdf0e10cSrcweir rendering::TexturingMode::REPEAT); 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir mxParentCanvas->fillTexturedPolyPolygon( 1299cdf0e10cSrcweir xBackgroundPolygon, 1300cdf0e10cSrcweir aViewState, 1301cdf0e10cSrcweir aRenderState, 1302cdf0e10cSrcweir aTextures); 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir else 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir const util::Color aBackgroundColor (mpBackgroundBitmap->maReplacementColor); 1307cdf0e10cSrcweir aRenderState.DeviceColor[0] = ((aBackgroundColor >> 16) & 0x0ff) / 255.0; 1308cdf0e10cSrcweir aRenderState.DeviceColor[1] = ((aBackgroundColor >> 8) & 0x0ff) / 255.0; 1309cdf0e10cSrcweir aRenderState.DeviceColor[2] = ((aBackgroundColor >> 0) & 0x0ff) / 255.0; 1310cdf0e10cSrcweir aRenderState.DeviceColor[3] = ((aBackgroundColor >> 24) & 0x0ff) / 255.0; 1311cdf0e10cSrcweir mxParentCanvas->fillPolyPolygon( 1312cdf0e10cSrcweir xBackgroundPolygon, 1313cdf0e10cSrcweir aViewState, 1314cdf0e10cSrcweir aRenderState); 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir } 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir 1322cdf0e10cSrcweir void PresenterWindowManager::ProvideBackgroundBitmap (void) 1323cdf0e10cSrcweir { 1324cdf0e10cSrcweir if ( ! mxScaledBackgroundBitmap.is()) 1325cdf0e10cSrcweir { 1326cdf0e10cSrcweir Reference<rendering::XBitmap> xBitmap (mpBackgroundBitmap->GetNormalBitmap()); 1327cdf0e10cSrcweir if (xBitmap.is()) 1328cdf0e10cSrcweir { 1329cdf0e10cSrcweir const bool bStretchVertical (mpBackgroundBitmap->meVerticalTexturingMode 1330cdf0e10cSrcweir == PresenterBitmapDescriptor::Stretch); 1331cdf0e10cSrcweir const bool bStretchHorizontal (mpBackgroundBitmap->meHorizontalTexturingMode 1332cdf0e10cSrcweir == PresenterBitmapDescriptor::Stretch); 1333cdf0e10cSrcweir if (bStretchHorizontal || bStretchVertical) 1334cdf0e10cSrcweir { 1335cdf0e10cSrcweir geometry::RealSize2D aSize; 1336cdf0e10cSrcweir if (bStretchVertical) 1337cdf0e10cSrcweir aSize.Height = mxParentWindow->getPosSize().Height; 1338cdf0e10cSrcweir else 1339cdf0e10cSrcweir aSize.Height = xBitmap->getSize().Height; 1340cdf0e10cSrcweir if (bStretchHorizontal) 1341cdf0e10cSrcweir aSize.Width = mxParentWindow->getPosSize().Width; 1342cdf0e10cSrcweir else 1343cdf0e10cSrcweir aSize.Width = xBitmap->getSize().Width; 1344cdf0e10cSrcweir mxScaledBackgroundBitmap = xBitmap->getScaledBitmap(aSize, sal_False); 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir else 1347cdf0e10cSrcweir { 1348cdf0e10cSrcweir mxScaledBackgroundBitmap 1349cdf0e10cSrcweir = Reference<rendering::XBitmap>(xBitmap, UNO_QUERY); 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir } 1352cdf0e10cSrcweir } 1353cdf0e10cSrcweir } 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir Reference<rendering::XPolyPolygon2D> PresenterWindowManager::CreateClipPolyPolygon (void) const 1359cdf0e10cSrcweir { 1360cdf0e10cSrcweir // Create a clip polygon that includes the whole update area but has the 1361cdf0e10cSrcweir // content windows as holes. 1362cdf0e10cSrcweir const sal_Int32 nPaneCount (mpPaneContainer->maPanes.size()); 1363cdf0e10cSrcweir ::std::vector<awt::Rectangle> aRectangles; 1364cdf0e10cSrcweir aRectangles.reserve(1+nPaneCount); 1365cdf0e10cSrcweir aRectangles.push_back(mxParentWindow->getPosSize()); 1366cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 1367cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end()); 1368cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane) 1369cdf0e10cSrcweir { 1370cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor (*iPane); 1371cdf0e10cSrcweir if ( ! pDescriptor->mbIsActive) 1372cdf0e10cSrcweir continue; 1373cdf0e10cSrcweir if ( ! pDescriptor->mbIsOpaque) 1374cdf0e10cSrcweir continue; 1375cdf0e10cSrcweir if ( ! pDescriptor->mxBorderWindow.is() || ! pDescriptor->mxContentWindow.is()) 1376cdf0e10cSrcweir continue; 1377cdf0e10cSrcweir Reference<awt::XWindow2> xWindow (pDescriptor->mxBorderWindow, UNO_QUERY); 1378cdf0e10cSrcweir if (xWindow.is() && ! xWindow->isVisible()) 1379cdf0e10cSrcweir continue; 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir const awt::Rectangle aOuterBorderBox (pDescriptor->mxBorderWindow->getPosSize()); 1382cdf0e10cSrcweir awt::Rectangle aInnerBorderBox (pDescriptor->mxContentWindow->getPosSize()); 1383cdf0e10cSrcweir aInnerBorderBox.X += aOuterBorderBox.X; 1384cdf0e10cSrcweir aInnerBorderBox.Y += aOuterBorderBox.Y; 1385cdf0e10cSrcweir aRectangles.push_back(aInnerBorderBox); 1386cdf0e10cSrcweir } 1387cdf0e10cSrcweir Reference<rendering::XPolyPolygon2D> xPolyPolygon ( 1388cdf0e10cSrcweir PresenterGeometryHelper::CreatePolygon( 1389cdf0e10cSrcweir aRectangles, 1390cdf0e10cSrcweir mxParentCanvas->getDevice())); 1391cdf0e10cSrcweir if (xPolyPolygon.is()) 1392cdf0e10cSrcweir xPolyPolygon->setFillRule(rendering::FillRule_EVEN_ODD); 1393cdf0e10cSrcweir return xPolyPolygon; 1394cdf0e10cSrcweir } 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir void PresenterWindowManager::UpdateWindowList (void) 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir #ifdef ENABLE_PANE_RESIZING 1402cdf0e10cSrcweir try 1403cdf0e10cSrcweir { 1404cdf0e10cSrcweir OSL_ASSERT(mxComponentContext.is()); 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir Reference<lang::XComponent> xComponent (mxPaneBorderManager, UNO_QUERY); 1407cdf0e10cSrcweir if (xComponent.is()) 1408cdf0e10cSrcweir xComponent->dispose(); 1409cdf0e10cSrcweir 1410cdf0e10cSrcweir Reference<lang::XMultiComponentFactory> xFactory (mxComponentContext->getServiceManager()); 1411cdf0e10cSrcweir if (xFactory.is()) 1412cdf0e10cSrcweir { 1413cdf0e10cSrcweir Sequence<Any> aArguments (1 + mpPaneContainer->maPanes.size()*2); 1414cdf0e10cSrcweir sal_Int32 nIndex (0); 1415cdf0e10cSrcweir aArguments[nIndex++] = Any(mxParentWindow); 1416cdf0e10cSrcweir for (sal_uInt32 nPaneIndex=0; nPaneIndex<mpPaneContainer->maPanes.size(); ++nPaneIndex) 1417cdf0e10cSrcweir { 1418cdf0e10cSrcweir if ( ! mpPaneContainer->maPanes[nPaneIndex]->mbIsActive) 1419cdf0e10cSrcweir continue; 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir const Reference<awt::XWindow> xBorderWindow ( 1422cdf0e10cSrcweir mpPaneContainer->maPanes[nPaneIndex]->mxBorderWindow); 1423cdf0e10cSrcweir const Reference<awt::XWindow> xContentWindow ( 1424cdf0e10cSrcweir mpPaneContainer->maPanes[nPaneIndex]->mxContentWindow); 1425cdf0e10cSrcweir const Reference<awt::XWindow2> xBorderWindow2(xBorderWindow, UNO_QUERY); 1426cdf0e10cSrcweir if (xBorderWindow.is() 1427cdf0e10cSrcweir && xContentWindow.is() 1428cdf0e10cSrcweir && ( ! xBorderWindow2.is() || xBorderWindow2->isVisible())) 1429cdf0e10cSrcweir { 1430cdf0e10cSrcweir aArguments[nIndex++] = Any(xBorderWindow); 1431cdf0e10cSrcweir aArguments[nIndex++] = Any(xContentWindow); 1432cdf0e10cSrcweir } 1433cdf0e10cSrcweir } 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir aArguments.realloc(nIndex); 1436cdf0e10cSrcweir rtl::Reference<PresenterPaneBorderManager> pManager ( 1437cdf0e10cSrcweir new PresenterPaneBorderManager ( 1438cdf0e10cSrcweir mxComponentContext, 1439cdf0e10cSrcweir mpPresenterController)); 1440cdf0e10cSrcweir pManager->initialize(aArguments); 1441cdf0e10cSrcweir mxPaneBorderManager = Reference<XInterface>(static_cast<XWeak*>(pManager.get())); 1442cdf0e10cSrcweir } 1443cdf0e10cSrcweir } 1444cdf0e10cSrcweir catch (RuntimeException&) 1445cdf0e10cSrcweir { 1446cdf0e10cSrcweir } 1447cdf0e10cSrcweir #endif 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir 1451cdf0e10cSrcweir 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir void PresenterWindowManager::Invalidate (void) 1454cdf0e10cSrcweir { 1455cdf0e10cSrcweir mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow); 1456cdf0e10cSrcweir } 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir Reference<awt::XWindow> PresenterWindowManager::GetParentWindow (void) const 1462cdf0e10cSrcweir { 1463cdf0e10cSrcweir return mxParentWindow; 1464cdf0e10cSrcweir } 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir Reference<rendering::XCanvas> PresenterWindowManager::GetParentCanvas (void) const 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir return mxParentCanvas; 1472cdf0e10cSrcweir } 1473cdf0e10cSrcweir 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir 1476cdf0e10cSrcweir 1477cdf0e10cSrcweir void PresenterWindowManager::Update (void) 1478cdf0e10cSrcweir { 1479cdf0e10cSrcweir mxClipPolygon = NULL; 1480cdf0e10cSrcweir mbIsLayoutPending = true; 1481cdf0e10cSrcweir 1482cdf0e10cSrcweir UpdateWindowList(); 1483cdf0e10cSrcweir Invalidate(); 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir 1487cdf0e10cSrcweir 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir void PresenterWindowManager::ThrowIfDisposed (void) const 1490cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 1491cdf0e10cSrcweir { 1492cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 1493cdf0e10cSrcweir { 1494cdf0e10cSrcweir throw lang::DisposedException ( 1495cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM( 1496cdf0e10cSrcweir "PresenterWindowManager has already been disposed")), 1497cdf0e10cSrcweir const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this))); 1498cdf0e10cSrcweir } 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir namespace { 1504cdf0e10cSrcweir 1505cdf0e10cSrcweir //===== ModeChangeAnimation =================================================== 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir class ModeChangeAnimation : public PresenterAnimation 1508cdf0e10cSrcweir { 1509cdf0e10cSrcweir public: 1510cdf0e10cSrcweir ModeChangeAnimation ( 1511cdf0e10cSrcweir const ::boost::shared_ptr<PresenterSprite>& rpSprite, 1512cdf0e10cSrcweir const Reference<rendering::XSpriteCanvas>& rxCanvas) 1513cdf0e10cSrcweir : PresenterAnimation (0, 1000, 20), 1514cdf0e10cSrcweir mpSprite(rpSprite), 1515cdf0e10cSrcweir mxCanvas(rxCanvas) 1516cdf0e10cSrcweir { 1517cdf0e10cSrcweir } 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir virtual void Run (const double nProgress, const sal_uInt64 nCurrentTime) 1520cdf0e10cSrcweir { 1521cdf0e10cSrcweir (void)nCurrentTime; 1522cdf0e10cSrcweir mpSprite->SetAlpha(1.0 - nProgress); 1523cdf0e10cSrcweir mxCanvas->updateScreen(sal_False); 1524cdf0e10cSrcweir } 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir private: 1527cdf0e10cSrcweir ::boost::shared_ptr<PresenterSprite> mpSprite; 1528cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> mxCanvas; 1529cdf0e10cSrcweir }; 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir ModeChangeAnimationStarter::ModeChangeAnimationStarter ( 1535cdf0e10cSrcweir const Reference<drawing::framework::XConfigurationController>& rxConfigurationController, 1536cdf0e10cSrcweir const Reference<awt::XWindow>& rxWindow, 1537cdf0e10cSrcweir const Reference<rendering::XSpriteCanvas>& rxCanvas, 1538cdf0e10cSrcweir const ::boost::shared_ptr<PresenterAnimator>& rpAnimator) 1539cdf0e10cSrcweir : ModeChangeAnimationStarterInterfaceBase(m_aMutex), 1540cdf0e10cSrcweir mxConfigurationController(rxConfigurationController), 1541cdf0e10cSrcweir mpAnimator(rpAnimator), 1542cdf0e10cSrcweir mpSprite(new PresenterSprite()), 1543cdf0e10cSrcweir mxCanvas(rxCanvas) 1544cdf0e10cSrcweir { 1545cdf0e10cSrcweir OSL_ASSERT(rxWindow.is()); 1546cdf0e10cSrcweir OSL_ASSERT(rxCanvas.is()); 1547cdf0e10cSrcweir 1548cdf0e10cSrcweir // Get the bitmap of the background. 1549cdf0e10cSrcweir Reference<rendering::XBitmap> xBackgroundBitmap (rxCanvas, UNO_QUERY); 1550cdf0e10cSrcweir if ( ! xBackgroundBitmap.is()) 1551cdf0e10cSrcweir return; 1552cdf0e10cSrcweir 1553cdf0e10cSrcweir // Create the sprite. 1554cdf0e10cSrcweir const awt::Rectangle aWindowSize (rxWindow->getPosSize()); 1555cdf0e10cSrcweir mpSprite->SetFactory(rxCanvas); 1556cdf0e10cSrcweir mpSprite->Resize(geometry::RealSize2D(aWindowSize.Width, aWindowSize.Height)); 1557cdf0e10cSrcweir mpSprite->SetPriority(10); 1558cdf0e10cSrcweir 1559cdf0e10cSrcweir // Fill it with the background inside the bounding box. 1560cdf0e10cSrcweir const rendering::ViewState aViewState ( 1561cdf0e10cSrcweir geometry::AffineMatrix2D(1,0,0, 0,1,0), 1562cdf0e10cSrcweir NULL); 1563cdf0e10cSrcweir const rendering::RenderState aRenderState ( 1564cdf0e10cSrcweir geometry::AffineMatrix2D(1,0,0, 0,1,0), 1565cdf0e10cSrcweir NULL, 1566cdf0e10cSrcweir Sequence<double>(4), 1567cdf0e10cSrcweir rendering::CompositeOperation::SOURCE); 1568cdf0e10cSrcweir Reference<rendering::XCanvas> xSpriteCanvas (mpSprite->GetCanvas()); 1569cdf0e10cSrcweir if (xSpriteCanvas.is()) 1570cdf0e10cSrcweir { 1571cdf0e10cSrcweir xSpriteCanvas->drawBitmap(xBackgroundBitmap, aViewState, aRenderState); 1572cdf0e10cSrcweir mpSprite->Show(); 1573cdf0e10cSrcweir } 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir // Register as listener to be notified when the new panes are visible 1576cdf0e10cSrcweir // and the sprite can be faded out. 1577cdf0e10cSrcweir mxConfigurationController->addConfigurationChangeListener( 1578cdf0e10cSrcweir this, 1579cdf0e10cSrcweir A2S("ConfigurationUpdateEnd"), 1580cdf0e10cSrcweir Any()); 1581cdf0e10cSrcweir } 1582cdf0e10cSrcweir 1583cdf0e10cSrcweir 1584cdf0e10cSrcweir 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir ModeChangeAnimationStarter::~ModeChangeAnimationStarter (void) 1587cdf0e10cSrcweir { 1588cdf0e10cSrcweir } 1589cdf0e10cSrcweir 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir 1592cdf0e10cSrcweir 1593cdf0e10cSrcweir void SAL_CALL ModeChangeAnimationStarter::disposing (void) 1594cdf0e10cSrcweir { 1595cdf0e10cSrcweir mxConfigurationController = NULL; 1596cdf0e10cSrcweir mpAnimator.reset(); 1597cdf0e10cSrcweir mpSprite.reset(); 1598cdf0e10cSrcweir } 1599cdf0e10cSrcweir 1600cdf0e10cSrcweir 1601cdf0e10cSrcweir 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir // XConfigurationChangeListener 1604cdf0e10cSrcweir 1605cdf0e10cSrcweir void SAL_CALL ModeChangeAnimationStarter::notifyConfigurationChange ( 1606cdf0e10cSrcweir const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent) 1607cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException) 1608cdf0e10cSrcweir { 1609cdf0e10cSrcweir (void)rEvent; 1610cdf0e10cSrcweir 1611cdf0e10cSrcweir // Start the actual animation. 1612cdf0e10cSrcweir mpAnimator->AddAnimation(SharedPresenterAnimation(new ModeChangeAnimation( 1613cdf0e10cSrcweir mpSprite, 1614cdf0e10cSrcweir mxCanvas))); 1615cdf0e10cSrcweir 1616cdf0e10cSrcweir mxConfigurationController->removeConfigurationChangeListener(this); 1617cdf0e10cSrcweir } 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir 1620cdf0e10cSrcweir 1621cdf0e10cSrcweir 1622cdf0e10cSrcweir // XEventListener 1623cdf0e10cSrcweir 1624cdf0e10cSrcweir void SAL_CALL ModeChangeAnimationStarter::disposing ( 1625cdf0e10cSrcweir const com::sun::star::lang::EventObject& rEvent) 1626cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException) 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir if (rEvent.Source == mxConfigurationController) 1629cdf0e10cSrcweir mxConfigurationController = NULL; 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir } // end of anonymous namespace 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir } } // end of namespace ::sdext::presenter 1638