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 #ifndef SDEXT_PRESENTER_CONTROLLER_HXX 29*cdf0e10cSrcweir #define SDEXT_PRESENTER_CONTROLLER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterAccessibility.hxx" 32*cdf0e10cSrcweir #include "PresenterPaneContainer.hxx" 33*cdf0e10cSrcweir #include "PresenterTheme.hxx" 34*cdf0e10cSrcweir #include "PresenterSprite.hxx" 35*cdf0e10cSrcweir #include <cppuhelper/compbase6.hxx> 36*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 37*cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/XFocusListener.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/awt/XKeyListener.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowController.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowListener.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/frame/XFrameActionListener.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp> 54*cdf0e10cSrcweir #include <rtl/ref.hxx> 55*cdf0e10cSrcweir #include <map> 56*cdf0e10cSrcweir #include <vector> 57*cdf0e10cSrcweir #include <boost/function.hpp> 58*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 59*cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir namespace css = ::com::sun::star; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir namespace sdext { namespace presenter { 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir class PresenterAnimator; 66*cdf0e10cSrcweir class PresenterCanvasHelper; 67*cdf0e10cSrcweir class PresenterPaintManager; 68*cdf0e10cSrcweir class PresenterPaneAnimator; 69*cdf0e10cSrcweir class PresenterPaneContainer; 70*cdf0e10cSrcweir class PresenterPaneBorderPainter; 71*cdf0e10cSrcweir class PresenterTheme; 72*cdf0e10cSrcweir class PresenterWindowManager; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir namespace { 75*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper6 < 76*cdf0e10cSrcweir css::drawing::framework::XConfigurationChangeListener, 77*cdf0e10cSrcweir css::frame::XFrameActionListener, 78*cdf0e10cSrcweir css::awt::XKeyListener, 79*cdf0e10cSrcweir css::awt::XFocusListener, 80*cdf0e10cSrcweir css::awt::XMouseListener, 81*cdf0e10cSrcweir css::awt::XMouseMotionListener 82*cdf0e10cSrcweir > PresenterControllerInterfaceBase; 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir /** The controller of the presenter screen is responsible for telling the 87*cdf0e10cSrcweir individual views which slides to show. Additionally it provides access 88*cdf0e10cSrcweir to frequently used values of the current theme. 89*cdf0e10cSrcweir */ 90*cdf0e10cSrcweir class PresenterController 91*cdf0e10cSrcweir : protected ::cppu::BaseMutex, 92*cdf0e10cSrcweir public PresenterControllerInterfaceBase 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir public: 95*cdf0e10cSrcweir static ::rtl::Reference<PresenterController> Instance ( 96*cdf0e10cSrcweir const css::uno::Reference<css::frame::XFrame>& rxFrame); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir PresenterController ( 99*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 100*cdf0e10cSrcweir const css::uno::Reference<css::frame::XController>& rxController, 101*cdf0e10cSrcweir const css::uno::Reference<css::presentation::XSlideShowController>& rxSlideShowController, 102*cdf0e10cSrcweir const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, 103*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxMainPaneId); 104*cdf0e10cSrcweir ~PresenterController (void); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void UpdateCurrentSlide (const sal_Int32 nOffset); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir SharedBitmapDescriptor 111*cdf0e10cSrcweir GetViewBackground (const ::rtl::OUString& rsViewURL) const; 112*cdf0e10cSrcweir PresenterTheme::SharedFontDescriptor 113*cdf0e10cSrcweir GetViewFont (const ::rtl::OUString& rsViewURL) const; 114*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTheme> GetTheme (void) const; 115*cdf0e10cSrcweir ::rtl::Reference<PresenterWindowManager> GetWindowManager (void) const; 116*cdf0e10cSrcweir css::uno::Reference<css::presentation::XSlideShowController> 117*cdf0e10cSrcweir GetSlideShowController (void) const; 118*cdf0e10cSrcweir rtl::Reference<PresenterPaneContainer> GetPaneContainer (void) const; 119*cdf0e10cSrcweir ::rtl::Reference<PresenterPaneBorderPainter> GetPaneBorderPainter (void) const; 120*cdf0e10cSrcweir ::boost::shared_ptr<PresenterAnimator> GetAnimator (void) const; 121*cdf0e10cSrcweir ::boost::shared_ptr<PresenterCanvasHelper> GetCanvasHelper (void) const; 122*cdf0e10cSrcweir css::uno::Reference<css::drawing::XPresenterHelper> GetPresenterHelper (void) const; 123*cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaintManager> GetPaintManager (void) const; 124*cdf0e10cSrcweir void HideSlideSorter (void); 125*cdf0e10cSrcweir double GetSlideAspectRatio (void) const; 126*cdf0e10cSrcweir void ShowView (const ::rtl::OUString& rsViewURL); 127*cdf0e10cSrcweir void HideView (const ::rtl::OUString& rsViewURL); 128*cdf0e10cSrcweir bool IsViewVisible (const ::rtl::OUString& rsViewURL) const; 129*cdf0e10cSrcweir void DispatchUnoCommand (const ::rtl::OUString& rsCommand) const; 130*cdf0e10cSrcweir css::uno::Reference<css::frame::XDispatch> GetDispatch ( 131*cdf0e10cSrcweir const css::util::URL& rURL) const; 132*cdf0e10cSrcweir css::util::URL CreateURLFromString (const ::rtl::OUString& rsURL) const; 133*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XConfigurationController> 134*cdf0e10cSrcweir GetConfigurationController (void) const; 135*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> GetCurrentSlide (void) const; 136*cdf0e10cSrcweir ::rtl::Reference<PresenterAccessible> GetAccessible (void) const; 137*cdf0e10cSrcweir void SetAccessibilityActiveState (const bool bIsActive); 138*cdf0e10cSrcweir bool IsAccessibilityActive (void) const; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void HandleMouseClick (const css::awt::MouseEvent& rEvent); 141*cdf0e10cSrcweir void UpdatePaneTitles (void); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir /** Request activation or deactivation of (some of) the views according 144*cdf0e10cSrcweir to the given parameters. 145*cdf0e10cSrcweir */ 146*cdf0e10cSrcweir void RequestViews ( 147*cdf0e10cSrcweir const bool bIsSlideSorterActive, 148*cdf0e10cSrcweir const bool bIsNotesViewActive, 149*cdf0e10cSrcweir const bool bIsHelpViewActive); 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir // XConfigurationChangeListener 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir virtual void SAL_CALL notifyConfigurationChange ( 154*cdf0e10cSrcweir const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent) 155*cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // XEventListener 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir virtual void SAL_CALL disposing ( 161*cdf0e10cSrcweir const com::sun::star::lang::EventObject& rEvent) 162*cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir // XFrameActionListener 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir virtual void SAL_CALL frameAction ( 168*cdf0e10cSrcweir const css::frame::FrameActionEvent& rEvent) 169*cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // XKeyListener 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) 175*cdf0e10cSrcweir throw (css::uno::RuntimeException); 176*cdf0e10cSrcweir virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) 177*cdf0e10cSrcweir throw (css::uno::RuntimeException); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir // XFocusListener 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent) 183*cdf0e10cSrcweir throw (css::uno::RuntimeException); 184*cdf0e10cSrcweir virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent) 185*cdf0e10cSrcweir throw (css::uno::RuntimeException); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir // XMouseListener 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 191*cdf0e10cSrcweir throw (css::uno::RuntimeException); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) 194*cdf0e10cSrcweir throw (css::uno::RuntimeException); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) 197*cdf0e10cSrcweir throw (css::uno::RuntimeException); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 200*cdf0e10cSrcweir throw (css::uno::RuntimeException); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir // XMouseMotionListener 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 206*cdf0e10cSrcweir throw (css::uno::RuntimeException); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 209*cdf0e10cSrcweir throw (css::uno::RuntimeException); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir private: 212*cdf0e10cSrcweir typedef ::std::map<css::uno::Reference<css::frame::XFrame>,rtl::Reference<PresenterController> > InstanceContainer; 213*cdf0e10cSrcweir static InstanceContainer maInstances; 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 216*cdf0e10cSrcweir css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas; 217*cdf0e10cSrcweir css::uno::Reference<css::frame::XController> mxController; 218*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XConfigurationController> 219*cdf0e10cSrcweir mxConfigurationController; 220*cdf0e10cSrcweir css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController; 221*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId; 222*cdf0e10cSrcweir rtl::Reference<PresenterPaneContainer> mpPaneContainer; 223*cdf0e10cSrcweir sal_Int32 mnCurrentSlideIndex; 224*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide; 225*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> mxNextSlide; 226*cdf0e10cSrcweir ::rtl::Reference<PresenterWindowManager> mpWindowManager; 227*cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaneAnimator> mpCurrentPaneAnimation; 228*cdf0e10cSrcweir sal_Int32 mnWindowBackgroundColor; 229*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTheme> mpTheme; 230*cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxMainWindow; 231*cdf0e10cSrcweir ::rtl::Reference<PresenterPaneBorderPainter> mpPaneBorderPainter; 232*cdf0e10cSrcweir ::boost::shared_ptr<PresenterAnimator> mpAnimator; 233*cdf0e10cSrcweir ::boost::shared_ptr<PresenterCanvasHelper> mpCanvasHelper; 234*cdf0e10cSrcweir css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; 235*cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaintManager> mpPaintManager; 236*cdf0e10cSrcweir sal_Int32 mnPendingSlideNumber; 237*cdf0e10cSrcweir css::uno::Reference<css::util::XURLTransformer> mxUrlTransformer; 238*cdf0e10cSrcweir ::rtl::Reference<PresenterAccessible> mpAccessibleObject; 239*cdf0e10cSrcweir bool mbIsAccessibilityActive; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir void InitializePresenterScreen (void); 242*cdf0e10cSrcweir void InitializeSlideShowView (const css::uno::Reference<css::uno::XInterface>& rxView); 243*cdf0e10cSrcweir void GetSlides (const sal_Int32 nOffset); 244*cdf0e10cSrcweir void UpdateViews (void); 245*cdf0e10cSrcweir void InitializeMainPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane); 246*cdf0e10cSrcweir void LoadTheme (const css::uno::Reference<css::drawing::framework::XPane>& rxPane); 247*cdf0e10cSrcweir void UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir /** This method is called when the user pressed one of the numerical 250*cdf0e10cSrcweir keys. Depending on the modifier, numeric keys switch to another 251*cdf0e10cSrcweir slide (no modifier), or change to another view (Ctrl modifier). 252*cdf0e10cSrcweir @param nKey 253*cdf0e10cSrcweir Numeric value that is printed on the pressed key. For example 254*cdf0e10cSrcweir pressing the key '4' will result in the value 4, not the ASCII 255*cdf0e10cSrcweir code (0x34?). 256*cdf0e10cSrcweir @param nModifiers 257*cdf0e10cSrcweir The modifier bit field as provided by the key up event. 258*cdf0e10cSrcweir */ 259*cdf0e10cSrcweir void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException); 262*cdf0e10cSrcweir }; 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir } } // end of namespace ::sdext::presenter 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir #endif 268