summaryrefslogtreecommitdiffstats
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 00:02:55 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 10:20:09 -0400
commit221cbbf64a20b87443f378fcb2ed22068867f494 (patch)
tree6960395f7318848cbd447943417df90bd7a6b964 /editeng
parentMake ImpEditEngine explicitly non-copyable. (diff)
downloadcore-221cbbf64a20b87443f378fcb2ed22068867f494.tar.gz
core-221cbbf64a20b87443f378fcb2ed22068867f494.zip
Another SV_DECL_PTRARR killed.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx54
-rw-r--r--editeng/source/editeng/editdoc.hxx20
-rw-r--r--editeng/source/editeng/editeng.cxx10
-rw-r--r--editeng/source/editeng/impedit.cxx4
-rw-r--r--editeng/source/editeng/impedit.hxx6
-rw-r--r--editeng/source/editeng/impedit2.cxx64
-rw-r--r--editeng/source/editeng/impedit3.cxx20
-rw-r--r--editeng/source/editeng/impedit4.cxx6
8 files changed, 107 insertions, 77 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 608e68149450..4d253d958caf 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1024,33 +1024,57 @@ EditLineList::~EditLineList()
void EditLineList::Reset()
{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
- delete GetObject(nLine);
- Remove( 0, Count() );
+ maLines.clear();
}
-void EditLineList::DeleteFromLine( sal_uInt16 nDelFrom )
+void EditLineList::DeleteFromLine(size_t nDelFrom)
{
- DBG_ASSERT( nDelFrom <= (Count() - 1), "DeleteFromLine: Out of range" );
- for ( sal_uInt16 nL = nDelFrom; nL < Count(); nL++ )
- delete GetObject(nL);
- Remove( nDelFrom, Count()-nDelFrom );
+ DBG_ASSERT( nDelFrom <= (maLines.size() - 1), "DeleteFromLine: Out of range" );
+ LinesType::iterator it = maLines.begin();
+ std::advance(it, nDelFrom);
+ maLines.erase(it, maLines.end());
}
-sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd )
+size_t EditLineList::FindLine(sal_uInt16 nChar, bool bInclEnd)
{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
+ size_t n = maLines.size();
+ for (size_t i = 0; i < n; ++i)
{
- EditLine* pLine = GetObject( nLine );
- if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) ||
- ( pLine->GetEnd() > nChar ) )
+ const EditLine& rLine = maLines[i];
+ if ( (bInclEnd && (rLine.GetEnd() >= nChar)) ||
+ (rLine.GetEnd() > nChar) )
{
- return nLine;
+ return i;
}
}
DBG_ASSERT( !bInclEnd, "Line not found: FindLine" );
- return ( Count() - 1 );
+ return n - 1;
+}
+
+size_t EditLineList::Count() const
+{
+ return maLines.size();
+}
+
+const EditLine* EditLineList::operator[](size_t nPos) const
+{
+ return &maLines[nPos];
+}
+
+EditLine* EditLineList::operator[](size_t nPos)
+{
+ return &maLines[nPos];
+}
+
+void EditLineList::Append(EditLine* p)
+{
+ maLines.push_back(p);
+}
+
+void EditLineList::Insert(size_t nPos, EditLine* p)
+{
+ maLines.insert(maLines.begin()+nPos, p);
}
EditPaM::EditPaM() : pNode(NULL), nIndex(0) {}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 7cc78ca663b3..5bdce4cd589c 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -540,18 +540,24 @@ public:
// -------------------------------------------------------------------------
// class LineList
// -------------------------------------------------------------------------
-typedef EditLine* EditLinePtr;
-SV_DECL_PTRARR( LineArray, EditLinePtr, 0 )
-
-class EditLineList : public LineArray
+class EditLineList
{
+ typedef boost::ptr_vector<EditLine> LinesType;
+ LinesType maLines;
+
public:
EditLineList();
~EditLineList();
- void Reset();
- void DeleteFromLine( sal_uInt16 nDelFrom );
- sal_uInt16 FindLine( sal_uInt16 nChar, sal_Bool bInclEnd );
+ void Reset();
+ void DeleteFromLine(size_t nDelFrom);
+ size_t FindLine(sal_uInt16 nChar, bool bInclEnd);
+ size_t Count() const;
+ const EditLine* operator[](size_t nPos) const;
+ EditLine* operator[](size_t nPos);
+
+ void Append(EditLine* p);
+ void Insert(size_t nPos, EditLine* p);
};
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index b6189d1876f4..1d5fe3a1aa82 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1708,7 +1708,7 @@ Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph )
if ( pPPortion->GetLines().Count() )
{
// Correct it if large Bullet.
- EditLine* pFirstLine = pPPortion->GetLines()[0];
+ const EditLine* pFirstLine = pPPortion->GetLines()[0];
aPoint.X() = pFirstLine->GetStartPosX();
}
else
@@ -1762,7 +1762,7 @@ sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
DBG_ASSERT( pParaPortion, "ParaPortion?" );
sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine );
if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) &&
( aDocPos.X() <= aLineXPosStartEnd.Max() + nBorder ) )
@@ -2201,9 +2201,9 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara )
aInfos.bValid = pImpEditEngine->IsFormatted();
if ( pImpEditEngine->IsFormatted() )
{
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
- EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
- pParaPortion->GetLines().GetObject( 0 ) : NULL;
+ const ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
+ const EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
+ pParaPortion->GetLines()[0] : NULL;
DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" );
if ( pParaPortion && pLine )
{
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 62d32e095e91..e33ee5a8e200 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -205,7 +205,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ )
{
- EditLine* pLine = pTmpPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pTmpPortion->GetLines()[nLine];
DBG_ASSERT( pLine, "Line not found: DrawSelection()" );
sal_Bool bPartOfLine = sal_False;
@@ -261,7 +261,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" );
- long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, sal_True );
+ long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, true );
long nX2 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpEndIndex );
Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 0c93da6856ac..438abee694be 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -533,11 +533,11 @@ private:
EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True );
EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True );
- long GetXPos(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
+ long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const;
- sal_uInt16 GetChar(const ParaPortion* pParaPortion, EditLine* pLine, long nX, bool bSmart = true);
+ sal_uInt16 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, long nX, bool bSmart = true);
Range GetInvalidYOffsets( ParaPortion* pPortion );
- Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const;
+ Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const;
void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue );
sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8e2cd809b6a7..aec30e18e09a 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -601,7 +601,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
if ( pLine && ( nInputEnd > pLine->GetEnd() ) )
nInputEnd = pLine->GetEnd();
Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GETCRSR_ENDOFLINE );
@@ -1006,8 +1006,8 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
+ bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
pEditView->pImpEditView->nExtraCursorFlags = 0;
@@ -1062,8 +1062,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
+ bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
pEditView->pImpEditView->nExtraCursorFlags = 0;
@@ -1291,7 +1291,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pPPortion, "No matching portion found: CursorUp ");
sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
long nX;
if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
@@ -1305,7 +1305,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
EditPaM aNewPaM( rPaM );
if ( nLine ) // same paragraph
{
- EditLine* pPrevLine = pPPortion->GetLines().GetObject(nLine-1);
+ const EditLine* pPrevLine = pPPortion->GetLines()[nLine-1];
aNewPaM.SetIndex( GetChar( pPPortion, pPrevLine, nX ) );
// If a previous automatically wrapped line, and one has to be exactly
// at the end of this line, the cursor lands on the current line at the
@@ -1319,7 +1319,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion );
if ( pPrevPortion )
{
- pLine = pPrevPortion->GetLines().GetObject( pPrevPortion->GetLines().Count()-1 );
+ pLine = pPrevPortion->GetLines()[pPrevPortion->GetLines().Count()-1];
OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
aNewPaM.SetNode( pPrevPortion->GetNode() );
aNewPaM.SetIndex( GetChar( pPrevPortion, pLine, nX+nOnePixelInRef ) );
@@ -1340,7 +1340,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
long nX;
if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
{
- EditLine* pLine = pPPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() );
pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef;
}
@@ -1350,7 +1350,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
EditPaM aNewPaM( rPaM );
if ( nLine < pPPortion->GetLines().Count()-1 )
{
- EditLine* pNextLine = pPPortion->GetLines().GetObject(nLine+1);
+ const EditLine* pNextLine = pPPortion->GetLines()[nLine+1];
aNewPaM.SetIndex( GetChar( pPPortion, pNextLine, nX ) );
// Special treatment, see CursorUp ...
if ( ( aNewPaM.GetIndex() == pNextLine->GetEnd() ) && ( aNewPaM.GetIndex() > pNextLine->GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) )
@@ -1361,7 +1361,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pNextPortion = GetNextVisPortion( pPPortion );
if ( pNextPortion )
{
- EditLine* pLine = pNextPortion->GetLines().GetObject(0);
+ const EditLine* pLine = pNextPortion->GetLines()[0];
OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
aNewPaM.SetNode( pNextPortion->GetNode() );
// Never at the very end when several lines, because then a line
@@ -1380,7 +1380,7 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM )
const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pCurPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Current line not found ?!" );
EditPaM aNewPaM( rPaM );
@@ -1393,7 +1393,7 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM )
const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pCurPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Current line not found ?!" );
EditPaM aNewPaM( rPaM );
@@ -3113,7 +3113,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace )
sal_uLong nLines = pPortion->GetLines().Count();
for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
{
- pLine = pPortion->GetLines().GetObject( nLine );
+ pLine = pPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" );
// nCurWidth = pLine->GetStartPosX();
// For Center- or Right- alignment it depends on the paper
@@ -3249,7 +3249,7 @@ xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine )
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" );
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Line not found: GetLineHeight" );
return pLine->GetLen();
}
@@ -3265,7 +3265,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uIn
rStart = rEnd = 0xFFFF; // default values in case of error
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" );
rStart = pLine->GetStart();
rEnd = pLine->GetEnd();
@@ -3306,7 +3306,7 @@ sal_uInt16 ImpEditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineHeight" );
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Paragraph not found: GetLineHeight" );
return pLine->GetHeight();
}
@@ -3602,7 +3602,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
sal_uInt16 nLine;
for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pL = pPortion->GetLines()[nLine];
if ( pL->IsInvalid() )
{
nFirstInvalid = nLine;
@@ -3624,7 +3624,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1;
for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pL = pPortion->GetLines()[nLine];
if ( pL->IsValid() )
{
nLastInvalid = nLine;
@@ -3639,7 +3639,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() &&
( rLSItem.GetPropLineSpace() < 100 ) )
{
- EditLine* pL = pPortion->GetLines().GetObject( nFirstInvalid );
+ const EditLine* pL = pPortion->GetLines()[nFirstInvalid];
long n = pL->GetTxtHeight() * ( 100 - rLSItem.GetPropLineSpace() );
n /= 100;
aRange.Min() -= n;
@@ -3669,10 +3669,10 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" );
- EditLine* pLine = 0;
+ const EditLine* pLine = NULL;
for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pTmpLine = pPortion->GetLines()[nLine];
nY += pTmpLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY += nSBL;
@@ -3700,7 +3700,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
aPaM.SetIndex( nCurIndex );
if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) &&
- ( pLine != pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1) ) )
+ ( pLine != pPortion->GetLines()[pPortion->GetLines().Count()-1] ) )
{
aPaM = CursorLeft( aPaM, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
}
@@ -3709,7 +3709,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
}
sal_uInt16 ImpEditEngine::GetChar(
- const ParaPortion* pParaPortion, EditLine* pLine, long nXPos, bool bSmart)
+ const ParaPortion* pParaPortion, const EditLine* pLine, long nXPos, bool bSmart)
{
OSL_ENSURE( pLine, "No line received: GetChar" );
@@ -3819,7 +3819,7 @@ sal_uInt16 ImpEditEngine::GetChar(
return nChar;
}
-Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const
+Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const
{
Range aLineXPosStartEnd;
@@ -3930,7 +3930,7 @@ long ImpEditEngine::GetPortionXOffset(
}
long ImpEditEngine::GetXPos(
- const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
{
OSL_ENSURE( pLine, "No line received: GetXPos" );
OSL_ENSURE( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos has to be called properly!" );
@@ -4068,8 +4068,8 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion )
if ( pPortion->IsVisible() )
{
OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" );
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
- pPortion->nHeight += pPortion->GetLines().GetObject( nLine )->GetHeight();
+ for (size_t nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine)
+ pPortion->nHeight += pPortion->GetLines()[nLine]->GetHeight();
if ( !aStatus.IsOutliner() )
{
@@ -4178,11 +4178,11 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
sal_uInt16 nCurIndex = 0;
OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" );
- EditLine* pLine = 0;
+ const EditLine* pLine = NULL;
sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False;
for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pTmpLine = pPortion->GetLines()[nLine];
if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) )
{
pLine = pTmpLine;
@@ -4199,11 +4199,11 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
// Cursor at the End of the paragraph.
OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" );
- pLine = pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1 );
+ pLine = pPortion->GetLines()[pPortion->GetLines().Count()-1];
nY -= pLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY -= nSBL;
- nCurIndex = nCurIndex - pLine->GetLen();
+ nCurIndex = nCurIndex - pLine->GetLen();
}
Rectangle aEditCursor;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index c1c7aea01763..315ff3b61631 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -619,7 +619,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( pParaPortion->GetLines().Count() == 0 )
{
EditLine* pL = new EditLine;
- pParaPortion->GetLines().Insert( pL, 0 );
+ pParaPortion->GetLines().Append(pL);
}
// ---------------------------------------------------------------
@@ -706,7 +706,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
sal_uInt16 nLine = pParaPortion->GetLines().Count()-1;
for ( sal_uInt16 nL = 0; nL <= nLine; nL++ )
{
- EditLine* pLine = pParaPortion->GetLines().GetObject( nL );
+ EditLine* pLine = pParaPortion->GetLines()[nL];
if ( pLine->GetEnd() > nRealInvalidStart ) // not nInvalidStart!
{
nLine = nL;
@@ -719,7 +719,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nLine && ( !pParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->Len() ) || ( nInvalidDiff <= 0 ) ) )
nLine--;
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ EditLine* pLine = pParaPortion->GetLines()[nLine];
static Rectangle aZeroArea = Rectangle( Point(), Point() );
Rectangle aBulletArea( aZeroArea );
@@ -1508,7 +1508,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
// Next line or maybe a new line....
pLine = 0;
if ( nLine < pParaPortion->GetLines().Count()-1 )
- pLine = pParaPortion->GetLines().GetObject( ++nLine );
+ pLine = pParaPortion->GetLines()[++nLine];
if ( pLine && ( nIndex >= pNode->Len() ) )
{
nDelFromLine = nLine;
@@ -1519,7 +1519,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nIndex < pNode->Len() )
{
pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
+ pParaPortion->GetLines().Insert(++nLine, pLine);
}
else if ( nIndex && bLineBreak && GetTextRanger() )
{
@@ -1528,7 +1528,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
TextPortion* pDummyPortion = new TextPortion( 0 );
pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
+ pParaPortion->GetLines().Insert(++nLine, pLine);
bForceOneRun = sal_True;
bProcessingEmptyLine = sal_True;
}
@@ -1571,7 +1571,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
EditLine* pTmpLine = new EditLine;
pTmpLine->SetStart( pParaPortion->GetNode()->Len() );
pTmpLine->SetEnd( pParaPortion->GetNode()->Len() );
- pParaPortion->GetLines().Insert( pTmpLine, pParaPortion->GetLines().Count() );
+ pParaPortion->GetLines().Append(pTmpLine);
sal_Bool bLineBreak = pParaPortion->GetNode()->Len() ? sal_True : sal_False;
sal_Int32 nSpaceBefore = 0;
@@ -2818,7 +2818,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
- EditLine* pLine;
+ const EditLine* pLine = NULL;
Point aTmpPos;
Point aRedLineTmpPos;
DBG_ASSERT( GetParaPortions().Count(), "No ParaPortion?!" );
@@ -2885,7 +2885,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
{
- pLine = pPortion->GetLines().GetObject(nLine);
+ pLine = pPortion->GetLines()[nLine];
DBG_ASSERT( pLine, "NULL-Pointer in the line iterator in UpdateViews" );
aTmpPos = aStartPos;
if ( !IsVertical() )
@@ -3974,7 +3974,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
nTotalLineCount += nLineCount;
for (sal_uInt16 j = 0; j < nLineCount; ++j)
{
- EditLine* pLine = rLines.GetObject(j);
+ const EditLine* pLine = rLines[j];
nTotalOccupiedHeight += pLine->GetHeight();
if (j < nLineCount-1)
nTotalOccupiedHeight += nSBL;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 3d353309e959..6617eb310442 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1159,9 +1159,9 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
nCount = pParaPortion->GetLines().Count();
for ( n = 0; n < nCount; n++ )
{
- EditLine* pLine = pParaPortion->GetLines()[n];
+ const EditLine* pLine = pParaPortion->GetLines()[n];
EditLine* pNew = pLine->Clone();
- pX->aLines.Insert( pNew, pX->aLines.Count() );
+ pX->aLines.Append(pNew);
}
#ifdef DBG_UTIL
sal_uInt16 nTest;
@@ -1357,7 +1357,7 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
EditLine* pLine = pXP->aLines[m];
EditLine* pNew = pLine->Clone();
pNew->SetInvalid(); // Paint again!
- pParaPortion->GetLines().Insert( pNew, m );
+ pParaPortion->GetLines().Insert(m, pNew);
}
#ifdef DBG_UTIL
sal_uInt16 nTest;