xref: /aoo4110/main/forms/source/component/Date.hxx (revision b1cdbd2c)
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() throw ( ::com::sun::star::uno::RuntimeException );
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 										throw(::com::sun::star::lang::IllegalArgumentException);
59 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
60 
61     // XServiceInfo
62 	IMPLEMENTATION_NAME(ODateModel);
63 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
64 
65     // XPropertySet
66     using OEditBaseModel::getFastPropertyValue;
67 
68     // OControlModel's property handling
69 	virtual void describeFixedProperties(
70 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
71     ) const;
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::Any
80                             translateControlValueToExternalValue( ) const;
81     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
82                             getSupportedBindingTypes();
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 
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_translateControlValueToUNODate(
104                                 ::com::sun::star::uno::Any& _rUNOValue ) const;
105 };
106 
107 //==================================================================
108 //= ODateControl
109 //==================================================================
110 class ODateControl: public OBoundControl
111 {
112 protected:
113 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
114 
115 public:
116 	ODateControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
117 	DECLARE_UNO3_AGG_DEFAULTS(ODateControl, OBoundControl);
118 
119 // ::com::sun::star::lang::XServiceInfo
120 	IMPLEMENTATION_NAME(ODateControl);
121 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
122 };
123 
124 //.........................................................................
125 }	// namespace frm
126 //.........................................................................
127 
128 #endif // _FORMS_DATE_HXX_
129 
130