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