diff options
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/access.cxx | 22 | ||||
-rw-r--r-- | configmgr/source/access.hxx | 3 | ||||
-rw-r--r-- | configmgr/source/childaccess.cxx | 4 | ||||
-rw-r--r-- | configmgr/source/dconf.cxx | 4 | ||||
-rw-r--r-- | configmgr/source/localizedvaluenode.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/localizedvaluenode.hxx | 8 | ||||
-rw-r--r-- | configmgr/source/propertynode.cxx | 9 | ||||
-rw-r--r-- | configmgr/source/propertynode.hxx | 8 | ||||
-rw-r--r-- | configmgr/source/valueparser.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 4 |
10 files changed, 55 insertions, 17 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 371ebdc95b06..3075bc0a32f6 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -478,6 +478,28 @@ css::uno::Type Access::getTypeByHierarchicalName(OUString const & aName) } } +sal_Bool Access::getModifiedByHierarchicalName(OUString const & aName) +{ + assert(thisIs(IS_ANY)); + osl::MutexGuard g(*lock_); + checkLocalizedPropertyAccess(); + rtl::Reference< ChildAccess > child(getSubChild(aName)); + if (!child.is()) { + throw css::container::NoSuchElementException( + aName, getXWeak()); + } + auto const & p = child->getNode(); + switch (p->kind()) { + case Node::KIND_PROPERTY: + return static_cast<PropertyNode *>(p.get())->isModified(); + case Node::KIND_LOCALIZED_VALUE: + return static_cast<LocalizedValueNode *>(p.get())->isModified(); + default: + throw css::util::InvalidStateException( + aName, getXWeak()); + } +} + sal_Bool Access::hasByHierarchicalName(OUString const & aName) { assert(thisIs(IS_ANY)); diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index a94d20a6bce6..bd93b4222177 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -168,6 +168,9 @@ public: virtual css::uno::Type SAL_CALL getTypeByHierarchicalName( OUString const & aName) override; + virtual sal_Bool SAL_CALL getModifiedByHierarchicalName( + OUString const & aName) override; + virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString const & aName) override; virtual void SAL_CALL replaceByHierarchicalName( diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index e0a9f9ac6cee..abf3795f1d55 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -279,11 +279,11 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) switch (node_->kind()) { case Node::KIND_PROPERTY: static_cast< PropertyNode * >(node_.get())->setValue( - Data::NO_LAYER, *changedValue_); + Data::NO_LAYER, *changedValue_, true); break; case Node::KIND_LOCALIZED_VALUE: static_cast< LocalizedValueNode * >(node_.get())->setValue( - Data::NO_LAYER, *changedValue_); + Data::NO_LAYER, *changedValue_, true); break; default: assert(false); // this cannot happen diff --git a/configmgr/source/dconf.cxx b/configmgr/source/dconf.cxx index 8548daa46b3c..c12f4a2814fd 100644 --- a/configmgr/source/dconf.cxx +++ b/configmgr/source/dconf.cxx @@ -973,7 +973,7 @@ void readDir( case ReadValue::Error: continue; case ReadValue::Value: - prop->setValue(layer, value); + prop->setValue(layer, value, false); finalize(client, path, member, layer); break; case ReadValue::Remove: @@ -1005,7 +1005,7 @@ void readDir( continue; } static_cast<LocalizedValueNode *>(member.get())->setValue( - layer, value); + layer, value, false); finalize(client, path, member, layer); break; } diff --git a/configmgr/source/localizedvaluenode.cxx b/configmgr/source/localizedvaluenode.cxx index 816975063d29..7f377cc65e2f 100644 --- a/configmgr/source/localizedvaluenode.cxx +++ b/configmgr/source/localizedvaluenode.cxx @@ -30,7 +30,7 @@ namespace configmgr { LocalizedValueNode::LocalizedValueNode(int layer, css::uno::Any value): - Node(layer), value_(std::move(value)) + Node(layer), value_(std::move(value)), modified_(false) {} LocalizedValueNode::LocalizedValueNode(int layer): @@ -46,9 +46,10 @@ OUString LocalizedValueNode::getTemplateName() const { } -void LocalizedValueNode::setValue(int layer, css::uno::Any const & value) +void LocalizedValueNode::setValue(int layer, css::uno::Any const & value, bool bIsUserModification) { setLayer(layer); + modified_ = bIsUserModification; if (&value != &value_) value_ = value; } diff --git a/configmgr/source/localizedvaluenode.hxx b/configmgr/source/localizedvaluenode.hxx index 07949ac5a621..305c82811f33 100644 --- a/configmgr/source/localizedvaluenode.hxx +++ b/configmgr/source/localizedvaluenode.hxx @@ -39,13 +39,16 @@ public: virtual OUString getTemplateName() const override; const css::uno::Any& getValue() const { return value_; } - css::uno::Any* getValuePtr(int layer) + css::uno::Any* getValuePtr(int layer, bool bIsUserModification) { setLayer(layer); + modified_ = bIsUserModification; return &value_; } - void setValue(int layer, css::uno::Any const& value); + void setValue(int layer, css::uno::Any const& value, bool bIsUserModification); + + bool isModified() { return modified_; } private: LocalizedValueNode(LocalizedValueNode const&) = default; @@ -55,6 +58,7 @@ private: virtual Kind kind() const override; css::uno::Any value_; + bool modified_; }; } diff --git a/configmgr/source/propertynode.cxx b/configmgr/source/propertynode.cxx index 351025a2ffb1..6a9d2a6e2817 100644 --- a/configmgr/source/propertynode.cxx +++ b/configmgr/source/propertynode.cxx @@ -39,7 +39,7 @@ PropertyNode::PropertyNode( int layer, Type staticType, bool nillable, css::uno::Any value, bool extension): Node(layer), staticType_(staticType), nillable_(nillable), - extension_(extension), value_(std::move(value)) + extension_(extension), modified_(false), value_(std::move(value)) {} rtl::Reference< Node > PropertyNode::clone(bool) const { @@ -62,15 +62,18 @@ css::uno::Any const & PropertyNode::getValue(Components & components) { return value_; } -void PropertyNode::setValue(int layer, css::uno::Any const & value) { +void PropertyNode::setValue(int layer, css::uno::Any const & value, bool bIsUserModification) { setLayer(layer); value_ = value; + // Consider as modified when modified during runtime or by user registry modifications + modified_ = bIsUserModification; externalDescriptor_.clear(); } -css::uno::Any *PropertyNode::getValuePtr(int layer) +css::uno::Any *PropertyNode::getValuePtr(int layer, bool bIsUserModification) { setLayer(layer); + modified_ = bIsUserModification; externalDescriptor_.clear(); return &value_; } diff --git a/configmgr/source/propertynode.hxx b/configmgr/source/propertynode.hxx index 108b8e944b2b..db6fb926adbf 100644 --- a/configmgr/source/propertynode.hxx +++ b/configmgr/source/propertynode.hxx @@ -46,13 +46,15 @@ public: css::uno::Any const & getValue(Components & components); - void setValue(int layer, css::uno::Any const & value); - css::uno::Any *getValuePtr(int layer); + void setValue(int layer, css::uno::Any const & value, bool bIsUserModification); + css::uno::Any *getValuePtr(int layer, bool bIsUserModification); void setExternal(int layer, OUString const & descriptor); bool isExtension() const { return extension_;} + bool isModified() const { return modified_;} + private: PropertyNode(PropertyNode const&) = default; @@ -65,6 +67,8 @@ private: // TYPE_HEXBINARY_LIST; not TYPE_ERROR or TYPE_NIL) bool nillable_; bool extension_; + /// Whether the property was modified by the user: + bool modified_; OUString externalDescriptor_; css::uno::Any value_; }; diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 17174368d59b..249c1c1dbdcb 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -33,6 +33,7 @@ #include <xmlreader/span.hxx> #include <xmlreader/xmlreader.hxx> +#include "data.hxx" #include "localizedvaluenode.hxx" #include "node.hxx" #include "nodemap.hxx" @@ -347,7 +348,7 @@ bool ValueParser::endElement() { switch (node_->kind()) { case Node::KIND_PROPERTY: - pValue = static_cast< PropertyNode * >(node_.get())->getValuePtr(layer_); + pValue = static_cast< PropertyNode * >(node_.get())->getValuePtr(layer_, layer_ == Data::NO_LAYER); break; case Node::KIND_LOCALIZED_PROPERTY: { @@ -360,7 +361,7 @@ bool ValueParser::endElement() { } else { pLVNode = static_cast< LocalizedValueNode * >(i->second.get()); } - pValue = pLVNode->getValuePtr(layer_); + pValue = pLVNode->getValuePtr(layer_, layer_ == Data::NO_LAYER); } break; default: diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index af21518abd78..b54e7aa95f01 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -427,7 +427,7 @@ void XcuParser::handlePropValue( "xsi:nil and oor:external attributes for prop in " + reader.getUrl()); } - prop->setValue(valueParser_.getLayer(), css::uno::Any()); + prop->setValue(valueParser_.getLayer(), css::uno::Any(), valueParser_.getLayer() == Data::NO_LAYER); state_.push(State::Ignore(false)); } else if (external.isEmpty()) { valueParser_.separator_ = separator; @@ -514,7 +514,7 @@ void XcuParser::handleLocpropValue( } else { static_cast< LocalizedValueNode * >( i->second.get())->setValue( - valueParser_.getLayer(), css::uno::Any()); + valueParser_.getLayer(), css::uno::Any(), valueParser_.getLayer() == Data::NO_LAYER); } state_.push(State::Ignore(true)); } else { |