fdo#75757 remove inheritance from std::vector
For TextDoc, also removing ToolsList Change-Id: Id818f61f562317ce106414937253f1748a33315a Reviewed-on: https://gerrit.libreoffice.org/12454 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
committed by
Caolán McNamara
parent
df9efbd53d
commit
63d8977f9f
@@ -150,21 +150,6 @@ struct TEIMEInfos
|
|||||||
void DestroyAttribs();
|
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
|
#endif // INCLUDED_VCL_TEXTDATA_HXX
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -407,38 +407,33 @@ void TextNode::Append( const TextNode& rNode )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextNode::operator==(TextNode const& other) const
|
||||||
|
{
|
||||||
|
return maText == other.maText && &maCharAttribs == &other.maCharAttribs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TextDoc::TextDoc()
|
TextDoc::TextDoc()
|
||||||
{
|
{
|
||||||
mnLeftMargin = 0;
|
mnLeftMargin = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
TextDoc::~TextDoc()
|
|
||||||
{
|
|
||||||
DestroyTextNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextDoc::Clear()
|
void TextDoc::Clear()
|
||||||
{
|
{
|
||||||
DestroyTextNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextDoc::DestroyTextNodes()
|
|
||||||
{
|
|
||||||
for ( sal_uLong nNode = 0; nNode < maTextNodes.Count(); nNode++ )
|
|
||||||
delete maTextNodes.GetObject( nNode );
|
|
||||||
maTextNodes.clear();
|
maTextNodes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString TextDoc::GetText( const sal_Unicode* pSep ) const
|
OUString TextDoc::GetText( const sal_Unicode* pSep ) const
|
||||||
{
|
{
|
||||||
sal_uLong nNodes = maTextNodes.Count();
|
sal_uLong nNodes = maTextNodes.size();
|
||||||
|
|
||||||
OUString aASCIIText;
|
OUString aASCIIText;
|
||||||
sal_uLong nLastNode = nNodes-1;
|
sal_uLong nLastNode = nNodes-1;
|
||||||
for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ )
|
for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ )
|
||||||
{
|
{
|
||||||
TextNode* pNode = maTextNodes.GetObject( nNode );
|
const TextNode& pNode = maTextNodes[ nNode ];
|
||||||
OUString aTmp( pNode->GetText() );
|
OUString aTmp( pNode.GetText() );
|
||||||
aASCIIText += aTmp;
|
aASCIIText += aTmp;
|
||||||
if ( pSep && ( nNode != nLastNode ) )
|
if ( pSep && ( nNode != nLastNode ) )
|
||||||
aASCIIText += pSep;
|
aASCIIText += pSep;
|
||||||
@@ -451,9 +446,8 @@ OUString TextDoc::GetText( sal_uLong nPara ) const
|
|||||||
{
|
{
|
||||||
OUString aText;
|
OUString aText;
|
||||||
|
|
||||||
TextNode* pNode = ( nPara < maTextNodes.Count() ) ? maTextNodes.GetObject( nPara ) : 0;
|
if ( nPara < maTextNodes.size() )
|
||||||
if ( pNode )
|
aText = maTextNodes[ nPara ].GetText();
|
||||||
aText = pNode->GetText();
|
|
||||||
|
|
||||||
return aText;
|
return aText;
|
||||||
}
|
}
|
||||||
@@ -461,7 +455,7 @@ OUString TextDoc::GetText( sal_uLong nPara ) const
|
|||||||
sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
|
sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
|
||||||
{
|
{
|
||||||
sal_uLong nLen = 0;
|
sal_uLong nLen = 0;
|
||||||
sal_uLong nNodes = maTextNodes.Count();
|
sal_uLong nNodes = maTextNodes.size();
|
||||||
if ( nNodes )
|
if ( nNodes )
|
||||||
{
|
{
|
||||||
sal_uLong nStartNode = 0;
|
sal_uLong nStartNode = 0;
|
||||||
@@ -474,10 +468,10 @@ sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSe
|
|||||||
|
|
||||||
for ( sal_uLong nNode = nStartNode; nNode <= nEndNode; nNode++ )
|
for ( sal_uLong nNode = nStartNode; nNode <= nEndNode; nNode++ )
|
||||||
{
|
{
|
||||||
TextNode* pNode = maTextNodes.GetObject( nNode );
|
const TextNode& pNode = maTextNodes[ nNode ];
|
||||||
|
|
||||||
sal_uInt16 nS = 0;
|
sal_uInt16 nS = 0;
|
||||||
sal_Int32 nE = pNode->GetText().getLength();
|
sal_Int32 nE = pNode.GetText().getLength();
|
||||||
if ( pSel && ( nNode == pSel->GetStart().GetPara() ) )
|
if ( pSel && ( nNode == pSel->GetStart().GetPara() ) )
|
||||||
nS = pSel->GetStart().GetIndex();
|
nS = pSel->GetStart().GetIndex();
|
||||||
if ( pSel && ( nNode == pSel->GetEnd().GetPara() ) )
|
if ( pSel && ( nNode == pSel->GetEnd().GetPara() ) )
|
||||||
@@ -495,11 +489,11 @@ sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSe
|
|||||||
|
|
||||||
TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c )
|
TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c )
|
||||||
{
|
{
|
||||||
DBG_ASSERT( c != 0x0A, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
|
DBG_ASSERT( c != 0x0A, "TextDoc::InsertText: Newline not allowed in paragraph!" );
|
||||||
DBG_ASSERT( c != 0x0D, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
|
DBG_ASSERT( c != 0x0D, "TextDoc::InsertText: Newline not allowed in paragraph!" );
|
||||||
|
|
||||||
TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
|
TextNode& pNode = maTextNodes[ rPaM.GetPara() ];
|
||||||
pNode->InsertText( rPaM.GetIndex(), c );
|
pNode.InsertText( rPaM.GetIndex(), c );
|
||||||
|
|
||||||
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+1 );
|
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+1 );
|
||||||
return aPaM;
|
return aPaM;
|
||||||
@@ -507,11 +501,11 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c )
|
|||||||
|
|
||||||
TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr )
|
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( 0x0A ) == -1, "TextDoc::InsertText: Newline not allowed in paragraph!" );
|
||||||
DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
|
DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "TextDoc::InsertText: Newline not allowed in paragraph!" );
|
||||||
|
|
||||||
TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
|
TextNode& pNode = maTextNodes[ rPaM.GetPara() ];
|
||||||
pNode->InsertText( rPaM.GetIndex(), rStr );
|
pNode.InsertText( rPaM.GetIndex(), rStr );
|
||||||
|
|
||||||
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.getLength() );
|
TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.getLength() );
|
||||||
return aPaM;
|
return aPaM;
|
||||||
@@ -519,47 +513,45 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr )
|
|||||||
|
|
||||||
TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs )
|
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 );
|
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 );
|
TextPaM aPaM( rPaM.GetPara()+1, 0 );
|
||||||
return aPaM;
|
return aPaM;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPaM TextDoc::ConnectParagraphs( TextNode* pLeft, TextNode* pRight )
|
TextPaM TextDoc::ConnectParagraphs( TextNode& pLeft, const TextNode& pRight )
|
||||||
{
|
{
|
||||||
sal_Int32 nPrevLen = pLeft->GetText().getLength();
|
sal_Int32 nPrevLen = pLeft.GetText().getLength();
|
||||||
pLeft->Append( *pRight );
|
pLeft.Append( pRight );
|
||||||
|
|
||||||
// the paragraph on the right vanishes
|
// the paragraph on the right vanishes
|
||||||
sal_uLong nRight = maTextNodes.GetPos( pRight );
|
RemoveNode( ::std::find( maTextNodes.cbegin(), maTextNodes.cend(), pRight ) - maTextNodes.cbegin() );
|
||||||
maTextNodes.Remove( nRight );
|
|
||||||
delete pRight;
|
|
||||||
|
|
||||||
sal_uLong nLeft = maTextNodes.GetPos( pLeft );
|
sal_uLong nLeft = std::find( maTextNodes.begin(), maTextNodes.end(), pLeft ) - maTextNodes.begin();
|
||||||
TextPaM aPaM( nLeft, nPrevLen );
|
TextPaM aPaM( nLeft, nPrevLen );
|
||||||
return aPaM;
|
return aPaM;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPaM TextDoc::RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars )
|
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 );
|
pNode.RemoveText( rPaM.GetIndex(), nChars );
|
||||||
|
|
||||||
return rPaM;
|
return rPaM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextDoc::IsValidPaM( const TextPaM& rPaM )
|
bool TextDoc::IsValidPaM( const TextPaM& rPaM )
|
||||||
{
|
{
|
||||||
if ( rPaM.GetPara() >= maTextNodes.Count() )
|
if ( rPaM.GetPara() >= maTextNodes.size() )
|
||||||
{
|
{
|
||||||
OSL_FAIL( "PaM: Para out of range" );
|
OSL_FAIL( "PaM: Para out of range" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TextNode * pNode = maTextNodes.GetObject( rPaM.GetPara() );
|
TextNode& pNode = maTextNodes[ rPaM.GetPara() ];
|
||||||
if ( rPaM.GetIndex() > pNode->GetText().getLength() )
|
if ( rPaM.GetIndex() > pNode.GetText().getLength() )
|
||||||
{
|
{
|
||||||
OSL_FAIL( "PaM: Index out of range" );
|
OSL_FAIL( "PaM: Index out of range" );
|
||||||
return false;
|
return false;
|
||||||
|
@@ -85,12 +85,15 @@ public:
|
|||||||
|
|
||||||
TextNode* Split( sal_uInt16 nPos, bool bKeepEndigAttribs );
|
TextNode* Split( sal_uInt16 nPos, bool bKeepEndigAttribs );
|
||||||
void Append( const TextNode& rNode );
|
void Append( const TextNode& rNode );
|
||||||
|
|
||||||
|
bool operator ==(TextNode const& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextDoc
|
class TextDoc
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ToolsList<TextNode*> maTextNodes;
|
typedef boost::ptr_vector<TextNode> TextNodes;
|
||||||
|
TextNodes maTextNodes;
|
||||||
sal_uInt16 mnLeftMargin;
|
sal_uInt16 mnLeftMargin;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -98,19 +101,22 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TextDoc();
|
TextDoc();
|
||||||
~TextDoc();
|
~TextDoc() {};
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
ToolsList<TextNode*>& GetNodes() { return maTextNodes; }
|
const TextNode& GetNode(sal_uInt16 pos) const { return maTextNodes[pos]; }
|
||||||
const ToolsList<TextNode*>& GetNodes() const { return maTextNodes; }
|
TextNode* GetNode(sal_uInt16 pos) { return &maTextNodes[pos]; }
|
||||||
|
size_t CountNodes() { return maTextNodes.size(); }
|
||||||
|
void InsertNode( TextNode* node, size_t nPos ) { maTextNodes.insert( maTextNodes.begin() + nPos, node ); }
|
||||||
|
void RemoveNode( size_t nPos ) { maTextNodes.erase( maTextNodes.begin()+nPos ); }
|
||||||
|
|
||||||
TextPaM RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars );
|
TextPaM RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars );
|
||||||
TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c );
|
TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c );
|
||||||
TextPaM InsertText( const TextPaM& rPaM, const OUString& rStr );
|
TextPaM InsertText( const TextPaM& rPaM, const OUString& rStr );
|
||||||
|
|
||||||
TextPaM InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs );
|
TextPaM InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs );
|
||||||
TextPaM ConnectParagraphs( TextNode* pLeft, TextNode* pRight );
|
TextPaM ConnectParagraphs( TextNode& pLeft, const TextNode& pRight );
|
||||||
|
|
||||||
sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
|
sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
|
||||||
OUString GetText( const sal_Unicode* pSep ) const;
|
OUString GetText( const sal_Unicode* pSep ) const;
|
||||||
|
@@ -299,7 +299,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator
|
|||||||
|
|
||||||
sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const
|
sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const
|
||||||
{
|
{
|
||||||
return mpDoc->GetNodes().GetObject( nPara )->GetText().getLength();
|
return mpDoc->GetNode( nPara )->GetText().getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEngine::SetUpdateMode( bool bUpdate )
|
void TextEngine::SetUpdateMode( bool bUpdate )
|
||||||
@@ -383,7 +383,7 @@ void TextEngine::ImpInitDoc()
|
|||||||
mpTEParaPortions = new TEParaPortions;
|
mpTEParaPortions = new TEParaPortions;
|
||||||
|
|
||||||
TextNode* pNode = new TextNode( OUString() );
|
TextNode* pNode = new TextNode( OUString() );
|
||||||
mpDoc->GetNodes().Insert( pNode, 0 );
|
mpDoc->InsertNode( pNode, 0 );
|
||||||
|
|
||||||
TEParaPortion* pIniPortion = new TEParaPortion( pNode );
|
TEParaPortion* pIniPortion = new TEParaPortion( pNode );
|
||||||
mpTEParaPortions->Insert( pIniPortion, (sal_uLong)0 );
|
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 );
|
const sal_Unicode* pSep = static_getLineEndText( aSeparator );
|
||||||
for ( sal_uLong nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ )
|
for ( sal_uLong nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
|
TextNode* pNode = mpDoc->GetNode( nNode );
|
||||||
|
|
||||||
sal_uInt16 nStartPos = 0;
|
sal_uInt16 nStartPos = 0;
|
||||||
sal_Int32 nEndPos = pNode->GetText().getLength();
|
sal_Int32 nEndPos = pNode->GetText().getLength();
|
||||||
@@ -476,7 +476,7 @@ void TextEngine::SetText( const OUString& rText )
|
|||||||
void TextEngine::CursorMoved( sal_uLong nNode )
|
void TextEngine::CursorMoved( sal_uLong nNode )
|
||||||
{
|
{
|
||||||
// delete empty attribute; but only if paragraph is not empty!
|
// delete empty attribute; but only if paragraph is not empty!
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
|
TextNode* pNode = mpDoc->GetNode( nNode );
|
||||||
if ( pNode && pNode->GetCharAttribs().HasEmptyAttribs() && !pNode->GetText().isEmpty() )
|
if ( pNode && pNode->GetCharAttribs().HasEmptyAttribs() && !pNode->GetText().isEmpty() )
|
||||||
pNode->GetCharAttribs().DeleteEmptyAttribs();
|
pNode->GetCharAttribs().DeleteEmptyAttribs();
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndo
|
|||||||
if ( IsUndoEnabled() && !IsInUndo() )
|
if ( IsUndoEnabled() && !IsInUndo() )
|
||||||
{
|
{
|
||||||
// attributes have to be saved for UNDO before RemoveChars!
|
// attributes have to be saved for UNDO before RemoveChars!
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
|
TextNode* pNode = mpDoc->GetNode( rPaM.GetPara() );
|
||||||
OUString aStr( pNode->GetText().copy( rPaM.GetIndex(), nChars ) );
|
OUString aStr( pNode->GetText().copy( rPaM.GetIndex(), nChars ) );
|
||||||
|
|
||||||
// check if attributes are being deleted or changed
|
// 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 ?" );
|
DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" );
|
||||||
|
|
||||||
TextNode* pLeft = mpDoc->GetNodes().GetObject( nLeft );
|
TextNode* pLeft = mpDoc->GetNode( nLeft );
|
||||||
TextNode* pRight = mpDoc->GetNodes().GetObject( nRight );
|
TextNode* pRight = mpDoc->GetNode( nRight );
|
||||||
|
|
||||||
if ( IsUndoEnabled() && !IsInUndo() )
|
if ( IsUndoEnabled() && !IsInUndo() )
|
||||||
InsertUndo( new TextUndoConnectParas( this, nLeft, pLeft->GetText().getLength() ) );
|
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( pLeft && pLeftPortion, "ImpConnectParagraphs(1): Hidden Portion" );
|
||||||
DBG_ASSERT( pRight && pRightPortion, "ImpConnectParagraphs(2): Hidden Portion" );
|
DBG_ASSERT( pRight && pRightPortion, "ImpConnectParagraphs(2): Hidden Portion" );
|
||||||
|
|
||||||
TextPaM aPaM = mpDoc->ConnectParagraphs( pLeft, pRight );
|
TextPaM aPaM = mpDoc->ConnectParagraphs( *pLeft, *pRight );
|
||||||
ImpParagraphRemoved( nRight );
|
ImpParagraphRemoved( nRight );
|
||||||
|
|
||||||
pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->GetText().getLength() );
|
pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->GetText().getLength() );
|
||||||
@@ -565,7 +565,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
|
|||||||
if ( nStartNode != nEndNode )
|
if ( nStartNode != nEndNode )
|
||||||
{
|
{
|
||||||
// the remainder of StartNodes...
|
// the remainder of StartNodes...
|
||||||
TextNode* pLeft = mpDoc->GetNodes().GetObject( nStartNode );
|
TextNode* pLeft = mpDoc->GetNode( nStartNode );
|
||||||
sal_Int32 nChars = pLeft->GetText().getLength() - aStartPaM.GetIndex();
|
sal_Int32 nChars = pLeft->GetText().getLength() - aStartPaM.GetIndex();
|
||||||
if ( nChars )
|
if ( nChars )
|
||||||
{
|
{
|
||||||
@@ -608,11 +608,11 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
|
|||||||
|
|
||||||
void TextEngine::ImpRemoveParagraph( sal_uLong nPara )
|
void TextEngine::ImpRemoveParagraph( sal_uLong nPara )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
boost::scoped_ptr<TEParaPortion> pPortion(mpTEParaPortions->GetObject( nPara ));
|
boost::scoped_ptr<TEParaPortion> pPortion(mpTEParaPortions->GetObject( nPara ));
|
||||||
|
|
||||||
// the Node is handled by Undo and is deleted if appropriate
|
// the Node is handled by Undo and is deleted if appropriate
|
||||||
mpDoc->GetNodes().Remove( nPara );
|
mpDoc->RemoveNode( nPara );
|
||||||
if ( IsUndoEnabled() && !IsInUndo() )
|
if ( IsUndoEnabled() && !IsInUndo() )
|
||||||
InsertUndo( new TextUndoDelPara( this, pNode, nPara ) );
|
InsertUndo( new TextUndoDelPara( this, pNode, nPara ) );
|
||||||
else
|
else
|
||||||
@@ -669,7 +669,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
|
|||||||
DBG_ASSERT( c != '\r', "InsertText: NewLine!" );
|
DBG_ASSERT( c != '\r', "InsertText: NewLine!" );
|
||||||
|
|
||||||
TextPaM aPaM( rCurSel.GetStart() );
|
TextPaM aPaM( rCurSel.GetStart() );
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpDoc->GetNode( aPaM.GetPara() );
|
||||||
|
|
||||||
bool bDoOverwrite = ( bOverwrite &&
|
bool bDoOverwrite = ( bOverwrite &&
|
||||||
( aPaM.GetIndex() < pNode->GetText().getLength() ) );
|
( aPaM.GetIndex() < pNode->GetText().getLength() ) );
|
||||||
@@ -831,7 +831,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
|
|||||||
if ( IsUndoEnabled() && !IsInUndo() )
|
if ( IsUndoEnabled() && !IsInUndo() )
|
||||||
InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) );
|
InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) );
|
||||||
|
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
|
TextNode* pNode = mpDoc->GetNode( rPaM.GetPara() );
|
||||||
bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength();
|
bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength();
|
||||||
|
|
||||||
TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) );
|
TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) );
|
||||||
@@ -840,7 +840,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt
|
|||||||
DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" );
|
DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" );
|
||||||
pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
|
pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
|
||||||
|
|
||||||
TextNode* pNewNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNewNode = mpDoc->GetNode( aPaM.GetPara() );
|
||||||
TEParaPortion* pNewPortion = new TEParaPortion( pNewNode );
|
TEParaPortion* pNewPortion = new TEParaPortion( pNewNode );
|
||||||
mpTEParaPortions->Insert( pNewPortion, aPaM.GetPara() );
|
mpTEParaPortions->Insert( pNewPortion, aPaM.GetPara() );
|
||||||
ImpParagraphInserted( 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* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const
|
||||||
{
|
{
|
||||||
const TextCharAttrib* pAttr = NULL;
|
const TextCharAttrib* pAttr = NULL;
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
|
TextNode* pNode = mpDoc->GetNode( rPaM.GetPara() );
|
||||||
if ( pNode && ( rPaM.GetIndex() < pNode->GetText().getLength() ) )
|
if ( pNode && ( rPaM.GetIndex() < pNode->GetText().getLength() ) )
|
||||||
pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
|
pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
|
||||||
return pAttr;
|
return pAttr;
|
||||||
@@ -1035,9 +1035,9 @@ const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt1
|
|||||||
bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const
|
bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const
|
||||||
{
|
{
|
||||||
bool bAttr = false;
|
bool bAttr = false;
|
||||||
for ( sal_uLong n = mpDoc->GetNodes().Count(); --n && !bAttr; )
|
for ( sal_uLong n = mpDoc->CountNodes(); --n && !bAttr; )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( n );
|
TextNode* pNode = mpDoc->GetNode( n );
|
||||||
bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
|
bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
|
||||||
}
|
}
|
||||||
return bAttr;
|
return bAttr;
|
||||||
@@ -1066,8 +1066,8 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not found - go to last visible
|
// not found - go to last visible
|
||||||
sal_uLong nLastNode = mpDoc->GetNodes().Count() - 1;
|
sal_uLong nLastNode = mpDoc->CountNodes() - 1;
|
||||||
TextNode* pLast = mpDoc->GetNodes().GetObject( nLastNode );
|
TextNode* pLast = mpDoc->GetNode( nLastNode );
|
||||||
return TextPaM( nLastNode, pLast->GetText().getLength() );
|
return TextPaM( nLastNode, pLast->GetText().getLength() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,7 +1216,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart,
|
|||||||
{
|
{
|
||||||
#ifdef DBG_UTIL
|
#ifdef DBG_UTIL
|
||||||
// within the text there must not be a Portion change (attribute/tab)!
|
// 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->GetNode( nPara )->GetText().indexOf( '\t', nPortionStart );
|
||||||
DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
|
DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1238,7 +1238,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart,
|
|||||||
SeekCursor( nPara, nPortionStart+1, aFont, NULL );
|
SeekCursor( nPara, nPortionStart+1, aFont, NULL );
|
||||||
mpRefDev->SetFont( aFont );
|
mpRefDev->SetFont( aFont );
|
||||||
}
|
}
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
nWidth = (sal_uLong)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
|
nWidth = (sal_uLong)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1316,7 +1316,7 @@ Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion )
|
|||||||
|
|
||||||
sal_uLong TextEngine::GetParagraphCount() const
|
sal_uLong TextEngine::GetParagraphCount() const
|
||||||
{
|
{
|
||||||
return mpDoc->GetNodes().Count();
|
return mpDoc->CountNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEngine::EnableUndo( bool bEnable )
|
void TextEngine::EnableUndo( bool bEnable )
|
||||||
@@ -1368,14 +1368,14 @@ void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara )
|
|||||||
DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" );
|
DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" );
|
||||||
TEParaPortion* pNew = new TEParaPortion( pNode );
|
TEParaPortion* pNew = new TEParaPortion( pNode );
|
||||||
mpTEParaPortions->Insert( pNew, nPara );
|
mpTEParaPortions->Insert( pNew, nPara );
|
||||||
mpDoc->GetNodes().Insert( pNode, nPara );
|
mpDoc->InsertNode( pNode, nPara );
|
||||||
ImpParagraphInserted( nPara );
|
ImpParagraphInserted( nPara );
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_uInt16 nSepPos )
|
TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_uInt16 nSepPos )
|
||||||
{
|
{
|
||||||
#ifdef DBG_UTIL
|
#ifdef DBG_UTIL
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
|
TextNode* pNode = mpDoc->GetNode( nNode );
|
||||||
DBG_ASSERT( pNode, "SplitContent: Invalid Node!" );
|
DBG_ASSERT( pNode, "SplitContent: Invalid Node!" );
|
||||||
DBG_ASSERT( IsInUndo(), "SplitContent: only in Undo()!" );
|
DBG_ASSERT( IsInUndo(), "SplitContent: only in Undo()!" );
|
||||||
DBG_ASSERT( nSepPos <= pNode->GetText().getLength(), "SplitContent: Bad index" );
|
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 )
|
if ( pOutDev )
|
||||||
pOutDev->SetTextColor( maTextColor );
|
pOutDev->SetTextColor( maTextColor );
|
||||||
|
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
sal_uInt16 nAttribs = pNode->GetCharAttribs().Count();
|
sal_uInt16 nAttribs = pNode->GetCharAttribs().Count();
|
||||||
for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
|
for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
|
||||||
{
|
{
|
||||||
@@ -1634,7 +1634,7 @@ void TextEngine::FormatDoc()
|
|||||||
|
|
||||||
void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
|
void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
||||||
|
|
||||||
TextLine* pTmpLine = new TextLine;
|
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 )
|
void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, sal_uInt16 nPortionStart, long nRemainingWidth )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
|
|
||||||
// Font still should be adjusted
|
// Font still should be adjusted
|
||||||
sal_Int32 nMaxBreakPos = mpRefDev->GetTextBreak( pNode->GetText(), nRemainingWidth, nPortionStart );
|
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
|
// bool: changing Height of Paragraph Yes/No - true/false
|
||||||
|
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
||||||
DBG_ASSERT( pTEParaPortion->IsInvalid(), "CreateLines: Portion not invalid!" );
|
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 TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord )
|
||||||
{
|
{
|
||||||
OUString aWord;
|
OUString aWord;
|
||||||
if ( rCursorPos.GetPara() < mpDoc->GetNodes().Count() )
|
if ( rCursorPos.GetPara() < mpDoc->CountNodes() )
|
||||||
{
|
{
|
||||||
TextSelection aSel( rCursorPos );
|
TextSelection aSel( rCursorPos );
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( rCursorPos.GetPara() );
|
TextNode* pNode = mpDoc->GetNode( rCursorPos.GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator();
|
uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator();
|
||||||
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rCursorPos.GetIndex(), GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
|
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rCursorPos.GetIndex(), GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
|
||||||
aSel.GetStart().GetIndex() = (sal_uInt16)aBoundary.startPos;
|
aSel.GetStart().GetIndex() = (sal_uInt16)aBoundary.startPos;
|
||||||
@@ -2494,8 +2494,8 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
|
|||||||
aSel = *pSel;
|
aSel = *pSel;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sal_uLong nParas = mpDoc->GetNodes().Count();
|
sal_uLong nParas = mpDoc->CountNodes();
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
|
TextNode* pNode = mpDoc->GetNode( nParas - 1 );
|
||||||
aSel = TextPaM( nParas-1 , pNode->GetText().getLength() );
|
aSel = TextPaM( nParas-1 , pNode->GetText().getLength() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2535,8 +2535,8 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
|
|||||||
aSel = *pSel;
|
aSel = *pSel;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sal_uLong nParas = mpDoc->GetNodes().Count();
|
sal_uLong nParas = mpDoc->CountNodes();
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
|
TextNode* pNode = mpDoc->GetNode( nParas - 1 );
|
||||||
aSel.GetStart() = TextPaM( 0, 0 );
|
aSel.GetStart() = TextPaM( 0, 0 );
|
||||||
aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() );
|
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++ )
|
for ( sal_uLong nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); nPara++ )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
|
|
||||||
sal_uInt16 nStartPos = 0;
|
sal_uInt16 nStartPos = 0;
|
||||||
sal_Int32 nEndPos = pNode->GetText().getLength();
|
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 )
|
void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
|
||||||
{
|
{
|
||||||
if ( nPara < mpDoc->GetNodes().Count() )
|
if ( nPara < mpDoc->CountNodes() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
if ( pNode->GetCharAttribs().Count() )
|
if ( pNode->GetCharAttribs().Count() )
|
||||||
{
|
{
|
||||||
pNode->GetCharAttribs().Clear();
|
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 )
|
void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate )
|
||||||
{
|
{
|
||||||
if ( nPara < mpDoc->GetNodes().Count() )
|
if ( nPara < mpDoc->CountNodes() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
if ( pNode->GetCharAttribs().Count() )
|
if ( pNode->GetCharAttribs().Count() )
|
||||||
{
|
{
|
||||||
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
|
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 )
|
void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib )
|
||||||
{
|
{
|
||||||
if ( nPara < mpDoc->GetNodes().Count() )
|
if ( nPara < mpDoc->CountNodes() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
if ( pNode->GetCharAttribs().Count() )
|
if ( pNode->GetCharAttribs().Count() )
|
||||||
{
|
{
|
||||||
TextCharAttribList& rAttribs = pNode->GetCharAttribs();
|
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!
|
// As TextEngine is currently intended only for TextEditors, there is no Undo for Attributes!
|
||||||
|
|
||||||
if ( nPara < mpDoc->GetNodes().Count() )
|
if ( nPara < mpDoc->CountNodes() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
|
||||||
|
|
||||||
sal_Int32 nMax = pNode->GetText().getLength();
|
sal_Int32 nMax = pNode->GetText().getLength();
|
||||||
@@ -2734,7 +2734,7 @@ void TextEngine::ValidateSelection( TextSelection& rSel ) const
|
|||||||
|
|
||||||
void TextEngine::ValidatePaM( TextPaM& rPaM ) const
|
void TextEngine::ValidatePaM( TextPaM& rPaM ) const
|
||||||
{
|
{
|
||||||
sal_uLong nMaxPara = mpDoc->GetNodes().Count() - 1;
|
sal_uLong nMaxPara = mpDoc->CountNodes() - 1;
|
||||||
if ( rPaM.GetPara() > nMaxPara )
|
if ( rPaM.GetPara() > nMaxPara )
|
||||||
{
|
{
|
||||||
rPaM.GetPara() = nMaxPara;
|
rPaM.GetPara() = nMaxPara;
|
||||||
@@ -2780,7 +2780,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
|
|||||||
TextView* pView = (*mpViews)[ --nView ];
|
TextView* pView = (*mpViews)[ --nView ];
|
||||||
if ( pView != GetActiveView() )
|
if ( pView != GetActiveView() )
|
||||||
{
|
{
|
||||||
sal_uLong nParas = mpDoc->GetNodes().Count();
|
sal_uLong nParas = mpDoc->CountNodes();
|
||||||
for ( int n = 0; n <= 1; n++ )
|
for ( int n = 0; n <= 1; n++ )
|
||||||
{
|
{
|
||||||
TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd();
|
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;
|
sal_uInt8 nRightToLeft = 0;
|
||||||
|
|
||||||
TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
|
TextNode* pNode = mpDoc->GetNode( nPara );
|
||||||
if ( pNode && !pNode->GetText().isEmpty() )
|
if ( pNode && !pNode->GetText().isEmpty() )
|
||||||
{
|
{
|
||||||
TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );
|
TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );
|
||||||
|
@@ -173,20 +173,20 @@ void TextUndoDelPara::Undo()
|
|||||||
void TextUndoDelPara::Redo()
|
void TextUndoDelPara::Redo()
|
||||||
{
|
{
|
||||||
// pNode is not valid anymore in case an Undo joined paragraphs
|
// pNode is not valid anymore in case an Undo joined paragraphs
|
||||||
mpNode = GetDoc()->GetNodes().GetObject( mnPara );
|
mpNode = GetDoc()->GetNode( mnPara );
|
||||||
|
|
||||||
delete GetTEParaPortions()->GetObject( mnPara );
|
delete GetTEParaPortions()->GetObject( mnPara );
|
||||||
GetTEParaPortions()->Remove( mnPara );
|
GetTEParaPortions()->Remove( mnPara );
|
||||||
|
|
||||||
// do not delete Node because of Undo!
|
// do not delete Node because of Undo!
|
||||||
GetDoc()->GetNodes().Remove( mnPara );
|
GetDoc()->RemoveNode( mnPara );
|
||||||
GetTextEngine()->ImpParagraphRemoved( mnPara );
|
GetTextEngine()->ImpParagraphRemoved( mnPara );
|
||||||
|
|
||||||
mbDelObject = true; // belongs again to the Undo
|
mbDelObject = true; // belongs again to the Undo
|
||||||
|
|
||||||
sal_uLong nParas = GetDoc()->GetNodes().Count();
|
sal_uLong nParas = GetDoc()->CountNodes();
|
||||||
sal_uLong n = mnPara < nParas ? mnPara : (nParas-1);
|
sal_uLong n = mnPara < nParas ? mnPara : (nParas-1);
|
||||||
TextNode* pN = GetDoc()->GetNodes().GetObject( n );
|
TextNode* pN = GetDoc()->GetNode( n );
|
||||||
TextPaM aPaM( n, pN->GetText().getLength() );
|
TextPaM aPaM( n, pN->GetText().getLength() );
|
||||||
SetSelection( aPaM );
|
SetSelection( aPaM );
|
||||||
}
|
}
|
||||||
|
@@ -735,7 +735,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
|
|||||||
aCurSel = mpImpl->mpTextEngine->ImpInsertParaBreak( aCurSel );
|
aCurSel = mpImpl->mpTextEngine->ImpInsertParaBreak( aCurSel );
|
||||||
if ( mpImpl->mbAutoIndent )
|
if ( mpImpl->mbAutoIndent )
|
||||||
{
|
{
|
||||||
TextNode* pPrev = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aCurSel.GetEnd().GetPara() - 1 );
|
TextNode* pPrev = mpImpl->mpTextEngine->mpDoc->GetNode( aCurSel.GetEnd().GetPara() - 1 );
|
||||||
sal_uInt16 n = 0;
|
sal_uInt16 n = 0;
|
||||||
while ( ( n < pPrev->GetText().getLength() ) && (
|
while ( ( n < pPrev->GetText().getLength() ) && (
|
||||||
( pPrev->GetText()[ n ] == ' ' ) ||
|
( pPrev->GetText()[ n ] == ' ' ) ||
|
||||||
@@ -858,7 +858,7 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
|
|||||||
if ( mpImpl->maSelection.GetEnd().GetIndex() < mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection.GetEnd().GetPara() ) )
|
if ( mpImpl->maSelection.GetEnd().GetIndex() < mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection.GetEnd().GetPara() ) )
|
||||||
{
|
{
|
||||||
HideSelection();
|
HideSelection();
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( mpImpl->maSelection.GetEnd().GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( mpImpl->maSelection.GetEnd().GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
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 );
|
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
|
||||||
TextSelection aNewSel( mpImpl->maSelection );
|
TextSelection aNewSel( mpImpl->maSelection );
|
||||||
@@ -897,7 +897,7 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
|
|||||||
HideSelection();
|
HideSelection();
|
||||||
TextSelection aNewSel( mpImpl->maSelection );
|
TextSelection aNewSel( mpImpl->maSelection );
|
||||||
aNewSel.GetStart().GetIndex() = 0;
|
aNewSel.GetStart().GetIndex() = 0;
|
||||||
aNewSel.GetEnd().GetIndex() = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( mpImpl->maSelection.GetEnd().GetPara() )->GetText().getLength();
|
aNewSel.GetEnd().GetIndex() = mpImpl->mpTextEngine->mpDoc->GetNode( mpImpl->maSelection.GetEnd().GetPara() )->GetText().getLength();
|
||||||
ImpSetSelection( aNewSel );
|
ImpSetSelection( aNewSel );
|
||||||
ShowSelection();
|
ShowSelection();
|
||||||
ShowCursor( true, true );
|
ShowCursor( true, true );
|
||||||
@@ -921,7 +921,7 @@ void TextView::Command( const CommandEvent& rCEvt )
|
|||||||
{
|
{
|
||||||
DeleteSelected();
|
DeleteSelected();
|
||||||
delete mpImpl->mpTextEngine->mpIMEInfos;
|
delete mpImpl->mpTextEngine->mpIMEInfos;
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( GetSelection().GetEnd().GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( GetSelection().GetEnd().GetPara() );
|
||||||
mpImpl->mpTextEngine->mpIMEInfos = new TEIMEInfos( GetSelection().GetEnd(), pNode->GetText().copy( GetSelection().GetEnd().GetIndex() ) );
|
mpImpl->mpTextEngine->mpIMEInfos = new TEIMEInfos( GetSelection().GetEnd(), pNode->GetText().copy( GetSelection().GetEnd().GetIndex() ) );
|
||||||
mpImpl->mpTextEngine->mpIMEInfos->bWasCursorOverwrite = !IsInsertMode();
|
mpImpl->mpTextEngine->mpIMEInfos->bWasCursorOverwrite = !IsInsertMode();
|
||||||
}
|
}
|
||||||
@@ -1375,7 +1375,7 @@ TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIterator
|
|||||||
|
|
||||||
if ( aPaM.GetIndex() )
|
if ( aPaM.GetIndex() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
||||||
sal_Int32 nCount = 1;
|
sal_Int32 nCount = 1;
|
||||||
aPaM.GetIndex() = (sal_uInt16)xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount );
|
aPaM.GetIndex() = (sal_uInt16)xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount );
|
||||||
@@ -1383,7 +1383,7 @@ TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIterator
|
|||||||
else if ( aPaM.GetPara() )
|
else if ( aPaM.GetPara() )
|
||||||
{
|
{
|
||||||
aPaM.GetPara()--;
|
aPaM.GetPara()--;
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
aPaM.GetIndex() = pNode->GetText().getLength();
|
aPaM.GetIndex() = pNode->GetText().getLength();
|
||||||
}
|
}
|
||||||
return aPaM;
|
return aPaM;
|
||||||
@@ -1393,14 +1393,14 @@ TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIterato
|
|||||||
{
|
{
|
||||||
TextPaM aPaM( rPaM );
|
TextPaM aPaM( rPaM );
|
||||||
|
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
|
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
|
||||||
{
|
{
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
||||||
sal_Int32 nCount = 1;
|
sal_Int32 nCount = 1;
|
||||||
aPaM.GetIndex() = (sal_uInt16)xBI->nextCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount );
|
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->CountNodes()-1) )
|
||||||
{
|
{
|
||||||
aPaM.GetPara()++;
|
aPaM.GetPara()++;
|
||||||
aPaM.GetIndex() = 0;
|
aPaM.GetIndex() = 0;
|
||||||
@@ -1415,7 +1415,7 @@ TextPaM TextView::CursorWordLeft( const TextPaM& rPaM )
|
|||||||
|
|
||||||
if ( aPaM.GetIndex() )
|
if ( aPaM.GetIndex() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
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 );
|
i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
|
||||||
if ( aBoundary.startPos >= rPaM.GetIndex() )
|
if ( aBoundary.startPos >= rPaM.GetIndex() )
|
||||||
@@ -1425,7 +1425,7 @@ TextPaM TextView::CursorWordLeft( const TextPaM& rPaM )
|
|||||||
else if ( aPaM.GetPara() )
|
else if ( aPaM.GetPara() )
|
||||||
{
|
{
|
||||||
aPaM.GetPara()--;
|
aPaM.GetPara()--;
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
aPaM.GetIndex() = pNode->GetText().getLength();
|
aPaM.GetIndex() = pNode->GetText().getLength();
|
||||||
}
|
}
|
||||||
return aPaM;
|
return aPaM;
|
||||||
@@ -1435,14 +1435,14 @@ TextPaM TextView::CursorWordRight( const TextPaM& rPaM )
|
|||||||
{
|
{
|
||||||
TextPaM aPaM( rPaM );
|
TextPaM aPaM( rPaM );
|
||||||
|
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
|
if ( aPaM.GetIndex() < pNode->GetText().getLength() )
|
||||||
{
|
{
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
||||||
i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
||||||
aPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
|
aPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
|
||||||
}
|
}
|
||||||
else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count()-1) )
|
else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->CountNodes()-1) )
|
||||||
{
|
{
|
||||||
aPaM.GetPara()++;
|
aPaM.GetPara()++;
|
||||||
aPaM.GetIndex() = 0;
|
aPaM.GetIndex() = 0;
|
||||||
@@ -1466,7 +1466,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
|
|||||||
}
|
}
|
||||||
else if ( nDelMode == DELMODE_RESTOFWORD )
|
else if ( nDelMode == DELMODE_RESTOFWORD )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aEndPaM.GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
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 );
|
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() )
|
if ( aBoundary.startPos == mpImpl->maSelection.GetEnd().GetIndex() )
|
||||||
@@ -1494,21 +1494,21 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode )
|
|||||||
}
|
}
|
||||||
else if ( nDelMode == DELMODE_RESTOFWORD )
|
else if ( nDelMode == DELMODE_RESTOFWORD )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aEndPaM.GetPara() );
|
||||||
uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator();
|
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 );
|
i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
||||||
aEndPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
|
aEndPaM.GetIndex() = (sal_uInt16)aBoundary.startPos;
|
||||||
}
|
}
|
||||||
else // DELMODE_RESTOFCONTENT
|
else // DELMODE_RESTOFCONTENT
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aEndPaM.GetPara() );
|
||||||
if ( aEndPaM.GetIndex() < pNode->GetText().getLength() )
|
if ( aEndPaM.GetIndex() < pNode->GetText().getLength() )
|
||||||
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->CountNodes() - 1 ) )
|
||||||
{
|
{
|
||||||
// next paragraph
|
// next paragraph
|
||||||
aEndPaM.GetPara()++;
|
aEndPaM.GetPara()++;
|
||||||
TextNode* pNextNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
|
TextNode* pNextNode = mpImpl->mpTextEngine->mpDoc->GetNode( aEndPaM.GetPara() );
|
||||||
aEndPaM.GetIndex() = pNextNode->GetText().getLength();
|
aEndPaM.GetIndex() = pNextNode->GetText().getLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1580,7 +1580,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
|
|||||||
if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() )
|
if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() )
|
||||||
aPaM.GetIndex()--;
|
aPaM.GetIndex()--;
|
||||||
}
|
}
|
||||||
else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1 ) ) // next paragraph
|
else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->CountNodes() - 1 ) ) // next paragraph
|
||||||
{
|
{
|
||||||
aPaM.GetPara()++;
|
aPaM.GetPara()++;
|
||||||
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
|
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
|
||||||
@@ -1638,7 +1638,7 @@ TextPaM TextView::CursorStartOfParagraph( const TextPaM& rPaM )
|
|||||||
|
|
||||||
TextPaM TextView::CursorEndOfParagraph( const TextPaM& rPaM )
|
TextPaM TextView::CursorEndOfParagraph( const TextPaM& rPaM )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( rPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( rPaM.GetPara() );
|
||||||
TextPaM aPaM( rPaM );
|
TextPaM aPaM( rPaM );
|
||||||
aPaM.GetIndex() = pNode->GetText().getLength();
|
aPaM.GetIndex() = pNode->GetText().getLength();
|
||||||
return aPaM;
|
return aPaM;
|
||||||
@@ -1652,8 +1652,8 @@ TextPaM TextView::CursorStartOfDoc()
|
|||||||
|
|
||||||
TextPaM TextView::CursorEndOfDoc()
|
TextPaM TextView::CursorEndOfDoc()
|
||||||
{
|
{
|
||||||
sal_uLong nNode = mpImpl->mpTextEngine->mpDoc->GetNodes().Count() - 1;
|
sal_uLong nNode = mpImpl->mpTextEngine->mpDoc->CountNodes() - 1;
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( nNode );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( nNode );
|
||||||
TextPaM aPaM( nNode, pNode->GetText().getLength() );
|
TextPaM aPaM( nNode, pNode->GetText().getLength() );
|
||||||
return aPaM;
|
return aPaM;
|
||||||
}
|
}
|
||||||
@@ -1712,7 +1712,7 @@ void TextView::ImpShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bSpec
|
|||||||
|
|
||||||
if ( !IsInsertMode() && !mpImpl->maSelection.HasRange() )
|
if ( !IsInsertMode() && !mpImpl->maSelection.HasRange() )
|
||||||
{
|
{
|
||||||
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
|
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNode( aPaM.GetPara() );
|
||||||
if ( !pNode->GetText().isEmpty() && ( aPaM.GetIndex() < pNode->GetText().getLength() ) )
|
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...
|
// If we are behind a portion, and the next portion has other direction, we must change position...
|
||||||
|
Reference in New Issue
Block a user