1*50e6b072SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*50e6b072SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*50e6b072SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*50e6b072SAndrew Rist * distributed with this work for additional information 6*50e6b072SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*50e6b072SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*50e6b072SAndrew Rist * "License"); you may not use this file except in compliance 9*50e6b072SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*50e6b072SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*50e6b072SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*50e6b072SAndrew Rist * software distributed under the License is distributed on an 15*50e6b072SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*50e6b072SAndrew Rist * KIND, either express or implied. See the License for the 17*50e6b072SAndrew Rist * specific language governing permissions and limitations 18*50e6b072SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*50e6b072SAndrew Rist *************************************************************/ 21*50e6b072SAndrew Rist 22*50e6b072SAndrew Rist 23cdf0e10cSrcweir #ifndef TOOLKIT_CONTROLS_TKSPINBUTTON_HXX 24cdf0e10cSrcweir #define TOOLKIT_CONTROLS_TKSPINBUTTON_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx> 27cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx> 28cdf0e10cSrcweir #include <toolkit/controls/unocontrolbase.hxx> 29cdf0e10cSrcweir #include <toolkit/helper/macros.hxx> 30cdf0e10cSrcweir #include <com/sun/star/awt/XSpinValue.hpp> 31cdf0e10cSrcweir #include <com/sun/star/awt/XAdjustmentListener.hpp> 32cdf0e10cSrcweir #include <comphelper/uno3.hxx> 33cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir //........................................................................ 36cdf0e10cSrcweir namespace toolkit 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //........................................................................ 39cdf0e10cSrcweir 40cdf0e10cSrcweir //==================================================================== 41cdf0e10cSrcweir //= UnoSpinButtonModel 42cdf0e10cSrcweir //==================================================================== 43cdf0e10cSrcweir class UnoSpinButtonModel : public UnoControlModel 44cdf0e10cSrcweir { 45cdf0e10cSrcweir protected: 46cdf0e10cSrcweir ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 47cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 48cdf0e10cSrcweir 49cdf0e10cSrcweir public: 50cdf0e10cSrcweir UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); UnoSpinButtonModel(const UnoSpinButtonModel & rModel)51cdf0e10cSrcweir UnoSpinButtonModel( const UnoSpinButtonModel& rModel ) : UnoControlModel( rModel ) {;} 52cdf0e10cSrcweir Clone() const53cdf0e10cSrcweir UnoControlModel* Clone() const { return new UnoSpinButtonModel( *this ); } 54cdf0e10cSrcweir 55cdf0e10cSrcweir // XMultiPropertySet 56cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 57cdf0e10cSrcweir 58cdf0e10cSrcweir // XPersistObject 59cdf0e10cSrcweir ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 60cdf0e10cSrcweir 61cdf0e10cSrcweir // XServiceInfo 62cdf0e10cSrcweir ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 63cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 64cdf0e10cSrcweir }; 65cdf0e10cSrcweir 66cdf0e10cSrcweir //==================================================================== 67cdf0e10cSrcweir //= UnoSpinButtonControl 68cdf0e10cSrcweir //==================================================================== 69cdf0e10cSrcweir 70cdf0e10cSrcweir typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XAdjustmentListener 71cdf0e10cSrcweir , ::com::sun::star::awt::XSpinValue 72cdf0e10cSrcweir > UnoSpinButtonControl_Base; 73cdf0e10cSrcweir 74cdf0e10cSrcweir class UnoSpinButtonControl :public UnoControlBase 75cdf0e10cSrcweir ,public UnoSpinButtonControl_Base 76cdf0e10cSrcweir { 77cdf0e10cSrcweir private: 78cdf0e10cSrcweir AdjustmentListenerMultiplexer maAdjustmentListeners; 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir UnoSpinButtonControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 82cdf0e10cSrcweir ::rtl::OUString GetComponentServiceName(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir DECLARE_UNO3_AGG_DEFAULTS( UnoSpinButtonControl, UnoControlBase ); 85cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir 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)88cdf0e10cSrcweir void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } 89cdf0e10cSrcweir void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XTypeProvider 92cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XAdjustmentListener 95cdf0e10cSrcweir void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // XSpinValue 98cdf0e10cSrcweir virtual void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir virtual void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual void SAL_CALL setValue( sal_Int32 value ) throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getValue( ) throw (::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir virtual void SAL_CALL setMinimum( sal_Int32 minValue ) throw (::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir virtual void SAL_CALL setMaximum( sal_Int32 maxValue ) throw (::com::sun::star::uno::RuntimeException); 105cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getMinimum( ) throw (::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getMaximum( ) throw (::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir virtual void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) throw (::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSpinIncrement( ) throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getOrientation( ) throw (::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // XServiceInfo 113cdf0e10cSrcweir ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir }; 116cdf0e10cSrcweir 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir //........................................................................ 120cdf0e10cSrcweir } // namespacetoolkit 121cdf0e10cSrcweir //........................................................................ 122cdf0e10cSrcweir 123cdf0e10cSrcweir #endif // TOOLKIT_CONTROLS_TKSPINBUTTON_HXX 124