summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/texteng.hxx20
-rw-r--r--vcl/source/edit/textdoc.cxx2
-rw-r--r--vcl/source/edit/textdoc.hxx2
-rw-r--r--vcl/source/edit/texteng.cxx47
-rw-r--r--vcl/source/edit/textview.cxx12
5 files changed, 39 insertions, 44 deletions
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 47cb547e7001..d26dee78e680 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -180,11 +180,11 @@ protected:
bool CreateLines( sal_uLong nPara );
void CreateAndInsertEmptyLine( sal_uLong nPara );
- void ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth );
- sal_uInt16 SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos );
- void CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos );
- void RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars );
- void SeekCursor( sal_uLong nNode, sal_uInt16 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
+ void ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth );
+ sal_uInt16 SplitTextPortion( sal_uLong nPara, sal_Int32 nPos );
+ void CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos );
+ void RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, short nNewChars );
+ void SeekCursor( sal_uLong nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
void FormatDoc();
void FormatFullDoc();
@@ -196,20 +196,20 @@ protected:
bool IsFormatted() const { return mbFormatted; }
- sal_uInt16 GetCharPos( sal_uLong nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false );
+ sal_Int32 GetCharPos( sal_uLong nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false );
Rectangle GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bPreferPortionStart = false );
sal_uInt16 ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, bool bSmart );
long ImpGetPortionXOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nTextPortion );
- long ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false );
- long ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, sal_uInt16 nIndex2 );
- sal_uInt8 ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL );
+ long ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false );
+ long ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 );
+ sal_uInt8 ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL );
static void ImpInitLayoutMode( OutputDevice* pOutDev, bool bDrawingR2LPortion = false );
TxtAlign ImpGetAlign() const;
sal_uLong CalcTextHeight();
sal_uLong CalcParaHeight( sal_uLong nParagraph ) const;
sal_uLong CalcTextWidth( sal_uLong nPara );
- sal_uLong CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart, sal_uInt16 nPortionLen, const vcl::Font* pFont = 0 );
+ sal_uLong CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 );
Range GetInvalidYOffsets( sal_uLong nPortion );
// for Undo/Redo
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 040f8a30cdfb..f3d2cd19f9d0 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -123,7 +123,7 @@ bool TextCharAttribList::HasAttrib( sal_uInt16 nWhich ) const
return false;
}
-bool TextCharAttribList::HasBoundingAttrib( sal_uInt16 nBound )
+bool TextCharAttribList::HasBoundingAttrib( sal_Int32 nBound )
{
for (TextCharAttribs::reverse_iterator it = maAttribs.rbegin(); it != maAttribs.rend(); ++it)
{
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 72c7eb18443c..1efecf9fb425 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -57,7 +57,7 @@ public:
const TextCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos, sal_Int32 nMaxPos = SAL_MAX_INT32 ) const;
TextCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos );
bool HasAttrib( sal_uInt16 nWhich ) const;
- bool HasBoundingAttrib( sal_uInt16 nBound );
+ bool HasBoundingAttrib( sal_Int32 nBound );
};
class TextNode
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index e8fb5b9e430e..5247a2ba7881 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -929,7 +929,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP
return aEditCursor;
}
-long TextEngine::ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart )
+long TextEngine::ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart )
{
DBG_ASSERT( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "ImpGetXPos: Bad parameters!" );
@@ -1072,7 +1072,7 @@ sal_uInt16 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara
DBG_ASSERT( IsFormatted(), "GetPaM: Not formatted" );
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
- sal_uInt16 nCurIndex = 0;
+ sal_Int32 nCurIndex = 0;
long nY = 0;
TextLine* pLine = 0;
@@ -1097,18 +1097,18 @@ sal_uInt16 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara
{
uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator();
sal_Int32 nCount = 1;
- nCurIndex = (sal_uInt16)xBI->previousCharacters( pPortion->GetNode()->GetText(), nCurIndex, GetLocale(), i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
+ nCurIndex = xBI->previousCharacters( pPortion->GetNode()->GetText(), nCurIndex, GetLocale(), i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
}
return nCurIndex;
}
-sal_uInt16 TextEngine::GetCharPos( sal_uLong nPortion, sal_uInt16 nLine, long nXPos, bool )
+sal_Int32 TextEngine::GetCharPos( sal_uLong nPortion, sal_uInt16 nLine, long nXPos, bool )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
TextLine& pLine = pPortion->GetLines()[ nLine ];
- sal_uInt16 nCurIndex = pLine.GetStart();
+ sal_Int32 nCurIndex = pLine.GetStart();
long nTmpX = pLine.GetStartX();
if ( nXPos <= nTmpX )
@@ -1208,7 +1208,7 @@ sal_uLong TextEngine::CalcTextHeight()
return nY;
}
-sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart, sal_uInt16 nLen, const vcl::Font* pFont )
+sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont )
{
#ifdef DBG_UTIL
// within the text there must not be a Portion change (attribute/tab)!
@@ -1382,7 +1382,7 @@ TextPaM TextEngine::ConnectContents( sal_uLong nLeftNode )
return ImpConnectParagraphs( nLeftNode, nLeftNode+1 );
}
-void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, vcl::Font& rFont, OutputDevice* pOutDev )
+void TextEngine::SeekCursor( sal_uLong nPara, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev )
{
rFont = maFont;
if ( pOutDev )
@@ -1652,7 +1652,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_Int32 nPortionStart, long nRemainingWidth )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
@@ -1702,7 +1702,7 @@ void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*,
pLine->SetEndPortion( nEndPortion );
}
-sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos )
+sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_Int32 nPos )
{
// the Portion at nPos is being split, unless there is already a switch at nPos
@@ -1710,14 +1710,14 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos )
return 0;
sal_uInt16 nSplitPortion;
- sal_uInt16 nTmpPos = 0;
+ sal_Int32 nTmpPos = 0;
TETextPortion* pTextPortion = 0;
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
- sal_uInt16 nPortions = pTEParaPortion->GetTextPortions().size();
+ const sal_uInt16 nPortions = pTEParaPortion->GetTextPortions().size();
for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ )
{
TETextPortion* pTP = pTEParaPortion->GetTextPortions()[nSplitPortion];
- nTmpPos = nTmpPos + pTP->GetLen();
+ nTmpPos += pTP->GetLen();
if ( nTmpPos >= nPos )
{
if ( nTmpPos == nPos ) // nothing needs splitting
@@ -1729,7 +1729,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos )
DBG_ASSERT( pTextPortion, "SplitTextPortion: position outside of region!" );
- sal_uInt16 nOverlapp = nTmpPos - nPos;
+ const sal_Int32 nOverlapp = nTmpPos - nPos;
pTextPortion->GetLen() = pTextPortion->GetLen() - nOverlapp;
TETextPortion* pNewPortion = new TETextPortion( nOverlapp );
pTEParaPortion->GetTextPortions().insert( pTEParaPortion->GetTextPortions().begin() + nSplitPortion + 1, pNewPortion );
@@ -1738,7 +1738,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos )
return nSplitPortion;
}
-void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos )
+void TextEngine::CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
TextNode* pNode = pTEParaPortion->GetNode();
@@ -1786,16 +1786,16 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos )
// Delete starting with...
// Unfortunately, the number of TextPortions does not have to be
// equal to aPositions.Count(), because of linebreaks
- sal_uInt16 nPortionStart = 0;
+ sal_Int32 nPortionStart = 0;
sal_uInt16 nInvPortion = 0;
sal_uInt16 nP;
for ( nP = 0; nP < pTEParaPortion->GetTextPortions().size(); nP++ )
{
TETextPortion* pTmpPortion = pTEParaPortion->GetTextPortions()[nP];
- nPortionStart = nPortionStart + pTmpPortion->GetLen();
+ nPortionStart += pTmpPortion->GetLen();
if ( nPortionStart >= nStartPos )
{
- nPortionStart = nPortionStart - pTmpPortion->GetLen();
+ nPortionStart -= pTmpPortion->GetLen();
nInvPortion = nP;
break;
}
@@ -1831,7 +1831,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos )
OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "CreateTextPortions: No Portions?!");
}
-void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars )
+void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, short nNewChars )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "RecalcTextPortion: no Portions!");
@@ -1871,8 +1871,7 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short
else
{
sal_uInt16 nPortionStart;
- const sal_uInt16 nTP = pTEParaPortion->GetTextPortions().
- FindPortion( nStartPos, nPortionStart );
+ const sal_uInt16 nTP = pTEParaPortion->GetTextPortions().FindPortion( nStartPos, nPortionStart );
TETextPortion* const pTP = pTEParaPortion->GetTextPortions()[ nTP ];
DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found!" );
pTP->GetLen() = pTP->GetLen() + nNewChars;
@@ -1887,8 +1886,8 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short
// There must be no Portion reaching into or starting within,
// thus: nStartPos <= nPos <= nStartPos - nNewChars(neg.)
size_t nPortion = 0;
- sal_uInt16 nPos = 0;
- sal_uInt16 nEnd = nStartPos-nNewChars;
+ sal_Int32 nPos = 0;
+ sal_Int32 nEnd = nStartPos-nNewChars;
const size_t nPortions = pTEParaPortion->GetTextPortions().size();
TETextPortion* pTP = 0;
for ( nPortion = 0; nPortion < nPortions; nPortion++ )
@@ -2934,7 +2933,7 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara )
}
-sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16* pStart, sal_uInt16* pEnd )
+sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_uInt16* pStart, sal_uInt16* pEnd )
{
sal_uInt8 nRightToLeft = 0;
@@ -3056,7 +3055,7 @@ TxtAlign TextEngine::ImpGetAlign() const
return eAlign;
}
-long TextEngine::ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, sal_uInt16 nIndex2 )
+long TextEngine::ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 8b8fca39ff85..a218141966e8 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1520,8 +1520,7 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM )
sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
if ( nLine ) // same paragraph
{
- sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine-1, nX );
- aPaM.GetIndex() = nCharPos;
+ aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine-1, nX );
// If we need to go to the end of a line that was wrapped automatically,
// the cursor ends up at the beginning of the 2nd line
// Problem: Last character of an automatically wrapped line = Cursor
@@ -1534,8 +1533,7 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM )
aPaM.GetPara()--;
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
sal_uInt16 nL = pPPortion->GetLines().size() - 1;
- sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), nL, nX+1 );
- aPaM.GetIndex() = nCharPos;
+ aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), nL, nX+1 );
}
return aPaM;
@@ -1558,8 +1556,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
if ( nLine < ( pPPortion->GetLines().size() - 1 ) )
{
- sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX );
- aPaM.GetIndex() = nCharPos;
+ aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX );
// special case CursorUp
TextLine& pLine = pPPortion->GetLines()[ nLine + 1 ];
@@ -1570,8 +1567,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
{
aPaM.GetPara()++;
pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
- sal_uInt16 nCharPos = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), 0, nX+1 );
- aPaM.GetIndex() = nCharPos;
+ aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), 0, nX+1 );
TextLine& pLine = pPPortion->GetLines().front();
if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && ( pPPortion->GetLines().size() > 1 ) )
--aPaM.GetIndex();