LibreOffice Module forms (master) 1
datatypes.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21#include "datatypes.hxx"
22#include "resourcehelper.hxx"
23#include <frm_strings.hxx>
24#include <property.hxx>
25#include <strings.hrc>
26#include "convert.hxx"
28
29#include <com/sun/star/xsd/DataTypeClass.hpp>
30#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
31#include <o3tl/string_view.hxx>
32#include <tools/datetime.hxx>
33#include <rtl/math.hxx>
34#include <sal/log.hxx>
35#include <utility>
36
37
38namespace xforms
39{
40
41
42 using ::com::sun::star::uno::Reference;
43 using ::com::sun::star::uno::Any;
44 using ::com::sun::star::util::Date;
45 using ::com::sun::star::util::Time;
46 using ::com::sun::star::util::DateTime;
47 using ::com::sun::star::lang::IllegalArgumentException;
48 using ::com::sun::star::beans::XPropertyChangeListener;
49 using ::com::sun::star::beans::XVetoableChangeListener;
50
51 using ::com::sun::star::beans::PropertyAttribute::BOUND;
52 using ::com::sun::star::beans::PropertyAttribute::READONLY;
53
54 using namespace ::com::sun::star::xsd;
55 using namespace ::frm;
56 U_NAMESPACE_USE
57
58 OXSDDataType::OXSDDataType( OUString _aName, sal_Int16 _nTypeClass )
59 :OXSDDataType_PBase( m_aBHelper )
60 ,m_bIsBasic( true )
61 ,m_nTypeClass( _nTypeClass )
62 ,m_sName(std::move( _aName ))
63 ,m_nWST( WhiteSpaceTreatment::Preserve )
64 ,m_bPatternMatcherDirty( true )
65 {
66 }
67
68
70 {
71 }
72
73
75 {
79
82 }
83
84
85 void OXSDDataType::initializeClone( const OXSDDataType& _rCloneSource )
86 {
87 m_bIsBasic = false;
88 m_nTypeClass = _rCloneSource.m_nTypeClass;
89 m_sPattern = _rCloneSource.m_sPattern;
90 m_nWST = _rCloneSource.m_nWST;
91 }
92
93
94 rtl::Reference<OXSDDataType> OXSDDataType::clone( const OUString& _rNewName ) const
95 {
96 rtl::Reference<OXSDDataType> pClone = createClone( _rNewName );
97 pClone->initializeClone( *this );
98 return pClone;
99 }
100
101
103
104
106
107 OUString SAL_CALL OXSDDataType::getName( )
108 {
109 return m_sName;
110 }
111
112
113 void SAL_CALL OXSDDataType::setName( const OUString& aName )
114 {
115 // TODO: check the name for conflicts in the repository
117 SAL_WARN_IF( m_sName != aName, "forms.misc", "OXSDDataType::setName: inconsistency!" );
118 }
119
120
121 OUString SAL_CALL OXSDDataType::getPattern()
122 {
123 return m_sPattern;
124 }
125
126
127 void SAL_CALL OXSDDataType::setPattern( const OUString& _pattern )
128 {
130 SAL_WARN_IF( m_sPattern != _pattern, "forms.misc", "OXSDDataType::setPattern: inconsistency!" );
131 }
132
133
135 {
136 return m_nWST;
137 }
138
139
140 void SAL_CALL OXSDDataType::setWhiteSpaceTreatment( sal_Int16 _whitespacetreatment )
141 {
142 setFastPropertyValue( PROPERTY_ID_XSD_WHITESPACE, Any(_whitespacetreatment) );
143 SAL_WARN_IF( m_nWST != _whitespacetreatment, "forms.misc", "OXSDDataType::setWhiteSpaceTreatment: inconsistency!" );
144 }
145
146
148 {
149 return m_bIsBasic;
150 }
151
152
153 sal_Int16 SAL_CALL OXSDDataType::getTypeClass()
154 {
155 return m_nTypeClass;
156 }
157
158
159 sal_Bool OXSDDataType::validate( const OUString& sValue )
160 {
161 return bool(!_validate( sValue ));
162 }
163
164
165 OUString OXSDDataType::explainInvalid( const OUString& sValue )
166 {
167 // get reason
168 TranslateId pReason = _validate( sValue );
169
170 // get resource and return localized string
171 return (!pReason)
172 ? OUString()
173 : getResource( pReason, sValue,
174 _explainInvalid( pReason ) );
175 }
176
178 {
179 if ( RID_STR_XFORMS_PATTERN_DOESNT_MATCH == rReason )
180 {
181 OSL_ENSURE( !m_sPattern.isEmpty(), "OXSDDataType::_explainInvalid: how can this error occur without a regular expression?" );
182 return m_sPattern;
183 }
184 return OUString();
185 }
186
187 namespace
188 {
189 void lcl_initializePatternMatcher( ::std::unique_ptr< RegexMatcher >& _rpMatcher, const OUString& _rPattern )
190 {
191 UErrorCode nMatchStatus = U_ZERO_ERROR;
192 UnicodeString aIcuPattern( reinterpret_cast<const UChar *>(_rPattern.getStr()), _rPattern.getLength() );
193 _rpMatcher.reset( new RegexMatcher( aIcuPattern, 0, nMatchStatus ) );
194 OSL_ENSURE( U_SUCCESS( nMatchStatus ), "lcl_initializePatternMatcher: invalid pattern property!" );
195 // if asserts, then something changed our pattern without going to convertFastPropertyValue/checkPropertySanity
196 }
197
198 bool lcl_matchString( RegexMatcher& _rMatcher, const OUString& _rText )
199 {
200 UErrorCode nMatchStatus = U_ZERO_ERROR;
201 UnicodeString aInput( reinterpret_cast<const UChar *>(_rText.getStr()), _rText.getLength() );
202 _rMatcher.reset( aInput );
203 if ( _rMatcher.matches( nMatchStatus ) )
204 {
205 int32_t nStart = _rMatcher.start( nMatchStatus );
206 int32_t nEnd = _rMatcher.end ( nMatchStatus );
207 if ( ( nStart == 0 ) && ( nEnd == _rText.getLength() ) )
208 return true;
209 }
210
211 return false;
212 }
213 }
214
215 TranslateId OXSDDataType::_validate( const OUString& _rValue )
216 {
217 // care for the regular expression
218 if ( !m_sPattern.isEmpty() )
219 {
220 // ensure our pattern matcher is up to date
222 {
223 lcl_initializePatternMatcher( m_pPatternMatcher, m_sPattern );
225 }
226
227 // let it match the string
228 if (!lcl_matchString(*m_pPatternMatcher, _rValue))
229 return RID_STR_XFORMS_PATTERN_DOESNT_MATCH;
230 }
231
232 return {};
233 }
234
235
236 sal_Bool OXSDDataType::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue )
237 {
238 // let the base class do the conversion
239 if ( !OXSDDataType_PBase::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue ) )
240 return false;
241
242 // sanity checks
243 OUString sErrorMessage;
244 if ( !checkPropertySanity( _nHandle, _rConvertedValue, sErrorMessage ) )
245 {
246 IllegalArgumentException aException;
247 aException.Message = sErrorMessage;
248 aException.Context = *this;
249 throw aException;
250 }
251
252 return true;
253 }
254
255
256 void SAL_CALL OXSDDataType::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
257 {
259 if ( _nHandle == PROPERTY_ID_XSD_PATTERN )
261 }
262
263
264 bool OXSDDataType::checkPropertySanity( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, OUString& _rErrorMessage )
265 {
266 if ( _nHandle == PROPERTY_ID_XSD_PATTERN )
267 {
268 OUString sPattern;
269 OSL_VERIFY( _rNewValue >>= sPattern );
270
271 UnicodeString aIcuPattern( reinterpret_cast<const UChar *>(sPattern.getStr()), sPattern.getLength() );
272 UErrorCode nMatchStatus = U_ZERO_ERROR;
273 RegexMatcher aMatcher( aIcuPattern, 0, nMatchStatus );
274 if ( U_FAILURE( nMatchStatus ) )
275 {
276 _rErrorMessage = "This is no valid pattern.";
277 return false;
278 }
279 }
280 return true;
281 }
282
283
284 void SAL_CALL OXSDDataType::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
285 {
286 OXSDDataType_PBase::setPropertyValue( aPropertyName, aValue );
287 }
288
289
290 Any SAL_CALL OXSDDataType::getPropertyValue( const OUString& PropertyName )
291 {
292 return OXSDDataType_PBase::getPropertyValue( PropertyName );
293 }
294
295
296 void SAL_CALL OXSDDataType::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
297 {
298 OXSDDataType_PBase::addPropertyChangeListener( aPropertyName, xListener );
299 }
300
301
302 void SAL_CALL OXSDDataType::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
303 {
304 OXSDDataType_PBase::removePropertyChangeListener( aPropertyName, aListener );
305 }
306
307
308 void SAL_CALL OXSDDataType::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
309 {
310 OXSDDataType_PBase::addVetoableChangeListener( PropertyName, aListener );
311 }
312
313
314 void SAL_CALL OXSDDataType::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
315 {
316 OXSDDataType_PBase::removeVetoableChangeListener( PropertyName, aListener );
317 }
318
319 OValueLimitedType_Base::OValueLimitedType_Base( const OUString& _rName, sal_Int16 _nTypeClass )
320 :OXSDDataType( _rName, _nTypeClass )
321 ,m_fCachedMaxInclusive( 0 )
322 ,m_fCachedMaxExclusive( 0 )
323 ,m_fCachedMinInclusive( 0 )
324 ,m_fCachedMinExclusive( 0 )
325 {
326 }
327
328
330 {
331 OXSDDataType::initializeClone( _rCloneSource );
332 initializeTypedClone( static_cast< const OValueLimitedType_Base& >( _rCloneSource ) );
333 }
334
335
337 {
338 m_aMaxInclusive = _rCloneSource.m_aMaxInclusive;
339 m_aMaxExclusive = _rCloneSource.m_aMaxExclusive;
340 m_aMinInclusive = _rCloneSource.m_aMinInclusive;
341 m_aMinExclusive = _rCloneSource.m_aMinExclusive;
346 }
347
348
350 sal_Int32 _nHandle, const css::uno::Any& _rValue )
351 {
353
354 // if one of our limit properties has been set, translate it into a double
355 // value, for later efficient validation
356 switch ( _nHandle )
357 {
363 if ( m_aMaxInclusive.hasValue() )
365 else
367 break;
373 if ( m_aMaxExclusive.hasValue() )
375 else
377 break;
383 if ( m_aMinInclusive.hasValue() )
385 else
387 break;
393 if ( m_aMinExclusive.hasValue() )
395 else
397 break;
398 }
399 }
400
401
402 bool OValueLimitedType_Base::_getValue( const OUString& rValue, double& fValue )
403 {
404 // convert to double
405 rtl_math_ConversionStatus eStatus;
406 sal_Int32 nEnd;
407 double f = ::rtl::math::stringToDouble(
408 rValue.replace(',','.'), '.', u'\0', &eStatus, &nEnd );
409
410 // error checking...
411 bool bReturn = false;
412 if( eStatus == rtl_math_ConversionStatus_Ok
413 && nEnd == rValue.getLength() )
414 {
415 bReturn = true;
416 fValue = f;
417 }
418 return bReturn;
419 }
420
422 {
423 TranslateId pReason = OXSDDataType::_validate( rValue );
424 if (!pReason)
425 {
426
427 // convert value and check format
428 double f;
429 if( ! _getValue( rValue, f ) )
430 pReason = RID_STR_XFORMS_VALUE_IS_NOT_A;
431
432 // check range
433 else if( ( m_aMaxInclusive.hasValue() ) && f > m_fCachedMaxInclusive )
434 pReason = RID_STR_XFORMS_VALUE_MAX_INCL;
435 else if( ( m_aMaxExclusive.hasValue() ) && f >= m_fCachedMaxExclusive )
436 pReason = RID_STR_XFORMS_VALUE_MAX_EXCL;
437 else if( ( m_aMinInclusive.hasValue() ) && f < m_fCachedMinInclusive )
438 pReason = RID_STR_XFORMS_VALUE_MIN_INCL;
439 else if( ( m_aMinExclusive.hasValue() ) && f <= m_fCachedMinExclusive )
440 pReason = RID_STR_XFORMS_VALUE_MIN_EXCL;
441 }
442 return pReason;
443 }
444
446 {
447 OUStringBuffer sInfo;
448 if (rReason == RID_STR_XFORMS_VALUE_IS_NOT_A)
449 sInfo.append( getName() );
450 else if (rReason == RID_STR_XFORMS_VALUE_MAX_INCL)
452 else if (rReason == RID_STR_XFORMS_VALUE_MAX_EXCL)
454 else if (rReason == RID_STR_XFORMS_VALUE_MIN_INCL)
456 else if (rReason == RID_STR_XFORMS_VALUE_MIN_EXCL)
458 return sInfo.makeStringAndClear();
459 }
460
461 OStringType::OStringType( const OUString& _rName, sal_Int16 _nTypeClass )
462 :OStringType_Base( _rName, _nTypeClass )
463 {
464 }
465
466
468 {
470
471 registerMayBeVoidProperty( PROPERTY_XSD_LENGTH, PROPERTY_ID_XSD_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
473
474 registerMayBeVoidProperty( PROPERTY_XSD_MIN_LENGTH, PROPERTY_ID_XSD_MIN_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
476
477 registerMayBeVoidProperty( PROPERTY_XSD_MAX_LENGTH, PROPERTY_ID_XSD_MAX_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
479 }
480
481
483 {
484 return new OStringType( _rName, getTypeClass() );
485 }
486 void OStringType::initializeClone( const OXSDDataType& _rCloneSource )
487 {
488 OStringType_Base::initializeClone( _rCloneSource );
489 initializeTypedClone( static_cast< const OStringType& >( _rCloneSource ) );
490 }
491
492
493
495 {
496 m_aLength = _rCloneSource.m_aLength;
497 m_aMinLength = _rCloneSource.m_aMinLength;
498 m_aMaxLength = _rCloneSource.m_aMaxLength;
499 }
500
501
502 bool OStringType::checkPropertySanity( sal_Int32 _nHandle, const Any& _rNewValue, OUString& _rErrorMessage )
503 {
504 // let the base class do the conversion
505 if ( !OStringType_Base::checkPropertySanity( _nHandle, _rNewValue, _rErrorMessage ) )
506 return false;
507
508 _rErrorMessage.clear();
509 switch ( _nHandle )
510 {
514 {
515 sal_Int32 nValue( 0 );
516 OSL_VERIFY( _rNewValue >>= nValue );
517 if ( nValue < 0 )
518 _rErrorMessage = "Length limits must denote positive integer values.";
519 // TODO/eforms: localize the error message
520 }
521 break;
522 }
523
524 return _rErrorMessage.isEmpty();
525 }
526
527
528 TranslateId OStringType::_validate( const OUString& rValue )
529 {
530 // check regexp, whitespace etc. in parent class
531 TranslateId pReason = OStringType_Base::_validate( rValue );
532
533 if (!pReason)
534 {
535 // check string constraints
536 sal_Int32 nLength = rValue.getLength();
537 sal_Int32 nLimit = 0;
538 if ( m_aLength >>= nLimit )
539 {
540 if ( nLimit != nLength )
541 pReason = RID_STR_XFORMS_VALUE_LENGTH;
542 }
543 else
544 {
545 if ( ( m_aMaxLength >>= nLimit ) && ( nLength > nLimit ) )
546 pReason = RID_STR_XFORMS_VALUE_MAX_LENGTH;
547 else if ( ( m_aMinLength >>= nLimit ) && ( nLength < nLimit ) )
548 pReason = RID_STR_XFORMS_VALUE_MIN_LENGTH;
549 }
550 }
551 return pReason;
552 }
553
555 {
556 sal_Int32 nValue = 0;
557 OUStringBuffer sInfo;
558 if (rReason == RID_STR_XFORMS_VALUE_LENGTH)
559 {
560 if( m_aLength >>= nValue )
561 sInfo.append( nValue );
562 }
563 else if (rReason == RID_STR_XFORMS_VALUE_MAX_LENGTH)
564 {
565 if( m_aMaxLength >>= nValue )
566 sInfo.append( nValue );
567 }
568 else if (rReason == RID_STR_XFORMS_VALUE_MIN_LENGTH)
569 {
570 if( m_aMinLength >>= nValue )
571 sInfo.append( nValue );
572 }
573 else if (rReason)
574 {
575 sInfo.append(OStringType_Base::_explainInvalid(rReason));
576 }
577 return sInfo.makeStringAndClear();
578 }
579
580
581 OAnyURIType::OAnyURIType( const OUString& _rName, sal_Int16 _nTypeClass )
582 :OAnyURIType_Base( _rName, _nTypeClass )
583 {
584 m_xURLTransformer = css::util::URLTransformer::create(::comphelper::getProcessComponentContext());
585 }
586
587
589 {
591
592 registerMayBeVoidProperty( PROPERTY_XSD_LENGTH, PROPERTY_ID_XSD_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
594
595 registerMayBeVoidProperty( PROPERTY_XSD_MIN_LENGTH, PROPERTY_ID_XSD_MIN_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
597
598 registerMayBeVoidProperty( PROPERTY_XSD_MAX_LENGTH, PROPERTY_ID_XSD_MAX_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
600 }
601
602
604 {
605 return new OAnyURIType( _rName, getTypeClass() );
606 }
607 void OAnyURIType::initializeClone( const OXSDDataType& _rCloneSource )
608 {
609 OAnyURIType_Base::initializeClone( _rCloneSource );
610 initializeTypedClone( static_cast< const OAnyURIType& >( _rCloneSource ) );
611 }
612
613
614
616 {
617 m_aLength = _rCloneSource.m_aLength;
618 m_aMinLength = _rCloneSource.m_aMinLength;
619 m_aMaxLength = _rCloneSource.m_aMaxLength;
620 }
621
622
623 bool OAnyURIType::checkPropertySanity( sal_Int32 _nHandle, const Any& _rNewValue, OUString& _rErrorMessage )
624 {
625 // let the base class do the conversion
626 if ( !OAnyURIType_Base::checkPropertySanity( _nHandle, _rNewValue, _rErrorMessage ) )
627 return false;
628
629 _rErrorMessage.clear();
630 switch ( _nHandle )
631 {
635 {
636 sal_Int32 nValue( 0 );
637 OSL_VERIFY( _rNewValue >>= nValue );
638 if ( nValue < 0 )
639 _rErrorMessage = "Length limits must denote positive integer values.";
640 // TODO/eforms: localize the error message
641 }
642 break;
643 }
644
645 return _rErrorMessage.isEmpty();
646 }
647
648
649 TranslateId OAnyURIType::_validate( const OUString& rValue )
650 {
651 // check regexp, whitespace etc. in parent class
652 TranslateId pReason = OAnyURIType_Base::_validate( rValue );
653
654 if (!pReason)
655 {
656 // check AnyURI constraints
657 sal_Int32 nLength = rValue.getLength();
658 sal_Int32 nLimit = 0;
659 if ( m_aLength >>= nLimit )
660 {
661 if ( nLimit != nLength )
662 pReason = RID_STR_XFORMS_VALUE_LENGTH;
663 }
664 else
665 {
666 if ( ( m_aMaxLength >>= nLimit ) && ( nLength > nLimit ) )
667 pReason = RID_STR_XFORMS_VALUE_MAX_LENGTH;
668 else if ( ( m_aMinLength >>= nLimit ) && ( nLength < nLimit ) )
669 pReason = RID_STR_XFORMS_VALUE_MIN_LENGTH;
670 }
671 // check URL
672 css::util::URL aCommandURL;
673 aCommandURL.Complete = rValue;
674 if (!m_xURLTransformer->parseStrict(aCommandURL))
675 pReason = RID_STR_XFORMS_INVALID_VALUE;
676
677 }
678 return pReason;
679 }
680
682 {
683 sal_Int32 nValue = 0;
684 OUStringBuffer sInfo;
685 if (rReason == RID_STR_XFORMS_VALUE_LENGTH)
686 {
687 if( m_aLength >>= nValue )
688 sInfo.append( nValue );
689 }
690 else if (rReason == RID_STR_XFORMS_VALUE_MAX_LENGTH)
691 {
692 if( m_aMaxLength >>= nValue )
693 sInfo.append( nValue );
694 }
695 else if (rReason == RID_STR_XFORMS_VALUE_MIN_LENGTH)
696 {
697 if( m_aMinLength >>= nValue )
698 sInfo.append( nValue );
699 }
700 else if (rReason)
701 {
702 sInfo.append(OAnyURIType_Base::_explainInvalid(rReason));
703 }
704 return sInfo.makeStringAndClear();
705 }
706
707 OBooleanType::OBooleanType( const OUString& _rName )
708 :OBooleanType_Base( _rName, DataTypeClass::BOOLEAN )
709 {
710 }
711
713 {
714 return new OBooleanType( _rName );
715 }
716
717 void OBooleanType::initializeClone( const OXSDDataType& _rCloneSource )
718 {
719 OBooleanType_Base::initializeClone( _rCloneSource );
720 }
721
722 TranslateId OBooleanType::_validate( const OUString& sValue )
723 {
724 TranslateId pInvalidityReason = OBooleanType_Base::_validate( sValue );
725 if ( pInvalidityReason )
726 return pInvalidityReason;
727
728 bool bValid = sValue == "0" || sValue == "1" || sValue == "true" || sValue == "false";
729 return bValid ? TranslateId() : RID_STR_XFORMS_INVALID_VALUE;
730 }
731
733 {
734 return !rReason ? OUString() : getName();
735 }
736
737 ODecimalType::ODecimalType( const OUString& _rName, sal_Int16 _nTypeClass )
738 :ODecimalType_Base( _rName, _nTypeClass )
739 {
740 }
741
743 {
744 return new ODecimalType( _rName, getTypeClass() );
745 }
746 void ODecimalType::initializeClone( const OXSDDataType& _rCloneSource )
747 {
748 ODecimalType_Base::initializeClone( _rCloneSource );
749 initializeTypedClone( static_cast< const ODecimalType& >( _rCloneSource ) );
750 }
751
753 {
754 m_aTotalDigits = _rCloneSource.m_aTotalDigits;
755 m_aFractionDigits = _rCloneSource.m_aFractionDigits;
756 }
757
758
760 {
762
763 registerMayBeVoidProperty( PROPERTY_XSD_TOTAL_DIGITS, PROPERTY_ID_XSD_TOTAL_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
765
766 registerMayBeVoidProperty( PROPERTY_XSD_FRACTION_DIGITS, PROPERTY_ID_XSD_FRACTION_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID,
768 }
769
770
771 // validate decimals and return code for which facets failed
772 // to be used by: ODecimalType::validate and ODecimalType::explainInvalid
773 TranslateId ODecimalType::_validate( const OUString& rValue )
774 {
775 TranslateId pReason = ODecimalType_Base::_validate( rValue );
776
777 // check digits (if no other cause is available so far)
778 if (!pReason)
779 {
780 sal_Int32 nLength = rValue.getLength();
781 sal_Int32 n = 0;
782 sal_Int32 nTotalDigits = 0;
783 sal_Int32 nFractionDigits = 0;
784 const sal_Unicode* pValue = rValue.getStr();
785 for( ; n < nLength && pValue[n] != '.'; n++ )
786 if( pValue[n] >= '0'
787 && pValue[n] <= '9')
788 nTotalDigits++;
789 for( ; n < nLength; n++ )
790 if( pValue[n] >= '0'
791 && pValue[n] <= '9')
792 nFractionDigits++;
793 nTotalDigits += nFractionDigits;
794
795 sal_Int32 nValue = 0;
796 if( ( m_aTotalDigits >>= nValue ) && nTotalDigits > nValue )
797 pReason = RID_STR_XFORMS_VALUE_TOTAL_DIGITS;
798 else if( ( m_aFractionDigits >>= nValue ) &&
799 ( nFractionDigits > nValue ) )
800 pReason = RID_STR_XFORMS_VALUE_FRACTION_DIGITS;
801 }
802
803 return pReason;
804 }
805
807 {
808 sal_Int32 nValue = 0;
809 OUStringBuffer sInfo;
810 if (rReason == RID_STR_XFORMS_VALUE_TOTAL_DIGITS)
811 {
812 if( m_aTotalDigits >>= nValue )
813 sInfo.append( nValue );
814 }
815 else if (rReason == RID_STR_XFORMS_VALUE_FRACTION_DIGITS)
816 {
817 if( m_aFractionDigits >>= nValue )
818 sInfo.append( nValue );
819 }
820 else
821 {
822 sInfo.append(ODecimalType_Base::_explainInvalid(rReason));
823 }
824 return sInfo.makeStringAndClear();
825 }
826
827 OUString ODecimalType::typedValueAsHumanReadableString( const Any& _rValue ) const
828 {
829 double fValue( 0 );
830 normalizeValue( _rValue, fValue );
831 return OUString::number( fValue );
832 }
833
834
835 void ODecimalType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
836 {
837 OSL_VERIFY( _rValue >>= _rDoubleValue );
838 }
839
840
841 ODateType::ODateType(const OUString& _rName)
842 :ODateType_Base(_rName, DataTypeClass::DATE)
843 {
844 }
846 {
847 return new ODateType(_rName);
848 }
849 void ODateType::initializeClone( const OXSDDataType& _rCloneSource )
850 {
851 ODateType_Base::initializeClone(_rCloneSource);
852 initializeTypedClone(static_cast< const ODateType& >(_rCloneSource));
853 }
854
855 TranslateId ODateType::_validate( const OUString& _rValue )
856 {
857 return ODateType_Base::_validate( _rValue );
858 }
859
860 bool ODateType::_getValue( const OUString& value, double& fValue )
861 {
862 Any aTypeValue;
863 try
864 {
865 aTypeValue = Convert::get().toAny( value, getCppuType() );
866 }
867 catch (com::sun::star::lang::IllegalArgumentException)
868 {
869 return false;
870 }
871
872 Date aValue;
873 if ( !( aTypeValue >>= aValue ) )
874 return false;
875
876 ::Date aToolsDate( aValue.Day, aValue.Month, aValue.Year );
877 fValue = aToolsDate.GetDate();
878 return true;
879 }
880
881
882 OUString ODateType::typedValueAsHumanReadableString( const Any& _rValue ) const
883 {
884 OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "ODateType::typedValueAsHumanReadableString: unexpected type" );
885 return Convert::get().toXSD( _rValue );
886 }
887
888
889 void ODateType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
890 {
891 Date aValue;
892 OSL_VERIFY( _rValue >>= aValue );
893 ::Date aToolsDate( aValue.Day, aValue.Month, aValue.Year );
894 _rDoubleValue = aToolsDate.GetDate();
895 }
896
897
898 OTimeType::OTimeType(const OUString& _rName)
899 :OTimeType_Base(_rName, DataTypeClass::TIME)
900 {
901 }
903 {
904 return new OTimeType(_rName);
905 }
906 void OTimeType::initializeClone( const OXSDDataType& _rCloneSource )
907 {
908 OTimeType_Base::initializeClone(_rCloneSource);
909 initializeTypedClone(static_cast< const OTimeType& >(_rCloneSource));
910 }
911
912 TranslateId OTimeType::_validate( const OUString& _rValue )
913 {
914 return OTimeType_Base::_validate( _rValue );
915 }
916
917 bool OTimeType::_getValue( const OUString& value, double& fValue )
918 {
919 Any aTypedValue;
920 try
921 {
922 aTypedValue = Convert::get().toAny( value, getCppuType() );
923 }
924 catch (com::sun::star::lang::IllegalArgumentException)
925 {
926 return false;
927 }
928
929 css::util::Time aValue;
930 if ( !( aTypedValue >>= aValue ) )
931 return false;
932
933 ::tools::Time aToolsTime( aValue );
934 // no loss/rounding; IEEE 754 double-precision floating-point
935 // has a mantissa of 53 bits; we need at the very most 50 bits:
936 // format of aToolsTime.GetTime() is (in decimal) hhmmssnnnnnnnnn
937 // and 999999999999999 = 0x38D7EA4C67FFF
938 // in reality I doubt we need (much) more than
939 // 240000000000000 = 0x0DA475ABF0000
940 // that is 48 bits
941 fValue = aToolsTime.GetTime();
942 return true;
943 }
944
945
946 OUString OTimeType::typedValueAsHumanReadableString( const Any& _rValue ) const
947 {
948 OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "OTimeType::typedValueAsHumanReadableString: unexpected type" );
949 return Convert::get().toXSD( _rValue );
950 }
951
952
953 void OTimeType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
954 {
955 css::util::Time aValue;
956 OSL_VERIFY( _rValue >>= aValue );
957 ::tools::Time aToolsTime( aValue );
958 _rDoubleValue = aToolsTime.GetTime();
959 }
960
961
962 ODateTimeType::ODateTimeType(const OUString& _rName)
963 :ODateTimeType_Base(_rName, DataTypeClass::DATETIME)
964 {
965 }
967 {
968 return new ODateTimeType(_rName);
969 }
970 void ODateTimeType::initializeClone( const OXSDDataType& _rCloneSource )
971 {
973 initializeTypedClone(static_cast< const ODateTimeType& >(_rCloneSource));
974 }
975
976 TranslateId ODateTimeType::_validate( const OUString& _rValue )
977 {
978 return ODateTimeType_Base::_validate( _rValue );
979 }
980
981 namespace
982 {
983 double lcl_normalizeDateTime( const DateTime& _rValue )
984 {
985 ::DateTime aToolsValue(_rValue);
986
987 double fValue = 0;
988 // days since 1.1.1900 (which is relatively arbitrary but fixed date)
989 fValue += ::Date( aToolsValue ) - ::Date( 1, 1, 1900 );
990 // time
991 fValue += aToolsValue.GetTimeInDays();
992 return fValue;
993 }
994 }
995
996
997 bool ODateTimeType::_getValue( const OUString& value, double& fValue )
998 {
999 Any aTypedValue;
1000 try
1001 {
1002 aTypedValue = Convert::get().toAny( value, getCppuType() );
1003 }
1004 catch (com::sun::star::uno::RuntimeException)
1005 {
1006 return false;
1007 }
1008
1009 DateTime aValue;
1010 if ( !( aTypedValue >>= aValue ) )
1011 return false;
1012
1013 fValue = lcl_normalizeDateTime( aValue );
1014 return true;
1015 }
1016
1017
1018 OUString ODateTimeType::typedValueAsHumanReadableString( const Any& _rValue ) const
1019 {
1020 OSL_PRECOND( _rValue.getValueType().equals( getCppuType() ), "OTimeType::typedValueAsHumanReadableString: unexpected type" );
1021 OUString sString = Convert::get().toXSD( _rValue );
1022
1023 // ISO 8601 notation has a "T" to separate between date and time. Our only concession
1024 // to the "human readable" in the method name is to replace this T with a whitespace.
1025 OSL_ENSURE( sString.indexOf( 'T' ) != -1, "ODateTimeType::typedValueAsHumanReadableString: hmm - no ISO notation?" );
1026 return sString.replace( 'T', ' ' );
1027 }
1028
1029
1030 void ODateTimeType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
1031 {
1032 DateTime aValue;
1033 OSL_VERIFY( _rValue >>= aValue );
1034 _rDoubleValue = lcl_normalizeDateTime( aValue );
1035 }
1036
1037 OShortIntegerType::OShortIntegerType( const OUString& _rName, sal_Int16 _nTypeClass )
1038 :OShortIntegerType_Base( _rName, _nTypeClass )
1039 {
1040 }
1041
1043 {
1044 return new OShortIntegerType( _rName, getTypeClass() );
1045 }
1047 {
1049 initializeTypedClone( static_cast< const OShortIntegerType& >( _rCloneSource ) );
1050 }
1051
1052 static bool lcl_getValueYear( std::u16string_view value, double& fValue )
1053 {
1054 if (value.size() > 4)
1055 {
1056 fValue = 0;
1057 return false;
1058 }
1059 if (o3tl::equalsAscii(value, "0"))
1060 {
1061 fValue = 0;
1062 return true;
1063 }
1064 sal_Int32 int32Value = o3tl::toInt32(value);
1065 if (
1066 int32Value == 0 ||
1067 int32Value < 0 ||
1068 int32Value > 10000
1069 )
1070 {
1071 fValue = 0;
1072 return false;
1073 }
1074 fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
1075 return true;
1076 }
1077
1078 static bool lcl_getValueMonth( std::u16string_view value, double& fValue )
1079 {
1080 if (value.size() > 2)
1081 {
1082 fValue = 0;
1083 return false;
1084 }
1085 sal_Int32 int32Value = o3tl::toInt32(value);
1086 if (
1087 int32Value == 0 ||
1088 int32Value < 1 ||
1089 int32Value > 12
1090 )
1091 {
1092 fValue = 0;
1093 return false;
1094 }
1095 fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
1096 return true;
1097 }
1098
1099 static bool lcl_getValueDay( std::u16string_view value, double& fValue )
1100 {
1101 if (value.size() > 2)
1102 {
1103 fValue = 0;
1104 return false;
1105 }
1106 sal_Int32 int32Value = o3tl::toInt32(value);
1107 if (
1108 int32Value == 0 ||
1109 int32Value < 1 ||
1110 int32Value > 31
1111 )
1112 {
1113 fValue = 0;
1114 return false;
1115 }
1116 fValue = static_cast<double>(static_cast<sal_Int16>(int32Value));
1117 return true;
1118 }
1119
1120 bool OShortIntegerType::_getValue( const OUString& value, double& fValue )
1121 {
1122 switch (this->getTypeClass())
1123 {
1124 case css::xsd::DataTypeClass::gYear:
1125 return lcl_getValueYear(value, fValue);
1126
1127 case css::xsd::DataTypeClass::gMonth:
1128 return lcl_getValueMonth(value, fValue);
1129
1130 case css::xsd::DataTypeClass::gDay:
1131 return lcl_getValueDay(value, fValue);
1132 default:
1133 // for the moment, the only types which derive from OShortIntegerType are:
1134 // gYear, gMonth and gDay, see ODataTypeRepository ctr
1135 return false;
1136 }
1137 }
1138
1139
1140 OUString OShortIntegerType::typedValueAsHumanReadableString( const Any& _rValue ) const
1141 {
1142 sal_Int16 nValue( 0 );
1143 OSL_VERIFY( _rValue >>= nValue );
1144 return OUString::number( nValue );
1145 }
1146
1147
1148 void OShortIntegerType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
1149 {
1150 sal_Int16 nValue( 0 );
1151 OSL_VERIFY( _rValue >>= nValue );
1152 _rDoubleValue = nValue;
1153 }
1154
1155
1156template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
1158 :SUPERCLASS( _rName, _nTypeClass )
1159 ,m_bPropertiesRegistered( false )
1160{
1161}
1162
1163
1164template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
1166{
1167 css::uno::Sequence< css::beans::Property > aProps;
1169 return new ::cppu::OPropertyArrayHelper( aProps );
1170}
1171
1172
1173template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
1174css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getPropertySetInfo()
1175{
1176 return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
1177}
1178
1179
1180template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS >
1182{
1183 if ( !m_bPropertiesRegistered )
1184 {
1185 this->registerProperties();
1186 m_bPropertiesRegistered = true;
1187 }
1188
1190}
1191
1192
1193template< typename VALUE_TYPE >
1194OValueLimitedType< VALUE_TYPE >::OValueLimitedType( const OUString& _rName, sal_Int16 _nTypeClass )
1195 :OValueLimitedType_Base( _rName, _nTypeClass )
1196{
1197}
1198
1199} // namespace xforms
1200
1201
1202/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetDate() const
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
void registerMayBeVoidProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any *_pPointerToMember, const css::uno::Type &_rExpectedType)
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue) override final
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
sal_Int64 GetTime() const
static Convert & get()
get/create Singleton class
Definition: convert.cxx:274
css::uno::Any toAny(const OUString &, const css::uno::Type &)
convert XML representation to Any of given type
Definition: convert.cxx:297
OUString toXSD(const css::uno::Any &rAny)
convert any to XML representation
Definition: convert.cxx:291
virtual OUString _explainInvalid(TranslateId rReason) override
Definition: datatypes.cxx:681
css::uno::Any m_aLength
Definition: datatypes.hxx:270
virtual bool checkPropertySanity(sal_Int32 _nHandle, const css::uno::Any &_rNewValue, OUString &_rErrorMessage) override
Definition: datatypes.cxx:623
virtual void registerProperties() override
Definition: datatypes.cxx:588
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:649
css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer
Definition: datatypes.hxx:275
OAnyURIType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:581
css::uno::Any m_aMinLength
Definition: datatypes.hxx:271
css::uno::Any m_aMaxLength
Definition: datatypes.hxx:272
void initializeTypedClone(const OAnyURIType &_rCloneSource)
Definition: datatypes.cxx:615
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:607
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:603
OBooleanType(const OUString &_rName)
Definition: datatypes.cxx:707
virtual OUString _explainInvalid(TranslateId rReason) override
Definition: datatypes.cxx:732
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:722
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:717
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:712
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:970
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const override
Definition: datatypes.cxx:1018
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const override
Definition: datatypes.cxx:1030
virtual bool _getValue(const OUString &value, double &fValue) override
Definition: datatypes.cxx:997
ODateTimeType(const OUString &_rName)
Definition: datatypes.cxx:962
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:976
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:966
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const override
Definition: datatypes.cxx:882
ODateType(const OUString &_rName)
Definition: datatypes.cxx:841
virtual bool _getValue(const OUString &value, double &fValue) override
Definition: datatypes.cxx:860
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:855
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const override
Definition: datatypes.cxx:889
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:849
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:845
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const override
Definition: datatypes.cxx:835
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const override
Definition: datatypes.cxx:827
virtual OUString _explainInvalid(TranslateId rReason) override
Definition: datatypes.cxx:806
virtual void registerProperties() override
Definition: datatypes.cxx:759
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:742
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:746
css::uno::Any m_aFractionDigits
Definition: datatypes.hxx:297
css::uno::Any m_aTotalDigits
Definition: datatypes.hxx:296
void initializeTypedClone(const ODecimalType &_rCloneSource)
Definition: datatypes.cxx:752
ODecimalType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:737
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:773
helper class for implementing interfaces derived from XDataType
Definition: datatypes.hxx:208
ODerivedDataType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:1157
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: datatypes.cxx:1174
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: datatypes.cxx:1165
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: datatypes.cxx:1181
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:1042
OShortIntegerType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:1037
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const override
Definition: datatypes.cxx:1140
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:1046
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const override
Definition: datatypes.cxx:1148
virtual bool _getValue(const OUString &value, double &fValue) override
Definition: datatypes.cxx:1120
virtual OUString _explainInvalid(TranslateId rReason) override
Definition: datatypes.cxx:554
void initializeTypedClone(const OStringType &_rCloneSource)
Definition: datatypes.cxx:494
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:482
virtual bool checkPropertySanity(sal_Int32 _nHandle, const css::uno::Any &_rNewValue, OUString &_rErrorMessage) override
Definition: datatypes.cxx:502
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:486
css::uno::Any m_aLength
Definition: datatypes.hxx:245
css::uno::Any m_aMinLength
Definition: datatypes.hxx:246
css::uno::Any m_aMaxLength
Definition: datatypes.hxx:247
virtual void registerProperties() override
Definition: datatypes.cxx:467
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:528
OStringType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:461
virtual bool _getValue(const OUString &value, double &fValue) override
Definition: datatypes.cxx:917
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:906
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const override
Definition: datatypes.cxx:946
OTimeType(const OUString &_rName)
Definition: datatypes.cxx:898
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const override
Definition: datatypes.cxx:902
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const override
Definition: datatypes.cxx:953
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:912
void initializeTypedClone(const OValueLimitedType_Base &_rCloneSource)
Definition: datatypes.cxx:336
virtual bool _getValue(const OUString &value, double &fValue)
Definition: datatypes.cxx:402
virtual TranslateId _validate(const OUString &value) override
Definition: datatypes.cxx:421
OValueLimitedType_Base(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:319
virtual void normalizeValue(const css::uno::Any &_rValue, double &_rDoubleValue) const =0
translates a <member>ValueType</member> value into a double value
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: datatypes.cxx:349
virtual OUString _explainInvalid(TranslateId rReason) override
Definition: datatypes.cxx:445
virtual OUString typedValueAsHumanReadableString(const css::uno::Any &_rValue) const =0
translate a given value into a human-readable string
virtual void initializeClone(const OXSDDataType &_rCloneSource) override
Definition: datatypes.cxx:329
OValueLimitedType(const OUString &_rName, sal_Int16 _nTypeClass)
Definition: datatypes.cxx:1194
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: datatypes.cxx:290
rtl::Reference< OXSDDataType > clone(const OUString &_rNewName) const
Definition: datatypes.cxx:94
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: datatypes.cxx:296
virtual sal_Bool SAL_CALL getIsBasic() override
Definition: datatypes.cxx:147
virtual TranslateId _validate(const OUString &value)
Definition: datatypes.cxx:215
sal_Int16 getTypeClass() const
Definition: datatypes.hxx:71
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: datatypes.cxx:256
virtual OUString SAL_CALL explainInvalid(const OUString &value) override
Definition: datatypes.cxx:165
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: datatypes.cxx:302
virtual bool checkPropertySanity(sal_Int32 _nHandle, const css::uno::Any &_rNewValue, OUString &_rErrorMessage)
Definition: datatypes.cxx:264
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: datatypes.cxx:314
::std::unique_ptr< U_NAMESPACE_QUALIFIER RegexMatcher > m_pPatternMatcher
Definition: datatypes.hxx:67
OXSDDataType(const OXSDDataType &)=delete
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: datatypes.cxx:308
virtual ~OXSDDataType() override
Definition: datatypes.cxx:69
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, sal_Int32 _nHandle, const css::uno::Any &_rValue) override
Definition: datatypes.cxx:236
virtual OUString SAL_CALL getName() override
Definition: datatypes.cxx:107
virtual void initializeClone(const OXSDDataType &_rCloneSource)
Definition: datatypes.cxx:85
virtual OUString SAL_CALL getPattern() override
Definition: datatypes.cxx:121
virtual OUString _explainInvalid(TranslateId rReason)
Definition: datatypes.cxx:177
virtual sal_Bool SAL_CALL validate(const OUString &value) override
Definition: datatypes.cxx:159
virtual rtl::Reference< OXSDDataType > createClone(const OUString &_rName) const =0
virtual sal_Int16 SAL_CALL getWhiteSpaceTreatment() override
Definition: datatypes.cxx:134
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: datatypes.cxx:284
virtual void registerProperties()
Definition: datatypes.cxx:74
virtual void SAL_CALL setPattern(const OUString &_pattern) override
Definition: datatypes.cxx:127
virtual void SAL_CALL setName(const OUString &aName) override
Definition: datatypes.cxx:113
virtual void SAL_CALL setWhiteSpaceTreatment(sal_Int16 _whitespacetreatment) override
Definition: datatypes.cxx:140
sal_Int16 m_nTypeClass
Definition: datatypes.hxx:60
Any value
const bool READONLY
OUString m_sName
float u
sal_Int16 nValue
constexpr OUStringLiteral PROPERTY_XSD_TYPE_CLASS
constexpr OUStringLiteral PROPERTY_XSD_WHITESPACE
constexpr OUStringLiteral PROPERTY_NAME
Definition: frm_strings.hxx:28
constexpr OUStringLiteral PROPERTY_XSD_IS_BASIC
constexpr OUStringLiteral PROPERTY_XSD_MAX_LENGTH
constexpr OUStringLiteral PROPERTY_XSD_TOTAL_DIGITS
constexpr OUStringLiteral PROPERTY_XSD_LENGTH
constexpr OUStringLiteral PROPERTY_XSD_FRACTION_DIGITS
constexpr OUStringLiteral PROPERTY_XSD_MIN_LENGTH
constexpr OUStringLiteral PROPERTY_XSD_PATTERN
OUString aName
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
DATE
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
bool equalsAscii(std::u16string_view s1, std::string_view s2)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
::cppu::WeakImplHelper< css::xsd::XDataType > OXSDDataType_Base
Definition: datatypes.hxx:49
static bool lcl_getValueDay(std::u16string_view value, double &fValue)
Definition: datatypes.cxx:1099
static bool lcl_getValueMonth(std::u16string_view value, double &fValue)
Definition: datatypes.cxx:1078
static bool lcl_getValueYear(std::u16string_view value, double &fValue)
Definition: datatypes.cxx:1052
OUString getResource(TranslateId pResourceId)
get a resource string for the current language
#define PROPERTY_ID_XSD_MAX_INCLUSIVE_INT
Definition: property.hxx:276
#define PROPERTY_ID_XSD_LENGTH
Definition: property.hxx:271
#define PROPERTY_ID_NAME
Definition: property.hxx:40
#define PROPERTY_ID_XSD_PATTERN
Definition: property.hxx:269
#define PROPERTY_ID_XSD_WHITESPACE
Definition: property.hxx:270
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME
Definition: property.hxx:294
#define PROPERTY_ID_XSD_TYPE_CLASS
Definition: property.hxx:297
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT
Definition: property.hxx:277
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE
Definition: property.hxx:281
#define PROPERTY_ID_XSD_IS_BASIC
Definition: property.hxx:296
#define PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME
Definition: property.hxx:288
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME
Definition: property.hxx:295
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME
Definition: property.hxx:293
#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE
Definition: property.hxx:284
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE
Definition: property.hxx:286
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME
Definition: property.hxx:289
#define PROPERTY_ID_XSD_TOTAL_DIGITS
Definition: property.hxx:274
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME
Definition: property.hxx:290
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE
Definition: property.hxx:282
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME
Definition: property.hxx:291
#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME
Definition: property.hxx:292
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE
Definition: property.hxx:283
#define PROPERTY_ID_XSD_MAX_LENGTH
Definition: property.hxx:273
#define PROPERTY_ID_XSD_MIN_LENGTH
Definition: property.hxx:272
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT
Definition: property.hxx:279
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE
Definition: property.hxx:287
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE
Definition: property.hxx:285
#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE
Definition: property.hxx:280
#define PROPERTY_ID_XSD_FRACTION_DIGITS
Definition: property.hxx:275
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_INT
Definition: property.hxx:278
unsigned char sal_Bool
sal_uInt16 sal_Unicode
sal_Int32 nLength