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_SLIDE_SHOW_VIEW_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "PresenterViewFactory.hxx" 28cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowView.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp> 30cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp> 31cdf0e10cSrcweir #include <com/sun/star/awt/XMouseMotionListener.hpp> 32cdf0e10cSrcweir #include <com/sun/star/awt/XPointer.hpp> 33cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp> 34cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 35cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 36cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceId.hpp> 37cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp> 38cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 39cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowController.hpp> 40cdf0e10cSrcweir #include <com/sun/star/rendering/XPolyPolygon2D.hpp> 41cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 42cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp> 43cdf0e10cSrcweir #include <cppuhelper/compbase7.hxx> 44cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 45cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 46cdf0e10cSrcweir #include <boost/noncopyable.hpp> 47cdf0e10cSrcweir 48cdf0e10cSrcweir namespace css = ::com::sun::star; 49cdf0e10cSrcweir 50cdf0e10cSrcweir namespace sdext { namespace presenter { 51cdf0e10cSrcweir 52cdf0e10cSrcweir namespace { 53cdf0e10cSrcweir typedef cppu::WeakComponentImplHelper7< 54cdf0e10cSrcweir css::presentation::XSlideShowView, 55cdf0e10cSrcweir css::awt::XPaintListener, 56cdf0e10cSrcweir css::awt::XMouseListener, 57cdf0e10cSrcweir css::awt::XMouseMotionListener, 58cdf0e10cSrcweir css::awt::XWindowListener, 59cdf0e10cSrcweir css::drawing::framework::XView, 60cdf0e10cSrcweir css::drawing::XDrawView 61cdf0e10cSrcweir > PresenterSlideShowViewInterfaceBase; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir /** Life view in a secondary windo of a full screen slide show. 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir class PresenterSlideShowView 67cdf0e10cSrcweir : private ::boost::noncopyable, 68cdf0e10cSrcweir protected ::cppu::BaseMutex, 69cdf0e10cSrcweir public PresenterSlideShowViewInterfaceBase, 70cdf0e10cSrcweir public CachablePresenterView 71cdf0e10cSrcweir { 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir PresenterSlideShowView ( 74cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 75cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 76cdf0e10cSrcweir const css::uno::Reference<css::frame::XController>& rxController, 77cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 78cdf0e10cSrcweir virtual ~PresenterSlideShowView (void); 79cdf0e10cSrcweir 80cdf0e10cSrcweir void LateInit (void); 81cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir // CachablePresenterView 85cdf0e10cSrcweir 86cdf0e10cSrcweir virtual void ReleaseView (void); 87cdf0e10cSrcweir 88cdf0e10cSrcweir 89cdf0e10cSrcweir // XSlideShowView 90cdf0e10cSrcweir 91cdf0e10cSrcweir virtual css::uno::Reference< 92cdf0e10cSrcweir css::rendering::XSpriteCanvas > SAL_CALL getCanvas (void) 93cdf0e10cSrcweir throw (css::uno::RuntimeException); 94cdf0e10cSrcweir 95cdf0e10cSrcweir virtual void SAL_CALL clear (void) 96cdf0e10cSrcweir throw (css::uno::RuntimeException); 97cdf0e10cSrcweir 98cdf0e10cSrcweir virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation (void) 99cdf0e10cSrcweir throw (css::uno::RuntimeException); 100cdf0e10cSrcweir 101cdf0e10cSrcweir virtual void SAL_CALL addTransformationChangedListener( 102cdf0e10cSrcweir const css::uno::Reference< 103cdf0e10cSrcweir css::util::XModifyListener >& xListener) 104cdf0e10cSrcweir throw (css::uno::RuntimeException); 105cdf0e10cSrcweir 106cdf0e10cSrcweir virtual void SAL_CALL removeTransformationChangedListener( 107cdf0e10cSrcweir const css::uno::Reference< 108cdf0e10cSrcweir css::util::XModifyListener >& xListener) 109cdf0e10cSrcweir throw (css::uno::RuntimeException); 110cdf0e10cSrcweir 111cdf0e10cSrcweir virtual void SAL_CALL addPaintListener( 112cdf0e10cSrcweir const css::uno::Reference< 113cdf0e10cSrcweir css::awt::XPaintListener >& xListener) 114cdf0e10cSrcweir throw (css::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual void SAL_CALL removePaintListener( 117cdf0e10cSrcweir const css::uno::Reference< 118cdf0e10cSrcweir css::awt::XPaintListener >& xListener) 119cdf0e10cSrcweir throw (css::uno::RuntimeException); 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual void SAL_CALL addMouseListener( 122cdf0e10cSrcweir const css::uno::Reference< 123cdf0e10cSrcweir css::awt::XMouseListener >& xListener) 124cdf0e10cSrcweir throw (css::uno::RuntimeException); 125cdf0e10cSrcweir 126cdf0e10cSrcweir virtual void SAL_CALL removeMouseListener( 127cdf0e10cSrcweir const css::uno::Reference< 128cdf0e10cSrcweir css::awt::XMouseListener >& xListener) 129cdf0e10cSrcweir throw (css::uno::RuntimeException); 130cdf0e10cSrcweir 131cdf0e10cSrcweir virtual void SAL_CALL addMouseMotionListener( 132cdf0e10cSrcweir const css::uno::Reference< 133cdf0e10cSrcweir css::awt::XMouseMotionListener >& xListener) 134cdf0e10cSrcweir throw (css::uno::RuntimeException); 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual void SAL_CALL removeMouseMotionListener( 137cdf0e10cSrcweir const css::uno::Reference< 138cdf0e10cSrcweir css::awt::XMouseMotionListener >& xListener) 139cdf0e10cSrcweir throw (css::uno::RuntimeException); 140cdf0e10cSrcweir 141cdf0e10cSrcweir virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape) 142cdf0e10cSrcweir throw (css::uno::RuntimeException); 143cdf0e10cSrcweir 144cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) 145cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 146cdf0e10cSrcweir 147cdf0e10cSrcweir // lang::XEventListener 148cdf0e10cSrcweir virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 149cdf0e10cSrcweir throw (css::uno::RuntimeException); 150cdf0e10cSrcweir 151cdf0e10cSrcweir 152cdf0e10cSrcweir // XPaintListener 153cdf0e10cSrcweir virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 154cdf0e10cSrcweir throw (css::uno::RuntimeException); 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir // XMouseListener 158cdf0e10cSrcweir virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 159cdf0e10cSrcweir throw (css::uno::RuntimeException); 160cdf0e10cSrcweir 161cdf0e10cSrcweir virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) 162cdf0e10cSrcweir throw (css::uno::RuntimeException); 163cdf0e10cSrcweir 164cdf0e10cSrcweir virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) 165cdf0e10cSrcweir throw (css::uno::RuntimeException); 166cdf0e10cSrcweir 167cdf0e10cSrcweir virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 168cdf0e10cSrcweir throw (css::uno::RuntimeException); 169cdf0e10cSrcweir 170cdf0e10cSrcweir 171cdf0e10cSrcweir // XMouseMotionListener 172cdf0e10cSrcweir 173cdf0e10cSrcweir virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 174cdf0e10cSrcweir throw (css::uno::RuntimeException); 175cdf0e10cSrcweir 176cdf0e10cSrcweir virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 177cdf0e10cSrcweir throw (css::uno::RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir 180cdf0e10cSrcweir // XWindowListener 181cdf0e10cSrcweir 182cdf0e10cSrcweir virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 183cdf0e10cSrcweir throw (css::uno::RuntimeException); 184cdf0e10cSrcweir 185cdf0e10cSrcweir virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 186cdf0e10cSrcweir throw (css::uno::RuntimeException); 187cdf0e10cSrcweir 188cdf0e10cSrcweir virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 189cdf0e10cSrcweir throw (css::uno::RuntimeException); 190cdf0e10cSrcweir 191cdf0e10cSrcweir virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 192cdf0e10cSrcweir throw (css::uno::RuntimeException); 193cdf0e10cSrcweir 194cdf0e10cSrcweir 195cdf0e10cSrcweir // XView 196cdf0e10cSrcweir 197cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL 198cdf0e10cSrcweir getResourceId (void) 199cdf0e10cSrcweir throw(css::uno::RuntimeException); 200cdf0e10cSrcweir 201cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAnchorOnly (void) 202cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 203cdf0e10cSrcweir 204cdf0e10cSrcweir 205cdf0e10cSrcweir // XDrawView 206cdf0e10cSrcweir 207cdf0e10cSrcweir virtual void SAL_CALL setCurrentPage ( 208cdf0e10cSrcweir const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) 209cdf0e10cSrcweir throw (css::uno::RuntimeException); 210cdf0e10cSrcweir 211cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void) 212cdf0e10cSrcweir throw (css::uno::RuntimeException); 213cdf0e10cSrcweir 214cdf0e10cSrcweir 215cdf0e10cSrcweir // CachablePresenterView 216cdf0e10cSrcweir 217cdf0e10cSrcweir virtual void ActivatePresenterView (void); 218cdf0e10cSrcweir 219cdf0e10cSrcweir virtual void DeactivatePresenterView (void); 220cdf0e10cSrcweir 221cdf0e10cSrcweir private: 222cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 223cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 224cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 225cdf0e10cSrcweir css::uno::Reference<css::frame::XController> mxController; 226cdf0e10cSrcweir css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController; 227cdf0e10cSrcweir css::uno::Reference<css::presentation::XSlideShow> mxSlideShow; 228cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> mxCanvas; 229cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> mxViewCanvas; 230cdf0e10cSrcweir css::uno::Reference<css::awt::XPointer> mxPointer; 231cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxWindow; 232cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxViewWindow; 233cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XPane> mxTopPane; 234cdf0e10cSrcweir css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; 235cdf0e10cSrcweir css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1; 236cdf0e10cSrcweir css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2; 237cdf0e10cSrcweir bool mbIsViewAdded; 238cdf0e10cSrcweir 239cdf0e10cSrcweir /** Aspect ratio of the current slide. 240cdf0e10cSrcweir */ 241cdf0e10cSrcweir double mnPageAspectRatio; 242cdf0e10cSrcweir 243cdf0e10cSrcweir /** This broadcast helper is used to notify listeners registed to a 244cdf0e10cSrcweir SlideShowView object. 245cdf0e10cSrcweir */ 246cdf0e10cSrcweir ::cppu::OBroadcastHelper maBroadcaster; 247cdf0e10cSrcweir 248cdf0e10cSrcweir SharedBitmapDescriptor mpBackground; 249cdf0e10cSrcweir 250cdf0e10cSrcweir bool mbIsInModifyNotification; 251cdf0e10cSrcweir bool mbIsForcedPaintPending; 252cdf0e10cSrcweir bool mbIsPaintPending; 253cdf0e10cSrcweir ::rtl::OUString msClickToExitPresentationText; 254cdf0e10cSrcweir ::rtl::OUString msClickToExitPresentationTitle; 255cdf0e10cSrcweir ::rtl::OUString msTitleTemplate; 256cdf0e10cSrcweir bool mbIsEndSlideVisible; 257cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide; 258cdf0e10cSrcweir 259cdf0e10cSrcweir /** Create the window into which the slide show will render its 260cdf0e10cSrcweir content. This window has the correct aspect ratio and is displayed centered 261cdf0e10cSrcweir and as large as possible in its parent window. 262cdf0e10cSrcweir */ 263cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> CreateViewWindow ( 264cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxParentWindow) const; 265cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> CreateViewCanvas ( 266cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxWindow) const; 267cdf0e10cSrcweir 268cdf0e10cSrcweir void Resize (void); 269cdf0e10cSrcweir 270cdf0e10cSrcweir void PaintOuterWindow (const css::awt::Rectangle& rRepaintBox); 271cdf0e10cSrcweir void PaintInnerWindow (const css::awt::PaintEvent& rEvent); 272cdf0e10cSrcweir void PaintEndSlide (const css::awt::Rectangle& rRepaintBox); 273cdf0e10cSrcweir 274cdf0e10cSrcweir /** The slide show relies on the back buffer of the canvas not being 275cdf0e10cSrcweir modified. With a shared canvas there are times when that can not be 276cdf0e10cSrcweir guaranteed. 277cdf0e10cSrcweir Call this method when the back buffer may have changed its content, 278cdf0e10cSrcweir like when the window has been moved but not resized. 279cdf0e10cSrcweir */ 280cdf0e10cSrcweir void ForceRepaint (void); 281cdf0e10cSrcweir 282cdf0e10cSrcweir void CreateBackgroundPolygons (void); 283cdf0e10cSrcweir 284cdf0e10cSrcweir /** This method throws a DisposedException when the object has already been 285cdf0e10cSrcweir disposed. 286cdf0e10cSrcweir */ 287cdf0e10cSrcweir void ThrowIfDisposed (void) 288cdf0e10cSrcweir throw (css::lang::DisposedException); 289cdf0e10cSrcweir }; 290cdf0e10cSrcweir 291cdf0e10cSrcweir } } // end of namespace ::sd::presenter 292cdf0e10cSrcweir 293cdf0e10cSrcweir #endif 294