From 16cf257554887aeb6dc426c54ceeb8d70a6aadd0 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 23 Aug 2023 17:02:04 +0200 Subject: a11y: Simplify AccessibleBrowseBox::implGetHeaderBar Use the `mxColumnHeaderBar` and `mxRowHeaderBar` members directly instead of a pointer to an `rtl::Reference` that can be either of them. Change-Id: I620c7ba92a14fad50d9371b1762b5d5ad05fd7ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156011 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../source/extended/AccessibleBrowseBox.cxx | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'accessibility/source/extended/AccessibleBrowseBox.cxx') diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index e8276958f0f1..056d2c1b5f1c 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -204,25 +204,20 @@ css::uno::Reference< css::accessibility::XAccessible > AccessibleBrowseBox::impl css::uno::Reference< css::accessibility::XAccessible > AccessibleBrowseBox::implGetHeaderBar(AccessibleBrowseBoxObjType eObjType) { - css::uno::Reference< css::accessibility::XAccessible > xRet; - rtl::Reference< AccessibleBrowseBoxHeaderBar >* pxMember = nullptr; - if( eObjType == AccessibleBrowseBoxObjType::RowHeaderBar ) - pxMember = &mxRowHeaderBar; + { + if (!mxRowHeaderBar.is()) + mxRowHeaderBar = new AccessibleBrowseBoxHeaderBar(m_aCreator, *mpBrowseBox, eObjType); + return mxRowHeaderBar; + } else if( eObjType == AccessibleBrowseBoxObjType::ColumnHeaderBar ) - pxMember = &mxColumnHeaderBar; - - if( pxMember ) { - if( !pxMember->is() ) - { - rtl::Reference pHeaderBar = new AccessibleBrowseBoxHeaderBar( - m_aCreator, *mpBrowseBox, eObjType ); - *pxMember = pHeaderBar; - } - xRet = pxMember->get(); + if (!mxColumnHeaderBar.is()) + mxColumnHeaderBar = new AccessibleBrowseBoxHeaderBar(m_aCreator, *mpBrowseBox, eObjType); + return mxColumnHeaderBar; } - return xRet; + + return css::uno::Reference(); } css::uno::Reference< css::accessibility::XAccessible > -- cgit