diff options
-rw-r--r-- | editeng/source/accessibility/AccessibleContextBase.cxx | 20 | ||||
-rw-r--r-- | include/editeng/AccessibleContextBase.hxx | 4 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleControlShape.cxx | 3 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleShape.cxx | 18 | ||||
-rw-r--r-- | svx/source/table/accessiblecell.cxx | 25 |
5 files changed, 29 insertions, 41 deletions
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index ef09f28cde8c..1b8b41c10f3f 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -76,11 +76,9 @@ AccessibleContextBase::~AccessibleContextBase() bool AccessibleContextBase::SetState (sal_Int16 aState) { ::osl::ClearableMutexGuard aGuard (m_aMutex); - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - if ((pStateSet != nullptr) && !pStateSet->contains(aState)) + if ((mxStateSet != nullptr) && !mxStateSet->contains(aState)) { - pStateSet->AddState (aState); + mxStateSet->AddState (aState); // Clear the mutex guard so that it is not locked during calls to // listeners. aGuard.clear(); @@ -105,11 +103,9 @@ bool AccessibleContextBase::SetState (sal_Int16 aState) bool AccessibleContextBase::ResetState (sal_Int16 aState) { ::osl::ClearableMutexGuard aGuard (m_aMutex); - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - if ((pStateSet != nullptr) && pStateSet->contains(aState)) + if ((mxStateSet != nullptr) && mxStateSet->contains(aState)) { - pStateSet->RemoveState (aState); + mxStateSet->RemoveState (aState); // Clear the mutex guard so that it is not locked during calls to listeners. aGuard.clear(); @@ -129,10 +125,8 @@ bool AccessibleContextBase::ResetState (sal_Int16 aState) bool AccessibleContextBase::GetState (sal_Int16 aState) { ::osl::MutexGuard aGuard (m_aMutex); - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - if (pStateSet != nullptr) - return pStateSet->contains(aState); + if (mxStateSet != nullptr) + return mxStateSet->contains(aState); else // If there is no state set then return false as a default value. return false; @@ -313,7 +307,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL else { // Create a copy of the state set and return it. - pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); + pStateSet = mxStateSet; if (pStateSet != nullptr) pStateSet = new ::utl::AccessibleStateSetHelper (*pStateSet); diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx index 3955a1bbfeee..6def5872c180 100644 --- a/include/editeng/AccessibleContextBase.hxx +++ b/include/editeng/AccessibleContextBase.hxx @@ -28,10 +28,12 @@ #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> #include <editeng/editengdllapi.h> +#include <rtl/ref.hxx> namespace com::sun::star::accessibility { class XAccessibleStateSet; } namespace com::sun::star::accessibility { class XAccessibleRelationSet; } namespace com::sun::star::accessibility { struct AccessibleEventObject; } +namespace utl { class AccessibleStateSetHelper; } namespace accessibility { @@ -259,7 +261,7 @@ public: protected: /** The state set. */ - css::uno::Reference< css::accessibility::XAccessibleStateSet> mxStateSet; + rtl::Reference<::utl::AccessibleStateSetHelper> mxStateSet; /** The relation set. Relations can be set or removed by calling the <member>AddRelation</member> and <member>RemoveRelation</member> methods. diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index fb759ee57434..45b7edd75fe4 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -769,8 +769,7 @@ void AccessibleControlShape::initializeComposedState() return; // get our own state set implementation - ::utl::AccessibleStateSetHelper* pComposedStates = - static_cast< ::utl::AccessibleStateSetHelper* >( mxStateSet.get() ); + ::utl::AccessibleStateSetHelper* pComposedStates = mxStateSet.get(); OSL_PRECOND( pComposedStates, "AccessibleControlShape::initializeComposedState: no composed set!" ); diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index ee36cf297028..d7792053cb89 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -176,9 +176,7 @@ void AccessibleShape::Init() void AccessibleShape::UpdateStates() { - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - if (pStateSet == nullptr) + if (mxStateSet == nullptr) return; // Set the opaque state for certain shape types when their fill style is @@ -207,9 +205,9 @@ void AccessibleShape::UpdateStates() } } if (bShapeIsOpaque) - pStateSet->AddState (AccessibleStateType::OPAQUE); + mxStateSet->AddState (AccessibleStateType::OPAQUE); else - pStateSet->RemoveState (AccessibleStateType::OPAQUE); + mxStateSet->RemoveState (AccessibleStateType::OPAQUE); // Set the selected state. bool bShapeIsSelected = false; @@ -220,9 +218,9 @@ void AccessibleShape::UpdateStates() } if (bShapeIsSelected) - pStateSet->AddState (AccessibleStateType::SELECTED); + mxStateSet->AddState (AccessibleStateType::SELECTED); else - pStateSet->RemoveState (AccessibleStateType::SELECTED); + mxStateSet->RemoveState (AccessibleStateType::SELECTED); } OUString AccessibleShape::GetStyle() const @@ -392,8 +390,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL return AccessibleContextBase::getAccessibleStateSet (); } - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast<::utl::AccessibleStateSetHelper*>(mxStateSet.get()); + ::utl::AccessibleStateSetHelper* pStateSet = mxStateSet.get(); if (!pStateSet) return Reference<XAccessibleStateSet>(); @@ -1015,8 +1012,7 @@ void AccessibleShape::disposing() // Make sure to send an event that this object loses the focus in the // case that it has the focus. - ::utl::AccessibleStateSetHelper* pStateSet = - static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); + ::utl::AccessibleStateSetHelper* pStateSet = mxStateSet.get(); if (pStateSet != nullptr) pStateSet->RemoveState (AccessibleStateType::FOCUSED); diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 127d6b7fb742..98851438ff0c 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -191,23 +191,21 @@ Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet() } else { - ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - - if(pStateSet) + if(mxStateSet) { // Merge current FOCUSED state from edit engine. if (mpText != nullptr) { if (mpText->HaveFocus()) - pStateSet->AddState (AccessibleStateType::FOCUSED); + mxStateSet->AddState (AccessibleStateType::FOCUSED); else - pStateSet->RemoveState (AccessibleStateType::FOCUSED); + mxStateSet->RemoveState (AccessibleStateType::FOCUSED); } // Set the invisible state for merged cell if (mxCell.is() && mxCell->isMerged()) - pStateSet->RemoveState(AccessibleStateType::VISIBLE); + mxStateSet->RemoveState(AccessibleStateType::VISIBLE); else - pStateSet->AddState(AccessibleStateType::VISIBLE); + mxStateSet->AddState(AccessibleStateType::VISIBLE); //Just when the parent table is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE @@ -225,16 +223,16 @@ Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet() const css::uno::Sequence<short> aStates = rState->getStates(); if (std::find(aStates.begin(), aStates.end(), AccessibleStateType::EDITABLE) != aStates.end()) { - pStateSet->AddState (AccessibleStateType::EDITABLE); - pStateSet->AddState (AccessibleStateType::RESIZABLE); - pStateSet->AddState (AccessibleStateType::MOVEABLE); + mxStateSet->AddState (AccessibleStateType::EDITABLE); + mxStateSet->AddState (AccessibleStateType::RESIZABLE); + mxStateSet->AddState (AccessibleStateType::MOVEABLE); } } } } // 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)); + xStateSet.set(new ::utl::AccessibleStateSetHelper (*mxStateSet)); } } @@ -493,9 +491,8 @@ void AccessibleCell::disposing() // Make sure to send an event that this object loses the focus in the // case that it has the focus. - ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); - if (pStateSet != nullptr) - pStateSet->RemoveState(AccessibleStateType::FOCUSED); + if (mxStateSet != nullptr) + mxStateSet->RemoveState(AccessibleStateType::FOCUSED); if (mpText != nullptr) { |