diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2014-11-16 09:47:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-18 09:33:03 +0000 |
commit | 9e5a221f4e530873b19df1b280bb19124b8d8c68 (patch) | |
tree | e02c460d38c34fe46ac958c1a35fbf61fcf543e8 /vcl | |
parent | 2c1bf30bda6b914611134317b652402e4488fd03 (diff) |
fdo#75757 remove inheritance from std::vector
Removing TextLines class by the way
Change-Id: Ic491af976d61cac8e4b37857ff3a76570611d90d
Reviewed-on: https://gerrit.libreoffice.org/12474
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/edit/textdat2.hxx | 19 | ||||
-rw-r--r-- | vcl/source/edit/textdata.cxx | 30 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 87 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 34 |
4 files changed, 75 insertions, 95 deletions
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx index b5e211807cb7..2834f0852b82 100644 --- a/vcl/source/edit/textdat2.hxx +++ b/vcl/source/edit/textdat2.hxx @@ -24,7 +24,7 @@ #include <vcl/virdev.hxx> #include <vcl/cursor.hxx> -#include <vector> +#include <boost/ptr_container/ptr_vector.hpp> class TextNode; class TextView; @@ -162,15 +162,6 @@ public: inline bool operator != ( const TextLine& rLine ) const; }; -class TextLines : public std::vector<TextLine*> { -public: - ~TextLines() - { - for( iterator it = begin(); it != end(); ++it ) - delete *it; - } -}; - inline bool TextLine::operator == ( const TextLine& rLine ) const { return ( ( mnStart == rLine.mnStart ) && @@ -189,15 +180,15 @@ class TEParaPortion private: TextNode* mpNode; - TextLines maLines; + boost::ptr_vector<TextLine> maLines; TETextPortionList maTextPortions; std::vector<TEWritingDirectionInfo> maWritingDirectionInfos; - sal_uInt16 mnInvalidPosStart; + sal_uInt16 mnInvalidPosStart; short mnInvalidDiff; bool mbInvalid; - bool mbSimple; // nur lineares Tippen + bool mbSimple; // only type linearly TEParaPortion( const TEParaPortion& ) {;} @@ -217,7 +208,7 @@ public: short GetInvalidDiff() const { return mnInvalidDiff; } TextNode* GetNode() const { return mpNode; } - TextLines& GetLines() { return maLines; } + boost::ptr_vector<TextLine>& GetLines() { return maLines; } TETextPortionList& GetTextPortions() { return maTextPortions; } std::vector<TEWritingDirectionInfo>& GetWritingDirectionInfos() { return maWritingDirectionInfos; } diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index e6bebd2378b1..a6bd6ac224f0 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -163,16 +163,16 @@ sal_uInt16 TEParaPortion::GetLineNumber( sal_uInt16 nChar, bool bInclEnd ) { for ( sal_uInt16 nLine = 0; nLine < maLines.size(); nLine++ ) { - TextLine* pLine = maLines[ nLine ]; - if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) || - ( pLine->GetEnd() > nChar ) ) + TextLine& pLine = maLines[ nLine ]; + if ( ( bInclEnd && ( pLine.GetEnd() >= nChar ) ) || + ( pLine.GetEnd() > nChar ) ) { return nLine; } } // Then it should be at the end of the last line - OSL_ENSURE(nChar == maLines[maLines.size() - 1]->GetEnd(), "wrong Index"); + OSL_ENSURE(nChar == maLines.back().GetEnd(), "wrong Index"); OSL_ENSURE(!bInclEnd, "Line not found: FindLine"); return ( maLines.size() - 1 ); } @@ -183,11 +183,11 @@ 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(); - short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd(); - nTextDiff++; // LastFormatted->GetEnd() was inclusive => subtracted one too much! + const TextLine& pLastFormatted = maLines[ nLastFormattedLine ]; + const TextLine& pUnformatted = maLines[ nLastFormattedLine+1 ]; + short nPortionDiff = pUnformatted.GetStartPortion() - pLastFormatted.GetEndPortion(); + short nTextDiff = pUnformatted.GetStart() - pLastFormatted.GetEnd(); + nTextDiff++; // LastFormatted.GetEnd() was inclusive => subtracted one too much! // The first unformated one has to start exactly one portion past the last // formated one. @@ -198,15 +198,15 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat { for ( sal_uInt16 nL = nLastFormattedLine+1; nL < nLines; nL++ ) { - TextLine* pLine = maLines[ nL ]; + TextLine& pLine = maLines[ nL ]; - pLine->GetStartPortion() = pLine->GetStartPortion() + nPDiff; - pLine->GetEndPortion() = pLine->GetEndPortion() + nPDiff; + pLine.GetStartPortion() = pLine.GetStartPortion() + nPDiff; + pLine.GetEndPortion() = pLine.GetEndPortion() + nPDiff; - pLine->GetStart() = pLine->GetStart() + nTDiff; - pLine->GetEnd() = pLine->GetEnd() + nTDiff; + pLine.GetStart() = pLine.GetStart() + nTDiff; + pLine.GetEnd() = pLine.GetEnd() + nTDiff; - pLine->SetValid(); + pLine.SetValid(); } } } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 5be733f6d835..e4e06a672e1a 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -270,8 +270,8 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const sal_uInt16 nLines = pTEParaPortion->GetLines().size(); for ( sal_uInt16 nL = 0; nL < nLines; nL++ ) { - TextLine* pLine = pTEParaPortion->GetLines()[nL]; - aText += pTEParaPortion->GetNode()->GetText().copy( pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() ); + TextLine& pLine = pTEParaPortion->GetLines()[nL]; + aText += pTEParaPortion->GetNode()->GetText().copy( pLine.GetStart(), pLine.GetEnd() - pLine.GetStart() ); if ( pSep && ( ( (nP+1) < nParas ) || ( (nL+1) < nLines ) ) ) aText += pSep; } @@ -901,14 +901,14 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP TextLine* pLine = 0; for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { - TextLine* pTmpLine = pPortion->GetLines()[ nLine ]; - if ( ( pTmpLine->GetStart() == rPaM.GetIndex() ) || ( pTmpLine->IsIn( rPaM.GetIndex(), bSpecial ) ) ) + TextLine& pTmpLine = pPortion->GetLines()[ nLine ]; + if ( ( pTmpLine.GetStart() == rPaM.GetIndex() ) || ( pTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) ) { - pLine = pTmpLine; + pLine = &pTmpLine; break; } - nCurIndex = nCurIndex + pTmpLine->GetLen(); + nCurIndex = nCurIndex + pTmpLine.GetLen(); nY += mnCharHeight; } if ( !pLine ) @@ -916,7 +916,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP // Cursor at end of paragraph DBG_ASSERT( rPaM.GetIndex() == nCurIndex, "GetEditCursor: Bad Index!" ); - pLine = pPortion->GetLines().back(); + pLine = & ( pPortion->GetLines().back() ); nY -= mnCharHeight; nCurIndex = nCurIndex - pLine->GetLen(); } @@ -1083,11 +1083,11 @@ sal_uInt16 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara sal_uInt16 nLine; for ( nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { - TextLine* pTmpLine = pPortion->GetLines()[ nLine ]; + TextLine& pTmpLine = pPortion->GetLines()[ nLine ]; nY += mnCharHeight; if ( nY > rPosInPara.Y() ) // that's it { - pLine = pTmpLine; + pLine = &pTmpLine; break; // correct Y-Position not needed } } @@ -1097,7 +1097,7 @@ sal_uInt16 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara nCurIndex = GetCharPos( nPortion, nLine, rPosInPara.X(), bSmart ); if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) && - ( pLine != pPortion->GetLines().back() ) ) + ( pLine != &( pPortion->GetLines().back() ) ) ) { uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator(); sal_Int32 nCount = 1; @@ -1110,15 +1110,15 @@ sal_uInt16 TextEngine::GetCharPos( sal_uLong nPortion, sal_uInt16 nLine, long nX { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); - TextLine* pLine = pPortion->GetLines()[ nLine ]; + TextLine& pLine = pPortion->GetLines()[ nLine ]; - sal_uInt16 nCurIndex = pLine->GetStart(); + sal_uInt16 nCurIndex = pLine.GetStart(); - long nTmpX = pLine->GetStartX(); + long nTmpX = pLine.GetStartX(); if ( nXPos <= nTmpX ) return nCurIndex; - for ( sal_uInt16 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) + for ( sal_uInt16 i = pLine.GetStartPortion(); i <= pLine.GetEndPortion(); i++ ) { TETextPortion* pTextPortion = pPortion->GetTextPortions()[ i ]; nTmpX += pTextPortion->GetWidth(); @@ -1172,8 +1172,8 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara ) for ( sal_uInt16 nLine = pPortion->GetLines().size(); nLine; ) { sal_uLong nLineWidth = 0; - TextLine* pLine = pPortion->GetLines()[ --nLine ]; - for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) + TextLine& pLine = pPortion->GetLines()[ --nLine ]; + for ( sal_uInt16 nTP = pLine.GetStartPortion(); nTP <= pLine.GetEndPortion(); nTP++ ) { TETextPortion* pTextPortion = pPortion->GetTextPortions()[ nTP ]; nLineWidth += pTextPortion->GetWidth(); @@ -1263,8 +1263,7 @@ sal_uInt16 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) cons TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph ); if ( pPPortion && ( nLine < pPPortion->GetLines().size() ) ) { - TextLine* pLine = pPPortion->GetLines()[ nLine ]; - return pLine->GetLen(); + return pPPortion->GetLines()[ nLine ].GetLen(); } return 0; @@ -1294,8 +1293,8 @@ Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion ) sal_uInt16 nLine; for ( nLine = 0; nLine < nLines; nLine++ ) { - TextLine* pL = pTEParaPortion->GetLines()[ nLine ]; - if ( pL->IsInvalid() ) + TextLine& pL = pTEParaPortion->GetLines()[ nLine ]; + if ( pL.IsInvalid() ) { nFirstInvalid = nLine; break; @@ -1304,8 +1303,8 @@ Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion ) for ( nLastInvalid = nFirstInvalid; nLastInvalid < nLines; nLastInvalid++ ) { - TextLine* pL = pTEParaPortion->GetLines()[ nLine ]; - if ( pL->IsValid() ) + TextLine& pL = pTEParaPortion->GetLines()[ nLine ]; + if ( pL.IsValid() ) break; } @@ -1659,9 +1658,6 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara ) if ( bLineBreak ) { // -2: The new one is already inserted. - OSL_ENSURE( - pTEParaPortion->GetLines()[pTEParaPortion->GetLines().size()-2], - "CreateAndInsertEmptyLine: Soft Break, no Line?!"); sal_uInt16 nPos = (sal_uInt16) pTEParaPortion->GetTextPortions().size() - 1 ; pTmpLine->SetStartPortion( nPos ); pTmpLine->SetEndPortion( nPos ); @@ -1977,17 +1973,17 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan sal_uInt16 nIndex = 0; for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { - TextLine* pLine = pPortion->GetLines()[nLine]; - Point aTmpPos( rStartPos.X() + pLine->GetStartX(), nY ); + TextLine& pLine = pPortion->GetLines()[nLine]; + Point aTmpPos( rStartPos.X() + pLine.GetStartX(), nY ); if ( ( !pPaintArea || ( ( nY + mnCharHeight ) > pPaintArea->Top() ) ) && ( !pPaintRange || ( - ( TextPaM( nPara, pLine->GetStart() ) < pPaintRange->GetEnd() ) && - ( TextPaM( nPara, pLine->GetEnd() ) > pPaintRange->GetStart() ) ) ) ) + ( TextPaM( nPara, pLine.GetStart() ) < pPaintRange->GetEnd() ) && + ( TextPaM( nPara, pLine.GetEnd() ) > pPaintRange->GetStart() ) ) ) ) { // for all Portions of the line - nIndex = pLine->GetStart(); - for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ ) + nIndex = pLine.GetStart(); + for ( sal_uInt16 y = pLine.GetStartPortion(); y <= pLine.GetEndPortion(); y++ ) { OSL_ENSURE(pPortion->GetTextPortions().size(), "ImpPaint: Line without Textportion!"); @@ -1997,7 +1993,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, &pLine, nIndex, nIndex ); // only print if starting in the visible region if ( ( ( aTmpPos.X() + nTxtWidth ) >= 0 ) @@ -2051,7 +2047,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan { nL = pSelStart->GetIndex() - nTmpIndex; pOutDev->SetFont( aFont); - aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, pLine, nTmpIndex, nTmpIndex+nL ); + aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); nTmpIndex = nTmpIndex + nL; @@ -2065,7 +2061,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, &pLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); pOutDev->SetTextColor( aOldTextColor ); pOutDev->SetTextFillColor(); @@ -2076,7 +2072,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, &pLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex ); } bDone = true; @@ -2084,7 +2080,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, &pLine, nTmpIndex, nEnd ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex ); } } @@ -2160,8 +2156,6 @@ bool TextEngine::CreateLines( sal_uLong nPara ) pTEParaPortion->GetTextPortions().Reset(); if ( !pTEParaPortion->GetLines().empty() ) { - BOOST_FOREACH(TextLine* pLine, pTEParaPortion->GetLines()) - delete pLine; pTEParaPortion->GetLines().clear(); } CreateAndInsertEmptyLine( nPara ); @@ -2223,20 +2217,20 @@ bool TextEngine::CreateLines( sal_uLong nPara ) sal_uInt16 nLine = pTEParaPortion->GetLines().size()-1; for ( sal_uInt16 nL = 0; nL <= nLine; nL++ ) { - TextLine* pLine = pTEParaPortion->GetLines()[ nL ]; - if ( pLine->GetEnd() > nInvalidStart ) + TextLine& rLine = pTEParaPortion->GetLines()[ nL ]; + if ( rLine.GetEnd() > nInvalidStart ) { nLine = nL; break; } - pLine->SetValid(); + rLine.SetValid(); } // start a line before... // if typing at the end, the line before cannot change if ( nLine && ( !pTEParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->GetText().getLength() ) || ( nInvalidDiff <= 0 ) ) ) nLine--; - TextLine* pLine = pTEParaPortion->GetLines()[ nLine ]; + TextLine* pLine = &( pTEParaPortion->GetLines()[ nLine ] ); // format all lines starting here size_t nDelFromLine = std::numeric_limits<size_t>::max(); @@ -2427,9 +2421,9 @@ bool TextEngine::CreateLines( sal_uLong nPara ) sal_uInt16 nEndPortion = pLine->GetEndPortion(); // next line or new line - pLine = 0; + pLine = NULL; if ( nLine < pTEParaPortion->GetLines().size()-1 ) - pLine = pTEParaPortion->GetLines()[ ++nLine ]; + pLine = &( pTEParaPortion->GetLines()[ ++nLine ] ); if ( pLine && ( nIndex >= pNode->GetText().getLength() ) ) { nDelFromLine = nLine; @@ -2457,11 +2451,6 @@ bool TextEngine::CreateLines( sal_uLong nPara ) if (nDelFromLine != std::numeric_limits<size_t>::max()) { - for( TextLines::iterator it = pTEParaPortion->GetLines().begin() + nDelFromLine; - it != pTEParaPortion->GetLines().end(); ++it ) - { - delete *it; - } pTEParaPortion->GetLines().erase( pTEParaPortion->GetLines().begin() + nDelFromLine, pTEParaPortion->GetLines().end() ); } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 4bcd9f3b4d2f..fef07f20a5c6 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -418,9 +418,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_uInt16 nStartIndex = pLine->GetStart(); - sal_uInt16 nEndIndex = pLine->GetEnd(); + TextLine& pLine = pTEParaPortion->GetLines()[ nLine ]; + sal_uInt16 nStartIndex = pLine.GetStart(); + sal_uInt16 nEndIndex = pLine.GetEnd(); if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) ) nStartIndex = aSel.GetStart().GetIndex(); if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) ) @@ -1030,9 +1030,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 ( pLine && ( nInputEnd > pLine->GetEnd() ) ) - nInputEnd = pLine->GetEnd(); + TextLine& pLine = pParaPortion->GetLines()[ nLine ]; + if ( nInputEnd > pLine.GetEnd() ) + nInputEnd = pLine.GetEnd(); Rectangle aR2 = mpImpl->mpTextEngine->PaMtoEditCursor( TextPaM( aPaM.GetPara(), nInputEnd ) ); long nWidth = aR2.Left()-aR1.Right(); @@ -1539,8 +1539,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& pLine = pPPortion->GetLines()[ nLine - 1 ]; + if ( aPaM.GetIndex() && ( aPaM.GetIndex() == pLine.GetEnd() ) ) aPaM.GetIndex()--; } else if ( rPaM.GetPara() ) // previous paragraph @@ -1576,8 +1576,8 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) aPaM.GetIndex() = nCharPos; // 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& pLine = pPPortion->GetLines()[ nLine + 1 ]; + if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() ) aPaM.GetIndex()--; } else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) ) // next paragraph @@ -1586,8 +1586,8 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() ); sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), 0, nX+1 ); aPaM.GetIndex() = nCharPos; - TextLine* pLine = pPPortion->GetLines().front(); - if ( ( aPaM.GetIndex() == pLine->GetEnd() ) && ( aPaM.GetIndex() > pLine->GetStart() ) && ( pPPortion->GetLines().size() > 1 ) ) + TextLine& pLine = pPPortion->GetLines().front(); + if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && ( pPPortion->GetLines().size() > 1 ) ) aPaM.GetIndex()--; } @@ -1600,8 +1600,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& pLine = pPPortion->GetLines()[ nLine ]; + aPaM.GetIndex() = pLine.GetStart(); return aPaM; } @@ -1612,10 +1612,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& pLine = pPPortion->GetLines()[ nLine ]; + aPaM.GetIndex() = pLine.GetEnd(); - if ( pLine->GetEnd() > pLine->GetStart() ) // empty line + if ( pLine.GetEnd() > pLine.GetStart() ) // empty line { sal_Unicode cLastChar = pPPortion->GetNode()->GetText()[ aPaM.GetIndex()-1 ]; if ( ( cLastChar == ' ' ) && ( aPaM.GetIndex() != pPPortion->GetNode()->GetText().getLength() ) ) |