1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _FRM_IMAGE_BUTTON_HXX_
29 #define _FRM_IMAGE_BUTTON_HXX_
30 
31 #include "clickableimage.hxx"
32 #include <com/sun/star/awt/XMouseListener.hpp>
33 
34 //.........................................................................
35 namespace frm
36 {
37 //.........................................................................
38 
39 //==================================================================
40 // OImageButtonModel
41 //==================================================================
42 class OImageButtonModel
43 		:public OClickableImageBaseModel
44 {
45 public:
46 	DECLARE_DEFAULT_LEAF_XTOR( OImageButtonModel );
47 
48 // ::com::sun::star::lang::XServiceInfo
49 	IMPLEMENTATION_NAME(OImageButtonModel);
50 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
51 
52 // ::com::sun::star::io::XPersistObject
53 	virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
54 	virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
55 	virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
56 
57     // OControlModel's property handling
58 	virtual void describeFixedProperties(
59 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
60     ) const;
61 
62 protected:
63 	DECLARE_XCLONEABLE();
64 };
65 
66 //==================================================================
67 // OImageButtonControl
68 //==================================================================
69 typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XMouseListener> OImageButtonControl_BASE;
70 class OImageButtonControl : public OClickableImageBaseControl,
71 							public OImageButtonControl_BASE
72 {
73 protected:
74 	// UNO Anbindung
75 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
76 
77 public:
78 	OImageButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
79 
80     // XServiceInfo
81 	IMPLEMENTATION_NAME(OImageButtonControl);
82 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
83 
84 	// UNO Anbindung
85 	DECLARE_UNO3_AGG_DEFAULTS(OImageButtonControl, OClickableImageBaseControl);
86 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
87 
88     // XEventListener
89 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException)
90 		{ OControl::disposing(_rSource); }
91 
92     // XMouseListener
93 	virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
94 	virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
95 	virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
96 	virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
97 
98     // prevent method hiding
99     using OClickableImageBaseControl::disposing;
100 };
101 
102 //.........................................................................
103 }	// namespace frm
104 //.........................................................................
105 
106 #endif // _FRM_IMAGE_BUTTON_HXX_
107 
108