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