sw/source/core/access/accdoc.hxx | 4 ---- sw/source/core/access/accmap.cxx | 17 +++++++++-------- sw/source/core/access/accpara.cxx | 31 ++++++++++++++----------------- 3 files changed, 23 insertions(+), 29 deletions(-)
New commits: commit cd3207d18b703d4aa9ae0153d882571d298b1eac Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 12:36:08 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:30:21 2025 +0200 sw a11y: Move code into only block where it's relevant `xOldCursorAcc` can only be non-empty and `bOldShapeSelected` can only be true if assigned inside of the body of this if construct in SwAccessibleMap::GetContextImpl. Therefore, move the variables and the code that will otherwise have no effect into the body as well. Change-Id: I29824c442f41310af0aff15ebac0e0de9b9fd4a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184574 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 444eaac216a8..d8d11e5002d4 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1667,8 +1667,6 @@ rtl::Reference<SwAccessibleContext> SwAccessibleMap::GetContextImpl(const SwFram DBG_TESTSOLARMUTEX(); rtl::Reference < SwAccessibleContext > xAcc; - rtl::Reference < SwAccessibleContext > xOldCursorAcc; - bool bOldShapeSelected = false; SwAccessibleContextMap::iterator aIter = maFrameMap.find(pFrame); if (aIter != maFrameMap.end()) @@ -1676,6 +1674,9 @@ rtl::Reference<SwAccessibleContext> SwAccessibleMap::GetContextImpl(const SwFram if (!xAcc.is() && bCreate) { + rtl::Reference<SwAccessibleContext> xOldCursorAcc; + bool bOldShapeSelected = false; + switch( pFrame->GetType() ) { case SwFrameType::Txt: @@ -1768,13 +1769,13 @@ rtl::Reference<SwAccessibleContext> SwAccessibleMap::GetContextImpl(const SwFram bOldShapeSelected = mbShapeSelected; mbShapeSelected = false; } - } - // Invalidate focus for old object when map is not locked - if( xOldCursorAcc.is() ) - InvalidateCursorPosition( xOldCursorAcc ); - if( bOldShapeSelected ) - InvalidateShapeSelection(); + // Invalidate focus for old object when map is not locked + if (xOldCursorAcc.is()) + InvalidateCursorPosition(xOldCursorAcc); + if (bOldShapeSelected) + InvalidateShapeSelection(); + } return xAcc; } commit 2f4be841dac6b8bcd771c8f4332aff87a7e5d8db Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 11:47:22 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:30:14 2025 +0200 sw a11y: Drop superfluous/misleading comments The SwAccessibleDocumentBase::getAccessibleChild comment saying // Return the specified child or NULL if index is invalid. is misleading/incorrect, because passing an invalid index results in an IndexOutOfBoundsException being thrown instead. The other 3 dropped ones add no value to the corresponding documentation for the base interface, XAccessibleContext. Change-Id: If724ccafcafdad2b1d35810d46d890cff2000f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184573 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx index ba555547fea7..e4c82be7ef0c 100644 --- a/sw/source/core/access/accdoc.hxx +++ b/sw/source/core/access/accdoc.hxx @@ -51,19 +51,15 @@ public: // Return the number of currently visible children. virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; - // Return the specified child or NULL if index is invalid. virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int64 nIndex) override; - // Return a reference to the parent. virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override; - // Return this objects index among the parents children. virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; - // Return this object's description. virtual OUString SAL_CALL getAccessibleDescription() override; commit bdd679d1fa6a3d11bed4f6ed090c8c0a8b3a68be Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 11:33:13 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:30:07 2025 +0200 sw a11y: Drop commented out namespace prefix Change-Id: I786e73fcb7dc8be23348518056374ddc8012ee3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184572 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 8ecad5bdfa3b..b5d1d7a0be0b 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2074,13 +2074,13 @@ OUString SwAccessibleParagraph::getTextRange( return sText.copy(nStartIndex, nEndIndex-nStartIndex ); } -/*accessibility::*/TextSegment SwAccessibleParagraph::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType ) +TextSegment SwAccessibleParagraph::getTextAtIndex(sal_Int32 nIndex, sal_Int16 nTextType) { SolarMutexGuard aGuard; ThrowIfDisposed(); - /*accessibility::*/TextSegment aResult; + TextSegment aResult; aResult.SegmentStart = -1; aResult.SegmentEnd = -1; @@ -2110,7 +2110,7 @@ OUString SwAccessibleParagraph::getTextRange( return aResult; } -/*accessibility::*/TextSegment SwAccessibleParagraph::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 nTextType ) +TextSegment SwAccessibleParagraph::getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 nTextType) { SolarMutexGuard aGuard; @@ -2118,7 +2118,7 @@ OUString SwAccessibleParagraph::getTextRange( const OUString rText = GetString(); - /*accessibility::*/TextSegment aResult; + TextSegment aResult; aResult.SegmentStart = -1; aResult.SegmentEnd = -1; //If nIndex = 0, then nobefore text so return -1 directly. @@ -2183,13 +2183,13 @@ OUString SwAccessibleParagraph::getTextRange( return aResult; } -/*accessibility::*/TextSegment SwAccessibleParagraph::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 nTextType ) +TextSegment SwAccessibleParagraph::getTextBehindIndex(sal_Int32 nIndex, sal_Int16 nTextType) { SolarMutexGuard aGuard; ThrowIfDisposed(); - /*accessibility::*/TextSegment aResult; + TextSegment aResult; aResult.SegmentStart = -1; aResult.SegmentEnd = -1; const OUString rText = GetString(); @@ -2951,9 +2951,8 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::addSelection( sal_Int32, sal_Int32 sta return 0; } -/*accessibility::*/TextSegment SAL_CALL - SwAccessibleParagraph::getTextMarkup( sal_Int32 nTextMarkupIndex, - sal_Int32 nTextMarkupType ) +TextSegment SAL_CALL SwAccessibleParagraph::getTextMarkup(sal_Int32 nTextMarkupIndex, + sal_Int32 nTextMarkupType) { SolarMutexGuard g; @@ -2979,9 +2978,8 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::addSelection( sal_Int32, sal_Int32 sta return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType ); } -uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL - SwAccessibleParagraph::getTextMarkupAtIndex( sal_Int32 nCharIndex, - sal_Int32 nTextMarkupType ) +uno::Sequence<TextSegment> SAL_CALL +SwAccessibleParagraph::getTextMarkupAtIndex(sal_Int32 nCharIndex, sal_Int32 nTextMarkupType) { SolarMutexGuard g; @@ -3030,8 +3028,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex return nLineNo; } -/*accessibility::*/TextSegment SAL_CALL - SwAccessibleParagraph::getTextAtLineNumber( sal_Int32 nLineNo ) +TextSegment SAL_CALL SwAccessibleParagraph::getTextAtLineNumber(sal_Int32 nLineNo) { SolarMutexGuard g; @@ -3045,7 +3042,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex i18n::Boundary aLineBound; GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound ); - /*accessibility::*/TextSegment aTextAtLine; + TextSegment aTextAtLine; const OUString rText = GetString(); aTextAtLine.SegmentText = rText.copy( aLineBound.startPos, aLineBound.endPos - aLineBound.startPos ); @@ -3055,7 +3052,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex return aTextAtLine; } -/*accessibility::*/TextSegment SAL_CALL SwAccessibleParagraph::getTextAtLineWithCaret() +TextSegment SAL_CALL SwAccessibleParagraph::getTextAtLineWithCaret() { SolarMutexGuard g; @@ -3067,7 +3064,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex return getTextAtLineNumber( nLineNoOfCaret ); } - return /*accessibility::*/TextSegment(); + return TextSegment(); } sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()