diff options
Diffstat (limited to 'sw/source/core/crsr')
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 17 |
5 files changed, 36 insertions, 28 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 7e8448253950..0cb1562a1770 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -70,10 +70,11 @@ namespace SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode(); SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode(); - const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex()); + const sal_Unicode ch_start = + pStartTxtNode->GetTxt()[rStart.nContent.GetIndex()]; xub_StrLen nEndPos = ( rEnd == rStart || rEnd.nContent.GetIndex() == 0 ) ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1; - const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos ); + const sal_Unicode ch_end = pEndTxtNode->GetTxt()[nEndPos]; SwPaM aStartPaM(rStart); SwPaM aEndPaM(rEnd); io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL); @@ -100,10 +101,11 @@ namespace SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode(); SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode(); - const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex()); + const sal_Unicode ch_start = + pStartTxtNode->GetTxt()[rStart.nContent.GetIndex()]; xub_StrLen nEndPos = ( rEnd == rStart || rEnd.nContent.GetIndex() == 0 ) ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1; - const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos ); + const sal_Unicode ch_end = pEndTxtNode->GetTxt()[nEndPos]; SwPaM aStartPaM(rStart); SwPaM aEndPaM(rEnd); io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index e8048b22ddb2..5c8e955f61c9 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2151,7 +2151,7 @@ String SwCrsrShell::GetText() const { SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode(); if( pTxtNd ) - aTxt = pTxtNd->GetTxt().Copy( + aTxt = pTxtNd->GetTxt().copy( pCurCrsr->GetPoint()->nContent.GetIndex() ); } return aTxt; @@ -2174,11 +2174,11 @@ sal_Unicode SwCrsrShell::GetChar( sal_Bool bEnd, long nOffset ) return 0; xub_StrLen nPos = pPos->nContent.GetIndex(); - const String& rStr = pTxtNd->GetTxt(); + const OUString& rStr = pTxtNd->GetTxt(); sal_Unicode cCh = 0; - if( ((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.Len() ) - cCh = rStr.GetChar( static_cast<xub_StrLen>(nPos+nOffset) ); + if (((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.getLength()) + cCh = rStr[nPos + nOffset]; return cCh; } @@ -2200,7 +2200,7 @@ sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount ) xub_StrLen nPos = pPos->nContent.GetIndex(); if( bEnd ) { - if( ( nPos + nCount ) <= pTxtNd->GetTxt().Len() ) + if ((nPos + nCount) <= pTxtNd->GetTxt().getLength()) nPos = nPos + nCount; else return sal_False; // not possible @@ -3318,7 +3318,7 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, lcl_FillTextRange( rRange, *pNode, nBegin, nLen ); // get smarttag word - String aText( pNode->GetTxt().Copy( nBegin, nLen ) ); + String aText( pNode->GetTxt().copy(nBegin, nLen) ); //save the start and end positons of the line and the starting point Push(); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index b464f9619c0d..a14c9282afac 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -240,7 +240,7 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) nNdStt = rPam.GetPoint()->nContent.GetIndex(); nNdEnd = rPam.GetPoint()->nNode == rPam.GetMark()->nNode ? rPam.GetMark()->nContent.GetIndex() - : rTxtNd.GetTxt().Len(); + : rTxtNd.GetTxt().getLength(); } else { diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index c1231f9f0630..e813998da0a9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -59,7 +59,7 @@ static String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, xub_StrLen const SwpHints *pHts = rNd.GetpSwpHints(); sal_uInt16 n = 0; - xub_StrLen nSoftHyphen = nStart; + sal_Int32 nSoftHyphen = nStart; xub_StrLen nHintStart = STRING_LEN; bool bNewHint = true; bool bNewSoftHyphen = true; @@ -74,9 +74,11 @@ static String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, xub_StrLen STRING_LEN; if ( bNewSoftHyphen ) - nSoftHyphen = bRemoveSoftHyphen ? - rNd.GetTxt().Search( CHAR_SOFTHYPHEN, nSoftHyphen ) : - STRING_LEN; + { + nSoftHyphen = (bRemoveSoftHyphen) + ? rNd.GetTxt().indexOf(CHAR_SOFTHYPHEN, nSoftHyphen) + : -1; + } bNewHint = false; bNewSoftHyphen = false; @@ -84,19 +86,21 @@ static String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, xub_StrLen xub_StrLen nStt = 0; // Check if next stop is a hint. - if ( STRING_LEN != nHintStart && nHintStart < nSoftHyphen && nHintStart < nEnd ) + if ( STRING_LEN != nHintStart + && (-1 == nSoftHyphen || nHintStart < nSoftHyphen) + && nHintStart < nEnd ) { nStt = nHintStart; bNewHint = true; } // Check if next stop is a soft hyphen. - else if ( STRING_LEN != nSoftHyphen && nSoftHyphen < nHintStart && nSoftHyphen < nEnd ) + else if (-1 != nSoftHyphen && nSoftHyphen < nHintStart && nSoftHyphen < nEnd) { nStt = nSoftHyphen; bNewSoftHyphen = true; } // If nSoftHyphen == nHintStart, the current hint *must* be a hint with an end. - else if ( STRING_LEN != nSoftHyphen && nSoftHyphen == nHintStart ) + else if (-1 != nSoftHyphen && nSoftHyphen == nHintStart) { nStt = nSoftHyphen; bNewHint = true; @@ -258,7 +262,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes { if( pNode->IsTxtNode() ) { - nTxtLen = ((SwTxtNode*)pNode)->GetTxt().Len(); + nTxtLen = static_cast<SwTxtNode*>(pNode)->GetTxt().getLength(); if( rNdIdx == pPam->GetMark()->nNode ) nEnd = pPam->GetMark()->nContent.GetIndex(); else @@ -668,7 +672,8 @@ String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ) } xub_StrLen nEnd = aStr.Len(); bool bDeleteLastX = false; - if( pPam->End()->nContent < (static_cast<const SwTxtNode*>(pTxtNode))->GetTxt().Len() ) + if (pPam->End()->nContent < + static_cast<const SwTxtNode*>(pTxtNode)->GetTxt().getLength()) { aStr.Insert( sX ); bDeleteLastX = true; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 4e7f34216e65..8bb731a45a6a 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1227,7 +1227,7 @@ sal_Bool SwCursor::GoStartWordWT( sal_Int16 nWordType ) nWordType, sal_False ).startPos; - if( nPtPos < pTxtNd->GetTxt().Len() ) + if (nPtPos < pTxtNd->GetTxt().getLength()) { GetPoint()->nContent = nPtPos; if( !IsSelOvr() ) @@ -1251,7 +1251,7 @@ sal_Bool SwCursor::GoEndWordWT( sal_Int16 nWordType ) nWordType, sal_True ).endPos; - if( nPtPos <= pTxtNd->GetTxt().Len() && + if (nPtPos <= pTxtNd->GetTxt().getLength() && GetPoint()->nContent.GetIndex() != nPtPos ) { GetPoint()->nContent = nPtPos; @@ -1276,7 +1276,7 @@ sal_Bool SwCursor::GoNextWordWT( sal_Int16 nWordType ) pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ), nWordType ).startPos; - if( nPtPos < pTxtNd->GetTxt().Len() ) + if (nPtPos < pTxtNd->GetTxt().getLength()) { GetPoint()->nContent = nPtPos; if( !IsSelOvr() ) @@ -1303,7 +1303,7 @@ sal_Bool SwCursor::GoPrevWordWT( sal_Int16 nWordType ) pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ), nWordType ).startPos; - if( nPtPos < pTxtNd->GetTxt().Len() ) + if (nPtPos < pTxtNd->GetTxt().getLength()) { GetPoint()->nContent = nPtPos; if( !IsSelOvr() ) @@ -1469,7 +1469,7 @@ sal_Bool SwCursor::GoSentence( SentenceMoveType eMoveType ) // it is allowed to place the PaM just behind the last // character in the text thus <= ...Len - if( nPtPos <= pTxtNd->GetTxt().Len() ) + if (nPtPos <= pTxtNd->GetTxt().getLength()) { GetPoint()->nContent = nPtPos; if( !IsSelOvr() ) @@ -1507,12 +1507,12 @@ sal_Bool SwCursor::ExpandToSentenceBorders() // it is allowed to place the PaM just behind the last // character in the text thus <= ...Len bool bChanged = false; - if (nStartPos <= pStartNd->GetTxt().Len()) + if (nStartPos <= pStartNd->GetTxt().getLength()) { GetMark()->nContent = nStartPos; bChanged = true; } - if (nEndPos <= pEndNd->GetTxt().Len()) + if (nEndPos <= pEndNd->GetTxt().getLength()) { GetPoint()->nContent = nEndPos; bChanged = true; @@ -1723,7 +1723,8 @@ void SwCursor::DoSetBidiLevelUpDown() SwIndex& rIdx = GetPoint()->nContent; xub_StrLen nPos = rIdx.GetIndex(); - if( nPos && nPos < ((SwTxtNode&)rNode).GetTxt().Len() ) + if (nPos && nPos < + static_cast<SwTxtNode&>(rNode).GetTxt().getLength()) { const sal_uInt8 nCurrLevel = pSI->DirType( nPos ); const sal_uInt8 nPrevLevel = pSI->DirType( nPos - 1 ); |