diff options
Diffstat (limited to 'dbaccess/source/core/dataaccess/bookmarkcontainer.cxx')
-rw-r--r-- | dbaccess/source/core/dataaccess/bookmarkcontainer.cxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx index 647aaf557f97..3d0657e26603 100644 --- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx +++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx @@ -19,6 +19,7 @@ #include <bookmarkcontainer.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <comphelper/enumhelper.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -45,12 +46,12 @@ OBookmarkContainer::OBookmarkContainer(OWeakObject& _rParent, Mutex& _rMutex) } -void SAL_CALL OBookmarkContainer::acquire( ) throw() +void SAL_CALL OBookmarkContainer::acquire( ) noexcept { m_rParent.acquire(); } -void SAL_CALL OBookmarkContainer::release( ) throw() +void SAL_CALL OBookmarkContainer::release( ) noexcept { m_rParent.release(); } @@ -62,7 +63,7 @@ OBookmarkContainer::~OBookmarkContainer() // XServiceInfo OUString SAL_CALL OBookmarkContainer::getImplementationName( ) { - return "com.sun.star.comp.dba.OBookmarkContainer"; + return u"com.sun.star.comp.dba.OBookmarkContainer"_ustr; } sal_Bool SAL_CALL OBookmarkContainer::supportsService( const OUString& _rServiceName ) @@ -72,7 +73,7 @@ sal_Bool SAL_CALL OBookmarkContainer::supportsService( const OUString& _rService Sequence< OUString > SAL_CALL OBookmarkContainer::getSupportedServiceNames( ) { - return { "com.sun.star.sdb.DefinitionContainer" }; + return { u"com.sun.star.sdb.DefinitionContainer"_ustr }; } // XNameContainer @@ -96,10 +97,8 @@ void SAL_CALL OBookmarkContainer::insertByName( const OUString& _rName, const An // notify the listeners if (m_aContainerListeners.getLength()) { - ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), Any()); - OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); - while (aListenerIterator.hasMoreElements()) - static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent); + ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any()); + m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent ); } } @@ -126,10 +125,8 @@ void SAL_CALL OBookmarkContainer::removeByName( const OUString& _rName ) // notify the listeners if (m_aContainerListeners.getLength()) { - ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), Any()); - OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); - while (aListenerIterator.hasMoreElements()) - static_cast< XContainerListener* >(aListenerIterator.next())->elementRemoved(aEvent); + ContainerEvent aEvent(*this, Any(_rName), Any(sOldBookmark), Any()); + m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent ); } } @@ -161,10 +158,8 @@ void SAL_CALL OBookmarkContainer::replaceByName( const OUString& _rName, const A aGuard.clear(); if (m_aContainerListeners.getLength()) { - ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), makeAny(sOldLink)); - OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners); - while (aListenerIterator.hasMoreElements()) - static_cast< XContainerListener* >(aListenerIterator.next())->elementReplaced(aEvent); + ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any(sOldLink)); + m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvent ); } } @@ -185,7 +180,6 @@ void SAL_CALL OBookmarkContainer::removeContainerListener( const Reference< XCon // XElementAccess Type SAL_CALL OBookmarkContainer::getElementType( ) { - MutexGuard aGuard(m_rMutex); return ::cppu::UnoType<OUString>::get(); } @@ -213,10 +207,10 @@ Any SAL_CALL OBookmarkContainer::getByIndex( sal_Int32 _nIndex ) { MutexGuard aGuard(m_rMutex); - if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aBookmarksIndexed.size()))) + if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aBookmarksIndexed.size())) throw IndexOutOfBoundsException(); - return makeAny(m_aBookmarksIndexed[_nIndex]->second); + return Any(m_aBookmarksIndexed[_nIndex]->second); } Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName ) @@ -226,7 +220,7 @@ Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName ) if (!checkExistence(_rName)) throw NoSuchElementException(); - return makeAny(m_aBookmarks[_rName]); + return Any(m_aBookmarks[_rName]); } Sequence< OUString > SAL_CALL OBookmarkContainer::getElementNames( ) |