1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b0724fc6SAndrew Rist  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b0724fc6SAndrew Rist  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19*b0724fc6SAndrew Rist  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
26cdf0e10cSrcweir #include "toolkit/controls/tkspinbutton.hxx"
27cdf0e10cSrcweir #include "toolkit/helper/property.hxx"
28cdf0e10cSrcweir #include "toolkit/helper/unopropertyarrayhelper.hxx"
29cdf0e10cSrcweir #include <com/sun/star/awt/ScrollBarOrientation.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //........................................................................
36cdf0e10cSrcweir namespace toolkit
37cdf0e10cSrcweir {
38cdf0e10cSrcweir //........................................................................
39cdf0e10cSrcweir 
40cdf0e10cSrcweir     using namespace ::com::sun::star::uno;
41cdf0e10cSrcweir     using namespace ::com::sun::star::awt;
42cdf0e10cSrcweir     using namespace ::com::sun::star::lang;
43cdf0e10cSrcweir     using namespace ::com::sun::star::beans;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     //====================================================================
46cdf0e10cSrcweir 	//= UnoSpinButtonModel
47cdf0e10cSrcweir 	//====================================================================
48cdf0e10cSrcweir 	//--------------------------------------------------------------------
UnoSpinButtonModel(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & i_factory)49cdf0e10cSrcweir     UnoSpinButtonModel::UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
50cdf0e10cSrcweir         :UnoControlModel( i_factory )
51cdf0e10cSrcweir     {
52cdf0e10cSrcweir 	    ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
53cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_BORDER );
54cdf0e10cSrcweir 		ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
55cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
56cdf0e10cSrcweir 	    ImplRegisterProperty( BASEPROPERTY_ENABLED );
57cdf0e10cSrcweir 	    ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
58cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
59cdf0e10cSrcweir 	    ImplRegisterProperty( BASEPROPERTY_HELPURL );
60cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
61cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
62cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_REPEAT );
63cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_REPEAT_DELAY );
64cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_SYMBOL_COLOR );
65cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_SPINVALUE );
66cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MIN );
67cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MAX );
68cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_SPININCREMENT );
69cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_TABSTOP );
70cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
71cdf0e10cSrcweir         ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	//--------------------------------------------------------------------
getServiceName()75cdf0e10cSrcweir     ::rtl::OUString UnoSpinButtonModel::getServiceName( ) throw (RuntimeException)
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir 	    return ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	//--------------------------------------------------------------------
ImplGetDefaultValue(sal_uInt16 nPropId) const81cdf0e10cSrcweir     Any UnoSpinButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         switch ( nPropId )
84cdf0e10cSrcweir         {
85cdf0e10cSrcweir         case BASEPROPERTY_DEFAULTCONTROL:
86cdf0e10cSrcweir             return makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl ) );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir         case BASEPROPERTY_BORDER:
89cdf0e10cSrcweir             return makeAny( (sal_Int16) 0 );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         case BASEPROPERTY_REPEAT:
92cdf0e10cSrcweir             return makeAny( (sal_Bool)sal_True );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         default:
95cdf0e10cSrcweir     	    return UnoControlModel::ImplGetDefaultValue( nPropId );
96cdf0e10cSrcweir         }
97cdf0e10cSrcweir     }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	//--------------------------------------------------------------------
getInfoHelper()100cdf0e10cSrcweir     ::cppu::IPropertyArrayHelper& UnoSpinButtonModel::getInfoHelper()
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir 	    static UnoPropertyArrayHelper* pHelper = NULL;
103cdf0e10cSrcweir 	    if ( !pHelper )
104cdf0e10cSrcweir 	    {
105cdf0e10cSrcweir 		    Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
106cdf0e10cSrcweir 		    pHelper = new UnoPropertyArrayHelper( aIDs );
107cdf0e10cSrcweir 	    }
108cdf0e10cSrcweir 	    return *pHelper;
109cdf0e10cSrcweir     }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	//--------------------------------------------------------------------
getPropertySetInfo()112cdf0e10cSrcweir     Reference< XPropertySetInfo > UnoSpinButtonModel::getPropertySetInfo(  ) throw(RuntimeException)
113cdf0e10cSrcweir     {
114cdf0e10cSrcweir 	    static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
115cdf0e10cSrcweir 	    return xInfo;
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	//--------------------------------------------------------------------
getImplementationName()119cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UnoSpinButtonModel::getImplementationName(  ) throw(RuntimeException)
120cdf0e10cSrcweir     {
121cdf0e10cSrcweir         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonModel" ) );
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	//--------------------------------------------------------------------
getSupportedServiceNames()125cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonModel::getSupportedServiceNames() throw(RuntimeException)
126cdf0e10cSrcweir     {
127cdf0e10cSrcweir         Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
128cdf0e10cSrcweir         aServices.realloc( aServices.getLength() + 1 );
129cdf0e10cSrcweir         aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
130cdf0e10cSrcweir         return aServices;
131cdf0e10cSrcweir     }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     //====================================================================
134cdf0e10cSrcweir 	//= UnoSpinButtonControl
135cdf0e10cSrcweir 	//====================================================================
136cdf0e10cSrcweir 	//--------------------------------------------------------------------
UnoSpinButtonControl(const Reference<XMultiServiceFactory> & i_factory)137cdf0e10cSrcweir     UnoSpinButtonControl::UnoSpinButtonControl( const Reference< XMultiServiceFactory >& i_factory )
138cdf0e10cSrcweir         :UnoControlBase( i_factory )
139cdf0e10cSrcweir 	    ,maAdjustmentListeners( *this )
140cdf0e10cSrcweir     {
141cdf0e10cSrcweir     }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	//--------------------------------------------------------------------
GetComponentServiceName()144cdf0e10cSrcweir     ::rtl::OUString UnoSpinButtonControl::GetComponentServiceName()
145cdf0e10cSrcweir     {
146cdf0e10cSrcweir 	    return ::rtl::OUString::createFromAscii( "SpinButton" );
147cdf0e10cSrcweir     }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	//--------------------------------------------------------------------
queryAggregation(const Type & rType)150cdf0e10cSrcweir     Any UnoSpinButtonControl::queryAggregation( const Type & rType ) throw(RuntimeException)
151cdf0e10cSrcweir     {
152cdf0e10cSrcweir         Any aRet = UnoControlBase::queryAggregation( rType );
153cdf0e10cSrcweir         if ( !aRet.hasValue() )
154cdf0e10cSrcweir             aRet = UnoSpinButtonControl_Base::queryInterface( rType );
155cdf0e10cSrcweir         return aRet;
156cdf0e10cSrcweir     }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	//--------------------------------------------------------------------
IMPLEMENT_FORWARD_XTYPEPROVIDER2(UnoSpinButtonControl,UnoControlBase,UnoSpinButtonControl_Base)159cdf0e10cSrcweir     IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoSpinButtonControl, UnoControlBase, UnoSpinButtonControl_Base )
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	//--------------------------------------------------------------------
162cdf0e10cSrcweir     void UnoSpinButtonControl::dispose() throw(RuntimeException)
163cdf0e10cSrcweir     {
164cdf0e10cSrcweir         ::osl::ClearableMutexGuard aGuard( GetMutex() );
165cdf0e10cSrcweir         if ( maAdjustmentListeners.getLength() )
166cdf0e10cSrcweir         {
167cdf0e10cSrcweir             Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
168cdf0e10cSrcweir             if ( xSpinnable.is() )
169cdf0e10cSrcweir                 xSpinnable->removeAdjustmentListener( this );
170cdf0e10cSrcweir 
171cdf0e10cSrcweir             EventObject aDisposeEvent;
172cdf0e10cSrcweir 	        aDisposeEvent.Source = *this;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir             aGuard.clear();
175cdf0e10cSrcweir 	        maAdjustmentListeners.disposeAndClear( aDisposeEvent );
176cdf0e10cSrcweir         }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir         UnoControl::dispose();
179cdf0e10cSrcweir     }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	//--------------------------------------------------------------------
getImplementationName()182cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UnoSpinButtonControl::getImplementationName(  ) throw(RuntimeException)
183cdf0e10cSrcweir     {
184cdf0e10cSrcweir         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonControl" ) );
185cdf0e10cSrcweir     }
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	//--------------------------------------------------------------------
getSupportedServiceNames()188cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonControl::getSupportedServiceNames() throw(RuntimeException)
189cdf0e10cSrcweir     {
190cdf0e10cSrcweir         Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
191cdf0e10cSrcweir         aServices.realloc( aServices.getLength() + 1 );
192cdf0e10cSrcweir         aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl );
193cdf0e10cSrcweir         return aServices;
194cdf0e10cSrcweir     }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     //--------------------------------------------------------------------
createPeer(const Reference<XToolkit> & rxToolkit,const Reference<XWindowPeer> & rParentPeer)197cdf0e10cSrcweir     void UnoSpinButtonControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
198cdf0e10cSrcweir     {
199cdf0e10cSrcweir 	    UnoControl::createPeer( rxToolkit, rParentPeer );
200cdf0e10cSrcweir 
201cdf0e10cSrcweir         Reference < XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
202cdf0e10cSrcweir         if ( xSpinnable.is() )
203cdf0e10cSrcweir 	        xSpinnable->addAdjustmentListener( this );
204cdf0e10cSrcweir     }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	//--------------------------------------------------------------------
adjustmentValueChanged(const AdjustmentEvent & rEvent)207cdf0e10cSrcweir     void UnoSpinButtonControl::adjustmentValueChanged( const AdjustmentEvent& rEvent ) throw(RuntimeException)
208cdf0e10cSrcweir     {
209cdf0e10cSrcweir 	    switch ( rEvent.Type )
210cdf0e10cSrcweir 	    {
211cdf0e10cSrcweir 		    case AdjustmentType_ADJUST_LINE:
212cdf0e10cSrcweir 		    case AdjustmentType_ADJUST_PAGE:
213cdf0e10cSrcweir 		    case AdjustmentType_ADJUST_ABS:
214cdf0e10cSrcweir 				ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( rEvent.Value ), sal_False );
215cdf0e10cSrcweir     		    break;
216cdf0e10cSrcweir 		    default:
217cdf0e10cSrcweir                 DBG_ERROR( "UnoSpinButtonControl::adjustmentValueChanged - unknown Type" );
218cdf0e10cSrcweir 	    }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	    if ( maAdjustmentListeners.getLength() )
221cdf0e10cSrcweir         {
222cdf0e10cSrcweir             AdjustmentEvent aEvent( rEvent );
223cdf0e10cSrcweir             aEvent.Source = *this;
224cdf0e10cSrcweir 		    maAdjustmentListeners.adjustmentValueChanged( aEvent );
225cdf0e10cSrcweir         }
226cdf0e10cSrcweir     }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	//--------------------------------------------------------------------
addAdjustmentListener(const Reference<XAdjustmentListener> & listener)229cdf0e10cSrcweir     void UnoSpinButtonControl::addAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
230cdf0e10cSrcweir     {
231cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
232cdf0e10cSrcweir 	    maAdjustmentListeners.addInterface( listener );
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	//--------------------------------------------------------------------
removeAdjustmentListener(const Reference<XAdjustmentListener> & listener)236cdf0e10cSrcweir     void UnoSpinButtonControl::removeAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
239cdf0e10cSrcweir 	    maAdjustmentListeners.removeInterface( listener );
240cdf0e10cSrcweir     }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir     //--------------------------------------------------------------------
setValue(sal_Int32 value)243cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setValue( sal_Int32 value ) throw (RuntimeException)
244cdf0e10cSrcweir     {
245cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( value ), sal_True );
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     //--------------------------------------------------------------------
setValues(sal_Int32 minValue,sal_Int32 maxValue,sal_Int32 currentValue)249cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (RuntimeException)
250cdf0e10cSrcweir     {
251cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
252cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
253cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( currentValue ), sal_True );
254cdf0e10cSrcweir     }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     //--------------------------------------------------------------------
getValue()257cdf0e10cSrcweir     sal_Int32 SAL_CALL UnoSpinButtonControl::getValue(  ) throw (RuntimeException)
258cdf0e10cSrcweir     {
259cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
260cdf0e10cSrcweir         sal_Int32 nValue = 0;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir         Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
263cdf0e10cSrcweir 	    if ( xSpinnable.is() )
264cdf0e10cSrcweir 		    nValue = xSpinnable->getValue();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir         return nValue;
267cdf0e10cSrcweir     }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     //--------------------------------------------------------------------
setMinimum(sal_Int32 minValue)270cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setMinimum( sal_Int32 minValue ) throw (RuntimeException)
271cdf0e10cSrcweir     {
272cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
273cdf0e10cSrcweir     }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     //--------------------------------------------------------------------
setMaximum(sal_Int32 maxValue)276cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setMaximum( sal_Int32 maxValue ) throw (RuntimeException)
277cdf0e10cSrcweir     {
278cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
279cdf0e10cSrcweir     }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     //--------------------------------------------------------------------
getMinimum()282cdf0e10cSrcweir     sal_Int32 SAL_CALL UnoSpinButtonControl::getMinimum(  ) throw (RuntimeException)
283cdf0e10cSrcweir     {
284cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
285cdf0e10cSrcweir         sal_Int32 nMin = 0;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir         Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
288cdf0e10cSrcweir 	    if ( xSpinnable.is() )
289cdf0e10cSrcweir 		    nMin = xSpinnable->getMinimum();
290cdf0e10cSrcweir 
291cdf0e10cSrcweir         return nMin;
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     //--------------------------------------------------------------------
getMaximum()295cdf0e10cSrcweir     sal_Int32 SAL_CALL UnoSpinButtonControl::getMaximum(  ) throw (RuntimeException)
296cdf0e10cSrcweir     {
297cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
298cdf0e10cSrcweir         sal_Int32 nMax = 0;
299cdf0e10cSrcweir 
300cdf0e10cSrcweir         Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
301cdf0e10cSrcweir 	    if ( xSpinnable.is() )
302cdf0e10cSrcweir 		    nMax = xSpinnable->getMaximum();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir         return nMax;
305cdf0e10cSrcweir     }
306cdf0e10cSrcweir 
307cdf0e10cSrcweir     //--------------------------------------------------------------------
setSpinIncrement(sal_Int32 spinIncrement)308cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setSpinIncrement( sal_Int32 spinIncrement ) throw (RuntimeException)
309cdf0e10cSrcweir     {
310cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPININCREMENT ), makeAny( spinIncrement ), sal_True );
311cdf0e10cSrcweir     }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir     //--------------------------------------------------------------------
getSpinIncrement()314cdf0e10cSrcweir     sal_Int32 SAL_CALL UnoSpinButtonControl::getSpinIncrement(  ) throw (RuntimeException)
315cdf0e10cSrcweir     {
316cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
317cdf0e10cSrcweir         sal_Int32 nIncrement = 0;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
320cdf0e10cSrcweir 	    if ( xSpinnable.is() )
321cdf0e10cSrcweir 		    nIncrement = xSpinnable->getSpinIncrement();
322cdf0e10cSrcweir 
323cdf0e10cSrcweir         return nIncrement;
324cdf0e10cSrcweir     }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     //--------------------------------------------------------------------
setOrientation(sal_Int32 orientation)327cdf0e10cSrcweir     void SAL_CALL UnoSpinButtonControl::setOrientation( sal_Int32 orientation ) throw (NoSupportException, RuntimeException)
328cdf0e10cSrcweir     {
329cdf0e10cSrcweir 	    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ORIENTATION ), makeAny( orientation ), sal_True );
330cdf0e10cSrcweir     }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     //--------------------------------------------------------------------
getOrientation()333cdf0e10cSrcweir     sal_Int32 SAL_CALL UnoSpinButtonControl::getOrientation(  ) throw (RuntimeException)
334cdf0e10cSrcweir     {
335cdf0e10cSrcweir         ::osl::MutexGuard aGuard( GetMutex() );
336cdf0e10cSrcweir         sal_Int32 nOrientation = ScrollBarOrientation::HORIZONTAL;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
339cdf0e10cSrcweir 	    if ( xSpinnable.is() )
340cdf0e10cSrcweir 		    nOrientation = xSpinnable->getOrientation();
341cdf0e10cSrcweir 
342cdf0e10cSrcweir         return nOrientation;
343cdf0e10cSrcweir     }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir //........................................................................
346cdf0e10cSrcweir }  // namespace toolkit
347cdf0e10cSrcweir //........................................................................
348cdf0e10cSrcweir 
349