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_PRESENTER_SLIDE_SORTER_HXX 29*cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_SLIDE_SORTER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterController.hxx" 32*cdf0e10cSrcweir #include "PresenterPaneContainer.hxx" 33*cdf0e10cSrcweir #include "PresenterViewFactory.hxx" 34*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 35*cdf0e10cSrcweir #include <cppuhelper/compbase8.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/drawing/XSlidePreviewCache.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceId.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/geometry/RealRectangle2D.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/rendering/XPolyPolygon2D.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/rendering/XSprite.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir namespace css = ::com::sun::star; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace { 52*cdf0e10cSrcweir typedef cppu::WeakComponentImplHelper8< 53*cdf0e10cSrcweir css::drawing::framework::XView, 54*cdf0e10cSrcweir css::awt::XWindowListener, 55*cdf0e10cSrcweir css::awt::XPaintListener, 56*cdf0e10cSrcweir css::beans::XPropertyChangeListener, 57*cdf0e10cSrcweir css::drawing::XSlidePreviewCacheListener, 58*cdf0e10cSrcweir css::awt::XMouseListener, 59*cdf0e10cSrcweir css::awt::XMouseMotionListener, 60*cdf0e10cSrcweir css::drawing::XDrawView 61*cdf0e10cSrcweir > PresenterSlideSorterInterfaceBase; 62*cdf0e10cSrcweir } 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir namespace sdext { namespace presenter { 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir class PresenterButton; 67*cdf0e10cSrcweir class PresenterScrollBar; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir /** A simple slide sorter for the presenter screen. It uses a preview cache 70*cdf0e10cSrcweir to create the slide previews. Painting is done via a canvas. 71*cdf0e10cSrcweir */ 72*cdf0e10cSrcweir class PresenterSlideSorter 73*cdf0e10cSrcweir : private ::cppu::BaseMutex, 74*cdf0e10cSrcweir public PresenterSlideSorterInterfaceBase, 75*cdf0e10cSrcweir public CachablePresenterView 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir public: 78*cdf0e10cSrcweir PresenterSlideSorter ( 79*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 80*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 81*cdf0e10cSrcweir const css::uno::Reference<css::frame::XController>& rxController, 82*cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 83*cdf0e10cSrcweir virtual ~PresenterSlideSorter (void); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir void SetActiveState (const bool bIsActive); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // lang::XEventListener 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual void SAL_CALL 93*cdf0e10cSrcweir disposing (const css::lang::EventObject& rEventObject) 94*cdf0e10cSrcweir throw (css::uno::RuntimeException); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // XWindowListener 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 100*cdf0e10cSrcweir throw (css::uno::RuntimeException); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 103*cdf0e10cSrcweir throw (css::uno::RuntimeException); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 106*cdf0e10cSrcweir throw (css::uno::RuntimeException); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 109*cdf0e10cSrcweir throw (css::uno::RuntimeException); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir // XPaintListener 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 115*cdf0e10cSrcweir throw (css::uno::RuntimeException); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir // XMouseListener 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 121*cdf0e10cSrcweir throw(css::uno::RuntimeException); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) 124*cdf0e10cSrcweir throw(css::uno::RuntimeException); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) 127*cdf0e10cSrcweir throw(css::uno::RuntimeException); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 130*cdf0e10cSrcweir throw(css::uno::RuntimeException); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir // XMouseMotionListener 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 136*cdf0e10cSrcweir throw (css::uno::RuntimeException); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 139*cdf0e10cSrcweir throw (css::uno::RuntimeException); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // XResourceId 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void) 145*cdf0e10cSrcweir throw (css::uno::RuntimeException); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAnchorOnly (void) 148*cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir // XPropertyChangeListener 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir virtual void SAL_CALL propertyChange ( 154*cdf0e10cSrcweir const css::beans::PropertyChangeEvent& rEvent) 155*cdf0e10cSrcweir throw(css::uno::RuntimeException); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // XSlidePreviewCacheListener 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir virtual void SAL_CALL notifyPreviewCreation ( 161*cdf0e10cSrcweir sal_Int32 nSlideIndex) 162*cdf0e10cSrcweir throw(css::uno::RuntimeException); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir // XDrawView 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir virtual void SAL_CALL setCurrentPage ( 168*cdf0e10cSrcweir const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) 169*cdf0e10cSrcweir throw (css::uno::RuntimeException); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void) 172*cdf0e10cSrcweir throw (css::uno::RuntimeException); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir private: 175*cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 176*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 177*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XPane> mxPane; 178*cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> mxCanvas; 179*cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxWindow; 180*cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 181*cdf0e10cSrcweir css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController; 182*cdf0e10cSrcweir css::uno::Reference<css::drawing::XSlidePreviewCache> mxPreviewCache; 183*cdf0e10cSrcweir bool mbIsPaintPending; 184*cdf0e10cSrcweir bool mbIsLayoutPending; 185*cdf0e10cSrcweir class Layout; 186*cdf0e10cSrcweir ::boost::shared_ptr<Layout> mpLayout; 187*cdf0e10cSrcweir ::rtl::Reference<PresenterScrollBar> mpHorizontalScrollBar; 188*cdf0e10cSrcweir ::rtl::Reference<PresenterScrollBar> mpVerticalScrollBar; 189*cdf0e10cSrcweir ::rtl::Reference<PresenterButton> mpCloseButton; 190*cdf0e10cSrcweir class MouseOverManager; 191*cdf0e10cSrcweir ::boost::scoped_ptr<MouseOverManager> mpMouseOverManager; 192*cdf0e10cSrcweir sal_Int32 mnSlideIndexMousePressed; 193*cdf0e10cSrcweir sal_Int32 mnCurrentSlideIndex; 194*cdf0e10cSrcweir sal_Int32 mnSeparatorY; 195*cdf0e10cSrcweir css::util::Color maSeparatorColor; 196*cdf0e10cSrcweir css::awt::Point maCloseButtonCenter; 197*cdf0e10cSrcweir css::awt::Rectangle maCurrentSlideFrameBoundingBox; 198*cdf0e10cSrcweir class CurrentSlideFrameRenderer; 199*cdf0e10cSrcweir ::boost::shared_ptr<CurrentSlideFrameRenderer> mpCurrentSlideFrameRenderer; 200*cdf0e10cSrcweir css::uno::Reference<css::rendering::XPolyPolygon2D> mxPreviewFrame; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir void UpdateLayout (void); 203*cdf0e10cSrcweir css::geometry::RealRectangle2D PlaceScrollBars ( 204*cdf0e10cSrcweir const css::geometry::RealRectangle2D& rUpperBox); 205*cdf0e10cSrcweir void PlaceCloseButton ( 206*cdf0e10cSrcweir const PresenterPaneContainer::SharedPaneDescriptor& rpPane, 207*cdf0e10cSrcweir const css::awt::Rectangle& rCenterBox, 208*cdf0e10cSrcweir const sal_Int32 nLeftFrameWidth); 209*cdf0e10cSrcweir void ClearBackground ( 210*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 211*cdf0e10cSrcweir const css::awt::Rectangle& rRedrawArea); 212*cdf0e10cSrcweir double GetSlideAspectRatio (void) const; 213*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> GetPreview (const sal_Int32 nSlideIndex); 214*cdf0e10cSrcweir void PaintPreview ( 215*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 216*cdf0e10cSrcweir const css::awt::Rectangle& rUpdateBox, 217*cdf0e10cSrcweir const sal_Int32 nSlideIndex); 218*cdf0e10cSrcweir void Paint (const css::awt::Rectangle& rUpdateBox); 219*cdf0e10cSrcweir void SetHorizontalOffset (const double nXOffset); 220*cdf0e10cSrcweir void SetVerticalOffset (const double nYOffset); 221*cdf0e10cSrcweir void GotoSlide (const sal_Int32 nSlideIndex); 222*cdf0e10cSrcweir bool ProvideCanvas (void); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir /** This method throws a DisposedException when the object has already been 225*cdf0e10cSrcweir disposed. 226*cdf0e10cSrcweir */ 227*cdf0e10cSrcweir void ThrowIfDisposed (void) 228*cdf0e10cSrcweir throw (css::lang::DisposedException); 229*cdf0e10cSrcweir }; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir } } // end of namespace ::sdext::presenter 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir #endif 234