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