26#include <com/sun/star/uno/Any.hxx>
27#include <com/sun/star/uno/RuntimeException.hpp>
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(
86 "bad root element <" +
name.convertFromUtf8() +
"> in " +
89 }
else if (
state_.top().ignore) {
91 }
else if (!
state_.top().node.is()) {
94 throw css::uno::RuntimeException(
95 "bad items node member <" +
name.convertFromUtf8() +
"> in " +
100 switch (
state_.top().node->kind()) {
105 throw css::uno::RuntimeException(
106 "bad property node member <" +
name.convertFromUtf8() +
107 "> in " + reader.
getUrl());
117 throw css::uno::RuntimeException(
118 "bad localized property node member <" +
119 name.convertFromUtf8() +
"> in " + reader.
getUrl());
124 state_.top().node.get()));
127 throw css::uno::RuntimeException(
128 "bad member <" +
name.convertFromUtf8() +
"> in " +
142 throw css::uno::RuntimeException(
143 "bad group node member <" +
name.convertFromUtf8() +
144 "> in " + reader.
getUrl());
158 "bad set node <prop> member in \"" << reader.
getUrl()
162 throw css::uno::RuntimeException(
163 "bad set node member <" +
name.convertFromUtf8() +
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(
219 "invalid op " +
text.convertFromUtf8());
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 " +
249 throw css::uno::RuntimeException(
250 "multiple component-update name attributes in " +
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());
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());
503 throw css::uno::RuntimeException(
504 "xsi:nil attribute for non-nillable prop in " + reader.
getUrl());
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());
599 switch (
i->second->kind()) {
607 type, op, finalized);
610 throw css::uno::RuntimeException(
611 "inappropriate prop " +
name +
" in " + reader.
getUrl());
623 if (
group->isExtensible()) {
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(
666 property->setFinalized(finalizedLayer);
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 " +
691 group->getMembers().erase(propertyIndex);
706 int finalizedLayer = std::min(
709 property->setFinalized(finalizedLayer);
717 throw css::uno::RuntimeException(
718 "invalid type for prop " +
name +
" in " + reader.
getUrl());
732 replacement->setFinalized(
property->getFinalized());
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());
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());
865 OUString templateName(
867 component, hasNodeType, nodeType, &
set->getDefaultTemplateName()));
868 if (!
set->isValidTemplate(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());
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);
903 "ignoring modify of unknown set member node \"" <<
name
904 <<
"\" in \"" << reader.
getUrl() <<
'"');
914 member->setFinalized(finalizedLayer);
915 member->setMandatory(mandatoryLayer);
924 member->setFinalized(finalizedLayer);
925 member->setMandatory(mandatoryLayer);
virtual NodeMap & getMembers() override
void add(std::vector< OUString > const &path)
NodeMapImpl::iterator iterator
rtl::Reference< Node > findNode(int layer, OUString const &name) const
@ KIND_LOCALIZED_PROPERTY
Containment contains(std::vector< OUString > const &path) const
void setExternal(int layer, OUString const &descriptor)
void setValue(int layer, css::uno::Any const &value)
void characters(xmlreader::Span const &text)
bool startElement(xmlreader::XmlReader &reader, int nsId, xmlreader::Span const &name)
xmlreader::XmlReader::Text getTextMode() const
void start(rtl::Reference< Node > const &property, OUString const &localizedName=OUString())
void handleLocpropValue(xmlreader::XmlReader &reader, LocalizedPropertyNode *locprop)
void handlePropValue(xmlreader::XmlReader &reader, PropertyNode *prop)
void recordModification(bool addition)
virtual void endElement(xmlreader::XmlReader const &reader) override
void handlePlainGroupProp(xmlreader::XmlReader const &reader, GroupNode *group, NodeMap::iterator const &propertyIndex, std::u16string_view name, Type type, Operation operation, bool finalized)
void handleSetNode(xmlreader::XmlReader &reader, SetNode *set)
virtual bool startElement(xmlreader::XmlReader &reader, int nsId, xmlreader::Span const &name, std::set< OUString > const *existingDependencies) override
virtual xmlreader::XmlReader::Text getTextMode() override
void handleGroupProp(xmlreader::XmlReader &reader, GroupNode *group)
void handleComponentData(xmlreader::XmlReader &reader)
XcuParser(int layer, Data &data, Partial const *partial, Modifications *broadcastModifications, Additions *additions)
void handleUnknownGroupProp(xmlreader::XmlReader const &reader, GroupNode const *group, OUString const &name, Type type, Operation operation, bool finalized)
void handleItem(xmlreader::XmlReader &reader)
Modifications * broadcastModifications_
bool recordModifications_
void handleLocalizedGroupProp(xmlreader::XmlReader const &reader, LocalizedPropertyNode *property, OUString const &name, Type type, Operation operation, bool finalized)
virtual void characters(xmlreader::Span const &span) override
void handleGroupNode(xmlreader::XmlReader &reader, rtl::Reference< Node > const &group)
std::vector< OUString > path_
std::stack< State > state_
virtual ~XcuParser() override
static Operation parseOperation(xmlreader::Span const &text)
const OUString & getUrl() const
bool nextAttribute(int *nsId, Span *localName)
Span getAttributeValue(bool fullyNormalize)
#define SAL_WARN(area, stream)
void set(css::uno::UnoInterfaceReference const &value)
Type parseType(xmlreader::XmlReader const &reader, xmlreader::Span const &text)
bool parseBoolean(xmlreader::Span const &text)
OUString parseTemplateReference(std::u16string_view component, bool hasNodeType, std::u16string_view nodeType, OUString const *defaultTemplateName)
std::vector< std::vector< OUString > > Additions
PyObject_HEAD PyUNO_callable_Internals * members
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
Modifications modifications
rtl::Reference< Node > resolvePathRepresentation(OUString const &pathRepresentation, OUString *canonicRepresentation, std::vector< OUString > *path, int *finalizedLayer) const
NodeMap & getComponents() const
rtl::Reference< Node > getTemplate(int layer, OUString const &fullName) const
static State Modify(rtl::Reference< Node > const &theNode)
static State Insert(rtl::Reference< Node > const &theNode, OUString const &theName)
static State Ignore(bool thePop)
rtl::OUString convertFromUtf8() const