xref: /aoo41x/main/forms/source/component/Time.hxx (revision 2d785d7e)
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() throw ( ::com::sun::star::uno::RuntimeException);
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 										throw(::com::sun::star::lang::IllegalArgumentException);
60 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
61 
62 	// ::com::sun::star::lang::XServiceInfo
63 	IMPLEMENTATION_NAME(OTimeModel);
64 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
65 
66     // OControlModel's property handling
67 	virtual void describeFixedProperties(
68 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
69     ) const;
70 
71     // prevent method hiding
72     using OBoundControlModel::getFastPropertyValue;
73 
74 protected:
75     // OBoundControlModel overridables
76     virtual ::com::sun::star::uno::Any
77                             translateDbColumnToControlValue( );
78     virtual sal_Bool        commitControlValueToDbColumn( bool _bPostReset );
79 
80     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
81                             getSupportedBindingTypes();
82     virtual ::com::sun::star::uno::Any
83                             translateControlValueToExternalValue( ) const;
84     virtual ::com::sun::star::uno::Any
85                             translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
86 
87     virtual ::com::sun::star::uno::Any
88                             translateControlValueToValidatableValue( ) const;
89 
90     virtual ::com::sun::star::uno::Any
91                             getDefaultForReset() const;
92 	virtual void            resetNoBroadcast();
93 
94 	virtual void		    onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
95 
96 protected:
97     DECLARE_XCLONEABLE();
98 
99 private:
100     /** translates the control value (the VCL-internal integer representation of a date) into
101         a UNO-Date.
102     */
103     void                    impl_translateControlValueToUNOTime(
104                                 ::com::sun::star::uno::Any& _rUNOValue ) const;
105 };
106 
107 //==================================================================
108 //= OTimeControl
109 //==================================================================
110 class OTimeControl: public OBoundControl
111 {
112 protected:
113 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
114 
115 public:
116 	OTimeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
117 	DECLARE_UNO3_AGG_DEFAULTS(OTimeControl, OBoundControl);
118 
119 	// ::com::sun::star::lang::XServiceInfo
120 	IMPLEMENTATION_NAME(OTimeControl);
121 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
122 };
123 
124 //.........................................................................
125 }	// namespace frm
126 //.........................................................................
127 
128 #endif // _FORMS_TIME_HXX_
129 
130