1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _FORMS_DATE_HXX_ 25 #define _FORMS_DATE_HXX_ 26 27 #include "EditBase.hxx" 28 #include "limitedformats.hxx" 29 30 //......................................................................... 31 namespace frm 32 { 33 //......................................................................... 34 35 //================================================================== 36 //= ODateModel 37 //================================================================== 38 class ODateModel 39 :public OEditBaseModel 40 ,public OLimitedFormats 41 { 42 ::com::sun::star::uno::Any m_aSaveValue; 43 sal_Bool m_bDateTimeField; 44 45 protected: 46 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 47 48 public: 49 DECLARE_DEFAULT_LEAF_XTOR( ODateModel ); 50 51 // XPersistObject 52 virtual ::rtl::OUString SAL_CALL getServiceName(); 53 54 // ::com::sun::star::beans::XPropertySet 55 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 56 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, 57 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ); 58 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue); 59 60 // XServiceInfo 61 IMPLEMENTATION_NAME(ODateModel); 62 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 63 64 // XPropertySet 65 using OEditBaseModel::getFastPropertyValue; 66 67 // OControlModel's property handling 68 virtual void describeFixedProperties( 69 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps 70 ) const; 71 72 protected: 73 // OBoundControlModel overridables 74 virtual ::com::sun::star::uno::Any 75 translateDbColumnToControlValue( ); 76 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); 77 78 virtual ::com::sun::star::uno::Any 79 translateControlValueToExternalValue( ) const; 80 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 81 getSupportedBindingTypes(); 82 virtual ::com::sun::star::uno::Any 83 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const; 84 85 virtual ::com::sun::star::uno::Any 86 translateControlValueToValidatableValue( ) const; 87 88 virtual ::com::sun::star::uno::Any 89 getDefaultForReset() const; 90 91 virtual void resetNoBroadcast(); 92 93 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); 94 95 protected: 96 DECLARE_XCLONEABLE(); 97 98 private: 99 /** translates the control value (the VCL-internal integer representation of a date) into 100 a UNO-Date. 101 */ 102 void impl_translateControlValueToUNODate( 103 ::com::sun::star::uno::Any& _rUNOValue ) const; 104 }; 105 106 //================================================================== 107 //= ODateControl 108 //================================================================== 109 class ODateControl: public OBoundControl 110 { 111 protected: 112 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 113 114 public: 115 ODateControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); 116 DECLARE_UNO3_AGG_DEFAULTS(ODateControl, OBoundControl); 117 118 // ::com::sun::star::lang::XServiceInfo 119 IMPLEMENTATION_NAME(ODateControl); 120 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 121 }; 122 123 //......................................................................... 124 } // namespace frm 125 //......................................................................... 126 127 #endif // _FORMS_DATE_HXX_ 128