diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-08-28 13:30:12 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-08-28 13:30:12 +0000 |
commit | 62c5fa997391a7112df183360ed7afdd41060855 (patch) | |
tree | 9372e1270f93b418aedb0fff1450ce3ffeaa7750 /forms/source/component | |
parent | ab8722fe9222ba155c9ff24ee3e6b50bdc58a29f (diff) |
#74241# be an XSQLErrorBroadcaster - so we can broadcast errors during the commit
Diffstat (limited to 'forms/source/component')
-rw-r--r-- | forms/source/component/FormattedField.cxx | 205 | ||||
-rw-r--r-- | forms/source/component/FormattedField.hxx | 290 |
2 files changed, 263 insertions, 232 deletions
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 3f6fd39ca303..356902e3929a 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FormattedField.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-08-10 07:44:37 $ + * last change: $Author: fs $ $Date: 2001-08-28 14:30:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,12 @@ #ifndef _FRM_PROPERTY_HXX_ #include "property.hxx" #endif +#ifndef _FRM_RESOURCE_HXX_ +#include "frm_resource.hxx" +#endif +#ifndef _FRM_RESOURCE_HRC_ +#include "frm_resource.hrc" +#endif #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> @@ -148,6 +154,10 @@ #include <vos/mutex.hxx> #endif // needed as long as we use the SolarMutex +#ifndef _COMPHELPER_STREAMSECTION_HXX_ +#include <comphelper/streamsection.hxx> +#endif + using namespace dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdb; @@ -161,88 +171,6 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; - -//namespace stario = ::com::sun::star::io; - -/** implements handling for compatibly reading/writing data from/into an input/output stream. - data written in a block secured by this class should be readable by older versions which - use the same mechanism. -*/ -/*************************************************************************/ - -class OMarkableStreamBlock -{ - Reference< XMarkableStream > m_xMarkStream; - Reference< XDataInputStream > m_xInStream; - Reference< XDataOutputStream > m_xOutStream; - - sal_Int32 m_nBlockStart; - sal_Int32 m_nBlockLen; - -public: - /** starts reading of a "skippable" block of data within the given input stream<BR> - The object given by _rxInput must support the XMarkableStream interface. - */ - OMarkableStreamBlock(const Reference< XDataInputStream >& _rxInput); - /** starts writing of a "skippable" block of data into the given output stream - The object given by _rxOutput must support the XMarkableStream interface. - */ - OMarkableStreamBlock(const Reference< XDataOutputStream >& _rxOutput); - - ~OMarkableStreamBlock(); -}; - -//------------------------------------------------------------------------- -OMarkableStreamBlock::OMarkableStreamBlock(const Reference< XDataInputStream >& _rxInput) - :m_xInStream(_rxInput) - ,m_xMarkStream(_rxInput, UNO_QUERY) - ,m_nBlockStart(-1) - ,m_nBlockLen(-1) -{ - DBG_ASSERT(m_xInStream.is() && m_xMarkStream.is(), "OMarkableStreamBlock::OMarkableStreamBlock : invaid argument !"); - if (m_xInStream.is() && m_xMarkStream.is()) - { - m_nBlockLen = _rxInput->readLong(); - m_nBlockStart = m_xMarkStream->createMark(); - } -} - -//------------------------------------------------------------------------- -OMarkableStreamBlock::OMarkableStreamBlock(const Reference< XDataOutputStream >& _rxOutput) - :m_xOutStream(_rxOutput) - ,m_xMarkStream(_rxOutput, UNO_QUERY) - ,m_nBlockStart(-1) - ,m_nBlockLen(-1) -{ - DBG_ASSERT(m_xOutStream.is() && m_xMarkStream.is(), "OMarkableStreamBlock::OMarkableStreamBlock : invaid argument !"); - if (m_xOutStream.is() && m_xMarkStream.is()) - { - m_nBlockStart = m_xMarkStream->createMark(); - // a placeholder where we will write the overall length (within the destructor) - m_nBlockLen = 0; - m_xOutStream->writeLong(m_nBlockLen); - } -} - -//------------------------------------------------------------------------- -OMarkableStreamBlock::~OMarkableStreamBlock() -{ - if (m_xInStream.is() && m_xMarkStream.is()) - { // we're working on an input stream - m_xMarkStream->jumpToMark(m_nBlockStart); - m_xInStream->skipBytes(m_nBlockLen); - m_xMarkStream->deleteMark(m_nBlockStart); - } - else if (m_xOutStream.is() && m_xMarkStream.is()) - { - m_nBlockLen = m_xMarkStream->offsetToMark(m_nBlockStart) - sizeof(m_nBlockLen); - m_xMarkStream->jumpToMark(m_nBlockStart); - m_xOutStream->writeLong(m_nBlockLen); - m_xMarkStream->jumpToFurthest(); - m_xMarkStream->deleteMark(m_nBlockStart); - } -} - //......................................................................... namespace frm { @@ -294,10 +222,10 @@ InterfaceRef SAL_CALL OFormattedControl_CreateInstance(const Reference<XMultiSer //------------------------------------------------------------------ Sequence<Type> OFormattedControl::_getTypes() { - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OFormattedControl_BASE::getTypes(), OBoundControl::_getTypes()); - return aTypes; + return ::comphelper::concatSequences( + OFormattedControl_BASE::getTypes(), + OBoundControl::_getTypes() + ); } //------------------------------------------------------------------ @@ -452,6 +380,7 @@ InterfaceRef SAL_CALL OFormattedModel_CreateInstance(const Reference<XMultiServi OFormattedModel::OFormattedModel(const Reference<XMultiServiceFactory>& _rxFactory) :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_FORMATTEDFIELD, FRM_CONTROL_FORMATTEDFIELD, sal_False ) // use the old control name for compytibility reasons + ,OErrorBroadcaster( rBHelper ) ,OPropertyChangeListener(m_aMutex) ,m_bOriginalNumeric(sal_False) ,m_bNumeric(sal_False) @@ -460,6 +389,7 @@ OFormattedModel::OFormattedModel(const Reference<XMultiServiceFactory>& _rxFacto ,m_aNullDate(DBTypeConversion::getStandardDate()) ,m_bAggregateListening(sal_False) ,m_pPropertyMultiplexer(NULL) + ,m_nFieldType( DataType::OTHER ) { DBG_CTOR(OFormattedModel, NULL); m_nClassId = FormComponentType::TEXTFIELD; @@ -534,6 +464,7 @@ void OFormattedModel::releaseAggregateListener() void SAL_CALL OFormattedModel::disposing() { stopAggregateListening(); + OErrorBroadcaster::disposing(); OEditBaseModel::disposing(); } @@ -550,6 +481,24 @@ StringSequence OFormattedModel::getSupportedServiceNames() throw() return aSupported; } +// XAggregation +//------------------------------------------------------------------------------ +Any SAL_CALL OFormattedModel::queryAggregation(const Type& _rType) throw(RuntimeException) +{ + Any aReturn = OEditBaseModel::queryAggregation( _rType ); + return aReturn.hasValue() ? aReturn : OErrorBroadcaster::queryInterface( _rType ); +} + +// XTypeProvider +//------------------------------------------------------------------------------ +Sequence< Type > OFormattedModel::_getTypes() +{ + return ::comphelper::concatSequences( + OEditBaseModel::_getTypes(), + OErrorBroadcaster::getTypes() + ); +} + // XPersistObject //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OFormattedModel::getServiceName() @@ -819,6 +768,14 @@ void OFormattedModel::_loaded(const EventObject& rEvent) m_xOriginalFormatter = NULL; + // get some properties of the field + m_nFieldType = DataType::OTHER; + if ( m_xField.is() ) + { + m_xField->getPropertyValue( PROPERTY_FIELDTYPE ) >>= m_nFieldType; + } + + DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::_loaded : have no aggregate !"); if (m_xAggregateSet.is()) { // all the following doesn't make any sense if we have no aggregate ... @@ -928,6 +885,7 @@ void OFormattedModel::_unloaded() m_xOriginalFormatter = NULL; } + m_nFieldType = DataType::OTHER; m_nKeyType = NumberFormat::UNDEFINED; m_aNullDate = DBTypeConversion::getStandardDate(); } @@ -1009,7 +967,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) // and to be a little bit more compatible we make the following section skippable { Reference< XDataOutputStream > xOut(_rxOutStream, UNO_QUERY); - OMarkableStreamBlock aDownCompat(xOut); + OStreamSection aDownCompat(xOut); // a sub version within the skippable block _rxOutStream->writeShort(0x0000); @@ -1022,7 +980,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) } { - OMarkableStreamBlock aDownCompat2(xOut); + OStreamSection aDownCompat2(xOut); switch (aEffectiveValue.getValueType().getTypeClass()) { case TypeClass_STRING: @@ -1091,14 +1049,14 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) if (nVersion == 0x0003) { // since version 3 there is a "skippable" block at this position Reference< XDataInputStream > xIn(_rxInStream, UNO_QUERY); - OMarkableStreamBlock aDownCompat(xIn); + OStreamSection aDownCompat(xIn); sal_Int16 nSubVersion = _rxInStream->readShort(); // version 0 and higher : the "effective value" property Any aEffectiveValue; { - OMarkableStreamBlock aDownCompat2(xIn); + OStreamSection aDownCompat2(xIn); switch (_rxInStream->readShort()) { case 0: // String @@ -1154,10 +1112,28 @@ sal_Int16 OFormattedModel::getPersistenceFlags() const return (OEditBaseModel::getPersistenceFlags() & ~PF_HANDLE_COMMON_PROPS); // a) we do our own call to writeCommonEditProperties } + +//------------------------------------------------------------------------------ +namespace +{ + static void lcl_replaceAscii( ::rtl::OUString& _rText, const sal_Char* _pAscii, const ::rtl::OUString& _rReplace ) + { + ::rtl::OUString sFind = ::rtl::OUString::createFromAscii( _pAscii ); + sal_Int32 nPos = _rText.indexOf( sFind ); + if ( 0 <= nPos ) + { + ::rtl::OUString sNew = _rText.copy( 0, nPos ); + sNew += _rReplace; + sNew += _rText.copy( nPos + sFind.getLength() ); + _rText = sNew; + } + } +} + //------------------------------------------------------------------------------ sal_Bool OFormattedModel::_commit() { - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OFormattedModel::nValueHandle ); + Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OFormattedModel::nValueHandle ); if (!compare(aNewValue, m_aSaveValue)) { // Leerstring + EmptyIsNull = void @@ -1175,6 +1151,49 @@ sal_Bool OFormattedModel::_commit() { if (aNewValue.getValueType().getTypeClass() == TypeClass_DOUBLE) { +/* // some plausibility checks + // 74241 - 28.08.2001 - frank.schoenheit@sun.com + double nValue = getDouble( aNewValue ); + double nLimitMin = 0; + double nLimitMax = 0; + sal_Bool bLargeInt = sal_False; + switch ( m_nFieldType ) + { + case DataType::TINYINT: + nLimitMin = -128; nLimitMax = 127; + break; // no specification if TINYINT is signed, thus this odd numbers .... + + case DataType::SMALLINT: + nLimitMin = -32768; nLimitMax = 32767; + break; + + case DataType::INTEGER: + nLimitMin = ((double)-2147483647) - 1; nLimitMax = 2147483647; + bLargeInt = sal_True; + break; + } + if ( nLimitMin && nLimitMax ) + { + if ( ( nValue < nLimitMin ) || ( nValue > nLimitMax ) ) + { + ::rtl::OUString sMessage = FRM_RES_STRING( RID_STR_INVALID_FIELD_VALUE ); + lcl_replaceAscii( sMessage, "$min$", bLargeInt ? ::rtl::OUString::createFromAscii( "-2147483648" ) : ::rtl::OUString::valueOf( (sal_Int32)nLimitMin ) ); + lcl_replaceAscii( sMessage, "$max$", ::rtl::OUString::valueOf( (sal_Int32)nLimitMax ) ); + + SQLException aError; + aError.Message = sMessage; + + onError( aError, FRM_RES_STRING( RID_STR_COULD_NOT_COMMIT ) ); + return sal_False; + } + } + // Do not do this checks. This would make sense if a min and max for the control are defined, + // but not with such implicit restrictions as got from the field type. This is way too dependent + // on the type of database we're working with (e.g., for a TINYINT, it is not defined if this is + // signed or unsigned. There may be databases which treat it as signed, and databases which don't. + // And we have no chance to know this, but we would need to to use the correct limits .... +*/ + DBTypeConversion::setValue(m_xColumnUpdate, m_aNullDate, getDouble(aNewValue), m_nKeyType); } else diff --git a/forms/source/component/FormattedField.hxx b/forms/source/component/FormattedField.hxx index b7e0d65a4d8c..d3c3787e7f1e 100644 --- a/forms/source/component/FormattedField.hxx +++ b/forms/source/component/FormattedField.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FormattedField.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2001-05-31 14:03:04 $ + * last change: $Author: fs $ $Date: 2001-08-28 14:30:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,152 +76,164 @@ #ifndef _CPPUHELPER_IMPLBASE1_HXX_ #include <cppuhelper/implbase1.hxx> #endif - +#ifndef FORMS_ERRORBROADCASTER_HXX +#include "errorbroadcaster.hxx" +#endif //......................................................................... namespace frm { -//================================================================== -//= OFormattedModel -//================================================================== -class OFormattedModel - :public OEditBaseModel - ,public OPropertyChangeListener - ,public ::comphelper::OAggregationArrayUsageHelper< OFormattedModel > -{ - OPropertyChangeMultiplexer* m_pPropertyMultiplexer; - - // das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das - // ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded) - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> m_xOriginalFormatter; - ::com::sun::star::util::Date m_aNullDate; - ::com::sun::star::uno::Any m_aSaveValue; - - sal_Int16 m_nKeyType; - sal_Bool m_bOriginalNumeric : 1, - m_bNumeric : 1, // analog fuer TreatAsNumeric-Property - m_bAggregateListening : 1; - - static ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> s_xDefaultFormatter; - static sal_Int32 nValueHandle; - // falls ich wirklich mal einen selber benutzen muss, wird der zwischen allen Instanzen geteilt - -protected: - virtual void _onValueChanged(); - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcDefaultFormatsSupplier() const; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormFormatsSupplier() const; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormatsSupplier() const; - sal_Int32 calcFormatKey() const; - void getFormatDescription(::rtl::OUString& sFormat, LanguageType& eLanguage); - - OFormattedModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - ~OFormattedModel(); - - friend InterfaceRef SAL_CALL OFormattedModel_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - friend class OFormattedFieldWrapper; - - /// starts multiplexing the aggregate's property changes - void startAggregateListening(); - /// stops multiplexing the aggregate's property changes - void stopAggregateListening(); - /// release the aggregate listener - void releaseAggregateListener(); - -protected: - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// XServiceInfo - IMPLEMENTATION_NAME(OFormattedModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// XBoundComponent - virtual sal_Bool _commit(); - -// XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference<stario::XObjectOutputStream>& _rxOutStream); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference<stario::XObjectInputStream>& _rxInStream); - virtual ::rtl::OUString SAL_CALL getServiceName(); - -// XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue); - -// XLoadListener - virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - -// XReset - virtual void _reset( void ); - -// XPropertyState - void setPropertyToDefaultByHandle(sal_Int32 nHandle); - ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const; - - void SAL_CALL setPropertyToDefault(const ::rtl::OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -// XPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); - -protected: - virtual sal_Int16 getPersistenceFlags() const; - // as we have an own version handling for persistence -}; - -//================================================================== -//= OFormattedControl -//================================================================== -typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE; -class OFormattedControl : public OBoundControl - ,public OFormattedControl_BASE -{ - sal_uInt32 m_nKeyEvent; - -public: - OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OFormattedControl(); - - DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OFormattedControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); + //================================================================== + //= OFormattedModel + //================================================================== + + class OFormattedModel + :public OEditBaseModel + ,public OErrorBroadcaster + ,public OPropertyChangeListener + ,public ::comphelper::OAggregationArrayUsageHelper< OFormattedModel > + { + OPropertyChangeMultiplexer* m_pPropertyMultiplexer; + + // das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das + // ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded) + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> m_xOriginalFormatter; + ::com::sun::star::util::Date m_aNullDate; + ::com::sun::star::uno::Any m_aSaveValue; + + sal_Int32 m_nFieldType; + sal_Int16 m_nKeyType; + sal_Bool m_bOriginalNumeric : 1, + m_bNumeric : 1, // analog fuer TreatAsNumeric-Property + m_bAggregateListening : 1; + + static ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > s_xDefaultFormatter; + static sal_Int32 nValueHandle; + // falls ich wirklich mal einen selber benutzen muss, wird der zwischen allen Instanzen geteilt + + protected: + virtual void _onValueChanged(); + + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcDefaultFormatsSupplier() const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormFormatsSupplier() const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormatsSupplier() const; + sal_Int32 calcFormatKey() const; + void getFormatDescription(::rtl::OUString& sFormat, LanguageType& eLanguage); + + OFormattedModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + ~OFormattedModel(); + + friend InterfaceRef SAL_CALL OFormattedModel_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + friend class OFormattedFieldWrapper; + + /// starts multiplexing the aggregate's property changes + void startAggregateListening(); + /// stops multiplexing the aggregate's property changes + void stopAggregateListening(); + /// release the aggregate listener + void releaseAggregateListener(); + + protected: + // XInterface + DECLARE_UNO3_AGG_DEFAULTS( OFormattedModel, OEditBaseModel ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + + // XAggregation + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XServiceInfo + IMPLEMENTATION_NAME(OFormattedModel); + virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); + + // XBoundComponent + virtual sal_Bool _commit(); + + // XPersistObject + virtual void SAL_CALL write(const ::com::sun::star::uno::Reference<stario::XObjectOutputStream>& _rxOutStream); + virtual void SAL_CALL read(const ::com::sun::star::uno::Reference<stario::XObjectInputStream>& _rxInStream); + virtual ::rtl::OUString SAL_CALL getServiceName(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; + virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, + sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw(::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue); + + // XLoadListener + virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent); + virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); + virtual void _unloaded(); + + // XReset + virtual void _reset( void ); + + // XPropertyState + void setPropertyToDefaultByHandle(sal_Int32 nHandle); + ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const; + + void SAL_CALL setPropertyToDefault(const ::rtl::OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + // OAggregationArrayUsageHelper + virtual void fillProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps + ) const; + IMPLEMENT_INFO_SERVICE() + + // XPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + protected: + virtual sal_Int16 getPersistenceFlags() const; + // as we have an own version handling for persistence + }; + + //================================================================== + //= OFormattedControl + //================================================================== + typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE; + class OFormattedControl : public OBoundControl + ,public OFormattedControl_BASE + { + sal_uInt32 m_nKeyEvent; -// ::com::sun::star::awt::XKeyListener - virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e); - virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e); + public: + OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + virtual ~OFormattedControl(); -// ::com::sun::star::awt::XControl - virtual void SAL_CALL setDesignMode(sal_Bool bOn); + DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + + // ::com::sun::star::lang::XServiceInfo + IMPLEMENTATION_NAME(OFormattedControl); + virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -private: - DECL_LINK( OnKeyPressed, void* ); -}; + // ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XKeyListener + virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e); + virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e); + + // ::com::sun::star::awt::XControl + virtual void SAL_CALL setDesignMode(sal_Bool bOn); + + private: + DECL_LINK( OnKeyPressed, void* ); + }; //......................................................................... } |