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_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX 24 #define TOOLKIT_TOOLKIT_CONTROLS_TKSCROLLBAR_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/XScrollBar.hpp> 31 #include <com/sun/star/awt/XAdjustmentListener.hpp> 32 #include <com/sun/star/awt/AdjustmentType.hpp> 33 34 //........................................................................ 35 namespace toolkit 36 { 37 //........................................................................ 38 39 //==================================================================== 40 //= UnoControlScrollBarModel 41 //==================================================================== 42 class UnoControlScrollBarModel : public UnoControlModel 43 { 44 protected: 45 ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 46 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 47 48 public: 49 UnoControlScrollBarModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); UnoControlScrollBarModel(const UnoControlScrollBarModel & rModel)50 UnoControlScrollBarModel( const UnoControlScrollBarModel& rModel ) : UnoControlModel( rModel ) {;} 51 Clone() const52 UnoControlModel* Clone() const { return new UnoControlScrollBarModel( *this ); } 53 54 // ::com::sun::star::beans::XMultiPropertySet 55 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 56 57 // ::com::sun::star::io::XPersistObject 58 ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 59 60 // XServiceInfo 61 DECLIMPL_SERVICEINFO_DERIVED( UnoControlScrollBarModel, UnoControlModel, szServiceName2_UnoControlScrollBarModel ) 62 }; 63 64 //==================================================================== 65 //= UnoControlScrollBarModel 66 //==================================================================== 67 class UnoScrollBarControl : public UnoControlBase, 68 public ::com::sun::star::awt::XAdjustmentListener, 69 public ::com::sun::star::awt::XScrollBar 70 { 71 private: 72 AdjustmentListenerMultiplexer maAdjustmentListeners; 73 74 public: 75 UnoScrollBarControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 76 ::rtl::OUString GetComponentServiceName(); 77 queryInterface(const::com::sun::star::uno::Type & rType)78 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } 79 ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()80 void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } release()81 void SAL_CALL release() throw() { OWeakAggObject::release(); } 82 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)83 void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } 84 void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 85 86 // ::com::sun::star::lang::XTypeProvider 87 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 88 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 89 90 // ::com::sun::star::awt::XAdjustmentListener 91 void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 92 93 // ::com::sun::star::awt::XScrollBar 94 void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException); 95 void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException); 96 void SAL_CALL setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 97 void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException); 98 sal_Int32 SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); 99 void SAL_CALL setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 100 sal_Int32 SAL_CALL getMaximum( ) throw(::com::sun::star::uno::RuntimeException); 101 void SAL_CALL setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 102 sal_Int32 SAL_CALL getLineIncrement( ) throw(::com::sun::star::uno::RuntimeException); 103 void SAL_CALL setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 104 sal_Int32 SAL_CALL getBlockIncrement( ) throw(::com::sun::star::uno::RuntimeException); 105 void SAL_CALL setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 106 sal_Int32 SAL_CALL getVisibleSize( ) throw(::com::sun::star::uno::RuntimeException); 107 void SAL_CALL setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); 108 sal_Int32 SAL_CALL getOrientation( ) throw(::com::sun::star::uno::RuntimeException); 109 110 // ::com::sun::star::lang::XServiceInfo 111 DECLIMPL_SERVICEINFO_DERIVED( UnoScrollBarControl, UnoControlBase, szServiceName2_UnoControlScrollBar ) 112 }; 113 114 115 116 //........................................................................ 117 } // namespacetoolkit 118 //........................................................................ 119 120 #endif // TOOLKIT_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX 121