xref: /AOO41X/main/toolkit/inc/toolkit/controls/tkspinbutton.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 #ifndef TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
28 #define TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
29 
30 #include <toolkit/controls/unocontrolmodel.hxx>
31 #include <toolkit/helper/servicenames.hxx>
32 #include <toolkit/controls/unocontrolbase.hxx>
33 #include <toolkit/helper/macros.hxx>
34 #include <com/sun/star/awt/XSpinValue.hpp>
35 #include <com/sun/star/awt/XAdjustmentListener.hpp>
36 #include <comphelper/uno3.hxx>
37 #include <cppuhelper/implbase2.hxx>
38 
39 //........................................................................
40 namespace toolkit
41 {
42 //........................................................................
43 
44 	//====================================================================
45 	//= UnoSpinButtonModel
46 	//====================================================================
47     class UnoSpinButtonModel : public UnoControlModel
48     {
49     protected:
50 	    ::com::sun::star::uno::Any		ImplGetDefaultValue( sal_uInt16 nPropId ) const;
51 	    ::cppu::IPropertyArrayHelper&	SAL_CALL getInfoHelper();
52 
53     public:
54 						    UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
55 						    UnoSpinButtonModel( const UnoSpinButtonModel& rModel ) : UnoControlModel( rModel ) {;}
56 
57 	    UnoControlModel*	Clone() const { return new UnoSpinButtonModel( *this ); }
58 
59 	    // XMultiPropertySet
60         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
61 
62 	    // XPersistObject
63         ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
64 
65 	    // XServiceInfo
66         ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
67         ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
68     };
69 
70     //====================================================================
71 	//= UnoSpinButtonControl
72 	//====================================================================
73 
74     typedef ::cppu::ImplHelper2 <   ::com::sun::star::awt::XAdjustmentListener
75                                 ,   ::com::sun::star::awt::XSpinValue
76                                 >   UnoSpinButtonControl_Base;
77 
78     class UnoSpinButtonControl :public UnoControlBase
79 							   ,public UnoSpinButtonControl_Base
80     {
81     private:
82 	    AdjustmentListenerMultiplexer maAdjustmentListeners;
83 
84     public:
85 								    UnoSpinButtonControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
86 	    ::rtl::OUString				GetComponentServiceName();
87 
88         DECLARE_UNO3_AGG_DEFAULTS( UnoSpinButtonControl, UnoControlBase );
89         ::com::sun::star::uno::Any	SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
90 
91         void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
92         void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
93         void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException);
94 
95         // XTypeProvider
96         DECLARE_XTYPEPROVIDER()
97 
98 	    // XAdjustmentListener
99         void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
100 
101 	    // XSpinValue
102         virtual void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
103         virtual void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
104         virtual void SAL_CALL setValue( sal_Int32 value ) throw (::com::sun::star::uno::RuntimeException);
105         virtual void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (::com::sun::star::uno::RuntimeException);
106         virtual sal_Int32 SAL_CALL getValue(  ) throw (::com::sun::star::uno::RuntimeException);
107         virtual void SAL_CALL setMinimum( sal_Int32 minValue ) throw (::com::sun::star::uno::RuntimeException);
108         virtual void SAL_CALL setMaximum( sal_Int32 maxValue ) throw (::com::sun::star::uno::RuntimeException);
109         virtual sal_Int32 SAL_CALL getMinimum(  ) throw (::com::sun::star::uno::RuntimeException);
110         virtual sal_Int32 SAL_CALL getMaximum(  ) throw (::com::sun::star::uno::RuntimeException);
111         virtual void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) throw (::com::sun::star::uno::RuntimeException);
112         virtual sal_Int32 SAL_CALL getSpinIncrement(  ) throw (::com::sun::star::uno::RuntimeException);
113         virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
114         virtual sal_Int32 SAL_CALL getOrientation(  ) throw (::com::sun::star::uno::RuntimeException);
115 
116 	    // XServiceInfo
117         ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
118         ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
119     };
120 
121 
122 
123 //........................................................................
124 } // namespacetoolkit
125 //........................................................................
126 
127 #endif // TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
128