diff options
author | sb <sb@openoffice.org> | 2010-03-22 16:04:16 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-03-22 16:04:16 +0100 |
commit | ad00f306f700a83a2fbd8bf08214a5ac1d88f459 (patch) | |
tree | e507e4e6c3db4debdb00f561a9440a12883fd1ba /configmgr/source | |
parent | 8e5a36c9718accfb883cc674e364ecf08f768aed (diff) |
sb121: #i110264# in registrymodifications.xcu, allow localized property values to be described directly as <item><value> (instead of <item><prop><value>)
Diffstat (limited to 'configmgr/source')
-rw-r--r-- | configmgr/source/writemodfile.cxx | 84 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 17 |
2 files changed, 38 insertions, 63 deletions
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index c6a23d5bc8ef..c2573ab67439 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -451,9 +451,9 @@ void writeNode( void writeModifications( Components & components, oslFileHandle handle, - rtl::OUString const & grandparentPathRepresentation, - rtl::OUString const & parentName, rtl::Reference< Node > const & parent, - rtl::OUString const & nodeName, rtl::Reference< Node > const & node, + rtl::OUString const & parentPathRepresentation, + rtl::Reference< Node > const & parent, rtl::OUString const & nodeName, + rtl::Reference< Node > const & node, Modifications::Node const & modifications) { // It is never necessary to write oor:finalized or oor:mandatory attributes, @@ -461,39 +461,15 @@ void writeModifications( if (modifications.children.empty()) { OSL_ASSERT(parent.is()); // components themselves have no parent but must have children + writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\"")); + writeAttributeValue(handle, parentPathRepresentation); + writeData(handle, RTL_CONSTASCII_STRINGPARAM("\">")); if (node.is()) { - writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\"")); - if (parent->kind() == Node::KIND_LOCALIZED_PROPERTY) { - writeAttributeValue(handle, grandparentPathRepresentation); - writeData( - handle, RTL_CONSTASCII_STRINGPARAM("\"><prop oor:name=\"")); - writeAttributeValue(handle, parentName); - writeData( - handle, RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"fuse\">")); - writeNode(components, handle, parent, nodeName, node); - writeData(handle, RTL_CONSTASCII_STRINGPARAM("</prop>")); - } else { - writeAttributeValue( - handle, - (grandparentPathRepresentation + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + - Data::createSegment( - parent->getTemplateName(), parentName))); - writeData(handle, RTL_CONSTASCII_STRINGPARAM("\">")); - writeNode(components, handle, parent, nodeName, node); - } - writeData(handle, RTL_CONSTASCII_STRINGPARAM("</item>")); + writeNode(components, handle, parent, nodeName, node); } else { - writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\"")); switch (parent->kind()) { case Node::KIND_LOCALIZED_PROPERTY: - writeAttributeValue(handle, grandparentPathRepresentation); - writeData( - handle, RTL_CONSTASCII_STRINGPARAM("\"><prop oor:name=\"")); - writeAttributeValue(handle, parentName); - writeData( - handle, - RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"fuse\"><value")); + writeData(handle, RTL_CONSTASCII_STRINGPARAM("<value")); if (nodeName.getLength() != 0) { writeData( handle, RTL_CONSTASCII_STRINGPARAM(" xml:lang=\"")); @@ -501,61 +477,44 @@ void writeModifications( writeData(handle, RTL_CONSTASCII_STRINGPARAM("\"")); } writeData( - handle, - RTL_CONSTASCII_STRINGPARAM( - " oor:op=\"remove\"/></prop></item>")); + handle, RTL_CONSTASCII_STRINGPARAM(" oor:op=\"remove\"/>")); break; case Node::KIND_GROUP: OSL_ASSERT( dynamic_cast< GroupNode * >(parent.get())->isExtensible()); - writeAttributeValue( - handle, - (grandparentPathRepresentation + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + - Data::createSegment( - parent->getTemplateName(), parentName))); writeData( - handle, RTL_CONSTASCII_STRINGPARAM("\"><prop oor:name=\"")); + handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\"")); writeAttributeValue(handle, nodeName); writeData( handle, - RTL_CONSTASCII_STRINGPARAM( - "\" oor:op=\"remove\"/></item>")); + RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"remove\"/>")); break; case Node::KIND_SET: - writeAttributeValue( - handle, - (grandparentPathRepresentation + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + - Data::createSegment( - parent->getTemplateName(), parentName))); writeData( - handle, RTL_CONSTASCII_STRINGPARAM("\"><node oor:name=\"")); + handle, RTL_CONSTASCII_STRINGPARAM("<node oor:name=\"")); writeAttributeValue(handle, nodeName); writeData( handle, - RTL_CONSTASCII_STRINGPARAM( - "\" oor:op=\"remove\"/></item>")); + RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"remove\"/>")); break; default: OSL_ASSERT(false); // this cannot happen break; } } + writeData(handle, RTL_CONSTASCII_STRINGPARAM("</item>")); } else { - rtl::OUString parentPathRep; - if (parent.is()) { // components themselves have no parent - parentPathRep = grandparentPathRepresentation + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + - Data::createSegment(parent->getTemplateName(), parentName); - } OSL_ASSERT(node.is()); + rtl::OUString pathRep( + parentPathRepresentation + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + + Data::createSegment(node->getTemplateName(), nodeName)); for (Modifications::Node::Children::const_iterator i( modifications.children.begin()); i != modifications.children.end(); ++i) { writeModifications( - components, handle, parentPathRep, nodeName, node, i->first, + components, handle, pathRep, node, i->first, node->getMember(i->first), i->second); } } @@ -617,9 +576,8 @@ void writeModFile( j != data.modifications.getRoot().children.end(); ++j) { writeModifications( - components, tmp.handle, rtl::OUString(), rtl::OUString(), - rtl::Reference< Node >(), j->first, - Data::findNode(Data::NO_LAYER, data.components, j->first), + components, tmp.handle, rtl::OUString(), rtl::Reference< Node >(), + j->first, Data::findNode(Data::NO_LAYER, data.components, j->first), j->second); } writeData(tmp.handle, RTL_CONSTASCII_STRINGPARAM("</oor:items>")); diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 4f15b24afb01..60ea59ca0248 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -399,6 +399,23 @@ void XcuParser::handleItem(XmlReader & reader) { state_.push(State()); // ignored return; } + switch (node->kind()) { + case Node::KIND_PROPERTY: + case Node::KIND_LOCALIZED_VALUE: + OSL_TRACE( + "configmgr item of bad type %s in %s", + rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(), + rtl::OUStringToOString( + reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + state_.push(State()); // ignored + return; + case Node::KIND_LOCALIZED_PROPERTY: + valueParser_.type_ = dynamic_cast< LocalizedPropertyNode * >( + node.get())->getStaticType(); + break; + default: + break; + } OSL_ASSERT(!modificationPath_.empty()); componentName_ = modificationPath_.front(); if (modifications_ == 0) { |