diff options
Diffstat (limited to 'vcl/source/edit')
-rw-r--r-- | vcl/source/edit/textdata.cxx | 26 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 58 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 34 |
3 files changed, 59 insertions, 59 deletions
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index a3b32c8287c8..841e5cc78433 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -164,9 +164,9 @@ sal_uInt16 TEParaPortion::GetLineNumber( sal_Int32 nChar, bool bInclEnd ) { for ( size_t nLine = 0; nLine < maLines.size(); nLine++ ) { - TextLine& pLine = maLines[ nLine ]; - if ( ( bInclEnd && ( pLine.GetEnd() >= nChar ) ) || - ( pLine.GetEnd() > nChar ) ) + TextLine& rLine = maLines[ nLine ]; + if ( ( bInclEnd && ( rLine.GetEnd() >= nChar ) ) || + ( rLine.GetEnd() > nChar ) ) { return nLine; } @@ -184,10 +184,10 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" ); if ( nLastFormattedLine < ( nLines - 1 ) ) { - const TextLine& pLastFormatted = maLines[ nLastFormattedLine ]; - const TextLine& pUnformatted = maLines[ nLastFormattedLine+1 ]; - short nPortionDiff = pUnformatted.GetStartPortion() - pLastFormatted.GetEndPortion(); - sal_Int32 nTextDiff = pUnformatted.GetStart() - pLastFormatted.GetEnd(); + const TextLine& rLastFormatted = maLines[ nLastFormattedLine ]; + const TextLine& rUnformatted = maLines[ nLastFormattedLine+1 ]; + short nPortionDiff = rUnformatted.GetStartPortion() - rLastFormatted.GetEndPortion(); + sal_Int32 nTextDiff = rUnformatted.GetStart() - rLastFormatted.GetEnd(); nTextDiff++; // LastFormatted.GetEnd() was inclusive => subtracted one too much! // The first unformatted one has to start exactly one portion past the last @@ -199,15 +199,15 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat { for ( sal_uInt16 nL = nLastFormattedLine+1; nL < nLines; nL++ ) { - TextLine& pLine = maLines[ nL ]; + TextLine& rLine = maLines[ nL ]; - pLine.GetStartPortion() = pLine.GetStartPortion() + nPDiff; - pLine.GetEndPortion() = pLine.GetEndPortion() + nPDiff; + rLine.GetStartPortion() = rLine.GetStartPortion() + nPDiff; + rLine.GetEndPortion() = rLine.GetEndPortion() + nPDiff; - pLine.GetStart() = pLine.GetStart() + nTDiff; - pLine.GetEnd() = pLine.GetEnd() + nTDiff; + rLine.GetStart() = rLine.GetStart() + nTDiff; + rLine.GetEnd() = rLine.GetEnd() + nTDiff; - pLine.SetValid(); + rLine.SetValid(); } } } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 40a47719a242..af3425b30d9d 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -270,8 +270,8 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const const size_t nLines = pTEParaPortion->GetLines().size(); for ( size_t nL = 0; nL < nLines; ++nL ) { - TextLine& pLine = pTEParaPortion->GetLines()[nL]; - aText += pTEParaPortion->GetNode()->GetText().copy( pLine.GetStart(), pLine.GetEnd() - pLine.GetStart() ); + TextLine& rLine = pTEParaPortion->GetLines()[nL]; + aText += pTEParaPortion->GetNode()->GetText().copy( rLine.GetStart(), rLine.GetEnd() - rLine.GetStart() ); if ( pSep && ( ( (nP+1) < nParas ) || ( (nL+1) < nLines ) ) ) aText += pSep; } @@ -895,14 +895,14 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP TextLine* pLine = nullptr; for ( size_t nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { - TextLine& pTmpLine = pPortion->GetLines()[ nLine ]; - if ( ( pTmpLine.GetStart() == rPaM.GetIndex() ) || ( pTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) ) + TextLine& rTmpLine = pPortion->GetLines()[ nLine ]; + if ( ( rTmpLine.GetStart() == rPaM.GetIndex() ) || ( rTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) ) { - pLine = &pTmpLine; + pLine = &rTmpLine; break; } - nCurIndex = nCurIndex + pTmpLine.GetLen(); + nCurIndex = nCurIndex + rTmpLine.GetLen(); nY += mnCharHeight; } if ( !pLine ) @@ -1076,11 +1076,11 @@ sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara sal_uInt16 nLine; for ( nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { - TextLine& pTmpLine = pPortion->GetLines()[ nLine ]; + TextLine& rmpLine = pPortion->GetLines()[ nLine ]; nY += mnCharHeight; if ( nY > rPosInPara.Y() ) // that's it { - pLine = &pTmpLine; + pLine = &rmpLine; break; // correct Y-Position not needed } } @@ -1103,15 +1103,15 @@ sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nX { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); - TextLine& pLine = pPortion->GetLines()[ nLine ]; + TextLine& rLine = pPortion->GetLines()[ nLine ]; - sal_Int32 nCurIndex = pLine.GetStart(); + sal_Int32 nCurIndex = rLine.GetStart(); - long nTmpX = pLine.GetStartX(); + long nTmpX = rLine.GetStartX(); if ( nXPos <= nTmpX ) return nCurIndex; - for ( sal_uInt16 i = pLine.GetStartPortion(); i <= pLine.GetEndPortion(); i++ ) + for ( sal_uInt16 i = rLine.GetStartPortion(); i <= rLine.GetEndPortion(); i++ ) { TETextPortion* pTextPortion = pPortion->GetTextPortions()[ i ]; nTmpX += pTextPortion->GetWidth(); @@ -1165,8 +1165,8 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara ) for ( auto nLine = pPortion->GetLines().size(); nLine; ) { long nLineWidth = 0; - TextLine& pLine = pPortion->GetLines()[ --nLine ]; - for ( sal_uInt16 nTP = pLine.GetStartPortion(); nTP <= pLine.GetEndPortion(); nTP++ ) + TextLine& rLine = pPortion->GetLines()[ --nLine ]; + for ( sal_uInt16 nTP = rLine.GetStartPortion(); nTP <= rLine.GetEndPortion(); nTP++ ) { TETextPortion* pTextPortion = pPortion->GetTextPortions()[ nTP ]; nLineWidth += pTextPortion->GetWidth(); @@ -1274,8 +1274,8 @@ Range TextEngine::GetInvalidYOffsets( sal_uInt32 nPortion ) sal_uInt16 nLine; for ( nLine = 0; nLine < nLines; nLine++ ) { - TextLine& pL = pTEParaPortion->GetLines()[ nLine ]; - if ( pL.IsInvalid() ) + TextLine& rL = pTEParaPortion->GetLines()[ nLine ]; + if ( rL.IsInvalid() ) { nFirstInvalid = nLine; break; @@ -1284,8 +1284,8 @@ Range TextEngine::GetInvalidYOffsets( sal_uInt32 nPortion ) for ( nLastInvalid = nFirstInvalid; nLastInvalid < nLines; nLastInvalid++ ) { - TextLine& pL = pTEParaPortion->GetLines()[ nLine ]; - if ( pL.IsValid() ) + TextLine& rL = pTEParaPortion->GetLines()[ nLine ]; + if ( rL.IsValid() ) break; } @@ -1942,18 +1942,18 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan { // for all lines of the paragraph sal_Int32 nIndex = 0; - for ( auto &pLine : pPortion->GetLines() ) + for ( auto & rLine : pPortion->GetLines() ) { - Point aTmpPos( rStartPos.X() + pLine.GetStartX(), nY ); + Point aTmpPos( rStartPos.X() + rLine.GetStartX(), nY ); if ( ( !pPaintArea || ( ( nY + mnCharHeight ) > pPaintArea->Top() ) ) && ( !pPaintRange || ( - ( TextPaM( nPara, pLine.GetStart() ) < pPaintRange->GetEnd() ) && - ( TextPaM( nPara, pLine.GetEnd() ) > pPaintRange->GetStart() ) ) ) ) + ( TextPaM( nPara, rLine.GetStart() ) < pPaintRange->GetEnd() ) && + ( TextPaM( nPara, rLine.GetEnd() ) > pPaintRange->GetStart() ) ) ) ) { // for all Portions of the line - nIndex = pLine.GetStart(); - for ( sal_uInt16 y = pLine.GetStartPortion(); y <= pLine.GetEndPortion(); y++ ) + nIndex = rLine.GetStart(); + for ( sal_uInt16 y = rLine.GetStartPortion(); y <= rLine.GetEndPortion(); y++ ) { OSL_ENSURE(pPortion->GetTextPortions().size(), "ImpPaint: Line without Textportion!"); @@ -1963,7 +1963,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan ImpInitLayoutMode( pOutDev /*, pTextPortion->IsRightToLeft() */); long nTxtWidth = pTextPortion->GetWidth(); - aTmpPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nIndex, nIndex ); + aTmpPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &rLine, nIndex, nIndex ); // only print if starting in the visible region if ( ( ( aTmpPos.X() + nTxtWidth ) >= 0 ) @@ -2015,7 +2015,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan { const sal_Int32 nL = pSelStart->GetIndex() - nTmpIndex; pOutDev->SetFont( aFont); - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nTmpIndex+nL ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &rLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); nTmpIndex = nTmpIndex + nL; @@ -2029,7 +2029,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan Color aOldTextColor = pOutDev->GetTextColor(); pOutDev->SetTextColor( rStyleSettings.GetHighlightTextColor() ); pOutDev->SetTextFillColor( rStyleSettings.GetHighlightColor() ); - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nTmpIndex+nL ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &rLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); pOutDev->SetTextColor( aOldTextColor ); pOutDev->SetTextFillColor(); @@ -2040,7 +2040,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan if ( nTmpIndex < nEnd ) { nL = nEnd-nTmpIndex; - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nTmpIndex+nL ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &rLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex ); } bDone = true; @@ -2048,7 +2048,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan } if ( !bDone ) { - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nEnd ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &rLine, nTmpIndex, nEnd ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex ); } } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 038f122bd83d..daaf4f480b29 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -367,9 +367,9 @@ void TextView::ImpHighlight( const TextSelection& rSel ) // iterate over all lines for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ ) { - TextLine& pLine = pTEParaPortion->GetLines()[ nLine ]; - sal_Int32 nStartIndex = pLine.GetStart(); - sal_Int32 nEndIndex = pLine.GetEnd(); + TextLine& rLine = pTEParaPortion->GetLines()[ nLine ]; + sal_Int32 nStartIndex = rLine.GetStart(); + sal_Int32 nEndIndex = rLine.GetEnd(); if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) ) nStartIndex = aSel.GetStart().GetIndex(); if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) ) @@ -970,9 +970,9 @@ void TextView::Command( const CommandEvent& rCEvt ) TEParaPortion* pParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() ); sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex(), true ); - TextLine& pLine = pParaPortion->GetLines()[ nLine ]; - if ( nInputEnd > pLine.GetEnd() ) - nInputEnd = pLine.GetEnd(); + TextLine& rLine = pParaPortion->GetLines()[ nLine ]; + if ( nInputEnd > rLine.GetEnd() ) + nInputEnd = rLine.GetEnd(); Rectangle aR2 = mpImpl->mpTextEngine->PaMtoEditCursor( TextPaM( aPaM.GetPara(), nInputEnd ) ); long nWidth = aR2.Left()-aR1.Right(); @@ -1462,8 +1462,8 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM ) // If we need to go to the end of a line that was wrapped automatically, // the cursor ends up at the beginning of the 2nd line // Problem: Last character of an automatically wrapped line = Cursor - TextLine& pLine = pPPortion->GetLines()[ nLine - 1 ]; - if ( aPaM.GetIndex() && ( aPaM.GetIndex() == pLine.GetEnd() ) ) + TextLine& rLine = pPPortion->GetLines()[ nLine - 1 ]; + if ( aPaM.GetIndex() && ( aPaM.GetIndex() == rLine.GetEnd() ) ) --aPaM.GetIndex(); } else if ( rPaM.GetPara() ) // previous paragraph @@ -1497,8 +1497,8 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX ); // special case CursorUp - TextLine& pLine = pPPortion->GetLines()[ nLine + 1 ]; - if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() ) + TextLine& rLine = pPPortion->GetLines()[ nLine + 1 ]; + if ( ( aPaM.GetIndex() == rLine.GetEnd() ) && ( aPaM.GetIndex() > rLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() ) --aPaM.GetIndex(); } else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1 ) ) // next paragraph @@ -1506,8 +1506,8 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) aPaM.GetPara()++; pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() ); aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), 0, nX+1 ); - TextLine& pLine = pPPortion->GetLines().front(); - if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && ( pPPortion->GetLines().size() > 1 ) ) + TextLine& rLine = pPPortion->GetLines().front(); + if ( ( aPaM.GetIndex() == rLine.GetEnd() ) && ( aPaM.GetIndex() > rLine.GetStart() ) && ( pPPortion->GetLines().size() > 1 ) ) --aPaM.GetIndex(); } @@ -1520,8 +1520,8 @@ TextPaM TextView::CursorStartOfLine( const TextPaM& rPaM ) TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() ); sal_uInt16 nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false ); - TextLine& pLine = pPPortion->GetLines()[ nLine ]; - aPaM.GetIndex() = pLine.GetStart(); + TextLine& rLine = pPPortion->GetLines()[ nLine ]; + aPaM.GetIndex() = rLine.GetStart(); return aPaM; } @@ -1532,10 +1532,10 @@ TextPaM TextView::CursorEndOfLine( const TextPaM& rPaM ) TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() ); sal_uInt16 nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false ); - TextLine& pLine = pPPortion->GetLines()[ nLine ]; - aPaM.GetIndex() = pLine.GetEnd(); + TextLine& rLine = pPPortion->GetLines()[ nLine ]; + aPaM.GetIndex() = rLine.GetEnd(); - if ( pLine.GetEnd() > pLine.GetStart() ) // empty line + if ( rLine.GetEnd() > rLine.GetStart() ) // empty line { sal_Unicode cLastChar = pPPortion->GetNode()->GetText()[ aPaM.GetIndex()-1 ]; if ( ( cLastChar == ' ' ) && ( aPaM.GetIndex() != pPPortion->GetNode()->GetText().getLength() ) ) |