summaryrefslogtreecommitdiff
path: root/configmgr/source/rootaccess.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'configmgr/source/rootaccess.cxx')
-rw-r--r--configmgr/source/rootaccess.cxx179
1 files changed, 91 insertions, 88 deletions
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index fc1fe39e8073..03ee3b88e29a 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -133,6 +133,91 @@ void RootAccess::setAlive(bool b) {
alive_ = b;
}
+void RootAccess::addChangesListener(
+ css::uno::Reference< css::util::XChangesListener > const & aListener)
+ throw (css::uno::RuntimeException)
+{
+ assert(thisIs(IS_ANY));
+ {
+ osl::MutexGuard g(*lock_);
+ checkLocalizedPropertyAccess();
+ if (!aListener.is()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("null listener")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ if (!isDisposed()) {
+ changesListeners_.insert(aListener);
+ return;
+ }
+ }
+ try {
+ aListener->disposing(
+ css::lang::EventObject(static_cast< cppu::OWeakObject * >(this)));
+ } catch (css::lang::DisposedException &) {}
+}
+
+void RootAccess::removeChangesListener(
+ css::uno::Reference< css::util::XChangesListener > const & aListener)
+ throw (css::uno::RuntimeException)
+{
+ assert(thisIs(IS_ANY));
+ osl::MutexGuard g(*lock_);
+ checkLocalizedPropertyAccess();
+ ChangesListeners::iterator i(changesListeners_.find(aListener));
+ if (i != changesListeners_.end()) {
+ changesListeners_.erase(i);
+ }
+}
+
+void RootAccess::commitChanges()
+ throw (css::lang::WrappedTargetException, css::uno::RuntimeException)
+{
+ assert(thisIs(IS_UPDATE));
+ if (!alive_)
+ {
+ return;
+ }
+ Broadcaster bc;
+ {
+ osl::MutexGuard g(*lock_);
+
+ checkLocalizedPropertyAccess();
+ int finalizedLayer;
+ Modifications globalMods;
+ commitChildChanges(
+ ((getComponents().resolvePathRepresentation(
+ pathRepresentation_, 0, 0, &finalizedLayer)
+ == node_) &&
+ finalizedLayer == Data::NO_LAYER),
+ &globalMods);
+ getComponents().writeModifications();
+ getComponents().initGlobalBroadcaster(globalMods, this, &bc);
+ }
+ bc.send();
+}
+
+sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) {
+ assert(thisIs(IS_UPDATE));
+ osl::MutexGuard g(*lock_);
+ checkLocalizedPropertyAccess();
+ //TODO: Optimize:
+ std::vector< css::util::ElementChange > changes;
+ reportChildChanges(&changes);
+ return !changes.empty();
+}
+
+css::util::ChangesSet RootAccess::getPendingChanges()
+ throw (css::uno::RuntimeException)
+{
+ assert(thisIs(IS_UPDATE));
+ osl::MutexGuard g(*lock_);
+ checkLocalizedPropertyAccess();
+ comphelper::SequenceAsVector< css::util::ElementChange > changes;
+ reportChildChanges(&changes);
+ return changes.getAsConstList();
+}
+
RootAccess::~RootAccess()
{
osl::MutexGuard g(*lock_);
@@ -166,8 +251,10 @@ rtl::Reference< Node > RootAccess::getNode() {
// RuntimeException.Context is left null here
}
pathRepresentation_ = canonic;
- assert(!path_.empty());
- name_ = path_.back();
+ assert(!path_.empty() || node_->kind() == Node::KIND_ROOT);
+ if (!path_.empty()) {
+ name_ = path_.back();
+ }
finalized_ = finalizedLayer != Data::NO_LAYER;
}
return node_;
@@ -252,97 +339,13 @@ css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType)
return res;
}
-void RootAccess::addChangesListener(
- css::uno::Reference< css::util::XChangesListener > const & aListener)
+rtl::OUString RootAccess::getImplementationName()
throw (css::uno::RuntimeException)
{
assert(thisIs(IS_ANY));
- {
- osl::MutexGuard g(*lock_);
- checkLocalizedPropertyAccess();
- if (!aListener.is()) {
- throw css::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("null listener")),
- static_cast< cppu::OWeakObject * >(this));
- }
- if (!isDisposed()) {
- changesListeners_.insert(aListener);
- return;
- }
- }
- try {
- aListener->disposing(
- css::lang::EventObject(static_cast< cppu::OWeakObject * >(this)));
- } catch (css::lang::DisposedException &) {}
-}
-
-void RootAccess::removeChangesListener(
- css::uno::Reference< css::util::XChangesListener > const & aListener)
- throw (css::uno::RuntimeException)
-{
- assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
- checkLocalizedPropertyAccess();
- ChangesListeners::iterator i(changesListeners_.find(aListener));
- if (i != changesListeners_.end()) {
- changesListeners_.erase(i);
- }
-}
-
-void RootAccess::commitChanges()
- throw (css::lang::WrappedTargetException, css::uno::RuntimeException)
-{
- assert(thisIs(IS_UPDATE));
- if (!alive_)
- {
- return;
- }
- Broadcaster bc;
- {
- osl::MutexGuard g(*lock_);
-
- checkLocalizedPropertyAccess();
- int finalizedLayer;
- Modifications globalMods;
- commitChildChanges(
- ((getComponents().resolvePathRepresentation(
- pathRepresentation_, 0, 0, &finalizedLayer)
- == node_) &&
- finalizedLayer == Data::NO_LAYER),
- &globalMods);
- getComponents().writeModifications();
- getComponents().initGlobalBroadcaster(globalMods, this, &bc);
- }
- bc.send();
-}
-
-sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) {
- assert(thisIs(IS_UPDATE));
- osl::MutexGuard g(*lock_);
- checkLocalizedPropertyAccess();
- //TODO: Optimize:
- std::vector< css::util::ElementChange > changes;
- reportChildChanges(&changes);
- return !changes.empty();
-}
-
-css::util::ChangesSet RootAccess::getPendingChanges()
- throw (css::uno::RuntimeException)
-{
- assert(thisIs(IS_UPDATE));
- osl::MutexGuard g(*lock_);
- checkLocalizedPropertyAccess();
- comphelper::SequenceAsVector< css::util::ElementChange > changes;
- reportChildChanges(&changes);
- return changes.getAsConstList();
-}
-
-rtl::OUString RootAccess::getImplementationName() throw (css::uno::RuntimeException)
-{
- assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess();
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "configmgr.RootAccess" ) );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("configmgr.RootAccess"));
}
}