summaryrefslogtreecommitdiff
path: root/vcl/source/edit/texteng.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/edit/texteng.cxx')
-rw-r--r--vcl/source/edit/texteng.cxx92
1 files changed, 46 insertions, 46 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 81ff71f4a012..81a1a0f65c59 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -299,7 +299,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator
sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const
{
- return mpDoc->GetNode( nPara )->GetText().getLength();
+ return mpDoc->GetNodes().GetObject( nPara )->GetText().getLength();
}
void TextEngine::SetUpdateMode( bool bUpdate )
@@ -383,7 +383,7 @@ void TextEngine::ImpInitDoc()
mpTEParaPortions = new TEParaPortions;
TextNode* pNode = new TextNode( OUString() );
- mpDoc->InsertNode( pNode, 0 );
+ mpDoc->GetNodes().Insert( pNode, 0 );
TEParaPortion* pIniPortion = new TEParaPortion( pNode );
mpTEParaPortions->Insert( pIniPortion, (sal_uLong)0 );
@@ -409,7 +409,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->GetNode( nNode );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
sal_uInt16 nStartPos = 0;
sal_Int32 nEndPos = pNode->GetText().getLength();
@@ -476,7 +476,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->GetNode( nNode );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
if ( pNode && pNode->GetCharAttribs().HasEmptyAttribs() && !pNode->GetText().isEmpty() )
pNode->GetCharAttribs().DeleteEmptyAttribs();
}
@@ -487,7 +487,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->GetNode( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
OUString aStr( pNode->GetText().copy( rPaM.GetIndex(), nChars ) );
// check if attributes are being deleted or changed
@@ -512,8 +512,8 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight )
{
DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" );
- TextNode* pLeft = mpDoc->GetNode( nLeft );
- TextNode* pRight = mpDoc->GetNode( nRight );
+ TextNode* pLeft = mpDoc->GetNodes().GetObject( nLeft );
+ TextNode* pRight = mpDoc->GetNodes().GetObject( nRight );
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoConnectParas( this, nLeft, pLeft->GetText().getLength() ) );
@@ -524,7 +524,7 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight )
DBG_ASSERT( pLeft && pLeftPortion, "ImpConnectParagraphs(1): Hidden Portion" );
DBG_ASSERT( pRight && pRightPortion, "ImpConnectParagraphs(2): Hidden Portion" );
- TextPaM aPaM = mpDoc->ConnectParagraphs( *pLeft, *pRight );
+ TextPaM aPaM = mpDoc->ConnectParagraphs( pLeft, pRight );
ImpParagraphRemoved( nRight );
pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->GetText().getLength() );
@@ -565,7 +565,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
if ( nStartNode != nEndNode )
{
// the remainder of StartNodes...
- TextNode* pLeft = mpDoc->GetNode( nStartNode );
+ TextNode* pLeft = mpDoc->GetNodes().GetObject( nStartNode );
sal_Int32 nChars = pLeft->GetText().getLength() - aStartPaM.GetIndex();
if ( nChars )
{
@@ -608,11 +608,11 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
void TextEngine::ImpRemoveParagraph( sal_uLong nPara )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
boost::scoped_ptr<TEParaPortion> pPortion(mpTEParaPortions->GetObject( nPara ));
// the Node is handled by Undo and is deleted if appropriate
- mpDoc->RemoveNode( nPara );
+ mpDoc->GetNodes().Remove( nPara );
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoDelPara( this, pNode, nPara ) );
else
@@ -669,7 +669,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
DBG_ASSERT( c != '\r', "InsertText: NewLine!" );
TextPaM aPaM( rCurSel.GetStart() );
- TextNode* pNode = mpDoc->GetNode( aPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
bool bDoOverwrite = ( bOverwrite &&
( aPaM.GetIndex() < pNode->GetText().getLength() ) );
@@ -831,7 +831,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) );
- TextNode* pNode = mpDoc->GetNode( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength();
TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) );
@@ -840,7 +840,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" );
pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
- TextNode* pNewNode = mpDoc->GetNode( aPaM.GetPara() );
+ TextNode* pNewNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
TEParaPortion* pNewPortion = new TEParaPortion( pNewNode );
mpTEParaPortions->Insert( pNewPortion, aPaM.GetPara() );
ImpParagraphInserted( aPaM.GetPara() );
@@ -1026,7 +1026,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->GetNode( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
if ( pNode && ( rPaM.GetIndex() < pNode->GetText().getLength() ) )
pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
return pAttr;
@@ -1035,9 +1035,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->CountNodes(); --n && !bAttr; )
+ for ( sal_uLong n = mpDoc->GetNodes().Count(); --n && !bAttr; )
{
- TextNode* pNode = mpDoc->GetNode( n );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( n );
bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
}
return bAttr;
@@ -1066,8 +1066,8 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart )
}
// not found - go to last visible
- sal_uLong nLastNode = mpDoc->CountNodes() - 1;
- TextNode* pLast = mpDoc->GetNode( nLastNode );
+ sal_uLong nLastNode = mpDoc->GetNodes().Count() - 1;
+ TextNode* pLast = mpDoc->GetNodes().GetObject( nLastNode );
return TextPaM( nLastNode, pLast->GetText().getLength() );
}
@@ -1216,7 +1216,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->GetNode( nPara )->GetText().indexOf( '\t', nPortionStart );
+ sal_Int32 nTabPos = mpDoc->GetNodes().GetObject( nPara )->GetText().indexOf( '\t', nPortionStart );
DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
#endif
@@ -1238,7 +1238,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart,
SeekCursor( nPara, nPortionStart+1, aFont, NULL );
mpRefDev->SetFont( aFont );
}
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
nWidth = (sal_uLong)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
}
@@ -1316,7 +1316,7 @@ Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion )
sal_uLong TextEngine::GetParagraphCount() const
{
- return mpDoc->CountNodes();
+ return mpDoc->GetNodes().Count();
}
void TextEngine::EnableUndo( bool bEnable )
@@ -1368,14 +1368,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->InsertNode( pNode, nPara );
+ mpDoc->GetNodes().Insert( pNode, nPara );
ImpParagraphInserted( nPara );
}
TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_uInt16 nSepPos )
{
#ifdef DBG_UTIL
- TextNode* pNode = mpDoc->GetNode( nNode );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
DBG_ASSERT( pNode, "SplitContent: Invalid Node!" );
DBG_ASSERT( IsInUndo(), "SplitContent: only in Undo()!" );
DBG_ASSERT( nSepPos <= pNode->GetText().getLength(), "SplitContent: Bad index" );
@@ -1396,7 +1396,7 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, vcl::Font& rFont,
if ( pOutDev )
pOutDev->SetTextColor( maTextColor );
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
sal_uInt16 nAttribs = pNode->GetCharAttribs().Count();
for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
{
@@ -1634,7 +1634,7 @@ void TextEngine::FormatDoc()
void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
TextLine* pTmpLine = new TextLine;
@@ -1666,7 +1666,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, sal_uInt16 nPortionStart, long nRemainingWidth )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
// Font still should be adjusted
sal_Int32 nMaxBreakPos = mpRefDev->GetTextBreak( pNode->GetText(), nRemainingWidth, nPortionStart );
@@ -2143,7 +2143,7 @@ bool TextEngine::CreateLines( sal_uLong nPara )
{
// bool: changing Height of Paragraph Yes/No - true/false
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
DBG_ASSERT( pTEParaPortion->IsInvalid(), "CreateLines: Portion not invalid!" );
@@ -2468,10 +2468,10 @@ bool TextEngine::CreateLines( sal_uLong nPara )
OUString TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord )
{
OUString aWord;
- if ( rCursorPos.GetPara() < mpDoc->CountNodes() )
+ if ( rCursorPos.GetPara() < mpDoc->GetNodes().Count() )
{
TextSelection aSel( rCursorPos );
- TextNode* pNode = mpDoc->GetNode( rCursorPos.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( 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;
@@ -2494,8 +2494,8 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->CountNodes();
- TextNode* pNode = mpDoc->GetNode( nParas - 1 );
+ sal_uLong nParas = mpDoc->GetNodes().Count();
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
aSel = TextPaM( nParas-1 , pNode->GetText().getLength() );
}
@@ -2535,8 +2535,8 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->CountNodes();
- TextNode* pNode = mpDoc->GetNode( nParas - 1 );
+ sal_uLong nParas = mpDoc->GetNodes().Count();
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
aSel.GetStart() = TextPaM( 0, 0 );
aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() );
}
@@ -2549,7 +2549,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->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
sal_uInt16 nStartPos = 0;
sal_Int32 nEndPos = pNode->GetText().getLength();
@@ -2618,9 +2618,9 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
{
- if ( nPara < mpDoc->CountNodes() )
+ if ( nPara < mpDoc->GetNodes().Count() )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
if ( pNode->GetCharAttribs().Count() )
{
pNode->GetCharAttribs().Clear();
@@ -2639,9 +2639,9 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
}
void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate )
{
- if ( nPara < mpDoc->CountNodes() )
+ if ( nPara < mpDoc->GetNodes().Count() )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
if ( pNode->GetCharAttribs().Count() )
{
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
@@ -2663,9 +2663,9 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFo
}
void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib )
{
- if ( nPara < mpDoc->CountNodes() )
+ if ( nPara < mpDoc->GetNodes().Count() )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
if ( pNode->GetCharAttribs().Count() )
{
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
@@ -2694,9 +2694,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->CountNodes() )
+ if ( nPara < mpDoc->GetNodes().Count() )
{
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
sal_Int32 nMax = pNode->GetText().getLength();
@@ -2734,7 +2734,7 @@ void TextEngine::ValidateSelection( TextSelection& rSel ) const
void TextEngine::ValidatePaM( TextPaM& rPaM ) const
{
- sal_uLong nMaxPara = mpDoc->CountNodes() - 1;
+ sal_uLong nMaxPara = mpDoc->GetNodes().Count() - 1;
if ( rPaM.GetPara() > nMaxPara )
{
rPaM.GetPara() = nMaxPara;
@@ -2780,7 +2780,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
TextView* pView = (*mpViews)[ --nView ];
if ( pView != GetActiveView() )
{
- sal_uLong nParas = mpDoc->CountNodes();
+ sal_uLong nParas = mpDoc->GetNodes().Count();
for ( int n = 0; n <= 1; n++ )
{
TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd();
@@ -2964,7 +2964,7 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_u
{
sal_uInt8 nRightToLeft = 0;
- TextNode* pNode = mpDoc->GetNode( nPara );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
if ( pNode && !pNode->GetText().isEmpty() )
{
TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );