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_BUTTON_HXX 29*cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_BUTTON_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterBitmapContainer.hxx" 32*cdf0e10cSrcweir #include "PresenterTheme.hxx" 33*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseMotionListener.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/rendering/XBitmap.hpp> 41*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 42*cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx> 43*cdf0e10cSrcweir #include <boost/noncopyable.hpp> 44*cdf0e10cSrcweir #include <rtl/ref.hxx> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir namespace css = ::com::sun::star; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir namespace sdext { namespace presenter { 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir class PresenterController; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace { 53*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4 < 54*cdf0e10cSrcweir css::awt::XWindowListener, 55*cdf0e10cSrcweir css::awt::XPaintListener, 56*cdf0e10cSrcweir css::awt::XMouseListener, 57*cdf0e10cSrcweir css::awt::XMouseMotionListener 58*cdf0e10cSrcweir > PresenterButtonInterfaceBase; 59*cdf0e10cSrcweir } 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir /** Button for the presenter screen. It displays a text surrounded by a 62*cdf0e10cSrcweir frame. 63*cdf0e10cSrcweir */ 64*cdf0e10cSrcweir class PresenterButton 65*cdf0e10cSrcweir : private ::boost::noncopyable, 66*cdf0e10cSrcweir private ::cppu::BaseMutex, 67*cdf0e10cSrcweir public PresenterButtonInterfaceBase 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir public: 70*cdf0e10cSrcweir static ::rtl::Reference<PresenterButton> Create ( 71*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, 72*cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController, 73*cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTheme>& rpTheme, 74*cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxParentWindow, 75*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, 76*cdf0e10cSrcweir const ::rtl::OUString& rsConfigurationName); 77*cdf0e10cSrcweir ~PresenterButton (void); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir void SetCenter (const css::geometry::RealPoint2D& rLocation); 82*cdf0e10cSrcweir void SetCanvas ( 83*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, 84*cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxParentWindow); 85*cdf0e10cSrcweir css::geometry::IntegerSize2D GetSize (void); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // XWindowListener 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 90*cdf0e10cSrcweir throw (css::uno::RuntimeException); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 93*cdf0e10cSrcweir throw (css::uno::RuntimeException); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 96*cdf0e10cSrcweir throw (css::uno::RuntimeException); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 99*cdf0e10cSrcweir throw (css::uno::RuntimeException); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // XPaintListener 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 105*cdf0e10cSrcweir throw (css::uno::RuntimeException); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // XMouseListener 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 111*cdf0e10cSrcweir throw(css::uno::RuntimeException); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) 114*cdf0e10cSrcweir throw(css::uno::RuntimeException); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) 117*cdf0e10cSrcweir throw(css::uno::RuntimeException); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 120*cdf0e10cSrcweir throw(css::uno::RuntimeException); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // XMouseMotionListener 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 126*cdf0e10cSrcweir throw (css::uno::RuntimeException); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 129*cdf0e10cSrcweir throw (css::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir // lang::XEventListener 133*cdf0e10cSrcweir virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 134*cdf0e10cSrcweir throw (css::uno::RuntimeException); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir private: 137*cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 138*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTheme> mpTheme; 139*cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxWindow; 140*cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> mxCanvas; 141*cdf0e10cSrcweir css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; 142*cdf0e10cSrcweir const ::rtl::OUString msText; 143*cdf0e10cSrcweir const PresenterTheme::SharedFontDescriptor mpFont; 144*cdf0e10cSrcweir const PresenterTheme::SharedFontDescriptor mpMouseOverFont; 145*cdf0e10cSrcweir const ::rtl::OUString msAction; 146*cdf0e10cSrcweir css::geometry::RealPoint2D maCenter; 147*cdf0e10cSrcweir css::geometry::IntegerSize2D maButtonSize; 148*cdf0e10cSrcweir PresenterBitmapDescriptor::Mode meState; 149*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> mxNormalBitmap; 150*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> mxMouseOverBitmap; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir PresenterButton ( 153*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, 154*cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController, 155*cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTheme>& rpTheme, 156*cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxParentWindow, 157*cdf0e10cSrcweir const PresenterTheme::SharedFontDescriptor& rFont, 158*cdf0e10cSrcweir const PresenterTheme::SharedFontDescriptor& rMouseOverFont, 159*cdf0e10cSrcweir const ::rtl::OUString& rxText, 160*cdf0e10cSrcweir const ::rtl::OUString& rxAction); 161*cdf0e10cSrcweir void RenderButton ( 162*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 163*cdf0e10cSrcweir const css::geometry::IntegerSize2D& rSize, 164*cdf0e10cSrcweir const PresenterTheme::SharedFontDescriptor& rFont, 165*cdf0e10cSrcweir const PresenterBitmapDescriptor::Mode eMode, 166*cdf0e10cSrcweir const SharedBitmapDescriptor& rpLeft, 167*cdf0e10cSrcweir const SharedBitmapDescriptor& rpCenter, 168*cdf0e10cSrcweir const SharedBitmapDescriptor& rpRight); 169*cdf0e10cSrcweir css::geometry::IntegerSize2D CalculateButtonSize (void); 170*cdf0e10cSrcweir void Invalidate (void); 171*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> GetBitmap ( 172*cdf0e10cSrcweir const SharedBitmapDescriptor& mpIcon, 173*cdf0e10cSrcweir const PresenterBitmapDescriptor::Mode eMode); 174*cdf0e10cSrcweir void SetupButtonBitmaps (void); 175*cdf0e10cSrcweir static css::uno::Reference<css::beans::XPropertySet> GetConfigurationProperties ( 176*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, 177*cdf0e10cSrcweir const ::rtl::OUString& rsConfgurationName); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir void ThrowIfDisposed (void) const 180*cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException); 181*cdf0e10cSrcweir }; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir } } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir #endif 186