Kaydet (Commit) ad00f306 authored tarafından sb's avatar sb

sb121: #i110264# in registrymodifications.xcu, allow localized property values…

sb121: #i110264# in registrymodifications.xcu, allow localized property values to be described directly as <item><value> (instead of <item><prop><value>)
üst 8e5a36c9
......@@ -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>"));
......
......@@ -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) {
......
......@@ -113,7 +113,8 @@
<!ELEMENT oor:items (item*)>
<!ATTLIST oor:items>
<!ELEMENT item ((prop | node)*)>
<!ELEMENT item ((node | prop | value)*)>
<!ATTLIST item
oor:path CDATA #REQUIRED>
<!-- the absolute path representation of a set or group node -->
<!-- the absolute path representation of a localized property or a group
or set node -->
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