summaryrefslogtreecommitdiff
path: root/editeng/source/accessibility/AccessibleContextBase.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 15:58:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 20:45:59 +0200
commitd72f963c0de0c2e48f1dc999cd8687e13a1f676f (patch)
tree9f5e314e1f9e504706cc18675f9408fe3c8db8ea /editeng/source/accessibility/AccessibleContextBase.cxx
parent1c3929a0a1645e802ee18f9c3d3d380375500c72 (diff)
loplugin:flatten in editeng
Change-Id: I5c83183d1f9d2d8f5a25b976ead1a7598a75c641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92197 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/accessibility/AccessibleContextBase.cxx')
-rw-r--r--editeng/source/accessibility/AccessibleContextBase.cxx98
1 files changed, 49 insertions, 49 deletions
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index d99cfa031d76..72ac002c9940 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -347,19 +347,19 @@ lang::Locale SAL_CALL
void SAL_CALL AccessibleContextBase::addAccessibleEventListener (
const uno::Reference<XAccessibleEventListener >& rxListener)
{
- if (rxListener.is())
+ if (!rxListener.is())
+ return;
+
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
- rxListener->disposing (lang::EventObject (x));
- }
- else
- {
- if (!mnClientId)
- mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
- comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
- }
+ uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (x));
+ }
+ else
+ {
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
}
}
@@ -368,18 +368,18 @@ void SAL_CALL AccessibleContextBase::removeAccessibleEventListener (
const uno::Reference<XAccessibleEventListener >& rxListener )
{
ThrowIfDisposed ();
- if (rxListener.is() && mnClientId)
+ if (!(rxListener.is() && mnClientId))
+ return;
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
+ if ( !nListenerCount )
{
- sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
- mnClientId = 0;
- }
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
}
}
@@ -432,21 +432,21 @@ void AccessibleContextBase::SetAccessibleDescription (
const OUString& rDescription,
StringOrigin eDescriptionOrigin)
{
- if (eDescriptionOrigin < meDescriptionOrigin
- || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msDescription;
- aNewValue <<= rDescription;
+ if (!(eDescriptionOrigin < meDescriptionOrigin
+ || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription)))
+ return;
- msDescription = rDescription;
- meDescriptionOrigin = eDescriptionOrigin;
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= msDescription;
+ aNewValue <<= rDescription;
- CommitChange(
- AccessibleEventId::DESCRIPTION_CHANGED,
- aNewValue,
- aOldValue);
- }
+ msDescription = rDescription;
+ meDescriptionOrigin = eDescriptionOrigin;
+
+ CommitChange(
+ AccessibleEventId::DESCRIPTION_CHANGED,
+ aNewValue,
+ aOldValue);
}
@@ -454,21 +454,21 @@ void AccessibleContextBase::SetAccessibleName (
const OUString& rName,
StringOrigin eNameOrigin)
{
- if (eNameOrigin < meNameOrigin
- || (eNameOrigin == meNameOrigin && msName != rName))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msName;
- aNewValue <<= rName;
+ if (!(eNameOrigin < meNameOrigin
+ || (eNameOrigin == meNameOrigin && msName != rName)))
+ return;
- msName = rName;
- meNameOrigin = eNameOrigin;
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= msName;
+ aNewValue <<= rName;
- CommitChange(
- AccessibleEventId::NAME_CHANGED,
- aNewValue,
- aOldValue);
- }
+ msName = rName;
+ meNameOrigin = eNameOrigin;
+
+ CommitChange(
+ AccessibleEventId::NAME_CHANGED,
+ aNewValue,
+ aOldValue);
}