27#include <com/sun/star/beans/Property.hpp>
28#include <com/sun/star/beans/PropertyAttribute.hpp>
29#include <com/sun/star/beans/PropertyChangeEvent.hpp>
30#include <com/sun/star/beans/UnknownPropertyException.hpp>
31#include <com/sun/star/beans/XExactName.hpp>
32#include <com/sun/star/beans/XHierarchicalPropertySet.hpp>
33#include <com/sun/star/beans/XHierarchicalPropertySetInfo.hpp>
34#include <com/sun/star/beans/XMultiHierarchicalPropertySet.hpp>
35#include <com/sun/star/beans/XMultiPropertySet.hpp>
36#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
37#include <com/sun/star/beans/XProperty.hpp>
38#include <com/sun/star/beans/XPropertyChangeListener.hpp>
39#include <com/sun/star/beans/XPropertySet.hpp>
40#include <com/sun/star/beans/XPropertySetInfo.hpp>
41#include <com/sun/star/beans/XVetoableChangeListener.hpp>
42#include <com/sun/star/container/ContainerEvent.hpp>
43#include <com/sun/star/container/NoSuchElementException.hpp>
44#include <com/sun/star/container/XContainer.hpp>
45#include <com/sun/star/container/XContainerListener.hpp>
46#include <com/sun/star/container/XElementAccess.hpp>
47#include <com/sun/star/container/XHierarchicalName.hpp>
48#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
49#include <com/sun/star/container/XHierarchicalNameReplace.hpp>
50#include <com/sun/star/container/XNameAccess.hpp>
51#include <com/sun/star/container/XNameContainer.hpp>
52#include <com/sun/star/container/XNamed.hpp>
53#include <com/sun/star/lang/DisposedException.hpp>
54#include <com/sun/star/lang/EventObject.hpp>
55#include <com/sun/star/lang/IllegalArgumentException.hpp>
56#include <com/sun/star/lang/XComponent.hpp>
57#include <com/sun/star/lang/XEventListener.hpp>
58#include <com/sun/star/lang/XServiceInfo.hpp>
59#include <com/sun/star/lang/XSingleServiceFactory.hpp>
60#include <com/sun/star/lang/XTypeProvider.hpp>
61#include <com/sun/star/uno/Any.hxx>
62#include <com/sun/star/uno/Reference.hxx>
63#include <com/sun/star/uno/RuntimeException.hpp>
64#include <com/sun/star/uno/Sequence.hxx>
65#include <com/sun/star/uno/Type.hxx>
66#include <com/sun/star/uno/XInterface.hpp>
67#include <com/sun/star/uno/XWeak.hpp>
68#include <com/sun/star/util/ElementChange.hpp>
77#include <osl/interlck.h>
78#include <osl/mutex.hxx>
79#include <rtl/character.hxx>
81#include <rtl/ustrbuf.hxx>
82#include <rtl/ustring.hxx>
110bool isValidName(OUString
const &
name,
bool setMember) {
111 for (sal_Int32
i = 0;
i !=
name.getLength();) {
112 sal_uInt32 c =
name.iterateCodePoints(&
i);
113 if ((c < 0x20 && !(c == 0x09 || c == 0x0A || c == 0x0D))
114 || rtl::isSurrogate(c) || c == 0xFFFE || c == 0xFFFF
115 || (!setMember && c ==
'/'))
120 return !
name.isEmpty();
147 assert(child.is() && child->getParentAccess() ==
this);
154 assert(
dynamic_cast< ChildAccess *
>(
p.get()) !=
nullptr);
155 parent->modifiedChildren_.emplace(
156 p->getNameInternal(),
175 osl::MutexGuard g(*
lock_);
226 osl::MutexGuard g(*
lock_);
228 return css::uno::Sequence< sal_Int8 >();
234 osl::MutexGuard g(*
lock_);
236 return "org.openoffice-configmgr::Access";
247 osl::MutexGuard g(*
lock_);
249 std::vector<OUString> services;
250 services.emplace_back(
"com.sun.star.configuration.ConfigurationAccess");
252 services.emplace_back(
"com.sun.star.configuration.ConfigurationUpdateAccess");
254 services.emplace_back(
"com.sun.star.configuration.HierarchyAccess");
255 services.emplace_back(
"com.sun.star.configuration.HierarchyElement");
257 services.emplace_back(
"com.sun.star.configuration.GroupAccess");
258 services.emplace_back(
"com.sun.star.configuration.PropertyHierarchy");
260 services.emplace_back(
"com.sun.star.configuration.GroupUpdate");
263 services.emplace_back(
"com.sun.star.configuration.SetAccess");
264 services.emplace_back(
"com.sun.star.configuration.SimpleSetAccess");
266 services.emplace_back(
"com.sun.star.configuration.SetUpdate");
267 services.emplace_back(
"com.sun.star.configuration.SimpleSetUpdate");
278 osl::MutexGuard g(*
lock_);
281 throw css::uno::RuntimeException(
282 "configmgr dispose inappropriate Access",
296 css::uno::Reference< css::lang::XEventListener >
const & xListener)
300 osl::MutexGuard g(*
lock_);
302 if (!xListener.is()) {
303 throw css::uno::RuntimeException(
312 xListener->disposing(
314 }
catch (css::lang::DisposedException &) {}
318 css::uno::Reference< css::lang::XEventListener >
const & aListener)
321 osl::MutexGuard g(*
lock_);
331 osl::MutexGuard g(*
lock_);
347 throw css::uno::RuntimeException(
354 osl::MutexGuard g(*
lock_);
361 bool bGotValue =
false;
372 value = child->asValue();
390 value = child->asValue();
398 osl::MutexGuard g(*
lock_);
402 throw css::container::NoSuchElementException(
410 osl::MutexGuard g(*
lock_);
412 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
413 css::uno::Sequence<OUString> names(children.size());
414 OUString* pArray = names.getArray();
415 for (
auto const& child : children)
417 *pArray++ = child->getNameInternal();
425 osl::MutexGuard g(*
lock_);
433 osl::MutexGuard g(*
lock_);
437 throw css::container::NoSuchElementException(
440 return child->asValue();
446 osl::MutexGuard g(*
lock_);
452 OUString
const & aName, css::uno::Any
const & aElement)
458 osl::MutexGuard g(*
lock_);
462 throw css::container::NoSuchElementException(
465 child->checkFinalized();
469 switch (parent->kind()) {
472 child->setProperty(aElement, &localMods);
475 throw css::lang::IllegalArgumentException(
476 (
"configmgr::Access::replaceByHierarchicalName does not"
477 " currently support set members"),
480 throw css::lang::IllegalArgumentException(
481 (
"configmgr::Access::replaceByHierarchicalName does not allow"
482 " changing component " +
aName),
494 css::uno::Reference< css::container::XContainerListener >
const & xListener)
498 osl::MutexGuard g(*
lock_);
500 if (!xListener.is()) {
501 throw css::uno::RuntimeException(
510 xListener->disposing(
512 }
catch (css::lang::DisposedException &) {}
516 css::uno::Reference< css::container::XContainerListener >
const & xListener)
519 osl::MutexGuard g(*
lock_);
530 osl::MutexGuard g(*
lock_);
532 return aApproximateName;
538 osl::MutexGuard g(*
lock_);
539 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
540 std::vector< css::beans::Property >
properties;
542 for (
auto const& child : children)
552 osl::MutexGuard g(*
lock_);
555 throw css::beans::UnknownPropertyException(
558 return child->asProperty();
564 osl::MutexGuard g(*
lock_);
570 osl::MutexGuard g(*
lock_);
577 rootPath = root->getAbsolutePathRepresentation();
580 OUStringBuffer path(rootPath);
581 if (!rootPath.isEmpty() && rootPath !=
"/" && !rel.isEmpty()) {
585 return path.makeStringAndClear();
589 OUString
const & aRelativeName)
592 osl::MutexGuard g(*
lock_);
594 if (aRelativeName.isEmpty() || aRelativeName[0] ==
'/') {
595 throw css::lang::IllegalArgumentException(
596 "configmgr composeHierarchicalName inappropriate relative name",
600 if (!path.isEmpty()) {
603 path.append(aRelativeName);
604 return path.makeStringAndClear();
609 osl::MutexGuard g(*
lock_);
619 osl::MutexGuard g(*
lock_);
630 if (! node->getTemplateName().isEmpty()) {
632 parent->getChild(
aName));
633 if (other.get() ==
this) {
637 !(other.is() && other->isFinalized()))
639 if (!isValidName(
aName,
true)) {
640 throw css::uno::RuntimeException(
641 "invalid element name " +
aName);
650 parent->markChildAsModified(childAccess);
652 childAccess->unbind();
656 childAccess->bind(root, parent,
aName);
658 parent->markChildAsModified(childAccess);
670 throw css::uno::RuntimeException(
671 "configmgr setName inappropriate node",
685 osl::MutexGuard g(*
lock_);
697 OUString
const & aPropertyName, css::uno::Any
const & aValue)
702 osl::MutexGuard g(*
lock_);
704 throw css::uno::RuntimeException(
705 "configmgr setPropertyValue on non-update access",
710 throw css::beans::UnknownPropertyException(
721 osl::MutexGuard g(*
lock_);
725 throw css::beans::UnknownPropertyException(
731 OUString
const & aPropertyName,
732 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
737 osl::MutexGuard g(*
lock_);
738 if (!xListener.is()) {
739 throw css::uno::RuntimeException(
749 xListener->disposing(
751 }
catch (css::lang::DisposedException &) {}
755 OUString
const & aPropertyName,
756 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
760 osl::MutexGuard g(*
lock_);
762 PropertyChangeListeners::iterator
i(
765 PropertyChangeListenersElement::iterator j(
i->second.find(aListener));
766 if (j !=
i->second.end()) {
768 if (
i->second.empty()) {
776 OUString
const & PropertyName,
777 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
782 osl::MutexGuard g(*
lock_);
783 if (!aListener.is()) {
784 throw css::uno::RuntimeException(
795 aListener->disposing(
797 }
catch (css::lang::DisposedException &) {}
801 OUString
const & PropertyName,
802 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
806 osl::MutexGuard g(*
lock_);
808 VetoableChangeListeners::iterator
i(
811 VetoableChangeListenersElement::iterator j(
i->second.find(aListener));
812 if (j !=
i->second.end()) {
814 if (
i->second.empty()) {
822 css::uno::Sequence< OUString >
const & aPropertyNames,
823 css::uno::Sequence< css::uno::Any >
const & aValues)
828 osl::MutexGuard g(*
lock_);
830 throw css::uno::RuntimeException(
831 "configmgr setPropertyValues on non-update access",
834 if (aPropertyNames.getLength() != aValues.getLength()) {
835 throw css::lang::IllegalArgumentException(
836 (
"configmgr setPropertyValues: aPropertyNames/aValues of"
837 " different length"),
841 for (sal_Int32
i = 0;
i < aPropertyNames.getLength(); ++
i) {
843 throw css::lang::IllegalArgumentException(
844 "configmgr setPropertyValues inappropriate property name",
854 css::uno::Sequence< OUString >
const & aPropertyNames)
857 osl::MutexGuard g(*
lock_);
858 css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength());
859 auto aValsRange = asNonConstRange(vals);
860 for (sal_Int32
i = 0;
i < aPropertyNames.getLength(); ++
i)
863 throw css::uno::RuntimeException(
864 "configmgr getPropertyValues inappropriate property name",
872 css::uno::Sequence< OUString >
const &,
873 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
878 osl::MutexGuard g(*
lock_);
879 if (!xListener.is()) {
880 throw css::uno::RuntimeException(
889 xListener->disposing(
891 }
catch (css::lang::DisposedException &) {}
895 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
899 osl::MutexGuard g(*
lock_);
900 PropertiesChangeListeners::iterator
i(
908 css::uno::Sequence< OUString >
const & aPropertyNames,
909 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
913 css::uno::Sequence< css::beans::PropertyChangeEvent > events(
914 aPropertyNames.getLength());
915 auto aEventsRange = asNonConstRange(events);
916 for (sal_Int32
i = 0;
i < events.getLength(); ++
i) {
918 aEventsRange[
i].PropertyName = aPropertyNames[
i];
919 aEventsRange[
i].Further =
false;
920 aEventsRange[
i].PropertyHandle = -1;
922 xListener->propertiesChange(events);
925css::uno::Reference< css::beans::XHierarchicalPropertySetInfo >
932 OUString
const & aHierarchicalPropertyName,
933 css::uno::Any
const & aValue)
938 osl::MutexGuard g(*
lock_);
940 throw css::uno::RuntimeException(
941 "configmgr setHierarchicalPropertyName on non-update access",
947 throw css::beans::UnknownPropertyException(
948 aHierarchicalPropertyName,
951 child->checkFinalized();
953 child->setProperty(aValue, &localMods);
960 OUString
const & aHierarchicalPropertyName)
963 osl::MutexGuard g(*
lock_);
966 throw css::beans::UnknownPropertyException(
967 aHierarchicalPropertyName,
970 return child->asValue();
974 css::uno::Sequence< OUString >
const & aHierarchicalPropertyNames,
975 css::uno::Sequence< css::uno::Any >
const & Values)
980 osl::MutexGuard g(*
lock_);
982 throw css::uno::RuntimeException(
983 "configmgr setPropertyValues on non-update access",
986 if (aHierarchicalPropertyNames.getLength() !=
Values.getLength()) {
987 throw css::lang::IllegalArgumentException(
988 (
"configmgr setHierarchicalPropertyValues:"
989 " aHierarchicalPropertyNames/Values of different length"),
993 for (sal_Int32
i = 0;
i < aHierarchicalPropertyNames.getLength(); ++
i) {
997 throw css::lang::IllegalArgumentException(
998 (
"configmgr setHierarchicalPropertyValues inappropriate"
1002 child->checkFinalized();
1003 child->setProperty(
Values[
i], &localMods);
1011 css::uno::Sequence< OUString >
const & aHierarchicalPropertyNames)
1014 osl::MutexGuard g(*
lock_);
1015 css::uno::Sequence< css::uno::Any > vals(
1016 aHierarchicalPropertyNames.getLength());
1017 auto aValsRange = asNonConstRange(vals);
1018 for (sal_Int32
i = 0;
i < aHierarchicalPropertyNames.getLength(); ++
i) {
1022 throw css::lang::IllegalArgumentException(
1023 (
"configmgr getHierarchicalPropertyValues inappropriate"
1024 " hierarchical property name"),
1027 aValsRange[
i] = child->asValue();
1033 OUString
const & aHierarchicalName)
1036 osl::MutexGuard g(*
lock_);
1039 throw css::beans::UnknownPropertyException(
1042 return child->asProperty();
1046 OUString
const & aHierarchicalName)
1049 osl::MutexGuard g(*
lock_);
1054 OUString
const & aName, css::uno::Any
const & aElement)
1059 osl::MutexGuard g(*
lock_);
1063 throw css::container::NoSuchElementException(
1066 child->checkFinalized();
1071 child->setProperty(aElement, &localMods);
1078 localMods.
add(child->getRelativePath());
1080 freeAcc->bind(root,
this,
aName);
1094 OUString
const & aName, css::uno::Any
const & aElement)
1099 osl::MutexGuard g(*
lock_);
1103 throw css::container::ElementExistException(
1109 if (!isValidName(
aName,
false)) {
1110 throw css::lang::IllegalArgumentException(
1117 if (!isValidName(
aName,
false)) {
1118 throw css::lang::IllegalArgumentException(
1128 localMods.
add(child->getRelativePath());
1133 if (!isValidName(
aName,
true)) {
1134 throw css::lang::IllegalArgumentException(
1141 localMods.
add(freeAcc->getRelativePath());
1158 osl::MutexGuard g(*
lock_);
1161 if (!child.is() || child->isFinalized() ||
1164 throw css::container::NoSuchElementException(
1172 throw css::container::NoSuchElementException(
1177 localMods.
add(child->getRelativePath());
1195 throw css::uno::Exception(
1196 "unknown template " + tmplName,
1206 css::uno::Sequence< css::uno::Any >
const & aArguments)
1210 throw css::uno::Exception(
1211 (
"configuration SimpleSetUpdate createInstanceWithArguments"
1212 " must not specify any arguments"),
1219 components_(components), disposed_(false),
lock_(
lock() )
1226 assert(broadcaster !=
nullptr);
1241 for (
auto const& propertyChangeListenerElement : propertyChangeListener.second)
1244 propertyChangeListenerElement,
1245 css::lang::EventObject(
1251 for (
auto const& vetoableChangeListenerElement : vetoableChangeListener.second)
1254 vetoableChangeListenerElement,
1255 css::lang::EventObject(
1262 propertiesChangeListener,
1271 child->initDisposeBroadcaster(broadcaster);
1288 child->clearListeners();
1295 css::uno::Any res(OWeakObject::queryInterface(aType));
1296 if (res.hasValue()) {
1300 aType,
static_cast< css::lang::XTypeProvider *
>(
this),
1301 static_cast< css::lang::XServiceInfo *
>(
this),
1302 static_cast< css::lang::XComponent *
>(
this),
1303 static_cast< css::container::XHierarchicalNameAccess *
>(
this),
1304 static_cast< css::container::XContainer *
>(
this),
1305 static_cast< css::beans::XExactName *
>(
this),
1306 static_cast< css::container::XHierarchicalName *
>(
this),
1307 static_cast< css::container::XNamed *
>(
this),
1308 static_cast< css::beans::XProperty *
>(
this),
1309 static_cast< css::container::XElementAccess *
>(
this),
1310 static_cast< css::container::XNameAccess *
>(
this));
1311 if (res.hasValue()) {
1316 aType,
static_cast< css::beans::XPropertySetInfo *
>(
this),
1317 static_cast< css::beans::XPropertySet *
>(
this),
1318 static_cast< css::beans::XMultiPropertySet *
>(
this),
1319 static_cast< css::beans::XHierarchicalPropertySet *
>(
this),
1320 static_cast< css::beans::XMultiHierarchicalPropertySet *
>(
this),
1321 static_cast< css::beans::XHierarchicalPropertySetInfo *
>(
this));
1322 if (res.hasValue()) {
1328 aType,
static_cast< css::container::XNameReplace *
>(
this),
1329 static_cast< css::container::XHierarchicalNameReplace *
>(
this));
1330 if (res.hasValue()) {
1337 aType,
static_cast< css::container::XNameContainer *
>(
this));
1338 if (res.hasValue()) {
1344 aType,
static_cast< css::lang::XSingleServiceFactory *
>(
this));
1355 throw css::uno::RuntimeException(
1356 "configmgr Access to specialized LocalizedPropertyNode",
1369 &&
name.startsWith(
"*", &locale))
1371 if (locale.startsWith(
"*")) {
1374 (
"access best-matching localized property value via"
1375 " \"*<locale>\" with <locale> \"")
1376 << locale <<
"\" recursively starting with \"*\"");
1380 locale.isEmpty(),
"configmgr",
1381 (
"access best-matching localized property value via \"*<locale>\""
1382 " with empty <locale>; falling back to defaults"));
1390 if (!locale.isEmpty()) {
1393 if (directChild.is())
1399 for (
const OUString& rFallback : aFallbacks)
1410 if (aFallbacks.size() > 0)
1411 locale = aFallbacks[aFallbacks.size() - 1];
1413 !locale.isEmpty() && locale.indexOf(
'-') == -1 &&
1414 locale.indexOf(
'_') == -1);
1416 std::vector< rtl::Reference< ChildAccess > > children(
1418 for (
auto const& child : children)
1420 const OUString & name2(child->getNameInternal());
1421 if (name2.startsWith(locale) &&
1422 (name2.getLength() == locale.getLength() ||
1423 name2[locale.getLength()] ==
'-' ||
1424 name2[locale.getLength()] ==
'_'))
1445 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
1446 if (!children.empty()) {
1447 return children.front();
1458 std::vector< rtl::Reference< ChildAccess > > vec;
1460 for (
auto const& member :
members)
1464 assert(vec.back().is());
1472 vec.push_back(child);
1496 for (;;) std::abort();
1503 for (;;) std::abort();
1506 throw css::lang::IllegalArgumentException(
1507 "configmgr inappropriate property value",
1513 OUString
const &
name, css::uno::Any
const & value,
1516 assert(localModifications !=
nullptr);
1525 localModifications->
add(child->getRelativePath());
1529 std::vector< css::util::ElementChange > * changes)
1531 assert(changes !=
nullptr);
1537 child->reportChildChanges(changes);
1538 changes->push_back(css::util::ElementChange());
1541 changes->push_back(css::util::ElementChange());
1549 assert(globalModifications !=
nullptr);
1551 bool childValid = valid;
1555 childValid = childValid && !child->isFinalized();
1556 child->commitChanges(childValid, globalModifications);
1568 childValid = childValid &&
1571 child->getNode()->setMandatory(j->second->getMandatory());
1575 members[
i->first] = child->getNode();
1579 childValid = childValid && j !=
members.end() &&
1586 if (childValid &&
i->second.directlyModified) {
1588 path.push_back(
i->first);
1590 globalModifications->
add(path);
1592 i->second.child->committed();
1599 std::vector< css::util::ElementChange > * allChanges)
1601 assert(broadcaster !=
nullptr);
1602 std::vector< css::beans::PropertyChangeEvent > propChanges;
1604 for (
const auto &
i : modifications.
children)
1608 switch (child->getNode()->kind()) {
1610 if (!
i.second.children.empty()) {
1612 child->initBroadcasterAndChanges(
1613 i.second, broadcaster, allChanges);
1622 addContainerElementReplacedNotification(
1624 css::container::ContainerEvent(
1627 css::uno::Any(
i.first),
1628 css::uno::Any(), css::uno::Any()));
1631 PropertyChangeListeners::iterator j(
1634 for (
auto const& propertyChangeListenerElement : j->second)
1637 propertyChangeListenerElement,
1638 css::beans::PropertyChangeEvent(
1641 i.first,
false, -1, css::uno::Any(),
1647 for (
auto const& propertyChangeListenerElement : j->second)
1650 propertyChangeListenerElement,
1651 css::beans::PropertyChangeEvent(
1654 i.first,
false, -1, css::uno::Any(),
1658 if (allChanges !=
nullptr) {
1659 allChanges->push_back(
1660 css::util::ElementChange(
1662 child->getRelativePathRepresentation()),
1663 css::uno::Any(), css::uno::Any()));
1666 if (collectPropChanges) {
1667 propChanges.emplace_back(
1669 i.first,
false, -1, css::uno::Any(),
1682 css::container::ContainerEvent(
1684 css::uno::Any(
i.first), child->asValue(),
1688 if (allChanges !=
nullptr) {
1689 allChanges->push_back(
1690 css::util::ElementChange(
1692 child->getRelativePathRepresentation()),
1693 child->asValue(), css::uno::Any()));
1696 assert(!collectPropChanges);
1704 css::container::ContainerEvent(
1706 css::uno::Any(
i.first), child->asValue(),
1711 PropertyChangeListeners::iterator j(
1714 for (
auto const& propertyChangeListenerElement : j->second)
1717 propertyChangeListenerElement,
1718 css::beans::PropertyChangeEvent(
1720 i.first,
false, -1, css::uno::Any(),
1726 for (
auto const& propertyChangeListenerElement : j->second)
1729 propertyChangeListenerElement,
1730 css::beans::PropertyChangeEvent(
1732 i.first,
false, -1, css::uno::Any(),
1736 if (allChanges !=
nullptr) {
1737 allChanges->push_back(
1738 css::util::ElementChange(
1740 child->getRelativePathRepresentation()),
1741 child->asValue(), css::uno::Any()));
1744 if (collectPropChanges) {
1745 propChanges.emplace_back(
1747 i.first,
false, -1, css::uno::Any(),
1754 if (
i.second.children.empty()) {
1755 if (!child->getNode()->getTemplateName().isEmpty()) {
1759 addContainerElementInsertedNotification(
1761 css::container::ContainerEvent(
1764 css::uno::Any(
i.first),
1765 child->asValue(), css::uno::Any()));
1767 if (allChanges !=
nullptr) {
1768 allChanges->push_back(
1769 css::util::ElementChange(
1771 child->getRelativePathRepresentation()),
1772 css::uno::Any(), css::uno::Any()));
1779 child->initBroadcasterAndChanges(
1780 i.second, broadcaster, allChanges);
1798 css::container::ContainerEvent(
1800 css::uno::Any(
i.first), css::uno::Any(),
1804 if (allChanges !=
nullptr) {
1806 if (!path.isEmpty()) {
1810 allChanges->push_back(
1811 css::util::ElementChange(
1812 css::uno::Any(path.makeStringAndClear()),
1813 css::uno::Any(), css::uno::Any()));
1816 assert(!collectPropChanges);
1825 css::container::ContainerEvent(
1827 css::uno::Any(
i.first), css::uno::Any(),
1831 PropertyChangeListeners::iterator j(
1834 for (
auto const& propertyChangeListenerElement : j->second)
1837 propertyChangeListenerElement,
1838 css::beans::PropertyChangeEvent(
1840 i.first,
false, -1, css::uno::Any(),
1846 for (
auto const& propertyChangeListenerElement : j->second)
1849 propertyChangeListenerElement,
1850 css::beans::PropertyChangeEvent(
1852 i.first,
false, -1, css::uno::Any(),
1856 if (allChanges !=
nullptr) {
1857 OUStringBuffer path(
1859 if (!path.isEmpty()) {
1862 path.append(
i.first);
1863 allChanges->push_back(
1864 css::util::ElementChange(
1865 css::uno::Any(path.makeStringAndClear()),
1866 css::uno::Any(), css::uno::Any()));
1869 if (collectPropChanges) {
1870 propChanges.emplace_back(
1872 i.first,
false, -1, css::uno::Any(),
1879 if (
i.second.children.empty()) {
1884 css::container::ContainerEvent(
1886 css::uno::Any(
i.first),
1887 css::uno::Any(), css::uno::Any()));
1890 if (allChanges !=
nullptr) {
1891 OUStringBuffer path(
1893 if (!path.isEmpty()) {
1897 allChanges->push_back(
1898 css::util::ElementChange(
1899 css::uno::Any(path.makeStringAndClear()),
1900 css::uno::Any(), css::uno::Any()));
1912 if (!propChanges.empty()) {
1913 css::uno::Sequence< css::beans::PropertyChangeEvent > seq(
1924 directlyModified(false)
1929 child(
std::move(theChild)), directlyModified(theDirectlyModified)
1933 ModifiedChildren::iterator
const & childIterator)
1935 return (childIterator->second.child->getParentAccess() ==
this &&
1936 (childIterator->second.child->getNameInternal() ==
1937 childIterator->first))
1951 OUString
const &
name)
1961 if (
i->second->acquireCounting() > 1) {
1962 child.set(
i->second);
1964 i->second->releaseNondeleting();
1966 child->setNode(node);
1976 if( path.startsWith(
"/") ) {
1982 for (
auto const& elem :
abs)
1986 OUString templateName1;
1988 path,
i, &name1, &setElement1, &templateName1);
1989 if (
i == -1 || (
i != path.getLength() && path[
i] !=
'/')) {
1994 OUString templateName2;
1996 if (name1 != name2 || setElement1 != setElement2 ||
2002 if (
i != path.getLength()) {
2010 OUString templateName;
2012 if (
i == -1 || (
i != path.getLength() && path[
i] !=
'/')) {
2021 switch (
p->kind()) {
2024 !templateName.isEmpty())
2030 if (!templateName.isEmpty() &&
2043 if (child->isValue()) {
2044 return i == path.getLength()
2046 }
else if (
i >= path.getLength() - 1) {
2050 parent = child.get();
2055 OUString
const &
name, css::uno::Any
const & value,
2058 assert(localModifications !=
nullptr);
2063 child->checkFinalized();
2064 child->setProperty(
value, localModifications);
2073 switch (
p->kind()) {
2113 return css::beans::Property(
2115 (css::beans::PropertyAttribute::BOUND |
2116 css::beans::PropertyAttribute::CONSTRAINED |
2117 (nillable ? css::beans::PropertyAttribute::MAYBEVOID : 0) |
2119 ? css::beans::PropertyAttribute::REMOVABLE : 0) |
2121 ? css::beans::PropertyAttribute::READONLY : 0)));
2126 throw css::lang::IllegalArgumentException(
2127 "configmgr modification of finalized item",
2133 if (descriptor.isEmpty()) {
2138 switch (child->getNode()->kind()) {
2155 throw css::beans::UnknownPropertyException(
2160 css::uno::Any
const & value)
2163 if (!freeAcc.is() || freeAcc->getParentAccess().is() ||
2164 (freeAcc->isInTransaction() &&
2167 throw css::lang::IllegalArgumentException(
2168 "configmgr inappropriate set element",
2173 freeAcc->getNode()->getTemplateName()))
2175 throw css::lang::IllegalArgumentException(
2176 "configmgr inappropriate set element",
2194 osl::MutexGuard g(*
lock_);
const OUString & getBcp47(bool bResolveSystem=true) const
::std::vector< OUString > getFallbackStrings(bool bIncludeFullBcp47) const
void commitChildChanges(bool valid, Modifications *globalModifications)
virtual void SAL_CALL setPropertyValue(OUString const &aPropertyName, css::uno::Any const &aValue) override
PropertyChangeListeners propertyChangeListeners_
virtual css::uno::Any SAL_CALL getByName(OUString const &aName) override
void checkKnownProperty(OUString const &descriptor)
virtual void SAL_CALL addContainerListener(css::uno::Reference< css::container::XContainerListener > const &xListener) override
virtual css::beans::Property SAL_CALL getAsProperty() override
rtl::Reference< Access > getNotificationRoot()
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(css::uno::Sequence< OUString > const &aPropertyNames) override
DisposeListeners disposeListeners_
virtual void SAL_CALL removeEventListener(css::uno::Reference< css::lang::XEventListener > const &aListener) override
PropertiesChangeListeners propertiesChangeListeners_
virtual const OUString & getNameInternal()=0
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getHierarchicalPropertyValues(css::uno::Sequence< OUString > const &aHierarchicalPropertyNames) override
virtual css::uno::Any SAL_CALL getHierarchicalPropertyValue(OUString const &aHierarchicalPropertyName) override
rtl::Reference< ChildAccess > getModifiedChild(ModifiedChildren::iterator const &childIterator)
virtual void SAL_CALL removeByName(OUString const &aName) override
virtual void initBroadcaster(Modifications::Node const &modifications, Broadcaster *broadcaster)
virtual rtl::Reference< RootAccess > getRootAccess()=0
WeakChildMap cachedChildren_
void checkValue(css::uno::Any const &value, Type type, bool nillable)
rtl::Reference< ChildAccess > getUnmodifiedChild(OUString const &name)
virtual sal_Bool SAL_CALL hasPropertyByHierarchicalName(OUString const &aHierarchicalName) override
oslInterlockedCount acquireCounting()
virtual sal_Bool SAL_CALL hasPropertyByName(OUString const &Name) override
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
virtual rtl::Reference< Node > getNode()=0
virtual void clearListeners() noexcept
rtl::Reference< Node > getParentNode()
bool setChildProperty(OUString const &name, css::uno::Any const &value, Modifications *localModifications)
virtual void initDisposeBroadcaster(Broadcaster *broadcaster)
virtual std::vector< OUString > getAbsolutePath()=0
virtual sal_Bool SAL_CALL hasByName(OUString const &aName) override
virtual OUString SAL_CALL getHierarchicalName() override
ContainerListeners containerListeners_
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL replaceByHierarchicalName(OUString const &aName, css::uno::Any const &aElement) override
virtual void SAL_CALL removePropertyChangeListener(OUString const &aPropertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &aListener) override
virtual OUString SAL_CALL getExactName(OUString const &aApproximateName) override
void markChildAsModified(rtl::Reference< ChildAccess > const &child)
virtual void SAL_CALL setName(OUString const &aName) override
void initBroadcasterAndChanges(Modifications::Node const &modifications, Broadcaster *broadcaster, std::vector< css::util::ElementChange > *changes)
virtual css::beans::Property SAL_CALL getPropertyByHierarchicalName(OUString const &aHierarchicalName) override
virtual OUString SAL_CALL composeHierarchicalName(OUString const &aRelativeName) override
virtual void SAL_CALL addEventListener(css::uno::Reference< css::lang::XEventListener > const &xListener) override
void insertLocalizedValueChild(OUString const &name, css::uno::Any const &value, Modifications *localModifications)
bool getByNameFast(const OUString &name, css::uno::Any &value)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &aType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual void SAL_CALL firePropertiesChangeEvent(css::uno::Sequence< OUString > const &aPropertyNames, css::uno::Reference< css::beans::XPropertiesChangeListener > const &xListener) override
rtl::Reference< ChildAccess > createUnmodifiedChild(const OUString &name, const rtl::Reference< Node > &node)
virtual void addTypes(std::vector< css::uno::Type > *types) const =0
rtl::Reference< ChildAccess > getSubChild(OUString const &path)
VetoableChangeListeners vetoableChangeListeners_
virtual css::beans::Property SAL_CALL getPropertyByName(OUString const &aName) override
virtual void SAL_CALL addVetoableChangeListener(OUString const &PropertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &aListener) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual OUString getRelativePathRepresentation()=0
std::vector< rtl::Reference< ChildAccess > > getAllChildren()
virtual bool isFinalized()=0
virtual ~Access() override
virtual void SAL_CALL removeVetoableChangeListener(OUString const &PropertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &aListener) override
virtual void SAL_CALL addPropertyChangeListener(OUString const &aPropertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &xListener) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
rtl::Reference< ChildAccess > getChild(OUString const &name)
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString const &aName) override
virtual void SAL_CALL insertByName(OUString const &aName, css::uno::Any const &aElement) override
void checkLocalizedPropertyAccess()
virtual void SAL_CALL removePropertiesChangeListener(css::uno::Reference< css::beans::XPropertiesChangeListener > const &xListener) override
void releaseChild(OUString const &name)
virtual std::vector< OUString > getRelativePath()=0
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() override
virtual css::uno::Any SAL_CALL getByHierarchicalName(OUString const &aName) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL removeContainerListener(css::uno::Reference< css::container::XContainerListener > const &xListener) override
void reportChildChanges(std::vector< css::util::ElementChange > *changes)
ModifiedChildren modifiedChildren_
void releaseNondeleting()
virtual void addSupportedServiceNames(std::vector< OUString > *services)=0
virtual rtl::Reference< Access > getParentAccess()=0
virtual css::uno::Reference< css::beans::XHierarchicalPropertySetInfo > SAL_CALL getHierarchicalPropertySetInfo() override
Access(Components &components)
virtual void SAL_CALL addPropertiesChangeListener(css::uno::Sequence< OUString > const &aPropertyNames, css::uno::Reference< css::beans::XPropertiesChangeListener > const &xListener) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL replaceByName(OUString const &aName, css::uno::Any const &aElement) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(css::uno::Sequence< css::uno::Any > const &aArguments) override
virtual void SAL_CALL dispose() override
std::shared_ptr< osl::Mutex > lock_
virtual void SAL_CALL setPropertyValues(css::uno::Sequence< OUString > const &aPropertyNames, css::uno::Sequence< css::uno::Any > const &aValues) override
rtl::Reference< ChildAccess > getFreeSetMember(css::uno::Any const &value)
virtual void SAL_CALL setHierarchicalPropertyValues(css::uno::Sequence< OUString > const &aHierarchicalPropertyNames, css::uno::Sequence< css::uno::Any > const &Values) override
css::beans::Property asProperty()
virtual css::uno::Any SAL_CALL getPropertyValue(OUString const &PropertyName) override
virtual OUString SAL_CALL getName() override
virtual void SAL_CALL setHierarchicalPropertyValue(OUString const &aHierarchicalPropertyName, css::uno::Any const &aValue) override
virtual OUString SAL_CALL getImplementationName() override
void addContainerElementRemovedNotification(css::uno::Reference< css::container::XContainerListener > const &listener, css::container::ContainerEvent const &event)
void addContainerElementReplacedNotification(css::uno::Reference< css::container::XContainerListener > const &listener, css::container::ContainerEvent const &event)
void addPropertyChangeNotification(css::uno::Reference< css::beans::XPropertyChangeListener > const &listener, css::beans::PropertyChangeEvent const &event)
void addDisposeNotification(css::uno::Reference< css::lang::XEventListener > const &listener, css::lang::EventObject const &event)
void addPropertiesChangeNotification(css::uno::Reference< css::beans::XPropertiesChangeListener > const &listener, css::uno::Sequence< css::beans::PropertyChangeEvent > const &event)
static bool asSimpleValue(const rtl::Reference< Node > &rNode, css::uno::Any &value, Components &components)
Can we quickly extract a simple value into value ? if so returns true.
static bool allLocales(std::u16string_view locale)
void addModification(std::vector< OUString > const &path)
rtl::Reference< Node > getTemplate(OUString const &fullName) const
bool isExtensible() const
Type getStaticType() const
void add(std::vector< OUString > const &path)
Node const & getRoot() const
NodeMapImpl::iterator iterator
@ KIND_LOCALIZED_PROPERTY
Type getStaticType() const
bool isValidTemplate(OUString const &templateName) const
oslInterlockedCount m_refCount
css::uno::Type const & get()
std::shared_ptr< osl::Mutex > lock_
Sequence< PropertyValue > aArguments
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
const LanguageTag & getLocale()
const LanguageTag & getLanguageTag()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::shared_ptr< osl::Mutex > const & lock()
css::uno::Type const & mapType(Type type)
Type getDynamicType(css::uno::Any const &value)
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwNodeOffset abs(const SwNodeOffset &a)
PyObject_HEAD PyUNO_callable_Internals * members
static sal_Int32 parseSegment(OUString const &path, sal_Int32 index, OUString *name, bool *setElement, OUString *templateName)
static bool equalTemplateNames(OUString const &shortName, OUString const &longName)
static OUString createSegment(std::u16string_view templateName, OUString const &name)