summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-02-27 20:34:59 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-02-28 09:02:34 +0100
commitdd514841e6d9b1b2f9d1ac13bca593fcfcb781f6 (patch)
tree3af407dd5c000102fda94216a9252fa61c6c718f
parentef6798919a514fc0043f4cd050ffb244696bbda3 (diff)
a11y: Just use reference instead of extra pointer to content
Just use the `VCLXAccessibleBox::m_xList` member directly instead of extra local pointer variables referring to the reference's body. Change-Id: Ic760d766221df773e8285c927e58ea7419cc7da6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164060 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx52
1 files changed, 20 insertions, 32 deletions
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 93e49f90c285..4562a0fc40c0 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -108,15 +108,13 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
case VclEventId::ListboxSelect:
{
// Forward the call to the list child.
- VCLXAccessibleList* pList = m_xList.get();
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = m_xList.get();
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent, m_bIsDropDownBox);
+ m_xList->ProcessWindowEvent(rVclWindowEvent, m_bIsDropDownBox);
#if defined(_WIN32)
if (m_bIsDropDownBox)
{
@@ -128,30 +126,26 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
case VclEventId::DropdownOpen:
{
- VCLXAccessibleList* pList = m_xList.get();
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = m_xList.get();
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent);
- pList->HandleDropOpen();
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
+ m_xList->HandleDropOpen();
}
break;
}
case VclEventId::DropdownClose:
{
- VCLXAccessibleList* pList = m_xList.get();
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = m_xList.get();
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent);
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
}
VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
@@ -164,8 +158,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
case VclEventId::ComboboxSelect:
{
- VCLXAccessibleList* pList = m_xList.get();
- if (pList != nullptr && m_xText.is())
+ if (m_xList.is() && m_xText.is())
{
Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
if ( xText.is() )
@@ -173,7 +166,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
OUString sText = xText->getSelectedText();
if ( sText.isEmpty() )
sText = xText->getText();
- pList->UpdateSelection_Acc(sText, m_bIsDropDownBox);
+ m_xList->UpdateSelection_Acc(sText, m_bIsDropDownBox);
#if defined(_WIN32)
if (m_bIsDropDownBox || m_aBoxType==COMBOBOX)
NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
@@ -193,14 +186,12 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
case VclEventId::ComboboxItemRemoved:
{
// Forward the call to the list child.
- VCLXAccessibleList* pList = m_xList.get();
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = m_xList.get();
}
- if ( pList != nullptr )
- pList->ProcessWindowEvent (rVclWindowEvent);
+ if (m_xList.is())
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
break;
}
@@ -211,8 +202,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
// the same VCL object as this box does. In case of the
// combobox, however, we have to help by providing the list with
// the text of the currently selected item.
- VCLXAccessibleList* pList = m_xList.get();
- if (pList != nullptr && m_xText.is())
+ if (m_xList.is() && m_xText.is())
{
Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
if ( xText.is() )
@@ -220,7 +210,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
OUString sText = xText->getSelectedText();
if ( sText.isEmpty() )
sText = xText->getText();
- pList->UpdateSelection (sText);
+ m_xList->UpdateSelection(sText);
}
}
break;
@@ -443,13 +433,11 @@ Any VCLXAccessibleBox::getCurrentValue( )
}
if (m_aBoxType == LISTBOX && m_bIsDropDownBox && m_xList.is() )
{
-
- VCLXAccessibleList* pList = m_xList.get();
- if(pList->IsInDropDown())
+ if (m_xList->IsInDropDown())
{
- if(pList->getSelectedAccessibleChildCount()>0)
+ if (m_xList->getSelectedAccessibleChildCount() > 0)
{
- Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild(sal_Int64(0)), UNO_QUERY);
+ Reference<XAccessibleContext> xName (m_xList->getSelectedAccessibleChild(sal_Int64(0)), UNO_QUERY);
if(xName.is())
{
aAny <<= xName->getAccessibleName();