Kaydet (Commit) 93f19be7 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS dba204b (1.30.16); FILE MERGED

2006/07/14 11:05:52 fs 1.30.16.1: #i67019# allow for generic sequence properties
üst 20975544
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: propertyexport.cxx,v $ * $RCSfile: propertyexport.cxx,v $
* *
* $Revision: 1.30 $ * $Revision: 1.31 $
* *
* last change: $Author: hr $ $Date: 2006-06-19 18:20:32 $ * last change: $Author: rt $ $Date: 2006-07-26 07:33:32 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -158,7 +158,7 @@ namespace xmloff ...@@ -158,7 +158,7 @@ namespace xmloff
DBG_CHECK_PROPERTY_NO_TYPE(*aProperty); DBG_CHECK_PROPERTY_NO_TYPE(*aProperty);
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
const ::rtl::OUString sPropertyName = *aProperty; const ::rtl::OUString sPropertyName = *aProperty; (void)sPropertyName;
#endif #endif
// if the property state is DEFAULT, it does not need to be written // if the property state is DEFAULT, it does not need to be written
if (xPropertyState.is() && (PropertyState_DEFAULT_VALUE == xPropertyState->getPropertyState(*aProperty))) if (xPropertyState.is() && (PropertyState_DEFAULT_VALUE == xPropertyState->getPropertyState(*aProperty)))
...@@ -181,41 +181,46 @@ namespace xmloff ...@@ -181,41 +181,46 @@ namespace xmloff
aValue <<= makeAny(Sequence< ::rtl::OUString >(&sTemp, 1)); aValue <<= makeAny(Sequence< ::rtl::OUString >(&sTemp, 1));
} }
// the type to export
Type aExportType;
// is it a sequence // is it a sequence
sal_Bool bIsSequence = TypeClass_SEQUENCE == aValue.getValueTypeClass(); sal_Bool bIsSequence = TypeClass_SEQUENCE == aValue.getValueTypeClass();
// the type of the property, maybe reduced to the element type of a sequence // the type of the property, maybe reduced to the element type of a sequence
Type aSimpleType;
if (bIsSequence) if (bIsSequence)
aSimpleType = getSequenceElementType(aValue.getValueType()); aExportType = getSequenceElementType( aValue.getValueType() );
else else
aSimpleType = aValue.getValueType(); aExportType = aValue.getValueType();
// the type attribute // the type attribute
// modified by BerryJia for Bug102407 // modified by BerryJia for Bug102407
com::sun::star::beans::Property aPropertyStruct; bool bIsEmptyValue = TypeClass_VOID == aValue.getValueType().getTypeClass();
aPropertyStruct = m_xPropertyInfo->getPropertyByName(*aProperty); if ( bIsEmptyValue )
token::XMLTokenEnum eValueType = {
implGetPropertyXMLType(aPropertyStruct.Type); com::sun::star::beans::Property aPropDesc;
sal_Bool bIsVoid = !bIsSequence && aPropDesc = m_xPropertyInfo->getPropertyByName( *aProperty );
TypeClass_VOID == aValue.getValueType().getTypeClass(); aExportType = aPropDesc.Type;
if( bIsVoid ) }
AddAttribute(XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, token::XMLTokenEnum eValueType = implGetPropertyXMLType( aExportType );
token::XML_VOID );
if ( bIsEmptyValue )
AddAttribute( XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, token::XML_VOID );
else else
AddAttribute(XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, AddAttribute( XML_NAMESPACE_OFFICE, token::XML_VALUE_TYPE, eValueType );
eValueType);
token::XMLTokenEnum eValue = token::XMLTokenEnum eValueAttName( token::XML_VALUE );
token::XML_BOOLEAN == eValueType switch ( eValueType )
? token::XML_BOOLEAN_VALUE {
: (token::XML_STRING == eValueType case token::XML_BOOLEAN: eValueAttName = token::XML_BOOLEAN_VALUE; break;
? token::XML_STRING_VALUE case token::XML_STRING: eValueAttName = token::XML_STRING_VALUE; break;
: token::XML_VALUE); default: break;
}
if( !bIsSequence && !bIsVoid )
if( !bIsSequence && !bIsEmptyValue )
{ // the simple case { // the simple case
//add by BerryJia for Bug102407 //add by BerryJia for Bug102407
sValue = implConvertAny(aValue); sValue = implConvertAny(aValue);
AddAttribute(XML_NAMESPACE_OFFICE, eValue, sValue ); AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue );
} }
...@@ -230,7 +235,8 @@ namespace xmloff ...@@ -230,7 +235,8 @@ namespace xmloff
// the not-that-simple case, we need to iterate through the sequence elements // the not-that-simple case, we need to iterate through the sequence elements
IIterator* pSequenceIterator = NULL; IIterator* pSequenceIterator = NULL;
switch (aSimpleType.getTypeClass())
switch ( aExportType.getTypeClass() )
{ {
case TypeClass_STRING: case TypeClass_STRING:
pSequenceIterator = new OSequenceIterator< ::rtl::OUString >(aValue); pSequenceIterator = new OSequenceIterator< ::rtl::OUString >(aValue);
...@@ -263,7 +269,7 @@ namespace xmloff ...@@ -263,7 +269,7 @@ namespace xmloff
{ {
sValue = sValue =
implConvertAny(pSequenceIterator->nextElement()); implConvertAny(pSequenceIterator->nextElement());
AddAttribute(XML_NAMESPACE_OFFICE, eValue, sValue ); AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue );
SvXMLElementExport aValueTag( SvXMLElementExport aValueTag(
m_rContext.getGlobalContext(), m_rContext.getGlobalContext(),
XML_NAMESPACE_FORM, token::XML_LIST_VALUE, XML_NAMESPACE_FORM, token::XML_LIST_VALUE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment