diff options
Diffstat (limited to 'configmgr/source/childaccess.cxx')
-rw-r--r-- | configmgr/source/childaccess.cxx | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 68bc0b01351c..abf3795f1d55 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <cassert> +#include <utility> #include <vector> #include <com/sun/star/container/XChild.hpp> @@ -55,21 +56,11 @@ namespace configmgr { -namespace -{ - class theChildAccessUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theChildAccessUnoTunnelId > {}; -} - -css::uno::Sequence< sal_Int8 > const & ChildAccess::getTunnelId() -{ - return theChildAccessUnoTunnelId::get().getSeq(); -} - ChildAccess::ChildAccess( Components & components, rtl::Reference< RootAccess > const & root, - rtl::Reference< Access > const & parent, OUString const & name, + rtl::Reference< Access > const & parent, OUString name, rtl::Reference< Node > const & node): - Access(components), root_(root), parent_(parent), name_(name), node_(node), + Access(components), root_(root), parent_(parent), name_(std::move(name)), node_(node), inTransaction_(false), lock_( lock() ) { @@ -116,7 +107,7 @@ OUString ChildAccess::getRelativePathRepresentation() { return path.makeStringAndClear(); } -rtl::Reference< Node > ChildAccess::getNode() { +const rtl::Reference< Node > & ChildAccess::getNode() { return node_; } @@ -125,7 +116,7 @@ bool ChildAccess::isFinalized() { (parent_.is() && parent_->isFinalized()); } -OUString ChildAccess::getNameInternal() { +const OUString & ChildAccess::getNameInternal() { return name_; } @@ -137,11 +128,11 @@ rtl::Reference< Access > ChildAccess::getParentAccess() { return parent_; } -void ChildAccess::acquire() throw () { +void ChildAccess::acquire() noexcept { Access::acquire(); } -void ChildAccess::release() throw () { +void ChildAccess::release() noexcept { Access::release(); } @@ -150,7 +141,7 @@ css::uno::Reference< css::uno::XInterface > ChildAccess::getParent() assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); - return static_cast< cppu::OWeakObject * >(parent_.get()); + return cppu::getXWeak(parent_.get()); } void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &) @@ -159,23 +150,13 @@ void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &) osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); throw css::lang::NoSupportException( - "setParent", static_cast< cppu::OWeakObject * >(this)); -} - -sal_Int64 ChildAccess::getSomething( - css::uno::Sequence< sal_Int8 > const & aIdentifier) -{ - assert(thisIs(IS_ANY)); - osl::MutexGuard g(*lock_); - checkLocalizedPropertyAccess(); - return aIdentifier == getTunnelId() - ? reinterpret_cast< sal_Int64 >(this) : 0; + "setParent", getXWeak()); } void ChildAccess::bind( rtl::Reference< RootAccess > const & root, rtl::Reference< Access > const & parent, OUString const & name) - throw () + noexcept { assert(!parent_.is() && root.is() && parent.is() && !name.isEmpty()); root_ = root; @@ -183,7 +164,7 @@ void ChildAccess::bind( name_ = name; } -void ChildAccess::unbind() throw () { +void ChildAccess::unbind() noexcept { assert(parent_.is()); parent_->releaseChild(name_); parent_.clear(); @@ -240,14 +221,14 @@ void ChildAccess::setProperty( } checkValue(value, type, isNillable); getParentAccess()->markChildAsModified(this); - changedValue_.reset(new css::uno::Any(value)); + changedValue_.emplace(value); localModifications->add(getRelativePath()); } css::uno::Any ChildAccess::asValue() { - if (changedValue_ != nullptr) + if (changedValue_) { return *changedValue_; } @@ -264,8 +245,7 @@ css::uno::Any ChildAccess::asValue() return child.is() ? child->asValue() : css::uno::Any(); } } - value <<= css::uno::Reference< css::uno::XInterface >( - static_cast< cppu::OWeakObject * >(this)); + value <<= css::uno::Reference(getXWeak()); } return value; } @@ -291,7 +271,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) { assert(globalModifications != nullptr); commitChildChanges(valid, globalModifications); - if (valid && changedValue_ != nullptr) + if (valid && changedValue_) { std::vector<OUString> path(getAbsolutePath()); getComponents().addModification(path); @@ -299,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 @@ -345,8 +325,7 @@ css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType) return res.hasValue() ? res : cppu::queryInterface( - aType, static_cast< css::container::XChild * >(this), - static_cast< css::lang::XUnoTunnel * >(this)); + aType, static_cast< css::container::XChild * >(this)); } } |