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