Update ooo320-m1
[ooovba.git] / forms / source / component / Date.hxx
blob8d7de9d82be4b1d537d5063b5f96b51021a96700
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: Date.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_DATE_HXX_
32 #define _FORMS_DATE_HXX_
34 #include "EditBase.hxx"
35 #include "limitedformats.hxx"
37 //.........................................................................
38 namespace frm
40 //.........................................................................
42 //==================================================================
43 //= ODateModel
44 //==================================================================
45 class ODateModel
46 :public OEditBaseModel
47 ,public OLimitedFormats
49 ::com::sun::star::uno::Any m_aSaveValue;
50 sal_Bool m_bDateTimeField;
52 protected:
53 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
55 public:
56 DECLARE_DEFAULT_LEAF_XTOR( ODateModel );
58 // XPersistObject
59 virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException );
61 // ::com::sun::star::beans::XPropertySet
62 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
63 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
64 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
65 throw(::com::sun::star::lang::IllegalArgumentException);
66 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
68 // XServiceInfo
69 IMPLEMENTATION_NAME(ODateModel);
70 virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
72 // XPropertySet
73 using OEditBaseModel::getFastPropertyValue;
75 // OControlModel's property handling
76 virtual void describeFixedProperties(
77 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
78 ) const;
80 protected:
81 // OBoundControlModel overridables
82 virtual ::com::sun::star::uno::Any
83 translateDbColumnToControlValue( );
84 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
86 virtual ::com::sun::star::uno::Any
87 translateControlValueToExternalValue( ) const;
88 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
89 getSupportedBindingTypes();
90 virtual ::com::sun::star::uno::Any
91 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
93 virtual ::com::sun::star::uno::Any
94 translateControlValueToValidatableValue( ) const;
96 virtual ::com::sun::star::uno::Any
97 getDefaultForReset() const;
99 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
101 protected:
102 DECLARE_XCLONEABLE();
104 private:
105 /** translates the control value (the VCL-internal integer representation of a date) into
106 a UNO-Date.
108 void impl_translateControlValueToUNODate(
109 ::com::sun::star::uno::Any& _rUNOValue ) const;
112 //==================================================================
113 //= ODateControl
114 //==================================================================
115 class ODateControl: public OBoundControl
117 protected:
118 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
120 public:
121 ODateControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
122 DECLARE_UNO3_AGG_DEFAULTS(ODateControl, OBoundControl);
124 // ::com::sun::star::lang::XServiceInfo
125 IMPLEMENTATION_NAME(ODateControl);
126 virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
129 //.........................................................................
130 } // namespace frm
131 //.........................................................................
133 #endif // _FORMS_DATE_HXX_