26#include <com/sun/star/beans/PropertyAttribute.hpp>
27#include <com/sun/star/form/FormComponentType.hpp>
42 using namespace ::com::sun::star::form::binding;
49 ,m_nDefaultSpinValue( 0 )
52 m_nClassId = FormComponentType::SPINBUTTON;
57 OSpinButtonModel::OSpinButtonModel(
const OSpinButtonModel* _pOriginal,
const Reference< XComponentContext >& _rxFactory )
58 :OBoundControlModel( _pOriginal, _rxFactory )
60 m_nDefaultSpinValue = _pOriginal->m_nDefaultSpinValue;
64 OSpinButtonModel::~OSpinButtonModel( )
68 OUString SAL_CALL OSpinButtonModel::getImplementationName()
70 return "com.sun.star.comp.forms.OSpinButtonModel";
77 Sequence< OUString > SAL_CALL OSpinButtonModel::getSupportedServiceNames()
81 return ::comphelper::combineSequences(
82 getAggregateServiceNames(),
83 ::comphelper::concatSequences(
84 OControlModel::getSupportedServiceNames_Static(),
90 css::uno::Reference< css::util::XCloneable > SAL_CALL OSpinButtonModel::createClone()
93 pClone->clonedFrom(
this);
98 void OSpinButtonModel::describeFixedProperties( Sequence< Property >& _rProps )
const
100 OControlModel::describeFixedProperties( _rProps );
101 sal_Int32 nOldCount = _rProps.getLength();
102 _rProps.realloc( nOldCount + 3);
103 css::beans::Property* pProperties = _rProps.getArray() + nOldCount;
107 DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(),
"<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?");
111 void OSpinButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle )
const
116 _rValue <<= m_nDefaultSpinValue;
120 OBoundControlModel::getFastPropertyValue( _rValue, _nHandle );
125 void OSpinButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle,
const Any& _rValue )
130 OSL_VERIFY( _rValue >>= m_nDefaultSpinValue );
135 OBoundControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
140 sal_Bool OSpinButtonModel::convertFastPropertyValue(
141 Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle,
const Any& _rValue )
143 bool bModified(
false );
147 bModified =
tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_nDefaultSpinValue );
151 bModified = OBoundControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
158 Any OSpinButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle )
const
165 aReturn <<= sal_Int32(0);
169 aReturn = OBoundControlModel::getPropertyDefaultByHandle( _nHandle );
177 Any OSpinButtonModel::translateDbColumnToControlValue( )
179 OSL_FAIL(
"OSpinButtonModel::commitControlValueToDbColumn: never to be called (we're not bound)!" );
184 bool OSpinButtonModel::commitControlValueToDbColumn(
bool )
186 OSL_FAIL(
"OSpinButtonModel::commitControlValueToDbColumn: never to be called (we're not bound)!" );
191 Any OSpinButtonModel::getDefaultForReset()
const
193 return Any( m_nDefaultSpinValue );
197 OUString SAL_CALL OSpinButtonModel::getServiceName()
203 void SAL_CALL OSpinButtonModel::write(
const Reference< XObjectOutputStream >& _rxOutStream )
205 OBoundControlModel::write( _rxOutStream );
206 ::osl::MutexGuard aGuard(
m_aMutex );
208 OStreamSection aSection( _rxOutStream );
211 _rxOutStream->writeShort( 0x0001 );
214 _rxOutStream << m_nDefaultSpinValue;
215 writeHelpTextCompatibly( _rxOutStream );
219 void SAL_CALL OSpinButtonModel::read(
const Reference< XObjectInputStream>& _rxInStream )
221 OBoundControlModel::read( _rxInStream );
222 ::osl::MutexGuard aGuard(
m_aMutex );
226 OStreamSection aSection( _rxInStream );
228 sal_uInt16
nVersion = _rxInStream->readShort();
231 _rxInStream >> m_nDefaultSpinValue;
232 readHelpTextCompatibly( _rxInStream );
235 defaultCommonProperties();
242 Any OSpinButtonModel::translateExternalValueToControlValue(
const Any& _rExternalValue )
const
250 Any OSpinButtonModel::translateControlValueToExternalValue( )
const
257 Sequence< Type > OSpinButtonModel::getSupportedBindingTypes()
264extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
266 css::uno::Sequence<css::uno::Any>
const &)
#define DBG_ASSERT(sCon, aError)
constexpr OUStringLiteral PROPERTY_TABINDEX
constexpr OUStringLiteral PROPERTY_DEFAULT_SPIN_VALUE
constexpr OUStringLiteral PROPERTY_SPIN_VALUE
constexpr OUStringLiteral PROPERTY_CONTROLSOURCEPROPERTY
bool tryPropertyValue(Any &_rConvertedValue, Any &_rOldValue, const Any &_rValueToSet, const Any &_rCurrentValue, const Type &_rExpectedType)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Any translateControlIntToExternalDoubleValue(const Any &_rControlIntValue)
Any translateExternalDoubleToControlIntValue(const Any &_rExternalValue, const Reference< XPropertySet > &_rxProperties, const OUString &_rMinValueName, const OUString &_rMaxValueName)
#define PROPERTY_ID_CONTROLSOURCEPROPERTY
#define PROPERTY_ID_DEFAULT_SPIN_VALUE
#define PROPERTY_ID_SPIN_VALUE
#define PROPERTY_ID_TABINDEX
constexpr OUStringLiteral VCL_CONTROLMODEL_SPINBUTTON
constexpr OUStringLiteral FRM_SUN_COMPONENT_SPINBUTTON
constexpr OUStringLiteral VCL_CONTROL_SPINBUTTON
constexpr OUStringLiteral BINDABLE_INTEGER_VALUE_RANGE