sw/source/core/access/accpara.cxx |   53 +++++++++++---------------------------
 1 file changed, 16 insertions(+), 37 deletions(-)

New commits:
commit fcf747cb992cda5ecc2d5bc3cee50ca3da5cb4bb
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Apr 24 09:36:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 25 07:28:10 2025 +0200

    sw a11y: Drop 'using std::{max,min,sort}'
    
    Change-Id: I5e25dce74fba5e9b8d06ecb4c97d5d520c1858fd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184537
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index f41e3c9093b0..b0080c3ece7b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -102,10 +102,6 @@ using beans::PropertyValue;
 using beans::UnknownPropertyException;
 using beans::PropertyState_DIRECT_VALUE;
 
-using std::max;
-using std::min;
-using std::sort;
-
 namespace com::sun::star::text {
     class XText;
 }
@@ -2170,7 +2166,7 @@ OUString SwAccessibleParagraph::getTextRange(
         i18n::Boundary preBound = aBound;
         while(preBound.startPos==aBound.startPos && nIndex > 0)
         {
-            nIndex = min(nIndex, preBound.startPos);
+            nIndex = std::min(nIndex, preBound.startPos);
             if (nIndex <= 0) break;
             rText.iterateCodePoints(&nIndex, -1);
             GetTextBoundary( preBound, rText, nIndex, nTextType );
@@ -2189,7 +2185,7 @@ OUString SwAccessibleParagraph::getTextRange(
         bool bWord = false;
         while( !bWord )
         {
-            nIndex = min(nIndex, aBound.startPos);
+            nIndex = std::min(nIndex, aBound.startPos);
             if (nIndex > 0)
             {
                 rText.iterateCodePoints(&nIndex, -1);
@@ -2232,7 +2228,7 @@ OUString SwAccessibleParagraph::getTextRange(
     bool bWord = false;
     while( !bWord )
     {
-        nIndex = max( sal_Int32(nIndex+1), aBound.endPos );
+        nIndex = std::max(sal_Int32(nIndex + 1), aBound.endPos);
         if( nIndex < rText.getLength() )
             bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
         else
@@ -2259,8 +2255,8 @@ OUString SwAccessibleParagraph::getTextRange(
         {
             while(nexBound.endPos==aBound.endPos&&nIndex<rText.getLength())
             {
-                // nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) + 1;
-                nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) ;
+                // nIndex = std::max( (sal_Int32)(nIndex), nexBound.endPos) + 
1;
+                nIndex = std::max( (sal_Int32)(nIndex), nexBound.endPos) ;
                 const sal_Unicode* pStr = rText.getStr();
                 if (pStr)
                 {
@@ -2287,7 +2283,7 @@ OUString SwAccessibleParagraph::getTextRange(
         bWord = sal_False;
         while( !bWord )
         {
-            nIndex = max( (sal_Int32)(nIndex+1), aBound.endPos );
+            nIndex = std::max( (sal_Int32)(nIndex+1), aBound.endPos );
             if( nIndex < rText.getLength() )
             {
                 bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
@@ -2695,9 +2691,9 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
         TextFrameIndex const nHintStart(pTextFrame->MapModelToView(pNode, 
pHt->GetStart()));
         TextFrameIndex const nHintEnd(pTextFrame->MapModelToView(pNode, 
pHt->GetAnyEnd()));
         const sal_Int32 nTmpHStt = GetPortionData().GetAccessiblePosition(
-            max(aHIter.startIdx(), nHintStart));
+            std::max(aHIter.startIdx(), nHintStart));
         const sal_Int32 nTmpHEnd = GetPortionData().GetAccessiblePosition(
-            min(aHIter.endIdx(), nHintEnd));
+            std::min(aHIter.endIdx(), nHintEnd));
         xRet = new SwAccessibleHyperlink(*pHt,
                                          *this, nTmpHStt, nTmpHEnd );
         if (aIter != m_pHyperTextData->end())
commit b60c720df85ae6c2b429571bb1e9e926cc1d21ed
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Apr 24 09:27:26 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 25 07:28:02 2025 +0200

    sw a11y: Return early in SwAccessibleParagraph::GetTextBoundary
    
    Change-Id: I4716598f444f21eb7a040e4fd9cc65fe1551ccf1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184536
    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 8434c667b02c..f41e3c9093b0 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -624,47 +624,30 @@ bool SwAccessibleParagraph::GetTextBoundary(
                 : IsValidChar( nPos, rText.getLength() ) ) )
         throw lang::IndexOutOfBoundsException();
 
-    bool bRet;
-
     switch( nTextType )
     {
         case AccessibleTextType::WORD:
-            bRet = GetWordBoundary(rBound, rText, nPos);
-            break;
-
+            return GetWordBoundary(rBound, rText, nPos);
         case AccessibleTextType::SENTENCE:
-            bRet = GetSentenceBoundary( rBound, rText, nPos );
-            break;
-
+            return GetSentenceBoundary(rBound, rText, nPos);
         case AccessibleTextType::PARAGRAPH:
-            bRet = GetParagraphBoundary( rBound, rText );
-            break;
-
+            return GetParagraphBoundary(rBound, rText);
         case AccessibleTextType::CHARACTER:
-            bRet = GetCharBoundary( rBound, rText, nPos );
-            break;
-
+            return GetCharBoundary(rBound, rText, nPos);
         case AccessibleTextType::LINE:
             //Solve the problem of returning wrong LINE and PARAGRAPH
             if((nPos == rText.getLength()) && nPos > 0)
-                bRet = GetLineBoundary( rBound, rText, nPos - 1);
+                return GetLineBoundary(rBound, rText, nPos - 1);
             else
-                bRet = GetLineBoundary( rBound, rText, nPos );
+                return GetLineBoundary(rBound, rText, nPos);
             break;
-
         case AccessibleTextType::ATTRIBUTE_RUN:
-            bRet = GetAttributeBoundary( rBound, nPos );
-            break;
-
+            return GetAttributeBoundary(rBound, nPos);
         case AccessibleTextType::GLYPH:
-            bRet = GetGlyphBoundary( rBound, rText, nPos );
-            break;
-
+            return GetGlyphBoundary(rBound, rText, nPos);
         default:
             throw lang::IllegalArgumentException( );
     }
-
-    return bRet;
 }
 
 OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription()

Reply via email to