diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-05-18 13:44:07 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-05-18 13:44:07 +0000 |
commit | 3a058545da56907c8d233db342c0cb64164c15bd (patch) | |
tree | 6e871101881bd6bb89b1f29f6b631b8d0e41d2dd /forms/source | |
parent | 804bfc05a80e7e3e4b6961d290323ba7d960501c (diff) |
#86712# add FormatKey and FormatsSupplier property, mapped to the predefined formats
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/Date.cxx | 75 | ||||
-rw-r--r-- | forms/source/component/Date.hxx | 15 | ||||
-rw-r--r-- | forms/source/component/Time.cxx | 83 | ||||
-rw-r--r-- | forms/source/component/Time.hxx | 16 |
4 files changed, 150 insertions, 39 deletions
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index ccce79e5bc78..b8b1f7d9b56d 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Date.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2001-04-02 10:28:06 $ + * last change: $Author: fs $ $Date: 2001-05-18 14:44:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,6 +91,7 @@ using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::form; using namespace ::com::sun::star::awt; @@ -142,13 +143,16 @@ Sequence<Type> ODateModel::_getTypes() //------------------------------------------------------------------ ODateModel::ODateModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_DATEFIELD, FRM_CONTROL_DATEFIELD ) - // use the old control name for compytibility reasons + :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_DATEFIELD, FRM_CONTROL_DATEFIELD ) + // use the old control name for compytibility reasons + ,OLimitedFormats(_rxFactory, FormComponentType::DATEFIELD) { m_nClassId = FormComponentType::DATEFIELD; m_sDataFieldConnectivityProperty = PROPERTY_DATE; if (ODateModel::nDateHandle == -1) ODateModel::nDateHandle = getOriginalHandle(PROPERTY_ID_DATE); + + setAggregateSet(m_xAggregateFastSet, getOriginalHandle(PROPERTY_ID_DATEFORMAT)); } // XServiceInfo @@ -183,19 +187,18 @@ void ODateModel::fillProperties( Sequence< Property >& _rProps, Sequence< Property >& _rAggregateProps ) const { - FRM_BEGIN_PROP_HELPER(9) - // Date auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_DATE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP2(BOUNDFIELD, XPropertySet, READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); + FRM_BEGIN_PROP_HELPER(11) + DECL_PROP1(NAME, ::rtl::OUString, BOUND); + DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); + DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); + DECL_PROP1(TAG, ::rtl::OUString, BOUND); + DECL_PROP1(TABINDEX, sal_Int16, BOUND); + DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); + DECL_IFACE_PROP2(BOUNDFIELD, XPropertySet, READONLY, TRANSIENT); + DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); + DECL_PROP2(CONTROLSOURCEPROPERTY, ::rtl::OUString, READONLY, TRANSIENT); + DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT); + DECL_IFACE_PROP1(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY); FRM_END_PROP_HELPER(); } @@ -205,6 +208,42 @@ void ODateModel::fillProperties( return *const_cast<ODateModel*>(this)->getArrayHelper(); } +//------------------------------------------------------------------------------ +void SAL_CALL ODateModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle ) const +{ + switch (_nHandle) + { + case PROPERTY_ID_FORMATKEY: + getFormatKeyPropertyValue(_rValue); + break; + case PROPERTY_ID_FORMATSSUPPLIER: + _rValue <<= getFormatsSupplier(); + break; + default: + OEditBaseModel::getFastPropertyValue(_rValue, _nHandle); + break; + } +} + +//------------------------------------------------------------------------------ +sal_Bool SAL_CALL ODateModel::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue, + sal_Int32 _nHandle, const Any& _rValue ) throw(IllegalArgumentException) +{ + if (PROPERTY_ID_FORMATKEY == _nHandle) + return convertFormatKeyPropertyValue(_rConvertedValue, _rOldValue, _rValue); + else + return OEditBaseModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL ODateModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) +{ + if (PROPERTY_ID_FORMATKEY == _nHandle) + setFormatKeyPropertyValue(_rValue); + else + OEditBaseModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); +} + // XLoadListener //------------------------------------------------------------------------------ void ODateModel::_loaded(const EventObject& rEvent) @@ -294,7 +333,7 @@ void ODateModel::_reset() aValue = m_aDefault; else { // aktuelles Datum einstellen - Date aCurrentDate; + ::Date aCurrentDate; aValue <<= (sal_Int32)aCurrentDate.GetDate(); } diff --git a/forms/source/component/Date.hxx b/forms/source/component/Date.hxx index 75a768b64a44..a53191d08948 100644 --- a/forms/source/component/Date.hxx +++ b/forms/source/component/Date.hxx @@ -2,9 +2,9 @@ * * $RCSfile: Date.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-23 08:48:15 $ + * last change: $Author: fs $ $Date: 2001-05-18 14:44:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,9 @@ #ifndef _FORMS_EDITBASE_HXX_ #include "EditBase.hxx" #endif +#ifndef _FORMS_LIMITED_FORMATS_HXX_ +#include "limitedformats.hxx" +#endif //......................................................................... namespace frm @@ -76,6 +79,7 @@ namespace frm //================================================================== class ODateModel :public OEditBaseModel + ,public OLimitedFormats ,public ::comphelper::OAggregationArrayUsageHelper< ODateModel > { ::com::sun::star::uno::Any m_aSaveValue; @@ -95,6 +99,13 @@ public: // stario::XPersistObject virtual ::rtl::OUString SAL_CALL getServiceName(); + // ::com::sun::star::beans::XPropertySet + 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); + // ::com::sun::star::lang::XServiceInfo IMPLEMENTATION_NAME(ODateModel); virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index 8fa321cc9862..80967319ec61 100644 --- a/forms/source/component/Time.cxx +++ b/forms/source/component/Time.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Time.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2001-04-02 10:28:06 $ + * last change: $Author: fs $ $Date: 2001-05-18 14:44:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,11 +93,16 @@ using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::form; +using namespace ::com::sun::star::util; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; //================================================================== +//= +//================================================================== + +//================================================================== //= OTimeControl //================================================================== //------------------------------------------------------------------ @@ -161,13 +166,22 @@ Sequence<Type> OTimeModel::_getTypes() //------------------------------------------------------------------ OTimeModel::OTimeModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_TIMEFIELD, FRM_CONTROL_TIMEFIELD ) + :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_TIMEFIELD, FRM_CONTROL_TIMEFIELD ) // use the old control name for compytibility reasons + ,OLimitedFormats(_rxFactory, FormComponentType::TIMEFIELD) { m_nClassId = FormComponentType::TIMEFIELD; m_sDataFieldConnectivityProperty = PROPERTY_TIME; if (OTimeModel::nTimeHandle == -1) OTimeModel::nTimeHandle = getOriginalHandle(PROPERTY_ID_TIME); + + setAggregateSet(m_xAggregateFastSet, getOriginalHandle(PROPERTY_ID_TIMEFORMAT)); +} + +//------------------------------------------------------------------------------ +OTimeModel::~OTimeModel() +{ + setAggregateSet(Reference< XFastPropertySet >(), -1); } //------------------------------------------------------------------------------ @@ -189,19 +203,18 @@ void OTimeModel::fillProperties( Sequence< Property >& _rProps, Sequence< Property >& _rAggregateProps ) const { - FRM_BEGIN_PROP_HELPER(9) - // starutil::Time auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TIME, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP2(BOUNDFIELD, XPropertySet, READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); + FRM_BEGIN_PROP_HELPER(11) + DECL_PROP1(NAME, ::rtl::OUString, BOUND); + DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); + DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); + DECL_PROP1(TAG, ::rtl::OUString, BOUND); + DECL_PROP1(TABINDEX, sal_Int16, BOUND); + DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); + DECL_IFACE_PROP2(BOUNDFIELD, XPropertySet, READONLY, TRANSIENT); + DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); + DECL_PROP2(CONTROLSOURCEPROPERTY, ::rtl::OUString, READONLY, TRANSIENT); + DECL_PROP0(FORMATKEY, sal_Int32); + DECL_IFACE_PROP1(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY); FRM_END_PROP_HELPER(); } @@ -211,6 +224,42 @@ void OTimeModel::fillProperties( return *const_cast<OTimeModel*>(this)->getArrayHelper(); } +//------------------------------------------------------------------------------ +void SAL_CALL OTimeModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle ) const +{ + switch (_nHandle) + { + case PROPERTY_ID_FORMATKEY: + getFormatKeyPropertyValue(_rValue); + break; + case PROPERTY_ID_FORMATSSUPPLIER: + _rValue <<= getFormatsSupplier(); + break; + default: + OEditBaseModel::getFastPropertyValue(_rValue, _nHandle); + break; + } +} + +//------------------------------------------------------------------------------ +sal_Bool SAL_CALL OTimeModel::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue, + sal_Int32 _nHandle, const Any& _rValue ) throw(IllegalArgumentException) +{ + if (PROPERTY_ID_FORMATKEY == _nHandle) + return convertFormatKeyPropertyValue(_rConvertedValue, _rOldValue, _rValue); + else + return OEditBaseModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OTimeModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) +{ + if (PROPERTY_ID_FORMATKEY == _nHandle) + setFormatKeyPropertyValue(_rValue); + else + OEditBaseModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); +} + // XLoadListener //------------------------------------------------------------------------------ void OTimeModel::_loaded(const EventObject& rEvent) @@ -301,7 +350,7 @@ void OTimeModel::_reset() aValue = m_aDefault; else { // aktuelles Datum einstellen - Time aCurrentTime; + ::Time aCurrentTime; aValue <<= (sal_Int32)aCurrentTime.GetTime(); } diff --git a/forms/source/component/Time.hxx b/forms/source/component/Time.hxx index 0393f8bc3f0e..415fbce2fce3 100644 --- a/forms/source/component/Time.hxx +++ b/forms/source/component/Time.hxx @@ -2,9 +2,9 @@ * * $RCSfile: Time.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-23 08:48:15 $ + * last change: $Author: fs $ $Date: 2001-05-18 14:44:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,9 @@ #ifndef _FORMS_EDITBASE_HXX_ #include "EditBase.hxx" #endif +#ifndef _FORMS_LIMITED_FORMATS_HXX_ +#include "limitedformats.hxx" +#endif //......................................................................... namespace frm @@ -76,6 +79,7 @@ namespace frm //================================================================== class OTimeModel :public OEditBaseModel + ,public OLimitedFormats ,public ::comphelper::OAggregationArrayUsageHelper< OTimeModel > { ::com::sun::star::uno::Any m_aSaveValue; @@ -88,6 +92,7 @@ protected: public: OTimeModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + ~OTimeModel(); // starform::XBoundComponent virtual sal_Bool _commit(); @@ -95,6 +100,13 @@ public: // stario::XPersistObject virtual ::rtl::OUString SAL_CALL getServiceName(); + // ::com::sun::star::beans::XPropertySet + 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); + // ::com::sun::star::lang::XServiceInfo IMPLEMENTATION_NAME(OTimeModel); virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); |