26 #include <com/sun/star/uno/Any.hxx>
27 #include <com/sun/star/uno/RuntimeException.hpp>
28 #include <rtl/ref.hxx>
29 #include <rtl/strbuf.hxx>
30 #include <rtl/string.hxx>
31 #include <rtl/ustring.hxx>
55 valueParser_(layer), data_(data),
56 partial_(partial), broadcastModifications_(broadcastModifications),
57 additions_(additions), recordModifications_(layer ==
Data::NO_LAYER),
59 partial_ != nullptr || broadcastModifications_ != nullptr || additions_ != nullptr ||
71 std::set< OUString >
const * )
78 name ==
"component-data")
85 throw css::uno::RuntimeException(
89 }
else if (
state_.top().ignore) {
91 }
else if (!
state_.top().node.is()) {
94 throw css::uno::RuntimeException(
100 switch (
state_.top().node->kind()) {
105 throw css::uno::RuntimeException(
107 "> in " + reader.
getUrl());
111 static_cast< PropertyNode * >(
state_.top().node.get()));
117 throw css::uno::RuntimeException(
118 "bad localized property node member <" +
123 static_cast< LocalizedPropertyNode * >(
124 state_.top().node.get()));
127 throw css::uno::RuntimeException(
136 static_cast< GroupNode * >(
state_.top().node.get()));
142 throw css::uno::RuntimeException(
144 "> in " + reader.
getUrl());
152 reader, static_cast< SetNode * >(
state_.top().node.get()));
158 "bad set node <prop> member in \"" << reader.
getUrl()
162 throw css::uno::RuntimeException(
164 "> in " + reader.
getUrl());
180 bool pop =
state_.top().pop;
183 if (
state_.top().insert) {
184 insert =
state_.top().node;
191 state_.top().node->getMembers()[
name] = insert;
193 if (pop && !
path_.empty()) {
206 if (text ==
"modify") {
209 if (text ==
"replace") {
212 if (text ==
"fuse") {
215 if (text ==
"remove") {
218 throw css::uno::RuntimeException(
223 OStringBuffer buf(256);
225 bool hasPackage =
false;
226 bool hasName =
false;
228 bool finalized =
false;
238 throw css::uno::RuntimeException(
239 "multiple component-update package attributes in " +
244 buf.insert(0, s.begin, s.length);
249 throw css::uno::RuntimeException(
250 "multiple component-update name attributes in " +
255 buf.append(s.begin, s.length);
261 attrLn ==
"finalized")
267 throw css::uno::RuntimeException(
268 "no component-data package attribute in " + reader.
getUrl());
271 throw css::uno::RuntimeException(
272 "no component-data name attribute in " + reader.
getUrl());
277 assert(
path_.empty());
292 << reader.
getUrl() <<
'"');
301 throw css::uno::RuntimeException(
302 "invalid operation on root node in " + reader.
getUrl());
304 int finalizedLayer = std::min(
306 node->getFinalized());
307 node->setFinalized(finalizedLayer);
327 if (!attrPath.
is()) {
328 throw css::uno::RuntimeException(
329 "missing path attribute in " + reader.
getUrl());
335 path,
nullptr, &
path_, &finalizedLayer));
339 "unknown item \"" << path <<
"\" in \"" << reader.
getUrl() <<
'"');
343 assert(!
path_.empty());
354 switch (node->kind()) {
359 "item of bad type \"" << path <<
"\" in \"" << reader.
getUrl()
365 node.get())->getStaticType();
397 throw css::uno::RuntimeException(
398 "invalid value type in " + reader.
getUrl());
402 attrLn ==
"separator")
406 throw css::uno::RuntimeException(
407 "bad oor:separator attribute in " + reader.
getUrl());
409 separator = OString(s.begin, s.length);
411 attrLn ==
"external")
414 if (external.isEmpty()) {
415 throw css::uno::RuntimeException(
416 "bad oor:external attribute value in " + reader.
getUrl());
422 throw css::uno::RuntimeException(
423 "xsi:nil attribute for non-nillable prop in " + reader.
getUrl());
425 if (!external.isEmpty()) {
426 throw css::uno::RuntimeException(
427 "xsi:nil and oor:external attributes for prop in " +
432 }
else if (external.isEmpty()) {
468 throw css::uno::RuntimeException(
469 "invalid value type in " + reader.
getUrl());
473 attrLn ==
"separator")
477 throw css::uno::RuntimeException(
478 "bad oor:separator attribute in " + reader.
getUrl());
480 separator = OString(s.begin, s.length);
488 path_.push_back(name);
503 throw css::uno::RuntimeException(
504 "xsi:nil attribute for non-nillable prop in " + reader.
getUrl());
511 if (
i == members.
end()) {
536 if (
i != members.
end()) {
543 throw css::uno::RuntimeException(
544 "bad op attribute for value element in " + reader.
getUrl());
551 bool hasName =
false;
555 bool finalized =
false;
574 attrLn ==
"finalized")
580 throw css::uno::RuntimeException(
581 "no prop name attribute in " + reader.
getUrl());
584 path_.push_back(name);
596 if (
i == members.
end()) {
599 switch (
i->second->kind()) {
606 static_cast< LocalizedPropertyNode * >(
i->second.get()), name,
607 type, op, finalized);
610 throw css::uno::RuntimeException(
611 "inappropriate prop " + name +
" in " + reader.
getUrl());
625 throw css::uno::RuntimeException(
626 "missing type attribute for prop " + name +
" in " +
645 "unknown property \"" << name <<
"\" in \"" << reader.
getUrl()
658 propertyIndex->second.get());
663 int finalizedLayer = std::min(
665 property->getFinalized());
666 property->setFinalized(finalizedLayer);
672 type !=
property->getStaticType())
674 throw css::uno::RuntimeException(
675 OUString::Concat(
"invalid type for prop ") + name +
" in " + reader.
getUrl());
687 throw css::uno::RuntimeException(
688 OUString::Concat(
"invalid remove of non-extension prop ") + name +
" in " +
706 int finalizedLayer = std::min(
708 property->getFinalized());
709 property->setFinalized(finalizedLayer);
715 type !=
property->getStaticType())
717 throw css::uno::RuntimeException(
718 "invalid type for prop " + name +
" in " + reader.
getUrl());
731 property->isNillable()));
738 throw css::uno::RuntimeException(
739 "invalid remove of non-extension prop " + name +
" in " +
747 bool hasName =
false;
750 bool finalized =
false;
765 attrLn ==
"finalized")
771 throw css::uno::RuntimeException(
772 "no node name attribute in " + reader.
getUrl());
775 path_.push_back(name);
787 "unknown node \"" << name <<
"\" in \"" << reader.
getUrl() <<
'"');
793 throw css::uno::RuntimeException(
794 "bad <node> \"" + name +
"\" of non group/set kind in " +
798 throw css::uno::RuntimeException(
799 "invalid operation on group node in " + reader.
getUrl());
801 int finalizedLayer = std::min(
803 child->getFinalized());
804 child->setFinalized(finalizedLayer);
813 bool hasName =
false;
816 bool hasNodeType =
false;
819 bool finalized =
false;
820 bool mandatory =
false;
831 attrLn ==
"component")
835 attrLn ==
"node-type")
844 attrLn ==
"finalized")
848 attrLn ==
"mandatory")
854 throw css::uno::RuntimeException(
855 "no node name attribute in " + reader.
getUrl());
858 path_.push_back(name);
865 OUString templateName(
869 throw css::uno::RuntimeException(
870 "set member node " + name +
" references invalid template " +
871 templateName +
" in " + reader.
getUrl());
876 throw css::uno::RuntimeException(
877 "set member node " + name +
" references undefined template " +
878 templateName +
" in " + reader.
getUrl());
884 if (
i != members.
end()) {
885 finalizedLayer = std::min(finalizedLayer,
i->second->getFinalized());
886 i->second->setFinalized(finalizedLayer);
887 mandatoryLayer = std::min(mandatoryLayer,
i->second->getMandatory());
888 i->second->setMandatory(mandatoryLayer);
900 if (
i == members.
end()) {
903 "ignoring modify of unknown set member node \"" << name
904 <<
"\" in \"" << reader.
getUrl() <<
'"');
914 member->setFinalized(finalizedLayer);
915 member->setMandatory(mandatoryLayer);
921 if (
i == members.
end()) {
924 member->setFinalized(finalizedLayer);
925 member->setMandatory(mandatoryLayer);
938 bool known =
i != members.
end();
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
virtual NodeMap & getMembers() override
Containment contains(std::vector< OUString > const &path) const
xmlreader::XmlReader::Text getTextMode() const
static State Modify(rtl::Reference< Node > const &theNode)
iterator find(const OUString &aStr)
bool startElement(xmlreader::XmlReader &reader, int nsId, xmlreader::Span const &name)
void handleGroupProp(xmlreader::XmlReader &reader, GroupNode *group)
void handleItem(xmlreader::XmlReader &reader)
static State Insert(rtl::Reference< Node > const &theNode, OUString const &theName)
bool isExtensible() const
void handleGroupNode(xmlreader::XmlReader &reader, rtl::Reference< Node > const &group)
PyObject_HEAD PyUNO_callable_Internals * members
void handlePropValue(xmlreader::XmlReader &reader, PropertyNode *prop)
std::stack< State > state_
bool parseBoolean(xmlreader::Span const &text)
Modifications * broadcastModifications_
void handleLocpropValue(xmlreader::XmlReader &reader, LocalizedPropertyNode *locprop)
Modifications modifications
void handleComponentData(xmlreader::XmlReader &reader)
void erase(const iterator &it)
Type getStaticType() const
std::vector< OUString > path_
std::vector< std::vector< OUString > > Additions
static Operation parseOperation(xmlreader::Span const &text)
void add(std::vector< OUString > const &path)
virtual void characters(xmlreader::Span const &span) override
void setExternal(int layer, OUString const &descriptor)
rtl::Reference< Node > resolvePathRepresentation(OUString const &pathRepresentation, OUString *canonicRepresentation, std::vector< OUString > *path, int *finalizedLayer) const
bool isValidTemplate(OUString const &templateName) const
void characters(xmlreader::Span const &text)
void recordModification(bool addition)
Type parseType(xmlreader::XmlReader const &reader, xmlreader::Span const &text)
virtual NodeMap & getMembers() override
NodeMap & getComponents() const
void start(rtl::Reference< Node > const &property, OUString const &localizedName=OUString())
NodeMapImpl::iterator iterator
OUString const & getDefaultTemplateName() const
virtual xmlreader::XmlReader::Text getTextMode() override
virtual ~XcuParser() override
Span getAttributeValue(bool fullyNormalize)
void handleUnknownGroupProp(xmlreader::XmlReader const &reader, GroupNode const *group, OUString const &name, Type type, Operation operation, bool finalized)
virtual bool startElement(xmlreader::XmlReader &reader, int nsId, xmlreader::Span const &name, std::set< OUString > const *existingDependencies) override
rtl::OUString convertFromUtf8() const
const OUString & getUrl() const
void handleSetNode(xmlreader::XmlReader &reader, SetNode *set)
OUString parseTemplateReference(std::u16string_view component, bool hasNodeType, std::u16string_view nodeType, OUString const *defaultTemplateName)
void handleLocalizedGroupProp(xmlreader::XmlReader const &reader, LocalizedPropertyNode *property, OUString const &name, Type type, Operation operation, bool finalized)
rtl::Reference< Node > getTemplate(int layer, OUString const &fullName) const
bool nextAttribute(int *nsId, Span *localName)
#define SAL_WARN(area, stream)
void handlePlainGroupProp(xmlreader::XmlReader const &reader, GroupNode *group, NodeMap::iterator const &propertyIndex, std::u16string_view name, Type type, Operation operation, bool finalized)
static State Ignore(bool thePop)
void setValue(int layer, css::uno::Any const &value)
virtual NodeMap & getMembers() override
rtl::Reference< Node > findNode(int layer, OUString const &name) const
bool recordModifications_
virtual void endElement(xmlreader::XmlReader const &reader) override
XcuParser(int layer, Data &data, Partial const *partial, Modifications *broadcastModifications, Additions *additions)