diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-10-19 11:17:29 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-10-19 11:17:47 +0200 |
commit | 322d455f9f87deb0551d7360ba10e4ae6e3021ab (patch) | |
tree | 5c68c94ef4279cdb8066428fd193e3e0d00b66d7 /xmloff | |
parent | 5e80f012e75dfbcd3343fc45e35e0b32ca754b39 (diff) |
Simplified comphelper::OSequenceIterator and its uses.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 53 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.hxx | 6 |
2 files changed, 33 insertions, 26 deletions
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 13d770e7e2b3..050dd4bf0992 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -101,7 +101,21 @@ namespace xmloff return ( !bIsDefaultValue || bIsDynamicProperty ); } - //--------------------------------------------------------------------- + template< typename T > void + OPropertyExport::exportRemainingPropertiesSequence( + Any const & value, token::XMLTokenEnum eValueAttName) + { + OSequenceIterator< T > i(value); + while (i.hasMoreElements()) + { + ::rtl::OUString sValue(implConvertAny(i.nextElement())); + AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue ); + SvXMLElementExport aValueTag( + m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, + token::XML_LIST_VALUE, sal_True, sal_False); + } + } + void OPropertyExport::exportRemainingProperties() { // the properties tag (will be created if we have at least one no-default property) @@ -189,49 +203,40 @@ namespace xmloff continue; // the not-that-simple case, we need to iterate through the sequence elements - IIterator* pSequenceIterator = NULL; - switch ( aExportType.getTypeClass() ) { case TypeClass_STRING: - pSequenceIterator = new OSequenceIterator< ::rtl::OUString >(aValue); + exportRemainingPropertiesSequence< ::rtl::OUString >( + aValue, eValueAttName); break; case TypeClass_DOUBLE: - pSequenceIterator = new OSequenceIterator< double >(aValue); + exportRemainingPropertiesSequence< double >( + aValue, eValueAttName); break; case TypeClass_BOOLEAN: - pSequenceIterator = new OSequenceIterator< sal_Bool >(aValue); + exportRemainingPropertiesSequence< sal_Bool >( + aValue, eValueAttName); break; case TypeClass_BYTE: - pSequenceIterator = new OSequenceIterator< sal_Int8 >(aValue); + exportRemainingPropertiesSequence< sal_Int8 >( + aValue, eValueAttName); break; case TypeClass_SHORT: - pSequenceIterator = new OSequenceIterator< sal_Int16 >(aValue); + exportRemainingPropertiesSequence< sal_Int16 >( + aValue, eValueAttName); break; case TypeClass_LONG: - pSequenceIterator = new OSequenceIterator< sal_Int32 >(aValue); + exportRemainingPropertiesSequence< sal_Int32 >( + aValue, eValueAttName); break; case TypeClass_HYPER: - pSequenceIterator = new OSequenceIterator< sal_Int64 >(aValue); + exportRemainingPropertiesSequence< sal_Int64 >( + aValue, eValueAttName); break; default: OSL_FAIL("OPropertyExport::exportRemainingProperties: unsupported sequence tyoe !"); break; } - if (pSequenceIterator) - { - while (pSequenceIterator->hasMoreElements()) - { - sValue = - implConvertAny(pSequenceIterator->nextElement()); - AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue ); - SvXMLElementExport aValueTag( - m_rContext.getGlobalContext(), - XML_NAMESPACE_FORM, token::XML_LIST_VALUE, - sal_True, sal_False); - } - } - delete pSequenceIterator; } } catch(...) diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index e31704c40530..1e3eaab55dd3 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -105,8 +105,10 @@ namespace xmloff */ void examinePersistence(); - /** - */ + template< typename T > void exportRemainingPropertiesSequence( + com::sun::star::uno::Any const & value, + token::XMLTokenEnum eValueAttName); + void exportRemainingProperties(); /** indicates that a property has been handled by a derived class, without using the helper methods of this |