summaryrefslogtreecommitdiffstats
path: root/forms/source/xforms/datatypes.cxx
blob: 91cb67efcf9f13a749f5e5acf1fce107d45380a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <memory>
#include "datatypes.hxx"
#include "resourcehelper.hxx"
#include <frm_strings.hxx>
#include <property.hxx>
#include <strings.hrc>
#include "convert.hxx"
#include <comphelper/processfactory.hxx>

#include <com/sun/star/xsd/DataTypeClass.hpp>
#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
#include <o3tl/string_view.hxx>
#include <tools/datetime.hxx>
#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <utility>


namespace xforms
{


    using ::com::sun::star::uno::Reference;
    using ::com::sun::star::uno::Any;
    using ::com::sun::star::util::Date;
    using ::com::sun::star::util::Time;
    using ::com::sun::star::util::DateTime;
    using ::com::sun::star::lang::IllegalArgumentException;
    using ::com::sun::star::beans::XPropertyChangeListener;
    using ::com::sun::star::beans::XVetoableChangeListener;

    using ::com::sun::star::beans::PropertyAttribute::BOUND;
    using ::com::sun::star::beans::PropertyAttribute::READONLY;

    using namespace ::com::sun::star::xsd;
    using namespace ::frm;
    U_NAMESPACE_USE

    OXSDDataType::OXSDDataType( OUString _aName, sal_Int16 _nTypeClass )
        :m_bIsBasic( true )
        ,m_nTypeClass( _nTypeClass )
        ,m_sName(std::move( _aName ))
        ,m_nWST( WhiteSpaceTreatment::Preserve )
        ,m_bPatternMatcherDirty( true )
    {
    }


    OXSDDataType::~OXSDDataType()
    {
    }


    void OXSDDataType::registerProperties()
    {
        registerProperty( PROPERTY_NAME,            PROPERTY_ID_NAME,           BOUND, &m_sName,    cppu::UnoType<decltype(m_sName)>::get() );
        registerProperty( PROPERTY_XSD_WHITESPACE,  PROPERTY_ID_XSD_WHITESPACE, BOUND, &m_nWST,     cppu::UnoType<cppu::UnoUnsignedShortType>::get() );
        registerProperty( PROPERTY_XSD_PATTERN,     PROPERTY_ID_XSD_PATTERN,    BOUND, &m_sPattern, cppu::UnoType<decltype(m_sPattern)>::get() );

        registerProperty( PROPERTY_XSD_IS_BASIC,    PROPERTY_ID_XSD_IS_BASIC,   READONLY, &m_bIsBasic,      cppu::UnoType<decltype(m_bIsBasic)>::get() );
        registerProperty( PROPERTY_XSD_TYPE_CLASS,  PROPERTY_ID_XSD_TYPE_CLASS, READONLY, &m_nTypeClass,    cppu::UnoType<decltype(m_nTypeClass)>::get() );
    }


