diff options
author | sb <sb@openoffice.org> | 2009-11-11 13:51:17 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2009-11-11 13:51:17 +0100 |
commit | 2e960eb1926080f6f98a3a7e886a45725eac7fe4 (patch) | |
tree | bb88a70b7ba01e82ba0ce9cdece3993eb53b4542 /configmgr/source/writemodfile.cxx | |
parent | 291b6d7e3b09ede5a589d5baf4c0effa13414e02 (diff) |
sb111: #i101955# fixed and cleaned up handling of oor:types of prop values
Diffstat (limited to 'configmgr/source/writemodfile.cxx')
-rw-r--r-- | configmgr/source/writemodfile.cxx | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index b2fe14898658..1fcd5dec81fb 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -291,9 +291,6 @@ template< typename T > void writeItemListValue( void writeValue(oslFileHandle handle, Type type, css::uno::Any const & value) { switch (type) { - case TYPE_NIL: - writeData(handle, RTL_CONSTASCII_STRINGPARAM(" xsi:nil=\"true\"/>")); - break; case TYPE_BOOLEAN: writeSingleValue< sal_Bool >(handle, value); break; @@ -336,7 +333,7 @@ void writeValue(oslFileHandle handle, Type type, css::uno::Any const & value) { case TYPE_HEXBINARY_LIST: writeItemListValue< css::uno::Sequence< sal_Int8 > >(handle, value); break; - default: // TYPE_ERROR, TYPE_ANY + default: // TYPE_ERROR, TYPE_NIL, TYPE_ANY OSL_ASSERT(false); // this cannot happen } } @@ -369,10 +366,12 @@ void writeNode( writeData(handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\"")); writeAttributeValue(handle, name); writeData(handle, RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"fuse\"")); - Type type = prop->getType(); + Type type = prop->getStaticType(); + Type dynType = getDynamicType(prop->getValue(components)); + OSL_ASSERT(dynType != TYPE_ERROR); if (type == TYPE_ANY) { - type = mapType(prop->getValue(components)); - if (type != TYPE_ERROR) { //TODO + type = dynType; + if (type != TYPE_NIL) { writeData( handle, RTL_CONSTASCII_STRINGPARAM(" oor:type=\"")); writeData( @@ -381,7 +380,12 @@ void writeNode( } } writeData(handle, "><value"); - writeValue(handle, type, prop->getValue(components)); + if (dynType == TYPE_NIL) { + writeData( + handle, RTL_CONSTASCII_STRINGPARAM(" xsi:nil=\"true\"/>")); + } else { + writeValue(handle, type, prop->getValue(components)); + } writeData(handle, "</prop>"); } break; @@ -405,12 +409,14 @@ void writeNode( writeData(handle, RTL_CONSTASCII_STRINGPARAM("\"")); } Type type = dynamic_cast< LocalizedPropertyNode * >(parent.get())-> - getType(); + getStaticType(); css::uno::Any value( dynamic_cast< LocalizedValueNode * >(node.get())->getValue()); + Type dynType = getDynamicType(value); + OSL_ASSERT(dynType != TYPE_ERROR); if (type == TYPE_ANY) { - type = mapType(value); - if (type != TYPE_ERROR) { // TODO + type = dynType; + if (type != TYPE_NIL) { writeData( handle, RTL_CONSTASCII_STRINGPARAM(" oor:type=\"")); writeData( @@ -418,7 +424,12 @@ void writeNode( writeData(handle, RTL_CONSTASCII_STRINGPARAM("\"")); } } - writeValue(handle, type, value); + if (dynType == TYPE_NIL) { + writeData( + handle, RTL_CONSTASCII_STRINGPARAM(" xsi:nil=\"true\"/>")); + } else { + writeValue(handle, type, value); + } } break; case Node::KIND_GROUP: |