1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _FORMS_TIME_HXX_ 29 #define _FORMS_TIME_HXX_ 30 31 #include "EditBase.hxx" 32 #include "limitedformats.hxx" 33 34 //......................................................................... 35 namespace frm 36 { 37 //......................................................................... 38 39 //================================================================== 40 //= OTimeModel 41 //================================================================== 42 class OTimeModel 43 :public OEditBaseModel 44 ,public OLimitedFormats 45 { 46 private: 47 ::com::sun::star::uno::Any m_aSaveValue; 48 sal_Bool m_bDateTimeField; 49 50 protected: 51 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 52 53 public: 54 DECLARE_DEFAULT_LEAF_XTOR( OTimeModel ); 55 56 // stario::XPersistObject 57 virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); 58 59 // ::com::sun::star::beans::XPropertySet 60 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 61 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, 62 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 63 throw(::com::sun::star::lang::IllegalArgumentException); 64 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); 65 66 // ::com::sun::star::lang::XServiceInfo 67 IMPLEMENTATION_NAME(OTimeModel); 68 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 69 70 // OControlModel's property handling 71 virtual void describeFixedProperties( 72 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps 73 ) const; 74 75 // prevent method hiding 76 using OBoundControlModel::getFastPropertyValue; 77 78 protected: 79 // OBoundControlModel overridables 80 virtual ::com::sun::star::uno::Any 81 translateDbColumnToControlValue( ); 82 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); 83 84 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 85 getSupportedBindingTypes(); 86 virtual ::com::sun::star::uno::Any 87 translateControlValueToExternalValue( ) const; 88 virtual ::com::sun::star::uno::Any 89 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const; 90 91 virtual ::com::sun::star::uno::Any 92 translateControlValueToValidatableValue( ) const; 93 94 virtual ::com::sun::star::uno::Any 95 getDefaultForReset() const; 96 virtual void resetNoBroadcast(); 97 98 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); 99 100 protected: 101 DECLARE_XCLONEABLE(); 102 103 private: 104 /** translates the control value (the VCL-internal integer representation of a date) into 105 a UNO-Date. 106 */ 107 void impl_translateControlValueToUNOTime( 108 ::com::sun::star::uno::Any& _rUNOValue ) const; 109 }; 110 111 //================================================================== 112 //= OTimeControl 113 //================================================================== 114 class OTimeControl: public OBoundControl 115 { 116 protected: 117 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); 118 119 public: 120 OTimeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); 121 DECLARE_UNO3_AGG_DEFAULTS(OTimeControl, OBoundControl); 122 123 // ::com::sun::star::lang::XServiceInfo 124 IMPLEMENTATION_NAME(OTimeControl); 125 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); 126 }; 127 128 //......................................................................... 129 } // namespace frm 130 //......................................................................... 131 132 #endif // _FORMS_TIME_HXX_ 133 134