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>
78#include <osl/interlck.h>
79#include <osl/mutex.hxx>
80#include <rtl/character.hxx>
82#include <rtl/ustrbuf.hxx>
83#include <rtl/ustring.hxx>
111bool isValidName(OUString
const &
name,
bool setMember) {
112 for (sal_Int32
i = 0;
i !=
name.getLength();) {
113 sal_uInt32 c =
name.iterateCodePoints(&
i);
114 if ((c < 0x20 && !(c == 0x09 || c == 0x0A || c == 0x0D))
115 || rtl::isSurrogate(c) || c == 0xFFFE || c == 0xFFFF
116 || (!setMember && c ==
'/'))
121 return !
name.isEmpty();
148 assert(child.is() && child->getParentAccess() ==
this);
155 assert(
dynamic_cast< ChildAccess *
>(
p.get()) !=
nullptr);
156 parent->modifiedChildren_.emplace(
157 p->getNameInternal(),
176 osl::MutexGuard g(*
lock_);
227 osl::MutexGuard g(*
lock_);
229 return css::uno::Sequence< sal_Int8 >();
235 osl::MutexGuard g(*
lock_);
237 return "org.openoffice-configmgr::Access";
248 osl::MutexGuard g(*
lock_);
250 std::vector<OUString> services;
251 services.emplace_back(
"com.sun.star.configuration.ConfigurationAccess");
253 services.emplace_back(
"com.sun.star.configuration.ConfigurationUpdateAccess");
255 services.emplace_back(
"com.sun.star.configuration.HierarchyAccess");
256 services.emplace_back(
"com.sun.star.configuration.HierarchyElement");
258 services.emplace_back(
"com.sun.star.configuration.GroupAccess");
259 services.emplace_back(
"com.sun.star.configuration.PropertyHierarchy");
261 services.emplace_back(
"com.sun.star.configuration.GroupUpdate");
264 services.emplace_back(
"com.sun.star.configuration.SetAccess");
265 services.emplace_back(
"com.sun.star.configuration.SimpleSetAccess");
267 services.emplace_back(
"com.sun.star.configuration.SetUpdate");
268 services.emplace_back(
"com.sun.star.configuration.SimpleSetUpdate");
279 osl::MutexGuard g(*
lock_);
282 throw css::uno::RuntimeException(
283 "configmgr dispose inappropriate Access",
297 css::uno::Reference< css::lang::XEventListener >
const & xListener)
301 osl::MutexGuard g(*
lock_);
303 if (!xListener.is()) {
304 throw css::uno::RuntimeException(
305 "null listener", getXWeak());
313 xListener->disposing(
314 css::lang::EventObject(getXWeak()));
315 }
catch (css::lang::DisposedException &) {}
319 css::uno::Reference< css::lang::XEventListener >
const & aListener)
322 osl::MutexGuard g(*
lock_);
332 osl::MutexGuard g(*
lock_);
348 throw css::uno::RuntimeException(
349 "this cannot happen", getXWeak());
355 osl::MutexGuard g(*
lock_);
362 bool bGotValue =
false;
373 value = child->asValue();
391 value = child->asValue();
399 osl::MutexGuard g(*
lock_);
403 throw css::container::NoSuchElementException(
411 osl::MutexGuard g(*
lock_);
413 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
414 css::uno::Sequence<OUString> names(children.size());
415 OUString* pArray = names.getArray();
416 for (
auto const& child : children)
418 *pArray++ = child->getNameInternal();
426 osl::MutexGuard g(*
lock_);
434 osl::MutexGuard g(*
lock_);
438 throw css::container::NoSuchElementException(
441 return child->asValue();
447 osl::MutexGuard g(*
lock_);
453 OUString
const & aName, css::uno::Any
const & aElement)
459 osl::MutexGuard g(*
lock_);
463 throw css::container::NoSuchElementException(
466 child->checkFinalized();
470 switch (parent->kind()) {
473 child->setProperty(aElement, &localMods);
476 throw css::lang::IllegalArgumentException(
477 (
"configmgr::Access::replaceByHierarchicalName does not"
478 " currently support set members"),
481 throw css::lang::IllegalArgumentException(
482 (
"configmgr::Access::replaceByHierarchicalName does not allow"
483 " changing component " +
aName),
495 css::uno::Reference< css::container::XContainerListener >
const & xListener)
499 osl::MutexGuard g(*
lock_);
501 if (!xListener.is()) {
502 throw css::uno::RuntimeException(
503 "null listener", getXWeak());
511 xListener->disposing(
512 css::lang::EventObject(getXWeak()));
513 }
catch (css::lang::DisposedException &) {}
517 css::uno::Reference< css::container::XContainerListener >
const & xListener)
520 osl::MutexGuard g(*
lock_);
531 osl::MutexGuard g(*
lock_);
533 return aApproximateName;
539 osl::MutexGuard g(*
lock_);
540 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
541 std::vector< css::beans::Property >
properties;
543 for (
auto const& child : children)
553 osl::MutexGuard g(*
lock_);
556 throw css::beans::UnknownPropertyException(
559 return child->asProperty();
565 osl::MutexGuard g(*
lock_);
571 osl::MutexGuard g(*
lock_);
578 rootPath = root->getAbsolutePathRepresentation();
581 OUStringBuffer path(rootPath);
582 if (!rootPath.isEmpty() && rootPath !=
"/" && !rel.isEmpty()) {
586 return path.makeStringAndClear();
590 OUString
const & aRelativeName)
593 osl::MutexGuard g(*
lock_);
595 if (aRelativeName.isEmpty() || aRelativeName[0] ==
'/') {
596 throw css::lang::IllegalArgumentException(
597 "configmgr composeHierarchicalName inappropriate relative name",
601 if (!path.isEmpty()) {
604 path.append(aRelativeName);
605 return path.makeStringAndClear();
610 osl::MutexGuard g(*
lock_);
620 osl::MutexGuard g(*
lock_);
631 if (! node->getTemplateName().isEmpty()) {
633 parent->getChild(
aName));
634 if (other.get() ==
this) {
638 !(other.is() && other->isFinalized()))
640 if (!isValidName(
aName,
true)) {
641 throw css::uno::RuntimeException(
642 "invalid element name " +
aName);
651 parent->markChildAsModified(childAccess);
653 childAccess->unbind();
657 childAccess->bind(root, parent,
aName);
659 parent->markChildAsModified(childAccess);
671 throw css::uno::RuntimeException(
672 "configmgr setName inappropriate node",
686 osl::MutexGuard g(*
lock_);
698 OUString
const & aPropertyName, css::uno::Any
const & aValue)
703 osl::MutexGuard g(*
lock_);
705 throw css::uno::RuntimeException(
706 "configmgr setPropertyValue on non-update access",
711 throw css::beans::UnknownPropertyException(
712 aPropertyName, getXWeak());
722 osl::MutexGuard g(*
lock_);
726 throw css::beans::UnknownPropertyException(
727 PropertyName, getXWeak());
732 OUString
const & aPropertyName,
733 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
738 osl::MutexGuard g(*
lock_);
739 if (!xListener.is()) {
740 throw css::uno::RuntimeException(
741 "null listener", getXWeak());
750 xListener->disposing(
751 css::lang::EventObject(getXWeak()));
752 }
catch (css::lang::DisposedException &) {}
756 OUString
const & aPropertyName,
757 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
761 osl::MutexGuard g(*
lock_);
763 PropertyChangeListeners::iterator
i(
766 PropertyChangeListenersElement::iterator j(
i->second.find(aListener));
767 if (j !=
i->second.end()) {
769 if (
i->second.empty()) {
777 OUString
const & PropertyName,
778 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
783 osl::MutexGuard g(*
lock_);
784 if (!aListener.is()) {
785 throw css::uno::RuntimeException(
786 "null listener", getXWeak());
796 aListener->disposing(
797 css::lang::EventObject(getXWeak()));
798 }
catch (css::lang::DisposedException &) {}
802 OUString
const & PropertyName,
803 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
807 osl::MutexGuard g(*
lock_);
809 VetoableChangeListeners::iterator
i(
812 VetoableChangeListenersElement::iterator j(
i->second.find(aListener));
813 if (j !=
i->second.end()) {
815 if (
i->second.empty()) {
823 css::uno::Sequence< OUString >
const & aPropertyNames,
824 css::uno::Sequence< css::uno::Any >
const & aValues)
829 osl::MutexGuard g(*
lock_);
831 throw css::uno::RuntimeException(
832 "configmgr setPropertyValues on non-update access",
835 if (aPropertyNames.getLength() != aValues.getLength()) {
836 throw css::lang::IllegalArgumentException(
837 (
"configmgr setPropertyValues: aPropertyNames/aValues of"
838 " different length"),
842 for (sal_Int32
i = 0;
i < aPropertyNames.getLength(); ++
i) {
844 throw css::lang::IllegalArgumentException(
845 "configmgr setPropertyValues inappropriate property name",
855 css::uno::Sequence< OUString >
const & aPropertyNames)
858 osl::MutexGuard g(*
lock_);
859 css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength());
860 auto aValsRange = asNonConstRange(vals);
861 for (sal_Int32
i = 0;
i < aPropertyNames.getLength(); ++
i)
864 throw css::uno::RuntimeException(
865 "configmgr getPropertyValues inappropriate property name",
873 css::uno::Sequence< OUString >
const &,
874 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
879 osl::MutexGuard g(*
lock_);
880 if (!xListener.is()) {
881 throw css::uno::RuntimeException(
882 "null listener", getXWeak());
890 xListener->disposing(
891 css::lang::EventObject(getXWeak()));
892 }
catch (css::lang::DisposedException &) {}
896 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
900 osl::MutexGuard g(*
lock_);
901 PropertiesChangeListeners::iterator
i(
909 css::uno::Sequence< OUString >
const & aPropertyNames,
910 css::uno::Reference< css::beans::XPropertiesChangeListener >
const &
914 css::uno::Sequence< css::beans::PropertyChangeEvent > events(
915 aPropertyNames.getLength());
916 auto aEventsRange = asNonConstRange(events);
917 for (sal_Int32
i = 0;
i < events.getLength(); ++
i) {
918 aEventsRange[
i].Source = getXWeak();
919 aEventsRange[
i].PropertyName = aPropertyNames[
i];
920 aEventsRange[
i].Further =
false;
921 aEventsRange[
i].PropertyHandle = -1;
923 xListener->propertiesChange(events);
926css::uno::Reference< css::beans::XHierarchicalPropertySetInfo >
933 OUString
const & aHierarchicalPropertyName,
934 css::uno::Any
const & aValue)
939 osl::MutexGuard g(*
lock_);
941 throw css::uno::RuntimeException(
942 "configmgr setHierarchicalPropertyName on non-update access",
948 throw css::beans::UnknownPropertyException(
949 aHierarchicalPropertyName,
952 child->checkFinalized();
954 child->setProperty(aValue, &localMods);
961 OUString
const & aHierarchicalPropertyName)
964 osl::MutexGuard g(*
lock_);
967 throw css::beans::UnknownPropertyException(
968 aHierarchicalPropertyName,
971 return child->asValue();
975 css::uno::Sequence< OUString >
const & aHierarchicalPropertyNames,
976 css::uno::Sequence< css::uno::Any >
const & Values)
981 osl::MutexGuard g(*
lock_);
983 throw css::uno::RuntimeException(
984 "configmgr setPropertyValues on non-update access",
987 if (aHierarchicalPropertyNames.getLength() !=
Values.getLength()) {
988 throw css::lang::IllegalArgumentException(
989 (
"configmgr setHierarchicalPropertyValues:"
990 " aHierarchicalPropertyNames/Values of different length"),
994 for (sal_Int32
i = 0;
i < aHierarchicalPropertyNames.getLength(); ++
i) {
998 throw css::lang::IllegalArgumentException(
999 (
"configmgr setHierarchicalPropertyValues inappropriate"
1003 child->checkFinalized();
1004 child->setProperty(
Values[
i], &localMods);
1012 css::uno::Sequence< OUString >
const & aHierarchicalPropertyNames)
1015 osl::MutexGuard g(*
lock_);
1016 css::uno::Sequence< css::uno::Any > vals(
1017 aHierarchicalPropertyNames.getLength());
1018 auto aValsRange = asNonConstRange(vals);
1019 for (sal_Int32
i = 0;
i < aHierarchicalPropertyNames.getLength(); ++
i) {
1023 throw css::lang::IllegalArgumentException(
1024 (
"configmgr getHierarchicalPropertyValues inappropriate"
1025 " hierarchical property name"),
1028 aValsRange[
i] = child->asValue();
1034 OUString
const & aHierarchicalName)
1037 osl::MutexGuard g(*
lock_);
1040 throw css::beans::UnknownPropertyException(
1041 aHierarchicalName, getXWeak());
1043 return child->asProperty();
1047 OUString
const & aHierarchicalName)
1050 osl::MutexGuard g(*
lock_);
1055 OUString
const & aName, css::uno::Any
const & aElement)
1060 osl::MutexGuard g(*
lock_);
1064 throw css::container::NoSuchElementException(
1067 child->checkFinalized();
1072 child->setProperty(aElement, &localMods);
1079 localMods.
add(child->getRelativePath());
1081 freeAcc->bind(root,
this,
aName);
1095 OUString
const & aName, css::uno::Any
const & aElement)
1100 osl::MutexGuard g(*
lock_);
1104 throw css::container::ElementExistException(
1110 if (!isValidName(
aName,
false)) {
1111 throw css::lang::IllegalArgumentException(
1112 aName, getXWeak(), 0);
1118 if (!isValidName(
aName,
false)) {
1119 throw css::lang::IllegalArgumentException(
1120 aName, getXWeak(), 0);
1129 localMods.
add(child->getRelativePath());
1134 if (!isValidName(
aName,
true)) {
1135 throw css::lang::IllegalArgumentException(
1136 aName, getXWeak(), 0);
1142 localMods.
add(freeAcc->getRelativePath());
1159 osl::MutexGuard g(*
lock_);
1162 if (!child.is() || child->isFinalized() ||
1165 throw css::container::NoSuchElementException(
1173 throw css::container::NoSuchElementException(
1178 localMods.
add(child->getRelativePath());
1196 throw css::uno::Exception(
1197 "unknown template " + tmplName,
1202 return cppu::getXWeak(
1207 css::uno::Sequence< css::uno::Any >
const & aArguments)
1211 throw css::uno::Exception(
1212 (
"configuration SimpleSetUpdate createInstanceWithArguments"
1213 " must not specify any arguments"),
1220 components_(components), disposed_(false),
lock_(
lock() )
1227 assert(broadcaster !=
nullptr);
1232 css::lang::EventObject(getXWeak()));
1238 css::lang::EventObject(getXWeak()));
1242 for (
auto const& propertyChangeListenerElement : propertyChangeListener.second)
1245 propertyChangeListenerElement,
1246 css::lang::EventObject(
1252 for (
auto const& vetoableChangeListenerElement : vetoableChangeListener.second)
1255 vetoableChangeListenerElement,
1256 css::lang::EventObject(
1263 propertiesChangeListener,
1264 css::lang::EventObject(getXWeak()));
1272 child->initDisposeBroadcaster(broadcaster);
1289 child->clearListeners();
1296 css::uno::Any res(OWeakObject::queryInterface(aType));
1297 if (res.hasValue()) {
1301 aType,
static_cast< css::lang::XTypeProvider *
>(
this),
1302 static_cast< css::lang::XServiceInfo *
>(
this),
1303 static_cast< css::lang::XComponent *
>(
this),
1304 static_cast< css::container::XHierarchicalNameAccess *
>(
this),
1305 static_cast< css::container::XContainer *
>(
this),
1306 static_cast< css::beans::XExactName *
>(
this),
1307 static_cast< css::container::XHierarchicalName *
>(
this),
1308 static_cast< css::container::XNamed *
>(
this),
1309 static_cast< css::beans::XProperty *
>(
this),
1310 static_cast< css::container::XElementAccess *
>(
this),
1311 static_cast< css::container::XNameAccess *
>(
this));
1312 if (res.hasValue()) {
1317 aType,
static_cast< css::beans::XPropertySetInfo *
>(
this),
1318 static_cast< css::beans::XPropertySet *
>(
this),
1319 static_cast< css::beans::XMultiPropertySet *
>(
this),
1320 static_cast< css::beans::XHierarchicalPropertySet *
>(
this),
1321 static_cast< css::beans::XMultiHierarchicalPropertySet *
>(
this),
1322 static_cast< css::beans::XHierarchicalPropertySetInfo *
>(
this));
1323 if (res.hasValue()) {
1329 aType,
static_cast< css::container::XNameReplace *
>(
this),
1330 static_cast< css::container::XHierarchicalNameReplace *
>(
this));
1331 if (res.hasValue()) {
1338 aType,
static_cast< css::container::XNameContainer *
>(
this));
1339 if (res.hasValue()) {
1345 aType,
static_cast< css::lang::XSingleServiceFactory *
>(
this));
1356 throw css::uno::RuntimeException(
1357 "configmgr Access to specialized LocalizedPropertyNode",
1370 &&
name.startsWith(
"*", &locale))
1372 if (locale.startsWith(
"*")) {
1375 (
"access best-matching localized property value via"
1376 " \"*<locale>\" with <locale> \"")
1377 << locale <<
"\" recursively starting with \"*\"");
1381 locale.isEmpty(),
"configmgr",
1382 (
"access best-matching localized property value via \"*<locale>\""
1383 " with empty <locale>; falling back to defaults"));
1391 if (!locale.isEmpty()) {
1394 if (directChild.is())
1398 if (aLanguageTag.
getBcp47() != locale)
1410 for (
const OUString& rFallback : aFallbacks)
1423 locale = locale.copy(0,
i);
1425 assert(!locale.isEmpty());
1426 std::vector< rtl::Reference< ChildAccess > > children(
1428 for (
auto const& child : children)
1430 const OUString & name2(child->getNameInternal());
1431 if (name2.startsWith(locale) &&
1432 (name2.getLength() == locale.getLength() ||
1433 name2[locale.getLength()] ==
'-' ||
1434 name2[locale.getLength()] ==
'_'))
1455 std::vector< rtl::Reference< ChildAccess > > children(
getAllChildren());
1456 if (!children.empty()) {
1457 return children.front();
1468 std::vector< rtl::Reference< ChildAccess > > vec;
1470 for (
auto const& member :
members)
1474 assert(vec.back().is());
1482 vec.push_back(child);
1506 for (;;) std::abort();
1513 for (;;) std::abort();
1516 throw css::lang::IllegalArgumentException(
1517 "configmgr inappropriate property value",
1523 OUString
const &
name, css::uno::Any
const & value,
1526 assert(localModifications !=
nullptr);
1535 localModifications->
add(child->getRelativePath());
1539 std::vector< css::util::ElementChange > * changes)
1541 assert(changes !=
nullptr);
1547 child->reportChildChanges(changes);
1548 changes->push_back(css::util::ElementChange());
1551 changes->push_back(css::util::ElementChange());
1559 assert(globalModifications !=
nullptr);
1561 bool childValid = valid;
1565 childValid = childValid && !child->isFinalized();
1566 child->commitChanges(childValid, globalModifications);
1578 childValid = childValid &&
1581 child->getNode()->setMandatory(j->second->getMandatory());
1585 members[
i->first] = child->getNode();
1589 childValid = childValid && j !=
members.end() &&
1596 if (childValid &&
i->second.directlyModified) {
1598 path.push_back(
i->first);
1600 globalModifications->
add(path);
1602 i->second.child->committed();
1609 std::vector< css::util::ElementChange > * allChanges)
1611 assert(broadcaster !=
nullptr);
1612 std::vector< css::beans::PropertyChangeEvent > propChanges;
1614 for (
const auto &
i : modifications.
children)
1618 switch (child->getNode()->kind()) {
1620 if (!
i.second.children.empty()) {
1622 child->initBroadcasterAndChanges(
1623 i.second, broadcaster, allChanges);
1632 addContainerElementReplacedNotification(
1634 css::container::ContainerEvent(
1636 css::uno::Any(
i.first),
1637 css::uno::Any(), css::uno::Any()));
1640 PropertyChangeListeners::iterator j(
1643 for (
auto const& propertyChangeListenerElement : j->second)
1646 propertyChangeListenerElement,
1647 css::beans::PropertyChangeEvent(
1649 i.first,
false, -1, css::uno::Any(),
1655 for (
auto const& propertyChangeListenerElement : j->second)
1658 propertyChangeListenerElement,
1659 css::beans::PropertyChangeEvent(
1661 i.first,
false, -1, css::uno::Any(),
1665 if (allChanges !=
nullptr) {
1666 allChanges->push_back(
1667 css::util::ElementChange(
1669 child->getRelativePathRepresentation()),
1670 css::uno::Any(), css::uno::Any()));
1673 if (collectPropChanges) {
1674 propChanges.emplace_back(
1676 i.first,
false, -1, css::uno::Any(),
1689 css::container::ContainerEvent(
1691 css::uno::Any(
i.first), child->asValue(),
1695 if (allChanges !=
nullptr) {
1696 allChanges->push_back(
1697 css::util::ElementChange(
1699 child->getRelativePathRepresentation()),
1700 child->asValue(), css::uno::Any()));
1703 assert(!collectPropChanges);
1711 css::container::ContainerEvent(
1713 css::uno::Any(
i.first), child->asValue(),
1718 PropertyChangeListeners::iterator j(
1721 for (
auto const& propertyChangeListenerElement : j->second)
1724 propertyChangeListenerElement,
1725 css::beans::PropertyChangeEvent(
1727 i.first,
false, -1, css::uno::Any(),
1733 for (
auto const& propertyChangeListenerElement : j->second)
1736 propertyChangeListenerElement,
1737 css::beans::PropertyChangeEvent(
1739 i.first,
false, -1, css::uno::Any(),
1743 if (allChanges !=
nullptr) {
1744 allChanges->push_back(
1745 css::util::ElementChange(
1747 child->getRelativePathRepresentation()),
1748 child->asValue(), css::uno::Any()));
1751 if (collectPropChanges) {
1752 propChanges.emplace_back(
1754 i.first,
false, -1, css::uno::Any(),
1761 if (
i.second.children.empty()) {
1762 if (!child->getNode()->getTemplateName().isEmpty()) {
1766 addContainerElementInsertedNotification(
1768 css::container::ContainerEvent(
1770 css::uno::Any(
i.first),
1771 child->asValue(), css::uno::Any()));
1773 if (allChanges !=
nullptr) {
1774 allChanges->push_back(
1775 css::util::ElementChange(
1777 child->getRelativePathRepresentation()),
1778 css::uno::Any(), css::uno::Any()));
1785 child->initBroadcasterAndChanges(
1786 i.second, broadcaster, allChanges);
1804 css::container::ContainerEvent(
1806 css::uno::Any(
i.first), css::uno::Any(),
1810 if (allChanges !=
nullptr) {
1812 if (!path.isEmpty()) {
1816 allChanges->push_back(
1817 css::util::ElementChange(
1818 css::uno::Any(path.makeStringAndClear()),
1819 css::uno::Any(), css::uno::Any()));
1822 assert(!collectPropChanges);
1831 css::container::ContainerEvent(
1833 css::uno::Any(
i.first), css::uno::Any(),
1837 PropertyChangeListeners::iterator j(
1840 for (
auto const& propertyChangeListenerElement : j->second)
1843 propertyChangeListenerElement,
1844 css::beans::PropertyChangeEvent(
1846 i.first,
false, -1, css::uno::Any(),
1852 for (
auto const& propertyChangeListenerElement : j->second)
1855 propertyChangeListenerElement,
1856 css::beans::PropertyChangeEvent(
1858 i.first,
false, -1, css::uno::Any(),
1862 if (allChanges !=
nullptr) {
1863 OUStringBuffer path(
1865 if (!path.isEmpty()) {
1868 path.append(
i.first);
1869 allChanges->push_back(
1870 css::util::ElementChange(
1871 css::uno::Any(path.makeStringAndClear()),
1872 css::uno::Any(), css::uno::Any()));
1875 if (collectPropChanges) {
1876 propChanges.emplace_back(
1878 i.first,
false, -1, css::uno::Any(),
1885 if (
i.second.children.empty()) {
1890 css::container::ContainerEvent(
1892 css::uno::Any(
i.first),
1893 css::uno::Any(), css::uno::Any()));
1896 if (allChanges !=
nullptr) {
1897 OUStringBuffer path(
1899 if (!path.isEmpty()) {
1903 allChanges->push_back(
1904 css::util::ElementChange(
1905 css::uno::Any(path.makeStringAndClear()),
1906 css::uno::Any(), css::uno::Any()));
1918 if (!propChanges.empty()) {
1919 css::uno::Sequence< css::beans::PropertyChangeEvent > seq(
1930 directlyModified(false)
1935 child(
std::move(theChild)), directlyModified(theDirectlyModified)
1939 ModifiedChildren::iterator
const & childIterator)
1941 return (childIterator->second.child->getParentAccess() ==
this &&
1942 (childIterator->second.child->getNameInternal() ==
1943 childIterator->first))
1957 OUString
const &
name)
1967 if (
i->second->acquireCounting() > 1) {
1968 child.set(
i->second);
1970 i->second->releaseNondeleting();
1972 child->setNode(node);
1982 if( path.startsWith(
"/") ) {
1988 for (
auto const& elem :
abs)
1992 OUString templateName1;
1994 path,
i, &name1, &setElement1, &templateName1);
1995 if (
i == -1 || (
i != path.getLength() && path[
i] !=
'/')) {
2000 OUString templateName2;
2002 if (name1 != name2 || setElement1 != setElement2 ||
2008 if (
i != path.getLength()) {
2016 OUString templateName;
2018 if (
i == -1 || (
i != path.getLength() && path[
i] !=
'/')) {
2027 switch (
p->kind()) {
2030 !templateName.isEmpty())
2036 if (!templateName.isEmpty() &&
2049 if (child->isValue()) {
2050 return i == path.getLength()
2052 }
else if (
i >= path.getLength() - 1) {
2056 parent = child.get();
2061 OUString
const &
name, css::uno::Any
const & value,
2064 assert(localModifications !=
nullptr);
2069 child->checkFinalized();
2070 child->setProperty(
value, localModifications);
2079 switch (
p->kind()) {
2119 return css::beans::Property(
2121 (css::beans::PropertyAttribute::BOUND |
2122 css::beans::PropertyAttribute::CONSTRAINED |
2123 (nillable ? css::beans::PropertyAttribute::MAYBEVOID : 0) |
2125 ? css::beans::PropertyAttribute::REMOVABLE : 0) |
2127 ? css::beans::PropertyAttribute::READONLY : 0)));
2132 throw css::lang::IllegalArgumentException(
2133 "configmgr modification of finalized item",
2139 if (descriptor.isEmpty()) {
2144 switch (child->getNode()->kind()) {
2161 throw css::beans::UnknownPropertyException(
2162 descriptor, getXWeak());
2166 css::uno::Any
const & value)
2168 css::uno::Reference<XInterface> xTmp;
2171 if (!freeAcc.is() || freeAcc->getParentAccess().is() ||
2172 (freeAcc->isInTransaction() &&
2175 throw css::lang::IllegalArgumentException(
2176 "configmgr inappropriate set element",
2181 freeAcc->getNode()->getTemplateName()))
2183 throw css::lang::IllegalArgumentException(
2184 "configmgr inappropriate set element",
2202 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()
sal_Int32 indexOfAny(std::u16string_view rIn, sal_Unicode const *const pChars, sal_Int32 const nPos)
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)