diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-02-18 18:36:45 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-02-18 20:16:07 +0100 |
commit | 0295c8a34e39326414c1b98cf4da905802f061b0 (patch) | |
tree | 0595896589edc155fae7775fe586403c59842379 /sw | |
parent | 24eae2b75c201292990122e69954072f36b6f218 (diff) |
sw: let SwTxtNode::GetTxt() return OUString
Change-Id: I36e777b2f623429773277e092284f7d2ba61e6ef
Diffstat (limited to 'sw')
82 files changed, 478 insertions, 419 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 854dbdc00e43..eba1e5d6ae5e 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -218,7 +218,7 @@ protected: public: using SwCntntNode::GetAttr; - const String& GetTxt() const { return (String&)m_Text; } //FIXME + const OUString& GetTxt() const { return m_Text; } /// getters for SwpHints inline SwpHints &GetSwpHints(); diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 5f94c84ba2dd..7667f258b3d9 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -251,7 +251,7 @@ void SwDocTest::testModelToViewHelper() nPos = aPaM.GetPoint()->nContent.GetIndex(); pTxtNode->InsertItem(aFtn, nPos, nPos); m_pDoc->InsertString(aPaM, rtl::OUString(" DDDDD")); - CPPUNIT_ASSERT(pTxtNode->GetTxt().Len() == (4*5) + 5 + 2); + CPPUNIT_ASSERT_EQUAL(pTxtNode->GetTxt().getLength(), (4*5) + 5 + 2); //set start of selection to first B aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 6); @@ -533,7 +533,8 @@ void SwDocTest::testSwScanner() aPaM.SetMark(); //set start of selection to current pos aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 5); //set end of selection to fifth char of current node m_pDoc->DeleteAndJoin(aPaM); //redline-aware deletion api - CPPUNIT_ASSERT_MESSAGE("real underlying text should be the same", pTxtNode->GetTxt().EqualsAscii(aString)); + //"real underlying text should be the same" + CPPUNIT_ASSERT_EQUAL(pTxtNode->GetTxt(), OUString(aString)); aDocStat.Reset(); pTxtNode->SetWordCountDirty(true); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 4ae32a3f0e4e..d3d58cf0563b 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1623,7 +1623,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds( paragraph. */ if (bBehindText) { - nPos = pNode->GetTxt().Len(); + nPos = pNode->GetTxt().getLength(); } else nPos = GetPortionData().FillSpecialPos diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index dd8fcb01314e..8e1e2fff9081 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -105,7 +105,7 @@ SwAccessiblePortionData::~SwAccessiblePortionData() void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/) { - OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().Len(), + OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().getLength(), "portion exceeds model string!" ); OSL_ENSURE( !bFinished, "We are already done!" ); @@ -124,9 +124,7 @@ void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType, sal_Int // update buffer + nModelPosition aBuffer.append( OUString( - pTxtNode->GetTxt().Copy( - static_cast<sal_uInt16>( nModelPosition ), - nLength ) ) ); + pTxtNode->GetTxt().copy(nModelPosition, nLength)) ); nModelPosition += nLength; bLastIsSpecial = sal_False; @@ -136,7 +134,7 @@ void SwAccessiblePortionData::Special( sal_uInt16 nLength, const String& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/) { OSL_ENSURE( nModelPosition >= 0, "illegal position" ); - OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().Len(), + OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().getLength(), "portion exceeds model string!" ); OSL_ENSURE( !bFinished, "We are already done!" ); @@ -166,7 +164,7 @@ void SwAccessiblePortionData::Special( { OUStringBuffer aTmpBuffer( rText.Len() + 1 ); aTmpBuffer.append( rText ); - aTmpBuffer.append( pTxtNode->GetTxt().GetChar(nModelPosition) ); + aTmpBuffer.append( pTxtNode->GetTxt()[nModelPosition] ); sDisplay = aTmpBuffer.makeStringAndClear(); break; } @@ -216,7 +214,8 @@ void SwAccessiblePortionData::Skip(sal_uInt16 nLength) { OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( aModelPositions.empty(), "Never Skip() after portions" ); - OSL_ENSURE( nLength <= pTxtNode->GetTxt().Len(), "skip exceeds model string!" ); + OSL_ENSURE( nLength <= pTxtNode->GetTxt().getLength(), + "skip exceeds model string!" ); nModelPosition += nLength; } @@ -532,7 +531,7 @@ void SwAccessiblePortionData::GetAttributeBoundary( sal_Int32 SwAccessiblePortionData::GetAccessiblePosition( sal_uInt16 nPos ) const { - OSL_ENSURE( nPos <= pTxtNode->GetTxt().Len(), "illegal position" ); + OSL_ENSURE( nPos <= pTxtNode->GetTxt().getLength(), "illegal position" ); // find the portion number // #i70538# - consider "empty" model portions - e.g. number portion @@ -602,8 +601,7 @@ sal_uInt16 SwAccessiblePortionData::FillSpecialPos( // if we have anything except plain text, compute nExtend + nRefPos if( (nModelEndPos - nModelPos == 1) && - (pTxtNode->GetTxt().GetChar(static_cast<sal_uInt16>(nModelPos)) != - sAccessibleString.getStr()[nPos]) ) + (pTxtNode->GetTxt()[nModelPos] != sAccessibleString.getStr()[nPos])) { // case 1: a one-character, non-text portion // reference position is the first accessibilty for our 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 ); diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 8aec980bcfc1..2298540c2462 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -567,7 +567,7 @@ static String lcl_dbg_out(const SwNode & rNode) const SfxItemSet * pAttrSet = pTxtNode->GetpSwAttrSet(); aTmpStr += String("<txt>", RTL_TEXTENCODING_ASCII_US); - aTmpStr += pTxtNode->GetTxt().Copy(0, 10); + aTmpStr += pTxtNode->GetTxt().copy(0, 10); aTmpStr += String("</txt>", RTL_TEXTENCODING_ASCII_US); if (rNode.IsTableNode()) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 7c6379a2bbd9..66bd4e98202a 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1698,7 +1698,7 @@ bool SwDoc::IncrementalDocStatCalculate( long nTextNodes ) case ND_TEXTNODE: { SwTxtNode *pTxt = static_cast< SwTxtNode * >( pNd ); - if( pTxt->CountWords( *mpDocStat, 0, pTxt->GetTxt().Len() ) ) + if (pTxt->CountWords(*mpDocStat, 0, pTxt->GetTxt().getLength())) nTextNodes--; break; } @@ -2124,7 +2124,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() ) { SwTxtNode* pTxtNode = (SwTxtNode*)GetNodes()[ nIndex+nEndOfs ]; - if( pTxtNode->GetTxt().Len() && nWish ) + if (pTxtNode->GetTxt().getLength() && nWish) --nWish; bKeep = pTxtNode->GetSwAttrSet().GetKeep().GetValue(); ++nEndOfs; @@ -2189,7 +2189,7 @@ bool SwDoc::RemoveInvisibleContent() &pTxtNd->GetNodes() == &GetNodes() ) { bRet = true; - SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); + SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength()); // Remove hidden paragraph or delete contents: // Delete contents if @@ -2220,7 +2220,7 @@ bool SwDoc::RemoveInvisibleContent() if ( pTxtNd ) { bool bRemoved = false; - SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); + SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength()); if ( pTxtNd->HasHiddenCharAttribute( true ) ) { bRemoved = sal_True; @@ -2361,7 +2361,7 @@ bool SwDoc::HasInvisibleContent() const SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode(); if ( pTxtNd ) { - SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); + SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength()); if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) ) { bRet = true; @@ -2636,7 +2636,7 @@ String SwDoc::GetPaMDescr(const SwPaM & rPam) const aResult += String(SW_RES(STR_START_QUOTE)); aResult += ShortenString(pTxtNode->GetTxt(). - Copy(nStart, nEnd - nStart), + copy(nStart, nEnd - nStart), nUndoStringLength, String(SW_RES(STR_LDOTS))); aResult += String(SW_RES(STR_END_QUOTE)); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 8d19f5445bd7..8dc5406b2d4d 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -244,8 +244,8 @@ public: } virtual bool Compare( int nIdx1, int nIdx2 ) const; - virtual int GetLen1() const { return pTxtNd1->GetTxt().Len(); } - virtual int GetLen2() const { return pTxtNd2->GetTxt().Len(); } + virtual int GetLen1() const { return pTxtNd1->GetTxt().getLength(); } + virtual int GetLen2() const { return pTxtNd2->GetTxt().getLength(); } }; // Options set in Tools->Options->Writer->Comparison @@ -1281,8 +1281,8 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, int nLcsLen = 0; - int nDstLen = rDstNd.GetTxt().Len(); - int nSrcLen = rSrcNd.GetTxt().Len(); + int nDstLen = rDstNd.GetTxt().getLength(); + int nSrcLen = rSrcNd.GetTxt().getLength(); int nMinLen = std::min( nDstLen , nSrcLen ); int nAvgLen = ( nDstLen + nSrcLen )/2; @@ -2146,13 +2146,13 @@ bool LineArrayComparator::Compare( int nIdx1, int nIdx2 ) const } for( i = 0; i < nBorderLen; i++ ) { - nHash = nHash*nMul + pTxtNd1->GetTxt().GetChar( i ); + nHash = nHash*nMul + pTxtNd1->GetTxt()[i]; } aHashes.insert( nHash ); for( ; i < nPar1Len; i++ ) { - nHash = nHash - nPow*pTxtNd1->GetTxt().GetChar( i - nBorderLen ); - nHash = nHash*nMul + pTxtNd1->GetTxt().GetChar( i ); + nHash = nHash - nPow*pTxtNd1->GetTxt()[ i - nBorderLen ]; + nHash = nHash*nMul + pTxtNd1->GetTxt()[ i ]; aHashes.insert( nHash ); } @@ -2160,7 +2160,7 @@ bool LineArrayComparator::Compare( int nIdx1, int nIdx2 ) const nHash = 0; for( i = 0; i < nBorderLen; i++ ) { - nHash = nHash*nMul + pTxtNd2->GetTxt().GetChar( i ); + nHash = nHash*nMul + pTxtNd2->GetTxt()[ i ]; } if( aHashes.find( nHash ) != aHashes.end() ) @@ -2170,8 +2170,8 @@ bool LineArrayComparator::Compare( int nIdx1, int nIdx2 ) const for( ; i < nPar2Len; i++ ) { - nHash = nHash - nPow*pTxtNd2->GetTxt().GetChar( i - nBorderLen ); - nHash = nHash*nMul + pTxtNd2->GetTxt().GetChar( i ); + nHash = nHash - nPow*pTxtNd2->GetTxt()[ i - nBorderLen ]; + nHash = nHash*nMul + pTxtNd2->GetTxt()[ i ]; if( aHashes.find( nHash ) != aHashes.end() ) { return true; @@ -2190,16 +2190,15 @@ bool CharArrayComparator::Compare( int nIdx1, int nIdx2 ) const return ( !CmpOptions.bUseRsid || pTxtNd1->CompareRsid( *pTxtNd2, nIdx1 + 1, nIdx2 + 1 ) ) - && pTxtNd1->GetTxt().GetChar( nIdx1 ) - == pTxtNd2->GetTxt().GetChar( nIdx2 ); + && pTxtNd1->GetTxt()[ nIdx1 ] == pTxtNd2->GetTxt()[ nIdx2 ]; } WordArrayComparator::WordArrayComparator( const SwTxtNode *pNode1, const SwTxtNode *pNode2 ) : pTxtNd1( pNode1 ), pTxtNd2( pNode2 ) { - pPos1 = new int[ pTxtNd1->GetTxt().Len() + 1 ]; - pPos2 = new int[ pTxtNd2->GetTxt().Len() + 1 ]; + pPos1 = new int[ pTxtNd1->GetTxt().getLength() + 1 ]; + pPos2 = new int[ pTxtNd2->GetTxt().getLength() + 1 ]; CalcPositions( pPos1, pTxtNd1, nCnt1 ); CalcPositions( pPos2, pTxtNd2, nCnt2 ); @@ -2220,8 +2219,8 @@ bool WordArrayComparator::Compare( int nIdx1, int nIdx2 ) const } for( int i = 0; i < nLen; i++) { - if( pTxtNd1->GetTxt().GetChar( pPos1[ nIdx1 ] + i ) - != pTxtNd2->GetTxt().GetChar( pPos2[ nIdx2 ] + i ) + if( pTxtNd1->GetTxt()[ pPos1[ nIdx1 ] + i ] + != pTxtNd2->GetTxt()[ pPos2[ nIdx2 ] + i ] || ( CmpOptions.bUseRsid && !pTxtNd1->CompareRsid( *pTxtNd2, pPos1[ nIdx1 ] + i, pPos2[ nIdx2 ] + i ) ) ) { @@ -2248,8 +2247,8 @@ int WordArrayComparator::GetCharSequence( const int *pWordLcs1, pSubseq1[ nLen ] = pPos1[ pWordLcs1[i] ] + j; pSubseq2[ nLen ] = pPos2[ pWordLcs2[i] ] + j; - if( pTxtNd1->GetTxt().GetChar( pPos1[ pWordLcs1[i] ] + j ) - != pTxtNd2->GetTxt().GetChar( pPos2[ pWordLcs2[i] ] + j ) ) + if( pTxtNd1->GetTxt()[ pPos1[ pWordLcs1[i] ] + j ] + != pTxtNd2->GetTxt()[ pPos2[ pWordLcs2[i] ] + j ] ) { nLen -= j; break; @@ -2265,11 +2264,11 @@ void WordArrayComparator::CalcPositions( int *pPos, const SwTxtNode *pTxtNd, int &nCnt ) { nCnt = -1; - for( int i = 0; i <= pTxtNd->GetTxt().Len(); i++ ) + for (int i = 0; i <= pTxtNd->GetTxt().getLength(); ++i) { - if( i == 0 || i == pTxtNd->GetTxt().Len() - || !isalnum( pTxtNd->GetTxt().GetChar( i - 1 ) ) - || !isalnum( pTxtNd->GetTxt().GetChar( i ) ) ) + if (i == 0 || i == pTxtNd->GetTxt().getLength() + || !isalnum( pTxtNd->GetTxt()[ i - 1 ]) + || !isalnum( pTxtNd->GetTxt()[ i ])) { // Begin new word nCnt++; pPos[ nCnt ] = i; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 1da5be979d95..04274fce654f 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -130,7 +130,7 @@ typedef boost::ptr_vector< _SaveRedline > _SaveRedlines; static bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos ) { - sal_Unicode cChr = pNode->GetTxt().GetChar( nPos ); + sal_Unicode const cChr = pNode->GetTxt()[nPos]; switch (cChr) { case CH_TXTATR_BREAKWORD: @@ -152,7 +152,8 @@ static void lcl_SkipAttr( const SwTxtNode *pNode, SwIndex &rIdx, xub_StrLen &rSt // skip all special attributes do { ++rIdx; - } while( (rStart = rIdx.GetIndex()) < pNode->GetTxt().Len() + rStart = rIdx.GetIndex(); + } while (rStart < pNode->GetTxt().getLength() && !lcl_MayOverwrite(pNode, rStart) ); } } @@ -717,9 +718,9 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) SwTxtNode *pNode = rPt.nNode.GetNode().GetTxtNode(); if (!pNode || ( static_cast<size_t>(rStr.Len()) // worst case: no erase - + static_cast<size_t>(pNode->GetTxt().Len()) > TXTNODE_MAX)) + + static_cast<size_t>(pNode->GetTxt().getLength()) > TXTNODE_MAX)) { - return sal_False; + return false; } if (GetIDocumentUndoRedo().DoesUndo()) @@ -740,7 +741,7 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) { // start behind the characters (to fix the attributes!) nStart = rIdx.GetIndex(); - if ( nStart < pNode->GetTxt().Len() ) + if (nStart < pNode->GetTxt().getLength()) { lcl_SkipAttr( pNode, rIdx, nStart ); } @@ -768,7 +769,7 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) else { // start behind the characters (to fix the attributes!) - if( nStart < pNode->GetTxt().Len() ) + if (nStart < pNode->GetTxt().getLength()) ++rIdx; pNode->InsertText( rtl::OUString(c), rIdx, INS_EMPTYEXPAND ); if( nStart+1 < rIdx.GetIndex() ) @@ -824,8 +825,8 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) if( pTxtNd && pTxtNd->CanJoinNext( &aNxtIdx ) ) { { // Block so SwIndex into node is deleted before Join - CorrRel( aNxtIdx, SwPosition( aIdx, SwIndex( pTxtNd, - pTxtNd->GetTxt().Len() ) ), 0, sal_True ); + CorrRel( aNxtIdx, SwPosition( aIdx, SwIndex(pTxtNd, + pTxtNd->GetTxt().getLength()) ), 0, sal_True ); } pTxtNd->JoinNext(); } @@ -1236,7 +1237,7 @@ static bool lcl_StrLenOverFlow( const SwPaM& rPam ) if( (0 != pEndNd) && pStt->nNode.GetNode().IsTxtNode() ) { sal_uInt64 nSum = pStt->nContent.GetIndex() + - pEndNd->GetTxt().Len() - pEnd->nContent.GetIndex(); + pEndNd->GetTxt().getLength() - pEnd->nContent.GetIndex(); if( nSum > STRING_LEN ) bRet = true; } @@ -1260,13 +1261,13 @@ void sw_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev ) { bool bExchange = pStt == rPam.GetPoint(); if( !pStt->nContent.GetIndex() && - pEndNd->GetTxt().Len() != pEnd->nContent.GetIndex() ) + pEndNd->GetTxt().getLength() != pEnd->nContent.GetIndex()) bExchange = !bExchange; if( bExchange ) rPam.Exchange(); rJoinPrev = rPam.GetPoint() == pStt; OSL_ENSURE( !pStt->nContent.GetIndex() && - pEndNd->GetTxt().Len() != pEnd->nContent.GetIndex() + pEndNd->GetTxt().getLength() != pEnd->nContent.GetIndex() ? rPam.GetPoint()->nNode < rPam.GetMark()->nNode : rPam.GetPoint()->nNode > rPam.GetMark()->nNode, "sw_GetJoinFlags"); @@ -1416,7 +1417,7 @@ lcl_CalcBreaks( ::std::vector<xub_StrLen> & rBreaks, SwPaM const & rPam ) for (xub_StrLen i = nStart; i < nEnd; ++i) { - const sal_Unicode c(pTxtNode->GetTxt().GetChar(i)); + const sal_Unicode c(pTxtNode->GetTxt()[i]); if ((CH_TXTATR_INWORD == c) || (CH_TXTATR_BREAKWORD == c)) { SwTxtAttr const * const pAttr( pTxtNode->GetTxtAttrForCharAt(i) ); @@ -1618,7 +1619,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode(); xub_StrLen nIndex = rPam.Start()->nContent.GetIndex(); // We may have a postit here. - if (pTxtNd->GetTxt().GetChar(nIndex) == CH_TXTATR_INWORD) + if (pTxtNd->GetTxt()[nIndex] == CH_TXTATR_INWORD) { SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nIndex, RES_TXTATR_FIELD); if (pTxtAttr && pTxtAttr->GetFld().GetFld()->Which() == RES_POSTITFLD) @@ -1897,10 +1898,14 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, nBeginGrammarCheck = aCrsr.GetPoint()->nContent.GetIndex(); } } - nEndGrammarCheck = pSpellArgs->pEndNode == pNd ? pSpellArgs->pEndIdx->GetIndex() : ((SwTxtNode*)pNd)->GetTxt().Len(); + nEndGrammarCheck = (pSpellArgs->pEndNode == pNd) + ? pSpellArgs->pEndIdx->GetIndex() + : static_cast<SwTxtNode const*>(pNd) + ->GetTxt().getLength(); } - xub_StrLen nSpellErrorPosition = ((SwTxtNode*)pNd)->GetTxt().Len(); + xub_StrLen nSpellErrorPosition = + static_cast<SwTxtNode const*>(pNd)->GetTxt().getLength(); if( (!pConvArgs && ((SwTxtNode*)pNd)->Spell( pSpellArgs )) || ( pConvArgs && @@ -2265,7 +2270,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, SwTxtNode* pTxtNd = pStt->nNode.GetNode().GetTxtNode(); xub_StrLen nStt = pStt->nContent.GetIndex(), nEnd = bOneNode ? pEnd->nContent.GetIndex() - : pTxtNd->GetTxt().Len(); + : pTxtNd->GetTxt().getLength(); SwDataChanged aTmp( aDelPam ); @@ -2411,13 +2416,13 @@ SetRedlineMode( eOld ); // Set the values again, if Frames or footnotes on the Text have been removed. nStt = nPtCnt; nEnd = bOneNode ? pEnd->nContent.GetIndex() - : pTxtNd->GetTxt().Len(); + : pTxtNd->GetTxt().getLength(); bool bFirst = true; String sIns; while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) ) { - if( !bFirst || nStt == pTxtNd->GetTxt().Len() ) + if (!bFirst || nStt == pTxtNd->GetTxt().getLength()) { InsertString( aDelPam, sIns ); } @@ -2431,7 +2436,7 @@ SetRedlineMode( eOld ); if( bFirst || sIns.Len() ) { - if( !bFirst || nStt == pTxtNd->GetTxt().Len() ) + if (!bFirst || nStt == pTxtNd->GetTxt().getLength()) { InsertString( aDelPam, sIns ); } @@ -2657,13 +2662,18 @@ void SwDoc::TransliterateText( { ++aIdx; if( pTNd ) - pTNd->TransliterateText( rTrans, nSttCnt, pTNd->GetTxt().Len(), pUndo ); + pTNd->TransliterateText( + rTrans, nSttCnt, pTNd->GetTxt().getLength(), pUndo); } for( ; aIdx.GetIndex() < nEndNd; ++aIdx ) { - if( 0 != ( pTNd = aIdx.GetNode().GetTxtNode() )) - pTNd->TransliterateText( rTrans, 0, pTNd->GetTxt().Len(), pUndo ); + pTNd = aIdx.GetNode().GetTxtNode(); + if (pTNd) + { + pTNd->TransliterateText( + rTrans, 0, pTNd->GetTxt().getLength(), pUndo); + } } if( nEndCnt && 0 != ( pTNd = pEnd->nNode.GetNode().GetTxtNode() )) @@ -2733,12 +2743,12 @@ void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const { ++aIdx; if( pTNd ) - pTNd->CountWords( rStat, nSttCnt, pTNd->GetTxt().Len() ); + pTNd->CountWords( rStat, nSttCnt, pTNd->GetTxt().getLength() ); } for( ; aIdx.GetIndex() < nEndNd; ++aIdx ) if( 0 != ( pTNd = aIdx.GetNode().GetTxtNode() )) - pTNd->CountWords( rStat, 0, pTNd->GetTxt().Len() ); + pTNd->CountWords( rStat, 0, pTNd->GetTxt().getLength() ); if( nEndCnt && 0 != ( pTNd = pEnd->nNode.GetNode().GetTxtNode() )) pTNd->CountWords( rStat, 0, nEndCnt ); @@ -2752,13 +2762,17 @@ void SwDoc::RemoveLeadingWhiteSpace(const SwPosition & rPos ) const SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode(); if ( pTNd ) { - const String& rTxt = pTNd->GetTxt(); + const OUString& rTxt = pTNd->GetTxt(); xub_StrLen nIdx = 0; - sal_Unicode cCh; - while( nIdx < rTxt.Len() && - ( '\t' == ( cCh = rTxt.GetChar( nIdx ) ) || - ( ' ' == cCh ) ) ) + while (nIdx < rTxt.getLength()) + { + sal_Unicode const cCh = rTxt[nIdx]; + if (('\t' != cCh) && (' ' != cCh)) + { + break; + } ++nIdx; + } if ( nIdx > 0 ) { diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 15097adb53c7..729dff7672af 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -874,8 +874,10 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) const sal_uLong nFlySttNd = pCntIdx->GetIndex(); if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) || - pTxtNd->GetTxt().Len() ) + pTxtNd->GetTxt().getLength() ) + { return SW_CHAIN_NOT_EMPTY; + } sal_uInt16 nArrLen = GetSpzFrmFmts()->size(); for( sal_uInt16 n = 0; n < nArrLen; ++n ) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 21f1bc752963..6355ec2b8843 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -785,7 +785,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNode); const SwIndex& rSt = pStt->nContent; sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); - const String& rStr = pTxtNd->GetTxt(); + const OUString& rStr = pTxtNd->GetTxt(); // Special case: if the Crsr is located within a URL attribute, we take over it's area SwTxtAttr const*const pURLAttr( @@ -819,7 +819,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, // These attributes are inserted as FormatAttributes and // never override the TextAttributes! if( !(nFlags & nsSetAttrMode::SETATTR_DONTREPLACE ) && - pTxtNd->HasHints() && !nMkPos && nPtPos == rStr.Len() ) + pTxtNd->HasHints() && !nMkPos && nPtPos == rStr.getLength()) { SwIndex aSt( pTxtNd ); if( pHistory ) @@ -985,7 +985,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pSwpHints ) pSwpHints->Register( &aRegH ); - pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags ); + pTNd->SetAttr(*pCharSet, 0, pTNd->GetTxt().getLength(), nFlags); if( pSwpHints ) pSwpHints->DeRegister(); } @@ -995,7 +995,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, else { if( pTNd && pCharSet && pCharSet->Count() ) - pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags ); + pTNd->SetAttr(*pCharSet, 0, pTNd->GetTxt().getLength(), nFlags); if( pOtherSet && pOtherSet->Count() ) pNode->SetAttr( *pOtherSet ); } @@ -2376,7 +2376,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, if( pSet && pTNd && pSet->Count() ) { aPam.SetMark(); - aPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() ); + aPam.GetMark()->nContent.Assign(pTNd, pTNd->GetTxt().getLength()); InsertItemSet( aPam, *pSet, 0 ); } } diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 9bd14f07aa9f..e69c47d61850 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -389,7 +389,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c // set the link in the StartNode SwFmtINetFmt aINet( sFileName , aEmptyStr ); SwTxtNode* pTNd = (SwTxtNode*)pStartNd; - pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() ); + pTNd->InsertItem(aINet, 0, pTNd->GetTxt().getLength()); // If the link cannot be found anymore, // it has to be a bug! diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 933b68510c95..17ef88c6291b 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -2892,7 +2892,7 @@ void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const SwTxtNode* pTNd = rMark.nNode.GetNode().GetTxtNode(); if( pTNd ) { - rMark.nContent.Assign( pTNd, pTNd->GetTxt().Len() ); + rMark.nContent.Assign(pTNd, pTNd->GetTxt().getLength()); if( pTNd->HasSwAttrSet() ) { @@ -3263,7 +3263,9 @@ void SwRedline::InvalidateRange() // trigger the Layout if( pNd->IsTxtNode() ) { aHt.nStart = n == nSttNd ? nSttCnt : 0; - aHt.nEnd = n == nEndNd ? nEndCnt : ((SwTxtNode*)pNd)->GetTxt().Len(); + aHt.nEnd = (n == nEndNd) + ? nEndCnt + : static_cast<SwTxtNode*>(pNd)->GetTxt().getLength(); ((SwTxtNode*)pNd)->ModifyNotification( &aHt, &aHt ); } } diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 25f83ff81ff0..25b11eec612f 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -188,8 +188,8 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_ // Point must be the startposition, Mark is optional the end position SwPosition* pPos = rPam.GetPoint(); const SwTxtNode* pTNd = pPos->nNode.GetNode().GetTxtNode(); - const String* pTxt = &pTNd->GetTxt(); - xub_StrLen nStart = pPos->nContent.GetIndex(), nEnd = pTxt->Len(); + OUString const& rTxt = pTNd->GetTxt(); + xub_StrLen nStart = pPos->nContent.GetIndex(), nEnd = rTxt.getLength(); sal_Bool bHasMark = rPam.HasMark(); if( bHasMark ) @@ -234,7 +234,7 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_ { // skip to the word begin! long nWordStt = pBreakIt->GetBreakIter()->getWordBoundary( - *pTxt, nStart, + rTxt, nStart, pBreakIt->GetLocale( pTNd->GetLang( nStart )), WordType::ANYWORD_IGNOREWHITESPACES, sal_True ).startPos; @@ -264,7 +264,7 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_ break; } - sal_Int32 nChType = rCC.getType( *pTxt, nStart ); + sal_Int32 nChType = rCC.getType(rTxt, nStart); bool bIgnoreChar = false, bIsAlphaNum = false, bChkNxtWrd = false; switch( nChType ) { @@ -305,7 +305,7 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_ { // search the end of this word nWordEnd = pBreakIt->GetBreakIter()->getWordBoundary( - *pTxt, nStart, + rTxt, nStart, pBreakIt->GetLocale( pTNd->GetLang( nStart )), WordType::ANYWORD_IGNOREWHITESPACES, sal_True ).endPos; @@ -318,7 +318,7 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_ } nStart = rPam.GetMark()->nContent.GetIndex(); - rEntry.SetText( pTxt->Copy( nStart, + rEntry.SetText( rTxt.copy( nStart, rPam.GetPoint()->nContent.GetIndex() - nStart )); return rPam.HasMark(); } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index cbe89a415851..66153620cfd0 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1149,7 +1149,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, // // If selected use marks from the same chapter only if( pTOXSrc->GetNodes().IsDocNodes() && - pTOXSrc->GetTxt().Len() && pTOXSrc->GetDepends() && + pTOXSrc->GetTxt().getLength() && pTOXSrc->GetDepends() && pTOXSrc->getLayoutFrm( pDoc->GetCurrentLayout() ) && (!IsFromChapter() || ::lcl_FindChapterNode( *pTOXSrc, 0 ) == pOwnChapterNode ) && !pTOXSrc->HasHiddenParaField() && @@ -1249,7 +1249,8 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) { ::SetProgressState( 0, pDoc->GetDocShell() ); - if( pTxtNd->GetTxt().Len() && pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && + if (pTxtNd->GetTxt().getLength() && + pTxtNd->getLayoutFrm(pDoc->GetCurrentLayout()) && pTxtNd->GetNodes().IsDocNodes() && ( !IsFromChapter() || pOwnChapterNode == ::lcl_FindChapterNode( *pTxtNd, 0 ) ) ) @@ -1281,7 +1282,8 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode ) const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); ::SetProgressState( 0, pDoc->GetDocShell() ); - if( rTxtNode.GetTxt().Len() && rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() ) && + if (rTxtNode.GetTxt().getLength() && + rTxtNode.getLayoutFrm(pDoc->GetCurrentLayout()) && rTxtNode.GetNodes().IsDocNodes() && ( !IsFromChapter() || ::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) ) @@ -1319,7 +1321,8 @@ void SwTOXBaseSection::UpdateAuthorities( const SwTOXInternational& rIntl ) const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); ::SetProgressState( 0, pDoc->GetDocShell() ); - if( rTxtNode.GetTxt().Len() && rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() ) && + if (rTxtNode.GetTxt().getLength() && + rTxtNode.getLayoutFrm(pDoc->GetCurrentLayout()) && rTxtNode.GetNodes().IsDocNodes() ) { //#106485# the body node has to be used! @@ -1976,16 +1979,16 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, rtl::OUString sSrchStr = rtl::OUStringBuffer().append(cNumRepl). append(sPageDeli).append(cNumRepl).makeStringAndClear(); - xub_StrLen nStartPos = pNd->GetTxt().Search( sSrchStr ); + sal_Int32 nStartPos = pNd->GetTxt().indexOf(sSrchStr); sSrchStr = rtl::OUStringBuffer().append(cNumRepl). append(cEndPageNum).makeStringAndClear(); - xub_StrLen nEndPos = pNd->GetTxt().Search( sSrchStr ); + sal_Int32 nEndPos = pNd->GetTxt().indexOf(sSrchStr); sal_uInt16 i; - if( STRING_NOTFOUND == nEndPos || rNums.empty() ) + if (-1 == nEndPos || rNums.empty()) return; - if( STRING_NOTFOUND == nStartPos || nStartPos > nEndPos) + if (-1 == nStartPos || nStartPos > nEndPos) nStartPos = nEndPos; sal_uInt16 nOld = rNums[0], @@ -2119,7 +2122,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, pCharFmt = pDoc->MakeCharFmt(GetMainEntryCharStyle(), 0); // find the page numbers in aNumStr and set the character style - xub_StrLen nOffset = pNd->GetTxt().Len() - aNumStr.Len(); + xub_StrLen nOffset = pNd->GetTxt().getLength() - aNumStr.Len(); SwFmtCharFmt aCharFmt(pCharFmt); for(sal_uInt16 j = 0; j < pCharStyleIdx->size(); j += 2) { diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 9d3c63adecb9..626f8d64413a 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -85,7 +85,7 @@ SwExtTextInput::~SwExtTextInput() } } rIdx = nSttCnt; - String sTxt( pTNd->GetTxt().Copy( nSttCnt, nEndCnt - nSttCnt )); + String sTxt( pTNd->GetTxt().copy(nSttCnt, nEndCnt - nSttCnt)); if( bIsOverwriteCursor && sOverwriteText.Len() ) { xub_StrLen nLen = sTxt.Len(); @@ -211,7 +211,7 @@ void SwExtTextInput::SetOverwriteCursor( sal_Bool bFlag ) { xub_StrLen nSttCnt = GetPoint()->nContent.GetIndex(), nEndCnt = GetMark()->nContent.GetIndex(); - sOverwriteText = pTNd->GetTxt().Copy( nEndCnt < nSttCnt ? nEndCnt + sOverwriteText = pTNd->GetTxt().copy( nEndCnt < nSttCnt ? nEndCnt : nSttCnt ); if( sOverwriteText.Len() ) { diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index af32fe5716de..2eeea7a1da32 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -277,7 +277,7 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const // Is that enough? What about PostIts/Fields/FieldTypes? // #i96213# - force copy of all attributes pCpyTxtNd->CopyText( pTxtNd, SwIndex( pCpyTxtNd ), - pCpyTxtNd->GetTxt().Len(), true ); + pCpyTxtNd->GetTxt().getLength(), true ); if( RES_CONDTXTFMTCOLL == pColl->Which() ) pTxtNd->ChkCondColl(); @@ -903,7 +903,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, SwTxtNode* pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode(); SwTxtNode* pDestTxtNd = aInsPos.GetNode().GetTxtNode(); bool bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() && - ( ( pDestTxtNd && !pDestTxtNd->GetTxt().Len() ) || + ( (pDestTxtNd && !pDestTxtNd->GetTxt().getLength()) || ( !bOneNode && !rPos.nContent.GetIndex() ) ); bool bCopyBookmarks = true; sal_Bool bStartIsTxtNode = 0 != pSttTxtNd; @@ -932,7 +932,8 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // - destination is an empty paragraph which is not in a list and // - source contains at least one paragraph which is not in a list if ( pNumRuleToPropagate && - pDestTxtNd && !pDestTxtNd->GetTxt().Len() && !pDestTxtNd->IsInList() && + pDestTxtNd && !pDestTxtNd->GetTxt().getLength() && + !pDestTxtNd->IsInList() && !lcl_ContainsOnlyParagraphsInList( rPam ) ) { pNumRuleToPropagate = 0; @@ -976,7 +977,8 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, } pDestTxtNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode(); - aDestIdx.Assign( pDestTxtNd, pDestTxtNd->GetTxt().Len() ); + aDestIdx.Assign( + pDestTxtNd, pDestTxtNd->GetTxt().getLength()); // Correct the area again if( bEndEqualIns ) @@ -1029,7 +1031,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, { const xub_StrLen nCpyLen = ( (bOneNode) ? pEnd->nContent.GetIndex() - : pSttTxtNd->GetTxt().Len() ) + : pSttTxtNd->GetTxt().getLength()) - pStt->nContent.GetIndex(); pSttTxtNd->CopyText( pDestTxtNd, aDestIdx, pStt->nContent, nCpyLen ); @@ -1170,7 +1172,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, } } - const bool bEmptyDestNd = 0 == pDestTxtNd->GetTxt().Len(); + const bool bEmptyDestNd = pDestTxtNd->GetTxt().isEmpty(); pEndTxtNd->CopyText( pDestTxtNd, aDestIdx, SwIndex( pEndTxtNd ), pEnd->nContent.GetIndex() ); @@ -1423,7 +1425,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, SwTxtNode* pTxtNode; if( 0 != ( pTxtNode = pAPos->nNode.GetNode().GetTxtNode() )) { - bEmptyNode = !pTxtNode->GetTxt().Len(); + bEmptyNode = pTxtNode->GetTxt().isEmpty(); if( bEmptyNode ) { //last node information is only necessary to know for the last TextNode diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index cd1f735cdcd2..12f8349d0d2d 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -233,8 +233,8 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, { SwTxtNode *const pTNd = pEndPos->nNode.GetNode().GetTxtNode(); - if (pTNd && - (pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex())) + if (pTNd && (pTNd->GetTxt().getLength() + != pEndPos->nContent.GetIndex())) { pUndoInsSect->SaveSplitNode( pTNd, sal_False ); } @@ -278,7 +278,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, pEndPos->nNode--; pTNd = pEndPos->nNode.GetNode().GetTxtNode(); } - if( pTNd ) nCntnt = pTNd->GetTxt().Len(); else nCntnt = 0; + nCntnt = (pTNd) ? pTNd->GetTxt().getLength() : 0; pEndPos->nContent.Assign( pTNd, nCntnt ); } } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index ec4a14662751..5f6dad997662 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1025,10 +1025,10 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->GetCurrentLayout() ) ); if( aFInfo.IsOneLine() ) // only makes sense in this case { - const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer(); - for( xub_StrLen nChPos = 0; *pTxt; ++nChPos, ++pTxt ) + OUString const& rTxt(pTxtNd->GetTxt()); + for (sal_Int32 nChPos = 0; nChPos < rTxt.getLength(); ++nChPos) { - if( *pTxt == cCh ) + if (rTxt[nChPos] == cCh) { aPosArr.push_back( static_cast<sal_uInt16>( aFInfo.GetCharPos( nChPos+1, sal_False )) ); @@ -1055,13 +1055,14 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd )); std::vector<sal_uLong> aBkmkArr; - _SaveCntntIdx( pDoc, aSttIdx.GetIndex(), pTxtNd->GetTxt().Len(), aBkmkArr ); - - const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer(); + _SaveCntntIdx( pDoc, aSttIdx.GetIndex(), pTxtNd->GetTxt().getLength(), + aBkmkArr ); if( T2T_PARA != cCh ) - for( xub_StrLen nChPos = 0; *pTxt; ++nChPos, ++pTxt ) - if( *pTxt == cCh ) + { + for (xub_StrLen nChPos = 0; nChPos < pTxtNd->GetTxt().getLength();) + { + if (pTxtNd->GetTxt()[nChPos] == cCh) { aCntPos.nContent = nChPos; SwCntntNode* pNewNd = pTxtNd->SplitCntntNode( aCntPos ); @@ -1072,9 +1073,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // Delete separator and correct search string pTxtNd->EraseText( aCntPos.nContent, 1 ); - pTxt = pTxtNd->GetTxt().GetBuffer(); nChPos = 0; - --nChPos, --pTxt; // for the ++ in the for loop !!! // Set the TableNode as StartNode for all TextNodes in the Table const SwNodeIndex aTmpIdx( aCntPos.nNode, -1 ); @@ -1087,11 +1086,17 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin() + nBoxes++, pBox ); } + else + { + ++nChPos; + } + } + } // Now for the last substring if( !aBkmkArr.empty() ) - _RestoreCntntIdx( aBkmkArr, *pTxtNd, pTxtNd->GetTxt().Len(), - pTxtNd->GetTxt().Len()+1 ); + _RestoreCntntIdx( aBkmkArr, *pTxtNd, pTxtNd->GetTxt().getLength(), + pTxtNd->GetTxt().getLength()+1 ); pSttNd = new SwStartNode( aCntPos.nNode, ND_STARTNODE, SwTableBoxStartNode ); const SwNodeIndex aTmpIdx( aCntPos.nNode, 1 ); @@ -1516,7 +1521,8 @@ static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ) if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() ) { // Inserting the separator - SwIndex aCntIdx( pDelPara->pLastNd, pDelPara->pLastNd->GetTxt().Len()); + SwIndex aCntIdx( pDelPara->pLastNd, + pDelPara->pLastNd->GetTxt().getLength()); pDelPara->pLastNd->InsertText( rtl::OUString(pDelPara->cCh), aCntIdx, IDocumentContentOperations::INS_EMPTYEXPAND ); if( pDelPara->pUndo ) @@ -1525,7 +1531,7 @@ static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ) std::vector<sal_uLong> aBkmkArr; xub_StrLen nOldTxtLen = aCntIdx.GetIndex(); - _SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().Len(), + _SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().getLength(), aBkmkArr ); pDelPara->pLastNd->JoinNext(); @@ -4166,7 +4172,8 @@ void SwDoc::ClearLineNumAttrs( SwPosition & rPos ) if( pNode->IsTxtNode() ) { SwTxtNode * pTxtNode = pNode->GetTxtNode(); - if ( pTxtNode && pTxtNode->IsNumbered() && pTxtNode->GetTxt().Len()==0 ) + if (pTxtNode && pTxtNode->IsNumbered() + && pTxtNode->GetTxt().isEmpty()) { const SfxPoolItem* pFmtItem = 0; SfxItemSet rSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()), diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 61a720f51691..56188e1a745e 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1156,7 +1156,7 @@ sal_Bool SwCntntNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const else bRet = sal_False; } - else if( nPos < rTNd.GetTxt().Len() ) + else if (nPos < rTNd.GetTxt().getLength()) ++(*pIdx); else bRet = sal_False; @@ -1634,8 +1634,8 @@ static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext) { return true; } - size_t const nSum( static_cast<const SwTxtNode&>(rPrev).GetTxt().Len() - + static_cast<const SwTxtNode&>(rNext).GetTxt().Len()); + size_t const nSum(static_cast<const SwTxtNode&>(rPrev).GetTxt().getLength() + + static_cast<const SwTxtNode&>(rNext).GetTxt().getLength()); return (nSum <= TXTNODE_MAX); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 8767e36b8070..7ce9e621d1c3 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -1604,7 +1604,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) SwTxtNode *const pSrcNd = aSttIdx.GetNode().GetTxtNode(); SwTxtNode * pDestNd = rPos.nNode.GetNode().GetTxtNode(); bool bSplitDestNd = true; - bool bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len(); + bool bCopyCollFmt = pDestNd && pDestNd->GetTxt().isEmpty(); if( pSrcNd ) { diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index a5fca1a2a4be..7acc7f58544d 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -166,7 +166,7 @@ sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, xub_StrLen const nLen = rTxt.Len(); for ( xub_StrLen n = 0; n < nLen; ++n ) { - sal_Unicode const Char = pNd->GetTxt().GetChar( n + nPos ); + sal_Unicode const Char = pNd->GetTxt()[n + nPos]; if ( ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char ) && pNd->GetTxtAttrForCharAt( n + nPos ) ) { @@ -181,7 +181,7 @@ sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, if( pDoc->IsAutoFmtRedline() ) { - if( nPos == pNd->GetTxt().Len() ) // at the End an Insert takes place + if (nPos == pNd->GetTxt().getLength()) // at the End do an Insert { pDoc->InsertString( *pPam, rTxt ); } @@ -190,8 +190,8 @@ sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, _PaMIntoCrsrShellRing aTmp( rEditSh, rCrsr, *pPam ); pPam->SetMark(); - pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(), - xub_StrLen( nPos + nSourceLength )); + pPam->GetPoint()->nContent = + std::min(pNd->GetTxt().getLength(), nPos + nSourceLength); pDoc->ReplaceRange( *pPam, rTxt, false ); pPam->Exchange(); pPam->DeleteMark(); @@ -202,8 +202,8 @@ sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, if( nSourceLength != rTxt.Len() ) { pPam->SetMark(); - pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(), - xub_StrLen( nPos + nSourceLength )); + pPam->GetPoint()->nContent = + std::min(pNd->GetTxt().getLength(), nPos + nSourceLength); pDoc->ReplaceRange( *pPam, rTxt, false ); pPam->Exchange(); pPam->DeleteMark(); @@ -288,13 +288,13 @@ const String* SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos ) (*pIdx)--; SwTxtNode* pTNd = pIdx->GetNode().GetTxtNode(); - while( pTNd && !pTNd->GetTxt().Len() ) + while (pTNd && !pTNd->GetTxt().getLength()) { (*pIdx)--; pTNd = pIdx->GetNode().GetTxtNode(); } if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )//#outline level,zhaojianwei - pStr = &pTNd->GetTxt(); + pStr = reinterpret_cast<String const*>(&pTNd->GetTxt()); // FIXME if( bUndoIdInitialized ) bUndoIdInitialized = true; @@ -323,8 +323,8 @@ sal_Bool SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPo eLang = GetAppLanguage(); //JP 22.04.99: Bug 63883 - Special treatment for dots. - bool bLastCharIsPoint = nEndPos < pTxtNd->GetTxt().Len() && - '.' == pTxtNd->GetTxt().GetChar( nEndPos ); + bool bLastCharIsPoint = nEndPos < pTxtNd->GetTxt().getLength() && + ('.' == pTxtNd->GetTxt()[nEndPos]); const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList( pTxtNd->GetTxt(), rSttPos, nEndPos, *this, eLang ); @@ -398,7 +398,7 @@ sal_Bool SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPo } if( bRet && ppPara && pTxtNd ) - *ppPara = &pTxtNd->GetTxt(); + *ppPara = reinterpret_cast<String const*>(&pTxtNd->GetTxt()); //FIXME return bRet; } @@ -476,7 +476,7 @@ void SwDontExpandItem::SaveDontExpandItems( const SwPosition& rPos ) aCharFmtSetRange ); xub_StrLen n = rPos.nContent.GetIndex(); if( !pTxtNd->GetAttr( *pDontExpItems, n, n, - n != pTxtNd->GetTxt().Len() )) + n != pTxtNd->GetTxt().getLength() )) delete pDontExpItems, pDontExpItems = 0; } } @@ -487,7 +487,7 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos ) if( pTxtNd ) { xub_StrLen nStart = rPos.nContent.GetIndex(); - if( nStart == pTxtNd->GetTxt().Len() ) + if( nStart == pTxtNd->GetTxt().getLength() ) pTxtNd->FmtToTxtAttr( pTxtNd ); if( pTxtNd->GetpSwpHints() && pTxtNd->GetpSwpHints()->Count() ) diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 859de64d2db3..5f58eb03d80e 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -162,8 +162,8 @@ class SwAutoFormat // TxtNode methods const SwTxtNode* GetNextNode() const; bool IsEmptyLine( const SwTxtNode& rNd ) const - { return 0 == rNd.GetTxt().Len() || - rNd.GetTxt().Len() == GetLeadingBlanks( rNd.GetTxt() ); } + { return rNd.GetTxt().isEmpty() || + rNd.GetTxt().getLength() == GetLeadingBlanks( rNd.GetTxt() ); } sal_Bool IsOneLine( const SwTxtNode& ) const; sal_Bool IsFastFullLine( const SwTxtNode& ) const; @@ -213,8 +213,8 @@ class SwAutoFormat !IsEmptyLine( *pTxtNd ) && !IsNoAlphaLine( *pTxtNd) && !IsEnumericChar( *pTxtNd ) && - ((STRING_MAXLEN - 50 - pTxtNd->GetTxt().Len()) > - pAktTxtNd->GetTxt().Len()) && + ((STRING_MAXLEN - 50 - pTxtNd->GetTxt().getLength()) > + pAktTxtNd->GetTxt().getLength()) && !HasBreakAttr( *pTxtNd ); } @@ -401,17 +401,17 @@ sal_Bool SwAutoFormat::IsFastFullLine( const SwTxtNode& rNd ) const sal_Bool SwAutoFormat::IsEnumericChar( const SwTxtNode& rNd ) const { - const String& rTxt = rNd.GetTxt(); + const OUString& rTxt = rNd.GetTxt(); String sTmp( rTxt ); xub_StrLen nBlnks = GetLeadingBlanks( sTmp ); - xub_StrLen nLen = rTxt.Len() - nBlnks; + xub_StrLen nLen = rTxt.getLength() - nBlnks; if( !nLen ) return sal_False; // -, +, * separated by blank ?? - if( 2 < nLen && IsSpace( rTxt.GetChar( nBlnks + 1 ) ) ) + if (2 < nLen && IsSpace(rTxt[nBlnks + 1])) { - if( StrChr( pBulletChar, rTxt.GetChar( nBlnks ) ) ) + if (StrChr(pBulletChar, rTxt[nBlnks])) return sal_True; // Should there be a symbol font at the position? SwTxtFrmInfo aFInfo( GetFrm( rNd ) ); @@ -455,7 +455,7 @@ sal_Bool SwAutoFormat::IsBlanksInString( const SwTxtNode& rNd ) const sal_uInt16 SwAutoFormat::CalcLevel( const SwTxtNode& rNd, sal_uInt16 *pDigitLvl ) const { sal_uInt16 nLvl = 0, nBlnk = 0; - const String& rTxt = rNd.GetTxt(); + const OUString& rTxt = rNd.GetTxt(); if( pDigitLvl ) *pDigitLvl = USHRT_MAX; @@ -472,9 +472,9 @@ sal_uInt16 SwAutoFormat::CalcLevel( const SwTxtNode& rNd, sal_uInt16 *pDigitLvl } - for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd; ++n ) + for (xub_StrLen n = 0, nEnd = rTxt.getLength(); n < nEnd; ++n) { - switch( rTxt.GetChar( n ) ) + switch (rTxt[n]) { case ' ': if( 3 == ++nBlnk ) ++nLvl, nBlnk = 0; @@ -540,13 +540,13 @@ bool SwAutoFormat::DoUnderline() if( !aFlags.bSetBorder ) return false; - const sal_Unicode* pStr = pAktTxtNd->GetTxt().GetBuffer(); + OUString const& rTxt(pAktTxtNd->GetTxt()); int eState = 0; xub_StrLen nCnt = 0; - while( *pStr ) + while (nCnt < rTxt.getLength()) { int eTmp = 0; - switch( *pStr ) + switch (rTxt[nCnt]) { case '-': eTmp = 1; break; case '_': eTmp = 2; break; @@ -562,8 +562,6 @@ bool SwAutoFormat::DoUnderline() else if( eState != eTmp ) return false; ++nCnt; - - ++pStr; } if( 2 < nCnt ) @@ -624,25 +622,24 @@ bool SwAutoFormat::DoTable() pAktTxtNd->FindTableNode() ) return false; - const String& rTmp = pAktTxtNd->GetTxt(); + const OUString& rTmp = pAktTxtNd->GetTxt(); xub_StrLen nSttPlus = GetLeadingBlanks( rTmp ); xub_StrLen nEndPlus = GetTrailingBlanks( rTmp ); sal_Unicode cChar; if( 2 > nEndPlus - nSttPlus || - ( '+' != ( cChar = rTmp.GetChar( nSttPlus )) && '|' != cChar ) || - ( '+' != ( cChar = rTmp.GetChar( nEndPlus - 1)) && '|' != cChar )) + ( '+' != ( cChar = rTmp[nSttPlus]) && '|' != cChar ) || + ( '+' != ( cChar = rTmp[nEndPlus - 1]) && '|' != cChar )) return false; SwTxtFrmInfo aInfo( pAktTxtFrm ); xub_StrLen n = nSttPlus; - const sal_Unicode* pStr = rTmp.GetBuffer() + n; std::vector<sal_uInt16> aPosArr; - while( *pStr ) + while (n < rTmp.getLength()) { - switch( *pStr ) + switch (rTmp[n]) { case '-': case '_': @@ -661,8 +658,6 @@ bool SwAutoFormat::DoTable() } if( ++n == nEndPlus ) break; - - ++pStr; } if( 1 < aPosArr.size() ) @@ -754,9 +749,9 @@ xub_StrLen SwAutoFormat::GetTrailingBlanks( const String& rStr ) const bool SwAutoFormat::IsFirstCharCapital( const SwTxtNode& rNd ) const { - const String& rTxt = rNd.GetTxt(); - for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd; ++n ) - if( !IsSpace( rTxt.GetChar( n ) ) ) + const OUString& rTxt = rNd.GetTxt(); + for (xub_StrLen n = 0, nEnd = rTxt.getLength(); n < nEnd; ++n) + if (!IsSpace(rTxt[n])) { CharClass& rCC = GetCharClass( rNd.GetSwAttrSet(). GetLanguage().GetLanguage() ); @@ -773,7 +768,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, String* pPreFix, String* pPostFix, String* pNumTypes ) const { // Teste auf 1.) / 1. / 1.1.1 / (1). / (1) / .... - const String& rTxt = rNd.GetTxt(); + const OUString& rTxt = rNd.GetTxt(); xub_StrLen nPos = rPos; int eScan = NONE; @@ -785,9 +780,9 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, CharClass& rCC = GetCharClass( rNd.GetSwAttrSet().GetLanguage().GetLanguage() ); - while( nPos < rTxt.Len() && nDigitLvl < MAXLEVEL - 1) + while (nPos < rTxt.getLength() && nDigitLvl < MAXLEVEL - 1) { - const sal_Unicode cCurrentChar = rTxt.GetChar( nPos ); + const sal_Unicode cCurrentChar = rTxt[nPos]; if( ('0' <= cCurrentChar && '9' >= cCurrentChar) || (0xff10 <= cCurrentChar && 0xff19 >= cCurrentChar) ) { @@ -977,9 +972,9 @@ CHECK_ROMAN_5: nClosingParentheses++; // nur wenn noch keine Zahlen gelesen wurden! if( pPreFix && !( eScan & ( NO_DELIM | CHG )) ) - *pPreFix += rTxt.GetChar( nPos ); + *pPreFix += rTxt[nPos]; else if( pPostFix ) - *pPostFix += rTxt.GetChar( nPos ); + *pPostFix += rTxt[nPos]; if( NO_DELIM & eScan ) { @@ -998,7 +993,7 @@ CHECK_ROMAN_5: ++nPos; } if( !( CHG & eScan ) || rPos == nPos || - nPos == rTxt.Len() || !IsSpace( rTxt.GetChar( nPos ) ) || + nPos == rTxt.getLength() || !IsSpace(rTxt[nPos]) || (nOpeningParentheses > nClosingParentheses)) return USHRT_MAX; @@ -1054,16 +1049,16 @@ bool SwAutoFormat::HasSelBlanks( SwPaM& rPam ) const SwPosition * pPos = rPam.End(); xub_StrLen nBlnkPos = pPos->nContent.GetIndex(); SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - if( nBlnkPos && nBlnkPos-- < pTxtNd->GetTxt().Len() && - ( ' ' == pTxtNd->GetTxt().GetChar( nBlnkPos ) )) + if (nBlnkPos && nBlnkPos-- < pTxtNd->GetTxt().getLength() && + (' ' == pTxtNd->GetTxt()[nBlnkPos])) pPos->nContent--; else { pPos = rPam.GetPoint() == pPos ? rPam.GetMark() : rPam.GetPoint(); nBlnkPos = pPos->nContent.GetIndex(); pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - if( nBlnkPos < pTxtNd->GetTxt().Len() && - ( ' ' == pTxtNd->GetTxt().GetChar( nBlnkPos ))) + if (nBlnkPos < pTxtNd->GetTxt().getLength() && + (' ' == pTxtNd->GetTxt()[nBlnkPos])) pPos->nContent++; else return false; @@ -1124,10 +1119,11 @@ void SwAutoFormat::DeleteAktPara( bool bStart, bool bEnd ) DeleteSel( aDelPam ); aDelPam.DeleteMark(); } - if( bEnd && pAktTxtNd->GetTxt().Len() != + if (bEnd && pAktTxtNd->GetTxt().getLength() != ( nPos = GetTrailingBlanks( pAktTxtNd->GetTxt() )) ) { - aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, pAktTxtNd->GetTxt().Len() ); + aDelPam.GetPoint()->nContent.Assign( + pAktTxtNd, pAktTxtNd->GetTxt().getLength()); aDelPam.SetMark(); aDelPam.GetPoint()->nContent = nPos; DeleteSel( aDelPam ); @@ -1180,7 +1176,7 @@ bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara ) { // dann nur bis zum Ende von Absatz loeschen aDelPam.GetPoint()->nNode--; - aDelPam.GetPoint()->nContent = pAktTxtNd->GetTxt().Len(); + aDelPam.GetPoint()->nContent = pAktTxtNd->GetTxt().getLength(); } else aDelPam.GetPoint()->nContent.Assign( pTNd, @@ -1204,14 +1200,15 @@ void SwAutoFormat::DelEmptyLine( bool bTstNextPara ) // Loesche Blanks den leeren Absatz aDelPam.DeleteMark(); aDelPam.GetPoint()->nNode = aNdIdx; - aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, pAktTxtNd->GetTxt().Len() ); + aDelPam.GetPoint()->nContent.Assign( + pAktTxtNd, pAktTxtNd->GetTxt().getLength() ); aDelPam.SetMark(); aDelPam.GetMark()->nNode--; SwTxtNode* pTNd = aDelPam.GetNode( sal_False )->GetTxtNode(); if( pTNd ) // erstmal den vorherigen Textnode benutzen. - aDelPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() ); + aDelPam.GetMark()->nContent.Assign(pTNd, pTNd->GetTxt().getLength()); else if( bTstNextPara ) { // dann versuche den naechsten (am Anfang vom Dok, Tabellen-Zellen, @@ -1288,7 +1285,7 @@ void SwAutoFormat::DelPrevPara() if( pTNd ) { // erstmal den vorherigen Textnode benutzen. - aDelPam.GetPoint()->nContent.Assign( pTNd, pTNd->GetTxt().Len() ); + aDelPam.GetPoint()->nContent.Assign(pTNd, pTNd->GetTxt().getLength()); DeleteSel( aDelPam ); } aDelPam.DeleteMark(); @@ -1422,12 +1419,15 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) SwTwips nFrmWidth = pAktTxtFrm->Prt().Width();; SwTwips nLeftTxtPos; { - const sal_Unicode* pTxt = pAktTxtNd->GetTxt().GetBuffer(), *pSav = pTxt; - while( IsSpace( *pTxt ) ) - ++pTxt; + sal_Int32 nPos(0); + while (nPos < pAktTxtNd->GetTxt().getLength() && + IsSpace(pAktTxtNd->GetTxt()[nPos])) + { + ++nPos; + } SwTxtFrmInfo aInfo( pAktTxtFrm ); - nLeftTxtPos = aInfo.GetCharPos( static_cast<xub_StrLen>(pTxt - pSav) ); + nLeftTxtPos = aInfo.GetCharPos(nPos); nLeftTxtPos -= pAktTxtNd->GetSwAttrSet().GetLRSpace().GetLeft(); } @@ -1747,21 +1747,21 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces ) if( nTxtPos ) { - const String& rStr = pAktTxtNd->GetTxt(); + const OUString& rStr = pAktTxtNd->GetTxt(); bool bInsTab = true; - if( '\t' == rStr.GetChar( nSpacePos+1 )) // ein Tab, das belassen wir + if ('\t' == rStr[nSpacePos+1]) // leave tab alone { --nSpacePos; bInsTab = false; } xub_StrLen nSpaceStt = nSpacePos; - while( nSpaceStt && IsSpace( rStr.GetChar( --nSpaceStt ) ) ) + while (nSpaceStt && IsSpace(rStr[--nSpaceStt])) ; ++nSpaceStt; - if( bInsTab && '\t' == rStr.GetChar( nSpaceStt ) ) // ein Tab, das belassen wir + if (bInsTab && '\t' == rStr[nSpaceStt]) // leave tab alone { ++nSpaceStt; bInsTab = false; @@ -1862,8 +1862,8 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) !aFlags.bChgWeightUnderl && !aFlags.bAddNonBrkSpace) ) return; - const String* pTxt = &pAktTxtNd->GetTxt(); - if( nPos >= pTxt->Len() ) + const OUString* pTxt = &pAktTxtNd->GetTxt(); + if (nPos >= pTxt->getLength()) return; bool bGetLanguage = aFlags.bChgOrdinalNumber || @@ -1887,14 +1887,14 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) CharClass& rAppCC = GetAppCharClass(); do { - while( nPos < pTxt->Len() && IsSpace( cChar = pTxt->GetChar( nPos ) )) + while (nPos < pTxt->getLength() && IsSpace(cChar = (*pTxt)[nPos])) ++nPos; - if( nPos == pTxt->Len() ) + if (nPos == pTxt->getLength()) break; // das wars if( ( ( bReplaceQuote && '\"' == cChar ) || ( bReplaceSglQuote && '\'' == cChar ) ) && - ( !nPos || ' ' == pTxt->GetChar( nPos-1 ) ) ) + (!nPos || ' ' == (*pTxt)[nPos-1])) { // -------------------------------------- // beachte: Sonderfall Symbolfonts !!! @@ -1939,10 +1939,10 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) bool bCallACorr = false; int bBreak = 0; - if( nPos && IsSpace( pTxt->GetChar( nPos-1 ))) + if (nPos && IsSpace((*pTxt)[nPos-1])) nLastBlank = nPos; - for( nSttPos = nPos; !bBreak && nPos < pTxt->Len(); ++nPos ) - switch( cChar = pTxt->GetChar( nPos ) ) + for (nSttPos = nPos; !bBreak && nPos < pTxt->getLength(); ++nPos) + switch (cChar = (*pTxt)[nPos]) { case '\"': case '\'': @@ -2006,7 +2006,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) ? STR_AUTOFMTREDL_BOLD : STR_AUTOFMTREDL_UNDER ); - sal_Unicode cBlank = nSttPos ? pTxt->GetChar(nSttPos - 1) : 0; + sal_Unicode cBlank = nSttPos ? (*pTxt)[nSttPos - 1] : 0; aDelPam.GetPoint()->nContent = nPos; if( pATst->FnChgWeightUnderl( aACorrDoc, *pTxt, @@ -2025,7 +2025,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) if(0 == (pDoc->GetRedlineMode() & nsRedlineMode_t::REDLINE_SHOW_DELETE)) nPos = aDelPam.GetPoint()->nContent.GetIndex() - 1; // wurde vorm Start ein Zeichen entfernt? - if( cBlank && cBlank != pTxt->GetChar(nSttPos - 1) ) + if (cBlank && cBlank != (*pTxt)[nSttPos - 1]) --nSttPos; } } @@ -2061,7 +2061,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) if( nPos == nSttPos ) { - if( ++nPos == pTxt->Len() ) + if (++nPos == pTxt->getLength()) bCallACorr = true; } else @@ -2107,7 +2107,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) SetRedlineTxt( STR_AUTOFMTREDL_DASH ) && pATst->FnChgToEnEmDash( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) || ( aFlags.bSetINetAttr && - ( nPos == pTxt->Len() || IsSpace( pTxt->GetChar( nPos )) ) && + (nPos == pTxt->getLength() || IsSpace((*pTxt)[nPos])) && SetRedlineTxt( STR_AUTOFMTREDL_DETECT_URL ) && pATst->FnSetINetAttr( aACorrDoc, *pTxt, nLastBlank, nPos, eLang ) ) ) nPos = aDelPam.GetPoint()->nContent.GetIndex(); @@ -2140,7 +2140,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) } } } - } while( nPos < pTxt->Len() ); + } while (nPos < pTxt->getLength()); ClearRedlineTxt(); } @@ -2666,7 +2666,7 @@ void SwEditShell::AutoFmtBySplitNode() // dann einen Node zurueckspringen SwNodeIndex aNdIdx( pCrsr->GetMark()->nNode, -1 ); SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode(); - if( pTxtNd && pTxtNd->GetTxt().Len() ) + if (pTxtNd && !pTxtNd->GetTxt().isEmpty()) { pCntnt->Assign( pTxtNd, 0 ); pCrsr->GetMark()->nNode = aNdIdx; diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 266f8d09263e..964fcda10a10 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -126,9 +126,10 @@ sal_Bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, { case ND_TEXTNODE: { - xub_StrLen nStt = n == nSttNd ? nSttCnt : 0, - nEnd = n == nEndNd ? nEndCnt - : ((SwTxtNode*)pNd)->GetTxt().Len(); + xub_StrLen const nStt = (n == nSttNd) ? nSttCnt : 0; + xub_StrLen const nEnd = (n == nEndNd) + ? nEndCnt + : static_cast<SwTxtNode*>(pNd)->GetTxt().getLength(); ((SwTxtNode*)pNd)->GetAttr( *pSet, nStt, nEnd, sal_False, sal_True, @@ -456,7 +457,6 @@ static bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, sal_uInt16 &rScrpt, bool bInSelection, bool bNum ) { bool bRet = false; - const String& rTxt = rTNd.GetTxt(); String sExp; // consider numbering @@ -484,7 +484,7 @@ static bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, } // and fields - if ( CH_TXTATR_BREAKWORD == rTxt.GetChar( nPos ) ) + if (CH_TXTATR_BREAKWORD == rTNd.GetTxt()[nPos]) { const SwTxtAttr* const pAttr = rTNd.GetTxtAttrForCharAt( nPos ); if (pAttr) @@ -557,7 +557,7 @@ sal_uInt16 SwEditShell::GetScriptType() const sal_uInt16 nScript; - if ( pTNd->GetTxt().Len() ) + if (!pTNd->GetTxt().isEmpty()) { nScript = pScriptInfo ? pScriptInfo->ScriptType( nPos ) : @@ -578,7 +578,7 @@ sal_uInt16 SwEditShell::GetScriptType() const if( aIdx.GetNode().IsTxtNode() ) { const SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode(); - const String& rTxt = pTNd->GetTxt(); + const OUString& rTxt = pTNd->GetTxt(); // try to get SwScriptInfo const SwScriptInfo* pScriptInfo = SwScriptInfo::GetScriptInfo( *pTNd ); @@ -588,11 +588,12 @@ sal_uInt16 SwEditShell::GetScriptType() const : 0, nEndPos = aIdx == nEndIdx ? pEnd->nContent.GetIndex() - : rTxt.Len(); + : rTxt.getLength(); - OSL_ENSURE( nEndPos <= rTxt.Len(), "Index outside the range - endless loop!" ); - if( nEndPos > rTxt.Len() ) - nEndPos = rTxt.Len(); + OSL_ENSURE( nEndPos <= rTxt.getLength(), + "Index outside the range - endless loop!" ); + if (nEndPos > rTxt.getLength()) + nEndPos = rTxt.getLength(); sal_uInt16 nScript; while( nChg < nEndPos ) @@ -603,23 +604,23 @@ sal_uInt16 SwEditShell::GetScriptType() const rTxt, nChg ); if( !lcl_IsNoEndTxtAttrAtPos( *pTNd, nChg, nRet, true, - 0 == nChg && rTxt.Len() == nEndPos ) ) + 0 == nChg && rTxt.getLength() == nEndPos)) nRet |= lcl_SetScriptFlags( nScript ); if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX) == nRet ) break; - xub_StrLen nFldPos = nChg+1; + sal_Int32 nFldPos = nChg+1; nChg = pScriptInfo ? pScriptInfo->NextScriptChg( nChg ) : (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rTxt, nChg, nScript ); - nFldPos = rTxt.Search( - CH_TXTATR_BREAKWORD, nFldPos ); - if( nFldPos < nChg ) + nFldPos = rTxt.indexOf( + CH_TXTATR_BREAKWORD, nFldPos); + if ((-1 != nFldPos) && (nFldPos < nChg)) nChg = nFldPos; } if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | @@ -676,7 +677,7 @@ sal_uInt16 SwEditShell::GetScalingOfSelectedText() const if( pStt->nNode == pEnd->nNode ) nEnd = pEnd->nContent.GetIndex(); else - nEnd = pTNd->GetTxt().Len(); + nEnd = pTNd->GetTxt().getLength(); nScaleWidth = pTNd->GetScalingOfSelectedText( nStt, nEnd ); } else diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx index e8369086cb10..af04306dfd39 100644 --- a/sw/source/core/edit/edfmt.cxx +++ b/sw/source/core/edit/edfmt.cxx @@ -73,6 +73,7 @@ void SwEditShell::FillByEx(SwCharFmt* pCharFmt, sal_Bool bReset) const SwCntntNode* pCNd = pPam->GetCntntNode(); if( pCNd->IsTxtNode() ) { + SwTxtNode const*const pTxtNode(static_cast<SwTxtNode const*>(pCNd)); xub_StrLen nStt, nEnd; if( pPam->HasMark() ) { @@ -98,7 +99,7 @@ void SwEditShell::FillByEx(SwCharFmt* pCharFmt, sal_Bool bReset) nStt = 0; } else - nEnd = ((SwTxtNode*)pCNd)->GetTxt().Len(); + nEnd = pTxtNode->GetTxt().getLength(); } } else @@ -106,7 +107,7 @@ void SwEditShell::FillByEx(SwCharFmt* pCharFmt, sal_Bool bReset) SfxItemSet aSet( pDoc->GetAttrPool(), pCharFmt->GetAttrSet().GetRanges() ); - ((SwTxtNode*)pCNd)->GetAttr( aSet, nStt, nEnd ); + pTxtNode->GetAttr( aSet, nStt, nEnd ); pCharFmt->SetFmtAttr( aSet ); } else if( pCNd->HasSwAttrSet() ) diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 5f8146d0ef1b..31045e0d24c9 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -194,7 +194,7 @@ sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, bool bEndUndo = false; SwDoc* pMyDoc = GetDoc(); SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); - if( pTxtNd && pTxtNd->GetTxt().Len() && rPos.nNode.GetIndex() + 1 != + if (pTxtNd && pTxtNd->GetTxt().getLength() && rPos.nNode.GetIndex() + 1 != pMyDoc->GetNodes().GetEndOfContent().GetIndex() ) rPos.nContent.Assign( pTxtNd, 0 ); else diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 31327d000b14..91d3e4e7ce94 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -558,7 +558,7 @@ String SwEditShell::GetDropTxt( const sal_uInt16 nChars ) const { xub_StrLen nDropLen = pTxtNd->GetDropLen( nChars ); if( nDropLen ) - aTxt = pTxtNd->GetTxt().Copy( 0, nDropLen ); + aTxt = pTxtNd->GetTxt().copy(0, nDropLen); } return aTxt; diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 8cfb24d57c71..ef150455c86b 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -1000,7 +1000,7 @@ uno::Reference< XSpellAlternatives > xub_StrLen nLen = 1; if( pWrong->InWrongWord(nBegin,nLen) && !pNode->IsSymbol(nBegin) ) { - String aText( pNode->GetTxt().Copy( nBegin, nLen ) ); + String const aText(pNode->GetTxt().copy(nBegin, nLen)); String aWord( aText ); aWord = comphelper::string::remove(aWord, CH_TXTATR_BREAKWORD); aWord = comphelper::string::remove(aWord, CH_TXTATR_INWORD); @@ -1113,7 +1113,7 @@ bool SwEditShell::GetGrammarCorrection( xub_StrLen nLen = 1; if (pWrong->InWrongWord(nBegin, nLen)) { - String aText( pNode->GetTxt().Copy( nBegin, nLen ) ); + String const aText(pNode->GetTxt().copy(nBegin, nLen)); uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() ); if (xGCIterator.is()) @@ -1811,7 +1811,8 @@ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt, bool bField = false; //read the character at the current position to check if it's a field - sal_Unicode cChar = pTxtNode->GetTxt().GetChar( pCrsr->GetMark()->nContent.GetIndex() ); + sal_Unicode const cChar = + pTxtNode->GetTxt()[pCrsr->GetMark()->nContent.GetIndex()]; if( CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar) { const SwTxtAttr* pTxtAttr = pTxtNode->GetTxtAttrForCharAt( diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 20aa72ae2224..f8ffa9e9205b 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -295,7 +295,8 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle) //body the directly available text node will be used if(!pTxtNode) pTxtNode = &rFldTxtNode; - if( pTxtNode->GetTxt().Len() && pTxtNode->getLayoutFrm( rDoc.GetCurrentLayout() ) && + if (!pTxtNode->GetTxt().isEmpty() && + pTxtNode->getLayoutFrm( rDoc.GetCurrentLayout() ) && pTxtNode->GetNodes().IsDocNodes() ) { SwTOXAuthority* pNew = new SwTOXAuthority( *pTxtNode, diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index a74d10d473ea..18b341416e03 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -91,7 +91,7 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt ) // delete content if ClpDocument contains content SwNodeIndex aSttIdx( pClpDoc->GetNodes().GetEndOfExtras(), 2 ); SwTxtNode* pTxtNd = aSttIdx.GetNode().GetTxtNode(); - if( !pTxtNd || pTxtNd->GetTxt().Len() || + if (!pTxtNd || !pTxtNd->GetTxt().isEmpty() || aSttIdx.GetIndex()+1 != pClpDoc->GetNodes().GetEndOfContent().GetIndex() ) { pClpDoc->GetNodes().Delete( aSttIdx, diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 7fa71fd0deaa..09b418bd3794 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -357,7 +357,7 @@ sal_Bool SwFEShell::MoveAnchor( sal_uInt16 nDir ) else { xub_StrLen nMax = - ((SwTxtFrm*)pOld)->GetTxtNode()->GetTxt().Len(); + static_cast<SwTxtFrm*>(pOld)->GetTxtNode()->GetTxt().getLength(); if( nAct < nMax ) { ++nAct; @@ -384,7 +384,7 @@ sal_Bool SwFEShell::MoveAnchor( sal_uInt16 nDir ) xub_StrLen nTmp = 0; if( bRet ) { - nTmp = ((SwTxtFrm*)pNew)->GetTxtNode()->GetTxt().Len(); + nTmp = static_cast<SwTxtFrm*>(pNew)->GetTxtNode()->GetTxt().getLength(); if( nTmp ) --nTmp; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 97e41aa44ab0..23956db3fb8b 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1240,7 +1240,7 @@ sal_Bool SwFEShell::IsAdjustCellWidthAllowed( sal_Bool bBalance ) const while ( pCNd ) { - if ( pCNd->GetTxt().Len() ) + if (!pCNd->GetTxt().isEmpty()) return sal_True; ++aIdx; pCNd = aIdx.GetNode().GetTxtNode(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index eabad89215ee..e08bc421f2b3 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1387,7 +1387,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, rInsPosNd.GetNode().EndOfSectionIndex() - 2 ); pTxtNd = rInsPosNd.GetNode().GetTxtNode(); if( pTxtNd ) - aInsPos.nContent.Assign( pTxtNd, pTxtNd->GetTxt().Len() ); + aInsPos.nContent.Assign(pTxtNd, pTxtNd->GetTxt().getLength()); } // the MergeBox should contain the complete text diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 0316791b8d54..b9ddf6ce71f4 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -913,7 +913,9 @@ void SwLayoutFrm::MakeAll() |*************************************************************************/ bool SwTxtNode::IsCollapse() const { - if ( GetDoc()->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA ) && GetTxt().Len()==0 ) { + if (GetDoc()->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA ) + && GetTxt().isEmpty()) + { sal_uLong nIdx=GetIndex(); const SwEndNode *pNdBefore=GetNodes()[nIdx-1]->GetEndNode(); const SwEndNode *pNdAfter=GetNodes()[nIdx+1]->GetEndNode(); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 81060e118d44..6fd3a4a461b2 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2109,7 +2109,7 @@ sal_Bool SwLayIdle::_DoIdleJob( const SwCntntFrm *pCnt, IdleJobType eJob ) break; case WORD_COUNT : { - const xub_StrLen nEnd = pTxtNode->GetTxt().Len(); + const xub_StrLen nEnd = pTxtNode->GetTxt().getLength(); SwDocStat aStat; pTxtNode->CountWords( aStat, 0, nEnd ); if ( Application::AnyInput( VCL_INPUT_ANY ) ) diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 4a9aef7b020f..20f23c1fd629 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -782,7 +782,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) sal_uInt16 nRepeat( 0 ); if( !bLongTab && rpFrm->IsTxtFrm() && SW_LAYCACHE_IO_REC_PARA == nType && - nOfst<((SwTxtFrm*)rpFrm)->GetTxtNode()->GetTxt().Len() ) + nOfst<((SwTxtFrm*)rpFrm)->GetTxtNode()->GetTxt().getLength()) bSplit = true; else if( rpFrm->IsTabFrm() && nRowCount < nOfst && ( bLongTab || SW_LAYCACHE_IO_REC_TABLE == nType ) ) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index a56db0fd1171..6c678f7aba1f 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2576,7 +2576,7 @@ sal_uInt16 SwTableBox::IsFormulaOrValueBox() const nWhich = RES_BOXATR_VALUE; else if( pSttNd && pSttNd->GetIndex() + 2 == pSttNd->EndOfSectionIndex() && 0 != ( pTNd = pSttNd->GetNodes()[ pSttNd->GetIndex() + 1 ] - ->GetTxtNode() ) && !pTNd->GetTxt().Len() ) + ->GetTxtNode() ) && pTNd->GetTxt().isEmpty()) nWhich = USHRT_MAX; return nWhich; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index bd84f810dec0..eb87695da079 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2005,7 +2005,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() if ( pTNd->IsHidden() || // #i40292# Skip empty outlines: - 0 == pTNd->GetTxt().Len() ) + pTNd->GetTxt().isEmpty()) continue; // Get parent id from stack: diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index dc59db5e1111..5cef43d186e7 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -295,8 +295,10 @@ sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, (rOrig.*fnRect->fnGetBottom)() == nUpperMaxY && pFrm->GetOfst() < nOffset && !pFrm->IsFollow() && !bNoScroll && - pFrm->GetTxtNode()->GetTxt().Len() != nNextOfst ) + pFrm->GetTxtNode()->GetTxt().getLength() != nNextOfst) + { bGoOn = sw_ChangeOffset( pFrm, nNextOfst ); + } else bGoOn = false; } while ( bGoOn ); @@ -625,11 +627,11 @@ sal_Bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint, pPos->nContent.Assign( pTxtNd, nOffset ); if( pFillData ) { - if( pTxtNd->GetTxt().Len() > nOffset || + if (pTxtNd->GetTxt().getLength() > nOffset || rPoint.Y() < Frm().Top() ) pFillData->bInner = true; pFillData->bFirstLine = aLine.GetLineNr() < 2; - if( pTxtNd->GetTxt().Len() ) + if (pTxtNd->GetTxt().getLength()) { pFillData->bEmpty = false; pFillData->nLineWidth = aLine.GetCurr()->Width(); @@ -755,12 +757,12 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const // We skip hard line brakes if( aLine.GetCurr()->GetLen() && - CH_BREAK == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) + CH_BREAK == aInf.GetTxt().GetChar(nRightMargin - 1)) --nRightMargin; else if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) { while( nRightMargin > aLine.GetStart() && - ' ' == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) + ' ' == aInf.GetTxt().GetChar(nRightMargin - 1)) --nRightMargin; } } @@ -1117,7 +1119,7 @@ void SwTxtFrm::PrepareVisualMove( xub_StrLen& nPos, sal_uInt8& nCrsrLevel, // // Bidi functions from icu 2.0 // - const sal_Unicode* pLineString = GetTxtNode()->GetTxt().GetBuffer(); + const sal_Unicode* pLineString = GetTxtNode()->GetTxt().getStr(); pLine += nStt; UErrorCode nError = U_ZERO_ERROR; @@ -1390,7 +1392,8 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const { SwTxtNode* pTxtNd = ((SwTxtFrm*)pFrm)->GetTxtNode(); rFill.pPos->nNode = *pTxtNd; - rFill.pPos->nContent.Assign( pTxtNd, pTxtNd->GetTxt().Len() ); + rFill.pPos->nContent.Assign( + pTxtNd, pTxtNd->GetTxt().getLength()); } if( nNextCol ) { diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 5833bfd264e0..35b425345485 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1145,7 +1145,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ) SwRepaint &rRepaint = *(pPara->GetRepaint()); if( bUnChg && rRepaint.Top() == rLine.Y() && (bPrev || nNewStart <= pPara->GetReformat()->Start()) - && ( nNewStart < GetTxtNode()->GetTxt().Len() ) ) + && (nNewStart < GetTxtNode()->GetTxt().getLength())) { rRepaint.Top( nBottom ); rRepaint.Height( 0 ); @@ -1218,7 +1218,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ) return sal_True; // Until the String's end? - if( nNewStart >= GetTxtNode()->GetTxt().Len() ) + if (nNewStart >= GetTxtNode()->GetTxt().getLength()) return sal_False; if( rLine.GetInfo().IsShift() ) @@ -1718,7 +1718,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) return; } - const xub_StrLen nStrLen = GetTxtNode()->GetTxt().Len(); + const xub_StrLen nStrLen = GetTxtNode()->GetTxt().getLength(); if ( nStrLen || !FormatEmpty() ) { @@ -1756,7 +1756,8 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) SwTxtFrmLocker aLock(this); SwTxtLineAccess aAccess( this ); const bool bNew = !aAccess.SwTxtLineAccess::IsAvailable(); - const bool bSetOfst = ( GetOfst() && GetOfst() > GetTxtNode()->GetTxt().Len() ); + const bool bSetOfst = + (GetOfst() && GetOfst() > GetTxtNode()->GetTxt().getLength()); if( CalcPreps() ) ; // nothing diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 0819465c6118..67b52b848223 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -299,7 +299,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, pFnt = pNewFnt; pUnderFnt = 0; - pTxt = &pNd->GetTxt(); + pTxt = reinterpret_cast<String const*>(&pNd->GetTxt()); //FIXME nIdx = nNewIdx; nLen = nNewLen; diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 3c010da222dd..72c9c7ba8acd 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -864,7 +864,7 @@ inline void SwTxtFormatInfo::SetParaFtn() inline sal_Bool SwTxtFormatInfo::IsSoftHyph( const xub_StrLen nPos ) const { - return CHAR_SOFTHYPHEN == GetTxtFrm()->GetTxtNode()->GetTxt().GetChar(nPos); + return CHAR_SOFTHYPHEN == GetTxtFrm()->GetTxtNode()->GetTxt()[nPos]; } diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 71885ad67f6e..c6aa8c98c443 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -323,8 +323,12 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const //TODO maybe use hints like FieldHints for this instead of looking at the text... int l=(nNext<m_pTxtNode->Len()?nNext:m_pTxtNode->Len()); sal_uInt16 p=nPos; - const sal_Unicode *txt=m_pTxtNode->GetTxt().GetBuffer(); - while(p<l && txt[p]!=CH_TXT_ATR_FIELDSTART && txt[p]!=CH_TXT_ATR_FIELDEND && txt[p]!=CH_TXT_ATR_FORMELEMENT) p++; + while (p<l && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDSTART + && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDEND + && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FORMELEMENT) + { + ++p; + } if ((p<l && p>nPos) || nNext<=p) nNext=p; else @@ -1013,8 +1017,8 @@ sal_uInt16 SwTxtNode::GetWidthOfLeadingTabs() const xub_StrLen nIdx = 0; sal_Unicode cCh; - while ( nIdx < GetTxt().Len() && - ( '\t' == ( cCh = GetTxt().GetChar( nIdx ) ) || + while ( nIdx < GetTxt().getLength() && + ( '\t' == ( cCh = GetTxt()[nIdx] ) || ' ' == cCh ) ) ++nIdx; diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 27f1d18be9e6..4115e73eb798 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1358,7 +1358,7 @@ sal_uInt16 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffe const xub_StrLen nStt, const xub_StrLen nEnd, const sal_Unicode cChar ) { - assert(rNode.GetTxt().Len() == rText.getLength()); + assert(rNode.GetTxt().getLength() == rText.getLength()); PositionList aList; xub_StrLen nHiddenStart; @@ -1441,11 +1441,11 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP if ( pList ) { pList->push_back( 0 ); - pList->push_back( rNode.GetTxt().Len() ); + pList->push_back(rNode.GetTxt().getLength()); } rnStartPos = 0; - rnEndPos = rNode.GetTxt().Len(); + rnEndPos = rNode.GetTxt().getLength(); return true; } } @@ -1457,7 +1457,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP // Check first, if we have a valid SwScriptInfo object for this text node: // bNewContainsHiddenChars = pSI->GetBoundsOfHiddenRange( nPos, rnStartPos, rnEndPos, pList ); - const bool bNewHiddenCharsHidePara = ( rnStartPos == 0 && rnEndPos >= rNode.GetTxt().Len() ); + const bool bNewHiddenCharsHidePara = + rnStartPos == 0 && rnEndPos >= rNode.GetTxt().getLength(); rNode.SetHiddenCharAttribute( bNewHiddenCharsHidePara, bNewContainsHiddenChars ); } else @@ -1465,7 +1466,9 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP // // No valid SwScriptInfo Object, we have to do it the hard way: // - Range aRange( 0, rNode.GetTxt().Len() ? rNode.GetTxt().Len() - 1 : 0 ); + Range aRange(0, (!rNode.GetTxt().isEmpty()) + ? rNode.GetTxt().getLength() - 1 + : 0); MultiSelection aHiddenMulti( aRange ); SwScriptInfo::CalcHiddenRanges( rNode, aHiddenMulti ); for( sal_uInt16 i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) @@ -1479,7 +1482,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP else if ( nHiddenStart <= nPos && nPos < nHiddenEnd ) { rnStartPos = nHiddenStart; - rnEndPos = Min( nHiddenEnd, rNode.GetTxt().Len() ); + rnEndPos = std::min<sal_Int32>(nHiddenEnd, + rNode.GetTxt().getLength()); break; } } @@ -2181,8 +2185,8 @@ SwTwips SwTxtFrm::HangingMargin() const void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelection &rHiddenMulti) { - assert((!rNode.GetTxt().Len() && rHiddenMulti.GetTotalRange().Len() == 1) || - (rNode.GetTxt().Len() == rHiddenMulti.GetTotalRange().Len())); + assert((rNode.GetTxt().isEmpty() && rHiddenMulti.GetTotalRange().Len() == 1) + || (rNode.GetTxt().getLength() == rHiddenMulti.GetTotalRange().Len())); const SfxPoolItem* pItem = 0; if( SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState( RES_CHRATR_HIDDEN, sal_True, &pItem ) && @@ -2218,8 +2222,8 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelecti void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &rHiddenMulti, bool bSelect) { - assert((!rNode.GetTxt().Len() && rHiddenMulti.GetTotalRange().Len() == 1) || - (rNode.GetTxt().Len() == rHiddenMulti.GetTotalRange().Len())); + assert((rNode.GetTxt().isEmpty() && rHiddenMulti.GetTotalRange().Len() == 1) + || (rNode.GetTxt().getLength() == rHiddenMulti.GetTotalRange().Len())); const IDocumentRedlineAccess& rIDRA = *rNode.getIDocumentRedlineAccess(); if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) @@ -2237,7 +2241,7 @@ void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection & xub_StrLen nRedlnEnd; pRed->CalcStartEnd( rNode.GetIndex(), nRedlStart, nRedlnEnd ); //clip it if the redline extends past the end of the nodes text - nRedlnEnd = std::min(nRedlnEnd, rNode.GetTxt().Len()); + nRedlnEnd = std::min<sal_Int32>(nRedlnEnd, rNode.GetTxt().getLength()); if ( nRedlnEnd > nRedlStart ) { Range aTmp( nRedlStart, nRedlnEnd - 1 ); @@ -2271,7 +2275,8 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi const Range& rRange = rHiddenMulti.GetRange( 0 ); const xub_StrLen nHiddenStart = (xub_StrLen)rRange.Min(); const xub_StrLen nHiddenEnd = (xub_StrLen)rRange.Max() + 1; - bNewHiddenCharsHidePara = ( nHiddenStart == 0 && nHiddenEnd >= rNode.GetTxt().Len() ); + bNewHiddenCharsHidePara = + (nHiddenStart == 0 && nHiddenEnd >= rNode.GetTxt().getLength()); } rNode.SetHiddenCharAttribute( bNewHiddenCharsHidePara, bNewContainsHiddenChars ); } diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 456faee4dfd5..f738c78db482 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -116,7 +116,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S pFnt->ChkMagic( pShell, nTmp ); pFnt->GetMagic( aMagicNo[ nTmp ], aFntIdx[ nTmp ], nTmp ); } - } while( nChg < rTxtNode.GetTxt().Len() ); + } while (nChg < rTxtNode.GetTxt().getLength()); } else { diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index af2cf6f8c234..6536cbba2e19 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -146,7 +146,7 @@ sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos ) MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const { - xub_StrLen nEnd = GetTxt().Len(); + xub_StrLen nEnd = GetTxt().getLength(); if( nWishLen && nWishLen < nEnd ) nEnd = nWishLen; @@ -181,7 +181,7 @@ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const xub_StrLen i = 0; for( ; i < nEnd; ++i ) { - sal_Unicode cChar = GetTxt().GetChar( i ); + sal_Unicode const cChar = GetTxt()[i]; if( CH_TAB == cChar || CH_BREAK == cChar || (( CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar ) && SwTxtSizeInfo::_HasHint( this, i ) ) ) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 554f5d086011..af575c212b74 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -390,7 +390,7 @@ SwTxtFrm::~SwTxtFrm() const XubString& SwTxtFrm::GetTxt() const { - return GetTxtNode()->GetTxt(); + return reinterpret_cast<const XubString&>(GetTxtNode()->GetTxt()); //FIXME } void SwTxtFrm::ResetPreps() @@ -511,7 +511,7 @@ bool sw_HideObj( const SwTxtFrm& _rFrm, _rFrm.IsInDocBody() && !_rFrm.FindNextCnt() ) { const sal_Unicode cAnchorChar = - _rFrm.GetTxtNode()->GetTxt().GetChar( _nObjAnchorPos ); + _rFrm.GetTxtNode()->GetTxt()[_nObjAnchorPos]; if ( cAnchorChar == CH_TXTATR_BREAKWORD ) { const SwTxtAttr* const pHint( diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 99f720410f34..665d338c5bae 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1368,7 +1368,7 @@ static void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt, case RES_TXTATR_METAFIELD: OSL_ENSURE(pNewHt, "copying Meta should not fail!"); OSL_ENSURE(pDest && (CH_TXTATR_BREAKWORD == - pDest->GetTxt().GetChar(*pNewHt->GetStart())), + pDest->GetTxt()[*pNewHt->GetStart()]), "missing CH_TXTATR?"); break; } @@ -1487,7 +1487,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, if ( !bForceCopyOfAllAttrs && ( nDestStart || pDest->HasSwAttrSet() || - nLen != pDest->GetTxt().Len() ) ) + nLen != pDest->GetTxt().getLength())) { SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1, @@ -1533,7 +1533,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, if ( !bForceCopyOfAllAttrs && ( nDestStart || pDest->HasSwAttrSet() || - nLen != pDest->GetTxt().Len() ) ) + nLen != pDest->GetTxt().getLength())) { SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1, @@ -1824,7 +1824,7 @@ void SwTxtNode::CutText( SwTxtNode * const pDest, { if(pDest) { - SwIndex aDestStt( pDest, pDest->GetTxt().Len() ); + SwIndex aDestStt(pDest, pDest->GetTxt().getLength()); CutImpl( pDest, aDestStt, rStart, nLen, false ); } else @@ -2015,7 +2015,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, { // alle, oder nur die CharAttribute ? if( nInitSize || pDest->HasSwAttrSet() || - nLen != pDest->GetTxt().Len() ) + nLen != pDest->GetTxt().getLength()) { SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1, @@ -2923,7 +2923,7 @@ XubString SwTxtNode::GetExpandTxt( const xub_StrLen nIdx, const bool bAddSpaceAfterListLabelStr, const bool bWithSpacesForLevel ) const { - XubString aTxt( GetTxt().Copy( nIdx, nLen ) ); + XubString aTxt( GetTxt().copy(nIdx, nLen) ); xub_StrLen nTxtStt = nIdx; Replace0xFF( aTxt, nTxtStt, aTxt.Len(), sal_True ); if( bWithNum ) @@ -2962,7 +2962,7 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, if( &rDestNd == this ) return sal_False; - SwIndex aDestIdx( &rDestNd, rDestNd.GetTxt().Len() ); + SwIndex aDestIdx(&rDestNd, rDestNd.GetTxt().getLength()); if( pDestIdx ) aDestIdx = *pDestIdx; xub_StrLen nDestStt = aDestIdx.GetIndex(); @@ -3089,9 +3089,9 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, aDestIdx = 0; sal_Int32 nStartDelete(-1); - while (aDestIdx < rDestNd.GetTxt().Len()) + while (aDestIdx < rDestNd.GetTxt().getLength()) { - sal_Unicode const cur(rDestNd.GetTxt().GetChar(aDestIdx.GetIndex())); + sal_Unicode const cur(rDestNd.GetTxt()[aDestIdx.GetIndex()]); if ( (cChar == cur) // filter substituted hidden text || (CH_TXT_ATR_FIELDSTART == cur) // filter all fieldmarks || (CH_TXT_ATR_FIELDEND == cur) @@ -3102,7 +3102,7 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, nStartDelete = aDestIdx.GetIndex(); // start deletion range } ++aDestIdx; - if (aDestIdx < rDestNd.GetTxt().Len()) + if (aDestIdx < rDestNd.GetTxt().getLength()) { continue; } // else: end of paragraph => delete, see below @@ -3294,7 +3294,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, aRedlArr.push_back( pREnd->nContent.GetIndex() ); else { - aRedlArr.push_back( GetTxt().Len() ); + aRedlArr.push_back(GetTxt().getLength()); break; // mehr kann nicht kommen } } @@ -3304,7 +3304,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, } } - XubString aTxt( GetTxt().Copy( nIdx, nLen ) ); + XubString aTxt(GetTxt().copy(nIdx, nLen)); xub_StrLen nTxtStt = nIdx, nIdxEnd = nIdx + aTxt.Len(); for( sal_uInt16 n = 0; n < aRedlArr.size(); n += 2 ) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index de26219172b6..80c65d8fc7ec 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1197,18 +1197,17 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV const OUString aOldTxt( pNode->GetTxt() ); OUStringBuffer buf(pNode->m_Text); const bool bRestoreString = lcl_MaskRedlinesAndHiddenText( *pNode, buf, - 0, pNode->GetTxt().Len() ) > 0; + 0, pNode->GetTxt().getLength()) > 0; if (bRestoreString) { // ??? UGLY: is it really necessary to modify m_Text here? pNode->m_Text = buf.makeStringAndClear(); } // a change of data indicates that at least one word has been modified - const bool bRedlineChg = - ( pNode->GetTxt().GetBuffer() != aOldTxt.getStr() ); + const bool bRedlineChg = (pNode->GetTxt().getStr() != aOldTxt.getStr()); xub_StrLen nBegin = 0; - xub_StrLen nEnd = pNode->GetTxt().Len(); + xub_StrLen nEnd = pNode->GetTxt().getLength(); xub_StrLen nInsertPos = 0; xub_StrLen nChgStart = STRING_LEN; xub_StrLen nChgEnd = 0; @@ -1224,9 +1223,9 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV if( STRING_LEN != nBegin ) { nEnd = pNode->GetWrong()->GetEndInv(); - if ( nEnd > pNode->GetTxt().Len() ) + if (nEnd > pNode->GetTxt().getLength()) { - nEnd = pNode->GetTxt().Len(); + nEnd = pNode->GetTxt().getLength(); } } @@ -1494,7 +1493,7 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos ) SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords(); xub_StrLen nBegin = 0; - xub_StrLen nEnd = pNode->GetTxt().Len(); + xub_StrLen nEnd = pNode->GetTxt().getLength(); xub_StrLen nLen; bool bACWDirty = false, bAnyWrd = false; @@ -1907,7 +1906,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat, { //not counting txtnodes used to hold deleted redline content return false; } - bool bCountAll = ( (0 == nStt) && (GetTxt().Len() == nEnd) ); + bool bCountAll = ( (0 == nStt) && (GetTxt().getLength() == nEnd) ); ++rStat.nAllPara; // #i93174#: count _all_ paragraphs if ( IsHidden() ) { // not counting hidden paras diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 613b415f0db9..3dd50c5496dc 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -465,7 +465,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) { aPos.nContent.Assign( (SwTxtNode*)pNd, rAnchor.GetPageNum() ); if ( aPos.nContent.GetIndex() > - static_cast<SwTxtNode*>(pNd)->GetTxt().Len() ) + static_cast<SwTxtNode*>(pNd)->GetTxt().getLength()) { // #i35443# - invalid position. // Thus, anchor attribute not restored diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index f824b8e1006b..3645d7b3a770 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -274,7 +274,7 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, sal_Bool bFullPara, sal_Bool bCalledByT aRg.aEnd--; } } - else if( pSttTxtNd && ( pEndTxtNd || pSttTxtNd->GetTxt().Len() ) ) + else if (pSttTxtNd && (pEndTxtNd || pSttTxtNd->GetTxt().getLength())) aRg.aStart++; // Step 3: Moving into UndoArray... @@ -344,22 +344,24 @@ sal_Bool SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd { bool bOneNode = nSttNode == nEndNode; xub_StrLen nLen = bOneNode ? nEndCntnt - nSttCntnt - : pSttTxtNd->GetTxt().Len() - nSttCntnt; + : pSttTxtNd->GetTxt().getLength() - nSttCntnt; SwRegHistory aRHst( *pSttTxtNd, pHistory ); // always save all text atttibutes because of possibly overlapping // areas of on/off pHistory->CopyAttr( pSttTxtNd->GetpSwpHints(), nNdIdx, - 0, pSttTxtNd->GetTxt().Len(), true ); + 0, pSttTxtNd->GetTxt().getLength(), true ); if( !bOneNode && pSttTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pSttTxtNd->GetpSwAttrSet(), nNdIdx ); // the length might have changed (!!Fields!!) - nLen = ( bOneNode ? pEnd->nContent.GetIndex() : pSttTxtNd->GetTxt().Len() ) - - pStt->nContent.GetIndex(); + nLen = ((bOneNode) + ? pEnd->nContent.GetIndex() + : pSttTxtNd->GetTxt().getLength()) + - pStt->nContent.GetIndex(); // delete now also the text (all attribute changes are added to // UNDO history) - pSttStr = (String*)new String( pSttTxtNd->GetTxt().Copy( nSttCntnt, nLen )); + pSttStr = new String( pSttTxtNd->GetTxt().copy(nSttCntnt, nLen)); pSttTxtNd->EraseText( pStt->nContent, nLen ); if( pSttTxtNd->GetpSwpHints() ) pSttTxtNd->GetpSwpHints()->DeRegister(); @@ -387,14 +389,14 @@ sal_Bool SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd // always save all text atttibutes because of possibly overlapping // areas of on/off pHistory->CopyAttr( pEndTxtNd->GetpSwpHints(), nNdIdx, 0, - pEndTxtNd->GetTxt().Len(), true ); + pEndTxtNd->GetTxt().getLength(), true ); if( pEndTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pEndTxtNd->GetpSwAttrSet(), nNdIdx ); // delete now also the text (all attribute changes are added to // UNDO history) - pEndStr = (String*)new String( pEndTxtNd->GetTxt().Copy( 0, + pEndStr = new String( pEndTxtNd->GetTxt().copy( 0, pEnd->nContent.GetIndex() )); pEndTxtNd->EraseText( aEndIdx, pEnd->nContent.GetIndex() ); if( pEndTxtNd->GetpSwpHints() ) @@ -455,7 +457,7 @@ sal_Bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam ) if( !pDelTxtNd ) return sal_False; xub_StrLen nUChrPos = bBackSp ? 0 : pSttStr->Len()-1; - sal_Unicode cDelChar = pDelTxtNd->GetTxt().GetChar( pStt->nContent.GetIndex() ); + sal_Unicode cDelChar = pDelTxtNd->GetTxt()[ pStt->nContent.GetIndex() ]; CharClass& rCC = GetAppCharClass(); if( ( CH_TXTATR_BREAKWORD == cDelChar || CH_TXTATR_INWORD == cDelChar ) || rCC.isLetterNumeric( rtl::OUString( cDelChar ), 0 ) != @@ -801,7 +803,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) SwTxtNode * pNd = aPos.nNode.GetNode().GetTxtNode(); if( pNd ) { - if( nSttCntnt < pNd->GetTxt().Len() ) + if (nSttCntnt < pNd->GetTxt().getLength()) { sal_uLong nOldIdx = aPos.nNode.GetIndex(); pDoc->SplitNode( aPos, false ); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 1f8458e882a9..5ca6b4c7a524 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -502,7 +502,7 @@ void SwUndoSetFlyFmt::GetAnchor( SwFmtAnchor& rAnchor, if ((FLY_AS_CHAR == nAnchorTyp) || (FLY_AT_CHAR == nAnchorTyp)) { - if ( nCntnt > static_cast<SwTxtNode*>(pNd)->GetTxt().Len() ) + if (nCntnt > static_cast<SwTxtNode*>(pNd)->GetTxt().getLength()) { pNd = 0; // invalid position } diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index ac49017b8c5b..325d6e93a510 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -74,8 +74,8 @@ String * SwUndoInsert::GetTxtFromDoc() const if( pCNd->IsTxtNode() ) { - pResult = new String( ((SwTxtNode*)pCNd)->GetTxt().Copy(nCntnt-nLen, - nLen ) ); + pResult = new String( + static_cast<SwTxtNode*>(pCNd)->GetTxt().copy(nCntnt-nLen, nLen)); } @@ -241,7 +241,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX ); RemoveIdxFromRange( aPaM, sal_False ); - pTxt = new String( pTxtNode->GetTxt().Copy(nCntnt-nLen, nLen) ); + pTxt = new String( pTxtNode->GetTxt().copy(nCntnt-nLen, nLen) ); pTxtNode->EraseText( aPaM.GetPoint()->nContent, nLen ); // Undo deletes fieldmarks in two step: first the end then the start position. @@ -404,10 +404,10 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) } else { - String aTxt( ((SwTxtNode*)pCNd)->GetTxt() ); + OUString const aTxt( static_cast<SwTxtNode*>(pCNd)->GetTxt() ); ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); rDoc.InsertString( rContext.GetRepeatPaM(), - aTxt.Copy( nCntnt - nLen, nLen ) ); + aTxt.copy(nCntnt - nLen, nLen) ); } break; case ND_GRFNODE: @@ -622,7 +622,7 @@ SwUndoReplace::Impl::Impl( if ( pNd->GetpSwpHints() ) { pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0, - pNd->GetTxt().Len(), true ); + pNd->GetTxt().getLength(), true ); } if ( m_bSplitNext ) @@ -634,7 +634,7 @@ SwUndoReplace::Impl::Impl( SwTxtNode* pNext = pEnd->nNode.GetNode().GetTxtNode(); sal_uLong nTmp = pNext->GetIndex(); pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0, - pNext->GetTxt().Len(), true ); + pNext->GetTxt().getLength(), true ); if( pNext->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pNext->GetpSwAttrSet(), nTmp ); pHistory->Add( pNext->GetTxtColl(),nTmp, ND_TEXTNODE ); @@ -646,9 +646,9 @@ SwUndoReplace::Impl::Impl( if( !pHistory->Count() ) delete pHistory, pHistory = 0; - xub_StrLen nECnt = m_bSplitNext ? pNd->GetTxt().Len() + xub_StrLen nECnt = m_bSplitNext ? pNd->GetTxt().getLength() : pEnd->nContent.GetIndex(); - m_sOld = pNd->GetTxt().Copy( m_nSttCnt, nECnt - m_nSttCnt ); + m_sOld = pNd->GetTxt().copy( m_nSttCnt, nECnt - m_nSttCnt ); } void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext) diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 0bfd5bf6a958..f89ebf50f25f 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -48,7 +48,7 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) if ( pTxtNd->GetpSwpHints() ) { pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nSttNode, - 0, pTxtNd->GetTxt().Len(), false ); + 0, pTxtNd->GetTxt().getLength(), false ); } if( pTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nSttNode ); @@ -59,7 +59,7 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) if ( pEndTxtNd->GetpSwpHints() ) { pHistory->CopyAttr( pEndTxtNd->GetpSwpHints(), nEndNode, - 0, pEndTxtNd->GetTxt().Len(), false ); + 0, pEndTxtNd->GetTxt().getLength(), false ); } if( pEndTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pEndTxtNd->GetpSwAttrSet(), nEndNode ); @@ -72,7 +72,7 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) if ( pTxtNd->GetpSwpHints() ) { pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nMvDestNode, - 0, pTxtNd->GetTxt().Len(), false ); + 0, pTxtNd->GetTxt().getLength(), false ); } if( pTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nMvDestNode ); @@ -228,7 +228,7 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) { { RemoveIdxRel( aIdx.GetIndex() + 1, SwPosition( aIdx, - SwIndex( pTxtNd, pTxtNd->GetTxt().Len() ) ) ); + SwIndex(pTxtNd, pTxtNd->GetTxt().getLength()))); } // Are there any Pams in the next TextNode? pTxtNd->JoinNext(); @@ -240,7 +240,7 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) pTxtNd = aIdx.GetNode().GetTxtNode(); { RemoveIdxRel( aIdx.GetIndex() + 1, SwPosition( aIdx, - SwIndex( pTxtNd, pTxtNd->GetTxt().Len() ) ) ); + SwIndex( pTxtNd, pTxtNd->GetTxt().getLength()))); } pTxtNd->JoinNext(); } @@ -303,7 +303,7 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext) { { RemoveIdxRel( aIdx.GetIndex() + 1, SwPosition( aIdx, - SwIndex( pTxtNd, pTxtNd->GetTxt().Len() ) ) ); + SwIndex(pTxtNd, pTxtNd->GetTxt().getLength()))); } pTxtNd->JoinNext(); } diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index 3cc6c4dd8934..c317354a5148 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -60,10 +60,10 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, OSL_ENSURE( pTxtNd, "Overwrite not in a TextNode?" ); bInsChar = sal_True; - xub_StrLen nTxtNdLen = pTxtNd->GetTxt().Len(); + xub_StrLen nTxtNdLen = pTxtNd->GetTxt().getLength(); if( nSttCntnt < nTxtNdLen ) // no pure insert? { - aDelStr.Insert( pTxtNd->GetTxt().GetChar( nSttCntnt ) ); + aDelStr.Insert( pTxtNd->GetTxt()[nSttCntnt] ); if( !pHistory ) pHistory = new SwHistory; SwRegHistory aRHst( *pTxtNd, pHistory ); @@ -108,7 +108,7 @@ sal_Bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, // Is the node a TextNode at all? SwTxtNode * pDelTxtNd = rPos.nNode.GetNode().GetTxtNode(); if( !pDelTxtNd || - ( pDelTxtNd->GetTxt().Len() != rPos.nContent.GetIndex() && + (pDelTxtNd->GetTxt().getLength() != rPos.nContent.GetIndex() && rPos.nContent.GetIndex() != ( nSttCntnt + aInsStr.Len() ))) return sal_False; @@ -142,9 +142,9 @@ sal_Bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, // both 'overwrites' can be combined so 'move' the corresponding character if( !bInsChar ) { - if( rPos.nContent.GetIndex() < pDelTxtNd->GetTxt().Len() ) + if (rPos.nContent.GetIndex() < pDelTxtNd->GetTxt().getLength()) { - aDelStr.Insert( pDelTxtNd->GetTxt().GetChar(rPos.nContent.GetIndex()) ); + aDelStr.Insert(pDelTxtNd->GetTxt()[rPos.nContent.GetIndex()]); rPos.nContent++; } else @@ -388,7 +388,7 @@ void SwUndoTransliterate::AddChanges( SwTxtNode& rTNd, long nOffsLen = rOffsets.getLength(); _UndoTransliterate_Data* pNew = new _UndoTransliterate_Data( rTNd.GetIndex(), nStart, (xub_StrLen)nOffsLen, - rTNd.GetTxt().Copy( nStart, nLen )); + rTNd.GetTxt().copy(nStart, nLen)); aChanges.push_back( pNew ); @@ -442,7 +442,7 @@ void SwUndoTransliterate::AddChanges( SwTxtNode& rTNd, pNew->pHistory = new SwHistory; SwRegHistory aRHst( rTNd, pNew->pHistory ); pNew->pHistory->CopyAttr( rTNd.GetpSwpHints(), - pNew->nNdIdx, 0, rTNd.GetTxt().Len(), false ); + pNew->nNdIdx, 0, rTNd.GetTxt().getLength(), false ); } break; } diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 141472dfb110..fd7525d9640f 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -150,7 +150,7 @@ SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId ) nSttNode == nEndNode && nSttCntnt + 1 == nEndCntnt && 0 != (pTNd = rRange.GetNode()->GetTxtNode()) ) { - sal_Unicode cCh = pTNd->GetTxt().GetChar( nSttCntnt ); + sal_Unicode const cCh = pTNd->GetTxt()[nSttCntnt]; if( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh ) { bCanGroup = sal_True; diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index aa9ddcfc56b6..79e069fe0259 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -234,7 +234,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, sal_uLong nNode ) { RemoveIdxRel( nNode + 1, SwPosition( aIdx, - SwIndex( pTxtNd, pTxtNd->GetTxt().Len() ))); + SwIndex(pTxtNd, pTxtNd->GetTxt().getLength()))); } pTxtNd->JoinNext(); @@ -256,7 +256,7 @@ SwUndoInsSection::SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart) m_pHistory.reset( new SwHistory ); } m_pHistory->CopyAttr( pTxtNd->GetpSwpHints(), pTxtNd->GetIndex(), 0, - pTxtNd->GetTxt().Len(), false ); + pTxtNd->GetTxt().getLength(), false ); } if (bAtStart) diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx index 9d57ba5d5244..59634e2c2ed9 100644 --- a/sw/source/core/undo/unsort.cxx +++ b/sw/source/core/undo/unsort.cxx @@ -227,7 +227,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext) SwTxtNode const*const pTNd = rPam.GetNode()->GetTxtNode(); if( pTNd ) { - rPam.GetPoint()->nContent = pTNd->GetTxt().Len(); + rPam.GetPoint()->nContent = pTNd->GetTxt().getLength(); } } } diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index 4f622be818dc..e65b15a17c85 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -47,7 +47,7 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, { pHistory = new SwHistory; pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nNode, 0, - pTxtNd->GetTxt().Len(), false ); + pTxtNd->GetTxt().getLength(), false ); if( !pHistory->Count() ) DELETEZ( pHistory ); } @@ -111,7 +111,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext) if( pTNd ) { rPam.GetPoint()->nNode = *pTNd; - rPam.GetPoint()->nContent.Assign( pTNd, pTNd->GetTxt().Len() ); + rPam.GetPoint()->nContent.Assign(pTNd, pTNd->GetTxt().getLength()); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) { @@ -130,7 +130,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext) { rPam.GetPoint()->nContent = 0; rPam.SetMark(); - rPam.GetPoint()->nContent = pTNd->GetTxt().Len(); + rPam.GetPoint()->nContent = pTNd->GetTxt().getLength(); pDoc->RstTxtAttrs( rPam, true ); pHistory->TmpRollback( pDoc, 0, false ); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 46e0ad6ca7bb..f75ad8ec88ad 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -372,7 +372,7 @@ SwTblToTxtSave::SwTblToTxtSave( SwDoc& rDoc, sal_uLong nNd, sal_uLong nEndIdx, x if ( pNd->GetpSwpHints() ) { m_pHstry->CopyAttr( pNd->GetpSwpHints(), nNd, 0, - pNd->GetTxt().Len(), false ); + pNd->GetTxt().getLength(), false ); } if( pNd->HasSwAttrSet() ) m_pHstry->CopyFmtAttr( *pNd->GetpSwAttrSet(), nNd ); @@ -571,7 +571,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, aBkmkArr.clear(); if( pTxtNd ) _SaveCntntIdx( GetDoc(), aSttIdx.GetIndex(), - pTxtNd->GetTxt().Len(), aBkmkArr ); + pTxtNd->GetTxt().getLength(), aBkmkArr ); } if( pTxtNd ) @@ -779,7 +779,7 @@ void SwUndoTxtToTbl::UndoImpl(::sw::UndoRedoContext & rContext) aPam.GetPoint()->nContent.Assign( 0, 0 ); // than move, relatively, the Crsr/etc. again - pPos->nContent.Assign( pTxtNd, pTxtNd->GetTxt().Len() ); + pPos->nContent.Assign(pTxtNd, pTxtNd->GetTxt().getLength()); RemoveIdxRel( nEndNode + 1, *pPos ); pTxtNd->JoinNext(); @@ -2018,7 +2018,7 @@ CHECKTABLE(pTblNd->GetTable()) // also delete not needed attributes SwIndex aTmpIdx( pTxtNd, nDelPos ); if( pTxtNd->GetpSwpHints() && pTxtNd->GetpSwpHints()->Count() ) - pTxtNd->RstAttr( aTmpIdx, pTxtNd->GetTxt().Len() - + pTxtNd->RstAttr(aTmpIdx, pTxtNd->GetTxt().getLength() - nDelPos + 1 ); // delete separator pTxtNd->EraseText( aTmpIdx, 1 ); @@ -2147,7 +2147,7 @@ SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox, // always save all text atttibutes because of possibly overlapping // areas of on/off pHistory->CopyAttr( pTNd->GetpSwpHints(), nNdPos, 0, - pTNd->GetTxt().Len(), true ); + pTNd->GetTxt().getLength(), true ); if( pTNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pTNd->GetpSwAttrSet(), nNdPos ); @@ -2718,7 +2718,7 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, pTxt = aInsertEnd.nNode.GetNode().GetTxtNode(); if( pTxt ) { - aInsertEnd.nContent.Assign( pTxt, pTxt->GetTxt().Len() ); + aInsertEnd.nContent.Assign(pTxt, pTxt->GetTxt().getLength()); if( !bRedo && rPos.nNode.GetNode().GetTxtNode() ) { // Try to merge, if not called by Redo() rJoin = true; @@ -2740,7 +2740,7 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, SwPosition aCellEnd( SwNodeIndex( *rBox.GetSttNd()->EndOfSectionNode(), -1 ) ); pTxt = aCellEnd.nNode.GetNode().GetTxtNode(); if( pTxt ) - aCellEnd.nContent.Assign( pTxt, pTxt->GetTxt().Len() ); + aCellEnd.nContent.Assign(pTxt, pTxt->GetTxt().getLength()); if( aDeleteStart != aCellEnd ) { // If the old (deleted) part is not empty, here we are... SwPaM aDeletePam( aDeleteStart, aCellEnd ); diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index b2857c90b0bc..3667f7b25dba 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -44,7 +44,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam ) { pTxtFmtColl = pTxtNd->GetTxtColl(); pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nSttNode, - 0, pTxtNd->GetTxt().Len(), false ); + 0, pTxtNd->GetTxt().getLength(), false ); if( pTxtNd->HasSwAttrSet() ) pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nSttNode ); @@ -163,7 +163,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) if( nSttNode != nEndNode ) { SwTxtNode* pTxtNd = pDoc->GetNodes()[ nEndNode ]->GetTxtNode(); - if( pTxtNd && pTxtNd->GetTxt().Len() == nEndCntnt ) + if (pTxtNd && pTxtNd->GetTxt().getLength() == nEndCntnt) pLastNdColl = pTxtNd->GetTxtColl(); } @@ -223,7 +223,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) { { RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx, - SwIndex( pTxtNode, pTxtNode->GetTxt().Len() ))); + SwIndex(pTxtNode, pTxtNode->GetTxt().getLength()))); } pTxtNode->JoinNext(); } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index f172d779e9c8..ef6251cfa673 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1125,7 +1125,7 @@ bool DocInsertStringSplitCR( return false; } const xub_StrLen nMaxLength = ( pTxtNd ) - ? STRING_LEN - pTxtNd->GetTxt().Len() + ? STRING_LEN - pTxtNd->GetTxt().getLength() : STRING_LEN; xub_StrLen nIdx = rText.Search( '\r', nStartIdx ); if( ( nIdx == STRING_NOTFOUND && nMaxLength < rText.Len() ) || diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 6895f915a3e6..851ef6851ff6 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -393,7 +393,7 @@ void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam, ? rStart.nContent.GetIndex() : 0; const xub_StrLen nEnd = (n == nEndNd) ? rEnd.nContent.GetIndex() - : static_cast<SwTxtNode*>(pNd)->GetTxt().Len(); + : static_cast<SwTxtNode*>(pNd)->GetTxt().getLength(); static_cast<SwTxtNode*>(pNd)->GetAttr( *pSet, nStart, nEnd, bOnlyTxtAttr, bGetFromChrFmt); } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 1331438a43b0..d0d7c8071297 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -260,7 +260,7 @@ bool SwXParagraph::SelectPaM(SwPaM & rPaM) *rPaM.GetPoint() = SwPosition( *pTxtNode ); // set selection to the whole paragraph rPaM.SetMark(); - rPaM.GetMark()->nContent = pTxtNode->GetTxt().Len(); + rPaM.GetMark()->nContent = pTxtNode->GetTxt().getLength(); return true; } @@ -1247,7 +1247,7 @@ throw (uno::RuntimeException) aCursor.MovePara(fnParaCurr, fnParaStart); } SwUnoCursorHelper::SelectPam(aCursor, true); - if (pTxtNode->GetTxt().Len()) { + if (pTxtNode->GetTxt().getLength()) { aCursor.MovePara(fnParaCurr, fnParaEnd); } SwUnoCursorHelper::SetString(aCursor, aString); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 412a76d5d761..9fcc536cdd67 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -51,6 +51,7 @@ #include <fmtfld.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <comphelper/string.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <set> @@ -251,7 +252,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( pUnoCrsr->Add(this); OSL_ENSURE(nEnd == -1 || (nStart <= nEnd && - nEnd <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len()), + nEnd <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().getLength()), "start or end value invalid!"); // find all frames, graphics and OLEs that are bound AT character in para @@ -313,8 +314,8 @@ lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr, const sal_Unicode fld[] = { CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, CH_TXT_ATR_FORMELEMENT, 0 }; - xub_StrLen pos = ::std::max(static_cast<const sal_Int32>(0), i_nStartPos); - while ((pos = pTxtNode->GetTxt().SearchChar(fld, pos)) != STRING_NOTFOUND) + sal_Int32 pos = ::std::max(static_cast<const sal_Int32>(0), i_nStartPos); + while ((pos = ::comphelper::string::indexOfAny(pTxtNode->GetTxt(), fld, pos)) != -1) { rFieldMarks.push_back(pos); ++pos; @@ -363,7 +364,7 @@ lcl_ExportFieldMark( return 0; } - const sal_Unicode Char = pTxtNode->GetTxt().GetChar(start); + const sal_Unicode Char = pTxtNode->GetTxt()[start]; if (CH_TXT_ATR_FIELDSTART == Char) { ::sw::mark::IFieldmark* pFieldmark = NULL; @@ -1083,7 +1084,7 @@ lcl_CreatePortions( pUnoCrsr->DeleteMark(); OSL_ENSURE(pUnoCrsr->Start()->nNode.GetNode().GetTxtNode() && (i_nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()-> - GetTxt().Len()), "Incorrect start position" ); + GetTxt().getLength()), "Incorrect start position" ); // ??? should this be i_nStartPos - current position ? pUnoCrsr->Right(static_cast<xub_StrLen>(i_nStartPos), CRSR_SKIP_CHARS, sal_False, sal_False); diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 3f6847a57be0..42a0b21f8620 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -131,8 +131,7 @@ sal_uLong SwASCWriter::WriteStream() // Should we have frames only? // That's possible, if we put a frame selection into the clipboard if( bTstFly && bWriteAll && - // No length - !pNd->GetTxt().Len() && + pNd->GetTxt().isEmpty() && // Frame exists pDoc->GetSpzFrmFmts()->size() && // Only one node in the array diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 53bf7e94c85b..3213bfc30517 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -619,7 +619,7 @@ void SwHTMLParser::InsertComment( const String& rComment, const sal_Char *pTag ) xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex(); SwTxtNode *pTxtNd = pPam->GetNode()->GetTxtNode(); sal_Bool bMoveFwd = sal_False; - if( nPos>0 && pTxtNd && ' '==pTxtNd->GetTxt().GetChar(nPos-1) ) + if (nPos>0 && pTxtNd && (' ' == pTxtNd->GetTxt()[nPos-1])) { bMoveFwd = sal_True; diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 41e740f014ab..636f626e3e84 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -1396,7 +1396,7 @@ void SwHTMLParser::StripTrailingPara() { --nPos; bSetSmallFont = - (CH_TXTATR_BREAKWORD == pTxtNd->GetTxt().GetChar( nPos )) && + (CH_TXTATR_BREAKWORD == pTxtNd->GetTxt()[nPos]) && (0 != pTxtNd->GetTxtAttrForCharAt( nPos, RES_TXTATR_FLYCNT )); } } diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 9097bd9b32d2..b0b96f240461 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2951,7 +2951,7 @@ xub_StrLen SwHTMLParser::StripTrailingLF() { xub_StrLen nPos = nLen; xub_StrLen nLFCount = 0; - while( nPos && '\x0a' == (pTxtNd->GetTxt()).GetChar(--nPos) ) + while (nPos && ('\x0a' == pTxtNd->GetTxt()[--nPos])) nLFCount++; if( nLFCount ) @@ -3426,8 +3426,8 @@ void _CellSaveStruct::CheckNoBreak( const SwPosition& rPos, SwDoc * /*pDoc*/ ) SwTxtNode const*const pTxtNd(rPos.nNode.GetNode().GetTxtNode()); if( pTxtNd ) { - sal_Unicode cLast = - pTxtNd->GetTxt().GetChar(nNoBreakEndCntntPos); + sal_Unicode const cLast = + pTxtNd->GetTxt()[nNoBreakEndCntntPos]; if( ' '==cLast || '\x0a'==cLast ) { // Zwischem dem </NOBR> und dem Zellen-Ende gibt es nur diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e15229d5d421..4322e9815752 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -696,7 +696,7 @@ void SwHTMLParser::Continue( int nToken ) SwNodeIndex aNxtIdx( *pSttNdIdx ); if( pTxtNode && pTxtNode->CanJoinNext( &aNxtIdx )) { - xub_StrLen nStt = pTxtNode->GetTxt().Len(); + xub_StrLen nStt = pTxtNode->GetTxt().getLength(); // wenn der Cursor noch in dem Node steht, dann setze in an das Ende if( pPam->GetPoint()->nNode == aNxtIdx ) { @@ -715,18 +715,18 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_True ).nNode.GetIndex() ) { xub_StrLen nCntPos = pPam->GetBound( sal_True ).nContent.GetIndex(); pPam->GetBound( sal_True ).nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() + nCntPos ); + pTxtNode->GetTxt().getLength() + nCntPos ); } if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_False ).nNode.GetIndex() ) { xub_StrLen nCntPos = pPam->GetBound( sal_False ).nContent.GetIndex(); pPam->GetBound( sal_False ).nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() + nCntPos ); + pTxtNode->GetTxt().getLength() + nCntPos ); } #endif // Zeichen Attribute beibehalten! SwTxtNode* pDelNd = aNxtIdx.GetNode().GetTxtNode(); - if( pTxtNode->GetTxt().Len() ) + if (pTxtNode->GetTxt().getLength()) pDelNd->FmtToTxtAttr( pTxtNode ); else pTxtNode->ChgFmtColl( pDelNd->GetTxtColl() ); @@ -793,7 +793,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_False ).nNode.GetIndex() ) pPam->SetMark(); pPam->DeleteMark(); pNextNd->JoinPrev(); } - else if( !pAktNd->GetTxt().Len() ) + else if (pAktNd->GetTxt().isEmpty()) { pPos->nContent.Assign( 0, 0 ); pPam->SetMark(); pPam->DeleteMark(); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index cae9fe2d25fd..ad43cc9879fb 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -120,13 +120,13 @@ sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& rPa { aPam.GetPoint()->nNode = *pSttNdIdx; aPam.GetPoint()->nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() ); + pTxtNode->GetTxt().getLength() ); } // If the first new node isn't empty, convert the node's text // attributes into hints. Otherwise, set the new node's // paragraph style at the previous (empty) node. SwTxtNode* pDelNd = aNxtIdx.GetNode().GetTxtNode(); - if( pTxtNode->GetTxt().Len() ) + if (pTxtNode->GetTxt().getLength()) pDelNd->FmtToTxtAttr( pTxtNode ); else pTxtNode->ChgFmtColl( pDelNd->GetTxtColl() ); diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 13c997adc675..99b332de3bf2 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -951,10 +951,11 @@ SwFltShell::SwFltShell(SwDoc* pDoc, SwPaM& rPaM, const String& rBaseURL, sal_Boo const SwPosition* pPos = pPaM->GetPoint(); const SwTxtNode* pSttNd = pPos->nNode.GetNode().GetTxtNode(); sal_uInt16 nCntPos = pPos->nContent.GetIndex(); - if( nCntPos && pSttNd->GetTxt().Len() ) + if (nCntPos && !pSttNd->GetTxt().isEmpty()) // EinfuegePos nicht in leerer Zeile pDoc->SplitNode( *pPos, false ); // neue Zeile erzeugen - if( pSttNd->GetTxt().Len() ){ // EinfuegePos nicht am Ende der Zeile + if (!pSttNd->GetTxt().isEmpty()) + { // InsertPos not on empty line pDoc->SplitNode( *pPos, false ); // neue Zeile pPaM->Move( fnMoveBackward ); // gehe in leere Zeile } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d19e26052fac..9d3994fe308e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2950,17 +2950,17 @@ void SwWW8ImplReader::simpleAddTextToParagraph(const String& rAddString) if (!pNd) return; - if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN-1) + if ((pNd->GetTxt().getLength() + rAddString.Len()) < STRING_MAXLEN-1) { rDoc.InsertString(*pPaM, rAddString); } else { - if (pNd->GetTxt().Len()< STRING_MAXLEN -1) + if (pNd->GetTxt().getLength() < STRING_MAXLEN -1) { String sTempStr (rAddString,0, - STRING_MAXLEN - pNd->GetTxt().Len() -1); + STRING_MAXLEN - pNd->GetTxt().getLength() -1); rDoc.InsertString(*pPaM, sTempStr); sTempStr = rAddString.Copy(sTempStr.Len(), rAddString.Len() - sTempStr.Len()); @@ -3022,7 +3022,8 @@ bool SwWW8ImplReader::HandlePageBreakChar() //xushanchuan add for issue106569 bool IsTemp=true; SwTxtNode* pTemp = pPaM->GetNode()->GetTxtNode(); - if ( pTemp && !( pTemp->GetTxt().Len() ) && ( bFirstPara || bFirstParaOfPage ) ) + if (pTemp && pTemp->GetTxt().isEmpty() + && (bFirstPara || bFirstParaOfPage)) { IsTemp = false; AppendTxtNode(*pPaM->GetPoint()); @@ -3479,7 +3480,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) if (pPreviousNode && bStartLine) { SwTxtNode* pEndNd = pPaM->GetNode()->GetTxtNode(); - const xub_StrLen nDropCapLen = pPreviousNode->GetTxt().Len(); + const xub_StrLen nDropCapLen = pPreviousNode->GetTxt().getLength(); // Need to reset the font size and text position for the dropcap { @@ -4509,10 +4510,10 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) sal_uInt16 nCntPos = pPos->nContent.GetIndex(); // EinfuegePos nicht in leerer Zeile - if( nCntPos && pSttNd->GetTxt().Len() ) + if (nCntPos && pSttNd->GetTxt().getLength()) rDoc.SplitNode( *pPos, false ); // neue Zeile erzeugen - if( pSttNd->GetTxt().Len() ) + if (pSttNd->GetTxt().getLength()) { // EinfuegePos nicht am Ende der Zeile rDoc.SplitNode( *pPos, false ); // neue Zeile pPaM->Move( fnMoveBackward ); // gehe in leere Zeile diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index bc8dd2e1fe48..e5dc94e5f45a 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -354,7 +354,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() //There should have been a footnote char, we will replace this. if (pTxt && nPos) { - sChar.Append(pTxt->GetTxt().GetChar(--nPos)); + sChar.Append(pTxt->GetTxt()[--nPos]); pPaM->SetMark(); pPaM->GetMark()->nContent--; rDoc.DeleteRange( *pPaM ); @@ -400,14 +400,14 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() SwNodeIndex& rNIdx = pPaM->GetPoint()->nNode; rNIdx = pSttIdx->GetIndex() + 1; SwTxtNode* pTNd = rNIdx.GetNode().GetTxtNode(); - if (pTNd && pTNd->GetTxt().Len() && sChar.Len()) + if (pTNd && !pTNd->GetTxt().isEmpty() && sChar.Len()) { - if (pTNd->GetTxt().GetChar(0) == sChar.GetChar(0)) + if (pTNd->GetTxt()[0] == sChar.GetChar(0)) { pPaM->GetPoint()->nContent.Assign( pTNd, 0 ); pPaM->SetMark(); // Strip out tabs we may have inserted on export #i24762# - if (pTNd->GetTxt().GetChar(1) == 0x09) + if (pTNd->GetTxt()[1] == 0x09) pPaM->GetMark()->nContent++; pPaM->GetMark()->nContent++; pReffingStck->Delete(*pPaM); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 658a0f069425..39c8939b2f25 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2190,7 +2190,7 @@ SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrmFmt *pFlyFmt, { SwTxtNode *pNd = aIdx.GetNode().GetTxtNode(); ++aIdx; - if (aIdx == aEnd && pNd && !pNd->GetTxt().Len()) + if (aIdx == aEnd && pNd && pNd->GetTxt().isEmpty()) { //An extra pre-created by writer unused paragraph // @@ -2367,7 +2367,7 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr) { maSectionManager.JoinNode(*rPam.GetPoint(), aPref.GetNode()); rPam.GetPoint()->nNode = aPref; - rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().Len()); + rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().getLength()); if (bStealAttr) pCtrlStck->StealAttr(rPam.GetPoint()->nNode); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index e45dc1cc82d2..558fbb70ab2f 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -765,7 +765,7 @@ void SwXMLImport::endDocument( void ) { pPaM->GetPoint()->nNode = *pSttNdIdx; pPaM->GetPoint()->nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() ); + pTxtNode->GetTxt().getLength()); } #if OSL_DEBUG_LEVEL > 0 @@ -783,7 +783,7 @@ void SwXMLImport::endDocument( void ) sal_uInt16 nCntPos = pPaM->GetBound( sal_True ).nContent.GetIndex(); pPaM->GetBound( sal_True ).nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() + nCntPos ); + pTxtNode->GetTxt().getLength() + nCntPos ); } if( pSttNdIdx->GetIndex()+1 == pPaM->GetBound( sal_False ).nNode.GetIndex() ) @@ -791,14 +791,14 @@ void SwXMLImport::endDocument( void ) sal_uInt16 nCntPos = pPaM->GetBound( sal_False ).nContent.GetIndex(); pPaM->GetBound( sal_False ).nContent.Assign( pTxtNode, - pTxtNode->GetTxt().Len() + nCntPos ); + pTxtNode->GetTxt().getLength() + nCntPos ); } #endif // If the first new node isn't empty, convert the node's text // attributes into hints. Otherwise, set the new node's // paragraph style at the previous (empty) node. SwTxtNode* pDelNd = aNxtIdx.GetNode().GetTxtNode(); - if( pTxtNode->GetTxt().Len() ) + if (!pTxtNode->GetTxt().isEmpty()) pDelNd->FmtToTxtAttr( pTxtNode ); else pTxtNode->ChgFmtColl( pDelNd->GetTxtColl() ); @@ -853,7 +853,7 @@ void SwXMLImport::endDocument( void ) pNextNd->JoinPrev(); } } - else if( !pCurrNd->GetTxt().Len() ) + else if (pCurrNd->GetTxt().isEmpty()) { pPos->nContent.Assign( 0, 0 ); pPaM->SetMark(); pPaM->DeleteMark(); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index d35254d0c7fb..66d3402c17d7 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2114,7 +2114,8 @@ SwTableBox *SwXMLTableContext::MakeTableBox( SAL_WARN_IF(!pTxtNode, "sw", "Should have a text node in cell?"); if (pTxtNode) { - SAL_WARN_IF(pTxtNode->GetTxt().Len(), "sw", "why text here?"); + SAL_WARN_IF(!pTxtNode->GetTxt().isEmpty(), "sw", + "why text here?"); pTxtNode->InsertText(*pCell->GetStringValue(), SwIndex(pTxtNode, 0)); } diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 76f6991609c1..af559acb2025 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -191,9 +191,9 @@ void SwView::ExecLingu(SfxRequest &rReq) { SwTxtNode *pTxtNode = aPointNodeIndex.GetNode().GetTxtNode(); // check for unexpected error case - OSL_ENSURE( pTxtNode && pTxtNode->GetTxt().Len() >= nPointIndex, + OSL_ENSURE(pTxtNode && pTxtNode->GetTxt().getLength() >= nPointIndex, "text missing: corrupted node?" ); - if (!pTxtNode || pTxtNode->GetTxt().Len() < nPointIndex) + if (!pTxtNode || pTxtNode->GetTxt().getLength() < nPointIndex) nPointIndex = 0; // restore cursor to its original position pWrtShell->GetCrsr()->GetPoint()->nContent.Assign( pTxtNode, nPointIndex ); |