xref: /trunk/main/forms/source/xforms/datatypes.hxx (revision 07a3d7f1)
12d785d7eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32d785d7eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42d785d7eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52d785d7eSAndrew Rist  * distributed with this work for additional information
62d785d7eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72d785d7eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
82d785d7eSAndrew Rist  * "License"); you may not use this file except in compliance
92d785d7eSAndrew Rist  * with the License.  You may obtain a copy of the License at
102d785d7eSAndrew Rist  *
112d785d7eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122d785d7eSAndrew Rist  *
132d785d7eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
142d785d7eSAndrew Rist  * software distributed under the License is distributed on an
152d785d7eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162d785d7eSAndrew Rist  * KIND, either express or implied.  See the License for the
172d785d7eSAndrew Rist  * specific language governing permissions and limitations
182d785d7eSAndrew Rist  * under the License.
192d785d7eSAndrew Rist  *
202d785d7eSAndrew Rist  *************************************************************/
212d785d7eSAndrew Rist 
222d785d7eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef FORMS_SOURCE_XFORMS_DATATYPES_HXX
25cdf0e10cSrcweir #define FORMS_SOURCE_XFORMS_DATATYPES_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /** === begin UNO includes === **/
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
29cdf0e10cSrcweir #include <com/sun/star/util/Date.hpp>
30cdf0e10cSrcweir #include <com/sun/star/util/Time.hpp>
31cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
32cdf0e10cSrcweir #include <com/sun/star/xsd/XDataType.hpp>
33cdf0e10cSrcweir #include <com/sun/star/xsd/DataTypeClass.hpp>
34cdf0e10cSrcweir /** === end UNO includes === **/
35cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
36cdf0e10cSrcweir #include <comphelper/uno3.hxx>
37cdf0e10cSrcweir #include <comphelper/propertycontainer.hxx>
38cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx>
39cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
40cdf0e10cSrcweir #include "warnings_guard_unicode_regex.h"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <memory>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //........................................................................
45cdf0e10cSrcweir namespace xforms
46cdf0e10cSrcweir {
47cdf0e10cSrcweir //........................................................................
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	//====================================================================
50cdf0e10cSrcweir 	//= OXSDDataType
51cdf0e10cSrcweir 	//====================================================================
52cdf0e10cSrcweir     typedef ::cppu::WeakImplHelper1             <   ::com::sun::star::xsd::XDataType
53cdf0e10cSrcweir                                                 >   OXSDDataType_Base;
54cdf0e10cSrcweir     typedef ::comphelper::OMutexAndBroadcastHelper  OXSDDataType_BBase;
55cdf0e10cSrcweir     typedef ::comphelper::OPropertyContainer        OXSDDataType_PBase;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     class OXSDDataType  :public OXSDDataType_Base
58cdf0e10cSrcweir                         ,public OXSDDataType_BBase         // order matters: OMutexAndBroadcastHelper before
59cdf0e10cSrcweir                         ,public OXSDDataType_PBase         // OPropertyContainer
60cdf0e10cSrcweir     {
61cdf0e10cSrcweir     private:
62cdf0e10cSrcweir         // <properties>
63cdf0e10cSrcweir         sal_Bool        m_bIsBasic;
64cdf0e10cSrcweir         sal_Int16       m_nTypeClass;
65cdf0e10cSrcweir         ::rtl::OUString m_sName;
66cdf0e10cSrcweir         ::rtl::OUString m_sPattern;
67cdf0e10cSrcweir         sal_uInt16      m_nWST;
68cdf0e10cSrcweir         // </properties>
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         ::std::auto_ptr< U_NAMESPACE_QUALIFIER RegexMatcher >
71cdf0e10cSrcweir                         m_pPatternMatcher;
72cdf0e10cSrcweir         bool            m_bPatternMatcherDirty;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     protected:
75cdf0e10cSrcweir 
isBasic() const76cdf0e10cSrcweir         sal_Bool    isBasic() const         { return m_bIsBasic; }
getTypeClass() const77cdf0e10cSrcweir         sal_Int16   getTypeClass() const    { return m_nTypeClass; }
78cdf0e10cSrcweir         const ::rtl::OUString&
getName() const79cdf0e10cSrcweir                     getName() const         { return m_sName; }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     private:
82cdf0e10cSrcweir         OXSDDataType( );                                    // never implemented
83cdf0e10cSrcweir         OXSDDataType( const OXSDDataType& );                // never implemented
84cdf0e10cSrcweir         OXSDDataType& operator=( const OXSDDataType& );     // never implemented
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     protected:
87cdf0e10cSrcweir         // create basic data type
88cdf0e10cSrcweir         OXSDDataType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass );
89cdf0e10cSrcweir         ~OXSDDataType();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     public:
92cdf0e10cSrcweir         DECLARE_XINTERFACE()
93cdf0e10cSrcweir         DECLARE_XTYPEPROVIDER()
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getName(  ) throw (::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir         virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::util::VetoException);
97cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getPattern() throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir         virtual void SAL_CALL setPattern( const ::rtl::OUString& _pattern ) throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir         virtual sal_Int16 SAL_CALL getWhiteSpaceTreatment() throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir         virtual void SAL_CALL setWhiteSpaceTreatment( sal_Int16 _whitespacetreatment ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
101cdf0e10cSrcweir         virtual sal_Bool SAL_CALL getIsBasic() throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir         virtual sal_Int16 SAL_CALL getTypeClass() throw (::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir         virtual sal_Bool SAL_CALL validate( const ::rtl::OUString& value ) throw (::com::sun::star::uno::RuntimeException);
105cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL explainInvalid( const ::rtl::OUString& value ) throw (::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         // XPropertySet - is a base of XDataType and needs to be disambiguated
108cdf0e10cSrcweir         virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir         virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir         virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
112cdf0e10cSrcweir         virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
113cdf0e10cSrcweir         virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     public:
116cdf0e10cSrcweir         OXSDDataType* clone( const ::rtl::OUString& _rNewName ) const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     protected:
119cdf0e10cSrcweir         // XPropertySet and friends
120cdf0e10cSrcweir 	    virtual sal_Bool SAL_CALL   convertFastPropertyValue( ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
121cdf0e10cSrcweir 	    virtual void SAL_CALL       setFastPropertyValue_NoBroadcast(
122cdf0e10cSrcweir 							            sal_Int32 nHandle,
123cdf0e10cSrcweir 							            const ::com::sun::star::uno::Any& rValue
124cdf0e10cSrcweir                                     )
125cdf0e10cSrcweir                                     throw (::com::sun::star::uno::Exception);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir         // --- own overridables ---
128cdf0e10cSrcweir         // helper for implementing cloning of data types
129cdf0e10cSrcweir         virtual OXSDDataType*   createClone( const ::rtl::OUString& _rName ) const = 0;
130cdf0e10cSrcweir         virtual void            initializeClone( const OXSDDataType& _rCloneSource );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir         // helper method for validate and explainInvalid
133cdf0e10cSrcweir         virtual sal_uInt16  _validate( const ::rtl::OUString& value );
134cdf0e10cSrcweir         virtual ::rtl::OUString _explainInvalid( sal_uInt16 nReason );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         // helper method for checking properties values which are to be set
137cdf0e10cSrcweir         virtual bool        checkPropertySanity( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rNewValue, ::rtl::OUString& _rErrorMessage );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         // register properties implemented by this instance - call the base class when overriding
140cdf0e10cSrcweir         virtual void        registerProperties();
141cdf0e10cSrcweir     };
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	//====================================================================
144cdf0e10cSrcweir 	//= helper for deriving from OXSDDataType
145cdf0e10cSrcweir 	//====================================================================
146cdf0e10cSrcweir #define DECLARE_DEFAULT_CLONING( classname )        \
147cdf0e10cSrcweir     virtual OXSDDataType* createClone( const ::rtl::OUString& _rName ) const;    \
148cdf0e10cSrcweir     virtual void       initializeClone( const OXSDDataType& _rCloneSource ); \
149cdf0e10cSrcweir             void       initializeTypedClone( const classname& _rCloneSource );
150cdf0e10cSrcweir 
151cdf0e10cSrcweir #define IMPLEMENT_DEFAULT_CLONING( classname, baseclass )   \
152cdf0e10cSrcweir     OXSDDataType* classname::createClone( const ::rtl::OUString& _rName ) const              \
153cdf0e10cSrcweir     {                                                       \
154cdf0e10cSrcweir         return new classname( _rName );                     \
155cdf0e10cSrcweir     }                                                       \
156cdf0e10cSrcweir     void classname::initializeClone( const OXSDDataType& _rCloneSource ) \
157cdf0e10cSrcweir     { \
158cdf0e10cSrcweir         baseclass::initializeClone( _rCloneSource );        \
159cdf0e10cSrcweir         initializeTypedClone( static_cast< const classname& >( _rCloneSource ) ); \
160cdf0e10cSrcweir     } \
161cdf0e10cSrcweir 
162cdf0e10cSrcweir #define IMPLEMENT_DEFAULT_TYPED_CLONING( classname, baseclass )   \
163cdf0e10cSrcweir     OXSDDataType* classname::createClone( const ::rtl::OUString& _rName ) const              \
164cdf0e10cSrcweir     {                                                       \
165cdf0e10cSrcweir         return new classname( _rName, getTypeClass() );     \
166cdf0e10cSrcweir     }                                                       \
167cdf0e10cSrcweir     void classname::initializeClone( const OXSDDataType& _rCloneSource ) \
168cdf0e10cSrcweir     { \
169cdf0e10cSrcweir         baseclass::initializeClone( _rCloneSource );        \
170cdf0e10cSrcweir         initializeTypedClone( static_cast< const classname& >( _rCloneSource ) ); \
171cdf0e10cSrcweir     } \
172cdf0e10cSrcweir 
173cdf0e10cSrcweir #define REGISTER_VOID_PROP( prop, memberAny, type ) \
174cdf0e10cSrcweir     registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, ::com::sun::star::beans::PropertyAttribute::BOUND | ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, \
175cdf0e10cSrcweir         &memberAny, ::getCppuType( static_cast< type* >( NULL ) ) );
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     //====================================================================
178cdf0e10cSrcweir 	//= OValueLimitedType_Base
179cdf0e10cSrcweir 	//====================================================================
180cdf0e10cSrcweir     class OValueLimitedType_Base : public OXSDDataType
181cdf0e10cSrcweir     {
182cdf0e10cSrcweir     protected:
183cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMaxInclusive;
184cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMaxExclusive;
185cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMinInclusive;
186cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMinExclusive;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir         double  m_fCachedMaxInclusive;
189cdf0e10cSrcweir         double  m_fCachedMaxExclusive;
190cdf0e10cSrcweir         double  m_fCachedMinInclusive;
191cdf0e10cSrcweir         double  m_fCachedMinExclusive;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     protected:
194cdf0e10cSrcweir         OValueLimitedType_Base( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir         virtual void       initializeClone( const OXSDDataType& _rCloneSource );
197cdf0e10cSrcweir                 void       initializeTypedClone( const OValueLimitedType_Base& _rCloneSource );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir         // XPropertySet and friends
200cdf0e10cSrcweir         virtual void SAL_CALL       setFastPropertyValue_NoBroadcast(
201cdf0e10cSrcweir 							            sal_Int32 nHandle,
202cdf0e10cSrcweir 							            const ::com::sun::star::uno::Any& rValue
203cdf0e10cSrcweir                                     )
204cdf0e10cSrcweir                                     throw (::com::sun::star::uno::Exception);
205cdf0e10cSrcweir 
206cdf0e10cSrcweir         // OXSDDataType overridables
207cdf0e10cSrcweir         virtual bool            _getValue( const ::rtl::OUString& value, double& fValue );
208cdf0e10cSrcweir         virtual sal_uInt16      _validate( const ::rtl::OUString& value );
209cdf0e10cSrcweir         virtual ::rtl::OUString _explainInvalid( sal_uInt16 nReason );
210cdf0e10cSrcweir 
211cdf0e10cSrcweir         // own overridables
212cdf0e10cSrcweir         /** translate a given value into a human-readable string
213cdf0e10cSrcweir 
214cdf0e10cSrcweir             The value is guaranteed to be not <NULL/>, and is of type <member>ValueType</member>
215cdf0e10cSrcweir         */
216cdf0e10cSrcweir         virtual ::rtl::OUString typedValueAsHumanReadableString( const ::com::sun::star::uno::Any& _rValue ) const = 0;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir         /** translates a <member>ValueType</member> value into a double value
219cdf0e10cSrcweir 
220cdf0e10cSrcweir             The normalization must respect the "<" and "==" relations on the value
221cdf0e10cSrcweir             space. That is, if two values are equal, their normalizations must be equal, too.
222*07a3d7f1SPedro Giffuni             Similarly, if <code>foo</code> is less than <code>bar</code>, the same
223cdf0e10cSrcweir             must hold for their normalizations.
224cdf0e10cSrcweir 
225cdf0e10cSrcweir             @param _rValue
226*07a3d7f1SPedro Giffuni                 the value to translate. Guaranteed to be not <NULL/>, and of type <member>ValueType</member>
227cdf0e10cSrcweir             @param _rDoubleValue
228cdf0e10cSrcweir                 output parameter to hold the resulting double value
229cdf0e10cSrcweir         */
230cdf0e10cSrcweir         virtual void normalizeValue( const ::com::sun::star::uno::Any& _rValue, double& _rDoubleValue ) const = 0;
231cdf0e10cSrcweir     };
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     //====================================================================
234cdf0e10cSrcweir 	//= OValueLimitedType
235cdf0e10cSrcweir 	//====================================================================
236cdf0e10cSrcweir     template < typename VALUE_TYPE >
237cdf0e10cSrcweir     class OValueLimitedType : public OValueLimitedType_Base
238cdf0e10cSrcweir     {
239cdf0e10cSrcweir     protected:
240cdf0e10cSrcweir         typedef     VALUE_TYPE  ValueType;
241cdf0e10cSrcweir         inline const ::com::sun::star::uno::Type&
getCppuType() const242cdf0e10cSrcweir             getCppuType() const { return ::getCppuType( static_cast< ValueType* >( NULL ) ); }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     protected:
245cdf0e10cSrcweir         OValueLimitedType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir         // OXSDDataType overridables
248cdf0e10cSrcweir         virtual void            registerProperties();
249cdf0e10cSrcweir     };
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	//====================================================================
252cdf0e10cSrcweir 	//= ODerivedDataType
253cdf0e10cSrcweir 	//====================================================================
254cdf0e10cSrcweir     /** helper class for implementing interfaces derived from XDataType
255cdf0e10cSrcweir     */
256cdf0e10cSrcweir     template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS = OXSDDataType >
257cdf0e10cSrcweir     class ODerivedDataType  :public SUPERCLASS
258cdf0e10cSrcweir                             ,::comphelper::OPropertyArrayUsageHelper< CONCRETE_DATA_TYPE_IMPL >
259cdf0e10cSrcweir     {
260cdf0e10cSrcweir     private:
261cdf0e10cSrcweir         bool    m_bPropertiesRegistered;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir     protected:
264cdf0e10cSrcweir         ODerivedDataType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass );
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     protected:
267cdf0e10cSrcweir 		// OPropertyArrayUsageHelper
268cdf0e10cSrcweir 		virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 		// XPropertySet
271cdf0e10cSrcweir 		virtual com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException);
272cdf0e10cSrcweir 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
273cdf0e10cSrcweir     };
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     //====================================================================
276cdf0e10cSrcweir 	//= OBooleanType
277cdf0e10cSrcweir 	//====================================================================
278cdf0e10cSrcweir     class OBooleanType;
279cdf0e10cSrcweir     typedef ODerivedDataType< OBooleanType > OBooleanType_Base;
280cdf0e10cSrcweir     class OBooleanType : public OBooleanType_Base
281cdf0e10cSrcweir     {
282cdf0e10cSrcweir     public:
283cdf0e10cSrcweir         OBooleanType( const ::rtl::OUString& _rName );
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     protected:
286cdf0e10cSrcweir         DECLARE_DEFAULT_CLONING( OBooleanType )
287cdf0e10cSrcweir 
288cdf0e10cSrcweir         // OXSDDataType overridables
289cdf0e10cSrcweir         virtual sal_uInt16      _validate( const ::rtl::OUString& value );
290cdf0e10cSrcweir         virtual ::rtl::OUString _explainInvalid( sal_uInt16 nReason );
291cdf0e10cSrcweir     };
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	//====================================================================
294cdf0e10cSrcweir 	//= OStringType
295cdf0e10cSrcweir 	//====================================================================
296cdf0e10cSrcweir     class OStringType;
297cdf0e10cSrcweir     typedef ODerivedDataType< OStringType > OStringType_Base;
298cdf0e10cSrcweir     class OStringType   :public OStringType_Base
299cdf0e10cSrcweir     {
300cdf0e10cSrcweir     protected:
301cdf0e10cSrcweir         // <properties>
302cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aLength;
303cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMinLength;
304cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aMaxLength;
305cdf0e10cSrcweir         // </properties>
306cdf0e10cSrcweir 
307cdf0e10cSrcweir     public:
308cdf0e10cSrcweir         OStringType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass /* = ::com::sun::star::xsd::DataTypeClass::STRING */ );
309cdf0e10cSrcweir 
310cdf0e10cSrcweir     protected:
311cdf0e10cSrcweir         DECLARE_DEFAULT_CLONING( OStringType )
312cdf0e10cSrcweir 
313cdf0e10cSrcweir         // OXSDDataType overridables
314cdf0e10cSrcweir         virtual sal_uInt16      _validate( const ::rtl::OUString& value );
315cdf0e10cSrcweir         virtual ::rtl::OUString _explainInvalid( sal_uInt16 nReason );
316cdf0e10cSrcweir         virtual bool            checkPropertySanity( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rNewValue, ::rtl::OUString& _rErrorMessage );
317cdf0e10cSrcweir         virtual void            registerProperties();
318cdf0e10cSrcweir     };
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	//====================================================================
321cdf0e10cSrcweir 	//= ODecimalType
322cdf0e10cSrcweir 	//====================================================================
323cdf0e10cSrcweir     class ODecimalType;
324cdf0e10cSrcweir     typedef ODerivedDataType< ODecimalType, OValueLimitedType< double > > ODecimalType_Base;
325cdf0e10cSrcweir     class ODecimalType : public ODecimalType_Base
326cdf0e10cSrcweir     {
327cdf0e10cSrcweir     protected:
328cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aTotalDigits;
329cdf0e10cSrcweir         ::com::sun::star::uno::Any m_aFractionDigits;
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     public:
332cdf0e10cSrcweir         ODecimalType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass /* = ::com::sun::star::xsd::DataTypeClass::DECIMAL */ );
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     protected:
335cdf0e10cSrcweir         DECLARE_DEFAULT_CLONING( ODecimalType )
336cdf0e10cSrcweir 
337cdf0e10cSrcweir         // OXSDDataType overridables
338cdf0e10cSrcweir         virtual sal_uInt16      _validate( const ::rtl::OUString& value );
339cdf0e10cSrcweir         virtual ::rtl::OUString _explainInvalid( sal_uInt16 nReason );
340cdf0e10cSrcweir         virtual void            registerProperties();
341cdf0e10cSrcweir 
342cdf0e10cSrcweir         // OValueLimitedType overridables
343cdf0e10cSrcweir         virtual ::rtl::OUString typedValueAsHumanReadableString( const ::com::sun::star::uno::Any& _rValue ) const;
344cdf0e10cSrcweir         virtual void normalizeValue( const ::com::sun::star::uno::Any& _rValue, double& _rDoubleValue ) const;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     private:
347cdf0e10cSrcweir         using ODecimalType_Base::initializeTypedClone;
348cdf0e10cSrcweir     };
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 	//====================================================================
351cdf0e10cSrcweir 	//=
352cdf0e10cSrcweir 	//====================================================================
353cdf0e10cSrcweir #define DEFAULT_DECLARE_SUBTYPE( classname, valuetype )         \
354cdf0e10cSrcweir     class classname;                                            \
355cdf0e10cSrcweir     typedef ODerivedDataType< classname, OValueLimitedType< valuetype > > classname##_Base;  \
356cdf0e10cSrcweir     class classname : public classname##_Base                   \
357cdf0e10cSrcweir     {                                                           \
358cdf0e10cSrcweir     public:                                                     \
359cdf0e10cSrcweir         classname( const ::rtl::OUString& _rName );             \
360cdf0e10cSrcweir                                                                 \
361cdf0e10cSrcweir     protected:                                                  \
362cdf0e10cSrcweir         DECLARE_DEFAULT_CLONING( classname )                    \
363cdf0e10cSrcweir                                                                 \
364cdf0e10cSrcweir         /* OXSDDataType overridables */                         \
365cdf0e10cSrcweir         virtual sal_uInt16          _validate( const ::rtl::OUString& value );  \
366cdf0e10cSrcweir         virtual bool                _getValue( const ::rtl::OUString& value, double& fValue );  \
367cdf0e10cSrcweir                                                                 \
368cdf0e10cSrcweir         /* OValueLimitedType overridables */                    \
369cdf0e10cSrcweir         virtual ::rtl::OUString     typedValueAsHumanReadableString( const ::com::sun::star::uno::Any& _rValue ) const;  \
370cdf0e10cSrcweir         virtual void normalizeValue( const ::com::sun::star::uno::Any& _rValue, double& _rDoubleValue ) const; \
371cdf0e10cSrcweir                                                                 \
372cdf0e10cSrcweir     private:                                                    \
373cdf0e10cSrcweir         using classname##_Base::initializeTypedClone;          \
374cdf0e10cSrcweir     };
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 	//====================================================================
377cdf0e10cSrcweir 	//= ODateType
378cdf0e10cSrcweir 	//====================================================================
379cdf0e10cSrcweir     DEFAULT_DECLARE_SUBTYPE( ODateType, ::com::sun::star::util::Date )
380cdf0e10cSrcweir 
381cdf0e10cSrcweir     //====================================================================
382cdf0e10cSrcweir 	//= OTimeType
383cdf0e10cSrcweir 	//====================================================================
384cdf0e10cSrcweir     DEFAULT_DECLARE_SUBTYPE( OTimeType, ::com::sun::star::util::Time )
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     //====================================================================
387cdf0e10cSrcweir 	//= ODateTimeType
388cdf0e10cSrcweir 	//====================================================================
389cdf0e10cSrcweir     DEFAULT_DECLARE_SUBTYPE( ODateTimeType, ::com::sun::star::util::DateTime )
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     //====================================================================
392cdf0e10cSrcweir 	//= OShortIntegerType
393cdf0e10cSrcweir 	//====================================================================
394cdf0e10cSrcweir     class OShortIntegerType;
395cdf0e10cSrcweir     typedef ODerivedDataType< OShortIntegerType, OValueLimitedType< sal_Int16 > > OShortIntegerType_Base;
396cdf0e10cSrcweir     class OShortIntegerType : public OShortIntegerType_Base
397cdf0e10cSrcweir     {
398cdf0e10cSrcweir     public:
399cdf0e10cSrcweir         OShortIntegerType( const ::rtl::OUString& _rName, sal_Int16 _nTypeClass );
400cdf0e10cSrcweir 
401cdf0e10cSrcweir     protected:
402cdf0e10cSrcweir         DECLARE_DEFAULT_CLONING( OShortIntegerType )
403cdf0e10cSrcweir 
404cdf0e10cSrcweir         // OXSDDataType overridables
405cdf0e10cSrcweir         virtual bool            _getValue( const ::rtl::OUString& value, double& fValue );
406cdf0e10cSrcweir 
407cdf0e10cSrcweir         // OValueLimitedType overridables
408cdf0e10cSrcweir         virtual ::rtl::OUString typedValueAsHumanReadableString( const ::com::sun::star::uno::Any& _rValue ) const;
409cdf0e10cSrcweir         virtual void normalizeValue( const ::com::sun::star::uno::Any& _rValue, double& _rDoubleValue ) const;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir     private:
412cdf0e10cSrcweir         using OShortIntegerType_Base::initializeTypedClone;
413cdf0e10cSrcweir     };
414cdf0e10cSrcweir 
415cdf0e10cSrcweir //........................................................................
416cdf0e10cSrcweir } // namespace xforms
417cdf0e10cSrcweir //........................................................................
418cdf0e10cSrcweir 
419cdf0e10cSrcweir #endif // FORMS_SOURCE_XFORMS_DATATYPES_HXX
420cdf0e10cSrcweir 
421