diff options
Diffstat (limited to 'xmloff/source/forms')
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 8 | ||||
-rwxr-xr-x | xmloff/source/forms/property_meta_data.cxx | 40 |
2 files changed, 31 insertions, 17 deletions
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index a25e7533a1..a944e62ef1 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -880,6 +880,7 @@ namespace xmloff ++aValueProps ) { + bool bSuccess = false; switch (aValueProps->Handle) { case PROPID_VALUE: @@ -889,6 +890,7 @@ namespace xmloff if (!bRetrievedValues) { getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty); + ENSURE_OR_BREAK( pCurrentValueProperty && pValueProperty, "OControlImport::StartElement: illegal value property names!" ); bRetrievedValues = sal_True; } OSL_ENSURE((PROPID_VALUE != aValueProps->Handle) || pValueProperty, @@ -901,6 +903,7 @@ namespace xmloff aValueProps->Name = ::rtl::OUString::createFromAscii(pValueProperty); else aValueProps->Name = ::rtl::OUString::createFromAscii(pCurrentValueProperty); + bSuccess = true; } break; case PROPID_MIN_VALUE: @@ -910,6 +913,7 @@ namespace xmloff if (!bRetrievedValueLimits) { getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty); + ENSURE_OR_BREAK( pMinValueProperty && pMaxValueProperty, "OControlImport::StartElement: illegal value limit property names!" ); bRetrievedValueLimits = sal_True; } OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty, @@ -922,10 +926,14 @@ namespace xmloff aValueProps->Name = ::rtl::OUString::createFromAscii(pMinValueProperty); else aValueProps->Name = ::rtl::OUString::createFromAscii(pMaxValueProperty); + bSuccess = true; } break; } + if ( !bSuccess ) + continue; + // translate the value implTranslateValueProperty(m_xInfo, *aValueProps); // add the property to the base class' array diff --git a/xmloff/source/forms/property_meta_data.cxx b/xmloff/source/forms/property_meta_data.cxx index a907112dbe..7f058d14b9 100755 --- a/xmloff/source/forms/property_meta_data.cxx +++ b/xmloff/source/forms/property_meta_data.cxx @@ -51,19 +51,26 @@ namespace xmloff { namespace metadata //= property meta data //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - static const PropertyDescription s_propertyMetaData[] = + namespace { - FORM_SINGLE_PROPERTY( DATE_MIN, XML_MIN_VALUE ), - FORM_SINGLE_PROPERTY( DATE_MAX, XML_MAX_VALUE ), - FORM_SINGLE_PROPERTY( DEFAULT_DATE, XML_VALUE ), - FORM_SINGLE_PROPERTY( DATE, XML_CURRENT_VALUE ), - FORM_SINGLE_PROPERTY( TIME_MIN, XML_MIN_VALUE ), - FORM_SINGLE_PROPERTY( TIME_MAX, XML_MAX_VALUE ), - FORM_SINGLE_PROPERTY( DEFAULT_TIME, XML_VALUE ), - FORM_SINGLE_PROPERTY( TIME, XML_CURRENT_VALUE ), + const PropertyDescription* lcl_getPropertyMetaData() + { + static const PropertyDescription s_propertyMetaData[] = + { + FORM_SINGLE_PROPERTY( DATE_MIN, XML_MIN_VALUE ), + FORM_SINGLE_PROPERTY( DATE_MAX, XML_MAX_VALUE ), + FORM_SINGLE_PROPERTY( DEFAULT_DATE, XML_VALUE ), + FORM_SINGLE_PROPERTY( DATE, XML_CURRENT_VALUE ), + FORM_SINGLE_PROPERTY( TIME_MIN, XML_MIN_VALUE ), + FORM_SINGLE_PROPERTY( TIME_MAX, XML_MAX_VALUE ), + FORM_SINGLE_PROPERTY( DEFAULT_TIME, XML_VALUE ), + FORM_SINGLE_PROPERTY( TIME, XML_CURRENT_VALUE ), - PropertyDescription() - }; + PropertyDescription() + }; + return s_propertyMetaData; + } + } //------------------------------------------------------------------------------------------------------------------ namespace @@ -85,7 +92,7 @@ namespace xmloff { namespace metadata static DescriptionsByName s_propertyDescriptionsByName; if ( s_propertyDescriptionsByName.empty() ) { - const PropertyDescription* desc = s_propertyMetaData; + const PropertyDescription* desc = lcl_getPropertyMetaData(); while ( desc->propertyName.getLength() != 0 ) { s_propertyDescriptionsByName[ desc->propertyName ] = desc; @@ -105,7 +112,7 @@ namespace xmloff { namespace metadata static IndexedPropertyGroups s_indexedPropertyGroups; if ( s_indexedPropertyGroups.empty() ) { - const PropertyDescription* desc = s_propertyMetaData; + const PropertyDescription* desc = lcl_getPropertyMetaData(); while ( desc->propertyName.getLength() != 0 ) { if ( desc->propertyGroup != NO_GROUP ) @@ -126,7 +133,7 @@ namespace xmloff { namespace metadata static ReverseTokenLookup s_reverseTokenLookup; if ( s_reverseTokenLookup.empty() ) { - const PropertyDescription* desc = s_propertyMetaData; + const PropertyDescription* desc = lcl_getPropertyMetaData(); while ( desc->propertyName.getLength() != 0 ) { s_reverseTokenLookup[ token::GetXMLToken( desc->attribute.attributeToken ) ] = desc->attribute.attributeToken; @@ -155,7 +162,7 @@ namespace xmloff { namespace metadata static AttributeGroups s_attributeGroups; if ( s_attributeGroups.empty() ) { - const PropertyDescription* desc = s_propertyMetaData; + const PropertyDescription* desc = lcl_getPropertyMetaData(); while ( desc->propertyName.getLength() != 0 ) { if ( desc->propertyGroup != NO_GROUP ) @@ -176,7 +183,7 @@ namespace xmloff { namespace metadata static AttributesWithoutGroup s_attributesWithoutGroup; if ( s_attributesWithoutGroup.empty() ) { - const PropertyDescription* desc = s_propertyMetaData; + const PropertyDescription* desc = lcl_getPropertyMetaData(); while ( desc->propertyName.getLength() != 0 ) { if ( desc->propertyGroup == NO_GROUP ) @@ -248,7 +255,6 @@ namespace xmloff { namespace metadata AttributeDescription getAttributeDescription( const sal_uInt16 i_namespacePrefix, const ::rtl::OUString& i_attributeName ) { AttributeDescription attribute; - const ReverseTokenLookup& rTokenLookup( getReverseTokenLookup() ); const ReverseTokenLookup::const_iterator pos = rTokenLookup.find( i_attributeName ); if ( pos != rTokenLookup.end() ) |