diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-23 20:13:14 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-18 08:41:27 +0200 |
commit | bc70f674c2487ad826f8fe04e626de1829f5b40d (patch) | |
tree | a34479173f54d914b47ecb196507a6f59e87b346 /configmgr | |
parent | 8a0a4a4e1fa63edaa5ef923e0db56df7d08eb73c (diff) |
Use getXWeak in configmgr
Change-Id: Ia7d9475cecd2208ccf672f2b35c0c841fed7f4dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150840
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/access.cxx | 150 | ||||
-rw-r--r-- | configmgr/source/childaccess.cxx | 7 | ||||
-rw-r--r-- | configmgr/source/configurationprovider.cxx | 12 | ||||
-rw-r--r-- | configmgr/source/configurationregistry.cxx | 54 | ||||
-rw-r--r-- | configmgr/source/readonlyaccess.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/readwriteaccess.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/rootaccess.cxx | 6 |
7 files changed, 118 insertions, 123 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 047c93a5627a..00a9db96407f 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -281,7 +281,7 @@ void Access::dispose() { if (getParentAccess().is()) { throw css::uno::RuntimeException( "configmgr dispose inappropriate Access", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } if (disposed_) { return; @@ -302,7 +302,7 @@ void Access::addEventListener( checkLocalizedPropertyAccess(); if (!xListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } if (!disposed_) { disposeListeners_.insert(xListener); @@ -311,7 +311,7 @@ void Access::addEventListener( } try { xListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -346,7 +346,7 @@ css::uno::Type Access::getElementType() { default: assert(false); throw css::uno::RuntimeException( - "this cannot happen", static_cast< cppu::OWeakObject * >(this)); + "this cannot happen", getXWeak()); } } @@ -401,7 +401,7 @@ css::uno::Any Access::getByName(OUString const & aName) css::uno::Any value; if (!getByNameFast(aName, value)) throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); return value; } @@ -436,7 +436,7 @@ css::uno::Any Access::getByHierarchicalName(OUString const & aName) rtl::Reference< ChildAccess > child(getSubChild(aName)); if (!child.is()) { throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } return child->asValue(); } @@ -461,7 +461,7 @@ void Access::replaceByHierarchicalName( rtl::Reference< ChildAccess > child(getSubChild(aName)); if (!child.is()) { throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } child->checkFinalized(); rtl::Reference< Node > parent(child->getParentNode()); @@ -476,12 +476,12 @@ void Access::replaceByHierarchicalName( throw css::lang::IllegalArgumentException( ("configmgr::Access::replaceByHierarchicalName does not" " currently support set members"), - static_cast< cppu::OWeakObject * >(this), 0); + getXWeak(), 0); case Node::KIND_ROOT: throw css::lang::IllegalArgumentException( ("configmgr::Access::replaceByHierarchicalName does not allow" " changing component " + aName), - static_cast< cppu::OWeakObject * >(this), 0); + getXWeak(), 0); default: assert(false); // this cannot happen break; @@ -500,7 +500,7 @@ void Access::addContainerListener( checkLocalizedPropertyAccess(); if (!xListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } if (!disposed_) { containerListeners_.insert(xListener); @@ -509,7 +509,7 @@ void Access::addContainerListener( } try { xListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -554,7 +554,7 @@ css::beans::Property Access::getPropertyByName(OUString const & aName) rtl::Reference< ChildAccess > child(getChild(aName)); if (!child.is()) { throw css::beans::UnknownPropertyException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } return child->asProperty(); } @@ -595,7 +595,7 @@ OUString Access::composeHierarchicalName( if (aRelativeName.isEmpty() || aRelativeName[0] == '/') { throw css::lang::IllegalArgumentException( "configmgr composeHierarchicalName inappropriate relative name", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } OUStringBuffer path(getRelativePathRepresentation()); if (!path.isEmpty()) { @@ -670,7 +670,7 @@ void Access::setName(OUString const & aName) // but a localized property is never an extension property throw css::uno::RuntimeException( "configmgr setName inappropriate node", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); default: assert(false); // this cannot happen break; @@ -704,12 +704,12 @@ void Access::setPropertyValue( if (!getRootAccess()->isUpdate()) { throw css::uno::RuntimeException( "configmgr setPropertyValue on non-update access", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } Modifications localMods; if (!setChildProperty(aPropertyName, aValue, &localMods)) { throw css::beans::UnknownPropertyException( - aPropertyName, static_cast< cppu::OWeakObject * >(this)); + aPropertyName, getXWeak()); } getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); } @@ -724,7 +724,7 @@ css::uno::Any Access::getPropertyValue(OUString const & PropertyName) css::uno::Any value; if (!getByNameFast(PropertyName, value)) throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); + PropertyName, getXWeak()); return value; } @@ -738,7 +738,7 @@ void Access::addPropertyChangeListener( osl::MutexGuard g(*lock_); if (!xListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } checkKnownProperty(aPropertyName); if (!disposed_) { @@ -748,7 +748,7 @@ void Access::addPropertyChangeListener( } try { xListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -783,7 +783,7 @@ void Access::addVetoableChangeListener( osl::MutexGuard g(*lock_); if (!aListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } checkKnownProperty(PropertyName); if (!disposed_) { @@ -794,7 +794,7 @@ void Access::addVetoableChangeListener( } try { aListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -830,20 +830,20 @@ void Access::setPropertyValues( if (!getRootAccess()->isUpdate()) { throw css::uno::RuntimeException( "configmgr setPropertyValues on non-update access", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } if (aPropertyNames.getLength() != aValues.getLength()) { throw css::lang::IllegalArgumentException( ("configmgr setPropertyValues: aPropertyNames/aValues of" " different length"), - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } Modifications localMods; for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i) { if (!setChildProperty(aPropertyNames[i], aValues[i], &localMods)) { throw css::lang::IllegalArgumentException( "configmgr setPropertyValues inappropriate property name", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } } getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); @@ -863,7 +863,7 @@ css::uno::Sequence< css::uno::Any > Access::getPropertyValues( if (!getByNameFast(aPropertyNames[i], aValsRange[i])) throw css::uno::RuntimeException( "configmgr getPropertyValues inappropriate property name", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } return vals; @@ -879,7 +879,7 @@ void Access::addPropertiesChangeListener( osl::MutexGuard g(*lock_); if (!xListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } if (!disposed_) { propertiesChangeListeners_.insert(xListener); @@ -888,7 +888,7 @@ void Access::addPropertiesChangeListener( } try { xListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -915,7 +915,7 @@ void Access::firePropertiesChangeEvent( aPropertyNames.getLength()); auto aEventsRange = asNonConstRange(events); for (sal_Int32 i = 0; i < events.getLength(); ++i) { - aEventsRange[i].Source = static_cast< cppu::OWeakObject * >(this); + aEventsRange[i].Source = getXWeak(); aEventsRange[i].PropertyName = aPropertyNames[i]; aEventsRange[i].Further = false; aEventsRange[i].PropertyHandle = -1; @@ -940,14 +940,14 @@ void Access::setHierarchicalPropertyValue( if (!getRootAccess()->isUpdate()) { throw css::uno::RuntimeException( "configmgr setHierarchicalPropertyName on non-update access", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } rtl::Reference< ChildAccess > child( getSubChild(aHierarchicalPropertyName)); if (!child.is()) { throw css::beans::UnknownPropertyException( aHierarchicalPropertyName, - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } child->checkFinalized(); Modifications localMods; @@ -966,7 +966,7 @@ css::uno::Any Access::getHierarchicalPropertyValue( if (!child.is()) { throw css::beans::UnknownPropertyException( aHierarchicalPropertyName, - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } return child->asValue(); } @@ -982,13 +982,13 @@ void Access::setHierarchicalPropertyValues( if (!getRootAccess()->isUpdate()) { throw css::uno::RuntimeException( "configmgr setPropertyValues on non-update access", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } if (aHierarchicalPropertyNames.getLength() != Values.getLength()) { throw css::lang::IllegalArgumentException( ("configmgr setHierarchicalPropertyValues:" " aHierarchicalPropertyNames/Values of different length"), - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } Modifications localMods; for (sal_Int32 i = 0; i < aHierarchicalPropertyNames.getLength(); ++i) { @@ -998,7 +998,7 @@ void Access::setHierarchicalPropertyValues( throw css::lang::IllegalArgumentException( ("configmgr setHierarchicalPropertyValues inappropriate" " property name"), - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } child->checkFinalized(); child->setProperty(Values[i], &localMods); @@ -1023,7 +1023,7 @@ css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues( throw css::lang::IllegalArgumentException( ("configmgr getHierarchicalPropertyValues inappropriate" " hierarchical property name"), - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } aValsRange[i] = child->asValue(); } @@ -1038,7 +1038,7 @@ css::beans::Property Access::getPropertyByHierarchicalName( rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName)); if (!child.is()) { throw css::beans::UnknownPropertyException( - aHierarchicalName, static_cast< cppu::OWeakObject * >(this)); + aHierarchicalName, getXWeak()); } return child->asProperty(); } @@ -1062,7 +1062,7 @@ void Access::replaceByName( rtl::Reference< ChildAccess > child(getChild(aName)); if (!child.is()) { throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } child->checkFinalized(); Modifications localMods; @@ -1102,14 +1102,14 @@ void Access::insertByName( checkFinalized(); if (getChild(aName).is()) { throw css::container::ElementExistException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } Modifications localMods; switch (getNode()->kind()) { case Node::KIND_LOCALIZED_PROPERTY: if (!isValidName(aName, false)) { throw css::lang::IllegalArgumentException( - aName, static_cast<cppu::OWeakObject *>(this), 0); + aName, getXWeak(), 0); } insertLocalizedValueChild(aName, aElement, &localMods); break; @@ -1117,7 +1117,7 @@ void Access::insertByName( { if (!isValidName(aName, false)) { throw css::lang::IllegalArgumentException( - aName, static_cast<cppu::OWeakObject *>(this), 0); + aName, getXWeak(), 0); } checkValue(aElement, TYPE_ANY, true); rtl::Reference child( @@ -1133,7 +1133,7 @@ void Access::insertByName( { if (!isValidName(aName, true)) { throw css::lang::IllegalArgumentException( - aName, static_cast<cppu::OWeakObject *>(this), 0); + aName, getXWeak(), 0); } rtl::Reference< ChildAccess > freeAcc( getFreeSetMember(aElement)); @@ -1163,7 +1163,7 @@ void Access::removeByName(OUString const & aName) child->getNode()->getMandatory() != Data::NO_LAYER) { throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } if (getNode()->kind() == Node::KIND_GROUP) { rtl::Reference< Node > p(child->getNode()); @@ -1171,7 +1171,7 @@ void Access::removeByName(OUString const & aName) !static_cast< PropertyNode * >(p.get())->isExtension()) { throw css::container::NoSuchElementException( - aName, static_cast< cppu::OWeakObject * >(this)); + aName, getXWeak()); } } Modifications localMods; @@ -1195,11 +1195,11 @@ css::uno::Reference< css::uno::XInterface > Access::createInstance() if (!tmpl.is()) { throw css::uno::Exception( "unknown template " + tmplName, - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } rtl::Reference< Node > node(tmpl->clone(true)); node->setLayer(Data::NO_LAYER); - return static_cast< cppu::OWeakObject * >( + return cppu::getXWeak( new ChildAccess(components_, getRootAccess(), node)); } @@ -1211,7 +1211,7 @@ css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments( throw css::uno::Exception( ("configuration SimpleSetUpdate createInstanceWithArguments" " must not specify any arguments"), - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } return createInstance(); } @@ -1229,13 +1229,13 @@ void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { { broadcaster->addDisposeNotification( disposeListener, - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } for (auto const& containerListener : containerListeners_) { broadcaster->addDisposeNotification( containerListener, - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } for (auto const& propertyChangeListener : propertyChangeListeners_) { @@ -1244,7 +1244,7 @@ void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { broadcaster->addDisposeNotification( propertyChangeListenerElement, css::lang::EventObject( - static_cast< cppu::OWeakObject * >(this))); + getXWeak())); } } for (auto const& vetoableChangeListener : vetoableChangeListeners_) @@ -1254,14 +1254,14 @@ void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { broadcaster->addDisposeNotification( vetoableChangeListenerElement, css::lang::EventObject( - static_cast< cppu::OWeakObject * >(this))); + getXWeak())); } } for (auto const& propertiesChangeListener : propertiesChangeListeners_) { broadcaster->addDisposeNotification( propertiesChangeListener, - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } //TODO: iterate over children w/ listeners (incl. unmodified ones): for (ModifiedChildren::iterator i(modifiedChildren_.begin()); @@ -1355,7 +1355,7 @@ void Access::checkLocalizedPropertyAccess() { { throw css::uno::RuntimeException( "configmgr Access to specialized LocalizedPropertyNode", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } } @@ -1515,7 +1515,7 @@ void Access::checkValue(css::uno::Any const & value, Type type, bool nillable) { if (!ok) { throw css::lang::IllegalArgumentException( "configmgr inappropriate property value", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } } @@ -1632,8 +1632,7 @@ void Access::initBroadcasterAndChanges( addContainerElementReplacedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >( - this), + getXWeak(), css::uno::Any(i.first), css::uno::Any(), css::uno::Any())); //TODO: non-void Element, ReplacedElement @@ -1646,8 +1645,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >( - this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1659,8 +1657,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >( - this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1675,7 +1672,7 @@ void Access::initBroadcasterAndChanges( } if (collectPropChanges) { propChanges.emplace_back( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any()); } @@ -1690,7 +1687,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addContainerElementReplacedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), css::uno::Any(i.first), child->asValue(), css::uno::Any())); //TODO: distinguish add/modify; non-void ReplacedElement @@ -1712,7 +1709,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addContainerElementReplacedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), css::uno::Any(i.first), child->asValue(), css::uno::Any())); //TODO: distinguish add/remove/modify; non-void @@ -1726,7 +1723,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1738,7 +1735,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1753,7 +1750,7 @@ void Access::initBroadcasterAndChanges( } if (collectPropChanges) { propChanges.emplace_back( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any()); } @@ -1769,8 +1766,7 @@ void Access::initBroadcasterAndChanges( addContainerElementInsertedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >( - this), + getXWeak(), css::uno::Any(i.first), child->asValue(), css::uno::Any())); } @@ -1806,7 +1802,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addContainerElementRemovedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), css::uno::Any(i.first), css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement @@ -1833,7 +1829,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addContainerElementRemovedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), css::uno::Any(i.first), css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement @@ -1846,7 +1842,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1858,7 +1854,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addPropertyChangeNotification( propertyChangeListenerElement, css::beans::PropertyChangeEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any())); } @@ -1878,7 +1874,7 @@ void Access::initBroadcasterAndChanges( } if (collectPropChanges) { propChanges.emplace_back( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), i.first, false, -1, css::uno::Any(), css::uno::Any()); } @@ -1892,7 +1888,7 @@ void Access::initBroadcasterAndChanges( broadcaster->addContainerElementRemovedNotification( containerListener, css::container::ContainerEvent( - static_cast< cppu::OWeakObject * >(this), + getXWeak(), css::uno::Any(i.first), css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement @@ -2135,7 +2131,7 @@ void Access::checkFinalized() { if (isFinalized()) { throw css::lang::IllegalArgumentException( "configmgr modification of finalized item", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } } @@ -2163,7 +2159,7 @@ void Access::checkKnownProperty(OUString const & descriptor) { } } throw css::beans::UnknownPropertyException( - descriptor, static_cast< cppu::OWeakObject * >(this)); + descriptor, getXWeak()); } rtl::Reference< ChildAccess > Access::getFreeSetMember( @@ -2178,7 +2174,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember( { throw css::lang::IllegalArgumentException( "configmgr inappropriate set element", - static_cast< cppu::OWeakObject * >(this), 1); + getXWeak(), 1); } assert(dynamic_cast< SetNode * >(getNode().get()) != nullptr); if (!static_cast< SetNode * >(getNode().get())->isValidTemplate( @@ -2186,7 +2182,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember( { throw css::lang::IllegalArgumentException( "configmgr inappropriate set element", - static_cast< cppu::OWeakObject * >(this), 1); + getXWeak(), 1); } return freeAcc; } diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index ea2394286371..8a8d581dd8d6 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -141,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 &) @@ -150,7 +150,7 @@ 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)); + "setParent", getXWeak()); } void ChildAccess::bind( @@ -245,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; } diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index a99309397e37..40ffd6a9ba4a 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -248,7 +248,7 @@ Service::createInstanceWithArguments( throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider does not support" " service " + ServiceSpecifier), - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } osl::MutexGuard guard(*lock_); Components & components = Components::getSingleton(context_); @@ -258,10 +258,10 @@ Service::createInstanceWithArguments( throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider: there is a leaf" " value at nodepath " + nodepath), - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } components.addRootAccess(root); - return static_cast< cppu::OWeakObject * >(root.get()); + return root->getXWeak(); } css::uno::Sequence< OUString > Service::getAvailableServiceNames() @@ -273,7 +273,7 @@ void Service::refresh() { //TODO std::unique_lock g(m_aMutex); if (maRefreshListeners.getLength(g)) { - css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this)); + css::lang::EventObject ev(getXWeak()); maRefreshListeners.notifyEach(g, &css::util::XRefreshListener::refreshed, ev); } } @@ -296,7 +296,7 @@ void Service::flush() { flushModifications(); std::unique_lock g(m_aMutex); if (maFlushListeners.getLength(g)) { - css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this)); + css::lang::EventObject ev(getXWeak()); maFlushListeners.notifyEach(g, &css::util::XFlushListener::flushed, ev); } } @@ -400,7 +400,7 @@ com_sun_star_comp_configuration_ConfigurationProvider_get_implementation( css::uno::Reference< css::uno::XInterface > createDefault( css::uno::Reference< css::uno::XComponentContext > const & context) { - return static_cast< cppu::OWeakObject * >(new Service(context)); + return getXWeak(new Service(context)); } } diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx index b2fd214f3510..4900b9f97d52 100644 --- a/configmgr/source/configurationregistry.cxx +++ b/configmgr/source/configurationregistry.cxx @@ -263,7 +263,7 @@ void Service::open(OUString const & rURL, sal_Bool bReadOnly, sal_Bool) throw css::lang::WrappedTargetRuntimeException( "com.sun.star.configuration.ConfigurationRegistry: open failed: " + e.Message, - static_cast< cppu::OWeakObject * >(this), anyEx ); + getXWeak(), anyEx ); } url_ = rURL; readOnly_ = bReadOnly; @@ -285,7 +285,7 @@ void Service::destroy() { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Reference< css::registry::XRegistryKey > Service::getRootKey() @@ -305,14 +305,14 @@ void Service::mergeKey(OUString const &, OUString const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void Service::flush() { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void Service::addFlushListener( @@ -320,7 +320,7 @@ void Service::addFlushListener( { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void Service::removeFlushListener( @@ -328,14 +328,14 @@ void Service::removeFlushListener( { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void Service::checkValid() { if (!access_.is()) { throw css::registry::InvalidRegistryException( "com.sun.star.configuration.ConfigurationRegistry: not valid", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } } @@ -343,7 +343,7 @@ void Service::checkValid_RuntimeException() { if (!access_.is()) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not valid", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } } @@ -360,7 +360,7 @@ OUString RegistryKey::getKeyName() { } throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } sal_Bool RegistryKey::isReadOnly() @@ -418,14 +418,14 @@ sal_Int32 RegistryKey::getLongValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setLongValue(sal_Int32) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< sal_Int32 > RegistryKey::getLongListValue() @@ -438,14 +438,14 @@ css::uno::Sequence< sal_Int32 > RegistryKey::getLongListValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setLongListValue(css::uno::Sequence< sal_Int32 > const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } OUString RegistryKey::getAsciiValue() @@ -458,14 +458,14 @@ OUString RegistryKey::getAsciiValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setAsciiValue(OUString const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< OUString > RegistryKey::getAsciiListValue() @@ -478,14 +478,14 @@ css::uno::Sequence< OUString > RegistryKey::getAsciiListValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setAsciiListValue(css::uno::Sequence< OUString > const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } OUString RegistryKey::getStringValue() @@ -498,14 +498,14 @@ OUString RegistryKey::getStringValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setStringValue(OUString const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< OUString > RegistryKey::getStringListValue() @@ -518,7 +518,7 @@ css::uno::Sequence< OUString > RegistryKey::getStringListValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setStringListValue( @@ -526,7 +526,7 @@ void RegistryKey::setStringListValue( { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< sal_Int8 > RegistryKey::getBinaryValue() @@ -539,14 +539,14 @@ css::uno::Sequence< sal_Int8 > RegistryKey::getBinaryValue() } throw css::registry::InvalidValueException( "com.sun.star.configuration.ConfigurationRegistry", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::setBinaryValue(css::uno::Sequence< sal_Int8 > const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Reference< css::registry::XRegistryKey > RegistryKey::openKey( @@ -569,7 +569,7 @@ css::uno::Reference< css::registry::XRegistryKey > RegistryKey::createKey( { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } void RegistryKey::closeKey() @@ -582,7 +582,7 @@ void RegistryKey::deleteKey(OUString const &) { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > @@ -590,14 +590,14 @@ RegistryKey::openKeys() { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } css::uno::Sequence< OUString > RegistryKey::getKeyNames() { throw css::uno::RuntimeException( "com.sun.star.configuration.ConfigurationRegistry: not implemented", - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } sal_Bool RegistryKey::createLink(OUString const &, OUString const &) diff --git a/configmgr/source/readonlyaccess.cxx b/configmgr/source/readonlyaccess.cxx index 71649bc08822..c070e47f71ce 100644 --- a/configmgr/source/readonlyaccess.cxx +++ b/configmgr/source/readonlyaccess.cxx @@ -86,12 +86,12 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments) if (aArguments.getLength() != 1 || !(aArguments[0] >>= locale)) { throw css::lang::IllegalArgumentException( "not exactly one string argument", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } std::unique_lock g1(mutex_); if (root_.is()) { throw css::uno::RuntimeException( - "already initialized", static_cast< cppu::OWeakObject * >(this)); + "already initialized", getXWeak()); } osl::MutexGuard g2(*lock()); Components & components = Components::getSingleton(context_); @@ -103,7 +103,7 @@ rtl::Reference< RootAccess > Service::getRoot() { std::unique_lock g(mutex_); if (!root_.is()) { throw css::lang::NotInitializedException( - "not initialized", static_cast< cppu::OWeakObject * >(this)); + "not initialized", getXWeak()); } return root_; } diff --git a/configmgr/source/readwriteaccess.cxx b/configmgr/source/readwriteaccess.cxx index 1e16cbb717a9..18148b377c1d 100644 --- a/configmgr/source/readwriteaccess.cxx +++ b/configmgr/source/readwriteaccess.cxx @@ -108,12 +108,12 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments) if (aArguments.getLength() != 1 || !(aArguments[0] >>= locale)) { throw css::lang::IllegalArgumentException( "not exactly one string argument", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } std::unique_lock g1(mutex_); if (root_.is()) { throw css::uno::RuntimeException( - "already initialized", static_cast< cppu::OWeakObject * >(this)); + "already initialized", getXWeak()); } osl::MutexGuard g2(*lock()); Components & components = Components::getSingleton(context_); @@ -125,7 +125,7 @@ rtl::Reference< RootAccess > Service::getRoot() { std::unique_lock g(mutex_); if (!root_.is()) { throw css::lang::NotInitializedException( - "not initialized", static_cast< cppu::OWeakObject * >(this)); + "not initialized", getXWeak()); } return root_; } diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index ff7adddef2d5..e2455556b6db 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -118,7 +118,7 @@ void RootAccess::addChangesListener( checkLocalizedPropertyAccess(); if (!aListener.is()) { throw css::uno::RuntimeException( - "null listener", static_cast< cppu::OWeakObject * >(this)); + "null listener", getXWeak()); } if (!isDisposed()) { changesListeners_.insert(aListener); @@ -127,7 +127,7 @@ void RootAccess::addChangesListener( } try { aListener->disposing( - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } catch (css::lang::DisposedException &) {} } @@ -269,7 +269,7 @@ void RootAccess::initDisposeBroadcaster(Broadcaster * broadcaster) { { broadcaster->addDisposeNotification( changesListener, - css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); + css::lang::EventObject(getXWeak())); } Access::initDisposeBroadcaster(broadcaster); } |