    void OXSDDataType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        m_bIsBasic   = false;
        m_nTypeClass = _rCloneSource.m_nTypeClass;
        m_sPattern   = _rCloneSource.m_sPattern;
        m_nWST       = _rCloneSource.m_nWST;
    }


    rtl::Reference<OXSDDataType> OXSDDataType::clone( const OUString& _rNewName ) const
    {
        rtl::Reference<OXSDDataType> pClone = createClone( _rNewName );
        pClone->initializeClone( *this );
        return pClone;
    }


    IMPLEMENT_FORWARD_XINTERFACE2( OXSDDataType, OXSDDataType_Base, ::comphelper::OPropertyContainer2 )


    IMPLEMENT_FORWARD_XTYPEPROVIDER2( OXSDDataType, OXSDDataType_Base, ::comphelper::OPropertyContainer2 )

    OUString SAL_CALL OXSDDataType::getName(  )
    {
        return m_sName;
    }


    void SAL_CALL OXSDDataType::setName( const OUString& aName )
    {
        // TODO: check the name for conflicts in the repository
        setFastPropertyValue( PROPERTY_ID_NAME, Any(aName) );
        SAL_WARN_IF( m_sName != aName, "forms.misc", "OXSDDataType::setName: inconsistency!" );
    }


    OUString SAL_CALL OXSDDataType::getPattern()
    {
        return m_sPattern;
    }


    void SAL_CALL OXSDDataType::setPattern( const OUString& _pattern )
    {
        setFastPropertyValue( PROPERTY_ID_XSD_PATTERN, Any(_pattern) );
        SAL_WARN_IF( m_sPattern != _pattern, "forms.misc", "OXSDDataType::setPattern: inconsistency!" );
    }


    sal_Int16 SAL_CALL OXSDDataType::getWhiteSpaceTreatment()
    {
        return m_nWST;
    }


    void SAL_CALL OXSDDataType::setWhiteSpaceTreatment( sal_Int16 _whitespacetreatment )
    {
        setFastPropertyValue( PROPERTY_ID_XSD_WHITESPACE, Any(_whitespacetreatment) );
        SAL_WARN_IF( m_nWST != _whitespacetreatment, "forms.misc", "OXSDDataType::setWhiteSpaceTreatment: inconsistency!" );
    }


    sal_Bool SAL_CALL OXSDDataType::getIsBasic()
    {
        return m_bIsBasic;
    }


    sal_Int16 SAL_CALL OXSDDataType::getTypeClass()
    {
        return m_nTypeClass;
    }


    sal_Bool OXSDDataType::validate( const OUString& sValue )
    {
        return bool(!_validate( sValue ));
    }


  OUString OXSDDataType::explainInvalid( const OUString& sValue )
    {
        // get reason
        TranslateId pReason = _validate( sValue );

        // get resource and return localized string
        return (!pReason)
            ? OUString()
            : getResource( pReason, sValue,
                                   _explainInvalid( pReason ) );
    }

    OUString OXSDDataType::_explainInvalid(TranslateId rReason)
    {
        if ( RID_STR_XFORMS_PATTERN_DOESNT_MATCH == rReason )
        {
            OSL_ENSURE( !m_sPattern.isEmpty(), "OXSDDataType::_explainInvalid: how can this error occur without a regular expression?" );
            return m_sPattern;
        }
        return OUString();
    }

    namespace
    {
        void lcl_initializePatternMatcher( ::std::unique_ptr< RegexMatcher >& _rpMatcher, const OUString& _rPattern )
        {
            UErrorCode nMatchStatus = U_ZERO_ERROR;
            UnicodeString aIcuPattern( reinterpret_cast<const UChar *>(_rPattern.getStr()), _rPattern.getLength() );
            _rpMatcher.reset( new RegexMatcher( aIcuPattern, 0, nMatchStatus ) );
            OSL_ENSURE( U_SUCCESS( nMatchStatus ), "lcl_initializePatternMatcher: invalid pattern property!" );
                // if asserts, then something changed our pattern without going to convertFastPropertyValue/checkPropertySanity
        }

        bool lcl_matchString( RegexMatcher& _rMatcher, const OUString& _rText )
        {
            UErrorCode nMatchStatus = U_ZERO_ERROR;
            UnicodeString aInput( reinterpret_cast<const UChar *>(_rText.getStr()), _rText.getLength() );
            _rMatcher.reset( aInput );
            if ( _rMatcher.matches( nMatchStatus ) )
            {
                int32_t nStart = _rMatcher.start( nMatchStatus );
                int32_t nEnd   = _rMatcher.end  ( nMatchStatus );
                if ( ( nStart == 0 ) && ( nEnd == _rText.getLength() ) )
                    return true;
            }

            return false;
        }
    }

    TranslateId OXSDDataType::_validate( const OUString& _rValue )
    {
        // care for the regular expression
        if ( !m_sPattern.isEmpty() )
        {
            // ensure our pattern matcher is up to date
            if ( m_bPatternMatcherDirty )
            {
                lcl_initializePatternMatcher( m_pPatternMatcher, m_sPattern );
                m_bPatternMatcherDirty = false;
            }

            // let it match the string
            if (!lcl_matchString(*m_pPatternMatcher, _rValue))
                return RID_STR_XFORMS_PATTERN_DOESNT_MATCH;
        }

        return {};
    }


    bool OXSDDataType::convertFastPropertyValue( std::unique_lock<std::mutex>& rGuard, Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue )
    {
        // let the base class do the conversion
        if ( !::comphelper::OPropertyContainer2::convertFastPropertyValue( rGuard, _rConvertedValue, _rOldValue, _nHandle, _rValue ) )
            return false;

        // sanity checks
        OUString sErrorMessage;
        if ( !checkPropertySanity( _nHandle, _rConvertedValue, sErrorMessage ) )
        {
            throw IllegalArgumentException(sErrorMessage, *this, 0);
        }

        return true;
    }


    void OXSDDataType::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 _nHandle, const Any& _rValue )
    {
        ::comphelper::OPropertyContainer2::setFastPropertyValue_NoBroadcast( rGuard, _nHandle, _rValue );
        if ( _nHandle == PROPERTY_ID_XSD_PATTERN )
            m_bPatternMatcherDirty = true;
    }


    bool OXSDDataType::checkPropertySanity( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, OUString& _rErrorMessage )
    {
        if ( _nHandle == PROPERTY_ID_XSD_PATTERN )
        {
            OUString sPattern;
            OSL_VERIFY( _rNewValue >>= sPattern );

            UnicodeString aIcuPattern( reinterpret_cast<const UChar *>(sPattern.getStr()), sPattern.getLength() );
            UErrorCode nMatchStatus = U_ZERO_ERROR;
            RegexMatcher aMatcher( aIcuPattern, 0, nMatchStatus );
            if ( U_FAILURE( nMatchStatus ) )
            {
                _rErrorMessage = "This is no valid pattern.";
                return false;
            }
        }
        return true;
    }


    void SAL_CALL OXSDDataType::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
    {
        ::comphelper::OPropertyContainer2::setPropertyValue( aPropertyName, aValue );
    }


    Any SAL_CALL OXSDDataType::getPropertyValue( const OUString& PropertyName )
    {
        return ::comphelper::OPropertyContainer2::getPropertyValue( PropertyName );
    }


    void SAL_CALL OXSDDataType::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
    {
        ::comphelper::OPropertyContainer2::addPropertyChangeListener( aPropertyName, xListener );
    }


    void SAL_CALL OXSDDataType::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
    {
        ::comphelper::OPropertyContainer2::removePropertyChangeListener( aPropertyName, aListener );
    }


    void SAL_CALL OXSDDataType::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
    {
        ::comphelper::OPropertyContainer2::addVetoableChangeListener( PropertyName, aListener );
    }


    void SAL_CALL OXSDDataType::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
    {
        ::comphelper::OPropertyContainer2::removeVetoableChangeListener( PropertyName, aListener );
    }

    OValueLimitedType_Base::OValueLimitedType_Base( const OUString& _rName, sal_Int16 _nTypeClass )
        :OXSDDataType( _rName, _nTypeClass )
        ,m_fCachedMaxInclusive( 0 )
        ,m_fCachedMaxExclusive( 0 )
        ,m_fCachedMinInclusive( 0 )
        ,m_fCachedMinExclusive( 0 )
    {
    }


    void OValueLimitedType_Base::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OXSDDataType::initializeClone( _rCloneSource );
        initializeTypedClone( static_cast< const OValueLimitedType_Base& >( _rCloneSource ) );
    }


    void OValueLimitedType_Base::initializeTypedClone( const OValueLimitedType_Base& _rCloneSource )
    {
        m_aMaxInclusive   = _rCloneSource.m_aMaxInclusive;
        m_aMaxExclusive   = _rCloneSource.m_aMaxExclusive;
        m_aMinInclusive   = _rCloneSource.m_aMinInclusive;
        m_aMinExclusive   = _rCloneSource.m_aMinExclusive;
        m_fCachedMaxInclusive   = _rCloneSource.m_fCachedMaxInclusive;
        m_fCachedMaxExclusive   = _rCloneSource.m_fCachedMaxExclusive;
        m_fCachedMinInclusive   = _rCloneSource.m_fCachedMinInclusive;
        m_fCachedMinExclusive   = _rCloneSource.m_fCachedMinExclusive;
    }


    void OValueLimitedType_Base::setFastPropertyValue_NoBroadcast(
        std::unique_lock<std::mutex>& rGuard,
        sal_Int32 _nHandle, const css::uno::Any& _rValue )
    {
        OXSDDataType::setFastPropertyValue_NoBroadcast( rGuard, _nHandle, _rValue );

        // if one of our limit properties has been set, translate it into a double
        // value, for later efficient validation
        switch ( _nHandle )
        {
        case PROPERTY_ID_XSD_MAX_INCLUSIVE_INT:
        case PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE:
        case PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE:
        case PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME:
        case PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME:
            if ( m_aMaxInclusive.hasValue() )
                normalizeValue( m_aMaxInclusive, m_fCachedMaxInclusive );
            else
                m_fCachedMaxInclusive = 0;
            break;
        case PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT:
        case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE:
        case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE:
        case PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME:
        case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME:
            if ( m_aMaxExclusive.hasValue() )
                normalizeValue( m_aMaxExclusive, m_fCachedMaxExclusive );
            else
                m_fCachedMaxExclusive = 0;
            break;
        case PROPERTY_ID_XSD_MIN_INCLUSIVE_INT:
        case PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE:
        case PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE:
        case PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME:
        case PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME:
            if ( m_aMinInclusive.hasValue() )
                normalizeValue( m_aMinInclusive, m_fCachedMinInclusive );
            else
                m_fCachedMinInclusive = 0;
            break;
        case PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT:
        case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE:
        case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE:
        case PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME:
        case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME:
            if ( m_aMinExclusive.hasValue() )
                normalizeValue( m_aMinExclusive, m_fCachedMinExclusive );
            else
                m_fCachedMinExclusive = 0;
            break;
        }
    }


    bool OValueLimitedType_Base::_getValue( const OUString& rValue, double& fValue )
    {
        // convert to double
        rtl_math_ConversionStatus eStatus;
        sal_Int32 nEnd;
        double f = ::rtl::math::stringToDouble(
            rValue.replace(',','.'), '.', u'\0', &eStatus, &nEnd );

        // error checking...
        bool bReturn = false;
        if( eStatus == rtl_math_ConversionStatus_Ok
            && nEnd == rValue.getLength() )
        {
            bReturn = true;
            fValue = f;
        }
        return bReturn;
    }

    TranslateId OValueLimitedType_Base::_validate( const OUString& rValue )
    {
        TranslateId pReason = OXSDDataType::_validate( rValue );
        if (!pReason)
        {

            // convert value and check format
            double f;
            if( ! _getValue( rValue, f ) )
                pReason = RID_STR_XFORMS_VALUE_IS_NOT_A;

            // check range
            else if( ( m_aMaxInclusive.hasValue() ) && f > m_fCachedMaxInclusive )
                pReason = RID_STR_XFORMS_VALUE_MAX_INCL;
            else if( ( m_aMaxExclusive.hasValue() ) && f >= m_fCachedMaxExclusive )
                pReason = RID_STR_XFORMS_VALUE_MAX_EXCL;
            else if( ( m_aMinInclusive.hasValue() ) && f < m_fCachedMinInclusive )
                pReason = RID_STR_XFORMS_VALUE_MIN_INCL;
            else if( ( m_aMinExclusive.hasValue() ) && f <= m_fCachedMinExclusive )
                pReason = RID_STR_XFORMS_VALUE_MIN_EXCL;
        }
        return pReason;
    }

    OUString OValueLimitedType_Base::_explainInvalid(TranslateId rReason)
    {
        OUStringBuffer sInfo;
        if (rReason == RID_STR_XFORMS_VALUE_IS_NOT_A)
            sInfo.append( getName() );
        else if (rReason == RID_STR_XFORMS_VALUE_MAX_INCL)
            sInfo.append( typedValueAsHumanReadableString( m_aMaxInclusive ) );
        else if (rReason == RID_STR_XFORMS_VALUE_MAX_EXCL)
            sInfo.append( typedValueAsHumanReadableString( m_aMaxExclusive ) );
        else if (rReason == RID_STR_XFORMS_VALUE_MIN_INCL)
            sInfo.append( typedValueAsHumanReadableString( m_aMinInclusive ) );
        else if (rReason == RID_STR_XFORMS_VALUE_MIN_EXCL)
            sInfo.append( typedValueAsHumanReadableString( m_aMinExclusive ) );
        return sInfo.makeStringAndClear();
    }

    OStringType::OStringType( const OUString& _rName, sal_Int16 _nTypeClass )
        :OStringType_Base( _rName, _nTypeClass )
    {
    }


    void OStringType::registerProperties()
    {
        OStringType_Base::registerProperties();

        registerMayBeVoidProperty( PROPERTY_XSD_LENGTH, PROPERTY_ID_XSD_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aLength, cppu::UnoType<sal_Int32>::get() );

        registerMayBeVoidProperty( PROPERTY_XSD_MIN_LENGTH, PROPERTY_ID_XSD_MIN_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aMinLength, cppu::UnoType<sal_Int32>::get() );

        registerMayBeVoidProperty( PROPERTY_XSD_MAX_LENGTH, PROPERTY_ID_XSD_MAX_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aMaxLength, cppu::UnoType<sal_Int32>::get() );
    }


    rtl::Reference<OXSDDataType> OStringType::createClone( const OUString& _rName ) const
    {
        return new OStringType( _rName, getTypeClass() );
    }
    void OStringType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OStringType_Base::initializeClone( _rCloneSource );
        initializeTypedClone( static_cast< const OStringType& >( _rCloneSource ) );
    }



    void OStringType::initializeTypedClone( const OStringType& _rCloneSource )
    {
        m_aLength       = _rCloneSource.m_aLength;
        m_aMinLength    = _rCloneSource.m_aMinLength;
        m_aMaxLength    = _rCloneSource.m_aMaxLength;
    }


    bool OStringType::checkPropertySanity( sal_Int32 _nHandle, const Any& _rNewValue, OUString& _rErrorMessage )
    {
        // let the base class do the conversion
        if ( !OStringType_Base::checkPropertySanity( _nHandle, _rNewValue, _rErrorMessage ) )
            return false;

        _rErrorMessage.clear();
        switch ( _nHandle )
        {
            case PROPERTY_ID_XSD_LENGTH:
            case PROPERTY_ID_XSD_MIN_LENGTH:
            case PROPERTY_ID_XSD_MAX_LENGTH:
            {
                sal_Int32 nValue( 0 );
                OSL_VERIFY( _rNewValue >>= nValue );
                if ( nValue < 0 )
                    _rErrorMessage = "Length limits must denote positive integer values.";
                        // TODO/eforms: localize the error message
            }
            break;
        }

        return _rErrorMessage.isEmpty();
    }


    TranslateId OStringType::_validate( const OUString& rValue )
    {
        // check regexp, whitespace etc. in parent class
        TranslateId pReason = OStringType_Base::_validate( rValue );

        if (!pReason)
        {
            // check string constraints
            sal_Int32 nLength = rValue.getLength();
            sal_Int32 nLimit = 0;
            if ( m_aLength >>= nLimit )
            {
                if ( nLimit != nLength )
                    pReason = RID_STR_XFORMS_VALUE_LENGTH;
            }
            else
            {
                if ( ( m_aMaxLength >>= nLimit ) && ( nLength > nLimit ) )
                    pReason = RID_STR_XFORMS_VALUE_MAX_LENGTH;
                else if ( ( m_aMinLength >>= nLimit ) && ( nLength < nLimit ) )
                    pReason = RID_STR_XFORMS_VALUE_MIN_LENGTH;
            }
        }
        return pReason;
    }

    OUString OStringType::_explainInvalid(TranslateId rReason)
    {
        sal_Int32 nValue = 0;
        OUStringBuffer sInfo;
        if (rReason == RID_STR_XFORMS_VALUE_LENGTH)
        {
            if( m_aLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason == RID_STR_XFORMS_VALUE_MAX_LENGTH)
        {
            if( m_aMaxLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason == RID_STR_XFORMS_VALUE_MIN_LENGTH)
        {
            if( m_aMinLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason)
        {
            sInfo.append(OStringType_Base::_explainInvalid(rReason));
        }
        return sInfo.makeStringAndClear();
    }

    OAnyURIType::OAnyURIType( const OUString& _rName, sal_Int16 _nTypeClass )
        : OAnyURIType_Base(_rName, _nTypeClass)
        , m_xURLTransformer(css::util::URLTransformer::create(::comphelper::getProcessComponentContext()))
    {
    }

    void OAnyURIType::registerProperties()
    {
        OAnyURIType_Base::registerProperties();

        registerMayBeVoidProperty( PROPERTY_XSD_LENGTH, PROPERTY_ID_XSD_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aLength, cppu::UnoType<sal_Int32>::get() );

        registerMayBeVoidProperty( PROPERTY_XSD_MIN_LENGTH, PROPERTY_ID_XSD_MIN_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aMinLength, cppu::UnoType<sal_Int32>::get() );

        registerMayBeVoidProperty( PROPERTY_XSD_MAX_LENGTH, PROPERTY_ID_XSD_MAX_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aMaxLength, cppu::UnoType<sal_Int32>::get() );
    }

    rtl::Reference<OXSDDataType> OAnyURIType::createClone( const OUString& _rName ) const
    {
        return new OAnyURIType( _rName, getTypeClass() );
    }

    void OAnyURIType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OAnyURIType_Base::initializeClone( _rCloneSource );
        initializeTypedClone( static_cast< const OAnyURIType& >( _rCloneSource ) );
    }



    void OAnyURIType::initializeTypedClone( const OAnyURIType& _rCloneSource )
    {
        m_aLength       = _rCloneSource.m_aLength;
        m_aMinLength    = _rCloneSource.m_aMinLength;
        m_aMaxLength    = _rCloneSource.m_aMaxLength;
    }


    bool OAnyURIType::checkPropertySanity( sal_Int32 _nHandle, const Any& _rNewValue, OUString& _rErrorMessage )
    {
        // let the base class do the conversion
        if ( !OAnyURIType_Base::checkPropertySanity( _nHandle, _rNewValue, _rErrorMessage ) )
            return false;

        _rErrorMessage.clear();
        switch ( _nHandle )
        {
            case PROPERTY_ID_XSD_LENGTH:
            case PROPERTY_ID_XSD_MIN_LENGTH:
            case PROPERTY_ID_XSD_MAX_LENGTH:
            {
                sal_Int32 nValue( 0 );
                OSL_VERIFY( _rNewValue >>= nValue );
                if ( nValue < 0 )
                    _rErrorMessage = "Length limits must denote positive integer values.";
                        // TODO/eforms: localize the error message
            }
            break;
        }

        return _rErrorMessage.isEmpty();
    }


    TranslateId OAnyURIType::_validate( const OUString& rValue )
    {
        // check regexp, whitespace etc. in parent class
        TranslateId pReason = OAnyURIType_Base::_validate( rValue );

        if (!pReason)
        {
            // check AnyURI constraints
            sal_Int32 nLength = rValue.getLength();
            sal_Int32 nLimit = 0;
            if ( m_aLength >>= nLimit )
            {
                if ( nLimit != nLength )
                    pReason = RID_STR_XFORMS_VALUE_LENGTH;
            }
            else
            {
                if ( ( m_aMaxLength >>= nLimit ) && ( nLength > nLimit ) )
                    pReason = RID_STR_XFORMS_VALUE_MAX_LENGTH;
                else if ( ( m_aMinLength >>= nLimit ) && ( nLength < nLimit ) )
                    pReason = RID_STR_XFORMS_VALUE_MIN_LENGTH;
            }
            // check URL
            css::util::URL aCommandURL;
            aCommandURL.Complete = rValue;
            if (!m_xURLTransformer->parseStrict(aCommandURL))
                pReason = RID_STR_XFORMS_INVALID_VALUE;

        }
        return pReason;
    }

    OUString OAnyURIType::_explainInvalid(TranslateId rReason)
    {
        sal_Int32 nValue = 0;
        OUStringBuffer sInfo;
        if (rReason == RID_STR_XFORMS_VALUE_LENGTH)
        {
            if( m_aLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason == RID_STR_XFORMS_VALUE_MAX_LENGTH)
        {
            if( m_aMaxLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason == RID_STR_XFORMS_VALUE_MIN_LENGTH)
        {
            if( m_aMinLength >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason)
        {
            sInfo.append(OAnyURIType_Base::_explainInvalid(rReason));
        }
        return sInfo.makeStringAndClear();
    }

    OBooleanType::OBooleanType( const OUString& _rName )
        :OBooleanType_Base( _rName, DataTypeClass::BOOLEAN )
    {
    }

    rtl::Reference<OXSDDataType> OBooleanType::createClone( const OUString& _rName ) const
    {
        return new OBooleanType( _rName );
    }

    void OBooleanType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OBooleanType_Base::initializeClone( _rCloneSource );
    }

    TranslateId OBooleanType::_validate( const OUString& sValue )
    {
        TranslateId pInvalidityReason = OBooleanType_Base::_validate( sValue );
        if ( pInvalidityReason )
            return pInvalidityReason;

        bool bValid = sValue == "0" || sValue == "1" || sValue == "true" || sValue == "false";
        return bValid ? TranslateId() : RID_STR_XFORMS_INVALID_VALUE;
    }

    OUString OBooleanType::_explainInvalid(TranslateId rReason)
    {
        return !rReason ? OUString() : getName();
    }

    ODecimalType::ODecimalType( const OUString& _rName, sal_Int16 _nTypeClass )
        :ODecimalType_Base( _rName, _nTypeClass )
    {
    }

    rtl::Reference<OXSDDataType> ODecimalType::createClone( const OUString& _rName ) const
    {
        return new ODecimalType( _rName, getTypeClass() );
    }
    void ODecimalType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        ODecimalType_Base::initializeClone( _rCloneSource );
        initializeTypedClone( static_cast< const ODecimalType& >( _rCloneSource ) );
    }

    void ODecimalType::initializeTypedClone( const ODecimalType& _rCloneSource )
    {
        m_aTotalDigits    = _rCloneSource.m_aTotalDigits;
        m_aFractionDigits = _rCloneSource.m_aFractionDigits;
    }


    void ODecimalType::registerProperties()
    {
        ODecimalType_Base::registerProperties();

        registerMayBeVoidProperty( PROPERTY_XSD_TOTAL_DIGITS, PROPERTY_ID_XSD_TOTAL_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aTotalDigits, cppu::UnoType<sal_Int32>::get() );

        registerMayBeVoidProperty( PROPERTY_XSD_FRACTION_DIGITS, PROPERTY_ID_XSD_FRACTION_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
            &m_aFractionDigits, cppu::UnoType<sal_Int32>::get() );
    }


    // validate decimals and return code for which facets failed
    // to be used by: ODecimalType::validate and ODecimalType::explainInvalid
    TranslateId ODecimalType::_validate( const OUString& rValue )
    {
        TranslateId pReason = ODecimalType_Base::_validate( rValue );

        // check digits (if no other cause is available so far)
        if (!pReason)
        {
            sal_Int32 nLength = rValue.getLength();
            sal_Int32 n = 0;
            sal_Int32 nTotalDigits = 0;
            sal_Int32 nFractionDigits = 0;
            const sal_Unicode* pValue = rValue.getStr();
            for( ; n < nLength && pValue[n] != '.'; n++ )
                if( pValue[n] >= '0'
                    && pValue[n] <= '9')
                    nTotalDigits++;
            for( ; n < nLength; n++ )
                if( pValue[n] >= '0'
                    && pValue[n] <= '9')
                    nFractionDigits++;
            nTotalDigits += nFractionDigits;

            sal_Int32 nValue = 0;
            if( ( m_aTotalDigits >>= nValue ) &&  nTotalDigits > nValue )
                pReason = RID_STR_XFORMS_VALUE_TOTAL_DIGITS;
            else if( ( m_aFractionDigits >>= nValue ) &&
                     ( nFractionDigits > nValue ) )
                pReason = RID_STR_XFORMS_VALUE_FRACTION_DIGITS;
        }

        return pReason;
    }

    OUString ODecimalType::_explainInvalid(TranslateId rReason)
    {
        sal_Int32 nValue = 0;
        OUStringBuffer sInfo;
        if (rReason == RID_STR_XFORMS_VALUE_TOTAL_DIGITS)
        {
            if( m_aTotalDigits >>= nValue )
                sInfo.append( nValue );
        }
        else if (rReason == RID_STR_XFORMS_VALUE_FRACTION_DIGITS)
        {
            if( m_aFractionDigits >>= nValue )
                sInfo.append( nValue );
        }
        else
        {
            sInfo.append(ODecimalType_Base::_explainInvalid(rReason));
        }
        return sInfo.makeStringAndClear();
    }

    OUString ODecimalType::typedValueAsHumanReadableString( const Any& _rValue ) const
    {
        double fValue( 0 );
        normalizeValue( _rValue, fValue );
        return OUString::number( fValue );
    }


    void ODecimalType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
    {
        OSL_VERIFY( _rValue >>= _rDoubleValue );
    }


    ODateType::ODateType(const OUString& _rName)
        :ODateType_Base(_rName, DataTypeClass::DATE)
    {
    }
    rtl::Reference<OXSDDataType> ODateType::createClone(const OUString& _rName) const
    {
        return new ODateType(_rName);
    }
    void ODateType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        ODateType_Base::initializeClone(_rCloneSource);
        initializeTypedClone(static_cast< const ODateType& >(_rCloneSource));
    }

    TranslateId ODateType::_validate( const OUString& _rValue )
    {
        return ODateType_Base::_validate( _rValue );
    }

    bool ODateType::_getValue( const OUString& value, double& fValue )
    {
        Any aTypeValue;
        try
        {
            aTypeValue = Convert::get().toAny( value, getCppuType() );
        }
        catch (com::sun::star::lang::IllegalArgumentException)
        {
            return false;
        }

        Date aValue;
        if ( !( aTypeValue >>= aValue ) )
            return false;

        ::Date aToolsDate( aValue.Day, aValue.Month, aValue.Year );
        fValue = aToolsDate.GetDate();
        return true;
    }


    OUString ODateType::typedValueAsHumanReadableString( const Any& _rValue ) const
    {
        OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "ODateType::typedValueAsHumanReadableString: unexpected type" );
        return Convert::get().toXSD( _rValue );
    }


    void ODateType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
    {
        Date aValue;
        OSL_VERIFY( _rValue >>= aValue );
        ::Date aToolsDate( aValue.Day, aValue.Month, aValue.Year );
        _rDoubleValue = aToolsDate.GetDate();
    }


    OTimeType::OTimeType(const OUString& _rName)
        :OTimeType_Base(_rName, DataTypeClass::TIME)
    {
    }
    rtl::Reference<OXSDDataType> OTimeType::createClone(const OUString& _rName) const
    {
        return new OTimeType(_rName);
    }
    void OTimeType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OTimeType_Base::initializeClone(_rCloneSource);
        initializeTypedClone(static_cast< const OTimeType& >(_rCloneSource));
    }

    TranslateId OTimeType::_validate( const OUString& _rValue )
    {
        return OTimeType_Base::_validate( _rValue );
    }

    bool OTimeType::_getValue( const OUString& value, double& fValue )
    {
        Any aTypedValue;
        try
        {
            aTypedValue = Convert::get().toAny( value, getCppuType() );
        }
        catch (com::sun::star::lang::IllegalArgumentException)
        {
            return false;
        }

        css::util::Time aValue;
        if ( !( aTypedValue >>= aValue ) )
            return false;

        ::tools::Time aToolsTime( aValue );
        // no loss/rounding; IEEE 754 double-precision floating-point
        // has a mantissa of 53 bits; we need at the very most 50 bits:
        // format of aToolsTime.GetTime() is (in decimal) hhmmssnnnnnnnnn
        // and 999999999999999 = 0x38D7EA4C67FFF
        // in reality I doubt we need (much) more than
        //     240000000000000 = 0x0DA475ABF0000
        // that is 48 bits
        fValue = aToolsTime.GetTime();
        return true;
    }


    OUString OTimeType::typedValueAsHumanReadableString( const Any& _rValue ) const
    {
        OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "OTimeType::typedValueAsHumanReadableString: unexpected type" );
        return Convert::get().toXSD( _rValue );
    }


    void OTimeType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
    {
        css::util::Time aValue;
        OSL_VERIFY( _rValue >>= aValue );
        ::tools::Time aToolsTime( aValue );
        _rDoubleValue = aToolsTime.GetTime();
    }


    ODateTimeType::ODateTimeType(const OUString& _rName)
        :ODateTimeType_Base(_rName, DataTypeClass::DATETIME)
    {
    }
    rtl::Reference<OXSDDataType> ODateTimeType::createClone(const OUString& _rName) const
    {
        return new ODateTimeType(_rName);
    }
    void ODateTimeType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        ODateTimeType_Base::initializeClone(_rCloneSource);
        initializeTypedClone(static_cast< const ODateTimeType& >(_rCloneSource));
    }

    TranslateId ODateTimeType::_validate( const OUString& _rValue )
    {
        return ODateTimeType_Base::_validate( _rValue );
    }

    namespace
    {
        double lcl_normalizeDateTime( const DateTime& _rValue )
        {
            ::DateTime aToolsValue(_rValue);

            double fValue = 0;
            // days since 1.1.1900 (which is relatively arbitrary but fixed date)
            fValue += ::Date( aToolsValue ) - ::Date( 1, 1, 1900 );
            // time
            fValue += aToolsValue.GetTimeInDays();
            return fValue;
        }
    }


    bool ODateTimeType::_getValue( const OUString& value, double& fValue )
    {
        Any aTypedValue;
        try
        {
            aTypedValue = Convert::get().toAny( value, getCppuType() );
        }
        catch (com::sun::star::uno::RuntimeException)
        {
            return false;
        }

        DateTime aValue;
        if ( !( aTypedValue >>= aValue ) )
            return false;

        fValue = lcl_normalizeDateTime( aValue );
        return true;
    }


    OUString ODateTimeType::typedValueAsHumanReadableString( const Any& _rValue ) const
    {
        OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "OTimeType::typedValueAsHumanReadableString: unexpected type" );
        OUString sString = Convert::get().toXSD( _rValue );

        // ISO 8601 notation has a "T" to separate between date and time. Our only concession
        // to the "human readable" in the method name is to replace this T with a whitespace.
        OSL_ENSURE( sString.indexOf( 'T' ) != -1, "ODateTimeType::typedValueAsHumanReadableString: hmm - no ISO notation?" );
        return sString.replace( 'T', ' ' );
    }


    void ODateTimeType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
    {
        DateTime aValue;
        OSL_VERIFY( _rValue >>= aValue );
        _rDoubleValue = lcl_normalizeDateTime( aValue );
    }

    OShortIntegerType::OShortIntegerType( const OUString& _rName, sal_Int16 _nTypeClass )
        :OShortIntegerType_Base( _rName, _nTypeClass )
    {
    }

    rtl::Reference<OXSDDataType> OShortIntegerType::createClone( const OUString& _rName ) const
    {
        return new OShortIntegerType( _rName, getTypeClass() );
    }
    void OShortIntegerType::initializeClone( const OXSDDataType& _rCloneSource )
    {
        OShortIntegerType_Base::initializeClone( _rCloneSource );
        initializeTypedClone( static_cast< const OShortIntegerType& >( _rCloneSource ) );
    }

    static bool lcl_getValueYear( std::u16string_view value, double& fValue )
    {
        if (value.size() > 4)
        {
             fValue = 0;
             return false;
        }
        if (o3tl::equalsAscii(value, "0"))
        {
            fValue = 0;
            return true;
        }
        sal_Int32 int32Value = o3tl::toInt32(value);
        if (
            int32Value == 0 ||
            int32Value < 0 ||
            int32Value > 10000
           )
        {
             fValue = 0;
             return false;
        }
        fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
        return true;
    }

    static bool lcl_getValueMonth( std::u16string_view value, double& fValue )
    {
        if (value.size() > 2)
        {
             fValue = 0;
             return false;
        }
        sal_Int32 int32Value = o3tl::toInt32(value);
        if (
            int32Value == 0 ||
            int32Value < 1 ||
            int32Value > 12
           )
        {
             fValue = 0;
             return false;
        }
        fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
        return true;
    }

    static bool lcl_getValueDay( std::u16string_view value, double& fValue )
    {
        if (value.size() > 2)
        {
             fValue = 0;
             return false;
        }
        sal_Int32 int32Value = o3tl::toInt32(value);
        if (
            int32Value == 0 ||
            int32Value < 1 ||
            int32Value > 31
           )
        {
             fValue = 0;
             return false;
        }
        fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
        return true;
    }

    bool OShortIntegerType::_getValue( const OUString& value, double& fValue )
    {
        switch (this->getTypeClass())
        {
            case css::xsd::DataTypeClass::gYear:
                return lcl_getValueYear(value, fValue);

            case css::xsd::DataTypeClass::gMonth:
                return lcl_getValueMonth(value, fValue);

            case css::xsd::DataTypeClass::gDay:
                return lcl_getValueDay(value, fValue);
            default:
                // for the moment, the only types which derive from OShortIntegerType are:
                // gYear, gMonth and gDay, see ODataTypeRepository ctr
                return false;
        }
    }


    OUString OShortIntegerType::typedValueAsHumanReadableString( const Any& _rValue ) const
    {
        sal_Int16 nValue( 0 );
        OSL_VERIFY( _rValue >>= nValue );
        return OUString::number( nValue );
    }


    void OShortIntegerType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
    {
        sal_Int16 nValue( 0 );
        OSL_VERIFY( _rValue >>= nValue );
        _rDoubleValue = nValue;
    }


template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::ODerivedDataType( const OUString& _rName, sal_Int16 _nTypeClass )
    :SUPERCLASS( _rName, _nTypeClass )
    ,m_bPropertiesRegistered( false )
{
}


template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
::cppu::IPropertyArrayHelper* ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::createArrayHelper( ) const
{
    css::uno::Sequence< css::beans::Property > aProps;
    ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::describeProperties( aProps );
    return new ::cppu::OPropertyArrayHelper( aProps );
}


template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getPropertySetInfo()
{
        return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
}


template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
::cppu::IPropertyArrayHelper& ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getInfoHelper()
{
    if ( !m_bPropertiesRegistered )
    {
        this->registerProperties();
        m_bPropertiesRegistered = true;
    }

    return *ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getArrayHelper();
}


template< typename VALUE_TYPE >
OValueLimitedType< VALUE_TYPE >::OValueLimitedType( const OUString& _rName, sal_Int16 _nTypeClass )
    :OValueLimitedType_Base( _rName, _nTypeClass )
{
}

} // namespace xforms


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */