summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Lefèvre <lefevre00@yahoo.fr>2015-01-19 09:44:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-19 12:50:38 +0000
commit3a626669b4b7c804aebda34009af5ee1d905116e (patch)
treedc7612acfce515a63b3bc177d6734486ee62042f
parentb698b9362b1a4ab58e0307a20f65dea796087344 (diff)
fdo#75757 Remove inheritance from std::vector
Take care not reproducing fdo#86552 again. Change-Id: I4a5967e76afcb5467addc81bc9eca61bb65865e7 Reviewed-on: https://gerrit.libreoffice.org/13992 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/textdata.hxx15
-rw-r--r--vcl/source/edit/textdoc.cxx33
-rw-r--r--vcl/source/edit/textdoc.hxx6
-rw-r--r--vcl/source/edit/texteng.cxx90
-rw-r--r--vcl/source/edit/textundo.cxx8
-rw-r--r--vcl/source/edit/textview.cxx44
6 files changed, 90 insertions, 106 deletions
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index 6af42ee5a93d..fe37fbd3b4c7 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -150,21 +150,6 @@ struct TEIMEInfos
void DestroyAttribs();
};
-// ----------------- Wrapper for old Tools List -------------------
-
-#include <vector>
-#include <algorithm>
-
-template <class T> class ToolsList : public ::std::vector< T >
-{
-public:
- size_t Count() const { return ::std::vector< T >::size(); }
- size_t GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
- T GetObject( size_t nIndex ) const { return (*this)[nIndex]; }
- void Insert( T pObject, size_t nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
- void Remove( size_t nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
-};
-
#endif // INCLUDED_VCL_TEXTDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 560284ccb1d6..2faa0e12a53b 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -424,20 +424,20 @@ void TextDoc::Clear()
void TextDoc::DestroyTextNodes()
{
- for ( sal_uLong nNode = 0; nNode < maTextNodes.Count(); nNode++ )
- delete maTextNodes.GetObject( nNode );
+ for ( sal_uLong nNode = 0; nNode < maTextNodes.size(); nNode++ )
+ delete maTextNodes[ nNode ];
maTextNodes.clear();
}
OUString TextDoc::GetText( const sal_Unicode* pSep ) const
{
- sal_uLong nNodes = maTextNodes.Count();
+ sal_uLong nNodes = maTextNodes.size();
OUString aASCIIText;
sal_uLong nLastNode = nNodes-1;
for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ )
{
- TextNode* pNode = maTextNodes.GetObject( nNode );
+ TextNode* pNode = maTextNodes[ nNode ];
OUString aTmp( pNode->GetText() );
aASCIIText += aTmp;
if ( pSep && ( nNode != nLastNode ) )
@@ -451,7 +451,7 @@ OUString TextDoc::GetText( sal_uLong nPara ) const
{
OUString aText;
- TextNode* pNode = ( nPara < maTextNodes.Count() ) ? maTextNodes.GetObject( nPara ) : 0;
+ TextNode* pNode = ( nPara < maTextNodes.size() ) ? maTextNodes[ nPara ] : 0;
if ( pNode )
aText = pNode->GetText();
@@ -461,7 +461,7 @@ OUString TextDoc::GetText( sal_uLong nPara ) const
sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
{
sal_uLong nLen = 0;
- sal_uLong nNodes = maTextNodes.Count();
+ sal_uLong nNodes = maTextNodes.size();
if ( nNodes )
{
sal_uLong nStartNode = 0;
@@ -474,7 +474,7 @@ sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSe
for ( sal_uLong nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
- TextNode* pNode = maTextNodes.GetObject( nNode );
+ TextNode* pNode = maTextNodes[ nNode ];
sal_uInt16 nS = 0;
sal_Int32 nE = pNode->GetText().getLength();
@@ -498,7 +498,7 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c )
DBG_ASSERT( c != 0x0A, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
DBG_ASSERT( c != 0x0D, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
- TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode* pNode = maTextNodes[ rPaM.GetPara() ];
pNode->InsertText( rPaM.GetIndex(), c );
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+1 );
@@ -510,7 +510,7 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr )
DBG_ASSERT( rStr.indexOf( 0x0A ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
- TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode* pNode = maTextNodes[ rPaM.GetPara() ];
pNode->InsertText( rPaM.GetIndex(), rStr );
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.getLength() );
@@ -519,10 +519,10 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr )
TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs )
{
- TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode* pNode = maTextNodes[ rPaM.GetPara() ];
TextNode* pNew = pNode->Split( rPaM.GetIndex(), bKeepEndingAttribs );
- maTextNodes.Insert( pNew, rPaM.GetPara()+1 );
+ maTextNodes.insert( maTextNodes.begin() + rPaM.GetPara() + 1, pNew );
TextPaM aPaM( rPaM.GetPara()+1, 0 );
return aPaM;
@@ -534,18 +534,17 @@ TextPaM TextDoc::ConnectParagraphs( TextNode* pLeft, TextNode* pRight )
pLeft->Append( *pRight );
// the paragraph on the right vanishes
- sal_uLong nRight = maTextNodes.GetPos( pRight );
- maTextNodes.Remove( nRight );
+ maTextNodes.erase( std::find( maTextNodes.begin(), maTextNodes.end(), pRight ) );
delete pRight;
- sal_uLong nLeft = maTextNodes.GetPos( pLeft );
+ sal_uLong nLeft = ::std::find( maTextNodes.begin(), maTextNodes.end(), pLeft ) - maTextNodes.begin();
TextPaM aPaM( nLeft, nPrevLen );
return aPaM;
}
TextPaM TextDoc::RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars )
{
- TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode* pNode = maTextNodes[ rPaM.GetPara() ];
pNode->RemoveText( rPaM.GetIndex(), nChars );
return rPaM;
@@ -553,12 +552,12 @@ TextPaM TextDoc::RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars )
bool TextDoc::IsValidPaM( const TextPaM& rPaM )
{
- if ( rPaM.GetPara() >= maTextNodes.Count() )
+ if ( rPaM.GetPara() >= maTextNodes.size() )
{
OSL_FAIL( "PaM: Para out of range" );
return false;
}
- TextNode * pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode * pNode = maTextNodes[ rPaM.GetPara() ];
if ( rPaM.GetIndex() > pNode->GetText().getLength() )
{
OSL_FAIL( "PaM: Index out of range" );
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 739de18040c6..f0d1ab36d653 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -90,7 +90,7 @@ public:
class TextDoc
{
private:
- ToolsList<TextNode*> maTextNodes;
+ std::vector<TextNode*> maTextNodes;
sal_uInt16 mnLeftMargin;
protected:
@@ -102,8 +102,8 @@ public:
void Clear();
- ToolsList<TextNode*>& GetNodes() { return maTextNodes; }
- const ToolsList<TextNode*>& GetNodes() const { return maTextNodes; }
+ std::vector<TextNode*>& GetNodes() { return maTextNodes; }
+ const std::vector<TextNode*>& GetNodes() const { return maTextNodes; }
TextPaM RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars );
TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c );
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index effe2af18805..201eb16dfb2b 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -298,7 +298,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator
sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const
{
- return mpDoc->GetNodes().GetObject( nPara )->GetText().getLength();
+ return mpDoc->GetNodes()[ nPara ]->GetText().getLength();
}
void TextEngine::SetUpdateMode( bool bUpdate )
@@ -382,7 +382,7 @@ void TextEngine::ImpInitDoc()
mpTEParaPortions = new TEParaPortions;
TextNode* pNode = new TextNode( OUString() );
- mpDoc->GetNodes().Insert( pNode, 0 );
+ mpDoc->GetNodes().insert( mpDoc->GetNodes().begin(), pNode );
TEParaPortion* pIniPortion = new TEParaPortion( pNode );
mpTEParaPortions->Insert( pIniPortion, (sal_uLong)0 );
@@ -408,7 +408,7 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co
const sal_Unicode* pSep = static_getLineEndText( aSeparator );
for ( sal_uLong nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+ TextNode* pNode = mpDoc->GetNodes()[ nNode ];
sal_uInt16 nStartPos = 0;
sal_Int32 nEndPos = pNode->GetText().getLength();
@@ -475,7 +475,7 @@ void TextEngine::SetText( const OUString& rText )
void TextEngine::CursorMoved( sal_uLong nNode )
{
// delete empty attribute; but only if paragraph is not empty!
- TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+ TextNode* pNode = mpDoc->GetNodes()[ nNode ];
if ( pNode && pNode->GetCharAttribs().HasEmptyAttribs() && !pNode->GetText().isEmpty() )
pNode->GetCharAttribs().DeleteEmptyAttribs();
}
@@ -486,7 +486,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndo
if ( IsUndoEnabled() && !IsInUndo() )
{
// attributes have to be saved for UNDO before RemoveChars!
- TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ];
OUString aStr( pNode->GetText().copy( rPaM.GetIndex(), nChars ) );
// check if attributes are being deleted or changed
@@ -511,8 +511,8 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight )
{
DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" );
- TextNode* pLeft = mpDoc->GetNodes().GetObject( nLeft );
- TextNode* pRight = mpDoc->GetNodes().GetObject( nRight );
+ TextNode* pLeft = mpDoc->GetNodes()[ nLeft ];
+ TextNode* pRight = mpDoc->GetNodes()[ nRight ];
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoConnectParas( this, nLeft, pLeft->GetText().getLength() ) );
@@ -564,7 +564,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
if ( nStartNode != nEndNode )
{
// the remainder of StartNodes...
- TextNode* pLeft = mpDoc->GetNodes().GetObject( nStartNode );
+ TextNode* pLeft = mpDoc->GetNodes()[ nStartNode ];
sal_Int32 nChars = pLeft->GetText().getLength() - aStartPaM.GetIndex();
if ( nChars )
{
@@ -607,11 +607,11 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
void TextEngine::ImpRemoveParagraph( sal_uLong nPara )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
boost::scoped_ptr<TEParaPortion> pPortion(mpTEParaPortions->GetObject( nPara ));
// the Node is handled by Undo and is deleted if appropriate
- mpDoc->GetNodes().Remove( nPara );
+ mpDoc->GetNodes().erase( mpDoc->GetNodes().begin() + nPara );
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoDelPara( this, pNode, nPara ) );
else
@@ -668,7 +668,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
DBG_ASSERT( c != '\r', "InsertText: NewLine!" );
TextPaM aPaM( rCurSel.GetStart() );
- TextNode* pNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes()[ aPaM.GetPara() ];
bool bDoOverwrite = ( bOverwrite &&
( aPaM.GetIndex() < pNode->GetText().getLength() ) );
@@ -830,7 +830,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) );
- TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ];
bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength();
TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) );
@@ -839,7 +839,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" );
pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
- TextNode* pNewNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNewNode = mpDoc->GetNodes()[ aPaM.GetPara() ];
TEParaPortion* pNewPortion = new TEParaPortion( pNewNode );
mpTEParaPortions->Insert( pNewPortion, aPaM.GetPara() );
ImpParagraphInserted( aPaM.GetPara() );
@@ -1025,7 +1025,7 @@ const TextAttrib* TextEngine::FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich
const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const
{
const TextCharAttrib* pAttr = NULL;
- TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ];
if ( pNode && ( rPaM.GetIndex() < pNode->GetText().getLength() ) )
pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
return pAttr;
@@ -1034,9 +1034,9 @@ const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt1
bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const
{
bool bAttr = false;
- for ( sal_uLong n = mpDoc->GetNodes().Count(); --n && !bAttr; )
+ for ( sal_uLong n = mpDoc->GetNodes().size(); --n && !bAttr; )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( n );
+ TextNode* pNode = mpDoc->GetNodes()[ n ];
bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
}
return bAttr;
@@ -1065,8 +1065,8 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart )
}
// not found - go to last visible
- sal_uLong nLastNode = mpDoc->GetNodes().Count() - 1;
- TextNode* pLast = mpDoc->GetNodes().GetObject( nLastNode );
+ sal_uLong nLastNode = mpDoc->GetNodes().size() - 1;
+ TextNode* pLast = mpDoc->GetNodes()[ nLastNode ];
return TextPaM( nLastNode, pLast->GetText().getLength() );
}
@@ -1215,7 +1215,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart,
{
#ifdef DBG_UTIL
// within the text there must not be a Portion change (attribute/tab)!
- sal_Int32 nTabPos = mpDoc->GetNodes().GetObject( nPara )->GetText().indexOf( '\t', nPortionStart );
+ sal_Int32 nTabPos = mpDoc->GetNodes()[ nPara ]->GetText().indexOf( '\t', nPortionStart );
DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
#endif
@@ -1237,7 +1237,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart,
SeekCursor( nPara, nPortionStart+1, aFont, NULL );
mpRefDev->SetFont( aFont );
}
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
nWidth = (sal_uLong)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
}
@@ -1315,7 +1315,7 @@ Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion )
sal_uLong TextEngine::GetParagraphCount() const
{
- return mpDoc->GetNodes().Count();
+ return mpDoc->GetNodes().size();
}
void TextEngine::EnableUndo( bool bEnable )
@@ -1367,14 +1367,14 @@ void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara )
DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" );
TEParaPortion* pNew = new TEParaPortion( pNode );
mpTEParaPortions->Insert( pNew, nPara );
- mpDoc->GetNodes().Insert( pNode, nPara );
+ mpDoc->GetNodes().insert( mpDoc->GetNodes().begin() + nPara, pNode );
ImpParagraphInserted( nPara );
}
TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_uInt16 nSepPos )
{
#ifdef DBG_UTIL
- TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+ TextNode* pNode = mpDoc->GetNodes()[ nNode ];
DBG_ASSERT( pNode, "SplitContent: Invalid Node!" );
DBG_ASSERT( IsInUndo(), "SplitContent: only in Undo()!" );
DBG_ASSERT( nSepPos <= pNode->GetText().getLength(), "SplitContent: Bad index" );
@@ -1395,7 +1395,7 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, vcl::Font& rFont,
if ( pOutDev )
pOutDev->SetTextColor( maTextColor );
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
sal_uInt16 nAttribs = pNode->GetCharAttribs().Count();
for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
{
@@ -1633,7 +1633,7 @@ void TextEngine::FormatDoc()
void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
TextLine* pTmpLine = new TextLine;
@@ -1665,7 +1665,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, sal_uInt16 nPortionStart, long nRemainingWidth )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
// Font still should be adjusted
sal_Int32 nMaxBreakPos = mpRefDev->GetTextBreak( pNode->GetText(), nRemainingWidth, nPortionStart );
@@ -2142,7 +2142,7 @@ bool TextEngine::CreateLines( sal_uLong nPara )
{
// bool: changing Height of Paragraph Yes/No - true/false
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
DBG_ASSERT( pTEParaPortion->IsInvalid(), "CreateLines: Portion not invalid!" );
@@ -2467,10 +2467,10 @@ bool TextEngine::CreateLines( sal_uLong nPara )
OUString TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord )
{
OUString aWord;
- if ( rCursorPos.GetPara() < mpDoc->GetNodes().Count() )
+ if ( rCursorPos.GetPara() < mpDoc->GetNodes().size() )
{
TextSelection aSel( rCursorPos );
- TextNode* pNode = mpDoc->GetNodes().GetObject( rCursorPos.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes()[ rCursorPos.GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator();
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rCursorPos.GetIndex(), GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
aSel.GetStart().GetIndex() = (sal_uInt16)aBoundary.startPos;
@@ -2493,8 +2493,8 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->GetNodes().Count();
- TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
+ sal_uLong nParas = mpDoc->GetNodes().size();
+ TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ];
aSel = TextPaM( nParas-1 , pNode->GetText().getLength() );
}
@@ -2534,8 +2534,8 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->GetNodes().Count();
- TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
+ sal_uLong nParas = mpDoc->GetNodes().size();
+ TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ];
aSel.GetStart() = TextPaM( 0, 0 );
aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() );
}
@@ -2548,7 +2548,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
for ( sal_uLong nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); nPara++ )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
sal_uInt16 nStartPos = 0;
sal_Int32 nEndPos = pNode->GetText().getLength();
@@ -2617,9 +2617,9 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
{
- if ( nPara < mpDoc->GetNodes().Count() )
+ if ( nPara < mpDoc->GetNodes().size() )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
if ( pNode->GetCharAttribs().Count() )
{
pNode->GetCharAttribs().Clear();
@@ -2638,9 +2638,9 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
}
void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate )
{
- if ( nPara < mpDoc->GetNodes().Count() )
+ if ( nPara < mpDoc->GetNodes().size() )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
if ( pNode->GetCharAttribs().Count() )
{
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
@@ -2662,9 +2662,9 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFo
}
void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib )
{
- if ( nPara < mpDoc->GetNodes().Count() )
+ if ( nPara < mpDoc->GetNodes().size() )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
if ( pNode->GetCharAttribs().Count() )
{
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
@@ -2693,9 +2693,9 @@ void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16
// As TextEngine is currently intended only for TextEditors, there is no Undo for Attributes!
- if ( nPara < mpDoc->GetNodes().Count() )
+ if ( nPara < mpDoc->GetNodes().size() )
{
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
sal_Int32 nMax = pNode->GetText().getLength();
@@ -2733,7 +2733,7 @@ void TextEngine::ValidateSelection( TextSelection& rSel ) const
void TextEngine::ValidatePaM( TextPaM& rPaM ) const
{
- sal_uLong nMaxPara = mpDoc->GetNodes().Count() - 1;
+ sal_uLong nMaxPara = mpDoc->GetNodes().size() - 1;
if ( rPaM.GetPara() > nMaxPara )
{
rPaM.GetPara() = nMaxPara;
@@ -2779,7 +2779,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
TextView* pView = (*mpViews)[ --nView ];
if ( pView != GetActiveView() )
{
- sal_uLong nParas = mpDoc->GetNodes().Count();
+ sal_uLong nParas = mpDoc->GetNodes().size();
for ( int n = 0; n <= 1; n++ )
{
TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd();
@@ -2963,7 +2963,7 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_u
{
sal_uInt8 nRightToLeft = 0;
- TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TextNode* pNode = mpDoc->GetNodes()[ nPara ];
if ( pNode && !pNode->GetText().isEmpty() )
{
TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index 57a721ed2b33..2ecd26495965 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -173,20 +173,20 @@ void TextUndoDelPara::Undo()
void TextUndoDelPara::Redo()
{
// pNode is not valid anymore in case an Undo joined paragraphs
- mpNode = GetDoc()->GetNodes().GetObject( mnPara );
+ mpNode = GetDoc()->GetNodes()[ mnPara ];
delete GetTEParaPortions()->GetObject( mnPara );
GetTEParaPortions()->Remove( mnPara );
// do not delete Node because of Undo!
- GetDoc()->GetNodes().Remove( mnPara );
+ GetDoc()->GetNodes().erase( ::std::find( GetDoc()->GetNodes().begin(), GetDoc()->GetNodes().end(), mpNode ) );
GetTextEngine()->ImpParagraphRemoved( mnPara );
mbDelObject = true; // belongs again to the Undo
- sal_uLong nParas = GetDoc()->GetNodes().Count();
+ sal_uLong nParas = GetDoc()->GetNodes().size();
sal_uLong n = mnPara < nParas ? mnPara : (nParas-1);
- TextNode* pN = GetDoc()->GetNodes().GetObject( n );
+ TextNode* pN = GetDoc()->GetNodes()[ n ];
TextPaM aPaM( n, pN->GetText().getLength() );
SetSelection( aPaM );
}
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index e135eee12bf2..0aa78887278e 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -736,7 +736,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
aCurSel = mpImpl->mpTextEngine->ImpInsertParaBreak( aCurSel );
if ( mpImpl->mbAutoIndent )
{
- TextNode* pPrev = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aCurSel.GetEnd().GetPara() - 1 );
+ TextNode* pPrev = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aCurSel.GetEnd().GetPara() - 1 ];
sal_uInt16 n = 0;
while ( ( n < pPrev->GetText().getLength() ) && (
( pPrev->GetText()[ n ] == ' ' ) ||
@@ -859,7 +859,7 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
if ( mpImpl->maSelection.GetEnd().GetIndex() < mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection.GetEnd().GetPara() ) )
{
HideSelection();
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( mpImpl->maSelection.GetEnd().GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ mpImpl->maSelection.GetEnd().GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
TextSelection aNewSel( mpImpl->maSelection );
@@ -898,7 +898,7 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
HideSelection();
TextSelection aNewSel( mpImpl->maSelection );
aNewSel.GetStart().GetIndex() = 0;
- aNewSel.GetEnd().GetIndex() = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( mpImpl->maSelection.GetEnd().GetPara() )->GetText().getLength();
+ aNewSel.GetEnd().GetIndex() = mpImpl->mpTextEngine->mpDoc->GetNodes()[ mpImpl->maSelection.GetEnd().GetPara() ]->GetText().getLength();
ImpSetSelection( aNewSel );
ShowSelection();
ShowCursor( true, true );
@@ -922,7 +922,7 @@ void TextView::Command( const CommandEvent& rCEvt )
{
DeleteSelected();
delete mpImpl->mpTextEngine->mpIMEInfos;
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( GetSelection().GetEnd().GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ GetSelection().GetEnd().GetPara() ];
mpImpl->mpTextEngine->mpIMEInfos = new TEIMEInfos( GetSelection().GetEnd(), pNode->GetText().copy( GetSelection().GetEnd().GetIndex() ) );
mpImpl->mpTextEngine->mpIMEInfos->bWasCursorOverwrite = !IsInsertMode();
}
@@ -1376,7 +1376,7 @@ TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIterator
if ( aPaM.GetIndex() )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
sal_Int32 nCount = 1;
aPaM.GetIndex() = (sal_uInt16)xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount );
@@ -1384,7 +1384,7 @@ TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIterator
else if ( aPaM.GetPara() )
{
aPaM.GetPara()--;
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
aPaM.GetIndex() = pNode->GetText().getLength();
}
return aPaM;
@@ -1394,14 +1394,14 @@ TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIterato
{
TextPaM aPaM( rPaM );
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
{
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
sal_Int32 nCount = 1;
aPaM.GetIndex() = (sal_uInt16)xBI->nextCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount );
}
- else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count()-1) )
+ else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size()-1) )
{
aPaM.GetPara()++;
aPaM.GetIndex() = 0;
@@ -1416,7 +1416,7 @@ TextPaM TextView::CursorWordLeft( const TextPaM& rPaM )
if ( aPaM.GetIndex() )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
if ( aBoundary.startPos >= rPaM.GetIndex() )
@@ -1426,7 +1426,7 @@ TextPaM TextView::CursorWordLeft( const TextPaM& rPaM )
else if ( aPaM.GetPara() )
{
aPaM.GetPara()--;
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
aPaM.GetIndex() = pNode->GetText().getLength();
}
return aPaM;
@@ -1436,14 +1436,14 @@ TextPaM TextView::CursorWordRight( const TextPaM& rPaM )
{
TextPaM aPaM( rPaM );
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
{
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
aPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
}
- else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count()-1) )
+ else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size()-1) )
{
aPaM.GetPara()++;
aPaM.GetIndex() = 0;
@@ -1467,7 +1467,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
}
else if ( nDelMode == DELMODE_RESTOFWORD )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aEndPaM.GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
if ( aBoundary.startPos == mpImpl->maSelection.GetEnd().GetIndex() )
@@ -1495,21 +1495,21 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
}
else if ( nDelMode == DELMODE_RESTOFWORD )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aEndPaM.GetPara() ];
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
aEndPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
}
else // DELMODE_RESTOFCONTENT
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aEndPaM.GetPara() ];
if ( aEndPaM.GetIndex() < pNode->GetText().getLength() )
aEndPaM.GetIndex() = pNode->GetText().getLength();
- else if ( aEndPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) )
+ else if ( aEndPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1 ) )
{
// next paragraph
aEndPaM.GetPara()++;
- TextNode* pNextNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ TextNode* pNextNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aEndPaM.GetPara() ];
aEndPaM.GetIndex() = pNextNode->GetText().getLength();
}
}
@@ -1581,7 +1581,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
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
+ else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1 ) ) // next paragraph
{
aPaM.GetPara()++;
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
@@ -1639,7 +1639,7 @@ TextPaM TextView::CursorStartOfParagraph( const TextPaM& rPaM )
TextPaM TextView::CursorEndOfParagraph( const TextPaM& rPaM )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ rPaM.GetPara() ];
TextPaM aPaM( rPaM );
aPaM.GetIndex() = pNode->GetText().getLength();
return aPaM;
@@ -1653,8 +1653,8 @@ TextPaM TextView::CursorStartOfDoc()
TextPaM TextView::CursorEndOfDoc()
{
- sal_uLong nNode = mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1;
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( nNode );
+ sal_uLong nNode = mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1;
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ nNode ];
TextPaM aPaM( nNode, pNode->GetText().getLength() );
return aPaM;
}
@@ -1713,7 +1713,7 @@ void TextView::ImpShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bSpec
if ( !IsInsertMode() && !mpImpl->maSelection.HasRange() )
{
- TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ];
if ( !pNode->GetText().isEmpty() && ( aPaM.GetIndex() < pNode->GetText().getLength() ) )
{
// If we are behind a portion, and the next portion has other direction, we must change position...