Files
libreoffice/sdext/source/presenter/PresenterToolBar.hxx

222 lines
7.6 KiB
C++
Raw Normal View History

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: PresenterToolBar.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: kz $ $Date: 2008-04-03 16:06:39 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef SDEXT_PRESENTER_TOOL_BAR_HXX
#define SDEXT_PRESENTER_TOOL_BAR_HXX
#include "PresenterController.hxx"
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase6.hxx>
#include <com/sun/star/awt/ActionEvent.hpp>
#include <com/sun/star/awt/XActionListener.hpp>
#include <com/sun/star/awt/XButton.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XFixedText.hpp>
#include <com/sun/star/awt/XMouseListener.hpp>
#include <com/sun/star/awt/XMouseMotionListener.hpp>
#include <com/sun/star/awt/XPaintListener.hpp>
#include <com/sun/star/awt/XWindowListener.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XPresenterHelper.hpp>
#include <com/sun/star/drawing/framework/XView.hpp>
#include <com/sun/star/drawing/framework/XResourceId.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <boost/scoped_ptr.hpp>
namespace css = ::com::sun::star;
namespace {
typedef cppu::WeakComponentImplHelper6<
css::awt::XWindowListener,
css::awt::XPaintListener,
css::awt::XMouseListener,
css::awt::XMouseMotionListener,
css::drawing::framework::XView,
css::drawing::XDrawView
> PresenterToolBarInterfaceBase;
}
namespace sdext { namespace presenter {
class PresenterBitmapContainer;
/** A simple tool bar that can display bitmapped buttons and labels. At the
moment there are buttons for moving to the next and previous slide and
to the next effect. A label displayes the index of the current slide
and the total number of slides.
In the future this set of controls may be extended. Declaration of the
control set could be made more flexible and more easy (e.g. via the
configuration to avoid the need to recompile this class.)
*/
class PresenterToolBar
: private ::cppu::BaseMutex,
public PresenterToolBarInterfaceBase
{
public:
explicit PresenterToolBar (
const css::uno::Reference<css::uno::XComponentContext>& rxContext,
const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
const css::uno::Reference<css::frame::XController>& rxController,
const ::rtl::Reference<PresenterController>& rpPresenterController);
virtual ~PresenterToolBar (void);
virtual void SAL_CALL disposing (void);
// lang::XEventListener
virtual void SAL_CALL
disposing (const css::lang::EventObject& rEventObject)
throw (css::uno::RuntimeException);
// XWindowListener
virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
throw (css::uno::RuntimeException);
// XPaintListener
virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
throw (css::uno::RuntimeException);
// XMouseListener
virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
// XMouseMotionListener
virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException);
// XResourceId
virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL isAnchorOnly (void)
throw (com::sun::star::uno::RuntimeException);
// XDrawView
virtual void SAL_CALL setCurrentPage (
const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
throw (css::uno::RuntimeException);
virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
throw (css::uno::RuntimeException);
class Element;
private:
css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
css::uno::Reference<css::drawing::framework::XPane> mxPane;
css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
css::uno::Reference<css::rendering::XCanvas> mxCanvas;
typedef ::std::vector<boost::shared_ptr<Element> > ElementContainer;
ElementContainer maElementContainer;
css::uno::Reference<css::awt::XWindow> mxWindow;
css::uno::Reference<css::awt::XWindow> mxControl;
css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
::rtl::Reference<PresenterController> mpPresenterController;
::rtl::OUString msPreviousButtonBitmapURL;
::rtl::OUString msNextButtonBitmapURL;
::boost::scoped_ptr<PresenterBitmapContainer> mpIconContainer;
void CreateControls (void);
void Resize (void);
void Clear (
const css::awt::Rectangle& rUpdateBox,
const css::rendering::ViewState& rViewState);
void Paint (
const css::awt::Rectangle& rUpdateBox,
const css::rendering::ViewState& rViewState);
void UpdateSlideNumber (void);
void CheckMouseOver (
const css::awt::MouseEvent& rEvent,
const bool bOverWindow,
const bool bMouseDown=false);
void GotoPreviousSlide (void);
void GotoNextSlide (void);
void GotoNextEffect (void);
/** This method throws a DisposedException when the object has already been
disposed.
*/
void ThrowIfDisposed (void) const
throw (css::lang::DisposedException);
};
} } // end of namespace ::sdext::presenter
#endif