20#include <com/sun/star/awt/ScrollBarOrientation.hpp>
21#include <com/sun/star/awt/XSpinValue.hpp>
22#include <com/sun/star/awt/XAdjustmentListener.hpp>
23#include <com/sun/star/uno/XComponentContext.hpp>
29#include <helper/property.hxx>
47 explicit UnoSpinButtonModel(
const css::uno::Reference< css::uno::XComponentContext >& i_factory );
48 UnoSpinButtonModel(
const UnoSpinButtonModel & rOther) :
UnoControlModel(rOther) {}
53 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
override;
56 OUString SAL_CALL getServiceName()
override;
68 , css::awt::XSpinValue
69 > UnoSpinButtonControl_Base;
72 ,
public UnoSpinButtonControl_Base
75 AdjustmentListenerMultiplexer maAdjustmentListeners;
78 UnoSpinButtonControl();
82 css::uno::Any SAL_CALL
queryAggregation(
const css::uno::Type & rType )
override;
84 void SAL_CALL
createPeer(
const css::uno::Reference< css::awt::XToolkit >& Toolkit,
const css::uno::Reference< css::awt::XWindowPeer >& Parent )
override;
86 void SAL_CALL
dispose( )
override;
95 virtual
void SAL_CALL addAdjustmentListener( const css::
uno::Reference< css::awt::XAdjustmentListener >& listener ) override;
96 virtual
void SAL_CALL removeAdjustmentListener( const css::
uno::Reference< css::awt::XAdjustmentListener >& listener ) override;
97 virtual
void SAL_CALL setValue( sal_Int32 value ) override;
98 virtual
void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) override;
99 virtual sal_Int32 SAL_CALL getValue( ) override;
100 virtual
void SAL_CALL setMinimum( sal_Int32 minValue ) override;
101 virtual
void SAL_CALL setMaximum( sal_Int32 maxValue ) override;
102 virtual sal_Int32 SAL_CALL getMinimum( ) override;
103 virtual sal_Int32 SAL_CALL getMaximum( ) override;
104 virtual
void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) override;
105 virtual sal_Int32 SAL_CALL getSpinIncrement( ) override;
106 virtual
void SAL_CALL setOrientation( sal_Int32
orientation ) override;
107 virtual sal_Int32 SAL_CALL getOrientation( ) override;
110 OUString SAL_CALL getImplementationName( ) override;
111 css::
uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
118 UnoSpinButtonModel::UnoSpinButtonModel( const css::
uno::Reference< css::
uno::XComponentContext >& i_factory )
144 OUString UnoSpinButtonModel::getServiceName( )
146 return "com.sun.star.awt.UnoControlSpinButtonModel";
150 Any UnoSpinButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId )
const
155 return Any( OUString(
"com.sun.star.awt.UnoControlSpinButton") );
158 return Any( sal_Int16(0) );
176 Reference< XPropertySetInfo > UnoSpinButtonModel::getPropertySetInfo( )
178 static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
183 OUString SAL_CALL UnoSpinButtonModel::getImplementationName( )
185 return "stardiv.Toolkit.UnoSpinButtonModel";
189 Sequence< OUString > SAL_CALL UnoSpinButtonModel::getSupportedServiceNames()
191 const css::uno::Sequence<OUString> vals {
"com.sun.star.awt.UnoControlSpinButtonModel" };
199 UnoSpinButtonControl::UnoSpinButtonControl()
200 :maAdjustmentListeners( *this )
205 OUString UnoSpinButtonControl::GetComponentServiceName()
const
211 Any UnoSpinButtonControl::queryAggregation(
const Type & rType )
214 if ( !aRet.hasValue() )
215 aRet = UnoSpinButtonControl_Base::queryInterface( rType );
223 void UnoSpinButtonControl::dispose()
225 ::osl::ClearableMutexGuard aGuard( GetMutex() );
226 if ( maAdjustmentListeners.getLength() )
228 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
229 if ( xSpinnable.is() )
230 xSpinnable->removeAdjustmentListener(
this );
232 EventObject aDisposeEvent;
233 aDisposeEvent.Source = *
this;
236 maAdjustmentListeners.disposeAndClear( aDisposeEvent );
243 OUString SAL_CALL UnoSpinButtonControl::getImplementationName( )
245 return "stardiv.Toolkit.UnoSpinButtonControl";
249 Sequence< OUString > SAL_CALL UnoSpinButtonControl::getSupportedServiceNames()
251 const css::uno::Sequence<OUString> vals {
"com.sun.star.awt.UnoControlSpinButton" };
256 void UnoSpinButtonControl::createPeer(
const Reference< XToolkit > & rxToolkit,
const Reference< XWindowPeer > & rParentPeer )
260 Reference < XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
261 if ( xSpinnable.is() )
262 xSpinnable->addAdjustmentListener(
this );
268 switch ( rEvent.Type )
270 case AdjustmentType_ADJUST_LINE:
271 case AdjustmentType_ADJUST_PAGE:
272 case AdjustmentType_ADJUST_ABS:
276 OSL_FAIL(
"UnoSpinButtonControl::adjustmentValueChanged - unknown Type" );
279 if ( maAdjustmentListeners.getLength() )
281 AdjustmentEvent
aEvent( rEvent );
283 maAdjustmentListeners.adjustmentValueChanged( aEvent );
288 void UnoSpinButtonControl::addAdjustmentListener(
const Reference< XAdjustmentListener > & listener )
290 ::osl::MutexGuard aGuard( GetMutex() );
291 maAdjustmentListeners.addInterface( listener );
295 void UnoSpinButtonControl::removeAdjustmentListener(
const Reference< XAdjustmentListener > & listener )
297 ::osl::MutexGuard aGuard( GetMutex() );
298 maAdjustmentListeners.removeInterface( listener );
302 void SAL_CALL UnoSpinButtonControl::setValue( sal_Int32 value )
308 void SAL_CALL UnoSpinButtonControl::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue )
316 sal_Int32 SAL_CALL UnoSpinButtonControl::getValue( )
318 ::osl::MutexGuard aGuard( GetMutex() );
321 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
322 if ( xSpinnable.is() )
323 nValue = xSpinnable->getValue();
329 void SAL_CALL UnoSpinButtonControl::setMinimum( sal_Int32 minValue )
335 void SAL_CALL UnoSpinButtonControl::setMaximum( sal_Int32 maxValue )
341 sal_Int32 SAL_CALL UnoSpinButtonControl::getMinimum( )
343 ::osl::MutexGuard aGuard( GetMutex() );
346 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
347 if ( xSpinnable.is() )
348 nMin = xSpinnable->getMinimum();
354 sal_Int32 SAL_CALL UnoSpinButtonControl::getMaximum( )
356 ::osl::MutexGuard aGuard( GetMutex() );
359 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
360 if ( xSpinnable.is() )
361 nMax = xSpinnable->getMaximum();
367 void SAL_CALL UnoSpinButtonControl::setSpinIncrement( sal_Int32 spinIncrement )
373 sal_Int32 SAL_CALL UnoSpinButtonControl::getSpinIncrement( )
375 ::osl::MutexGuard aGuard( GetMutex() );
376 sal_Int32 nIncrement = 0;
378 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
379 if ( xSpinnable.is() )
380 nIncrement = xSpinnable->getSpinIncrement();
386 void SAL_CALL UnoSpinButtonControl::setOrientation( sal_Int32
orientation )
392 sal_Int32 SAL_CALL UnoSpinButtonControl::getOrientation( )
394 ::osl::MutexGuard aGuard( GetMutex() );
395 sal_Int32 nOrientation = ScrollBarOrientation::HORIZONTAL;
397 Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
398 if ( xSpinnable.is() )
399 nOrientation = xSpinnable->getOrientation();
406extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
408 css::uno::XComponentContext *context,
409 css::uno::Sequence<css::uno::Any>
const &)
411 return cppu::acquire(
new UnoSpinButtonModel(context));
414extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
416 css::uno::XComponentContext *,
417 css::uno::Sequence<css::uno::Any>
const &)
419 return cppu::acquire(
new UnoSpinButtonControl());
virtual css::uno::Any ImplGetDefaultValue(sal_uInt16 nPropId) const
::cppu::IPropertyArrayHelper & getInfoHelper() override=0
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void SAL_CALL dispose() override
void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual OUString GetComponentServiceName() const
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &Toolkit, const css::uno::Reference< css::awt::XWindowPeer > &Parent) override
virtual css::uno::Any SAL_CALL queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
DECL_LISTENERMULTIPLEXER_END void SAL_CALL adjustmentValueChanged(const css::awt::AdjustmentEvent &rEvent) override
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
const OUString & GetPropertyName(sal_uInt16 nPropertyId)
#define BASEPROPERTY_SPININCREMENT
#define BASEPROPERTY_SPINVALUE
#define BASEPROPERTY_BORDER
#define BASEPROPERTY_ORIENTATION
#define BASEPROPERTY_CONTEXT_WRITING_MODE
#define BASEPROPERTY_HELPURL
#define BASEPROPERTY_REPEAT
#define BASEPROPERTY_SYMBOL_COLOR
#define BASEPROPERTY_BACKGROUNDCOLOR
#define BASEPROPERTY_SPINVALUE_MAX
#define BASEPROPERTY_TABSTOP
#define BASEPROPERTY_ENABLED
#define BASEPROPERTY_DEFAULTCONTROL
#define BASEPROPERTY_WRITING_MODE
#define BASEPROPERTY_BORDERCOLOR
#define BASEPROPERTY_ENABLEVISIBLE
#define BASEPROPERTY_HELPTEXT
#define BASEPROPERTY_REPEAT_DELAY
#define BASEPROPERTY_PRINTABLE
#define BASEPROPERTY_SPINVALUE_MIN
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer)
#define DECLARE_XTYPEPROVIDER()
#define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass)