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_TIME_HXX_ 25 #define _FORMS_TIME_HXX_ 26 27 #include "EditBase.hxx" 28 #include "limitedformats.hxx" 29 30 //......................................................................... 31 namespace frm 32 { 33 //......................................................................... 34 35 //================================================================== 36 //= OTimeModel 37 //================================================================== 38 class OTimeModel 39 :public OEditBaseModel 40 ,public OLimitedFormats 41 { 42 private: 43 ::com::sun::star::uno::Any m_aSaveValue; 44 sal_Bool m_bDateTimeField; 45 46 protected: 47 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 48 49 public: 50 DECLARE_DEFAULT_LEAF_XTOR( OTimeModel ); 51 52 // stario::XPersistObject 53 virtual ::rtl::OUString SAL_CALL getServiceName(); 54 55 // ::com::sun::star::beans::XPropertySet 56 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 57 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, 58 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ); 59 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue); 60 61 // ::com::sun::star::lang::XServiceInfo 62 IMPLEMENTATION_NAME(OTimeModel); 63 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 64 65 // OControlModel's property handling 66 virtual void describeFixedProperties( 67 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps 68 ) const; 69 70 // prevent method hiding 71 using OBoundControlModel::getFastPropertyValue; 72 73 protected: 74 // OBoundControlModel overridables 75 virtual ::com::sun::star::uno::Any 76 translateDbColumnToControlValue( ); 77 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); 78 79 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 80 getSupportedBindingTypes(); 81 virtual ::com::sun::star::uno::Any 82 translateControlValueToExternalValue( ) const; 83 virtual ::com::sun::star::uno::Any 84 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const; 85 86 virtual ::com::sun::star::uno::Any 87 translateControlValueToValidatableValue( ) const; 88 89 virtual ::com::sun::star::uno::Any 90 getDefaultForReset() const; 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_translateControlValueToUNOTime( 103 ::com::sun::star::uno::Any& _rUNOValue ) const; 104 }; 105 106 //================================================================== 107 //= OTimeControl 108 //================================================================== 109 class OTimeControl: public OBoundControl 110 { 111 protected: 112 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 113 114 public: 115 OTimeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); 116 DECLARE_UNO3_AGG_DEFAULTS(OTimeControl, OBoundControl); 117 118 // ::com::sun::star::lang::XServiceInfo 119 IMPLEMENTATION_NAME(OTimeControl); 120 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 121 }; 122 123 //......................................................................... 124 } // namespace frm 125 //......................................................................... 126 127 #endif // _FORMS_TIME_HXX_ 128