diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-11-01 11:34:47 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-11-01 11:34:47 +0100 |
commit | 98a64d26435b2e9a40e158f17f22641423e10183 (patch) | |
tree | 4f25e5c83863d73323438860f0771b9f64a6cc55 /xmloff | |
parent | f8a26479f2de04ba0237d4ba4159e39f03047773 (diff) |
dba34a: s_propertyMetaData should not be a global static, as it uses other global statics for initialization, which makes proper initialization dependent on module-load-order
Diffstat (limited to 'xmloff')
-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 1f1c28d579cf..eb6dd0965e76 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 a907112dbe58..7f058d14b9b7 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() ) |