summaryrefslogtreecommitdiff
path: root/svx/source/accessibility
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-18 11:15:00 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-18 16:59:11 +0200
commit331016f82a709d80c70143435db18753a78a23f6 (patch)
treed0f3362604538d94c8bbf7c127035b18752b316f /svx/source/accessibility
parente7cab93ebbccfc02e84c9385b8c53832784ef47c (diff)
return early on failure
Change-Id: Id96ba954d3056cf982701090cf84ab4b1793b40b Reviewed-on: https://gerrit.libreoffice.org/43489 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/accessibility')
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx91
1 files changed, 45 insertions, 46 deletions
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 86cc8ba732d1..ecf4c478774f 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -405,67 +405,66 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
AccessibleShape::getAccessibleStateSet()
{
::osl::MutexGuard aGuard (maMutex);
- Reference<XAccessibleStateSet> xStateSet;
- bool bDisposed = IsDisposed();
-
- if (bDisposed)
+ if (IsDisposed())
{
// Return a minimal state set that only contains the DEFUNC state.
- xStateSet = AccessibleContextBase::getAccessibleStateSet ();
+ return AccessibleContextBase::getAccessibleStateSet ();
}
- else
- {
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if (pStateSet != nullptr)
+ ::utl::AccessibleStateSetHelper* pStateSet =
+ static_cast<::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+
+ if (!pStateSet)
+ return Reference<XAccessibleStateSet>();
+
+ // Merge current FOCUSED state from edit engine.
+ if (mpText)
+ {
+ if (mpText->HaveFocus())
+ pStateSet->AddState (AccessibleStateType::FOCUSED);
+ else
+ pStateSet->RemoveState (AccessibleStateType::FOCUSED);
+ }
+ //Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
+ css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
+ if( xTempAcc.is() )
+ {
+ css::uno::Reference<XAccessibleContext>
+ xTempAccContext = xTempAcc->getAccessibleContext();
+ if( xTempAccContext.is() )
{
- // Merge current FOCUSED state from edit engine.
- if (mpText != nullptr)
+ css::uno::Reference<XAccessibleStateSet> rState =
+ xTempAccContext->getAccessibleStateSet();
+ if (rState.is())
{
- if (mpText->HaveFocus())
- pStateSet->AddState (AccessibleStateType::FOCUSED);
- else
- pStateSet->RemoveState (AccessibleStateType::FOCUSED);
- }
- //Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
- css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
- if( xTempAcc.is() )
- {
- css::uno::Reference<XAccessibleContext>
- xTempAccContext = xTempAcc->getAccessibleContext();
- if( xTempAccContext.is() )
+ css::uno::Sequence<short> aStates = rState->getStates();
+ int count = aStates.getLength();
+ for( int iIndex = 0;iIndex < count;iIndex++ )
{
- css::uno::Reference<XAccessibleStateSet> rState =
- xTempAccContext->getAccessibleStateSet();
- if( rState.is() ) {
- css::uno::Sequence<short> aStates = rState->getStates();
- int count = aStates.getLength();
- for( int iIndex = 0;iIndex < count;iIndex++ )
- {
- if( aStates[iIndex] == AccessibleStateType::EDITABLE )
- {
- pStateSet->AddState (AccessibleStateType::EDITABLE);
- pStateSet->AddState (AccessibleStateType::RESIZABLE);
- pStateSet->AddState (AccessibleStateType::MOVEABLE);
- break;
- }
- }
+ if( aStates[iIndex] == AccessibleStateType::EDITABLE )
+ {
+ pStateSet->AddState (AccessibleStateType::EDITABLE);
+ pStateSet->AddState (AccessibleStateType::RESIZABLE);
+ pStateSet->AddState (AccessibleStateType::MOVEABLE);
+ break;
}
}
}
- // Create a copy of the state set that may be modified by the
- // caller without affecting the current state set.
- xStateSet.set( new ::utl::AccessibleStateSetHelper (*pStateSet));
}
}
- if (!bDisposed && xStateSet.is() && mpParent && mpParent->IsDocumentSelAll())
+
+ // Create a copy of the state set that may be modified by the
+ // caller without affecting the current state set.
+ Reference<XAccessibleStateSet> xStateSet(new ::utl::AccessibleStateSetHelper(*pStateSet));
+
+ if (mpParent && mpParent->IsDocumentSelAll())
{
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get());
- pStateSet->AddState (AccessibleStateType::SELECTED);
+ ::utl::AccessibleStateSetHelper* pCopyStateSet =
+ static_cast<::utl::AccessibleStateSetHelper*>(xStateSet.get());
+ pCopyStateSet->AddState (AccessibleStateType::SELECTED);
}
+
return xStateSet;
}