xref: /AOO41X/main/forms/source/component/ImageButton.hxx (revision 2d785d7ea953737df3731803a26e291d82066c5a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _FRM_IMAGE_BUTTON_HXX_
25 #define _FRM_IMAGE_BUTTON_HXX_
26 
27 #include "clickableimage.hxx"
28 #include <com/sun/star/awt/XMouseListener.hpp>
29 
30 //.........................................................................
31 namespace frm
32 {
33 //.........................................................................
34 
35 //==================================================================
36 // OImageButtonModel
37 //==================================================================
38 class OImageButtonModel
39         :public OClickableImageBaseModel
40 {
41 public:
42     DECLARE_DEFAULT_LEAF_XTOR( OImageButtonModel );
43 
44 // ::com::sun::star::lang::XServiceInfo
45     IMPLEMENTATION_NAME(OImageButtonModel);
46     virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
47 
48 // ::com::sun::star::io::XPersistObject
49     virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
50     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);
51     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);
52 
53     // OControlModel's property handling
54     virtual void describeFixedProperties(
55         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
56     ) const;
57 
58 protected:
59     DECLARE_XCLONEABLE();
60 };
61 
62 //==================================================================
63 // OImageButtonControl
64 //==================================================================
65 typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XMouseListener> OImageButtonControl_BASE;
66 class OImageButtonControl : public OClickableImageBaseControl,
67                             public OImageButtonControl_BASE
68 {
69 protected:
70     // UNO Anbindung
71     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
72 
73 public:
74     OImageButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
75 
76     // XServiceInfo
77     IMPLEMENTATION_NAME(OImageButtonControl);
78     virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
79 
80     // UNO Anbindung
81     DECLARE_UNO3_AGG_DEFAULTS(OImageButtonControl, OClickableImageBaseControl);
82     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
83 
84     // XEventListener
disposing(const::com::sun::star::lang::EventObject & _rSource)85     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException)
86         { OControl::disposing(_rSource); }
87 
88     // XMouseListener
89     virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
90     virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
91     virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
92     virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
93 
94     // prevent method hiding
95     using OClickableImageBaseControl::disposing;
96 };
97 
98 //.........................................................................
99 }   // namespace frm
100 //.........................................................................
101 
102 #endif // _FRM_IMAGE_BUTTON_HXX_
103 
104