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 #include "PresenterController.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "PresenterAccessibility.hxx" 34*cdf0e10cSrcweir #include "PresenterAnimator.hxx" 35*cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx" 36*cdf0e10cSrcweir #include "PresenterCurrentSlideObserver.hxx" 37*cdf0e10cSrcweir #include "PresenterFrameworkObserver.hxx" 38*cdf0e10cSrcweir #include "PresenterHelper.hxx" 39*cdf0e10cSrcweir #include "PresenterNotesView.hxx" 40*cdf0e10cSrcweir #include "PresenterPaintManager.hxx" 41*cdf0e10cSrcweir #include "PresenterPaneAnimator.hxx" 42*cdf0e10cSrcweir #include "PresenterPaneBase.hxx" 43*cdf0e10cSrcweir #include "PresenterPaneContainer.hxx" 44*cdf0e10cSrcweir #include "PresenterPaneBorderPainter.hxx" 45*cdf0e10cSrcweir #include "PresenterTheme.hxx" 46*cdf0e10cSrcweir #include "PresenterViewFactory.hxx" 47*cdf0e10cSrcweir #include "PresenterWindowManager.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/awt/Key.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/awt/KeyModifier.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/awt/MouseButton.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ResourceId.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp> 61*cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp> 62*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 63*cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentation.hpp> 64*cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentationSupplier.hpp> 65*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 66*cdf0e10cSrcweir #include <com/sun/star/rendering/TextDirection.hpp> 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 69*cdf0e10cSrcweir #include <boost/bind.hpp> 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir using namespace ::com::sun::star; 72*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 73*cdf0e10cSrcweir using namespace ::com::sun::star::presentation; 74*cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 75*cdf0e10cSrcweir using ::rtl::OUString; 76*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir namespace { 79*cdf0e10cSrcweir const sal_Int32 ResourceActivationEventType = 0; 80*cdf0e10cSrcweir const sal_Int32 ResourceDeactivationEventType = 1; 81*cdf0e10cSrcweir const sal_Int32 ConfigurationUpdateEndEventType = 2; 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir namespace sdext { namespace presenter { 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir PresenterController::InstanceContainer PresenterController::maInstances; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir ::rtl::Reference<PresenterController> PresenterController::Instance ( 93*cdf0e10cSrcweir const css::uno::Reference<css::frame::XFrame>& rxFrame) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir InstanceContainer::const_iterator iInstance (maInstances.find(rxFrame)); 96*cdf0e10cSrcweir if (iInstance != maInstances.end()) 97*cdf0e10cSrcweir return iInstance->second; 98*cdf0e10cSrcweir else 99*cdf0e10cSrcweir return ::rtl::Reference<PresenterController>(); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir PresenterController::PresenterController ( 106*cdf0e10cSrcweir const Reference<XComponentContext>& rxContext, 107*cdf0e10cSrcweir const Reference<frame::XController>& rxController, 108*cdf0e10cSrcweir const Reference<presentation::XSlideShowController>& rxSlideShowController, 109*cdf0e10cSrcweir const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, 110*cdf0e10cSrcweir const Reference<XResourceId>& rxMainPaneId) 111*cdf0e10cSrcweir : PresenterControllerInterfaceBase(m_aMutex), 112*cdf0e10cSrcweir mxComponentContext(rxContext), 113*cdf0e10cSrcweir mxController(rxController), 114*cdf0e10cSrcweir mxConfigurationController(), 115*cdf0e10cSrcweir mxSlideShowController(rxSlideShowController), 116*cdf0e10cSrcweir mxMainPaneId(rxMainPaneId), 117*cdf0e10cSrcweir mpPaneContainer(rpPaneContainer), 118*cdf0e10cSrcweir mnCurrentSlideIndex(-1), 119*cdf0e10cSrcweir mxCurrentSlide(), 120*cdf0e10cSrcweir mxNextSlide(), 121*cdf0e10cSrcweir mpWindowManager(new PresenterWindowManager(rxContext,mpPaneContainer,this)), 122*cdf0e10cSrcweir mpCurrentPaneAnimation(), 123*cdf0e10cSrcweir mnWindowBackgroundColor(0x00ffffff), 124*cdf0e10cSrcweir mpTheme(), 125*cdf0e10cSrcweir mxMainWindow(), 126*cdf0e10cSrcweir mpPaneBorderPainter(), 127*cdf0e10cSrcweir mpAnimator(new PresenterAnimator()), 128*cdf0e10cSrcweir mpCanvasHelper(new PresenterCanvasHelper()), 129*cdf0e10cSrcweir mxPresenterHelper(), 130*cdf0e10cSrcweir mpPaintManager(), 131*cdf0e10cSrcweir mnPendingSlideNumber(-1), 132*cdf0e10cSrcweir mxUrlTransformer(), 133*cdf0e10cSrcweir mpAccessibleObject(), 134*cdf0e10cSrcweir mbIsAccessibilityActive(false) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir OSL_ASSERT(mxController.is()); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir if ( ! mxSlideShowController.is()) 139*cdf0e10cSrcweir throw new lang::IllegalArgumentException( 140*cdf0e10cSrcweir A2S("missing slide show controller"), 141*cdf0e10cSrcweir static_cast<XWeak*>(this), 142*cdf0e10cSrcweir 2); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir new PresenterCurrentSlideObserver(this,rxSlideShowController); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // Listen for configuration changes. 147*cdf0e10cSrcweir Reference<XControllerManager> xCM (mxController, UNO_QUERY_THROW); 148*cdf0e10cSrcweir mxConfigurationController = xCM->getConfigurationController(); 149*cdf0e10cSrcweir if (mxConfigurationController.is()) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir mxConfigurationController->addConfigurationChangeListener( 152*cdf0e10cSrcweir this, 153*cdf0e10cSrcweir A2S("ResourceActivation"), 154*cdf0e10cSrcweir Any(ResourceActivationEventType)); 155*cdf0e10cSrcweir mxConfigurationController->addConfigurationChangeListener( 156*cdf0e10cSrcweir this, 157*cdf0e10cSrcweir A2S("ResourceDeactivation"), 158*cdf0e10cSrcweir Any(ResourceDeactivationEventType)); 159*cdf0e10cSrcweir mxConfigurationController->addConfigurationChangeListener( 160*cdf0e10cSrcweir this, 161*cdf0e10cSrcweir A2S("ConfigurationUpdateEnd"), 162*cdf0e10cSrcweir Any(ConfigurationUpdateEndEventType)); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir // Listen for the frame being activated. 166*cdf0e10cSrcweir Reference<frame::XFrame> xFrame (mxController->getFrame()); 167*cdf0e10cSrcweir if (xFrame.is()) 168*cdf0e10cSrcweir xFrame->addFrameActionListener(this); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // Create the border painter. 171*cdf0e10cSrcweir mpPaneBorderPainter = new PresenterPaneBorderPainter(rxContext); 172*cdf0e10cSrcweir mpWindowManager->SetPaneBorderPainter(mpPaneBorderPainter); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // Create an object that is able to load the bitmaps in a format that is 175*cdf0e10cSrcweir // supported by the canvas. 176*cdf0e10cSrcweir Reference<lang::XMultiComponentFactory> xFactory ( 177*cdf0e10cSrcweir rxContext->getServiceManager(), UNO_QUERY); 178*cdf0e10cSrcweir if ( ! xFactory.is()) 179*cdf0e10cSrcweir return; 180*cdf0e10cSrcweir mxPresenterHelper = Reference<drawing::XPresenterHelper>( 181*cdf0e10cSrcweir xFactory->createInstanceWithContext( 182*cdf0e10cSrcweir A2S("com.sun.star.drawing.PresenterHelper"), 183*cdf0e10cSrcweir rxContext), 184*cdf0e10cSrcweir UNO_QUERY_THROW); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir if (mxSlideShowController.is()) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir mxSlideShowController->activate(); 189*cdf0e10cSrcweir Reference<beans::XPropertySet> xProperties (mxSlideShowController, UNO_QUERY); 190*cdf0e10cSrcweir if (xProperties.is()) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir Reference<awt::XWindow> xWindow ( 193*cdf0e10cSrcweir xProperties->getPropertyValue(A2S("ParentWindow")), UNO_QUERY); 194*cdf0e10cSrcweir if (xWindow.is()) 195*cdf0e10cSrcweir xWindow->addKeyListener(this); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir UpdateCurrentSlide(0); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir maInstances[mxController->getFrame()] = this; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir // Create a URLTransformer. 204*cdf0e10cSrcweir if (xFactory.is()) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir mxUrlTransformer = Reference<util::XURLTransformer>( 207*cdf0e10cSrcweir xFactory->createInstanceWithContext( 208*cdf0e10cSrcweir A2S("com.sun.star.util.URLTransformer"), 209*cdf0e10cSrcweir mxComponentContext), 210*cdf0e10cSrcweir UNO_QUERY); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir PresenterController::~PresenterController (void) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir void PresenterController::disposing (void) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir maInstances.erase(mxController->getFrame()); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir if (mxMainWindow.is()) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir mxMainWindow->removeKeyListener(this); 231*cdf0e10cSrcweir mxMainWindow->removeFocusListener(this); 232*cdf0e10cSrcweir mxMainWindow->removeMouseListener(this); 233*cdf0e10cSrcweir mxMainWindow->removeMouseMotionListener(this); 234*cdf0e10cSrcweir mxMainWindow = NULL; 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir if (mxConfigurationController.is()) 237*cdf0e10cSrcweir mxConfigurationController->removeConfigurationChangeListener(this); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir Reference<XComponent> xWindowManagerComponent ( 240*cdf0e10cSrcweir static_cast<XWeak*>(mpWindowManager.get()), UNO_QUERY); 241*cdf0e10cSrcweir mpWindowManager = NULL; 242*cdf0e10cSrcweir if (xWindowManagerComponent.is()) 243*cdf0e10cSrcweir xWindowManagerComponent->dispose(); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir if (mxController.is()) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir Reference<frame::XFrame> xFrame (mxController->getFrame()); 248*cdf0e10cSrcweir if (xFrame.is()) 249*cdf0e10cSrcweir xFrame->removeFrameActionListener(this); 250*cdf0e10cSrcweir mxController = NULL; 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir mxComponentContext = NULL; 254*cdf0e10cSrcweir mxConfigurationController = NULL; 255*cdf0e10cSrcweir mxSlideShowController = NULL; 256*cdf0e10cSrcweir mxMainPaneId = NULL; 257*cdf0e10cSrcweir mpPaneContainer = NULL; 258*cdf0e10cSrcweir mnCurrentSlideIndex = -1; 259*cdf0e10cSrcweir mxCurrentSlide = NULL; 260*cdf0e10cSrcweir mxNextSlide = NULL; 261*cdf0e10cSrcweir mpCurrentPaneAnimation.reset(); 262*cdf0e10cSrcweir mpTheme.reset(); 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir Reference<lang::XComponent> xComponent ( 265*cdf0e10cSrcweir static_cast<XWeak*>(mpPaneBorderPainter.get()), UNO_QUERY); 266*cdf0e10cSrcweir mpPaneBorderPainter = NULL; 267*cdf0e10cSrcweir if (xComponent.is()) 268*cdf0e10cSrcweir xComponent->dispose(); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir mpAnimator.reset(); 271*cdf0e10cSrcweir mpCanvasHelper.reset(); 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir Reference<lang::XComponent> xComponent (mxPresenterHelper, UNO_QUERY); 274*cdf0e10cSrcweir mxPresenterHelper = NULL; 275*cdf0e10cSrcweir if (xComponent.is()) 276*cdf0e10cSrcweir xComponent->dispose(); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir mpPaintManager.reset(); 279*cdf0e10cSrcweir mnPendingSlideNumber = -1; 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir Reference<lang::XComponent> xComponent (mxUrlTransformer, UNO_QUERY); 282*cdf0e10cSrcweir mxUrlTransformer = NULL; 283*cdf0e10cSrcweir if (xComponent.is()) 284*cdf0e10cSrcweir xComponent->dispose(); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void PresenterController::UpdateCurrentSlide (const sal_Int32 nOffset) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir GetSlides(nOffset); 294*cdf0e10cSrcweir UpdatePaneTitles(); 295*cdf0e10cSrcweir UpdateViews(); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir // Update the accessibility object. 298*cdf0e10cSrcweir if (IsAccessibilityActive()) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir sal_Int32 nSlideCount (0); 301*cdf0e10cSrcweir Reference<container::XIndexAccess> xIndexAccess(mxSlideShowController, UNO_QUERY); 302*cdf0e10cSrcweir if (xIndexAccess.is()) 303*cdf0e10cSrcweir nSlideCount = xIndexAccess->getCount(); 304*cdf0e10cSrcweir mpAccessibleObject->NotifyCurrentSlideChange(mnCurrentSlideIndex, nSlideCount); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir void PresenterController::GetSlides (const sal_Int32 nOffset) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir if ( ! mxSlideShowController.is()) 314*cdf0e10cSrcweir return; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // Get the current slide from the slide show controller. 317*cdf0e10cSrcweir mxCurrentSlide = NULL; 318*cdf0e10cSrcweir Reference<container::XIndexAccess> xIndexAccess(mxSlideShowController, UNO_QUERY); 319*cdf0e10cSrcweir sal_Int32 nSlideIndex = -1; 320*cdf0e10cSrcweir try 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir nSlideIndex = mxSlideShowController->getCurrentSlideIndex() + nOffset; 323*cdf0e10cSrcweir if (mxSlideShowController->isPaused()) 324*cdf0e10cSrcweir nSlideIndex = -1; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir if (xIndexAccess.is() && nSlideIndex>=0) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir if (nSlideIndex < xIndexAccess->getCount()) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir mnCurrentSlideIndex = nSlideIndex; 331*cdf0e10cSrcweir mxCurrentSlide = Reference<drawing::XDrawPage>( 332*cdf0e10cSrcweir xIndexAccess->getByIndex(nSlideIndex), UNO_QUERY); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir catch (RuntimeException&) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir // Get the next slide. 341*cdf0e10cSrcweir mxNextSlide = NULL; 342*cdf0e10cSrcweir try 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir const sal_Int32 nNextSlideIndex (mxSlideShowController->getNextSlideIndex()+nOffset); 345*cdf0e10cSrcweir if (nNextSlideIndex >= 0) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir if (xIndexAccess.is()) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir if (nNextSlideIndex < xIndexAccess->getCount()) 350*cdf0e10cSrcweir mxNextSlide = Reference<drawing::XDrawPage>( 351*cdf0e10cSrcweir xIndexAccess->getByIndex(nNextSlideIndex), UNO_QUERY); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir catch (RuntimeException&) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir void PresenterController::UpdatePaneTitles (void) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir if ( ! mxSlideShowController.is()) 366*cdf0e10cSrcweir return; 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir // Get placeholders and their values. 369*cdf0e10cSrcweir const OUString sCurrentSlideNumberPlaceholder (A2S("CURRENT_SLIDE_NUMBER")); 370*cdf0e10cSrcweir const OUString sCurrentSlideNamePlaceholder (A2S("CURRENT_SLIDE_NAME")); 371*cdf0e10cSrcweir const OUString sSlideCountPlaceholder (A2S("SLIDE_COUNT")); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // Get string for slide count. 374*cdf0e10cSrcweir OUString sSlideCount (A2S("---")); 375*cdf0e10cSrcweir Reference<container::XIndexAccess> xIndexAccess(mxSlideShowController, UNO_QUERY); 376*cdf0e10cSrcweir if (xIndexAccess.is()) 377*cdf0e10cSrcweir sSlideCount = OUString::valueOf(xIndexAccess->getCount()); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir // Get string for current slide index. 380*cdf0e10cSrcweir OUString sCurrentSlideNumber (OUString::valueOf(mnCurrentSlideIndex + 1)); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir // Get name of the current slide. 383*cdf0e10cSrcweir OUString sCurrentSlideName; 384*cdf0e10cSrcweir Reference<container::XNamed> xNamedSlide (mxCurrentSlide, UNO_QUERY); 385*cdf0e10cSrcweir if (xNamedSlide.is()) 386*cdf0e10cSrcweir sCurrentSlideName = xNamedSlide->getName(); 387*cdf0e10cSrcweir Reference<beans::XPropertySet> xSlideProperties (mxCurrentSlide, UNO_QUERY); 388*cdf0e10cSrcweir if (xSlideProperties.is()) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir try 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir OUString sName; 393*cdf0e10cSrcweir if (xSlideProperties->getPropertyValue(A2S("LinkDisplayName")) >>= sName) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir // Find out whether the name of the current slide has been 396*cdf0e10cSrcweir // automatically created or has been set by the user. 397*cdf0e10cSrcweir if (sName != sCurrentSlideName) 398*cdf0e10cSrcweir sCurrentSlideName = sName; 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir catch (beans::UnknownPropertyException&) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // Replace the placeholders with their current values. 407*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 408*cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=mpPaneContainer->maPanes.end(); ++iPane) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir OSL_ASSERT((*iPane).get() != NULL); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir OUString sTemplate (IsAccessibilityActive() 413*cdf0e10cSrcweir ? (*iPane)->msAccessibleTitleTemplate 414*cdf0e10cSrcweir : (*iPane)->msTitleTemplate); 415*cdf0e10cSrcweir if (sTemplate.getLength() <= 0) 416*cdf0e10cSrcweir continue; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir OUStringBuffer sResult; 419*cdf0e10cSrcweir sResult.ensureCapacity(sTemplate.getLength()); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir sal_Int32 nIndex (0); 422*cdf0e10cSrcweir while (true) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir sal_Int32 nStartIndex = sTemplate.indexOf('%', nIndex); 425*cdf0e10cSrcweir if (nStartIndex < 0) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir // Add the remaining part of the string. 428*cdf0e10cSrcweir sResult.append(sTemplate.copy(nIndex, sTemplate.getLength()-nIndex)); 429*cdf0e10cSrcweir break; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir else 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir // Add the part preceding the next %. 434*cdf0e10cSrcweir sResult.append(sTemplate.copy(nIndex, nStartIndex-nIndex)); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // Get the placeholder 437*cdf0e10cSrcweir ++nIndex; 438*cdf0e10cSrcweir ++nStartIndex; 439*cdf0e10cSrcweir const sal_Int32 nEndIndex (sTemplate.indexOf('%', nStartIndex+1)); 440*cdf0e10cSrcweir const OUString sPlaceholder (sTemplate.copy(nStartIndex, nEndIndex-nStartIndex)); 441*cdf0e10cSrcweir nIndex = nEndIndex+1; 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // Replace the placeholder with its current value. 444*cdf0e10cSrcweir if (sPlaceholder == sCurrentSlideNumberPlaceholder) 445*cdf0e10cSrcweir sResult.append(sCurrentSlideNumber); 446*cdf0e10cSrcweir else if (sPlaceholder == sCurrentSlideNamePlaceholder) 447*cdf0e10cSrcweir sResult.append(sCurrentSlideName); 448*cdf0e10cSrcweir else if (sPlaceholder == sSlideCountPlaceholder) 449*cdf0e10cSrcweir sResult.append(sSlideCount); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir (*iPane)->msTitle = sResult.makeStringAndClear(); 454*cdf0e10cSrcweir if ((*iPane)->mxPane.is()) 455*cdf0e10cSrcweir (*iPane)->mxPane->SetTitle((*iPane)->msTitle); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir void PresenterController::UpdateViews (void) 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir // Tell all views about the slides they should display. 465*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 466*cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=mpPaneContainer->maPanes.end(); ++iPane) 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir Reference<drawing::XDrawView> xDrawView ((*iPane)->mxView, UNO_QUERY); 469*cdf0e10cSrcweir if (xDrawView.is()) 470*cdf0e10cSrcweir xDrawView->setCurrentPage(mxCurrentSlide); 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir SharedBitmapDescriptor 478*cdf0e10cSrcweir PresenterController::GetViewBackground (const ::rtl::OUString& rsViewURL) const 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir if (mpTheme.get() != NULL) 481*cdf0e10cSrcweir { 482*cdf0e10cSrcweir const OUString sStyleName (mpTheme->GetStyleName(rsViewURL)); 483*cdf0e10cSrcweir return mpTheme->GetBitmap(sStyleName, A2S("Background")); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir return SharedBitmapDescriptor(); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir PresenterTheme::SharedFontDescriptor 492*cdf0e10cSrcweir PresenterController::GetViewFont (const ::rtl::OUString& rsViewURL) const 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir if (mpTheme.get() != NULL) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir const OUString sStyleName (mpTheme->GetStyleName(rsViewURL)); 497*cdf0e10cSrcweir return mpTheme->GetFont(sStyleName); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir return PresenterTheme::SharedFontDescriptor(); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTheme> PresenterController::GetTheme (void) const 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir return mpTheme; 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir ::rtl::Reference<PresenterWindowManager> PresenterController::GetWindowManager (void) const 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir return mpWindowManager; 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir Reference<presentation::XSlideShowController> 522*cdf0e10cSrcweir PresenterController::GetSlideShowController(void) const 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir return mxSlideShowController; 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir rtl::Reference<PresenterPaneContainer> PresenterController::GetPaneContainer (void) const 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir return mpPaneContainer; 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir ::rtl::Reference<PresenterPaneBorderPainter> PresenterController::GetPaneBorderPainter (void) const 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir return mpPaneBorderPainter; 541*cdf0e10cSrcweir } 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir ::boost::shared_ptr<PresenterAnimator> PresenterController::GetAnimator (void) const 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir return mpAnimator; 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir ::boost::shared_ptr<PresenterCanvasHelper> PresenterController::GetCanvasHelper (void) const 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir return mpCanvasHelper; 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir Reference<drawing::XPresenterHelper> PresenterController::GetPresenterHelper (void) const 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir return mxPresenterHelper; 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaintManager> PresenterController::GetPaintManager (void) const 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir return mpPaintManager; 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir void PresenterController::HideSlideSorter (void) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir if (mpCurrentPaneAnimation.get() != NULL) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir mpCurrentPaneAnimation->HidePane(); 583*cdf0e10cSrcweir mpCurrentPaneAnimation.reset(); 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir void PresenterController::ShowView (const OUString& rsViewURL) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 593*cdf0e10cSrcweir mpPaneContainer->FindViewURL(rsViewURL)); 594*cdf0e10cSrcweir if (pDescriptor.get() != NULL) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir pDescriptor->mbIsActive = true; 597*cdf0e10cSrcweir mxConfigurationController->requestResourceActivation( 598*cdf0e10cSrcweir pDescriptor->mxPaneId, 599*cdf0e10cSrcweir ResourceActivationMode_ADD); 600*cdf0e10cSrcweir mxConfigurationController->requestResourceActivation( 601*cdf0e10cSrcweir ResourceId::createWithAnchor( 602*cdf0e10cSrcweir mxComponentContext, 603*cdf0e10cSrcweir rsViewURL, 604*cdf0e10cSrcweir pDescriptor->mxPaneId), 605*cdf0e10cSrcweir ResourceActivationMode_REPLACE); 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir void PresenterController::HideView (const OUString& rsViewURL) 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 615*cdf0e10cSrcweir mpPaneContainer->FindViewURL(rsViewURL)); 616*cdf0e10cSrcweir if (pDescriptor.get() != NULL) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir mxConfigurationController->requestResourceDeactivation( 619*cdf0e10cSrcweir ResourceId::createWithAnchor( 620*cdf0e10cSrcweir mxComponentContext, 621*cdf0e10cSrcweir rsViewURL, 622*cdf0e10cSrcweir pDescriptor->mxPaneId)); 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir bool PresenterController::IsViewVisible (const OUString& rsViewURL) const 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 632*cdf0e10cSrcweir mpPaneContainer->FindViewURL(rsViewURL)); 633*cdf0e10cSrcweir if (pDescriptor.get() != NULL) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir return mxConfigurationController->getResource( 636*cdf0e10cSrcweir ResourceId::createWithAnchor( 637*cdf0e10cSrcweir mxComponentContext, 638*cdf0e10cSrcweir rsViewURL, 639*cdf0e10cSrcweir pDescriptor->mxPaneId)).is(); 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir return false; 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir void PresenterController::DispatchUnoCommand (const OUString& rsCommand) const 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir if ( ! mxUrlTransformer.is()) 650*cdf0e10cSrcweir return; 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir util::URL aURL; 653*cdf0e10cSrcweir aURL.Complete = rsCommand; 654*cdf0e10cSrcweir mxUrlTransformer->parseStrict(aURL); 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir Reference<frame::XDispatch> xDispatch (GetDispatch(aURL)); 657*cdf0e10cSrcweir if ( ! xDispatch.is()) 658*cdf0e10cSrcweir return; 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>()); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir Reference<css::frame::XDispatch> PresenterController::GetDispatch (const util::URL& rURL) const 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir if ( ! mxController.is()) 669*cdf0e10cSrcweir return NULL; 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir Reference<frame::XDispatchProvider> xDispatchProvider (mxController->getFrame(), UNO_QUERY); 672*cdf0e10cSrcweir if ( ! xDispatchProvider.is()) 673*cdf0e10cSrcweir return NULL; 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir return xDispatchProvider->queryDispatch( 676*cdf0e10cSrcweir rURL, 677*cdf0e10cSrcweir OUString(), 678*cdf0e10cSrcweir frame::FrameSearchFlag::SELF); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir util::URL PresenterController::CreateURLFromString (const ::rtl::OUString& rsURL) const 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir util::URL aURL; 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir if (mxUrlTransformer.is()) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir aURL.Complete = rsURL; 691*cdf0e10cSrcweir mxUrlTransformer->parseStrict(aURL); 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir return aURL; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir Reference<drawing::framework::XConfigurationController> 701*cdf0e10cSrcweir PresenterController::GetConfigurationController (void) const 702*cdf0e10cSrcweir { 703*cdf0e10cSrcweir return mxConfigurationController; 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir Reference<drawing::XDrawPage> PresenterController::GetCurrentSlide (void) const 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir return mxCurrentSlide; 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir ::rtl::Reference<PresenterAccessible> PresenterController::GetAccessible (void) const 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir return mpAccessibleObject; 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir void PresenterController::SetAccessibilityActiveState (const bool bIsActive) 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir if ( mbIsAccessibilityActive != bIsActive) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir mbIsAccessibilityActive = bIsActive; 730*cdf0e10cSrcweir UpdatePaneTitles(); 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir bool PresenterController::IsAccessibilityActive (void) const 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir return mbIsAccessibilityActive; 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir void PresenterController::HandleMouseClick (const awt::MouseEvent& rEvent) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir if (mxSlideShowController.is()) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir switch (rEvent.Buttons) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir case awt::MouseButton::LEFT: 752*cdf0e10cSrcweir if (rEvent.Modifiers == awt::KeyModifier::MOD2) 753*cdf0e10cSrcweir mxSlideShowController->gotoNextSlide(); 754*cdf0e10cSrcweir else 755*cdf0e10cSrcweir mxSlideShowController->gotoNextEffect(); 756*cdf0e10cSrcweir break; 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir case awt::MouseButton::RIGHT: 759*cdf0e10cSrcweir mxSlideShowController->gotoPreviousSlide(); 760*cdf0e10cSrcweir break; 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir default: 763*cdf0e10cSrcweir // Other or multiple buttons. 764*cdf0e10cSrcweir break; 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir void PresenterController::RequestViews ( 773*cdf0e10cSrcweir const bool bIsSlideSorterActive, 774*cdf0e10cSrcweir const bool bIsNotesViewActive, 775*cdf0e10cSrcweir const bool bIsHelpViewActive) 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 778*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iEnd (mpPaneContainer->maPanes.end()); 779*cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=iEnd; ++iPane) 780*cdf0e10cSrcweir { 781*cdf0e10cSrcweir bool bActivate (true); 782*cdf0e10cSrcweir const OUString sViewURL ((*iPane)->msViewURL); 783*cdf0e10cSrcweir if (sViewURL == PresenterViewFactory::msNotesViewURL) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir bActivate = bIsNotesViewActive && !bIsSlideSorterActive && !bIsHelpViewActive; 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir else if (sViewURL == PresenterViewFactory::msSlideSorterURL) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir bActivate = bIsSlideSorterActive; 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir else if (sViewURL == PresenterViewFactory::msCurrentSlidePreviewViewURL 792*cdf0e10cSrcweir || sViewURL == PresenterViewFactory::msNextSlidePreviewViewURL) 793*cdf0e10cSrcweir { 794*cdf0e10cSrcweir bActivate = !bIsSlideSorterActive && ! bIsHelpViewActive; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir else if (sViewURL == PresenterViewFactory::msToolBarViewURL) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir bActivate = true; 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir else if (sViewURL == PresenterViewFactory::msHelpViewURL) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir bActivate = bIsHelpViewActive; 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir if (bActivate) 806*cdf0e10cSrcweir ShowView(sViewURL); 807*cdf0e10cSrcweir else 808*cdf0e10cSrcweir HideView(sViewURL); 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir //----- XConfigurationChangeListener ------------------------------------------ 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir void SAL_CALL PresenterController::notifyConfigurationChange ( 818*cdf0e10cSrcweir const ConfigurationChangeEvent& rEvent) 819*cdf0e10cSrcweir throw (RuntimeException) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir ThrowIfDisposed(); 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir sal_Int32 nType (0); 824*cdf0e10cSrcweir if ( ! (rEvent.UserData >>= nType)) 825*cdf0e10cSrcweir return; 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir switch (nType) 828*cdf0e10cSrcweir { 829*cdf0e10cSrcweir case ResourceActivationEventType: 830*cdf0e10cSrcweir if (rEvent.ResourceId->compareTo(mxMainPaneId) == 0) 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir InitializeMainPane(Reference<XPane>(rEvent.ResourceObject,UNO_QUERY)); 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir else if (rEvent.ResourceId->isBoundTo(mxMainPaneId,AnchorBindingMode_DIRECT)) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir // A pane bound to the main pane has been created and is 837*cdf0e10cSrcweir // stored in the pane container. 838*cdf0e10cSrcweir Reference<XPane> xPane (rEvent.ResourceObject,UNO_QUERY); 839*cdf0e10cSrcweir if (xPane.is()) 840*cdf0e10cSrcweir { 841*cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( 842*cdf0e10cSrcweir mpPaneContainer->FindPaneId(xPane->getResourceId())); 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir // When there is a call out anchor location set then tell the 845*cdf0e10cSrcweir // window about it. 846*cdf0e10cSrcweir if (pDescriptor->mbHasCalloutAnchor) 847*cdf0e10cSrcweir pDescriptor->mxPane->SetCalloutAnchor( 848*cdf0e10cSrcweir pDescriptor->maCalloutAnchorLocation); 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir } 851*cdf0e10cSrcweir else if (rEvent.ResourceId->isBoundTo(mxMainPaneId,AnchorBindingMode_INDIRECT)) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir // A view bound to one of the panes has been created and is 854*cdf0e10cSrcweir // stored in the pane container along with its pane. 855*cdf0e10cSrcweir Reference<XView> xView (rEvent.ResourceObject,UNO_QUERY); 856*cdf0e10cSrcweir if (xView.is()) 857*cdf0e10cSrcweir { 858*cdf0e10cSrcweir SharedBitmapDescriptor pViewBackground( 859*cdf0e10cSrcweir GetViewBackground(xView->getResourceId()->getResourceURL())); 860*cdf0e10cSrcweir mpPaneContainer->StoreView(xView, pViewBackground); 861*cdf0e10cSrcweir UpdateViews(); 862*cdf0e10cSrcweir mpWindowManager->NotifyViewCreation(xView); 863*cdf0e10cSrcweir } 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir break; 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir case ResourceDeactivationEventType: 868*cdf0e10cSrcweir if (rEvent.ResourceId->isBoundTo(mxMainPaneId,AnchorBindingMode_INDIRECT)) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir // If this is a view then remove it from the pane container. 871*cdf0e10cSrcweir Reference<XView> xView (rEvent.ResourceObject,UNO_QUERY); 872*cdf0e10cSrcweir if (xView.is()) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pDescriptor( 875*cdf0e10cSrcweir mpPaneContainer->RemoveView(xView)); 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir // A possibly opaque view has been removed. Update() 878*cdf0e10cSrcweir // updates the clip polygon. 879*cdf0e10cSrcweir mpWindowManager->Update(); 880*cdf0e10cSrcweir // Request the repainting of the area previously 881*cdf0e10cSrcweir // occupied by the view. 882*cdf0e10cSrcweir if (pDescriptor.get() != NULL) 883*cdf0e10cSrcweir GetPaintManager()->Invalidate(pDescriptor->mxBorderWindow); 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir } 886*cdf0e10cSrcweir break; 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir case ConfigurationUpdateEndEventType: 889*cdf0e10cSrcweir if (IsAccessibilityActive()) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir mpAccessibleObject->UpdateAccessibilityHierarchy(); 892*cdf0e10cSrcweir UpdateCurrentSlide(0); 893*cdf0e10cSrcweir } 894*cdf0e10cSrcweir break; 895*cdf0e10cSrcweir } 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir 898*cdf0e10cSrcweir 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir 901*cdf0e10cSrcweir //----- XEventListener -------------------------------------------------------- 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir void SAL_CALL PresenterController::disposing ( 904*cdf0e10cSrcweir const lang::EventObject& rEvent) 905*cdf0e10cSrcweir throw (RuntimeException) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir if (rEvent.Source == mxController) 908*cdf0e10cSrcweir mxController = NULL; 909*cdf0e10cSrcweir else if (rEvent.Source == mxConfigurationController) 910*cdf0e10cSrcweir mxConfigurationController = NULL; 911*cdf0e10cSrcweir else if (rEvent.Source == mxSlideShowController) 912*cdf0e10cSrcweir mxSlideShowController = NULL; 913*cdf0e10cSrcweir else if (rEvent.Source == mxMainWindow) 914*cdf0e10cSrcweir mxMainWindow = NULL; 915*cdf0e10cSrcweir } 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir 919*cdf0e10cSrcweir 920*cdf0e10cSrcweir //----- XFrameActionListener -------------------------------------------------- 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir void SAL_CALL PresenterController::frameAction ( 923*cdf0e10cSrcweir const frame::FrameActionEvent& rEvent) 924*cdf0e10cSrcweir throw (RuntimeException) 925*cdf0e10cSrcweir { 926*cdf0e10cSrcweir if (rEvent.Action == frame::FrameAction_FRAME_ACTIVATED) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir if (mxSlideShowController.is()) 929*cdf0e10cSrcweir mxSlideShowController->activate(); 930*cdf0e10cSrcweir } 931*cdf0e10cSrcweir } 932*cdf0e10cSrcweir 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir //----- XKeyListener ---------------------------------------------------------- 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir void SAL_CALL PresenterController::keyPressed (const awt::KeyEvent& rEvent) 939*cdf0e10cSrcweir throw (RuntimeException) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir // Tell all views about the unhandled key event. 942*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 943*cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=mpPaneContainer->maPanes.end(); ++iPane) 944*cdf0e10cSrcweir { 945*cdf0e10cSrcweir if ( ! (*iPane)->mbIsActive) 946*cdf0e10cSrcweir continue; 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir Reference<awt::XKeyListener> xKeyListener ((*iPane)->mxView, UNO_QUERY); 949*cdf0e10cSrcweir if (xKeyListener.is()) 950*cdf0e10cSrcweir xKeyListener->keyPressed(rEvent); 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir void SAL_CALL PresenterController::keyReleased (const awt::KeyEvent& rEvent) 958*cdf0e10cSrcweir throw (RuntimeException) 959*cdf0e10cSrcweir { 960*cdf0e10cSrcweir if (rEvent.Source != mxMainWindow) 961*cdf0e10cSrcweir return; 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir switch (rEvent.KeyCode) 964*cdf0e10cSrcweir { 965*cdf0e10cSrcweir case awt::Key::ESCAPE: 966*cdf0e10cSrcweir case awt::Key::SUBTRACT: 967*cdf0e10cSrcweir { 968*cdf0e10cSrcweir if( mxController.is() ) 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir Reference< XPresentationSupplier > xPS( mxController->getModel(), UNO_QUERY ); 971*cdf0e10cSrcweir if( xPS.is() ) 972*cdf0e10cSrcweir { 973*cdf0e10cSrcweir Reference< XPresentation > xP( xPS->getPresentation() ); 974*cdf0e10cSrcweir if( xP.is() ) 975*cdf0e10cSrcweir xP->end(); 976*cdf0e10cSrcweir } 977*cdf0e10cSrcweir } 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir break; 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir case awt::Key::PAGEDOWN: 982*cdf0e10cSrcweir if (mxSlideShowController.is()) 983*cdf0e10cSrcweir { 984*cdf0e10cSrcweir if (rEvent.Modifiers == awt::KeyModifier::MOD2) 985*cdf0e10cSrcweir mxSlideShowController->gotoNextSlide(); 986*cdf0e10cSrcweir else 987*cdf0e10cSrcweir mxSlideShowController->gotoNextEffect(); 988*cdf0e10cSrcweir } 989*cdf0e10cSrcweir break; 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir case awt::Key::RIGHT: 992*cdf0e10cSrcweir case awt::Key::SPACE: 993*cdf0e10cSrcweir case awt::Key::DOWN: 994*cdf0e10cSrcweir case awt::Key::N: 995*cdf0e10cSrcweir if (mxSlideShowController.is()) 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir mxSlideShowController->gotoNextEffect(); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir break; 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir case awt::Key::LEFT: 1002*cdf0e10cSrcweir case awt::Key::PAGEUP: 1003*cdf0e10cSrcweir if (mxSlideShowController.is()) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir if (rEvent.Modifiers == awt::KeyModifier::MOD2) 1006*cdf0e10cSrcweir mxSlideShowController->gotoPreviousSlide(); 1007*cdf0e10cSrcweir else 1008*cdf0e10cSrcweir mxSlideShowController->gotoPreviousEffect(); 1009*cdf0e10cSrcweir } 1010*cdf0e10cSrcweir break; 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir case awt::Key::UP: 1013*cdf0e10cSrcweir case awt::Key::P: 1014*cdf0e10cSrcweir case awt::Key::BACKSPACE: 1015*cdf0e10cSrcweir if (mxSlideShowController.is()) 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir mxSlideShowController->gotoPreviousEffect(); 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir break; 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir case awt::Key::HOME: 1022*cdf0e10cSrcweir if (mxSlideShowController.is()) 1023*cdf0e10cSrcweir { 1024*cdf0e10cSrcweir mxSlideShowController->gotoFirstSlide(); 1025*cdf0e10cSrcweir } 1026*cdf0e10cSrcweir break; 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir case awt::Key::END: 1029*cdf0e10cSrcweir if (mxSlideShowController.is()) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir mxSlideShowController->gotoLastSlide(); 1032*cdf0e10cSrcweir } 1033*cdf0e10cSrcweir break; 1034*cdf0e10cSrcweir 1035*cdf0e10cSrcweir case awt::Key::W: 1036*cdf0e10cSrcweir case awt::Key::COMMA: 1037*cdf0e10cSrcweir if (mxSlideShowController.is()) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir if (mxSlideShowController->isPaused()) 1040*cdf0e10cSrcweir mxSlideShowController->resume(); 1041*cdf0e10cSrcweir else 1042*cdf0e10cSrcweir mxSlideShowController->blankScreen(0x00ffffff); 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir break; 1045*cdf0e10cSrcweir 1046*cdf0e10cSrcweir case awt::Key::B: 1047*cdf0e10cSrcweir case awt::Key::POINT: 1048*cdf0e10cSrcweir if (mxSlideShowController.is()) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir if (mxSlideShowController->isPaused()) 1051*cdf0e10cSrcweir mxSlideShowController->resume(); 1052*cdf0e10cSrcweir else 1053*cdf0e10cSrcweir mxSlideShowController->blankScreen(0x00000000); 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir break; 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir case awt::Key::NUM0: 1058*cdf0e10cSrcweir case awt::Key::NUM1: 1059*cdf0e10cSrcweir case awt::Key::NUM2: 1060*cdf0e10cSrcweir case awt::Key::NUM3: 1061*cdf0e10cSrcweir case awt::Key::NUM4: 1062*cdf0e10cSrcweir case awt::Key::NUM5: 1063*cdf0e10cSrcweir case awt::Key::NUM6: 1064*cdf0e10cSrcweir case awt::Key::NUM7: 1065*cdf0e10cSrcweir case awt::Key::NUM8: 1066*cdf0e10cSrcweir case awt::Key::NUM9: 1067*cdf0e10cSrcweir HandleNumericKeyPress(rEvent.KeyCode-awt::Key::NUM0, rEvent.Modifiers); 1068*cdf0e10cSrcweir break; 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir case awt::Key::RETURN: 1071*cdf0e10cSrcweir if (mnPendingSlideNumber > 0) 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir if (mxSlideShowController.is()) 1074*cdf0e10cSrcweir mxSlideShowController->gotoSlideIndex(mnPendingSlideNumber - 1); 1075*cdf0e10cSrcweir mnPendingSlideNumber = -1; 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir else 1078*cdf0e10cSrcweir { 1079*cdf0e10cSrcweir if (mxSlideShowController.is()) 1080*cdf0e10cSrcweir mxSlideShowController->gotoNextEffect(); 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir break; 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir case awt::Key::F1: 1086*cdf0e10cSrcweir // Toggle the help view. 1087*cdf0e10cSrcweir if (mpWindowManager.get() != NULL) 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir if (mpWindowManager->GetViewMode() != PresenterWindowManager::VM_Help) 1090*cdf0e10cSrcweir mpWindowManager->SetViewMode(PresenterWindowManager::VM_Help); 1091*cdf0e10cSrcweir else 1092*cdf0e10cSrcweir mpWindowManager->SetHelpViewState(false); 1093*cdf0e10cSrcweir } 1094*cdf0e10cSrcweir 1095*cdf0e10cSrcweir break; 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir default: 1098*cdf0e10cSrcweir // Tell all views about the unhandled key event. 1099*cdf0e10cSrcweir PresenterPaneContainer::PaneList::const_iterator iPane; 1100*cdf0e10cSrcweir for (iPane=mpPaneContainer->maPanes.begin(); iPane!=mpPaneContainer->maPanes.end(); ++iPane) 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir if ( ! (*iPane)->mbIsActive) 1103*cdf0e10cSrcweir continue; 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir Reference<awt::XKeyListener> xKeyListener ((*iPane)->mxView, UNO_QUERY); 1106*cdf0e10cSrcweir if (xKeyListener.is()) 1107*cdf0e10cSrcweir xKeyListener->keyReleased(rEvent); 1108*cdf0e10cSrcweir } 1109*cdf0e10cSrcweir break; 1110*cdf0e10cSrcweir } 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir void PresenterController::HandleNumericKeyPress ( 1117*cdf0e10cSrcweir const sal_Int32 nKey, 1118*cdf0e10cSrcweir const sal_Int32 nModifiers) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir switch (nModifiers) 1121*cdf0e10cSrcweir { 1122*cdf0e10cSrcweir case 0: 1123*cdf0e10cSrcweir if (mnPendingSlideNumber == -1) 1124*cdf0e10cSrcweir mnPendingSlideNumber = 0; 1125*cdf0e10cSrcweir UpdatePendingSlideNumber(mnPendingSlideNumber * 10 + nKey); 1126*cdf0e10cSrcweir break; 1127*cdf0e10cSrcweir 1128*cdf0e10cSrcweir case awt::KeyModifier::MOD1: 1129*cdf0e10cSrcweir // Ctrl-1, Ctrl-2, and Ctrl-3 are used to switch between views 1130*cdf0e10cSrcweir // (slide view, notes view, normal) 1131*cdf0e10cSrcweir mnPendingSlideNumber = -1; 1132*cdf0e10cSrcweir if (mpWindowManager.get() == NULL) 1133*cdf0e10cSrcweir return; 1134*cdf0e10cSrcweir switch(nKey) 1135*cdf0e10cSrcweir { 1136*cdf0e10cSrcweir case 1: 1137*cdf0e10cSrcweir mpWindowManager->SetViewMode(PresenterWindowManager::VM_Standard); 1138*cdf0e10cSrcweir break; 1139*cdf0e10cSrcweir case 2: 1140*cdf0e10cSrcweir mpWindowManager->SetViewMode(PresenterWindowManager::VM_Notes); 1141*cdf0e10cSrcweir break; 1142*cdf0e10cSrcweir case 3: 1143*cdf0e10cSrcweir mpWindowManager->SetViewMode(PresenterWindowManager::VM_SlideOverview); 1144*cdf0e10cSrcweir break; 1145*cdf0e10cSrcweir default: 1146*cdf0e10cSrcweir // Ignore unsupported key. 1147*cdf0e10cSrcweir break; 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir 1150*cdf0e10cSrcweir default: 1151*cdf0e10cSrcweir // Ignore unsupported modifiers. 1152*cdf0e10cSrcweir break; 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir } 1155*cdf0e10cSrcweir 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir //----- XFocusListener -------------------------------------------------------- 1160*cdf0e10cSrcweir 1161*cdf0e10cSrcweir void SAL_CALL PresenterController::focusGained (const css::awt::FocusEvent& rEvent) 1162*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1163*cdf0e10cSrcweir { 1164*cdf0e10cSrcweir (void)rEvent; 1165*cdf0e10cSrcweir } 1166*cdf0e10cSrcweir 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir void SAL_CALL PresenterController::focusLost (const css::awt::FocusEvent& rEvent) 1171*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1172*cdf0e10cSrcweir { 1173*cdf0e10cSrcweir (void)rEvent; 1174*cdf0e10cSrcweir } 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir 1178*cdf0e10cSrcweir 1179*cdf0e10cSrcweir //----- XMouseListener -------------------------------------------------------- 1180*cdf0e10cSrcweir 1181*cdf0e10cSrcweir void SAL_CALL PresenterController::mousePressed (const css::awt::MouseEvent& rEvent) 1182*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir (void)rEvent; 1185*cdf0e10cSrcweir if (mxMainWindow.is()) 1186*cdf0e10cSrcweir mxMainWindow->setFocus(); 1187*cdf0e10cSrcweir } 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir 1192*cdf0e10cSrcweir void SAL_CALL PresenterController::mouseReleased (const css::awt::MouseEvent& rEvent) 1193*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1194*cdf0e10cSrcweir { 1195*cdf0e10cSrcweir (void)rEvent; 1196*cdf0e10cSrcweir } 1197*cdf0e10cSrcweir 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir void SAL_CALL PresenterController::mouseEntered (const css::awt::MouseEvent& rEvent) 1202*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1203*cdf0e10cSrcweir { 1204*cdf0e10cSrcweir (void)rEvent; 1205*cdf0e10cSrcweir } 1206*cdf0e10cSrcweir 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir void SAL_CALL PresenterController::mouseExited (const css::awt::MouseEvent& rEvent) 1211*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir (void)rEvent; 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir //----- XMouseMotionListener -------------------------------------------------- 1220*cdf0e10cSrcweir 1221*cdf0e10cSrcweir void SAL_CALL PresenterController::mouseMoved (const css::awt::MouseEvent& rEvent) 1222*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir (void)rEvent; 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir void SAL_CALL PresenterController::mouseDragged (const css::awt::MouseEvent& rEvent) 1231*cdf0e10cSrcweir throw (css::uno::RuntimeException) 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir (void)rEvent; 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir //----------------------------------------------------------------------------- 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir void PresenterController::InitializeMainPane (const Reference<XPane>& rxPane) 1242*cdf0e10cSrcweir { 1243*cdf0e10cSrcweir if ( ! rxPane.is()) 1244*cdf0e10cSrcweir return; 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir mpAccessibleObject = new PresenterAccessible( 1247*cdf0e10cSrcweir mxComponentContext, 1248*cdf0e10cSrcweir this, 1249*cdf0e10cSrcweir rxPane); 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir LoadTheme(rxPane); 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir // Main pane has been created and is now observed by the window 1254*cdf0e10cSrcweir // manager. 1255*cdf0e10cSrcweir mpWindowManager->SetParentPane(rxPane); 1256*cdf0e10cSrcweir mpWindowManager->SetTheme(mpTheme); 1257*cdf0e10cSrcweir 1258*cdf0e10cSrcweir if (mpPaneBorderPainter.get() != NULL) 1259*cdf0e10cSrcweir mpPaneBorderPainter->SetTheme(mpTheme); 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir // Add key listener 1262*cdf0e10cSrcweir mxMainWindow = rxPane->getWindow(); 1263*cdf0e10cSrcweir if (mxMainWindow.is()) 1264*cdf0e10cSrcweir { 1265*cdf0e10cSrcweir mxMainWindow->addKeyListener(this); 1266*cdf0e10cSrcweir mxMainWindow->addFocusListener(this); 1267*cdf0e10cSrcweir mxMainWindow->addMouseListener(this); 1268*cdf0e10cSrcweir mxMainWindow->addMouseMotionListener(this); 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir Reference<XPane2> xPane2 (rxPane, UNO_QUERY); 1271*cdf0e10cSrcweir if (xPane2.is()) 1272*cdf0e10cSrcweir xPane2->setVisible(sal_True); 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir mpPaintManager.reset(new PresenterPaintManager(mxMainWindow, mxPresenterHelper, mpPaneContainer)); 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir mxCanvas = Reference<rendering::XSpriteCanvas>(rxPane->getCanvas(), UNO_QUERY); 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir if (mxSlideShowController.is()) 1279*cdf0e10cSrcweir mxSlideShowController->activate(); 1280*cdf0e10cSrcweir 1281*cdf0e10cSrcweir UpdateCurrentSlide(0); 1282*cdf0e10cSrcweir } 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir 1285*cdf0e10cSrcweir 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir void PresenterController::LoadTheme (const Reference<XPane>& rxPane) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir // Create (load) the current theme. 1290*cdf0e10cSrcweir if (rxPane.is()) 1291*cdf0e10cSrcweir mpTheme.reset(new PresenterTheme(mxComponentContext, OUString(), rxPane->getCanvas())); 1292*cdf0e10cSrcweir } 1293*cdf0e10cSrcweir 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir 1296*cdf0e10cSrcweir 1297*cdf0e10cSrcweir double PresenterController::GetSlideAspectRatio (void) const 1298*cdf0e10cSrcweir { 1299*cdf0e10cSrcweir double nSlideAspectRatio (28.0/21.0); 1300*cdf0e10cSrcweir 1301*cdf0e10cSrcweir try 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir if (mxController.is()) 1304*cdf0e10cSrcweir { 1305*cdf0e10cSrcweir Reference<drawing::XDrawPagesSupplier> xSlideSupplier ( 1306*cdf0e10cSrcweir mxController->getModel(), UNO_QUERY_THROW); 1307*cdf0e10cSrcweir Reference<drawing::XDrawPages> xSlides (xSlideSupplier->getDrawPages()); 1308*cdf0e10cSrcweir if (xSlides.is() && xSlides->getCount()>0) 1309*cdf0e10cSrcweir { 1310*cdf0e10cSrcweir Reference<beans::XPropertySet> xProperties(xSlides->getByIndex(0),UNO_QUERY_THROW); 1311*cdf0e10cSrcweir sal_Int32 nWidth (28000); 1312*cdf0e10cSrcweir sal_Int32 nHeight (21000); 1313*cdf0e10cSrcweir if ((xProperties->getPropertyValue(OUString::createFromAscii("Width")) >>= nWidth) 1314*cdf0e10cSrcweir && (xProperties->getPropertyValue(OUString::createFromAscii("Height")) >>= nHeight) 1315*cdf0e10cSrcweir && nHeight > 0) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir nSlideAspectRatio = double(nWidth) / double(nHeight); 1318*cdf0e10cSrcweir } 1319*cdf0e10cSrcweir } 1320*cdf0e10cSrcweir } 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir catch (RuntimeException&) 1323*cdf0e10cSrcweir { 1324*cdf0e10cSrcweir OSL_ASSERT(false); 1325*cdf0e10cSrcweir } 1326*cdf0e10cSrcweir 1327*cdf0e10cSrcweir return nSlideAspectRatio; 1328*cdf0e10cSrcweir } 1329*cdf0e10cSrcweir 1330*cdf0e10cSrcweir 1331*cdf0e10cSrcweir 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir void PresenterController::UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir mnPendingSlideNumber = nPendingSlideNumber; 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir if (mpTheme.get() == NULL) 1338*cdf0e10cSrcweir return; 1339*cdf0e10cSrcweir 1340*cdf0e10cSrcweir if ( ! mxMainWindow.is()) 1341*cdf0e10cSrcweir return; 1342*cdf0e10cSrcweir 1343*cdf0e10cSrcweir PresenterTheme::SharedFontDescriptor pFont ( 1344*cdf0e10cSrcweir mpTheme->GetFont(A2S("PendingSlideNumberFont"))); 1345*cdf0e10cSrcweir if (pFont.get() == NULL) 1346*cdf0e10cSrcweir return; 1347*cdf0e10cSrcweir 1348*cdf0e10cSrcweir pFont->PrepareFont(Reference<rendering::XCanvas>(mxCanvas, UNO_QUERY)); 1349*cdf0e10cSrcweir if ( ! pFont->mxFont.is()) 1350*cdf0e10cSrcweir return; 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir const OUString sText (OUString::valueOf(mnPendingSlideNumber)); 1353*cdf0e10cSrcweir rendering::StringContext aContext (sText, 0, sText.getLength()); 1354*cdf0e10cSrcweir Reference<rendering::XTextLayout> xLayout ( 1355*cdf0e10cSrcweir pFont->mxFont->createTextLayout( 1356*cdf0e10cSrcweir aContext, 1357*cdf0e10cSrcweir rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 1358*cdf0e10cSrcweir 0)); 1359*cdf0e10cSrcweir } 1360*cdf0e10cSrcweir 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir void PresenterController::ThrowIfDisposed (void) const 1365*cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 1366*cdf0e10cSrcweir { 1367*cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 1368*cdf0e10cSrcweir { 1369*cdf0e10cSrcweir throw lang::DisposedException ( 1370*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM( 1371*cdf0e10cSrcweir "PresenterController object has already been disposed")), 1372*cdf0e10cSrcweir const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this))); 1373*cdf0e10cSrcweir } 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir 1377*cdf0e10cSrcweir } } // end of namespace ::sdext::presenter 1378*cdf0e10cSrcweir 1379